import { app, BrowserWindow } from 'electron';

global.sharedObject = {
  userDataPath: app.getPath('userData')
};

let mainWindow;
const winURL = process.env.NODE_ENV === 'development'
  ? `http://localhost:${require('../../../config').port}`
  : `file://${__dirname}/index.html`;

function createWindow () {
  /**
   * Initial window options
   */
  mainWindow = new BrowserWindow({
    height: 776,
    width: 1276
  });

  mainWindow.loadURL(winURL);

  mainWindow.on('closed', () => {
    mainWindow = null;
  });

  // eslint-disable-next-line no-console
  console.log('mainWindow opened');
}

app.on('ready', createWindow);

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') {
    app.quit();
  }
});

app.on('activate', () => {
  if (mainWindow === null) {
    createWindow();
  }
});

@@ -20,16 +20,22 @@
 erWindow
+, Menu
  %7D from 
@@ -46,16 +46,16 @@
 ctron';%0A
-
 %0Aglobal.
@@ -603,36 +603,1931 @@
 %0A%7D%0A%0A
-app.on('ready', createWindow
+function customizeMenu () %7B%0A  const template = %5B%0A    %7B%0A      label: 'Edit',%0A      submenu: %5B%0A        %7Brole: 'undo'%7D,%0A        %7Brole: 'redo'%7D,%0A        %7Btype: 'separator'%7D,%0A        %7Brole: 'cut'%7D,%0A        %7Brole: 'copy'%7D,%0A        %7Brole: 'paste'%7D,%0A        %7Brole: 'pasteandmatchstyle'%7D,%0A        %7Brole: 'delete'%7D,%0A        %7Brole: 'selectall'%7D%0A      %5D%0A    %7D,%0A    %7B%0A      label: 'View',%0A      submenu: %5B%0A        %7Brole: 'reload'%7D,%0A        %7Brole: 'forcereload'%7D,%0A        %7Brole: 'toggledevtools'%7D,%0A        %7Btype: 'separator'%7D,%0A        %7Brole: 'resetzoom'%7D,%0A        %7Brole: 'zoomin'%7D,%0A        %7Brole: 'zoomout'%7D,%0A        %7Btype: 'separator'%7D,%0A        %7Brole: 'togglefullscreen'%7D%0A      %5D%0A    %7D,%0A    %7B%0A      role: 'window',%0A      submenu: %5B%0A        %7Brole: 'minimize'%7D,%0A        %7Brole: 'close'%7D%0A      %5D%0A    %7D,%0A    %7B%0A      role: 'help',%0A      submenu: %5B%0A        %7B%0A          label: 'Learn More',%0A          click () %7B require('electron').shell.openExternal('https://electron.atom.io'); %7D%0A        %7D%0A      %5D%0A    %7D%0A  %5D;%0A%0A  if (process.platform === 'darwin') %7B%0A    template.unshift(%7B%0A      label: app.getName(),%0A      submenu: %5B%0A        %7Brole: 'about'%7D,%0A        %7Btype: 'separator'%7D,%0A        %7Brole: 'services', submenu: %5B%5D%7D,%0A        %7Btype: 'separator'%7D,%0A        %7Brole: 'hide'%7D,%0A        %7Brole: 'hideothers'%7D,%0A        %7Brole: 'unhide'%7D,%0A        %7Btype: 'separator'%7D,%0A        %7Brole: 'quit'%7D%0A      %5D%0A    %7D);%0A%0A    // Edit menu%0A    template%5B1%5D.submenu.push(%0A      %7Btype: 'separator'%7D,%0A      %7B%0A        label: 'Speech',%0A        submenu: %5B%0A          %7Brole: 'startspeaking'%7D,%0A          %7Brole: 'stopspeaking'%7D%0A        %5D%0A      %7D%0A    );%0A%0A    // Window menu%0A    template%5B3%5D.submenu = %5B%0A      %7Brole: 'close'%7D,%0A      %7Brole: 'minimize'%7D,%0A      %7Brole: 'zoom'%7D,%0A      %7Btype: 'separator'%7D,%0A      %7Brole: 'front'%7D%0A    %5D;%0A  %7D%0A%0A  const menu = Menu.buildFromTemplate(template);%0A  Menu.setApplicationMenu(menu);%0A%7D%0A%0Aapp.on('ready', function () %7B%0A  createWindow();%0A  customizeMenu();%0A%7D
 );%0A%0A

add menus for mac to make it support copy and paste