Skip to content

Commit

Permalink
fix(editor): removed Lumi Run menu entry if not prerelease (#1679)
Browse files Browse the repository at this point in the history
  • Loading branch information
sr258 committed Jul 9, 2021
1 parent 2c87273 commit 476caa4
Showing 1 changed file with 79 additions and 77 deletions.
156 changes: 79 additions & 77 deletions server/src/menu/h5peditorMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,87 +8,89 @@ import macMenu from './macMenu';
import windowMenu from './windowMenu';
import viewMenu from './viewMenu';
import runMenu from './runMenuItem';
import settings from '../settingsCache';

export default (window: electron.BrowserWindow, websocket: SocketIO.Server) => [
...macMenu(),
{
label: i18next.t('lumi:menu.file.label'),
submenu: [
{
accelerator: 'CmdOrCtrl+N',
click: () => {
websocket.emit('action', {
payload: {
contentId: Math.round(Math.random() * 100000)
},
type: 'NEW_H5P'
});
export default (window: electron.BrowserWindow, websocket: SocketIO.Server) =>
[
...macMenu(),
{
label: i18next.t('lumi:menu.file.label'),
submenu: [
{
accelerator: 'CmdOrCtrl+N',
click: () => {
websocket.emit('action', {
payload: {
contentId: Math.round(Math.random() * 100000)
},
type: 'NEW_H5P'
});
},
label: i18next.t('lumi:menu.h5peditor.new')
},
label: i18next.t('lumi:menu.h5peditor.new')
},
{ type: 'separator' } as any,
{
accelerator: 'CmdOrCtrl+O',
click: () => {
electron.dialog
.showOpenDialog({
filters: [
{
extensions: ['h5p'],
name: 'HTML 5 Package'
}
],
properties: ['openFile', 'multiSelections']
})
.then(({ filePaths }) => {
websocket.emit('action', {
payload: {
paths: filePaths
},
type: 'OPEN_H5P'
{ type: 'separator' } as any,
{
accelerator: 'CmdOrCtrl+O',
click: () => {
electron.dialog
.showOpenDialog({
filters: [
{
extensions: ['h5p'],
name: 'HTML 5 Package'
}
],
properties: ['openFile', 'multiSelections']
})
.then(({ filePaths }) => {
websocket.emit('action', {
payload: {
paths: filePaths
},
type: 'OPEN_H5P'
});
});
});
},
label: i18next.t('lumi:menu.h5peditor.open')
},
label: i18next.t('lumi:menu.h5peditor.open')
},
{ type: 'separator' } as any,
{
accelerator: 'CmdOrCtrl+S',
click: () => {
websocket.emit('action', {
type: 'SAVE'
});
{ type: 'separator' } as any,
{
accelerator: 'CmdOrCtrl+S',
click: () => {
websocket.emit('action', {
type: 'SAVE'
});
},
label: i18next.t('lumi:menu.file.save')
},
label: i18next.t('lumi:menu.file.save')
},
{
accelerator: 'Shift+CmdOrCtrl+S',
click: () => {
websocket.emit('action', {
type: 'SAVE_AS'
});
{
accelerator: 'Shift+CmdOrCtrl+S',
click: () => {
websocket.emit('action', {
type: 'SAVE_AS'
});
},
label: i18next.t('lumi:menu.file.save_as')
},
label: i18next.t('lumi:menu.file.save_as')
},
{ type: 'separator' } as any,
{
click: () => {
websocket.emit('action', {
type: 'EXPORT_AS_HTML'
});
{ type: 'separator' } as any,
{
click: () => {
websocket.emit('action', {
type: 'EXPORT_AS_HTML'
});
},
label: i18next.t('lumi:menu.file.export')
},
label: i18next.t('lumi:menu.file.export')
},
{ type: 'separator' } as any,
{
label: i18next.t('lumi:menu.quit'),
role: 'quit'
} as any
]
},
runMenu(websocket),
editMenu(),
...viewMenu(),
...windowMenu(),
helpMenu(window, websocket)
];
{ type: 'separator' } as any,
{
label: i18next.t('lumi:menu.quit'),
role: 'quit'
} as any
]
},
settings.getSettings().allowPrerelease ? runMenu(websocket) : undefined,
editMenu(),
...viewMenu(),
...windowMenu(),
helpMenu(window, websocket)
].filter((m) => m !== undefined);

0 comments on commit 476caa4

Please sign in to comment.