Fix send button not enabling after revert/undo
When restoring message text to prompt input after revert/undo, dispatch input event to trigger textarea's onInput handler. This updates the prompt signal and enables the send button immediately.
This commit is contained in:
@@ -101,6 +101,7 @@ const SessionView: Component<{
|
||||
const textarea = document.querySelector(".prompt-input") as HTMLTextAreaElement
|
||||
if (textarea) {
|
||||
textarea.value = textParts.map((p: any) => p.text).join("\n")
|
||||
textarea.dispatchEvent(new Event("input", { bubbles: true }))
|
||||
textarea.focus()
|
||||
}
|
||||
}
|
||||
@@ -469,6 +470,7 @@ const App: Component = () => {
|
||||
const textarea = document.querySelector(".prompt-input") as HTMLTextAreaElement
|
||||
if (textarea) {
|
||||
textarea.value = textParts.map((p: any) => p.text).join("\n")
|
||||
textarea.dispatchEvent(new Event("input", { bubbles: true }))
|
||||
textarea.focus()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user