blob: 8a6d05b72d9b012fceb5211fb15796c4d7fb82f1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import features from '../feature-manager.js';
import {isEditable} from '../helpers/dom-utils.js';
async function handler({key, target}: KeyboardEvent): Promise<void> {
if (key === 'y' && !isEditable(target)) {
const url = location.href;
await navigator.clipboard.writeText(url);
// Log to ensure we're coping the new URL
console.log('Copied URL to the clipboard', url);
}
}
function init(signal: AbortSignal): void {
window.addEventListener('keyup', handler, {signal});
}
void features.add(import.meta.url, {
init,
});
|