feat(search): 图标面板支持当前源中文名搜索,bump panels 版本

This commit is contained in:
sgp
2026-11-05 01:23:06 +08:00
parent bc9c8e8bba
commit b1b269519d
3 changed files with 9 additions and 3 deletions
+7 -1
View File
@@ -619,9 +619,15 @@ const HGB_UI = (function () {
if (!HGB_IconLib.scoreIcon) {
return list.filter(i => i.name.toLowerCase().includes(ql) || i.id.toLowerCase().includes(ql));
}
// 当前源中文名也可命中(如源「圣诞图标」内搜「圣诞」)
const meta = (typeof HGB_BuiltinIcons !== 'undefined' && HGB_BuiltinIcons.sources &&
HGB_BuiltinIcons.sources[builtinState.source]) || null;
const srcText = meta ? ((meta.name || '') + ' ' + (meta.nameCn || '')).toLowerCase() : '';
const srcHit = ql && srcText.indexOf(ql) !== -1;
const scored = [];
for (const i of list) {
const sc = HGB_IconLib.scoreIcon(i, ql, roots);
let sc = HGB_IconLib.scoreIcon(i, ql, roots);
if (sc < 0 && srcHit) sc = 250;
if (sc >= 0) scored.push({ i, sc });
}
scored.sort((a, b) => a.sc - b.sc);