Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/10550#issuecomment-4750341467

Daniel24cfd1c8f128
diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.ts
index 68feb581ff..43c2bf72fa 100644
--- a/app/src/protyle/render/av/filter.ts
+++ b/app/src/protyle/render/av/filter.ts
@@ -679,6 +679,11 @@ export const commitFilter = (data: IAV, path: string, newFilter: IAVFilter, prot
// bindInlineFilterEvents 绑定内联筛选编辑的事件(事件委托到面板)。即时保存。
export const bindInlineFilterEvents = (panelElement: HTMLElement, data: IAV, protyle: IProtyle, blockID: string, avID: string) => {
+ // 防重复绑定:事件委托绑在 panelElement 上,同一面板实例只需绑一次
+ if (panelElement.dataset.filterEventsBound === "true") {
+ return;
+ }
+ panelElement.dataset.filterEventsBound = "true";
const menuElement = panelElement.querySelector(".b3-menu") as HTMLElement;
const fields = getFieldsByData(data);
diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts
index 9506c46158..b01f4f205a 100644
--- a/app/src/protyle/render/av/openMenuPanel.ts
+++ b/app/src/protyle/render/av/openMenuPanel.ts
@@ -475,6 +475,8 @@ export const openMenuPanel = (options: {
break;
} else if (type === "goFilters") {
menuElement.innerHTML = getFiltersHTML(data);
+ menuElement.setAttribute("style", "min-width: 340px;max-width: 80vw;width: fit-content;");
+ bindInlineFilterEvents(avPanelElement as HTMLElement, data, options.protyle, blockID, avID);
setPosition(menuElement, tabRect.right - menuElement.clientWidth, tabRect.bottom, tabRect.height);
window.siyuan.menus.menu.remove();
event.preventDefault();