Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added edit menu #101

Merged
merged 1 commit into from
Nov 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions src/electron/Menu.ts
Original file line number Diff line number Diff line change
@@ -130,6 +130,68 @@ const createMenuTemplate = async (
],
});

template.push({
label: i18n.t('menu.edit.label'),
submenu: [
{
label: i18n.t('menu.edit.undo'),
accelerator: process.platform === 'darwin' ? 'Cmd+Z' : 'Ctrl+Z',
click: async() => {
if (mainWindow) {
mainWindow.webContents.undo();
}
}
},
{
label: i18n.t('menu.edit.redo'),
accelerator: process.platform === 'darwin' ? 'Cmd+Option+Z' : 'Ctrl+Shift+Z',
click: async() => {
if (mainWindow) {
mainWindow.webContents.redo();
}
}
},
{ type: 'separator' },
{
label: i18n.t('menu.edit.cut'),
accelerator: process.platform === 'darwin' ? 'Cmd+X' : 'Ctrl+X',
click: async() => {
if (mainWindow) {
mainWindow.webContents.cut();
}
}
},
{
label: i18n.t('menu.edit.copy'),
accelerator: process.platform === 'darwin' ? 'Cmd+C' : 'Ctrl+C',
click: async() => {
if (mainWindow) {
mainWindow.webContents.copy();
}
}
},
{
label: i18n.t('menu.edit.paste'),
accelerator: process.platform === 'darwin' ? 'Cmd+V' : 'Ctrl+V',
click: async() => {
if (mainWindow) {
mainWindow.webContents.paste();
}
}
},
{ type: 'separator' },
{
label: i18n.t('menu.edit.selectAll'),
accelerator: process.platform === 'darwin' ? 'Cmd+A' : 'Ctrl+A',
click: async() => {
if (mainWindow) {
mainWindow.webContents.selectAll();
}
}
},
]
});

template.push({
label: i18n.t('menu.view'),
submenu: [
9 changes: 9 additions & 0 deletions src/locales/en-US/common.json
Original file line number Diff line number Diff line change
@@ -11,6 +11,15 @@
"closeTab": "Close Tab",
"settings": "Settings"
},
"edit": {
"label": "&Edit",
"undo": "&Undo",
"redo": "&Redo",
"cut": "Cu&t",
"copy": "&Copy",
"paste": "&Paste",
"selectAll": "select&All"
},
"quit": "&Quit",
"view": "&View",
"darkTheme": "&Dark Theme",
9 changes: 9 additions & 0 deletions src/locales/pt-BR/common.json
Original file line number Diff line number Diff line change
@@ -11,6 +11,15 @@
"closeTab": "Fechar aba",
"settings": "Configurações"
},
"edit": {
"label": "&Editar",
"undo": "&Desfazer",
"redo": "&Refazer",
"cut": "Recor&tar",
"copy": "&Copiar",
"paste": "C&olar",
"selectAll": "Selecion&ar Tudo"
},
"quit": "&Sair",
"view": "&Visualizar",
"darkTheme": "&Tema Escuro",