diff --git a/app/src/protyle/wysiwyg/input.ts b/app/src/protyle/wysiwyg/input.ts index 8ec43da4a..176892894 100644 --- a/app/src/protyle/wysiwyg/input.ts +++ b/app/src/protyle/wysiwyg/input.ts @@ -167,7 +167,7 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range: // ```test` 不处理,正常渲染为段落块 } else { let replaceInnerHTML = editElement.innerHTML.trim().replace(/^(~|·|`){3,}/g, "```").replace(/\n(~|·|`){3,}/g, "\n```").trim(); - if (!replaceInnerHTML.endsWith("\n```")) { + if (!replaceInnerHTML.endsWith("\n```") && !replaceInnerHTML.endsWith("\n```")) { replaceInnerHTML = replaceInnerHTML.replace("", "") + "\n```"; } editElement.innerHTML = replaceInnerHTML;