|
|
@@ -3,8 +3,9 @@ import { BasicInterceptor } from '@growi/core/dist/utils';
|
|
|
import MarkdownTable from '~/client/models/MarkdownTable';
|
|
|
|
|
|
import {
|
|
|
- getStrFromBot, addRowToMarkdownTable, getStrToEot, isEndOfLine, mergeMarkdownTable, replaceFocusedMarkdownTableWithEditor, isInTable,
|
|
|
-} from './MarkdownTableUtilForEditor';
|
|
|
+ getStrFromBot, addRowToMarkdownTable, getStrToEot, isEndOfLine, mergeMarkdownTable, replaceFocusedMarkdownTableWithEditor,
|
|
|
+ isInTable, emptyLineOfTableRE,
|
|
|
+} from './markdown-table-util-for-editor';
|
|
|
|
|
|
/**
|
|
|
* Interceptor for markdown table
|
|
|
@@ -61,8 +62,6 @@ 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) {
|