Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions scripts/reading/context-menu.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down