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:
Anton
2026-02-25 18:25:12 -05:00
committed by GitHub
co-authored by Anton Pascal
parent 48d5091bb3
commit 09e212ad40
+6
View File
@@ -15,6 +15,12 @@ export const useKeyboard = () => {
if (e.key === 'Escape') { if (e.key === 'Escape') {
e.preventDefault() e.preventDefault()
emitter.emit('tool:cancel') 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) { } else if (e.key === '1' && !e.metaKey && !e.ctrlKey) {
e.preventDefault() e.preventDefault()
useEditor.getState().setPhase('site') useEditor.getState().setPhase('site')