microsoft / microsoft/monaco-editor

[Bug] Paste does not work with Electron 34

Open
#4,855 7 comments 8 reactions 2 assignees View on GitHub

@deepak1556 is already working on this.

Since Sep 9, 2025.

bug editor-clipboard
Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.