diff --git a/index.d.ts b/index.d.ts
index 7bbb8d5..4b1c263 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -47,6 +47,11 @@ declare namespace contextMenu {
*/
readonly copyLink?: string;
+ /**
+ @default 'Copy Image'
+ */
+ readonly copyImage?: string;
+
/**
@default 'Copy Image Address'
*/
@@ -78,6 +83,7 @@ declare namespace contextMenu {
readonly paste: (options: ActionOptions) => MenuItem;
readonly saveImage: (options: ActionOptions) => MenuItem;
readonly saveImageAs: (options: ActionOptions) => MenuItem;
+ readonly copyImage: (options: ActionOptions) => MenuItem;
readonly copyImageAddress: (options: ActionOptions) => MenuItem;
readonly inspect: () => MenuItem;
readonly services: () => MenuItem;
@@ -119,6 +125,13 @@ declare namespace contextMenu {
*/
readonly showLookUpSelection?: boolean;
+ /**
+ Show the `Copy Image` menu item when right-clicking on an image.
+
+ @default true
+ */
+ readonly showCopyImage?: boolean;
+
/**
Show the `Copy Image Address` menu item when right-clicking on an image.
@@ -194,11 +207,12 @@ declare namespace contextMenu {
The following options are ignored when `menu` is used:
+ - `showCopyImage`
- `showCopyImageAddress`
- `showSaveImageAs`
- `showInspectElement`
- @default [defaultActions.cut(), defaultActions.copy(), defaultActions.paste(), defaultActions.separator(), defaultActions.saveImage(), defaultActions.saveImageAs(), defaultActions.copyImageAddress(), defaultActions.separator(), defaultActions.copyLink(), defaultActions.separator(), defaultActions.inspect()]
+ @default [defaultActions.cut(), defaultActions.copy(), defaultActions.paste(), defaultActions.separator(), defaultActions.saveImage(), defaultActions.saveImageAs(), defaultActions.copyImage(), defaultActions.copyImageAddress(), defaultActions.separator(), defaultActions.copyLink(), defaultActions.separator(), defaultActions.inspect()]
*/
readonly menu?: (
defaultActions: Actions,
diff --git a/index.js b/index.js
index b3705c1..c30d356 100644
--- a/index.js
+++ b/index.js
@@ -114,6 +114,14 @@ const create = (win, options) => {
});
}
}),
+ copyImage: decorateMenuItem({
+ id: 'copyImage',
+ label: 'Copy Image',
+ visible: props.mediaType === 'image',
+ click() {
+ webContents(win).copyImageAt(props.x, props.y);
+ }
+ }),
copyImageAddress: decorateMenuItem({
id: 'copyImageAddress',
label: 'Copy Image Address',
@@ -157,6 +165,7 @@ const create = (win, options) => {
defaultActions.separator(),
defaultActions.saveImage(),
options.showSaveImageAs && defaultActions.saveImageAs(),
+ options.showCopyImage !== false && defaultActions.copyImage(),
options.showCopyImageAddress && defaultActions.copyImageAddress(),
defaultActions.separator(),
defaultActions.copyLink(),
diff --git a/readme.md b/readme.md
index 78828be..d9698ff 100644
--- a/readme.md
+++ b/readme.md
@@ -93,6 +93,13 @@ Default: `true`
Show the `Look Up {selection}` menu item when right-clicking text on macOS.
+#### showCopyImage
+
+Type: `boolean`
+Default: `true`
+
+Show the `Copy Image` menu item when right-clicking on an image.
+
#### showCopyImageAddress
Type: `boolean`
@@ -176,6 +183,7 @@ Even though you include an action, it will still only be shown/enabled when appr
The following options are ignored when `menu` is used:
- `showLookUpSelection`
+- `showCopyImage`
- `showCopyImageAddress`
- `showSaveImageAs`
- `showInspectElement`
@@ -190,6 +198,7 @@ Default actions:
- `paste`
- `saveImage`
- `saveImageAs`
+- `copyImage`
- `copyImageAddress`
- `copyLink`
- `inspect`