Merge pull request #225457 from mjbvz/yodelling-flyingfish

Enable copy paste api for readonly editors
This commit is contained in:
Matt Bierner
2024-08-13 09:59:55 -07:00
committed by GitHub
@@ -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<void> {
@@ -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;
}