Переглянути джерело

[codemirror] prevent default if key down handler returns true

akosyakov 8 роки тому
батько
коміт
2048a4880d
1 змінених файлів з 2 додано та 2 видалено
  1. 2 2
      src/codemirror/editor.ts

+ 2 - 2
src/codemirror/editor.ts

@@ -47,8 +47,8 @@ class CodeMirrorEditor implements CodeEditor.IEditor {
       loadModeByMIME(this._editor, mime);
     });
     CodeMirror.on(this.editor, 'keydown', (instance, evt) => {
-      if (this._handler) {
-        this._handler(this, evt);
+      if (this._handler && this._handler(this, evt)) {
+        evt.preventDefault();
       }
     });
   }