defocus codemirror on Esc

This commit is contained in:
tophf 2017-12-11 08:32:27 +03:00
parent 60a5fb96be
commit fb29638d00
2 changed files with 6 additions and 0 deletions

View File

@ -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'

View File

@ -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);
}