Vanessa 2022-09-20 18:28:09 +08:00
parent 3a43c97684
commit 17283d696a
6 changed files with 106 additions and 111 deletions

View file

@ -1,5 +1,5 @@
// "gutter", "toolbar", "select", "hint", "util", "dialog"
export const hideElements = (panels: string[], protyle?: IProtyle) => {
export const hideElements = (panels: string[], protyle?: IProtyle, focusHide = false) => {
if (!protyle) {
if (panels.includes("dialog")) {
for (let i = 0; i < window.siyuan.dialogs.length; i++) {
@ -27,8 +27,12 @@ export const hideElements = (panels: string[], protyle?: IProtyle) => {
}
if (protyle.toolbar && panels.includes("util")) {
const pinElement = protyle.toolbar.subElement.querySelector('[data-type="pin"]');
if (!pinElement || (pinElement && !pinElement.classList.contains("block__icon--active"))) {
if (focusHide || !pinElement || (pinElement && !pinElement.classList.contains("block__icon--active"))) {
protyle.toolbar.subElement.classList.add("fn__none");
if (protyle.toolbar.subElementCloseCB) {
protyle.toolbar.subElementCloseCB();
protyle.toolbar.subElementCloseCB = undefined;
}
}
}
if (panels.includes("select")) {