monacoEditor自定义快捷键

尹晟
2023-12-01
this.editor.addAction({
    id: "save",
    label: "save",
    keybindings: [
      monaco.KeyMod.chord(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_S),
    ],
    run: saveEditor,//方法
  });
saveEditor() {
  console.log(1)
};

monaco.KeyMod.chord(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_S)代表ctrl+s

 类似资料: