-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Preview Pane (Monaco): Experimental Fix Attempt for Ctrl+C Copy Failure (#36474) #44093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@VadiMIM11 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Summary of the Pull Request
This PR introduces an experimental fix attempt for clipboard copy (Ctrl + C) not working in Monaco-based File Explorer Preview (Issue #36474).
Our team investigated the interaction between Monaco Editor, WebView2, and the WinForms hosting layer used in PowerToys Preview Handlers. We identified that clipboard hotkeys were not propagated correctly from WebView2 to Monaco, resulting in Office reporting: "Clipboard item not collected: Format not supported by Office Clipboard."
As a mitigation attempt, we added a WebView2 KeyDown handler that explicitly forwards
Ctrl+Cto Monaco via a JavaScriptrunCopyCommand()call.Although the fix passed existing tests, it caused Monaco-based previews to stop working on our local development environment. Even after restoring to a clean installation of PowerToys, Monaco previews remained unresponsive.
Because of that, this PR is not a final fix, but instead contributes investigation results, hypotheses, and a minimal reproducible implementation that future contributors can build on.
We hope that this work will accelerate root-cause diagnosis by maintainers familiar with the Monaco/WebView2 integration layer.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Root Cause Investigation
Based on our testing and review of the following PowerToys documentation:
FilePreviewCommon.mdarchitecture (Preview Handler pipeline)monaco-editor.md)We believe the problem occurs in the boundary between WinForms → WebView2 → Monaco Editor.
Our primary hypotheses:
e.Handled = true) in WinForms or WebView2 may prevent normal copy event propagation.Code Changes Introduced
To test hypothesis #1 and #2, we added a fallback override that captures Ctrl + C at the WebView2 layer and explicitly executes Monaco’s internal copy command via injected JavaScript:
Results
Because of these unintended consequences, this PR is not intended to be merged as-is but as a contribution of debugging context and a minimal code example for further investigation by maintainers.
Validation Steps Performed
Additional Notes
We encourage deeper investigation from contributors familiar with:
We hope this contribution accelerates root cause analysis for #36474.