mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
Editor: Brings up suggestions menu after clicking suggestion (#19359)
This commit is contained in:
parent
649d745262
commit
ccba986bc2
@ -98,16 +98,14 @@ export default function SuggestionsPlugin({
|
|||||||
case 'Tab': {
|
case 'Tab': {
|
||||||
if (hasSuggestions) {
|
if (hasSuggestions) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
return component.typeaheadRef.insertSuggestion();
|
||||||
component.typeaheadRef.insertSuggestion();
|
|
||||||
return handleTypeahead(event, editor, onTypeahead, cleanText);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
handleTypeahead(event, editor, onTypeahead, cleanText);
|
handleTypeahead(editor, onTypeahead, cleanText);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,7 +121,9 @@ export default function SuggestionsPlugin({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return editor.applyTypeahead(suggestion);
|
const ed = editor.applyTypeahead(suggestion);
|
||||||
|
handleTypeahead(editor, onTypeahead, cleanText);
|
||||||
|
return ed;
|
||||||
},
|
},
|
||||||
|
|
||||||
applyTypeahead: (editor: CoreEditor, suggestion: CompletionItem): CoreEditor => {
|
applyTypeahead: (editor: CoreEditor, suggestion: CompletionItem): CoreEditor => {
|
||||||
@ -202,7 +202,6 @@ export default function SuggestionsPlugin({
|
|||||||
|
|
||||||
const handleTypeahead = debounce(
|
const handleTypeahead = debounce(
|
||||||
async (
|
async (
|
||||||
event: Event,
|
|
||||||
editor: CoreEditor,
|
editor: CoreEditor,
|
||||||
onTypeahead?: (typeahead: TypeaheadInput) => Promise<TypeaheadOutput>,
|
onTypeahead?: (typeahead: TypeaheadInput) => Promise<TypeaheadOutput>,
|
||||||
cleanText?: (text: string) => string
|
cleanText?: (text: string) => string
|
||||||
|
Loading…
Reference in New Issue
Block a user