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

+ 4 - 4
apps/app/src/components/PageEditor/MarkdownDrawioUtil.js

@@ -178,11 +178,11 @@ class MarkdownDrawioUtil {
   findAllDrawioSection(editor) {
   findAllDrawioSection(editor) {
     const lineNumbers = [];
     const lineNumbers = [];
     // refs: https://github.com/codemirror/CodeMirror/blob/5.64.0/addon/fold/foldcode.js#L106-L111
     // refs: https://github.com/codemirror/CodeMirror/blob/5.64.0/addon/fold/foldcode.js#L106-L111
-    for (let i = 1, e = this.doc(editor).lines; i <= e; i++) {
-      const line = this.doc(editor).line(i + 1).text;
-      const match = this.lineBeginPartOfDrawioRE.exec(line);
+    for (let firstLine = 1, lastLine = this.doc(editor).lines; firstLine <= lastLine; firstLine++) {
+      const lineText = this.doc(editor).line(firstLine + 1).text;
+      const match = this.lineBeginPartOfDrawioRE.exec(lineText);
       if (match) {
       if (match) {
-        lineNumbers.push(i);
+        lineNumbers.push(firstLine);
       }
       }
     }
     }
     return lineNumbers;
     return lineNumbers;