aboutsummaryrefslogtreecommitdiff
path: root/src/lib/CommandPalette
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-05-16 06:41:18 -0700
committerFuwn <[email protected]>2025-05-16 06:41:18 -0700
commit345a80d85d4d31b27440510c52ce4eb4ab553b4a (patch)
treeecee18656680671f893b2651a4404e392bbeaca4 /src/lib/CommandPalette
parentfeat(CommandPalette): Only show first 10 results (diff)
downloaddue.moe-345a80d85d4d31b27440510c52ce4eb4ab553b4a.tar.xz
due.moe-345a80d85d4d31b27440510c52ce4eb4ab553b4a.zip
feat(CommandPalette): Ignore whitespace when matching query
Diffstat (limited to 'src/lib/CommandPalette')
-rw-r--r--src/lib/CommandPalette/CommandPalette.svelte9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/CommandPalette/CommandPalette.svelte b/src/lib/CommandPalette/CommandPalette.svelte
index 6bea98ab..cdf962d7 100644
--- a/src/lib/CommandPalette/CommandPalette.svelte
+++ b/src/lib/CommandPalette/CommandPalette.svelte
@@ -21,8 +21,13 @@
});
const doesActionMatch = (action: CommandPaletteAction) =>
- action.name.toLowerCase().includes(search.toLowerCase()) ||
- action.tags?.some((tag) => tag.toLowerCase().includes(search.toLowerCase()));
+ action.name
+ .toLowerCase()
+ .replace(/\s+/g, '')
+ .includes(search.toLowerCase().replace(/\s+/g, '')) ||
+ action.tags?.some((tag) =>
+ tag.toLowerCase().replace(/\s+/g, '').includes(search.toLowerCase().replace(/\s+/g, ''))
+ );
filtered = [];