mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-14 20:58:51 +01:00
This commit is contained in:
parent
111a49294e
commit
053f88d0ce
3 changed files with 7 additions and 22 deletions
|
|
@ -34,7 +34,8 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
|
|||
let id = blockElement.getAttribute("data-node-id");
|
||||
range.insertNode(document.createElement("wbr"));
|
||||
let oldHTML = blockElement.outerHTML;
|
||||
if (!isBlock && blockElement.getAttribute("data-type") === "NodeCodeBlock") {
|
||||
if (!isBlock &&
|
||||
(blockElement.getAttribute("data-type") === "NodeCodeBlock" || protyle.toolbar.getCurrentType(range).includes("code"))) {
|
||||
range.deleteContents();
|
||||
range.insertNode(document.createTextNode(html.replace(/\r\n|\r|\u2028|\u2029/g, "\n")));
|
||||
range.collapse(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue