MCPcopy
hub / github.com/refined-github/refined-github / handler

Function handler

source/features/copy-on-y.tsx:5–15  ·  view source on GitHub ↗
({key, target}: KeyboardEvent)

Source from the content-addressed store, hash-verified

3import showOverlay from '../helpers/overlay.js';
4
5async 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
17function init(signal: AbortSignal): void {
18 globalThis.addEventListener('keyup', handler, {signal});

Callers

nothing calls this directly

Calls 2

isEditableFunction · 0.85
showOverlayFunction · 0.85

Tested by

no test coverage detected