Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Nov 8, 2019
1 parent 9e9fd9a commit 7b9637c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,3 +1,3 @@
language: node_js
node_js:
- '10'
- '12'
2 changes: 1 addition & 1 deletion fixture.html
Expand Up @@ -5,7 +5,7 @@
<title>Fixture</title>
<script>
window.addEventListener('load', () => {
const contextmenu = require('.');
const contextMenu = require('.');

contextMenu({
window: document.getElementById('webview')
Expand Down
6 changes: 5 additions & 1 deletion fixture.js
Expand Up @@ -43,5 +43,9 @@ contextMenu({
(async () => {
await app.whenReady();

await (new BrowserWindow()).loadFile(path.join(__dirname, 'fixture.html'));
await (new BrowserWindow({
webPreferences: {
nodeIntegration: true
}
})).loadFile(path.join(__dirname, 'fixture.html'));
})();
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -4,7 +4,7 @@ const cliTruncate = require('cli-truncate');
const {download} = require('electron-dl');
const isDev = require('electron-is-dev');

const webContents = win => win.webContents || win.getWebContents();
const webContents = win => win.webContents || (win.getWebContents && win.getWebContents());

const decorateMenuItem = menuItem => {
return (options = {}) => {
Expand Down
9 changes: 5 additions & 4 deletions package.json
Expand Up @@ -11,7 +11,8 @@
},
"scripts": {
"start": "electron fixture.js",
"test": "xo && ava && tsd"
"test": "xo && ava && tsd",
"start-fixture2": "electron fixture-menu.js"
},
"files": [
"index.js",
Expand All @@ -35,9 +36,9 @@
"devDependencies": {
"@types/node": "^12.0.10",
"ava": "^2.1.0",
"electron": "^5.0.0",
"tsd": "^0.7.2",
"xo": "^0.24.0"
"electron": "^7.1.1",
"tsd": "^0.10.0",
"xo": "^0.25.3"
},
"xo": {
"envs": [
Expand Down
16 changes: 8 additions & 8 deletions readme.md
Expand Up @@ -60,7 +60,7 @@ Type: `object`

#### window

Type: `BrowserWindow | WebView`<br>
Type: `BrowserWindow | WebView`

Window or WebView to add the context menu to.

Expand Down Expand Up @@ -88,42 +88,42 @@ The first argument is an array of default actions that can be used. The second a

#### showLookUpSelection

Type: `boolean`<br>
Type: `boolean`\
Default: `true`

Show the `Look Up {selection}` menu item when right-clicking text on macOS.

#### showCopyImage

Type: `boolean`<br>
Type: `boolean`\
Default: `true`

Show the `Copy Image` menu item when right-clicking on an image.

#### showCopyImageAddress

Type: `boolean`<br>
Type: `boolean`\
Default: `false`

Show the `Copy Image Address` menu item when right-clicking on an image.

#### showSaveImageAs

Type: `boolean`<br>
Type: `boolean`\
Default: `false`

Show the `Save Image As…` menu item when right-clicking on an image.

#### showInspectElement

Type: `boolean`<br>
Type: `boolean`\
Default: [Only in development](https://github.com/sindresorhus/electron-is-dev)

Force enable or disable the `Inspect Element` menu item.

#### showServices

Type: `boolean`<br>
Type: `boolean`\
Default: `false`

Show the system `Services` submenu when right-clicking text on macOS.
Expand All @@ -132,7 +132,7 @@ Note: Due to [a bug in the Electron implementation](https://github.com/electron/

#### labels

Type: `object`<br>
Type: `object`\
Default: `{}`

Override labels for the default menu items. Useful for i18n.
Expand Down

0 comments on commit 7b9637c

Please sign in to comment.