Просмотр исходного кода

BugFix: MarkdownTableInterceptor

Yuki Takei 7 лет назад
Родитель
Сommit
acfb1d090e
1 измененных файлов с 3 добавлено и 5 удалено
  1. 3 5
      resource/js/components/PageEditor/MarkdownTableInterceptor.js

+ 3 - 5
resource/js/components/PageEditor/MarkdownTableInterceptor.js

@@ -34,11 +34,9 @@ export default class MarkdownTableInterceptor extends BasicInterceptor {
     const context = Object.assign(args[0]);   // clone
     const editor = context.editor;            // AbstractEditor instance
 
-    if (editor != null) {
-      if (editor.constructor.name !== 'CodeMirrorEditor') {
-        // resolve
-        return Promise.resolve(context);
-      }
+    // do nothing if editor is not a CodeMirrorEditor
+    if (editor == null || editor.getCodeMirror() == null) {
+      return Promise.resolve(context);
     }
 
     const cm = editor.getCodeMirror();