1// Autogrows textareas based on content 2// 3// Example Usage: 4// <%= form.text_area :value, data: {controller: "autogrow", action: "input->autogrow#autogrow"} %> 5 6import { Controller } from "@hotwired/stimulus" 7 8export default class extends Controller { 9 connect() { 10 this.autogrow() 11 } 12 13 autogrow() { 14 this.element.style.height = 'auto' 15 16 // offsetHeight accounts for borders while clientHeight & scrollHeight do not 17 let borderHeight = (this.element.offsetHeight - this.element.clientHeight) 18 19 this.element.style.height = `${this.element.scrollHeight + borderHeight}px` 20 } 21}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.