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.
|
||||
const app = electron.app
|
||||
const Tray = electron.Tray
|
||||
const Menu = electron.Menu
|
||||
|
||||
// Module to create native browser window.
|
||||
const BrowserWindow = electron.BrowserWindow
|
||||
|
||||
|
@ -19,9 +21,7 @@ function createWindow () {
|
|||
}else{
|
||||
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`)
|
||||
|
||||
// Open the DevTools.
|
||||
|
@ -34,12 +34,38 @@ function createWindow () {
|
|||
// when you should delete the corresponding element.
|
||||
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
|
||||
// initialization and is ready to create browser windows.
|
||||
// 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.
|
||||
app.on('window-all-closed', function () {
|
||||
|
|
Loading…
Reference in New Issue