diff --git a/client/components/Controllers/Table/Editor.tsx b/client/components/Controllers/Table/Editor.tsx index 6216eccab..6d05b99f0 100644 --- a/client/components/Controllers/Table/Editor.tsx +++ b/client/components/Controllers/Table/Editor.tsx @@ -19,6 +19,30 @@ export default function Editor() { store.deleteMultipleCells(cellSelection) }) + useKeyPress(['alt+m'], () => { + store.togglePanel('metadata') + }) + + useKeyPress(['alt+r'], () => { + store.togglePanel('report') + }) + + useKeyPress(['alt+s'], () => { + store.togglePanel('source') + }) + + useKeyPress(['ctrl+z', 'meta+z'], () => { + store.undoTableChange() + }) + + useKeyPress(['ctrl+y', 'meta+y'], () => { + store.redoTableChange() + }) + + useKeyPress(['ctrl+s', 'meta+s'], () => { + store.saveTable() + }) + // Ensure that when the user interact with other parts on the application // e.g. Metadata editor the selection logic is not activated // also commit current table editing (https://github.com/okfn/opendataeditor/issues/495) diff --git a/client/components/Parts/Bars/Action.tsx b/client/components/Parts/Bars/Action.tsx index 53ce2f68e..e3a11f7ea 100644 --- a/client/components/Parts/Bars/Action.tsx +++ b/client/components/Parts/Bars/Action.tsx @@ -7,7 +7,6 @@ import CheckIcon from '@mui/icons-material/Check' import HistoryIcon from '@mui/icons-material/History' import IconButton from '../../Parts/Buttons/Icon' import Columns from '../Grids/Columns' -import { useKeyPress } from 'ahooks' import ElectricBoltIcon from '@mui/icons-material/ElectricBolt' export interface ActionBarProps {} @@ -37,12 +36,7 @@ export interface ButtonProps { export function SaveAsButton(props: ButtonProps) { const onClick = props.onClick || noop - useKeyPress(['ctrl.j'], (event) => { - event.preventDefault() - if (!props.disabled) { - onClick() - } - }) + return ( { - event.preventDefault() - if (!props.disabled) { - onClick() - } - }) + return ( { - event.preventDefault() - if (props.updated) { - onClick() - } - }) + return ( { - event.preventDefault() - if (props.updated) { - onClick() - } - }) + return ( { - event.preventDefault() - if (!props.enabled && !props.disabled) { - onClick() - } - }) + return ( { - event.preventDefault() - if (!props.enabled && !props.disabled) { - onClick() - } - }) + return ( { - event.preventDefault() - if (!props.enabled && !props.disabled) { - onClick() - } - }) + return ( { - event.preventDefault() - if (!props.disabled) { - onClick() - } - }) + return ( { - event.preventDefault() - if (!props.disabled) { - onClick() - } - }) + return ( { - event.preventDefault() - if (!props.disabled) { - onClick() - } - }) + return ( { - event.preventDefault() - if (!props.disabled) { - onClick() - } - }) + return ( { - event.preventDefault() - if (!props.disabled) { - onClick() - } - }) + return ( { - event.preventDefault() - if (!props.disabled) { - onClick() - } - }) + return ( { - event.preventDefault() - if (!props.disabled) { - onClick() - } - }) + return ( { - event.preventDefault() - props.onClick() - }) + return ( - +