From db90143e7a2f51ca314d43c5cc76e8b706164310 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 12 Aug 2024 17:25:31 -0700 Subject: [PATCH] Enable copy paste api for readonly editors For readonly editors we still should run out copy handler (but not the paste handlers) --- .../contrib/dropOrPasteInto/browser/copyPasteController.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.ts b/src/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.ts index 3406894faa7..1203f86cdfb 100644 --- a/src/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.ts +++ b/src/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.ts @@ -135,8 +135,7 @@ export class CopyPasteController extends Disposable implements IEditorContributi } private isPasteAsEnabled(): boolean { - return this._editor.getOption(EditorOption.pasteAs).enabled - && !this._editor.getOption(EditorOption.readOnly); + return this._editor.getOption(EditorOption.pasteAs).enabled; } public async finishedPaste(): Promise { @@ -246,8 +245,8 @@ export class CopyPasteController extends Disposable implements IEditorContributi } if ( - !this.isPasteAsEnabled() - && !this._pasteAsActionContext // Still enable if paste as was explicitly requested + this._editor.getOption(EditorOption.readOnly) // Never enabled if editor is readonly. + || (!this.isPasteAsEnabled() && !this._pasteAsActionContext) // Or feature disabled (but still enable if paste was explicitly requested) ) { return; }