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

Vanessad1ed86efe79b
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index 375a1d8a15..4c882af056 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -631,7 +631,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
label: window.siyuan.languages.copy,
icon: "iconCopy",
click() {
- writeText(protyle.lute.BlockDOM2StdMd(element.outerHTML));
+ writeText(protyle.lute.BlockDOM2StdMd(element.outerHTML).trim());
}
}).element);
if (!protyle.disabled) {
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts
index 589b76677e..675b87f0dc 100644
--- a/app/src/protyle/util/paste.ts
+++ b/app/src/protyle/util/paste.ts
@@ -398,12 +398,22 @@ 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;
+ if (tempElement.childElementCount === 1) {
+ const types = ((tempElement.firstElementChild as HTMLElement).dataset?.type || "").split(" ")
+ if(types.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;
+ }
+ if(types.includes("a")) {
+ protyle.toolbar.setInlineMark(protyle, "a", "range", {
+ type: "a",
+ color: `${(tempElement.firstElementChild as HTMLElement).dataset.href}${Constants.ZWSP}${range.toString()}`
+ });
+ return;
+ }
}
let isBlock = false;
tempElement.querySelectorAll("[data-node-id]").forEach((e) => {