Преглед на файлове

135395 get cursor position

soumaeda преди 2 години
родител
ревизия
fcccdff300
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  1. 3 2
      apps/app/src/components/PageEditor/MarkdownTableUtil.js

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

@@ -108,7 +108,7 @@ class MarkdownTableUtil {
    * return boolean value whether the cursor position is end of line
    */
   isEndOfLine(editor) {
-    return (this.curPos(editor) === editor.state.doc.line(this.curPos(editor).line + 1).length);
+    return (this.curPos(editor) === editor.state.doc.lineAt(this.curPos(editor)).to);
   }
 
   /**
@@ -166,8 +166,9 @@ class MarkdownTableUtil {
       },
     });
     editor.dispatch({
-      selection: { anchor: editor.state.doc.lineAt(this.curPos(editor)).to },
+      selection: { anchor: editor.state.doc.lineAt(eotPos).to },
     });
+    editor.focus();
   }
 
   /**