mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-09-22 01:29:02 +00:00
Fix #32 Ability to copy and paste a URL
This commit is contained in:
parent
d8fb87ccb5
commit
78a624c23f
@ -56,7 +56,7 @@ function createMainWindow(options, onAppQuit, setDockBadge) {
|
||||
mainWindow.webContents.send('change-zoom', currentZoom);
|
||||
};
|
||||
|
||||
createMenu(options.nativefierVersion, onAppQuit, mainWindow.webContents.goBack, mainWindow.webContents.goForward, onZoomIn, onZoomOut);
|
||||
createMenu(options.nativefierVersion, onAppQuit, mainWindow.webContents.goBack, mainWindow.webContents.goForward, onZoomIn, onZoomOut, mainWindow.webContents.getURL);
|
||||
initContextMenu(mainWindow);
|
||||
|
||||
if (options.userAgent) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
var electron = require('electron');
|
||||
var Menu = electron.Menu;
|
||||
var shell = electron.shell;
|
||||
const clipboard = electron.clipboard;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -10,8 +11,9 @@ var shell = electron.shell;
|
||||
* @param {electron} onGoForward
|
||||
* @param {function} onZoomIn
|
||||
* @param {function} onZoomOut
|
||||
* @param {function} getUrl
|
||||
*/
|
||||
function createMenu(nativefierVersion, onQuit, onGoBack, onGoForward, onZoomIn, onZoomOut) {
|
||||
function createMenu(nativefierVersion, onQuit, onGoBack, onGoForward, onZoomIn, onZoomOut, getUrl) {
|
||||
if (Menu.getApplicationMenu()) {
|
||||
return;
|
||||
}
|
||||
@ -43,6 +45,14 @@ function createMenu(nativefierVersion, onQuit, onGoBack, onGoForward, onZoomIn,
|
||||
accelerator: 'CmdOrCtrl+C',
|
||||
role: 'copy'
|
||||
},
|
||||
{
|
||||
label: 'Copy Current URL',
|
||||
accelerator: 'CmdOrCtrl+C',
|
||||
click: () => {
|
||||
const currentURL = getUrl();
|
||||
clipboard.writeText(currentURL);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Paste',
|
||||
accelerator: 'CmdOrCtrl+V',
|
||||
|
Loading…
Reference in New Issue
Block a user