mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-29 19:56:10 +01:00
🎨 点击其余地方需关闭字体面板
This commit is contained in:
parent
f1ed7ea50d
commit
bc75e7491d
3 changed files with 22 additions and 18 deletions
|
|
@ -32,6 +32,13 @@ export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {
|
|||
}
|
||||
}
|
||||
|
||||
if (!hasTopClosestByClassName(event.target, "protyle-util") &&
|
||||
!hasTopClosestByClassName(event.target, "protyle-toolbar")) {
|
||||
document.querySelectorAll(".protyle-font").forEach((item: HTMLElement) => {
|
||||
item.parentElement.classList.add("fn__none");
|
||||
});
|
||||
}
|
||||
|
||||
const copyElement = hasTopClosestByClassName(event.target, "protyle-action__copy");
|
||||
if (copyElement) {
|
||||
let text = copyElement.parentElement.nextElementSibling.textContent.replace(/\n$/, "");
|
||||
|
|
|
|||
|
|
@ -62,10 +62,13 @@ export const hideAllElements = (types: string[]) => {
|
|||
if (types.includes("util")) {
|
||||
getAllEditor().forEach(item => {
|
||||
if (item.protyle.toolbar) {
|
||||
item.protyle.toolbar.subElement.classList.add("fn__none");
|
||||
if (item.protyle.toolbar.subElementCloseCB) {
|
||||
item.protyle.toolbar.subElementCloseCB();
|
||||
item.protyle.toolbar.subElementCloseCB = undefined;
|
||||
const pinElement = item.protyle.toolbar.subElement.querySelector('[data-type="pin"]');
|
||||
if (!pinElement || (pinElement && pinElement.getAttribute("aria-label") === window.siyuan.languages.pin)) {
|
||||
item.protyle.toolbar.subElement.classList.add("fn__none");
|
||||
if (item.protyle.toolbar.subElementCloseCB) {
|
||||
item.protyle.toolbar.subElementCloseCB();
|
||||
item.protyle.toolbar.subElementCloseCB = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue