From 9c77e9d7f0fbf48d8f8462b0020801c7878d1901 Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Sat, 24 Feb 2018 21:03:12 +0100 Subject: Allow the usage of the esc-key by codemirror This change allows all input modes of codemirror to use the information from an input esc-key and make this way vim and sublime more functional. To prevent this change from breaking the return from the fullscreen mode, it catches the esc-key in this case. Hopefully this is an acceptable solution. As before the vim-mode is handled different in fulltext-mode as it is esc-key heavy. Signed-off-by: Sheogorath --- public/js/lib/editor/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'public/js/lib') diff --git a/public/js/lib/editor/index.js b/public/js/lib/editor/index.js index 003b32b7..bc228b7b 100644 --- a/public/js/lib/editor/index.js +++ b/public/js/lib/editor/index.js @@ -18,10 +18,10 @@ export default class Editor { cm.setOption('fullScreen', !cm.getOption('fullScreen')) }, Esc: function (cm) { - if (cm.getOption('keyMap').substr(0, 3) === 'vim') { - return CodeMirror.Pass - } else if (cm.getOption('fullScreen')) { + if (cm.getOption('fullScreen') && !(cm.getOption('keyMap').substr(0, 3) === 'vim')) { cm.setOption('fullScreen', false) + } else { + return CodeMirror.Pass } }, 'Cmd-S': function () { -- cgit v1.2.3