Преглед на файлове

update regular expression for drawio code block

Yuki Takei преди 3 години
родител
ревизия
e7d83f9b7b
променени са 2 файла, в които са добавени 5 реда и са изтрити 5 реда
  1. 2 2
      packages/app/src/components/PageEditor/CodeMirrorEditor.jsx
  2. 3 3
      packages/app/src/components/PageEditor/MarkdownDrawioUtil.js

+ 2 - 2
packages/app/src/components/PageEditor/CodeMirrorEditor.jsx

@@ -866,7 +866,7 @@ class CodeMirrorEditor extends AbstractEditor {
     this.linkEditModal.current.show(markdownLinkUtil.getMarkdownLink(this.getCodeMirror()));
     this.linkEditModal.current.show(markdownLinkUtil.getMarkdownLink(this.getCodeMirror()));
   }
   }
 
 
-  // fold draw.io section (::: drawio ~ :::)
+  // fold draw.io section (``` drawio ~ ```)
   foldDrawioSection() {
   foldDrawioSection() {
     const editor = this.getCodeMirror();
     const editor = this.getCodeMirror();
     const lineNumbers = mdu.findAllDrawioSection(editor);
     const lineNumbers = mdu.findAllDrawioSection(editor);
@@ -877,7 +877,7 @@ class CodeMirrorEditor extends AbstractEditor {
 
 
   onSaveForDrawio(drawioData) {
   onSaveForDrawio(drawioData) {
     const range = mdu.replaceFocusedDrawioWithEditor(this.getCodeMirror(), drawioData);
     const range = mdu.replaceFocusedDrawioWithEditor(this.getCodeMirror(), drawioData);
-    // Fold the section after the drawio section (:::drawio) has been updated.
+    // Fold the section after the drawio section (```drawio) has been updated.
     this.foldDrawioSection();
     this.foldDrawioSection();
     return range;
     return range;
   }
   }

+ 3 - 3
packages/app/src/components/PageEditor/MarkdownDrawioUtil.js

@@ -4,8 +4,8 @@
 class MarkdownDrawioUtil {
 class MarkdownDrawioUtil {
 
 
   constructor() {
   constructor() {
-    this.lineBeginPartOfDrawioRE = /^:::(\s.*)drawio$/;
-    this.lineEndPartOfDrawioRE = /^:::$/;
+    this.lineBeginPartOfDrawioRE = /^```(\s.*)drawio$/;
+    this.lineEndPartOfDrawioRE = /^```$/;
   }
   }
 
 
   /**
   /**
@@ -113,7 +113,7 @@ class MarkdownDrawioUtil {
 
 
   replaceFocusedDrawioWithEditor(editor, drawioData) {
   replaceFocusedDrawioWithEditor(editor, drawioData) {
     const curPos = editor.getCursor();
     const curPos = editor.getCursor();
-    const drawioBlock = ['::: drawio', drawioData.toString(), ':::'].join('\n');
+    const drawioBlock = ['``` drawio', drawioData.toString(), '```'].join('\n');
     let beginPos;
     let beginPos;
     let endPos;
     let endPos;