feat: Esc exits build mode back to select mode (#120)
When in build mode, pressing Escape now switches back to select mode in addition to canceling any in-progress tool operation. Requested by Julien. Co-authored-by: Anton Pascal <anton-pascal@users.noreply.github.com>
This commit is contained in:
@@ -15,6 +15,12 @@ export const useKeyboard = () => {
|
||||
if (e.key === 'Escape') {
|
||||
e.preventDefault()
|
||||
emitter.emit('tool:cancel')
|
||||
|
||||
// If in build mode, switch back to select mode
|
||||
const { mode } = useEditor.getState()
|
||||
if (mode === 'build') {
|
||||
useEditor.getState().setMode('select')
|
||||
}
|
||||
} else if (e.key === '1' && !e.metaKey && !e.ctrlKey) {
|
||||
e.preventDefault()
|
||||
useEditor.getState().setPhase('site')
|
||||
|
||||
Reference in New Issue
Block a user