From ccba986bc2cc375d193c970ec30f94f7b97c32b0 Mon Sep 17 00:00:00 2001 From: kay delaney <45561153+kaydelaney@users.noreply.github.com> Date: Mon, 30 Sep 2019 12:41:47 +0100 Subject: [PATCH] Editor: Brings up suggestions menu after clicking suggestion (#19359) --- .../features/explore/slate-plugins/suggestions.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/public/app/features/explore/slate-plugins/suggestions.tsx b/public/app/features/explore/slate-plugins/suggestions.tsx index d54f7f3095b..60e55cbbdfa 100644 --- a/public/app/features/explore/slate-plugins/suggestions.tsx +++ b/public/app/features/explore/slate-plugins/suggestions.tsx @@ -98,16 +98,14 @@ export default function SuggestionsPlugin({ case 'Tab': { if (hasSuggestions) { event.preventDefault(); - - component.typeaheadRef.insertSuggestion(); - return handleTypeahead(event, editor, onTypeahead, cleanText); + return component.typeaheadRef.insertSuggestion(); } break; } default: { - handleTypeahead(event, editor, onTypeahead, cleanText); + handleTypeahead(editor, onTypeahead, cleanText); break; } } @@ -123,7 +121,9 @@ export default function SuggestionsPlugin({ } // @ts-ignore - return editor.applyTypeahead(suggestion); + const ed = editor.applyTypeahead(suggestion); + handleTypeahead(editor, onTypeahead, cleanText); + return ed; }, applyTypeahead: (editor: CoreEditor, suggestion: CompletionItem): CoreEditor => { @@ -202,7 +202,6 @@ export default function SuggestionsPlugin({ const handleTypeahead = debounce( async ( - event: Event, editor: CoreEditor, onTypeahead?: (typeahead: TypeaheadInput) => Promise, cleanText?: (text: string) => string