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 <sheogorath@shivering-isles.com>
This commit is contained in:
Sheogorath 2018-02-24 21:03:12 +01:00
parent 6bcc72e090
commit 9c77e9d7f0
No known key found for this signature in database
GPG key ID: 1F05CC3635CDDFFD

View file

@ -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 () {