diff options
author | leo60228 <leo@60228.dev> | 2024-09-11 18:28:06 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-01-10 18:51:25 -0400 |
commit | ca03d7becf6eff26664d3aab7e43a14f5f6c62c9 (patch) | |
tree | f9e8a4a4b837a86379d16a0422d0aa9d431b5e25 /src | |
parent | 55dad23c4b65f9040b6b3e97c05813263b009ef7 (diff) |
avoid replacing results after focusing
Diffstat (limited to 'src')
-rw-r--r-- | src/static/js/client/sidebar-search.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/static/js/client/sidebar-search.js b/src/static/js/client/sidebar-search.js index 34d2161f..ae18c930 100644 --- a/src/static/js/client/sidebar-search.js +++ b/src/static/js/client/sidebar-search.js @@ -303,15 +303,20 @@ export function mutatePageContent() { export function addPageListeners() { if (!info.searchInput) return; + let prevValue = null; info.searchInput.addEventListener('change', _domEvent => { - if (info.searchInput.value) { + if (info.searchInput.value && info.searchInput.value !== prevValue) { activateSidebarSearch(info.searchInput.value); } + prevValue = info.searchInput.value; }); info.searchInput.addEventListener('input', _domEvent => { const {settings, state} = info; + if (prevValue === info.searchInput.value) return; + prevValue = info.searchInput.value; + if (!info.searchInput.value) { clearSidebarSearch(); return; |