defocus codemirror on Esc
This commit is contained in:
parent
60a5fb96be
commit
fb29638d00
|
@ -27,6 +27,7 @@
|
||||||
keyMap: prefs.get('editor.keyMap'),
|
keyMap: prefs.get('editor.keyMap'),
|
||||||
extraKeys: Object.assign(CodeMirror.defaults.extraKeys || {}, {
|
extraKeys: Object.assign(CodeMirror.defaults.extraKeys || {}, {
|
||||||
// independent of current keyMap
|
// independent of current keyMap
|
||||||
|
'Esc': 'defocusEditor',
|
||||||
'Alt-Enter': 'toggleStyle',
|
'Alt-Enter': 'toggleStyle',
|
||||||
'Alt-PageDown': 'nextEditor',
|
'Alt-PageDown': 'nextEditor',
|
||||||
'Alt-PageUp': 'prevEditor'
|
'Alt-PageUp': 'prevEditor'
|
||||||
|
|
|
@ -13,6 +13,7 @@ onDOMscriptReady('/codemirror.js').then(() => {
|
||||||
save,
|
save,
|
||||||
toggleStyle,
|
toggleStyle,
|
||||||
jumpToLine,
|
jumpToLine,
|
||||||
|
defocusEditor,
|
||||||
nextEditor, prevEditor,
|
nextEditor, prevEditor,
|
||||||
find, findNext, findPrev, replace, replaceAll,
|
find, findNext, findPrev, replace, replaceAll,
|
||||||
};
|
};
|
||||||
|
@ -155,6 +156,10 @@ onDOMscriptReady('/codemirror.js').then(() => {
|
||||||
return this.display.wrapper.parentNode;
|
return this.display.wrapper.parentNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function defocusEditor(cm) {
|
||||||
|
cm.display.input.blur();
|
||||||
|
}
|
||||||
|
|
||||||
function nextEditor(cm) {
|
function nextEditor(cm) {
|
||||||
return nextPrevEditor(cm, 1);
|
return nextPrevEditor(cm, 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user