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

Enabled to control whether markdown table is formatted or not when in editor edit mode.

Ryu Sato 5 лет назад
Родитель
Сommit
b8123fb5df

+ 1 - 0
src/client/js/components/PageEditor/CodeMirrorEditor.jsx

@@ -441,6 +441,7 @@ export default class CodeMirrorEditor extends AbstractEditor {
     const context = {
       handlers: [], // list of handlers which process enter key
       editor: this,
+      editorOption: this.props.editorOptions,
     };
 
     const interceptorManager = this.interceptorManager;

+ 3 - 2
src/client/js/components/PageEditor/MarkdownTableInterceptor.js

@@ -56,9 +56,10 @@ export default class MarkdownTableInterceptor extends BasicInterceptor {
   async process(contextName, ...args) {
     const context = Object.assign(args[0]); // clone
     const editor = context.editor; // AbstractEditor instance
+    const noIntercept = (context.editorOption.formattingMarkdownTable !== true);
 
-    // do nothing if editor is not a CodeMirrorEditor
-    if (editor == null || editor.getCodeMirror() == null) {
+    // do nothing if editor is not a CodeMirrorEditor or no intercept
+    if (editor == null || editor.getCodeMirror() == null || noIntercept) {
       return context;
     }