From 2ee8167cdc555099a782be397c50a546964df3e3 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Mon, 13 Jan 2025 19:21:37 -0500 Subject: [PATCH] fix: Filtering in suggestion menu --- app/editor/components/MentionMenu.tsx | 3 ++- app/editor/components/SuggestionsMenu.tsx | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/editor/components/MentionMenu.tsx b/app/editor/components/MentionMenu.tsx index 934847730e..87dc7c95d3 100644 --- a/app/editor/components/MentionMenu.tsx +++ b/app/editor/components/MentionMenu.tsx @@ -1,3 +1,4 @@ +import { isEmail } from "class-validator"; import { observer } from "mobx-react"; import { DocumentIcon, PlusIcon } from "outline-icons"; import * as React from "react"; @@ -129,7 +130,7 @@ function MentionMenu({ search, isActive, ...rest }: Props) { title: search?.trim(), section: DocumentsSection, subtitle: t("Create a new doc"), - visible: !!search, + visible: !!search && !isEmail(search), priority: -1, appendSpace: true, attrs: { diff --git a/app/editor/components/SuggestionsMenu.tsx b/app/editor/components/SuggestionsMenu.tsx index 13c71b187b..a8c9ee26ac 100644 --- a/app/editor/components/SuggestionsMenu.tsx +++ b/app/editor/components/SuggestionsMenu.tsx @@ -427,6 +427,10 @@ function SuggestionsMenu(props: Props) { return true; } + if (item.visible === false) { + return false; + } + // Some extensions may be disabled, remove corresponding menu items if ( item.name &&