Skip to content

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

:bug: Refresh database attribute panel after changes https://github.com/siyuan-note/siyuan/issues/18321

Danield2cb02c20a2a
diff --git a/app/src/assets/scss/business/_custom.scss b/app/src/assets/scss/business/_custom.scss
index 904491dd77..12a7cae612 100644
--- a/app/src/assets/scss/business/_custom.scss
+++ b/app/src/assets/scss/business/_custom.scss
@@ -236,7 +236,6 @@
.protyle-db-attr {
border-bottom: 1px solid var(--b3-border-color);
- border-radius: var(--b3-border-radius);
margin: 8px 16px 8px 24px;
padding-bottom: 8px;
@@ -259,7 +258,13 @@
background-color: var(--b3-theme-surface-light);
}
+ & > .block__icon:first-child {
+ padding-left: 0;
+ padding-right: 0;
+ }
+
.block__logo {
+ margin-left: 0;
min-height: 34px;
font-weight: 500;
}
diff --git a/app/src/config/tabs/editorRuntime.ts b/app/src/config/tabs/editorRuntime.ts
index 4bc77603b6..1a3ab6eed4 100644
--- a/app/src/config/tabs/editorRuntime.ts
+++ b/app/src/config/tabs/editorRuntime.ts
@@ -9,6 +9,7 @@ const applyEditorConfig = (data: Config.IEditor) => {
window.siyuan.config.editor = data;
getAllEditor().forEach((editorItem) => {
const protyle = editorItem.protyle;
+ protyle.databaseAttributePanel?.updateDisplayConfig();
reloadProtyle(protyle, false);
let isFullWidth = protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_FULLWIDTH);
if (!isFullWidth) {
diff --git a/app/src/protyle/render/av/attributePanel.ts b/app/src/protyle/render/av/attributePanel.ts
index 8c519ff4b2..1d8f4b5304 100644
--- a/app/src/protyle/render/av/attributePanel.ts
+++ b/app/src/protyle/render/av/attributePanel.ts
@@ -70,6 +70,11 @@ export class AVAttributePanel {
this.render(true);
}
+ public updateDisplayConfig() {
+ this.updateTabs();
+ this.updateEmptyState();
+ }
+
public hasDatabase(avID: string) {
return Boolean(this.bodyElement.querySelector(`[data-av-id="${avID}"]`));
}
@@ -86,6 +91,11 @@ export class AVAttributePanel {
this.refresh();
return;
}
+ if (operation.action === "updateAttrViewCell" && operation.data?.type === "block" && operation.rowID &&
+ this.hasItem(operation.rowID)) {
+ this.refresh();
+ return;
+ }
if (operation.action === "removeAttrViewBlock" &&
(this.hasDatabase(operation.avID) || operation.srcIDs?.some(item => this.hasItem(item)))) {
this.refresh();