Browse Source

:art: fix https://github.com/siyuan-note/siyuan/issues/7341

Vanessa 2 years ago
parent
commit
5ae02f36bc
1 changed files with 1 additions and 1 deletions
  1. 1 1
      app/src/protyle/wysiwyg/enter.ts

+ 1 - 1
app/src/protyle/wysiwyg/enter.ts

@@ -236,7 +236,7 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle
             // ```test` 不处理,正常渲染为段落块
             // ```test` 不处理,正常渲染为段落块
         } else if (blockElement.classList.contains("p")) { // https://github.com/siyuan-note/siyuan/issues/6953
         } else if (blockElement.classList.contains("p")) { // https://github.com/siyuan-note/siyuan/issues/6953
             const oldHTML = blockElement.outerHTML;
             const oldHTML = blockElement.outerHTML;
-            let replaceInnerHTML = editableElement.innerHTML.replace(/^(~|·|`){3,}/g, "```").replace(/\n(~|·|`){3,}/g, "\n```").trim();
+            let replaceInnerHTML = editableElement.innerHTML.replace(/\n(~|·|`){3,}/g, "\n```").trim().replace(/^(~|·|`){3,}/g, "```");
             if (!replaceInnerHTML.endsWith("\n```")) {
             if (!replaceInnerHTML.endsWith("\n```")) {
                 replaceInnerHTML += "<wbr>\n```";
                 replaceInnerHTML += "<wbr>\n```";
             }
             }