diff --git a/manifest.json b/manifest.json index 1f2db02..23ff051 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "gridexplorer", "name": "GridExplorer", - "version": "3.1.8", + "version": "3.1.9", "minAppVersion": "1.1.0", "description": "Browse note files in a grid view.", "author": "Devon22", diff --git a/package-lock.json b/package-lock.json index e548a20..de214bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gridexplorer", - "version": "3.1.8", + "version": "3.1.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gridexplorer", - "version": "3.1.8", + "version": "3.1.9", "license": "MIT", "dependencies": { "@esbuild/linux-x64": "0.17.3", diff --git a/package.json b/package.json index f5f4214..94619d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gridexplorer", - "version": "3.1.8", + "version": "3.1.9", "description": "Browse note files in a grid view.", "main": "main.js", "scripts": { diff --git a/src/modal/searchModal.ts b/src/modal/searchModal.ts index 305a46d..6100114 100644 --- a/src/modal/searchModal.ts +++ b/src/modal/searchModal.ts @@ -226,7 +226,13 @@ export class SearchModal extends Modal { const optionsList = [searchScopeContainer, searchNameContainer, searchMediaFilesContainer]; // 監聽輸入框變化來控制清空按鈕的顯示並更新標籤建議 - searchInput.addEventListener('input', () => { + let isComposing = false; + searchInput.addEventListener('compositionstart', () => { + isComposing = true; + }); + searchInput.addEventListener('compositionend', () => { + isComposing = false; + // 合成結束後檢查是否需要 flush 標籤 (處理拼音選詞後的空格) if (/\s/.test(searchInput.value)) { if (flushInput(false, true)) { renderTagButtons(); @@ -236,8 +242,20 @@ export class SearchModal extends Modal { updateTagSuggestions(); }); + searchInput.addEventListener('input', () => { + // 如果正在合成(如拼音輸入中),不執行會中斷輸入的 flush 操作 + if (!isComposing && /\s/.test(searchInput.value)) { + if (flushInput(false, true)) { + renderTagButtons(); + } + } + updateClearButton(); + updateTagSuggestions(); + }); + // 處理上下鍵及 Enter 選擇建議 searchInput.addEventListener('keydown', (e) => { + if (isComposing) return; if (e.key === 'Backspace' && searchInput.value === '') { if (currentInputIndex > 0) { currentInputIndex--; diff --git a/versions.json b/versions.json index 21e03fb..0064452 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,3 @@ { - "3.1.8": "1.1.0" + "3.1.9": "1.1.0" } \ No newline at end of file