mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-27 18:56:09 +01:00
This commit is contained in:
parent
93afce1477
commit
541d5613fd
1 changed files with 14 additions and 0 deletions
|
|
@ -398,6 +398,13 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
|||
// 编辑器内部粘贴
|
||||
const tempElement = document.createElement("div");
|
||||
tempElement.innerHTML = siyuanHTML;
|
||||
if (tempElement.childElementCount === 1 && ((tempElement.firstElementChild as HTMLElement).dataset?.type || "").split(" ").includes("block-ref")) {
|
||||
protyle.toolbar.setInlineMark(protyle, "block-ref", "range", {
|
||||
type: "id",
|
||||
color: `${(tempElement.firstElementChild as HTMLElement).dataset.id}${Constants.ZWSP}s${Constants.ZWSP}${range.toString()}`
|
||||
});
|
||||
return;
|
||||
}
|
||||
let isBlock = false;
|
||||
tempElement.querySelectorAll("[data-node-id]").forEach((e) => {
|
||||
const newId = Lute.NewNodeID();
|
||||
|
|
@ -483,6 +490,13 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
|||
e.remove();
|
||||
}
|
||||
});
|
||||
if (tempElement.childElementCount === 1 && tempElement.firstElementChild.tagName === "A") {
|
||||
protyle.toolbar.setInlineMark(protyle, "a", "range", {
|
||||
type: "a",
|
||||
color: (tempElement.firstElementChild as HTMLLinkElement).href
|
||||
});
|
||||
return;
|
||||
}
|
||||
fetchPost("/api/lute/html2BlockDOM", {
|
||||
dom: tempElement.innerHTML
|
||||
}, (response) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue