@@ -181 +183 @@ class ExecCommandPasteAction extends ExecCommandAction {
@@ -181 +185 @@ class ExecCommandPasteAction extends ExecCommandAction {
- precondition: EditorContextKeys.writable,
+ precondition: (require('vs/platform/contextkey/common/contextkey') as typeof import('vs/platform/contextkey/common/contextkey')).ContextKeyExpr.and(EditorContextKeys.writable, workbench.clipboardContextKey),
@@ -191 +193,2 @@ class ExecCommandPasteAction extends ExecCommandAction {
@@ -191 +195,2 @@ class ExecCommandPasteAction extends ExecCommandAction {
- order: 3
+ order: 3,
+ when: workbench.clipboardContextKey,
@@ -194,0 +198,14 @@ class ExecCommandPasteAction extends ExecCommandAction {
@@ -194,0 +200,26 @@ class ExecCommandPasteAction extends ExecCommandAction {
+
+ public async run(accessor, editor: ICodeEditor): Promise<void> {
+ if (editor instanceof (require('vs/editor/browser/widget/codeEditorWidget') as typeof import('vs/editor/browser/widget/codeEditorWidget')).CodeEditorWidget) {
+ try {
+ editor.trigger('', (require('vs/editor/common/editorCommon') as typeof import ('vs/editor/common/editorCommon')).Handler.Paste, {
+ text: await (require('vs/../../../../packages/vscode/src/workbench') as typeof import ('vs/../../../../packages/vscode/src/workbench')).workbench.clipboardText,
+ editor.focus();
+ const textInput = document.activeElement! as HTMLTextAreaElement;
+ const dataTransfer = new DataTransfer();
+ const value = await clipboard.readText();
+ dataTransfer.setData("text/plain", value);
+ const pasteEvent = new ClipboardEvent("paste", {
+ clipboardData: dataTransfer,
+ });
+ textInput.dispatchEvent(pasteEvent);
+ } catch (ex) {
+ super.run(accessor, editor);
+ try {
+ editor.trigger('', (require('vs/editor/common/editorCommon') as typeof import ('vs/editor/common/editorCommon')).Handler.Paste, {
+ text: await (require('vs/../../../../packages/vscode/src/workbench') as typeof import ('vs/../../../../packages/vscode/src/workbench')).workbench.clipboardText,