From 66da21804babe512b792ca11604c056641f4c49d Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 21 Apr 2022 17:44:00 +0200 Subject: [PATCH] cmd+backspace for delete rows on mac --- packages/web/src/commands/CommandListener.svelte | 2 ++ packages/web/src/datagrid/DataGridCore.svelte | 2 +- packages/web/src/utility/common.ts | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/web/src/commands/CommandListener.svelte b/packages/web/src/commands/CommandListener.svelte index ea4dbd0d..64ba4c5b 100644 --- a/packages/web/src/commands/CommandListener.svelte +++ b/packages/web/src/commands/CommandListener.svelte @@ -12,6 +12,8 @@ if (e.altKey) keyText += 'Alt+'; keyText += e.key; + // console.log('keyText', keyText); + const commandsValue = get(commandsCustomized); let commandsFiltered: any = Object.values(commandsValue).filter( (x: any) => diff --git a/packages/web/src/datagrid/DataGridCore.svelte b/packages/web/src/datagrid/DataGridCore.svelte index ae351b1c..e34c88fa 100644 --- a/packages/web/src/datagrid/DataGridCore.svelte +++ b/packages/web/src/datagrid/DataGridCore.svelte @@ -35,7 +35,7 @@ category: 'Data grid', name: 'Delete selected rows', toolbarName: 'Delete row(s)', - keyText: 'CtrlOrCommand+Delete', + keyText: isMac() ? 'Command+Backspace' : 'CtrlOrCommand+Delete', icon: 'icon minus', testEnabled: () => getCurrentDataGrid()?.getGrider()?.editable, onClick: () => getCurrentDataGrid().deleteSelectedRows(), diff --git a/packages/web/src/utility/common.ts b/packages/web/src/utility/common.ts index 42355526..5fb98c0f 100644 --- a/packages/web/src/utility/common.ts +++ b/packages/web/src/utility/common.ts @@ -53,7 +53,8 @@ export function formatKeyText(keyText: string): string { .replace('Shift+', '⇧ ') .replace('Alt+', '⌥ ') .replace('Command+', '⌘ ') - .replace('Ctrl+', '⌃ '); + .replace('Ctrl+', '⌃ ') + .replace('Backspace', '⌫ '); } return keyText.replace('CtrlOrCommand+', 'Ctrl+'); }