Skip to content

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

:bug: Keep empty field visibility toggle available in read-only documents https://github.com/siyuan-note/siyuan/issues/19674

Daniel947dcfaed85b
diff --git a/app/src/assets/scss/business/_custom.scss b/app/src/assets/scss/business/_custom.scss
index 8687822561..a842ce08c7 100644
--- a/app/src/assets/scss/business/_custom.scss
+++ b/app/src/assets/scss/business/_custom.scss
@@ -326,7 +326,6 @@
.protyle-db-attr[data-readonly="true"],
.custom-attr[data-readonly="true"] {
- [data-type="toggle-empty"],
[data-type="remove"],
[data-type="addColumn"],
.av__row > .block__icon[draggable] {
diff --git a/app/src/protyle/render/av/attributePanel.ts b/app/src/protyle/render/av/attributePanel.ts
index 3ec69ce724..1d28c2da1e 100644
--- a/app/src/protyle/render/av/attributePanel.ts
+++ b/app/src/protyle/render/av/attributePanel.ts
@@ -58,9 +58,6 @@ export class AVAttributePanel {
this.element.addEventListener("click", (event) => {
const target = event.target as HTMLElement;
if (target.closest('[data-type="toggle-empty"]')) {
- if (this.protyle.disabled) {
- return;
- }
this.showEmptyFields = !this.showEmptyFields;
this.updateEmptyState();
event.preventDefault();
@@ -475,12 +472,12 @@ export class AVAttributePanel {
private updateEmptyState() {
this.element.dataset.readonly = String(Boolean(this.protyle.disabled));
const hideEmpty = window.siyuan.config.editor.databaseAttrHideEmpty;
- if (!hideEmpty || this.protyle.disabled) {
+ if (!hideEmpty) {
this.showEmptyFields = false;
}
updateEmptyState(this.element, hideEmpty && !this.showEmptyFields);
const editElement = this.element.querySelector<HTMLElement>('[data-type="toggle-empty"]');
- editElement?.classList.toggle("fn__none", !hideEmpty || this.collapsed || this.protyle.disabled);
+ editElement?.classList.toggle("fn__none", !hideEmpty || this.collapsed);
editElement?.setAttribute("aria-label", window.siyuan.languages[
this.showEmptyFields ? "hideEmptyFields" : "displayEmptyFields"
]);