From 848162d297e64f2338a73a0e09665efc697e1ea8 Mon Sep 17 00:00:00 2001 From: Daniel Andrei Date: Tue, 9 Jul 2019 16:07:52 +0300 Subject: [PATCH] Add copy image menu item --- index.js | 9 +++++++++ readme.md | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/index.js b/index.js index b3705c1..b2c07cc 100644 --- a/index.js +++ b/index.js @@ -83,6 +83,14 @@ const create = (win, options) => { webContents(win).insertText(clipboardContent); } }), + copyImage: decorateMenuItem({ + id: 'copyImage', + label: 'Copy Image', + visible: props.mediaType === 'image', + click() { + webContents(win).copyImageAt(props.x, props.y); + } + }), saveImage: decorateMenuItem({ id: 'save', label: 'Save Image', @@ -157,6 +165,7 @@ const create = (win, options) => { defaultActions.separator(), defaultActions.saveImage(), options.showSaveImageAs && defaultActions.saveImageAs(), + defaultActions.copyImage(), options.showCopyImageAddress && defaultActions.copyImageAddress(), defaultActions.separator(), defaultActions.copyLink(), diff --git a/readme.md b/readme.md index 78828be..b166825 100644 --- a/readme.md +++ b/readme.md @@ -100,6 +100,13 @@ Default: `false` Show the `Copy Image Address` menu item when right-clicking on an image. +#### showCopyImage + +Type: `boolean`
+Default: `true` + +Show the `Copy Image` menu item when right-clicking on an image. + #### showSaveImageAs Type: `boolean`
@@ -188,6 +195,7 @@ Default actions: - `cut` - `copy` - `paste` +- `copyImage` - `saveImage` - `saveImageAs` - `copyImageAddress`