Enable copy paste for mac?
parent
0f349f1de9
commit
2c39815317
34
main.js
34
main.js
|
@ -3,6 +3,8 @@ var platform = require('os').platform()
|
||||||
// Module to control application life.
|
// Module to control application life.
|
||||||
const app = electron.app
|
const app = electron.app
|
||||||
const Tray = electron.Tray
|
const Tray = electron.Tray
|
||||||
|
const Menu = electron.Menu
|
||||||
|
|
||||||
// Module to create native browser window.
|
// Module to create native browser window.
|
||||||
const BrowserWindow = electron.BrowserWindow
|
const BrowserWindow = electron.BrowserWindow
|
||||||
|
|
||||||
|
@ -19,9 +21,7 @@ function createWindow () {
|
||||||
}else{
|
}else{
|
||||||
mainWindow = new BrowserWindow({width: 1280, height: 800, icon: __dirname + '/src/img/icon.ico'})
|
mainWindow = new BrowserWindow({width: 1280, height: 800, icon: __dirname + '/src/img/icon.ico'})
|
||||||
}
|
}
|
||||||
|
|
||||||
//appIcon = new Tray(trayIcon)
|
|
||||||
// and load the index.html of the app.
|
|
||||||
mainWindow.loadURL(`file://${__dirname}/index.html`)
|
mainWindow.loadURL(`file://${__dirname}/index.html`)
|
||||||
|
|
||||||
// Open the DevTools.
|
// Open the DevTools.
|
||||||
|
@ -34,12 +34,38 @@ function createWindow () {
|
||||||
// when you should delete the corresponding element.
|
// when you should delete the corresponding element.
|
||||||
mainWindow = null
|
mainWindow = null
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var template = [{
|
||||||
|
label: "Application",
|
||||||
|
submenu: [
|
||||||
|
{ label: "Quit", accelerator: "Command+Q", click: function() { app.quit(); }}
|
||||||
|
]}, {
|
||||||
|
label: "Edit",
|
||||||
|
submenu: [
|
||||||
|
{ label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
|
||||||
|
{ label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
|
||||||
|
{ type: "separator" },
|
||||||
|
{ label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
|
||||||
|
{ label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
|
||||||
|
{ label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
|
||||||
|
{ label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" },
|
||||||
|
{ label: "Reload", accelerator: 'CmdOrCtrl+R', click (item, focusedWindow){
|
||||||
|
if (focusedWindow) focusedWindow.reload()
|
||||||
|
}}
|
||||||
|
]}
|
||||||
|
];
|
||||||
|
|
||||||
|
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
|
||||||
|
mainWindow.setMenuBarVisibility(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method will be called when Electron has finished
|
// This method will be called when Electron has finished
|
||||||
// initialization and is ready to create browser windows.
|
// initialization and is ready to create browser windows.
|
||||||
// Some APIs can only be used after this event occurs.
|
// Some APIs can only be used after this event occurs.
|
||||||
app.on('ready', createWindow)
|
app.on('ready', function(){
|
||||||
|
createWindow()
|
||||||
|
mainWindow.maximize()
|
||||||
|
})
|
||||||
|
|
||||||
// Quit when all windows are closed.
|
// Quit when all windows are closed.
|
||||||
app.on('window-all-closed', function () {
|
app.on('window-all-closed', function () {
|
||||||
|
|
Loading…
Reference in New Issue