소스 검색

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
    * return boolean value whether the cursor position is end of line
    */
    */
   isEndOfLine(editor) {
   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({
     editor.dispatch({
-      selection: { anchor: editor.state.doc.lineAt(this.curPos(editor)).to },
+      selection: { anchor: editor.state.doc.lineAt(eotPos).to },
     });
     });
+    editor.focus();
   }
   }
 
 
   /**
   /**