Skip to content

Commit

Permalink
SDA-4481: Add Fix to image cannot be copied
Browse files Browse the repository at this point in the history
  • Loading branch information
NguyenTranHoangSym committed Mar 11, 2024
1 parent 367f888 commit 8aee5a8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/context-menu-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,17 @@ export class ContextMenuBuilder {
* Adds "Copy Image" and "Copy Image URL" items when `src` is valid.
*/
public addImageItems(menu, menuInfo) {
const target = this.getWebContents();
const current = this.getWebContents();
const copyImage = new MenuItem({
label: this.stringTable.copyImage(),
click: (_e) => {
if (!current.mainFrame.name) {
current?.send('copy-to-clipboard', menuInfo.srcURL);
} else {
current.copyImageAt(menuInfo.x, menuInfo.y);
}

logger.info('Context-Menu-Builder: Copy Image to clipboard');
target.send('copy-to-clipboard', menuInfo.srcURL);
},
});

Expand Down

0 comments on commit 8aee5a8

Please sign in to comment.