Sha256: 4c5cb52438dba1d3509e090988b9c82d23dab5f3dac027518b91dfc06ab05858
Contents?: true
Size: 664 Bytes
Versions: 2
Compression:
Stored size: 664 Bytes
Contents
import '@github/clipboard-copy-element' function toggleSVG(svg: SVGElement) { if (svg.style.display === '' || svg.style.display === 'block') { svg.style.display = 'none' } else { svg.style.display = 'block' } } // Toggle a copy button. function toggleCopyButton(button: HTMLElement) { const [clippyIcon, checkIcon] = button.querySelectorAll<SVGElement>('.octicon') if (!clippyIcon || !checkIcon) return toggleSVG(clippyIcon) toggleSVG(checkIcon) } document.addEventListener('clipboard-copy', function ({target}) { if (!(target instanceof HTMLElement)) return toggleCopyButton(target) setTimeout(toggleCopyButton, 2000, target) })
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
primer_view_components-0.0.40 | app/components/primer/clipboard_copy_component.ts |
primer_view_components-0.0.39 | app/components/primer/clipboard_copy_component.ts |