This commit is contained in:
crusader 2018-09-19 00:10:08 +09:00
parent ab1b663858
commit 778fe832c7
6 changed files with 66 additions and 59 deletions

View File

@ -48,7 +48,9 @@
/deep/ body .ui-contextmenu .ui-menuitem-link .ui-menuitem-text,
/deep/ body .ui-megamenu .ui-menuitem-link .ui-menuitem-text,
/deep/ body .ui-slidemenu .ui-menuitem-link .ui-menuitem-text {
// color: #333333;
font-family: var(--font-family-sans-serif);
font-size: 1.1em;
line-height: 1.5;
color: var(--app-menu-button-color);
}

View File

@ -83,11 +83,12 @@ function menuItemStateEqual(state: IMenuItemState, menuItem: MenuItem) {
const allMenuIds: ReadonlyArray<MenuIDs> = [
'save',
'save-as',
'preferences',
'open-in-shell',
'open-external-editor',
'about',
'export-csv',
'print',
'language-english',
'language-korean',
];
function getAllMenusDisabledBuilder(): MenuStateBuilder {

View File

@ -1,7 +1,10 @@
export type MenuEvent =
| 'save'
| 'save-as'
| 'show-preferences'
| 'show-about'
| 'open-external-editor'
| 'select-all';
| 'export-csv'
| 'print'
| 'language-english'
| 'language-korean'
;

View File

@ -1,7 +1,10 @@
export type MenuIDs =
| 'save'
| 'save-as'
| 'preferences'
| 'open-in-shell'
| 'open-external-editor'
| 'about';
| 'about'
| 'export-csv'
| 'print'
| 'language-english'
| 'language-korean'
;

View File

@ -216,11 +216,8 @@ app.on('ready', () => {
'update-preferred-app-menu-item-labels',
(
event: Electron.IpcMessageEvent,
labels: { editor?: string; pullRequestLabel?: string; shell: string }
) => {
menu = buildDefaultMenu(
labels.shell,
);
menu = buildDefaultMenu();
Menu.setApplicationMenu(menu);
if (mainWindow) {
mainWindow.sendAppMenu();

View File

@ -5,12 +5,8 @@ import { ensureItemIds } from './ensure-item-ids';
import { MenuEvent } from '../../commons/type/menu-event';
import { openDirectorySafe } from '../shell';
const defaultShellLabel = __DARWIN__
? 'Open in Terminal'
: 'Open in Command Prompt';
export function buildDefaultMenu(
shellLabel: string = defaultShellLabel,
): Electron.Menu {
const template = new Array<Electron.MenuItemConstructorOptions>();
const separator: Electron.MenuItemConstructorOptions = { type: 'separator' };
@ -51,54 +47,31 @@ export function buildDefaultMenu(
submenu: [
{
label: __DARWIN__ ? 'Save…' : 'Save…',
id: 'new-repository',
id: 'save',
click: emit('save'),
accelerator: 'CmdOrCtrl+S',
},
separator,
{
label: __DARWIN__ ? 'Save as…' : 'Save as…',
id: 'add-local-repository',
accelerator: 'CmdOrCtrl+Shift+S',
click: emit('save-as'),
}
label: __DARWIN__ ? 'Export as…' : 'Export as…',
submenu: [
{
label: __DARWIN__ ? 'CSV…' : 'CSV…',
id: 'export-csv',
click: emit('export-csv'),
},
],
},
separator,
{
label: __DARWIN__ ? 'Print…' : 'Print…',
id: 'print',
click: emit('print'),
},
],
};
if (!__DARWIN__) {
const fileItems = fileMenu.submenu as Electron.MenuItemConstructorOptions[];
fileItems.push(
separator,
{
label: '&Options…',
id: 'preferences',
accelerator: 'CmdOrCtrl+,',
click: emit('show-preferences'),
},
separator,
{ role: 'quit' }
);
}
template.push(fileMenu);
template.push({
label: __DARWIN__ ? 'Edit' : '&Edit',
submenu: [
{ role: 'undo', label: __DARWIN__ ? 'Undo' : '&Undo' },
{ role: 'redo', label: __DARWIN__ ? 'Redo' : '&Redo' },
separator,
{ role: 'cut', label: __DARWIN__ ? 'Cut' : 'Cu&t' },
{ role: 'copy', label: __DARWIN__ ? 'Copy' : '&Copy' },
{ role: 'paste', label: __DARWIN__ ? 'Paste' : '&Paste' },
{
label: __DARWIN__ ? 'Select All' : 'Select &all',
accelerator: 'CmdOrCtrl+A',
click: emit('select-all'),
},
],
});
template.push({
label: __DARWIN__ ? 'View' : '&View',
submenu: [
@ -169,6 +142,34 @@ export function buildDefaultMenu(
});
}
const settingMenu: Electron.MenuItemConstructorOptions = {
label: __DARWIN__ ? 'Discovery' : '&Discovery',
submenu: [
{
label: __DARWIN__ ? 'Setting…' : 'Setting…',
id: 'preferences',
accelerator: 'CmdOrCtrl+,',
click: emit('show-preferences'),
},
{
label: __DARWIN__ ? 'Language…' : 'Language…',
submenu: [
{
label: __DARWIN__ ? 'English…' : 'English…',
id: 'language-english',
click: emit('language-english'),
},
{
label: __DARWIN__ ? 'Korean…' : 'Korean…',
id: 'language-korean',
click: emit('language-korean'),
},
],
},
],
};
template.push(settingMenu);
const submitIssueItem: Electron.MenuItemConstructorOptions = {
label: __DARWIN__ ? 'Report Issue…' : 'Report issue…',
click() {