diff --git a/packages/grafana-ui/src/components/Monaco/CodeEditor.tsx b/packages/grafana-ui/src/components/Monaco/CodeEditor.tsx index ef5819b74c7..3efcfba0782 100644 --- a/packages/grafana-ui/src/components/Monaco/CodeEditor.tsx +++ b/packages/grafana-ui/src/components/Monaco/CodeEditor.tsx @@ -99,7 +99,14 @@ class UnthemedCodeEditor extends PureComponent { this.getEditorValue = () => editor.getValue(); - editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, this.onSave); + // Save when pressing Ctrl+S or Cmd+S + editor.onKeyDown((e: monacoType.IKeyboardEvent) => { + if (e.keyCode === monaco.KeyCode.KeyS && (e.ctrlKey || e.metaKey)) { + e.preventDefault(); + this.onSave(); + } + }); + const languagePromise = this.loadCustomLanguage(); if (onEditorDidMount) {