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/15268

Vanessa306fab4fee97
diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts
index 65de6973e1..a86621e33a 100644
--- a/app/src/protyle/render/av/render.ts
+++ b/app/src/protyle/render/av/render.ts
@@ -584,7 +584,9 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
});
}
} else if (operation.action === "addAttrViewView") {
- openMenuPanel({protyle, blockElement: item, type: "config"});
+ if (item.getAttribute("data-node-id") === operation.blockID) {
+ openMenuPanel({protyle, blockElement: item, type: "config"});
+ }
}
}
item.removeAttribute("data-loading");
diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.ts
index d5311eacaa..f44d335fb4 100644
--- a/app/src/protyle/util/insertHTML.ts
+++ b/app/src/protyle/util/insertHTML.ts
@@ -374,7 +374,14 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
isBlock = false;
block2text = true;
}
-
+ // 通过右键粘贴包含属性的块需保留整个块 https://github.com/siyuan-note/siyuan/issues/15268
+ for (let i = 0; i < tempElement.content.firstElementChild.attributes.length; i++) {
+ const attribute = tempElement.content.firstElementChild.attributes[i];
+ if (["memo", "name", "alias", "bookmark"].includes(attribute.name) || attribute.name.startsWith("custom-")) {
+ isBlock = true;
+ break;
+ }
+ }
// 使用 lute 方法会添加 p 元素,只有一个 p 元素或者只有一个字符串或者为 <u>b</u> 时的时候只拷贝内部
if (!isBlock) {
if (tempElement.content.firstChild.nodeType === 3 || block2text ||