From 9959c104d4d44537d9d80fb8e7187b93761bc25f Mon Sep 17 00:00:00 2001 From: mateuscmtropical Date: Fri, 20 Nov 2026 11:19:55 -0300 Subject: [PATCH] Fix: Copy image to clipboard not working on Electron 44 and later --- scripts/reading/context-menu.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) mode change 100755 => 100644 scripts/reading/context-menu.js diff --git a/scripts/reading/context-menu.js b/scripts/reading/context-menu.js old mode 100755 new mode 100644 index 1ed96a81a..0f29b7327 --- a/scripts/reading/context-menu.js +++ b/scripts/reading/context-menu.js @@ -542,9 +542,12 @@ async function copyImageToClipboard() URL.revokeObjectURL(data.blob); } - const nativeImage = electron.nativeImage.createFromDataURL(canvas.toDataURL()); + // Electron 44 removed the clipboard module from the renderer, use the web Clipboard API instead + const blob = await new Promise(function(resolve) { + canvas.toBlob(resolve, 'image/png'); + }); - electron.clipboard.writeImage(nativeImage, 'clipboard'); + await navigator.clipboard.write([new ClipboardItem({'image/png': blob})]); events.snackbar({ key: 'copyImageToClipboard',