Skip to content

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

:art: Smooth database attribute panel refresh https://github.com/siyuan-note/siyuan/issues/18321

Daniel220a53370bd7
diff --git a/app/src/protyle/render/av/attributePanel.ts b/app/src/protyle/render/av/attributePanel.ts
index 1d8f4b5304..cbd33e318b 100644
--- a/app/src/protyle/render/av/attributePanel.ts
+++ b/app/src/protyle/render/av/attributePanel.ts
@@ -47,18 +47,28 @@ export class AVAttributePanel {
if (!targetID || (!force && targetID === this.targetID && this.element.dataset.rendered === "true")) {
return;
}
+ const currentBodyElement = this.bodyElement;
+ const keepCurrentBody = force && targetID === this.targetID;
this.targetID = targetID;
this.element.dataset.nodeId = targetID;
- this.element.removeAttribute("data-rendered");
+ if (!keepCurrentBody) {
+ this.element.removeAttribute("data-rendered");
+ }
const token = ++this.renderToken;
const bodyElement = document.createElement("div");
bodyElement.className = "custom-attr protyle-db-attr__body";
- this.bodyElement.replaceWith(bodyElement);
- this.bodyElement = bodyElement;
+ if (!keepCurrentBody) {
+ currentBodyElement.replaceWith(bodyElement);
+ this.bodyElement = bodyElement;
+ }
renderAVAttribute(bodyElement, targetID, this.protyle, (renderedElement) => {
if (token !== this.renderToken) {
return;
}
+ if (keepCurrentBody) {
+ currentBodyElement.replaceWith(renderedElement);
+ this.bodyElement = renderedElement;
+ }
this.element.dataset.rendered = "true";
this.updateTabs();
this.updateEmptyState();