feat: improved textarea autosize handling
This commit is contained in:
@@ -2,11 +2,12 @@ import { Controller } from '@hotwired/stimulus'
|
|||||||
|
|
||||||
export default class extends Controller {
|
export default class extends Controller {
|
||||||
connect() {
|
connect() {
|
||||||
this.element.style.height = 'auto'
|
this.element.rows = 1
|
||||||
this.resize()
|
this.resize()
|
||||||
}
|
}
|
||||||
|
|
||||||
resize() {
|
resize() {
|
||||||
|
this.element.style.height = 'auto'
|
||||||
this.element.style.height = `${this.element.scrollHeight}px`
|
this.element.style.height = `${this.element.scrollHeight}px`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user