Explorar o código

135395 get cursor position

soumaeda %!s(int64=2) %!d(string=hai) anos
pai
achega
fcccdff300
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  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();
   }
 
   /**