소스 검색

[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();
       }
     });
   }