Skip to content

[Bug] Paste does not work with Electron 34 #4855

@dex4er

Description

@dex4er

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

I see the Paste option in context menu. However it doesn't work. The same for ctrl-v or cmd-v.

Tested in application that uses Electron 34.3.3

After I added extra debug to the clipboard.js I see const result = focusedEditor.getContainerDomNode().ownerDocument.execCommand('paste'); returns false.

It is because actually this command doesn't work in Electron and probably import { clipboard } from "electron"; clipboard.readText() should be used instead.

Unfortunately, if result is false, the alternative code works only if (platform.isWeb) so not in Electron.

I think newer vscode has this logic fixed but 0.52.2 version stuck with older vscode.

Monaco Editor Playground Code

Reproduction Steps

No response

Actual (Problematic) Behavior

No response

Expected Behavior

No response

Additional Context

No response

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions