Переглянути джерело

change some function following to migration

soumaeda 2 роки тому
батько
коміт
355caa5541

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

@@ -73,16 +73,16 @@ class MarkdownTableUtil {
    * return strings from BOT(beginning of table) to the cursor position
    * return strings from BOT(beginning of table) to the cursor position
    */
    */
   getStrFromBot(editor) {
   getStrFromBot(editor) {
-    const curPos = editor.getCursor();
-    return editor.getDoc().getRange(this.getBot(editor), curPos);
+    const curPos = editor.state.selection.main.head;
+    return editor.state.sliceDoc(this.getBot(editor), curPos);
   }
   }
 
 
   /**
   /**
    * return strings from the cursor position to EOT(end of table)
    * return strings from the cursor position to EOT(end of table)
    */
    */
   getStrToEot(editor) {
   getStrToEot(editor) {
-    const curPos = editor.getCursor();
-    return editor.getDoc().getRange(curPos, this.getEot(editor));
+    const curPos = editor.state.selection.main.head;
+    return editor.state.sliceDoc(curPos, this.getEot(editor));
   }
   }
 
 
   /**
   /**
@@ -107,8 +107,8 @@ 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) {
-    const curPos = editor.getCursor();
-    return (curPos.ch === editor.getDoc().getLine(curPos.line).length);
+    const curPos = editor.state.selection.main.head;
+    return (curPos === editor.state.doc.line(curPos.line + 1).length);
   }
   }
 
 
   /**
   /**