File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -527,6 +527,13 @@ export default {
527527 * Execute a keyboard shortcut, when applicable
528528 */
529529 shortcut (e ) {
530+ // Handle ESC to blur/unfocus the editor
531+ if (e .keyCode === 27 ) {
532+ e .preventDefault ();
533+ this .codemirror .getInputField ().blur ();
534+ return ;
535+ }
536+
530537 const mod = e .metaKey || e .ctrlKey ;
531538 if (! mod) return ;
532539
Original file line number Diff line number Diff line change @@ -139,6 +139,14 @@ function initCodeMirror() {
139139
140140 codemirror .value .on (' focus' , () => emit (' focus' ));
141141 codemirror .value .on (' blur' , () => emit (' blur' ));
142+
143+ codemirror .value .on (' keydown' , (cm , e ) => {
144+ // Handle ESC to blur/unfocus the editor
145+ if (e .keyCode === 27 ) {
146+ e .preventDefault ();
147+ codemirror .value .getInputField ().blur ();
148+ }
149+ });
142150}
143151
144152watch (
You can’t perform that action at this time.
0 commit comments