mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-05 20:30:15 +01:00
This commit is contained in:
parent
b87510558c
commit
4ccee1a4d8
5 changed files with 43 additions and 15 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue