Skip to content

Commit

Permalink
wip: work on #3484 -- removing focus on esc.
Browse files Browse the repository at this point in the history
  • Loading branch information
cramakri committed Jul 29, 2019
1 parent b39a344 commit 1bb0fd9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/console/src/widget.ts
Expand Up @@ -613,6 +613,23 @@ export class CodeConsole extends Widget {
if (event.keyCode === 13 && !editor.hasFocus()) {
event.preventDefault();
editor.focus();
} else if (event.keyCode === 27 && editor.hasFocus()) {
// Set to command mode;
event.preventDefault();
editor.blur();
// TODO Need to figure out what needs to happen for keyboard shortcuts to work
// this._content.node.focus();
// this._content.widgets[0].node.focus()
// this._banner.node.focus();
// this._banner.activate();
// console.log(this._banner.node);

// Hack to prevent CodeMirror from resetting focus on this widget
let codeMirror: any = (editor as any)['_editor'];
codeMirror.options.readOnly = 'nocursor';
window.setTimeout(() => {
codeMirror.options.readOnly = false;
}, 100);
}
}

Expand Down

0 comments on commit 1bb0fd9

Please sign in to comment.