1import { Controller } from '@hotwired/stimulus'; 2 3/** 4 * ÐопиÑÑÐµÑ value из source input в destination input по id. 5 * 6 * <div data-controller="copy-field-value" 7 * data-copy-field-value-source-id-value="â¦" 8 * data-copy-field-value-destination-id-value="â¦"> 9 * <button type="button" data-action="click->copy-field-value#copy">â¦</button> 10 * </div> 11 */ 12export default class extends Controller { 13 static values = { 14 sourceId: String, 15 destinationId: String, 16 }; 17 18 copy(event) { 19 event.preventDefault(); 20 21 const source = document.getElementById(this.sourceIdValue); 22 const destination = document.getElementById(this.destinationIdValue); 23 if (!source || !destination) { 24 return; 25 } 26 27 destination.value = source.value; 28 destination.dispatchEvent(new Event('input', { bubbles: true })); 29 destination.dispatchEvent(new Event('change', { bubbles: true })); 30 } 31}
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.