Kaynağa Gözat

modify agent-for-hackmd.js

* return if codemirror or editor is not found
Yuki Takei 7 yıl önce
ebeveyn
işleme
8f080e41dc
1 değiştirilmiş dosya ile 5 ekleme ve 0 silme
  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());