From acf414bedb32d6f919ba974fef1f8cc3747a5770 Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Thu, 4 Jul 2024 16:54:13 -0400 Subject: [PATCH] add onSelect callback --- public/scripts/autocomplete/AutoComplete.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/scripts/autocomplete/AutoComplete.js b/public/scripts/autocomplete/AutoComplete.js index 09e9f288c..9a7ef6f6a 100644 --- a/public/scripts/autocomplete/AutoComplete.js +++ b/public/scripts/autocomplete/AutoComplete.js @@ -56,6 +56,8 @@ export class AutoComplete { /**@type {function}*/ updateDetailsPositionDebounced; /**@type {function}*/ updateFloatingPositionDebounced; + /**@type {(item:AutoCompleteOption)=>any}*/ onSelect; + get matchType() { return power_user.stscript.matching ?? 'fuzzy'; } @@ -669,6 +671,7 @@ export class AutoComplete { } this.wasForced = false; this.textarea.dispatchEvent(new Event('input', { bubbles:true })); + this.onSelect?.(this.selectedItem); }