PageSourceSearch

https://3s.info/assets/controllers/copy_field_value_controller-wcjUJ2x.js

js 3s.info collected 2026-10-09 21:40:29 UTC 932 bytes, 31 lines download raw bytes

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.