The prompt confirmation system wasn't really working after moving to lexical

The async value setting was biting us here
This commit is contained in:
Jorge Manrubia
2025-07-03 23:29:36 +02:00
parent c134df1bb8
commit 809d23245f
@@ -162,13 +162,15 @@ export default class extends Controller {
this.waitingForConfirmationValue = true
}
#showConfirmationPrompt(confirmationPrompt) {
async #showConfirmationPrompt(confirmationPrompt) {
if (isMultiLineString(confirmationPrompt)) {
this.#showOutput(confirmationPrompt)
this.inputTarget.value = `Apply these changes? [Y/n] `
} else {
this.inputTarget.value = `${confirmationPrompt}? [Y/n] `
}
await nextFrame()
}
#handleConfirmationKey(key) {
@@ -180,16 +182,17 @@ export default class extends Controller {
}
}
#submitWithConfirmation() {
async #submitWithConfirmation() {
this.inputTarget.value = this.originalInputValue
this.confirmationTarget.value = "confirmed"
this.#hideOutput()
await nextFrame()
this.#submitCommand()
}
#submitCommand() {
this.formTarget.requestSubmit()
this.#reset()
}
#showOutput(markdown) {