1import { Controller } from "@hotwired/stimulus" 2 3export default class extends Controller { 4 static targets = ["input", "submit"] 5 6 get form() { 7 return this.inputTarget.closest("form") 8 } 9 10 handleKeydown(event) { 11 if (event.key === "Enter" && !event.shiftKey) { 12 event.preventDefault() 13 if (this.inputTarget.value.trim().length > 0) { 14 this.form?.requestSubmit() 15 } 16 } 17 } 18 19 submit() { 20 requestAnimationFrame(() => { 21 this.inputTarget.value = "" 22 this.inputTarget.style.height = "auto" 23 this.inputTarget.focus() 24 }) 25 } 26 27 fillAndSubmit(event) { 28 const prompt = event.currentTarget.dataset.prompt 29 if (prompt) { 30 this.inputTarget.value = prompt 31 this.form?.requestSubmit() 32 } 33 } 34 35 autogrow() { 36 const input = this.inputTarget 37 input.style.height = "auto" 38 input.style.height = Math.min(input.scrollHeight, 120) + "px" 39 } 40}
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.