diff --git a/manifest.json b/manifest.json index 4a8a930..87d9d14 100644 --- a/manifest.json +++ b/manifest.json @@ -5,5 +5,5 @@ "author": "lazyloong", "minAppVersion": "1.0.0", - "version": "2.24.1" + "version": "2.25.0" } diff --git a/src/modal/fileModal.ts b/src/modal/fileModal.ts index 0de408a..4485f1c 100644 --- a/src/modal/fileModal.ts +++ b/src/modal/fileModal.ts @@ -254,17 +254,15 @@ export default class FileModal extends FuzzyModal { lastNode.itemIndex = matchData1.map((p) => p.item); lastNode.itemIndexByPath = matchData2.map((p) => p.item); // 去除重复的笔记 - let result = matchData.reduce((acc, cur) => { + let result = matchData.reduce((acc, cur) => { if (cur.item.type === "link") { acc.push(cur); } else { - const existingItemIndex = acc.findIndex( - (item) => item.item.path === cur.item.path && item.score < cur.score - ); - if (existingItemIndex !== -1) { - acc[existingItemIndex] = cur; - } else { + const existingItemIndex = acc.findIndex((item) => item.item.path === cur.item.path); + if (existingItemIndex === -1) { acc.push(cur); + } else if (cur.score > acc[existingItemIndex].score) { + acc[existingItemIndex] = cur; } } return acc;