Steven Fukase vor 4 Jahren
Ursprung
Commit
0592167b2e
1 geänderte Dateien mit 7 neuen und 5 gelöschten Zeilen
  1. 7 5
      packages/app/src/components/PageEditor/CodeMirrorEditor.jsx

+ 7 - 5
packages/app/src/components/PageEditor/CodeMirrorEditor.jsx

@@ -201,11 +201,13 @@ export default class CodeMirrorEditor extends AbstractEditor {
   }
 
   async initializeTextlint() {
-    await this.props.onInitializeTextlint();
-    // If database has empty array, pass null instead to enable all default rules
-    const rulesForValidator = this.props.textlintRules?.length !== 0 ? this.props.textlintRules : null;
-    this.textlintValidator = createValidator(rulesForValidator);
-    this.codemirrorLintConfig = { getAnnotations: this.textlintValidator, async: true };
+    if (this.props.onInitializeTextlint != null) {
+      await this.props.onInitializeTextlint();
+      // If database has empty array, pass null instead to enable all default rules
+      const rulesForValidator = this.props.textlintRules?.length !== 0 ? this.props.textlintRules : null;
+      this.textlintValidator = createValidator(rulesForValidator);
+      this.codemirrorLintConfig = { getAnnotations: this.textlintValidator, async: true };
+    }
   }
 
   getCodeMirror() {