Skip to content

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

:art: Hide heading number format when numbering is disabled https://github.com/siyuan-note/siyuan/issues/522

Daniel583ed0a4ac8b
diff --git a/app/src/config/tabs/editorTab.ts b/app/src/config/tabs/editorTab.ts
index 5120d031f8..0b0b5bcdc4 100644
--- a/app/src/config/tabs/editorTab.ts
+++ b/app/src/config/tabs/editorTab.ts
@@ -114,6 +114,21 @@ const bindDatabaseAttrSettingsVisibility = (root: HTMLElement) => {
toggle();
};
+const bindHeadingNumberFormatVisibility = (root: HTMLElement) => {
+ const headingNumberSwitch = root.querySelector<HTMLInputElement>(`#${CSS.escape("editor.headingNumber")}`);
+ if (!headingNumberSwitch) {
+ return;
+ }
+ const toggle = () => {
+ root.querySelector(`#${CSS.escape("editor.headingNumberFormat")}`)?.closest(".config-item")?.classList.toggle(
+ "fn__none",
+ !headingNumberSwitch.checked,
+ );
+ };
+ headingNumberSwitch.addEventListener("change", toggle);
+ toggle();
+};
+
const registerEditorBlockFeaturesGroup = (tab: SettingTabBuilder) => {
const group = tab.group("blockFeatures", window.siyuan.languages.configGroupBlockFeatures);
group.switch("editor.displayNetImgMark", {
@@ -131,6 +146,7 @@ const registerEditorBlockFeaturesGroup = (tab: SettingTabBuilder) => {
group.switch("editor.headingNumber", {
title: window.siyuan.languages.headingNumber,
desc: window.siyuan.languages.headingNumberTip,
+ afterMount: bindHeadingNumberFormatVisibility,
});
group.select("editor.headingNumberFormat", {
title: window.siyuan.languages.headingNumberFormat,