From 01d121ef0fd6c1e923889fab6235d38b7b421d64 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 9 Jul 2023 22:46:33 -0700 Subject: [PATCH] Update mentionSuggestions with new type --- utils/mentionSuggestions.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/utils/mentionSuggestions.tsx b/utils/mentionSuggestions.tsx index 18e4b8a9..e495bfbd 100644 --- a/utils/mentionSuggestions.tsx +++ b/utils/mentionSuggestions.tsx @@ -11,7 +11,7 @@ import { } from '~components/MentionList' import api from '~utils/api' import { numberToElement } from '~utils/elements' -import { get } from 'http' +import { SuggestionOptions } from '~extensions/CustomSuggestion' interface RawSearchResponse { searchable_type: string @@ -44,8 +44,8 @@ function transform(object: RawSearchResponse) { } return result } - -export const mentionSuggestionOptions: MentionOptions['suggestion'] = { +// +export const mentionSuggestionOptions: Omit = { items: async ({ query }): Promise => { const locale = getCookie('NEXT_LOCALE') ? (getCookie('NEXT_LOCALE') as string) @@ -105,6 +105,10 @@ export const mentionSuggestionOptions: MentionOptions['suggestion'] = { return true } + if (props.event.key === 'Tab') { + popup?.hide() + } + if (!component?.ref) { return false }