If use 'Menu.setApplicationMenu' make all invalid keybord shortcuts


#1

if I use ‘Menu.setApplicationMenu’, can’t do anything with keybord shortcut in render proccess page, such as cmd+c, cmd+v…

ps: Ingore my poor english.


#2

see http://www.pracucci.com/atom-electron-enable-copy-and-paste.html


#3

Copy and paste are commands set in the menu bar, so if you’re setting a new one, you’re erasing the old one and all the keyboard commands attached.

The link you’ve linked to should fix that, assuming you’re setting the template as specified in that link. Specifically:

{
    label: 'Edit',
    submenu: [
      {
        label: 'Undo',
        accelerator: 'CmdOrCtrl+Z',
        role: 'undo'
      },
      {
        label: 'Redo',
        accelerator: 'Shift+CmdOrCtrl+Z',
        role: 'redo'
      },
      {
        type: 'separator'
      },
      {
        label: 'Cut',
        accelerator: 'CmdOrCtrl+X',
        role: 'cut'
      },
      {
        label: 'Copy',
        accelerator: 'CmdOrCtrl+C',
        role: 'copy'
      },
      {
        label: 'Paste',
        accelerator: 'CmdOrCtrl+V',
        role: 'paste'
      },
      {
        label: 'Select All',
        accelerator: 'CmdOrCtrl+A',
        role: 'selectall'
      },
    ]
  }

Which is also available in the docs, https://github.com/atom/electron/blob/master/docs/api/menu.md