feat: added cut, copy, paste and show command palette functions in header (#5648)
This commit is contained in:
@@ -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" &&
|
||||
|
||||
Reference in New Issue
Block a user