mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-15 08:30:42 +08:00
This commit is contained in:
parent
474718e5ae
commit
fe6e9c68fc
@ -31,6 +31,7 @@ import {newFile} from "../util/newFile";
|
||||
import {MenuItem} from "../menus/Menu";
|
||||
import {escapeHtml} from "../util/escape";
|
||||
import {isWindow} from "../util/functions";
|
||||
import {hideAllElements} from "../protyle/ui/hideElements";
|
||||
|
||||
export class Wnd {
|
||||
public id: string;
|
||||
@ -800,6 +801,7 @@ export class Wnd {
|
||||
}
|
||||
tab.parent = this;
|
||||
resizeTabs();
|
||||
hideAllElements(["toolbar"])
|
||||
}
|
||||
|
||||
public split(direction: TDirection) {
|
||||
|
@ -17,7 +17,7 @@ import {Asset} from "../asset";
|
||||
import {Search} from "../search";
|
||||
import {Dock} from "./dock";
|
||||
import {focusByRange} from "../protyle/util/selection";
|
||||
import {hideElements} from "../protyle/ui/hideElements";
|
||||
import {hideAllElements, hideElements} from "../protyle/ui/hideElements";
|
||||
import {fetchPost} from "../util/fetch";
|
||||
import {hasClosestBlock, hasClosestByClassName} from "../protyle/util/hasClosest";
|
||||
import {getContenteditableElement} from "../protyle/wysiwyg/getBlock";
|
||||
@ -514,10 +514,7 @@ export const resizeTabs = () => {
|
||||
});
|
||||
});
|
||||
pdfResize();
|
||||
document.querySelectorAll(".protyle-gutters").forEach(item => {
|
||||
item.classList.add("fn__none");
|
||||
item.innerHTML = "";
|
||||
});
|
||||
hideAllElements(["gutter"])
|
||||
}, 200);
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,7 @@ export const hideElements = (panels: string[], protyle?: IProtyle, focusHide = f
|
||||
}
|
||||
if (protyle.toolbar && panels.includes("toolbar")) {
|
||||
protyle.toolbar.element.classList.add("fn__none");
|
||||
protyle.toolbar.element.style.display = "";
|
||||
protyle.toolbar.element.style.display = "";
|
||||
}
|
||||
if (protyle.toolbar && panels.includes("util")) {
|
||||
const pinElement = protyle.toolbar.subElement.querySelector('[data-type="pin"]');
|
||||
@ -43,3 +43,24 @@ export const hideElements = (panels: string[], protyle?: IProtyle, focusHide = f
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// "toolbar", "pdfutil", "gutter"
|
||||
export const hideAllElements = (types: string[]) => {
|
||||
if (types.includes("toolbar")) {
|
||||
document.querySelectorAll(".protyle-toolbar").forEach((item: HTMLElement) => {
|
||||
item.classList.add("fn__none");
|
||||
item.style.display = "";
|
||||
});
|
||||
}
|
||||
if (types.includes("pdfutil")) {
|
||||
document.querySelectorAll(".pdf__util").forEach(item => {
|
||||
item.classList.add("fn__none");
|
||||
});
|
||||
}
|
||||
if (types.includes("gutter")) {
|
||||
document.querySelectorAll(".protyle-gutters").forEach(item => {
|
||||
item.classList.add("fn__none");
|
||||
item.innerHTML = "";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import {setEditMode} from "../protyle/util/setEditMode";
|
||||
import {rename} from "../editor/rename";
|
||||
import {Files} from "../layout/dock/Files";
|
||||
import {newDailyNote} from "./mount";
|
||||
import {hideElements} from "../protyle/ui/hideElements";
|
||||
import {hideAllElements, hideElements} from "../protyle/ui/hideElements";
|
||||
import {fetchPost} from "./fetch";
|
||||
import {goBack, goForward} from "./backForward";
|
||||
import {onGet} from "../protyle/util/onGet";
|
||||
@ -825,6 +825,13 @@ export const globalShortcut = () => {
|
||||
window.siyuan.menus.menu.remove();
|
||||
}
|
||||
}
|
||||
// protyle.toolbar 点击空白处时进行隐藏
|
||||
if (!hasClosestByClassName(event.target, "protyle-toolbar")) {
|
||||
hideAllElements(["toolbar"])
|
||||
}
|
||||
if (!hasClosestByClassName(event.target, "pdf__outer")) {
|
||||
hideAllElements(["pdfutil"])
|
||||
}
|
||||
// dock float 时,点击空白处,隐藏 dock
|
||||
const floatDockLayoutElement = hasClosestByClassName(event.target, "layout--float", true);
|
||||
if (floatDockLayoutElement) {
|
||||
@ -846,11 +853,6 @@ export const globalShortcut = () => {
|
||||
window.siyuan.layout.leftDock.hideDock();
|
||||
window.siyuan.layout.rightDock.hideDock();
|
||||
}
|
||||
if (!hasClosestByClassName(event.target, "pdf__outer")) {
|
||||
document.querySelectorAll(".pdf__util").forEach(item => {
|
||||
item.classList.add("fn__none");
|
||||
});
|
||||
}
|
||||
const copyElement = hasTopClosestByClassName(event.target, "protyle-action__copy");
|
||||
if (copyElement) {
|
||||
writeText(copyElement.parentElement.nextElementSibling.textContent.trimEnd());
|
||||
|
Loading…
Reference in New Issue
Block a user