mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
This commit is contained in:
parent
7112605f0d
commit
935e5b6d33
1 changed files with 53 additions and 31 deletions
|
|
@ -1626,39 +1626,61 @@ export class Gutter {
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
id: "headingEmbedMode",
|
id: "headingEmbedMode",
|
||||||
label: `<div class="fn__flex" style="margin-bottom: 4px">
|
label: window.siyuan.languages.headingEmbedMode,
|
||||||
<span>${window.siyuan.languages.headingEmbedMode}</span>
|
type: "submenu",
|
||||||
<span class="fn__space fn__flex-1"></span>
|
submenu: [{
|
||||||
<select class="b3-select fn__flex-center" style="margin-left: 8px;">
|
label: window.siyuan.languages.showHeadingWithBlocks,
|
||||||
<option value="0"${nodeElement.getAttribute("custom-heading-mode") === "0" ? " selected" : ""}>${window.siyuan.languages.showHeadingWithBlocks}</option>
|
iconHTML: "",
|
||||||
<option value="1"${nodeElement.getAttribute("custom-heading-mode") === "1" ? " selected" : ""}>${window.siyuan.languages.showHeadingOnlyTitle}</option>
|
checked: nodeElement.getAttribute("custom-heading-mode") === "0",
|
||||||
<option value="2"${nodeElement.getAttribute("custom-heading-mode") === "2" ? " selected" : ""}>${window.siyuan.languages.showHeadingOnlyBlocks}</option>
|
click() {
|
||||||
<option value=""${!nodeElement.getAttribute("custom-heading-mode") ? " selected" : ""}>${window.siyuan.languages.default}</option>
|
nodeElement.setAttribute("custom-heading-mode", "0");
|
||||||
</select>
|
fetchPost("/api/attr/setBlockAttrs", {
|
||||||
</div>`,
|
id,
|
||||||
bind(element) {
|
attrs: {"custom-heading-mode": "0"}
|
||||||
element.addEventListener("change", () => {
|
});
|
||||||
const selectElement = element.querySelector("select") as HTMLSelectElement;
|
|
||||||
const value = selectElement.value;
|
|
||||||
if (value === "") {
|
|
||||||
// 默认设置,清空 custom-heading-mode 属性
|
|
||||||
nodeElement.removeAttribute("custom-heading-mode");
|
|
||||||
fetchPost("/api/attr/setBlockAttrs", {
|
|
||||||
id,
|
|
||||||
attrs: {"custom-heading-mode": ""}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
nodeElement.setAttribute("custom-heading-mode", value);
|
|
||||||
fetchPost("/api/attr/setBlockAttrs", {
|
|
||||||
id,
|
|
||||||
attrs: {"custom-heading-mode": value}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
nodeElement.removeAttribute("data-render");
|
nodeElement.removeAttribute("data-render");
|
||||||
blockRender(protyle, nodeElement);
|
blockRender(protyle, nodeElement);
|
||||||
window.siyuan.menus.menu.remove();
|
}
|
||||||
});
|
}, {
|
||||||
}
|
label: window.siyuan.languages.showHeadingOnlyTitle,
|
||||||
|
iconHTML: "",
|
||||||
|
checked: nodeElement.getAttribute("custom-heading-mode") === "1",
|
||||||
|
click() {
|
||||||
|
nodeElement.setAttribute("custom-heading-mode", "1");
|
||||||
|
fetchPost("/api/attr/setBlockAttrs", {
|
||||||
|
id,
|
||||||
|
attrs: {"custom-heading-mode": "1"}
|
||||||
|
});
|
||||||
|
nodeElement.removeAttribute("data-render");
|
||||||
|
blockRender(protyle, nodeElement);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
label: window.siyuan.languages.showHeadingWithBlocks,
|
||||||
|
iconHTML: "",
|
||||||
|
checked: nodeElement.getAttribute("custom-heading-mode") === "2",
|
||||||
|
click() {
|
||||||
|
nodeElement.setAttribute("custom-heading-mode", "2");
|
||||||
|
fetchPost("/api/attr/setBlockAttrs", {
|
||||||
|
id,
|
||||||
|
attrs: {"custom-heading-mode": "2"}
|
||||||
|
});
|
||||||
|
nodeElement.removeAttribute("data-render");
|
||||||
|
blockRender(protyle, nodeElement);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
label: window.siyuan.languages.default,
|
||||||
|
iconHTML: "",
|
||||||
|
checked: !nodeElement.getAttribute("custom-heading-mode"),
|
||||||
|
click() {
|
||||||
|
nodeElement.setAttribute("custom-heading-mode", "0");
|
||||||
|
fetchPost("/api/attr/setBlockAttrs", {
|
||||||
|
id,
|
||||||
|
attrs: {"custom-heading-mode": ""}
|
||||||
|
});
|
||||||
|
nodeElement.removeAttribute("data-render");
|
||||||
|
blockRender(protyle, nodeElement);
|
||||||
|
}
|
||||||
|
}]
|
||||||
}]
|
}]
|
||||||
}).element);
|
}).element);
|
||||||
} else if (type === "NodeHeading" && !protyle.disabled) {
|
} else if (type === "NodeHeading" && !protyle.disabled) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue