Browse Source

135395 get cursor position

soumaeda 2 years ago
parent
commit
fcccdff300
1 changed files with 3 additions and 2 deletions
  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();
   }
 
   /**