From 345a80d85d4d31b27440510c52ce4eb4ab553b4a Mon Sep 17 00:00:00 2001 From: Fuwn Date: Fri, 16 May 2025 06:41:18 -0700 Subject: feat(CommandPalette): Ignore whitespace when matching query --- src/lib/CommandPalette/CommandPalette.svelte | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/lib/CommandPalette') 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 = []; -- cgit v1.2.3