Skip to content

Commit 9300d98

Browse files
committed
feat: Improve search functionality to support partial name matching and update metadata display
1 parent 51f9b2e commit 9300d98

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,22 +1159,27 @@
11591159
const items = document.querySelectorAll('.tree-item');
11601160
let matches = 0;
11611161
const total = items.length;
1162+
11621163
items.forEach(item => {
11631164
const nameEl = item.querySelector('.file-name');
11641165
const name = nameEl ? nameEl.textContent.toLowerCase() : '';
1165-
const path = (item.dataset.path || '').toLowerCase();
1166-
const match = !term || name.includes(term) || path.includes(term);
1166+
1167+
// Only search by name, support partial matching
1168+
const match = !term || name.includes(term);
1169+
11671170
item.style.display = match ? '' : 'none';
11681171
item.classList.toggle('search-match', !!term && match);
1172+
11691173
if (term && match) {
11701174
matches += 1;
11711175
openTreeParents(item);
11721176
}
11731177
});
1178+
11741179
if (D.searchMeta) {
11751180
D.searchMeta.textContent = term
11761181
? `${matches} match${matches === 1 ? '' : 'es'} of ${total}`
1177-
: 'Search file and folder names (case-insensitive)';
1182+
: 'Search by file or folder name (partial match supported)';
11781183
}
11791184
if (D.searchClear) {
11801185
D.searchClear.hidden = !term;

0 commit comments

Comments
 (0)