({key, target}: KeyboardEvent)
| 3 | import showOverlay from '../helpers/overlay.js'; |
| 4 | |
| 5 | async function handler({key, target}: KeyboardEvent): Promise<void> { |
| 6 | if (key !== 'y' || isEditable(target)) { |
| 7 | return; |
| 8 | } |
| 9 | |
| 10 | const url = location.href; |
| 11 | await navigator.clipboard.writeText(url); |
| 12 | // Log to ensure we're coping the new URL |
| 13 | console.log('Copied URL to the clipboard', url); |
| 14 | await showOverlay('Permalink copied to clipboard'); |
| 15 | } |
| 16 | |
| 17 | function init(signal: AbortSignal): void { |
| 18 | globalThis.addEventListener('keyup', handler, {signal}); |
nothing calls this directly
no test coverage detected