Skip to content

Commit

Permalink
Hotfix: Make Cmd+Enter work on assistant instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
krschacht committed May 17, 2024
1 parent f37f2e1 commit 05f3d6e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
8 changes: 0 additions & 8 deletions app/javascript/stimulus/form_controller.js

This file was deleted.

3 changes: 2 additions & 1 deletion app/javascript/stimulus/keyboard_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = [ "keyboardable" ]

click() {
click(event) {
let element

if (this.hasKeyboardableTarget)
Expand All @@ -12,6 +12,7 @@ export default class extends Controller {
element = this.element

element.click()
event.preventDefault()
}

get lastOfTheTargets() {
Expand Down
6 changes: 5 additions & 1 deletion app/javascript/stimulus/textarea_autogrow_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class extends Controller {
this.autogrow()

this.element.addEventListener('input', this.throttledAutogrow)
window.addEventListener('turbo:morph', () => this.throttledAutogrow)
window.addEventListener('turbo:morph', this.throttledAutogrow)
window.addEventListener('resize', this.throttledAutogrow)
window.addEventListener('main-column-changed', this.throttledAutogrow)
}
Expand All @@ -34,4 +34,8 @@ export default class extends Controller {

if (prevHeight != newHeight) window.dispatchEvent(new CustomEvent('main-column-changed'))
}

submitForm() {
this.element.closest('form').requestSubmit()
}
}

0 comments on commit 05f3d6e

Please sign in to comment.