mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
7fe3f7e2d2
commit
12ee5d5c4d
3 changed files with 26 additions and 5 deletions
|
|
@ -7,7 +7,7 @@ import {initNavigationMenu, initFileMenu} from "./navigation";
|
|||
import {initTabMenu} from "./tab";
|
||||
/// #endif
|
||||
import {Menu} from "./Menu";
|
||||
import {hasTopClosestByTag} from "../protyle/util/hasClosest";
|
||||
import {hasClosestByClassName, hasTopClosestByTag} from "../protyle/util/hasClosest";
|
||||
import {App} from "../index";
|
||||
|
||||
|
||||
|
|
@ -73,6 +73,12 @@ export class Menus {
|
|||
break;
|
||||
}
|
||||
|
||||
if (hasClosestByClassName(target, "av__panel") && !hasClosestByClassName(target, "b3-menu")) {
|
||||
document.querySelector(".av__panel").dispatchEvent(new CustomEvent("click", {detail: "close"}))
|
||||
event.stopPropagation();
|
||||
break;
|
||||
}
|
||||
|
||||
target = target.parentElement;
|
||||
}
|
||||
}, false);
|
||||
|
|
|
|||
|
|
@ -439,12 +439,19 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
|
|||
}
|
||||
});
|
||||
}
|
||||
avMaskElement.addEventListener("click", (event) => {
|
||||
|
||||
const removeAvMask = (event: Event) => {
|
||||
if ((event.target as HTMLElement).classList.contains("av__mask")
|
||||
&& document.activeElement.tagName !== "TEXTAREA" && document.activeElement.tagName !== "INPUT") {
|
||||
updateCellValueByInput(protyle, type, blockElement, cellElements);
|
||||
avMaskElement?.remove();
|
||||
}
|
||||
}
|
||||
avMaskElement.addEventListener("click", (event) => {
|
||||
removeAvMask(event)
|
||||
});
|
||||
avMaskElement.addEventListener("contextmenu", (event) => {
|
||||
removeAvMask(event)
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -456,10 +456,14 @@ export const openMenuPanel = (options: {
|
|||
window.siyuan.dragElement = undefined;
|
||||
}
|
||||
});
|
||||
avPanelElement.addEventListener("click", (event) => {
|
||||
avPanelElement.addEventListener("click", (event: MouseEvent) => {
|
||||
let type: string;
|
||||
if (typeof event.detail === "string") {
|
||||
type = event.detail;
|
||||
}
|
||||
let target = event.target as HTMLElement;
|
||||
while (target && !target.isSameNode(avPanelElement)) {
|
||||
const type = target.dataset.type;
|
||||
while (target && !target.isSameNode(avPanelElement) || type) {
|
||||
type = target.dataset.type || type;
|
||||
if (type === "close") {
|
||||
if (!options.protyle.toolbar.subElement.classList.contains("fn__none")) {
|
||||
// 优先关闭资源文件搜索
|
||||
|
|
@ -480,6 +484,7 @@ export const openMenuPanel = (options: {
|
|||
menuElement.innerHTML = getViewHTML(data.view);
|
||||
setPosition(menuElement, tabRect.right - menuElement.clientWidth, tabRect.bottom, tabRect.height);
|
||||
bindViewEvent({protyle: options.protyle, data, menuElement, blockElement: options.blockElement});
|
||||
window.siyuan.menus.menu.remove();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
|
|
@ -488,6 +493,7 @@ export const openMenuPanel = (options: {
|
|||
tabRect = options.blockElement.querySelector(".av__views").getBoundingClientRect();
|
||||
menuElement.innerHTML = getPropertiesHTML(data.view);
|
||||
setPosition(menuElement, tabRect.right - menuElement.clientWidth, tabRect.bottom, tabRect.height);
|
||||
window.siyuan.menus.menu.remove();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
|
|
@ -495,6 +501,7 @@ export const openMenuPanel = (options: {
|
|||
menuElement.innerHTML = getSortsHTML(data.view.columns, data.view.sorts);
|
||||
bindSortsEvent(options.protyle, menuElement, data, blockID);
|
||||
setPosition(menuElement, tabRect.right - menuElement.clientWidth, tabRect.bottom, tabRect.height);
|
||||
window.siyuan.menus.menu.remove();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
|
|
@ -558,6 +565,7 @@ export const openMenuPanel = (options: {
|
|||
} else if (type === "goFilters") {
|
||||
menuElement.innerHTML = getFiltersHTML(data.view);
|
||||
setPosition(menuElement, tabRect.right - menuElement.clientWidth, tabRect.bottom, tabRect.height);
|
||||
window.siyuan.menus.menu.remove();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue