feat: Implement Undo/Redo functionality with Redux middleware and UI integration#772
Open
Unnamed2964 wants to merge 1 commit intorailmapgen:mainfrom
Open
feat: Implement Undo/Redo functionality with Redux middleware and UI integration#772Unnamed2964 wants to merge 1 commit intorailmapgen:mainfrom
Unnamed2964 wants to merge 1 commit intorailmapgen:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
描述
本 PR 为项目引入了基于 Redux Middleware 的,与 RML 项目体验相连续的撤销/重做顶栏和快捷键功能,并针对频繁输入的文本框进行了防抖优化,以配合撤销功能的实现。
主要更改
撤销/重做 (Undo/Redo)
undo-middleware.ts:采用 Redux Middleware 拦截param/开头的 Action,维护past和future历史栈。目前策略为全量记录所有状态变更(暂未细分 Action 粒度)。undo-slice.ts:在 Redux Store 中轻量级地同步历史记录数量 (pastCount,futureCount),用于驱动 UI 状态。WindowHeader:添加撤销/重做按钮。react-hotkeys-hook,支持与 RML 体验相连续的快捷键操作。Ctrl+Z/Cmd+Z(取决于是否是 MacOS)Ctrl+Y/Cmd+Shift+Z(取决于是否是 MacOS)debouncedDelay属性添加了防抖处理(300ms),减少 Redux Action 的派发频率,以减少意外的撤销列表插入。其他说明