feat: added cut, copy, paste and show command palette functions in header (#5648)

This commit is contained in:
Ariel Leyva authored and GitHub committed 2026-01-18 08:55:20 +01:00
1 parent 550a73b6ba
commit 785b7abb7b
3 files changed
+105 -1

No files matched your search

+14
View File
@@ -51,6 +51,20 @@ export function copy(data: ClipboardArgs, opts?: ClipboardOpts) {
});
}
export function read() {
return new Promise<string>((resolve, reject) => {
if (
// Clipboard API requires secure context
window.isSecureContext &&
typeof navigator.clipboard !== "undefined"
) {
navigator.clipboard.readText().then(resolve).catch(reject);
} else {
reject();
}
});
}
function getPermission(name: string) {
return new Promise<void>((resolve, reject) => {
typeof navigator.permissions !== "undefined" &&