Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/14625

Vanessa541d5613fd93
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts
index dae93001f1..589b76677e 100644
--- a/app/src/protyle/util/paste.ts
+++ b/app/src/protyle/util/paste.ts
@@ -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) => {