Merge pull request #3 from HalfMAI/fix_input_event

This commit is contained in:
Dominik Reh
2022-10-13 08:06:22 +02:00
committed by GitHub

View File

@@ -182,6 +182,10 @@ function insertTextAtCursor(text, tagword) {
prompt = promptTextbox.value;
promptTextbox.selectionEnd = promptTextbox.selectionStart;
// Since we've modified a Gradio Textbox component manually, we need to simulate an `input` DOM event to ensure its
// internal Svelte data binding remains in sync.
promptTextbox.dispatchEvent(new Event("input", { bubbles: true }));
// Hide results after inserting
hideResults();