Vanessa 2024-04-10 22:38:48 +08:00
parent 7fe3f7e2d2
commit 12ee5d5c4d
3 changed files with 26 additions and 5 deletions

View file

@ -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;