1import {Controller} from '@hotwired/stimulus'; 2 3/* stimulusFetch: 'lazy' */ 4export default class extends Controller { 5 static targets = ['submit', 'input', 'count']; 6 7 // Reports how much of the note has been typed. The maximum is rendered server-side next to 8 // this number and enforced by the textarea's own maxlength, so only the count changes here. 9 onInput() { 10 if (this.hasCountTarget && this.hasInputTarget) { 11 this.countTarget.textContent = String(this.inputTarget.value.length); 12 } 13 } 14 15 // Disable the submit button while the form is being submitted to prevent duplicate notes, and 16 // show it as busy. The `loading` class restores the button's own colour, which `:disabled` 17 // would otherwise grey out, and reveals the spinner already in the markup. 18 onSubmit() { 19 if (this.hasSubmitTarget) { 20 this.submitTarget.disabled = true; 21 this.submitTarget.classList.add('loading'); 22 this.submitTarget.setAttribute('aria-busy', 'true'); 23 } 24 } 25}
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.