diff --git a/edit/codemirror-default.js b/edit/codemirror-default.js index 3a619cc3..02fdc676 100644 --- a/edit/codemirror-default.js +++ b/edit/codemirror-default.js @@ -27,6 +27,7 @@ keyMap: prefs.get('editor.keyMap'), extraKeys: Object.assign(CodeMirror.defaults.extraKeys || {}, { // independent of current keyMap + 'Esc': 'defocusEditor', 'Alt-Enter': 'toggleStyle', 'Alt-PageDown': 'nextEditor', 'Alt-PageUp': 'prevEditor' diff --git a/edit/codemirror-editing-hooks.js b/edit/codemirror-editing-hooks.js index d8af16d0..996a8a92 100644 --- a/edit/codemirror-editing-hooks.js +++ b/edit/codemirror-editing-hooks.js @@ -13,6 +13,7 @@ onDOMscriptReady('/codemirror.js').then(() => { save, toggleStyle, jumpToLine, + defocusEditor, nextEditor, prevEditor, find, findNext, findPrev, replace, replaceAll, }; @@ -155,6 +156,10 @@ onDOMscriptReady('/codemirror.js').then(() => { return this.display.wrapper.parentNode; } + function defocusEditor(cm) { + cm.display.input.blur(); + } + function nextEditor(cm) { return nextPrevEditor(cm, 1); }