Skip to content

Commit

Permalink
add: basic shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoecheza committed Oct 25, 2023
1 parent 72d5c53 commit 651e4bc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
20 changes: 17 additions & 3 deletions packages/@dcl/inspector/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/@dcl/inspector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "@dcl/inspector",
"version": "0.1.0",
"dependencies": {
"@dcl/asset-packs": "^1.2.5"
"@dcl/asset-packs": "^1.2.5",
"react-hotkeys-hook": "^4.4.1"
},
"devDependencies": {
"@babylonjs/core": "^6.18.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/@dcl/inspector/src/components/Toolbar/Toolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useCallback } from 'react'
import { BiUndo, BiRedo, BiSave, BiBadgeCheck } from 'react-icons/bi'
import { RiListSettingsLine } from 'react-icons/ri'
import { useHotkeys } from 'react-hotkeys-hook'

import { withSdk } from '../../hoc/withSdk'
import { Gizmos } from './Gizmos'
Expand Down Expand Up @@ -29,6 +30,10 @@ const Toolbar = withSdk(({ sdk }) => {
const handleUndo = useCallback(() => dispatch(undo()), [])
const handleRedo = useCallback(() => dispatch(redo()), [])

useHotkeys('mod+s', handleSaveClick, { preventDefault: true }, [])
useHotkeys('mod+z', handleUndo, { preventDefault: true }, [])
useHotkeys('mod+y', handleRedo, { preventDefault: true }, [])

return (
<div className="Toolbar">
<ToolbarButton
Expand Down

0 comments on commit 651e4bc

Please sign in to comment.