diff --git a/apps/client/src/features/editor/components/slash-menu/menu-items.layout.test.ts b/apps/client/src/features/editor/components/slash-menu/menu-items.layout.test.ts index c6469ecb..2e45ed30 100644 --- a/apps/client/src/features/editor/components/slash-menu/menu-items.layout.test.ts +++ b/apps/client/src/features/editor/components/slash-menu/menu-items.layout.test.ts @@ -2,7 +2,7 @@ import { describe, it, expect } from "vitest"; import { buildLayoutCandidates, getSuggestionItems, -} from "@/features/editor/components/slash-menu/menu-items.ts"; +} from "./menu-items"; /** * `buildLayoutCandidates` maps a slash query across physical keyboard layouts diff --git a/apps/client/src/features/editor/components/slash-menu/menu-items.ts b/apps/client/src/features/editor/components/slash-menu/menu-items.ts index b6b7f025..f9aaa63f 100644 --- a/apps/client/src/features/editor/components/slash-menu/menu-items.ts +++ b/apps/client/src/features/editor/components/slash-menu/menu-items.ts @@ -889,15 +889,15 @@ export const getSuggestionItems = ({ const search = query.toLowerCase(); const candidates = buildLayoutCandidates(search); // Only the original query is allowed to match via a short substring. Remapped - // (wrong-layout) candidates must be at least REMAP_MIN_LEN chars and differ - // from the original before they can match, so a 1-2 char ASCII query does not - // spuriously substring-match unrelated Cyrillic search terms (e.g. "/cy" -> - // "сн" hitting "сноска", "/b" -> "и" hitting "примечание"). + // (wrong-layout) candidates must be at least REMAP_MIN_LEN chars before they + // can match, so a 1-2 char ASCII query does not spuriously substring-match + // unrelated Cyrillic search terms (e.g. "/cy" -> "сн" hitting "сноска", + // "/b" -> "и" hitting "примечание"). buildLayoutCandidates already dedupes + // the remaps against the original, so candidates[0] is the original query. const REMAP_MIN_LEN = 3; const [originalCandidate, ...remapped] = candidates; const remappedCandidates = remapped.filter( - (candidate) => - candidate.length >= REMAP_MIN_LEN && candidate !== originalCandidate, + (candidate) => candidate.length >= REMAP_MIN_LEN, ); const filteredGroups: SlashMenuGroupedItemsType = {}; const htmlEmbedFeatureEnabled = isHtmlEmbedFeatureEnabled();