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 (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkuechler authored and TheReincarnator committed Dec 18, 2017
1 parent 1c96caf commit 26d8e9d
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 26d8e9d

Please sign in to comment.