Vanessa 2023-04-18 11:57:19 +08:00
parent b87510558c
commit 4ccee1a4d8
5 changed files with 43 additions and 15 deletions

View file

@ -1,3 +1,9 @@
/// #if MOBILE
import {getCurrentEditor} from "../../mobile/editor";
/// #else
import {getAllModels} from "../../layout/getAll";
/// #endif
// "gutter", "toolbar", "select", "hint", "util", "dialog"
export const hideElements = (panels: string[], protyle?: IProtyle, focusHide = false) => {
if (!protyle) {
@ -44,7 +50,7 @@ export const hideElements = (panels: string[], protyle?: IProtyle, focusHide = f
}
};
// "toolbar", "pdfutil", "gutter"
// "toolbar", "pdfutil", "gutter", "util"
export const hideAllElements = (types: string[]) => {
if (types.includes("toolbar")) {
document.querySelectorAll(".protyle-toolbar").forEach((item: HTMLElement) => {
@ -52,6 +58,24 @@ export const hideAllElements = (types: string[]) => {
item.style.display = "";
});
}
if (types.includes("util")) {
/// #if MOBILE
const editor = getCurrentEditor()
editor.protyle.toolbar.subElement.classList.add("fn__none");
if (editor.protyle.toolbar.subElementCloseCB) {
editor.protyle.toolbar.subElementCloseCB();
editor.protyle.toolbar.subElementCloseCB = undefined;
}
/// #else
getAllModels().editor.forEach(item => {
item.editor.protyle.toolbar.subElement.classList.add("fn__none");
if (item.editor.protyle.toolbar.subElementCloseCB) {
item.editor.protyle.toolbar.subElementCloseCB();
item.editor.protyle.toolbar.subElementCloseCB = undefined;
}
})
/// #endif
}
if (types.includes("pdfutil")) {
document.querySelectorAll(".pdf__util").forEach(item => {
item.classList.add("fn__none");