Просмотр исходного кода

135845 get text from drawio line

soumaeda 2 лет назад
Родитель
Сommit
2198a9e236
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      apps/app/src/components/PageEditor/MarkdownDrawioUtil.js

+ 5 - 3
apps/app/src/components/PageEditor/MarkdownDrawioUtil.js

@@ -112,11 +112,13 @@ class MarkdownDrawioUtil {
       const eod = this.getEod(editor);
 
       // skip block begin sesion("``` drawio")
-      this.doc(editor).lineAt(bod).number++;
+      const bodLineNum = this.doc(editor).lineAt(bod).number + 1;
+      const bodLine = this.doc(editor).line(bodLineNum);
       // skip block end sesion("```")
-      this.doc(editor).lineAt(eod).number--;
+      const eodLineNum = this.doc(editor).lineAt(eod).number - 1;
+      const eodLine = this.doc(editor).line(eodLineNum);
 
-      return editor.state.sliceDoc(bod, eod);
+      return editor.state.sliceDoc(bodLine.from, eodLine.to);
     }
     return null;
   }