Browse Source

Adds cut/copy/paste to macOS Desktop

Former-commit-id: 3a24853753536f7ac790f61aad37544737d370e9
David Benson 7 years ago
parent
commit
55bafbbabf
1 changed files with 40 additions and 0 deletions
  1. 40 0
      war/electron.js

+ 40 - 0
war/electron.js

@@ -143,6 +143,46 @@ app.on('ready', e =>
 	
 	createWindow()
 	autoUpdater.checkForUpdates()
+	
+	if (process.platform === 'darwin')
+	{
+	    template = [{
+	      label: app.getName(),
+	      submenu: [
+	        {
+	          label: 'About ' + app.getName(),
+	          click() { shell.openExternal('https://about.draw.io'); }
+	        },
+	        {
+	          label: 'Support',
+	          click() { shell.openExternal('https://about.draw.io/support'); }
+	        },
+	        {
+	          type: 'separator'
+	        },
+	        {
+	          label: 'Quit',
+	          accelerator: 'Command+Q',
+	          click() { app.quit(); }
+	        }
+	      ]
+	    }, {
+	      label: 'Edit',
+	      submenu: [{
+	        label: 'Cut',
+	        accelerator: 'CmdOrCtrl+X',
+	        selector: 'cut:'
+	      }, {
+	        label: 'Copy',
+	        accelerator: 'CmdOrCtrl+C',
+	        selector: 'copy:'
+	      }, {
+	        label: 'Paste',
+	        accelerator: 'CmdOrCtrl+V',
+	        selector: 'paste:'
+	      }]
+	    }];
+	}
 })
 
 // Quit when all windows are closed.