Browse Source

:iphone: fix https://github.com/siyuan-note/siyuan/issues/12258

Vanessa 9 months ago
parent
commit
4cc06c4824
2 changed files with 18 additions and 7 deletions
  1. 16 0
      app/src/mobile/menu/search.ts
  2. 2 7
      app/src/search/menu.ts

+ 16 - 0
app/src/mobile/menu/search.ts

@@ -347,6 +347,22 @@ const initSearchEvent = (app: App, element: Element, config: Config.IUILayoutTab
                         return true;
                     }
                 });
+                if (target.parentElement.classList.contains("b3-chip--current")) {
+                    updateConfig(element, {
+                        removed: true,
+                        sort: 0,
+                        group: 0,
+                        hasReplace: false,
+                        method: 0,
+                        hPath: "",
+                        idPath: [],
+                        k: "",
+                        r: "",
+                        page: 1,
+                        types: getDefaultType(),
+                        replaceTypes: Object.assign({}, Constants.SIYUAN_DEFAULT_REPLACETYPES),
+                    }, config);
+                }
                 if (target.parentElement.parentElement.childElementCount === 1) {
                     target.parentElement.parentElement.classList.add("fn__none");
                 }

+ 2 - 7
app/src/search/menu.ts

@@ -634,16 +634,11 @@ export const initCriteriaMenu = (element: HTMLElement, data: Config.IUILayoutTab
             html += `<div data-type="set-criteria" class="${isSame ? "b3-chip--current " : ""}b3-chip b3-chip--middle b3-chip--pointer b3-chip--${["secondary", "primary", "info", "success", "warning", "error", ""][index % 7]}">${escapeHtml(item.name)}<svg class="b3-chip__close" data-type="remove-criteria"><use xlink:href="#iconCloseRound"></use></svg></div>`;
         });
         /// #if MOBILE
-        element.innerHTML = `<div class="b3-chips">
+        element.innerHTML = `<div class="b3-chips${html?"":" fn__none"}">
     ${html}
 </div>`;
-        if (html === "") {
-            element.classList.add("fn__none");
-        } else {
-            element.classList.remove("fn__none");
-        }
         /// #else
-        element.innerHTML = `<div class="b3-chips">
+        element.innerHTML = `<div class="b3-chips${html ? "" : " fn__none"}">
     ${html}
 </div>
 <span class="fn__flex-1"></span>