Skip to content

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

:art: Support database filter composition https://github.com/siyuan-note/siyuan/issues/10550

Daniel804df9d578e2
diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.ts
index 65a582ceba..26d0cc19a6 100644
--- a/app/src/protyle/render/av/filter.ts
+++ b/app/src/protyle/render/av/filter.ts
@@ -302,7 +302,7 @@ export const getFiltersHTML = (data: IAV) => {
${html}
<button class="b3-menu__item" data-type="addFilterCondition" data-path="" data-depth="0">
<svg class="b3-menu__icon"><use xlink:href="#iconAdd"></use></svg>
- <span class="b3-menu__label fn__flex-shrink">${window.siyuan.languages.addFilterCondition}</span>
+ <span class="b3-menu__label" style="flex:none;">${window.siyuan.languages.addFilterCondition}</span>
<svg class="av__filter-arrow"><use xlink:href="#iconDown"></use></svg>
</button>
<button class="b3-menu__item b3-menu__item--warning${leafCount > 0 ? "" : " fn__none"}" data-type="removeFilters">
diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts
index 392bdc5779..8b5d6ed829 100644
--- a/app/src/protyle/render/av/openMenuPanel.ts
+++ b/app/src/protyle/render/av/openMenuPanel.ts
@@ -484,7 +484,8 @@ export const openMenuPanel = (options: {
data: JSON.parse(JSON.stringify(data.view.filters)),
blockID
}]);
- data.view.filters = [];
+ // 本地状态保持“顶层单个空根组”不变量(后端会同样归一化),避免后续 addFilterGroup 误把新分组当成根组
+ data.view.filters = [{combination: "and", filters: []}];
menuElement.innerHTML = getFiltersHTML(data);
setPosition(menuElement, tabRect.right - menuElement.clientWidth, tabRect.bottom, tabRect.height);
window.siyuan.menus.menu.remove();