소스 검색

modify agent-for-hackmd.js

* return if codemirror or editor is not found
Yuki Takei 7 년 전
부모
커밋
8f080e41dc
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      resource/js/agent-for-hackmd.js

+ 5 - 0
resource/js/agent-for-hackmd.js

@@ -73,6 +73,11 @@ function addEventListenersToCodemirror() {
   // get CodeMirror editor instance
   const editor = window.editor;
 
+  // e.g. 404 not found
+  if (codemirror == null || editor == null) {
+    return;
+  }
+
   //// change event
   editor.on('change', (cm, change) => {
     debouncedPostParentToNotifyBodyChanges(cm.doc.getValue());