microsoft / microsoft/monaco-editor

[Bug] : Editor allows ctrl+v to paste but disables when using context menu paste option.

Open
#4,069 1 comment 0 reactions 1 assignee View on GitHub

@mjbvz is already working on this.

Since Jul 10, 2023.

bug
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

https://microsoft.github.io/monaco-editor/playground.html?source=v0.40.0#XQAAAAKZAQAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscwztL3RgmSaumWUF-TBOsVJ4S4FwfCDQb5-2uUHXTVAefbVSd9IzaZ_vv9VR9KugsKimARHSWlrTPOQHROITHxmAeFEs9_m3VHdSe7_Etv6Wpgzto0GSqI-Jbjpg6g3FsuE6sHNUsN9V6wL_ETQPRnm_0aVo0fnziUFXcOKdl1dN60w7lo6ksZk1GRLNRnJzi9yrBvdxj-pa6H0kcgR-V1FdTlNpR7fWF7jGnobpdtU4tU4Ok5mfapbCHRX_5CfbVQlilb4b4QPhbGF5wSQdSxStmNDURCQPPKXXN6-iGReKsXwlrZXF1IfthvhSOF2m1G9p67XrkF8_-693Eg

Monaco Editor Playground Code
const value = /* set from `myEditor.getModel()`: */ `function hello() {
	alert('Hello world!');
	alert('Hello world!');
}`;

// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
	value,
	language: "javascript",
	automaticLayout: true,
	pasteAs: {
		enabled: false,
	},

});
Reproduction Steps

Just visited this doc link: https://microsoft.github.io/monaco-editor/docs.html#interfaces/editor.IEditorOptions.html#pasteAs
and added in the code but it is not working correctly. I want to disable paste option using ctrl+v

Actual (Problematic) Behavior

Context menu paste option is disabled after using
pasteAs: { enabled: false, },
but ctrl+v is pasting content as usual

Expected Behavior

It should disable all types of pasting e.g. ctrl+v, context menu paste option, etc...

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.