Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/6249

Vanessa0203b299d6b4
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index b2a8d4652e..8d66f38018 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -1184,6 +1184,8 @@ export class Gutter {
click() {
protyle.toolbar.showRender(protyle, nodeElement);
}
+ }, {
+ type: "separator"
}, {
label: `<div class="fn__flex" style="margin-bottom: 4px"><span>${window.siyuan.languages.embedBlockBreadcrumb}</span><span class="fn__space fn__flex-1"></span>
<input type="checkbox" class="b3-switch fn__flex-center"${breadcrumb === "true" ? " checked" : ((window.siyuan.config.editor.embedBlockBreadcrumb && breadcrumb !== "false") ? " checked" : "")}></div>`,
@@ -1203,6 +1205,25 @@ export class Gutter {
window.siyuan.menus.menu.remove();
});
}
+ }, {
+ label: `<div class="fn__flex" style="margin-bottom: 4px"><span>${window.siyuan.languages.hideHeadingBelowBlocks}</span><span class="fn__space fn__flex-1"></span>
+<input type="checkbox" class="b3-switch fn__flex-center"${nodeElement.getAttribute("custom-heading-mode") === "1" ? " checked" : ""}></div>`,
+ bind(element) {
+ element.addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => {
+ const inputElement = element.querySelector("input");
+ if (event.target.tagName !== "INPUT") {
+ inputElement.checked = !inputElement.checked;
+ }
+ nodeElement.setAttribute("custom-heading-mode", inputElement.checked ? "1" : "0");
+ fetchPost("/api/attr/setBlockAttrs", {
+ id,
+ attrs: {"custom-heading-mode": inputElement.checked ? "1" : "0"}
+ });
+ nodeElement.removeAttribute("data-render");
+ blockRender(protyle, nodeElement);
+ window.siyuan.menus.menu.remove();
+ });
+ }
}]
}).element);
} else if (type === "NodeHeading" && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index e2988f0dcc..a6bb994177 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -780,10 +780,6 @@ export class Toolbar {
this.subElement.innerHTML = `<div ${(isPin && this.subElement.firstElementChild.getAttribute("data-drag") === "true") ? 'data-drag="true"' : ""} class="block__popover--move"><div class="block__icons block__icons--border fn__flex">
${title}
<span class="fn__flex-1"></span>
- <label aria-label="${window.siyuan.languages.hideHeadingBelowBlocks}" style="overflow:inherit;" class="b3-tooltips b3-tooltips__nw${!types.includes("NodeBlockQueryEmbed") ? " fn__none" : ""}">
- <input type="checkbox" class="b3-switch">
- <span class="fn__space"></span>
- </label>
<button data-type="refresh" class="block__icon b3-tooltips b3-tooltips__nw${(isPin && !this.subElement.querySelector('[data-type="refresh"]').classList.contains("block__icon--active")) ? "" : " block__icon--active"}${types.includes("NodeBlockQueryEmbed") ? " fn__none" : ""}" aria-label="${window.siyuan.languages.refresh}"><svg><use xlink:href="#iconRefresh"></use></svg></button>
<span class="fn__space"></span>
<button data-type="before" class="block__icon b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages["insert-before"]}"><svg><use xlink:href="#iconBefore"></use></svg></button>
@@ -920,20 +916,6 @@ export class Toolbar {
} else if (isInlineMemo) {
textElement.value = Lute.UnEscapeHTMLStr(renderElement.getAttribute("data-inline-memo-content") || "");
} else {
- const switchElement = this.subElement.querySelector(".b3-switch") as HTMLInputElement;
- if (nodeElement.getAttribute("custom-heading-mode") === "1") {
- switchElement.checked = true;
- }
- switchElement.addEventListener("change", () => {
- hideElements(["util"], protyle);
- nodeElement.setAttribute("custom-heading-mode", switchElement.checked ? "1" : "0");
- fetchPost("/api/attr/setBlockAttrs", {
- id,
- attrs: {"custom-heading-mode": switchElement.checked ? "1" : "0"}
- });
- renderElement.removeAttribute("data-render");
- blockRender(protyle, renderElement);
- });
textElement.value = Lute.UnEscapeHTMLStr(renderElement.getAttribute("data-content") || "");
}