Przeglądaj źródła

135395 add or reduce from curPos line number

soumaeda 2 lat temu
rodzic
commit
e8a84311a5

+ 2 - 2
apps/app/src/components/PageEditor/MarkdownTableUtil.js

@@ -39,7 +39,7 @@ class MarkdownTableUtil {
 
 
     const doc = editor.state.doc;
     const doc = editor.state.doc;
     const firstLine = doc.line(1);
     const firstLine = doc.line(1);
-    let line = doc.lineAt(this.curPos(editor)).number;
+    let line = doc.lineAt(this.curPos(editor)).number - 1;
     for (; line >= firstLine.number; line--) {
     for (; line >= firstLine.number; line--) {
       const strLine = doc.line(line).text;
       const strLine = doc.line(line).text;
       if (!this.linePartOfTableRE.test(strLine)) {
       if (!this.linePartOfTableRE.test(strLine)) {
@@ -61,7 +61,7 @@ class MarkdownTableUtil {
 
 
     const doc = editor.state.doc;
     const doc = editor.state.doc;
     const lastLine = doc.line(doc.lines);
     const lastLine = doc.line(doc.lines);
-    let line = doc.lineAt(this.curPos(editor)).number;
+    let line = doc.lineAt(this.curPos(editor)).number + 1;
     for (; line <= lastLine.number; line++) {
     for (; line <= lastLine.number; line++) {
       const strLine = doc.line(line).text;
       const strLine = doc.line(line).text;
       if (!this.linePartOfTableRE.test(strLine)) {
       if (!this.linePartOfTableRE.test(strLine)) {