mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-01 10:20:16 +01:00
This commit is contained in:
parent
24ee5d14be
commit
d9f7441170
3 changed files with 19 additions and 6 deletions
|
|
@ -271,7 +271,20 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
|||
e.setAttribute("contenteditable", "true");
|
||||
});
|
||||
const tempInnerHTML = tempElement.innerHTML;
|
||||
insertHTML(tempInnerHTML, protyle, isBlock);
|
||||
if (!nodeElement.classList.contains("av") && tempInnerHTML.startsWith("[{") && tempInnerHTML.endsWith("}]")) {
|
||||
try {
|
||||
const json = JSON.parse(tempInnerHTML);
|
||||
if (json.length > 0 && json[0].id && json[0].type) {
|
||||
insertHTML(textPlain, protyle, isBlock);
|
||||
} else {
|
||||
insertHTML(tempInnerHTML, protyle, isBlock);
|
||||
}
|
||||
} catch (e) {
|
||||
insertHTML(tempInnerHTML, protyle, isBlock);
|
||||
}
|
||||
} else {
|
||||
insertHTML(tempInnerHTML, protyle, isBlock);
|
||||
}
|
||||
filterClipboardHint(protyle, protyle.lute.BlockDOM2StdMd(tempInnerHTML));
|
||||
blockRender(protyle, protyle.wysiwyg.element);
|
||||
processRender(protyle.wysiwyg.element);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue