aj-techsoul / ELECTRON-4-PHP

An easiest way to use php in electron
MIT License
202 stars 46 forks source link

Copy and Paste Disabled by Default #5

Closed ryanpamplin closed 6 years ago

ryanpamplin commented 6 years ago

Hello. Copy and paste doesn't seem to work. I've read that you need to enable it with Electron, but I was thinking most people will probably want it on by default with your project.

Thank you!

aj-techsoul commented 6 years ago

please explain copy paste where from where 🤔🤔🤔???

ryanpamplin commented 6 years ago

When you test the app it works fine, but when you make a build, copy and paste functionality doesn't work. See: https://pracucci.com/atom-electron-enable-copy-and-paste.html

aj-techsoul commented 6 years ago

I am still figuring out, i tried fixing this issue. But no menu was showing neither on testing nor on build. If somebody can fix this and send me the code then i would add it.

aj-techsoul commented 6 years ago

@ryanpamplin Its fixed now by following code and updated in master. So please let me know is it working as you feel it to be or not. :)

///////////////////////////////

app.on('ready', () => {
  createWindow()
  if (process.platform === 'darwin') {
    var template = [{
      label: 'FromScratch',
      submenu: [{
        label: 'Quit',
        accelerator: 'CmdOrCtrl+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:'
      }]
    }];
    var osxMenu = Menu.buildFromTemplate(template);
    Menu.setApplicationMenu(osxMenu);
  }
})

helped by answer here https://github.com/ahmadudin/electron-instaPy-GUI/issues/6