|
@@ -148,6 +148,8 @@ export default class CodeMirrorEditor extends AbstractEditor {
|
|
|
this.showLinkEditHandler = this.showLinkEditHandler.bind(this);
|
|
this.showLinkEditHandler = this.showLinkEditHandler.bind(this);
|
|
|
this.showHandsonTableHandler = this.showHandsonTableHandler.bind(this);
|
|
this.showHandsonTableHandler = this.showHandsonTableHandler.bind(this);
|
|
|
this.showDrawioHandler = this.showDrawioHandler.bind(this);
|
|
this.showDrawioHandler = this.showDrawioHandler.bind(this);
|
|
|
|
|
+
|
|
|
|
|
+ this.initTextlintSettings = this.initTextlintSettings.bind(this);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
init() {
|
|
init() {
|
|
@@ -155,6 +157,24 @@ export default class CodeMirrorEditor extends AbstractEditor {
|
|
|
this.cmNoCdnScriptRoot = '/js/cdn';
|
|
this.cmNoCdnScriptRoot = '/js/cdn';
|
|
|
this.cmNoCdnStyleRoot = '/styles/cdn';
|
|
this.cmNoCdnStyleRoot = '/styles/cdn';
|
|
|
|
|
|
|
|
|
|
+ // TODO: Get configs from db
|
|
|
|
|
+ this.isLintEnabled = true;
|
|
|
|
|
+
|
|
|
|
|
+ this.textlintConfig = [
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'max-comma',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'common-misspellings',
|
|
|
|
|
+ options: {
|
|
|
|
|
+ ignore: [
|
|
|
|
|
+ 'isnt',
|
|
|
|
|
+ 'yuo',
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
this.interceptorManager = new InterceptorManager();
|
|
this.interceptorManager = new InterceptorManager();
|
|
|
this.interceptorManager.addInterceptors([
|
|
this.interceptorManager.addInterceptors([
|
|
|
new PreventMarkdownListInterceptor(),
|
|
new PreventMarkdownListInterceptor(),
|
|
@@ -170,6 +190,8 @@ export default class CodeMirrorEditor extends AbstractEditor {
|
|
|
this.emojiAutoCompleteHelper = new EmojiAutoCompleteHelper(this.props.emojiStrategy);
|
|
this.emojiAutoCompleteHelper = new EmojiAutoCompleteHelper(this.props.emojiStrategy);
|
|
|
this.setState({ isEnabledEmojiAutoComplete: true });
|
|
this.setState({ isEnabledEmojiAutoComplete: true });
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ this.initTextlintSettings();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
componentDidMount() {
|
|
@@ -195,6 +217,12 @@ export default class CodeMirrorEditor extends AbstractEditor {
|
|
|
this.setKeymapMode(keymapMode);
|
|
this.setKeymapMode(keymapMode);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ initTextlintSettings() {
|
|
|
|
|
+ console.log('init!');
|
|
|
|
|
+ this.textlintValidator = createValidator(this.textlintConfig);
|
|
|
|
|
+ this.codemirrorLintConfig = this.isLintEnabled ? { getAnnotations: this.textlintValidator, async: true } : undefined;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
getCodeMirror() {
|
|
getCodeMirror() {
|
|
|
return this.cm.editor;
|
|
return this.cm.editor;
|
|
|
}
|
|
}
|
|
@@ -857,31 +885,6 @@ export default class CodeMirrorEditor extends AbstractEditor {
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // TODO: Get configs from db
|
|
|
|
|
- isLintEnabled = true;
|
|
|
|
|
-
|
|
|
|
|
- textlintConfig = [
|
|
|
|
|
- {
|
|
|
|
|
- name: 'max-comma',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- name: 'dummy-rule',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- name: 'common-misspellings',
|
|
|
|
|
- options: {
|
|
|
|
|
- ignore: [
|
|
|
|
|
- 'isnt',
|
|
|
|
|
- 'yuo',
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- ];
|
|
|
|
|
-
|
|
|
|
|
- textlintValidator = createValidator(this.textlintConfig);
|
|
|
|
|
-
|
|
|
|
|
- codemirrorLintConfig = this.isLintEnabled ? { getAnnotations: this.textlintValidator, async: true } : undefined;
|
|
|
|
|
-
|
|
|
|
|
render() {
|
|
render() {
|
|
|
const mode = this.state.isGfmMode ? 'gfm-growi' : undefined;
|
|
const mode = this.state.isGfmMode ? 'gfm-growi' : undefined;
|
|
|
const lint = this.codemirrorLintConfig;
|
|
const lint = this.codemirrorLintConfig;
|