From 3aa9204e574c84962806acf271396c095eda8e2b Mon Sep 17 00:00:00 2001 From: Zankio Date: Sat, 23 Apr 2016 23:26:40 +0800 Subject: [PATCH] Fix Esc in Vim mode --- public/js/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/public/js/index.js b/public/js/index.js index f38e2ba..26c1ed6 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -5,13 +5,14 @@ var defaultExtraKeys = { cm.setOption("fullScreen", !cm.getOption("fullScreen")); }, "Esc": function(cm) { - if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false); + if (cm.getOption('keyMap').substr(0, 3) === 'vim') return CodeMirror.Pass; + else if(cm.getOption("fullScreen")) cm.setOption("fullScreen", false); }, "Cmd-S": function () { - return CodeMirror.PASS + return CodeMirror.Pass }, "Ctrl-S": function () { - return CodeMirror.PASS + return CodeMirror.Pass }, "Enter": "newlineAndIndentContinueMarkdownList", "Tab": function(cm) { @@ -2928,4 +2929,4 @@ $(editor.getInputField()) $(this).data('autocompleting', false); editor.setOption("extraKeys", defaultExtraKeys); } - }); \ No newline at end of file + });