mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
[Peek][PreviewPane]Show Copy entry in right-click copy menu (#33845)
## Summary of the Pull Request Fixes two bugs: - Peek: Missing "Copy" menu-item for all WebView2 previewers. - PreviewPane: Missing "Copy" menu-item for markdown files only. ## Detailed Description of the Pull Request / Additional comments The issues are: - Peek: - When not using Monaco (markdown, html) - the default WebView2 context menu has been disabled. I have enabled it and then disabled ALL menu-items other than "Copy" (such as "Back"). - When using Monaco + Release (other code files) - current code tries to use the Monaco context menu, but it is somehow disabled at runtime. I spent MANY hours trying to find out why but without success. It works fine when I view the generated html + js files in a browser or in a Debug build or in PreviewPane. But I couldn't find the root cause. Trying to fix it by enabling the WebView2 context menu instead doesn't work as for whatever reason, WebView2 doesn't generate a "Copy" menu-item (it thinks there's no selected text when there is). So in this case, the only thing I could get to work was generating context menu-items via WebView2 callbacks that call JS functions. As a bonus, this way of doing it also allows "Toggle text wrapping" to work. - PreviewPane: - Markdown - the default WebView2 context menu has been disabled. Like for Peek, I have enabled it and then disabled ALL menu-items other than "Copy" (such as "Back"). - Monaco (other code files) - this already just works fine, so I've left it as is. I *could* make it work the same way as I've done for Peek for consistency, but I've chosen to leave it as is since it works.  
This commit is contained in:
@@ -318,4 +318,12 @@
|
||||
<value>Length: {0}</value>
|
||||
<comment>{0} is the duration of the audio read from file metadata</comment>
|
||||
</data>
|
||||
<data name="ContextMenu_Copy" xml:space="preserve">
|
||||
<value>Copy</value>
|
||||
<comment>Copy selected text to clipboard</comment>
|
||||
</data>
|
||||
<data name="ContextMenu_ToggleTextWrapping" xml:space="preserve">
|
||||
<value>Toggle text wrapping</value>
|
||||
<comment>Toggle whether text in pane is word-wrapped</comment>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user