WebContextMenus: use vesktop native clipboard - fixes some permission issues

This commit is contained in:
Vendicated 2024-01-13 19:05:01 +01:00
parent 8c89002867
commit cb7045c00b
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18

View file

@ -182,6 +182,12 @@ export default definePlugin({
],
async copyImage(url: string) {
if (IS_VESKTOP && VesktopNative.clipboard) {
const data = await fetch(url).then(r => r.arrayBuffer());
VesktopNative.clipboard.copyImage(data, url);
return;
}
// Clipboard only supports image/png, jpeg and similar won't work. Thus, we need to convert it to png
// via canvas first
const img = new Image();