From cc6bd02da9f12452381d926d6b1a8ca7dd1bb32a Mon Sep 17 00:00:00 2001 From: mxd <838425805@qq.com> Date: Fri, 13 Aug 2021 21:36:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=BC=E5=BC=8F=E5=8C=96?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E9=94=AE=E4=B8=BA`Ctrl+Alt+L`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../console/src/components/editor/magic-script-editor.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/magic-editor/src/console/src/components/editor/magic-script-editor.vue b/magic-editor/src/console/src/components/editor/magic-script-editor.vue index c233fea7..5e41bbdf 100644 --- a/magic-editor/src/console/src/components/editor/magic-script-editor.vue +++ b/magic-editor/src/console/src/components/editor/magic-script-editor.vue @@ -74,6 +74,7 @@ import {Parser} from '@/scripts/parsing/parser.js' import tokenizer from '@/scripts/parsing/tokenizer.js' import {TokenStream} from '@/scripts/parsing/index.js' import RequestParameter from '@/scripts/editor/request-parameter.js'; +import { CommandsRegistry } from 'monaco-editor/esm/vs/platform/commands/common/commands' export default { name: 'MagicScriptEditor', @@ -131,6 +132,11 @@ export default { }, '!findWidgetVisible && !inreferenceSearchEditor && !editorHasSelection' ) + this.editor._standaloneKeybindingService.addDynamicKeybinding(`-editor.action.formatDocument`, undefined, () => {}) + const { handler, when } = CommandsRegistry.getCommand('editor.action.formatDocument') ?? {} + if (handler) { + this.editor._standaloneKeybindingService.addDynamicKeybinding('editor.action.formatDocument', monaco.KeyMod.CtrlCmd | monaco.KeyMod.Alt | monaco.KeyCode.KEY_L, handler, when) + } this.editor.onMouseDown(e => { if (e.target.element.classList.contains('codicon')) { return