Skip to content

Commit

Permalink
Merge pull request #105 from CodinGame/fix-map-clipboard
Browse files Browse the repository at this point in the history
Fix map clipboard
  • Loading branch information
CGNonofr authored Feb 27, 2024
2 parents a39d289 + cf293d6 commit e95f527
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions src/tools.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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('copy')
},
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') {
Expand Down

0 comments on commit e95f527

Please sign in to comment.