mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-17 06:05:29 +01:00
This commit is contained in:
parent
e887d70a18
commit
86d649f29b
1 changed files with 6 additions and 1 deletions
|
|
@ -63,9 +63,14 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle
|
|||
// ```test` 不处理,正常渲染为段落块
|
||||
} else if (blockElement.classList.contains("p")) { // https://github.com/siyuan-note/siyuan/issues/6953
|
||||
const oldHTML = blockElement.outerHTML;
|
||||
// https://github.com/siyuan-note/siyuan/issues/16744
|
||||
range.extractContents();
|
||||
const wbrElement = document.createElement("wbr");
|
||||
range.insertNode(wbrElement);
|
||||
wbrElement.after(document.createTextNode("\n"));
|
||||
let replaceInnerHTML = editableElement.innerHTML.replace(/\n(~|·|`){3,}/g, "\n```").trim().replace(/^(~|·|`){3,}/g, "```");
|
||||
if (!replaceInnerHTML.endsWith("\n```")) {
|
||||
replaceInnerHTML += "<wbr>\n```";
|
||||
replaceInnerHTML += "\n```";
|
||||
}
|
||||
editableElement.innerHTML = replaceInnerHTML;
|
||||
blockElement.outerHTML = protyle.lute.SpinBlockDOM(blockElement.outerHTML);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue