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

update from upstream #3

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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