diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2015-11-18 18:39:25 +0100 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2015-11-18 18:39:25 +0100 |
commit | e92caf57bbad2af886b48d8ff82d8fece214b783 (patch) | |
tree | 29d097ca936dd9ddd982f17a97120ca8e48cc9af /js/codeq/editor.js | |
parent | 4ff70466bf0fea1fa91c130e3864868459bfbe9e (diff) |
Escape from editor using the escape key
Diffstat (limited to 'js/codeq/editor.js')
-rw-r--r-- | js/codeq/editor.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/js/codeq/editor.js b/js/codeq/editor.js index 27296d5..2f8476c 100644 --- a/js/codeq/editor.js +++ b/js/codeq/editor.js @@ -1,4 +1,4 @@ -codeq.makeEditor = function (elt, options) { +codeq.makeEditor = function (elt, options, onEscape) { var statusBar = $(elt).siblings(".block-statusbar")[0], updateStatusBar = function (pos) { statusBar.innerHTML = 'line ' + (pos.line+1) + ', column ' + (pos.ch+1); @@ -8,6 +8,8 @@ codeq.makeEditor = function (elt, options) { lineNumbers: true, matchBrackets: true, extraKeys: { + // allow a custom function to escape the editor (there is no blur) + 'Esc': onEscape || CodeMirror.Pass, // replace tabs with spaces 'Tab': function (cm) { var spaces = Array(cm.getOption("indentUnit") + 1).join(" "); |