From 4676eaeda4373b924efa20864b00fbebcb5b0b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Tue, 27 Feb 2024 18:59:46 +0100 Subject: [PATCH 1/2] fix: wrong command --- src/tools.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools.ts b/src/tools.ts index cf8a5db..26498fc 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -516,7 +516,7 @@ export function mapClipboard ( weight: 1000, handler: () => { copiedText = editor.getModel()!.getValueInRange(editor.getSelection()!) - document.execCommand('copy') + document.execCommand('cut') }, when: ContextKeyExpr.equals('editorId', editor.getId()), primary: monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyX From cf293d619ae72a5ca903e5effe5550f711961664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Tue, 27 Feb 2024 19:00:07 +0100 Subject: [PATCH 2/2] cleanup: remove useless deprecated code --- src/tools.ts | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/src/tools.ts b/src/tools.ts index 26498fc..20fcfbf 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -1,5 +1,5 @@ import * as monaco from 'monaco-editor' -import { ContextKeyExpr, DisposableStore, KeybindingsRegistry } from 'vscode/monaco' +import { DisposableStore } from 'vscode/monaco' interface PastePayload { text: string @@ -497,32 +497,6 @@ export function mapClipboard ( const disposableStore = new DisposableStore() let copiedText = '' - disposableStore.add( - KeybindingsRegistry.registerCommandAndKeybindingRule({ - id: 'customCopy', - weight: 1000, - handler: () => { - copiedText = editor.getModel()!.getValueInRange(editor.getSelection()!) - document.execCommand('copy') - }, - when: ContextKeyExpr.equals('editorId', editor.getId()), - primary: monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyC - }) - ) - - disposableStore.add( - KeybindingsRegistry.registerCommandAndKeybindingRule({ - id: 'customCut', - weight: 1000, - handler: () => { - copiedText = editor.getModel()!.getValueInRange(editor.getSelection()!) - document.execCommand('cut') - }, - when: ContextKeyExpr.equals('editorId', editor.getId()), - primary: monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyX - }) - ) - const originalTrigger = editor.trigger editor.trigger = function (source, handlerId, payload) { if (handlerId === 'editor.action.clipboardCopyAction') {