소스 검색

135845 get text from drawio line

soumaeda 2 년 전
부모
커밋
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;
   }