Skip to content
This repository was archived by the owner on Jul 21, 2024. It is now read-only.

update from upstream #3

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3efba17
Add `showSelectAll` option (#160)
hns258 Aug 11, 2022
584bb1f
3.4.0
sindresorhus Aug 11, 2022
157a5ad
Fix typo in readme example (#162)
tauraloke Aug 16, 2022
ddc4036
Meta tweaks
sindresorhus Aug 16, 2022
c50c1f5
Add menu items to save and copy video (#161)
and80506 Aug 19, 2022
27f85a1
3.5.0
sindresorhus Aug 19, 2022
9ed5d4b
Allow copying whitespace-only text (#166)
BrandonXLF Oct 26, 2022
48b43f9
Add `showCopyLink` option (#165)
absidue Oct 26, 2022
503c4aa
3.6.0
sindresorhus Oct 26, 2022
cc69dea
Fix "Inspect Element" not working in `BrowserView` (#167)
yocontra Dec 3, 2022
b150d0a
3.6.1
sindresorhus Dec 3, 2022
a388241
Fix readme for more recent Electron versions (#169)
samuel-fringeli Aug 12, 2023
3b72a26
Require Node.js 18 and Electron 30 and move to ESM
sindresorhus May 1, 2024
d48f868
4.0.0
sindresorhus May 1, 2024
3cfcb4b
Fix menu disposal (#180)
lovemegowin Jun 26, 2024
2193d7a
4.0.1
sindresorhus Jun 26, 2024
a4be72c
Fix clean up in the case of the window close event being prevented (#…
lovemegowin Aug 23, 2024
125230e
4.0.2
sindresorhus Aug 23, 2024
d2c3c73
Fix cleaning up window (#183)
benoitf Aug 28, 2024
691c307
4.0.3
sindresorhus Aug 28, 2024
fe0e088
Fix the `window` option (#185)
quanglam2807 Aug 29, 2024
72da237
4.0.4
sindresorhus Aug 29, 2024
9fd50d8
Fix `WebContentsView` crash on app quit (#191)
kethinov Feb 6, 2025
33fd1df
4.0.5
sindresorhus Feb 6, 2025
edaf4f9
Accept `WebContentsView` type in `window` option (#194)
timche May 21, 2025
1ad08ae
4.1.0
sindresorhus May 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/funding.yml

This file was deleted.

7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ jobs:
fail-fast: false
matrix:
node-version:
- 14
- 20
- 18
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
37 changes: 20 additions & 17 deletions fixtures/fixture-menu.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,44 @@
'use strict';
const path = require('path');
const {
app,
BrowserWindow
} = require('electron');
const contextMenu = require('..');
import path from 'node:path';
import {app, BrowserWindow} from 'electron';
import contextMenu from '../index.js';

contextMenu({
menu: actions => [
actions.separator(),
actions.copyLink({
transform: content => `modified_link_${content}`
transform: content => `modified_link_${content}`,
}),
actions.separator(),
{
label: 'Unicorn'
label: 'Unicorn',
},
actions.separator(),
actions.saveVideo(),
actions.saveVideoAs(),
actions.copyVideoAddress({
transform: content => `modified_copy_${content}`,
}),
actions.separator(),
actions.copy({
transform: content => `modified_copy_${content}`
transform: content => `modified_copy_${content}`,
}),
{
label: 'Invisible',
visible: false
visible: false,
},
actions.paste({
transform: content => `modified_paste_${content}`
})
]
transform: content => `modified_paste_${content}`,
}),
],
});

// eslint-disable-next-line unicorn/prefer-top-level-await
(async () => {
await app.whenReady();

await (new BrowserWindow({
webPreferences: {
spellcheck: true
}
})).loadFile(path.join(__dirname, 'fixture.html'));
spellcheck: true,
},
})).loadFile(path.join(import.meta.dirname, 'fixture.html'));
})();
12 changes: 6 additions & 6 deletions fixtures/fixture-toggle.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'use strict';
const path = require('path');
const {app, BrowserWindow} = require('electron');
import path from 'node:path';
import {app, BrowserWindow} from 'electron';

// eslint-disable-next-line unicorn/prefer-top-level-await
(async () => {
await app.whenReady();

await (new BrowserWindow({
webPreferences: {
nodeIntegration: true
}
})).loadFile(path.join(__dirname, 'fixture-toggle.html'));
nodeIntegration: true,
},
})).loadFile(path.join(import.meta.dirname, 'fixture-toggle.html'));
})();
5 changes: 5 additions & 0 deletions fixtures/fixture.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ <h1>Fixture</h1>
<br>
<img src="fixture.jpg">
<br>
<br>
<video controls width="250">
<source src="flower.mp4" type="video/mp4">
Sorry, your browser doesn't support embedded videos.
</video>
<div contenteditable="true"><strong>Editable text</strong></div>
<br>
<a href="https://github.com">Link</a>
Expand Down
37 changes: 20 additions & 17 deletions fixtures/fixture.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
const path = require('path');
const {app, BrowserWindow} = require('electron');
const contextMenu = require('..');
import path from 'node:path';
import {app, BrowserWindow} from 'electron';
import contextMenu from '../index.js';

contextMenu({
labels: {
Expand All @@ -12,42 +11,46 @@ contextMenu({
saveImageAs: 'Configured Save Image As…',
copyLink: 'Configured Copy Link',
saveLinkAs: 'Configured Save Link As…',
inspect: 'Configured Inspect'
inspect: 'Configured Inspect',
},
prepend: () => [
{
label: 'Unicorn'
label: 'Unicorn',
},
{
type: 'separator'
type: 'separator',
},
{
type: 'separator'
type: 'separator',
},
{
label: 'Invisible',
visible: false
visible: false,
},
{
type: 'separator'
type: 'separator',
},
{
type: 'separator'
}
type: 'separator',
},
],
append: () => {},
append() {},
showSelectAll: true,
showCopyImageAddress: true,
showSaveImageAs: true,
showCopyVideoAddress: true,
showSaveVideoAs: true,
showInspectElement: false,
showSaveLinkAs: true
showSaveLinkAs: true,
});

// eslint-disable-next-line unicorn/prefer-top-level-await
(async () => {
await app.whenReady();

await (new BrowserWindow({
webPreferences: {
spellcheck: true
}
})).loadFile(path.join(__dirname, 'fixture.html'));
spellcheck: true,
},
})).loadFile(path.join(import.meta.dirname, 'fixture.html'));
})();
Binary file added fixtures/flower.mp4
Binary file not shown.
Loading