mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 12:44:10 -06:00
CodeEditor: Save with Ctrl+S via onKeyDown instead of addCommand (#68955)
Change addCommand to onKeyDown
This commit is contained in:
parent
f22d1d14a0
commit
25b89babac
@ -99,7 +99,14 @@ class UnthemedCodeEditor extends PureComponent<Props> {
|
|||||||
|
|
||||||
this.getEditorValue = () => editor.getValue();
|
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();
|
const languagePromise = this.loadCustomLanguage();
|
||||||
|
|
||||||
if (onEditorDidMount) {
|
if (onEditorDidMount) {
|
||||||
|
Loading…
Reference in New Issue
Block a user