2
0
soumaeda 2 жил өмнө
parent
commit
54533fbcde

+ 4 - 0
packages/editor/src/services/codemirror-editor/use-codemirror-editor/utils/fold-drawio.ts

@@ -11,7 +11,9 @@ const findAllDrawioSection = (view?: EditorView) => {
   }
   const lineBeginPartOfDrawioRE = /^```(\s.*)drawio$/;
   const lineNumbers: number[] = [];
+  // repeat the process in each line from the top to the bottom in the editor
   for (let i = 1, e = view.state.doc.lines; i <= e; i++) {
+    // get each line text
     const lineTxt = view.state.doc.line(i).text;
     const match = lineBeginPartOfDrawioRE.exec(lineTxt);
     if (match) {
@@ -26,7 +28,9 @@ const foldDrawioSection = (lineNumbers?: number[], view?: EditorView) => {
     return;
   }
   lineNumbers.forEach((lineNumber) => {
+    // get the end of the lines containing '''drawio
     const from = view.state.doc.line(lineNumber).to;
+    // get the end of the lines containing '''
     const to = view.state.doc.line(lineNumber + 2).to;
     view?.dispatch({
       effects: foldEffect.of({