feat: improved textarea autosize handling

This commit is contained in:
Björn Fromme
2024-04-04 13:10:28 +02:00
parent 26239488ba
commit 3266d5dc99
@@ -2,11 +2,12 @@ import { Controller } from '@hotwired/stimulus'
export default class extends Controller {
connect() {
this.element.style.height = 'auto'
this.element.rows = 1
this.resize()
}
resize() {
this.element.style.height = 'auto'
this.element.style.height = `${this.element.scrollHeight}px`
}
}