Support Cmd+ alternative to Ctrl+ hotkeys

This commit is contained in:
Chen-I Lim 2021-04-01 09:39:50 -07:00
parent 37adf0a081
commit e708f3e8f5
3 changed files with 5 additions and 4 deletions

View file

@ -58,6 +58,7 @@ class CenterPanel extends React.Component<Props, State> {
e.stopPropagation() e.stopPropagation()
} }
// TODO: Might need a different hotkey, as Cmd+D is save bookmark on Chrome
if (keyName === 'ctrl+d') { if (keyName === 'ctrl+d') {
// CTRL+D: Duplicate selected cards // CTRL+D: Duplicate selected cards
this.duplicateSelectedCards() this.duplicateSelectedCards()

View file

@ -29,7 +29,7 @@ const ViewHeaderSearch = (props: Props) => {
setSearchValue(boardTree.getSearchText()) setSearchValue(boardTree.getSearchText())
}, [boardTree]) }, [boardTree])
useHotkeys('ctrl+shift+f', () => { useHotkeys('ctrl+shift+f,cmd+shift+f', () => {
setIsSearching(true) setIsSearching(true)
searchFieldRef.current?.focus(true) searchFieldRef.current?.focus(true)
}) })

View file

@ -96,7 +96,7 @@ class BoardPage extends React.Component<Props, State> {
return return
} }
if (keyName === 'ctrl+z') { // Cmd+Z if (keyName === 'ctrl+z' || keyName === 'cmd+z') { // Cmd+Z
Utils.log('Undo') Utils.log('Undo')
if (mutator.canUndo) { if (mutator.canUndo) {
const description = mutator.undoDescription const description = mutator.undoDescription
@ -109,7 +109,7 @@ class BoardPage extends React.Component<Props, State> {
} else { } else {
sendFlashMessage({content: 'Nothing to Undo', severity: 'low'}) sendFlashMessage({content: 'Nothing to Undo', severity: 'low'})
} }
} else if (keyName === 'shift+ctrl+z') { // Shift+Cmd+Z } else if (keyName === 'shift+ctrl+z' || keyName === 'shift+cmd+z') { // Shift+Cmd+Z
Utils.log('Redo') Utils.log('Redo')
if (mutator.canRedo) { if (mutator.canRedo) {
const description = mutator.redoDescription const description = mutator.redoDescription
@ -161,7 +161,7 @@ class BoardPage extends React.Component<Props, State> {
return ( return (
<div className='BoardPage'> <div className='BoardPage'>
<HotKeys <HotKeys
keyName='shift+ctrl+z,ctrl+z' keyName='shift+ctrl+z,shift+cmd+z,ctrl+z,cmd+z'
onKeyDown={this.undoRedoHandler} onKeyDown={this.undoRedoHandler}
/> />
<Workspace <Workspace