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

135396 define emptyLineOfTableRE in intercepter

soumaeda 2 лет назад
Родитель
Сommit
78909a734f

+ 3 - 1
apps/app/src/components/PageEditor/MarkdownTableInterceptor.js

@@ -3,7 +3,7 @@ import { BasicInterceptor } from '@growi/core/dist/utils';
 import MarkdownTable from '~/client/models/MarkdownTable';
 
 import {
-  getStrFromBot, addRowToMarkdownTable, getStrToEot, isEndOfLine, mergeMarkdownTable, emptyLineOfTableRE,
+  getStrFromBot, addRowToMarkdownTable, getStrToEot, isEndOfLine, mergeMarkdownTable,
 } from './MarkdownTableUtil';
 
 /**
@@ -61,6 +61,8 @@ export default class MarkdownTableInterceptor extends BasicInterceptor {
     const editor = context.editor; // AbstractEditor instance
     // "autoFormatMarkdownTable" may be undefined, so it is compared to true and converted to bool.
     const noIntercept = (context.autoFormatMarkdownTable === false);
+    // https://regex101.com/r/1UuWBJ/3
+    const emptyLineOfTableRE = /^([^\r\n|]*)\|((\s*\|)+)$/;
 
     // do nothing if editor is not a CodeMirrorEditor or no intercept
     if (editor == null || editor.getCodeMirror() == null || noIntercept) {

+ 0 - 2
apps/app/src/components/PageEditor/MarkdownTableUtil.ts

@@ -8,8 +8,6 @@ import MarkdownTable from '~/client/models/MarkdownTable';
 
 // https://regex101.com/r/7BN2fR/10
 const linePartOfTableRE = /^([^\r\n|]*)\|(([^\r\n|]*\|)+)$/;
-// https://regex101.com/r/1UuWBJ/3
-export const emptyLineOfTableRE = /^([^\r\n|]*)\|((\s*\|)+)$/;
 
 const curPos = (editor: EditorView): number => {
   return editor.state.selection.main.head;