未验证 提交 90856c1b 编写于 作者: A Alex Dima

Add fallback keybinding rules for cmd+x, cmd+c and cmd+v on the mac to trigger...

Add fallback keybinding rules for cmd+x, cmd+c and cmd+v on the mac to trigger cut, copy and paste by default (in all contexts).

fixes #83412
上级 32a529d1
......@@ -3,5 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import './inputClipboardActions';
import './sleepResumeRepaintMinimap';
import './selectionClipboard';
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
import * as platform from 'vs/base/common/platform';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
if (platform.isMacintosh) {
// On the mac, cmd+x, cmd+c and cmd+v do not result in cut / copy / paste
// We therefore add a basic keybinding rule that invokes document.execCommand
// This is to cover <input>s...
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'execCut',
primary: KeyMod.CtrlCmd | KeyCode.KEY_X,
handler: bindExecuteCommand('cut'),
weight: 0,
when: undefined,
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'execCopy',
primary: KeyMod.CtrlCmd | KeyCode.KEY_C,
handler: bindExecuteCommand('copy'),
weight: 0,
when: undefined,
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'execPaste',
primary: KeyMod.CtrlCmd | KeyCode.KEY_V,
handler: bindExecuteCommand('paste'),
weight: 0,
when: undefined,
});
function bindExecuteCommand(command: 'cut' | 'copy' | 'paste') {
return () => {
document.execCommand(command);
};
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册