Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
feat(menu): windows should use delete key for removing patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
Lasse Küchler committed Dec 18, 2017
1 parent 3dbfef6 commit c655513
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/electron/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,24 @@ export function createMenu(store: Store): void {
},
{
label: '&Delete',
accelerator: 'Backspace',
accelerator: (() => {
if (process.platform === 'darwin') {
return 'Backspace';
} else {
return 'Delete';
}
})(),
click: () => {
console.log('delete');
const selectedElement: PageElement | undefined = store.getSelectedElement();
if (selectedElement) {
selectedElement.remove();
store.setSelectedElement(undefined);
} else {
Menu.sendActionToFirstResponder('Backspace');
if (process.platform === 'darwin') {
Menu.sendActionToFirstResponder('Backspace');
} else {
Menu.sendActionToFirstResponder('Delete');
}
}
}
}
Expand Down

0 comments on commit c655513

Please sign in to comment.