Skip to content

Commit

Permalink
Require Electron 8
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Apr 14, 2020
1 parent 71c5d2e commit 4de32a9
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 18 deletions.
6 changes: 3 additions & 3 deletions index.d.ts
Expand Up @@ -15,7 +15,7 @@ declare namespace contextMenu {
@default 'Correct Automatically'
*/
readonly correctAutomatically?: string;

/**
@default 'Learn Spelling'
*/
Expand All @@ -26,7 +26,7 @@ declare namespace contextMenu {
@default 'Look Up “{selection}”'
*/
readonly lookUpSelection?: string;

/**
@default 'Search with Google'
*/
Expand Down Expand Up @@ -249,7 +249,7 @@ declare namespace contextMenu {
- `showSaveImageAs`
- `showInspectElement`
- `showServices`
To get spellchecking, “Correct Automatically”, and “Learn Spelling” in the menu, please enable the `spellcheck` preference in browser window: `new BrowserWindow({webPreferences: {spellcheck: true}})`
@default [...dictionarySuggestions, defaultActions.separator(), defaultActions.correctAutomatically(), defaultActions.separator(), defaultActions.learnSpelling(), defaultActions.separator(), defaultActions.lookUpSelection(), defaultActions.separator(),defaultActions.searchWithGoogle(), defaultActions.cut(), defaultActions.copy(), defaultActions.paste(), defaultActions.separator(), defaultActions.saveImage(), defaultActions.saveImageAs(), defaultActions.copyLink(), defaultActions.copyImage(), defaultActions.copyImageAddress(), defaultActions.separator(), defaultActions.copyLink(), defaultActions.separator(), defaultActions.inspect()]
Expand Down
8 changes: 4 additions & 4 deletions index.test-d.ts
@@ -1,5 +1,5 @@
import {expectType} from 'tsd';
import {app, BrowserWindow, shell} from 'electron';
import {app} from 'electron';
import contextMenu = require('.');

expectType<void>(contextMenu());
Expand All @@ -15,10 +15,10 @@ contextMenu({

app.on('web-contents-created', (event, webContents) => {
contextMenu({
prepend: (defaultActions, params) => [{
prepend: (defaultActions, parameters) => [{
label: 'Rainbow',
visible: params.mediaType === 'image'
visible: parameters.mediaType === 'image'
}],
window: webContents
});
})
});
2 changes: 1 addition & 1 deletion license
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
27 changes: 20 additions & 7 deletions package.json
Expand Up @@ -8,7 +8,7 @@
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"scripts": {
"start": "electron fixture.js",
Expand All @@ -27,24 +27,37 @@
"menu",
"extensible",
"save",
"image"
"image",
"spellchecking",
"spellcheck",
"spelling",
"spell",
"check",
"correct",
"word",
"words",
"dictionary"
],
"dependencies": {
"cli-truncate": "^2.0.0",
"electron-dl": "^1.2.0",
"electron-dl": "^3.0.0",
"electron-is-dev": "^1.0.1"
},
"devDependencies": {
"@types/node": "^12.0.10",
"ava": "^2.1.0",
"electron": "^8.0.0",
"tsd": "^0.10.0",
"xo": "^0.25.3"
"electron": "^8.2.2",
"tsd": "^0.11.0",
"xo": "^0.29.1"
},
"xo": {
"envs": [
"node",
"browser"
]
],
"rules": {
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off"
}
}
}
6 changes: 3 additions & 3 deletions readme.md
Expand Up @@ -4,7 +4,7 @@
<img src="screenshot.png" width="125" align="right">

Electron doesn't have a built-in context menu. You're supposed to handle that yourself. But it's both tedious and hard to get right. This module gives you a nice extensible context menu with items like `Cut`/`Copy`/`Paste` for text, `Save Image` for images, and `Copy Link` for links. It also adds an `Inspect Element` menu item when in development to quickly view items in the inspector like in Chrome.
Electron doesn't have a built-in context menu. You're supposed to handle that yourself. But it's both tedious and hard to get right. This module gives you a nice extensible context menu with spellchecking and items like `Cut`/`Copy`/`Paste` for text, `Save Image` for images, and `Copy Link` for links. It also adds an `Inspect Element` menu item when in development to quickly view items in the inspector like in Chrome.

You can use this module directly in both the main and renderer process.

Expand All @@ -14,7 +14,7 @@ You can use this module directly in both the main and renderer process.
$ npm install electron-context-menu
```

*Requires Electron 4 or later.*
*Requires Electron 8 or later.*

## Usage

Expand Down Expand Up @@ -207,7 +207,7 @@ The following options are ignored when `menu` is used:
- `showInspectElement`
- `showServices`
- `showSearchWithGoogle`

Default actions:

- `spellCheck`
Expand Down

0 comments on commit 4de32a9

Please sign in to comment.