1import { Controller } from "@hotwired/stimulus"; 2 3export default class extends Controller { 4 copyTextToClipboard(event) { 5 const { text, tip } = event.params; 6 7 if (navigator.clipboard.writeText) { 8 navigator.clipboard.writeText(text); 9 } else { 10 console.log(`navigator.clipboard.writeText is not supported. If it was supported, the following text would have been copied to it: ${text}`) 11 } 12 13 this.element.classList.add("btn-disabled") 14 15 setTimeout(() => { 16 this.element.classList.remove("btn-disabled") 17 }, 2000) 18 19 if (tip) { 20 this.element.setAttribute("data-tip", tip) 21 this.element.classList.add("tooltip", "tooltip-open") 22 23 setTimeout(() => { 24 this.element.classList.remove("tooltip", "tooltip-open") 25 this.element.removeAttribute("data-tip") 26 }, 2000) 27 } 28 } 29}
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.