mirror of
https://github.com/scratchfoundation/scratch-desktop.git
synced 2025-01-08 21:51:55 -05:00
Merge pull request #20 from LLK/fix-mac-shortcuts
Include menu with default keyboard shortcuts to allow mac to work
This commit is contained in:
commit
a7519d167d
2 changed files with 57 additions and 1 deletions
50
src/main/MacOSMenu.js
Normal file
50
src/main/MacOSMenu.js
Normal file
|
@ -0,0 +1,50 @@
|
|||
// Include the standard keyboard shortcuts in the edit menu
|
||||
// so they can be used within the app. Only needed on Mac.
|
||||
export default app => ([
|
||||
{
|
||||
label: 'App', // Always overridden by app name
|
||||
submenu: [{
|
||||
label: 'Quit',
|
||||
accelerator: 'CmdOrCtrl+Q',
|
||||
click: () => app.quit()
|
||||
}]
|
||||
},
|
||||
{
|
||||
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'
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
|
@ -1,7 +1,8 @@
|
|||
import {BrowserWindow, app, dialog} from 'electron';
|
||||
import {BrowserWindow, Menu, app, dialog} from 'electron';
|
||||
import * as path from 'path';
|
||||
import {format as formatUrl} from 'url';
|
||||
import telemetry from './ScratchDesktopTelemetry';
|
||||
import MacOSMenu from './MacOSMenu';
|
||||
|
||||
telemetry.appWasOpened();
|
||||
|
||||
|
@ -20,6 +21,11 @@ const createMainWindow = () => {
|
|||
});
|
||||
const webContents = window.webContents;
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
const osxMenu = Menu.buildFromTemplate(MacOSMenu(app));
|
||||
Menu.setApplicationMenu(osxMenu);
|
||||
}
|
||||
|
||||
if (isDevelopment) {
|
||||
webContents.openDevTools();
|
||||
import('electron-devtools-installer').then(importedModule => {
|
||||
|
|
Loading…
Reference in a new issue