Skip to content

Commit

Permalink
fix: cannot undo and redo in form mode #301
Browse files Browse the repository at this point in the history
  • Loading branch information
Hufe921 committed Oct 24, 2023
1 parent 0891f05 commit 22c69ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/editor/core/event/handlers/keydown.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EditorZone } from '../../..'
import { EditorMode, EditorZone } from '../../..'
import { ZERO } from '../../../dataset/constant/Common'
import { ElementType } from '../../../dataset/enum/Element'
import { KeyMap } from '../../../dataset/enum/KeyMap'
Expand Down Expand Up @@ -349,11 +349,11 @@ export function keydown(evt: KeyboardEvent, host: CanvasEvent) {
direction: isUp ? MoveDirection.UP : MoveDirection.DOWN
})
} else if (isMod(evt) && evt.key === KeyMap.Z) {
if (isReadonly) return
if (isReadonly && draw.getMode() !== EditorMode.FORM) return
historyManager.undo()
evt.preventDefault()
} else if (isMod(evt) && evt.key === KeyMap.Y) {
if (isReadonly) return
if (isReadonly && draw.getMode() !== EditorMode.FORM) return
historyManager.redo()
evt.preventDefault()
} else if (isMod(evt) && evt.key === KeyMap.C) {
Expand Down

0 comments on commit 22c69ee

Please sign in to comment.