An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Show search clear buttons consistently https://github.com/siyuan-note/siyuan/issues/19413
Daniel6dcb6110cae1
diff --git a/app/src/mobile/menu/search.ts b/app/src/mobile/menu/search.tsindex 99b1e2a109..3661e08519 100644--- a/app/src/mobile/menu/search.ts+++ b/app/src/mobile/menu/search.ts@@ -152,8 +152,10 @@ const updateConfig = (element: Element, newConfig: Config.IUILayoutTabSearchConf}if (newConfig.k || clear) {(document.querySelector("#toolbarSearch") as HTMLInputElement).value = newConfig.k;+ document.querySelector("#toolbarSearch").dispatchEvent(new Event("change"));}(element.querySelector("#toolbarReplace") as HTMLInputElement).value = newConfig.r;+ element.querySelector("#toolbarReplace").dispatchEvent(new Event("change"));config = JSON.parse(JSON.stringify(newConfig));window.siyuan.storage[Constants.LOCAL_SEARCHDATA] = Object.assign({}, config);setStorageVal(Constants.LOCAL_SEARCHDATA, window.siyuan.storage[Constants.LOCAL_SEARCHDATA]);diff --git a/app/src/search/toggleHistory.ts b/app/src/search/toggleHistory.tsindex d442cbe7fc..d644a7b24d 100644--- a/app/src/search/toggleHistory.ts+++ b/app/src/search/toggleHistory.ts@@ -55,6 +55,7 @@ export const toggleReplaceHistory = (replaceInputElement: HTMLInputElement) => {}} else {replaceInputElement.value = element.textContent;+ replaceInputElement.dispatchEvent(new Event("change"));window.siyuan.menus.menu.remove();}itemEvent.preventDefault();@@ -125,6 +126,7 @@ export const toggleSearchHistory = (searchElement: Element, config: Config.IUILa}} else {searchInputElement.value = s;+ searchInputElement.dispatchEvent(new Event("change"));saveKeyList("keys", s, config);config.page = 1;/// #if MOBILE@@ -201,6 +203,7 @@ export const toggleAssetHistory = (assetElement: Element) => {}} else {assetInputElement.value = element.textContent;+ assetInputElement.dispatchEvent(new Event("change"));assetInputEvent(assetElement);window.siyuan.menus.menu.remove();}diff --git a/app/src/util/addClearButton.ts b/app/src/util/addClearButton.tsindex cb3177cc09..6a138f1a48 100644--- a/app/src/util/addClearButton.ts+++ b/app/src/util/addClearButton.ts@@ -52,6 +52,9 @@ export const addClearButton = (options: {options.inputElement.addEventListener("input", () => {update(options.inputElement, clearElement, options.right, contenteditable);});+ options.inputElement.addEventListener("change", () => {+ update(options.inputElement, clearElement, options.right, contenteditable);+ });// contenteditable 剪切不会触发 inputif (contenteditable) {options.inputElement.addEventListener("cut", () => {diff --git a/app/src/util/pathName.ts b/app/src/util/pathName.tsindex 8d401af8f8..f801af2d41 100644--- a/app/src/util/pathName.ts+++ b/app/src/util/pathName.ts@@ -20,6 +20,7 @@ import {mergePathSegments} from "./mergePathSegments";import {expandFileTree} from "../layout/dock/fileTreeAnimation";import {getHostCapabilities} from "./hostCapabilities";import {highlightSearchText} from "./searchHighlight";+import {addClearButton} from "./addClearButton";export const useShell = (cmd: "showItemInFolder" | "openPath", filePath: string) => {if (!getHostCapabilities().localFileSystem) {@@ -446,6 +447,7 @@ export const movePathTo = (options: {}} else {inputElement.value = s;+ inputElement.dispatchEvent(new Event("change"));saveMovePathHistory();inputEvent();window.siyuan.menus.menu.remove();@@ -472,6 +474,14 @@ export const movePathTo = (options: {});};inputEvent();+ addClearButton({+ inputElement,+ right: 8,+ clearCB() {+ saveMovePathHistory();+ inputEvent();+ }+ });inputElement.addEventListener("compositionend", (event: InputEvent) => {inputEvent(event);});