feat(workspace): 工作区浏览器后退历史与离开守卫 - #663
Open
mrytsr wants to merge 1 commit into
Open
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.
为工作区实现完整的浏览器返回键行为,全平台生效(Web 桌面/移动端、桌面客户端,不区分视口)。
后退历史(WorkspaceWindowHistoryProvider):将所有抽屉、内存路由页、文件编辑工作区以 LIFO 栈镜像到浏览器历史,按返回键逐层关闭窗口而不是离开 /workspace。落在已卸载窗口的幽灵条目上自动跳过;关闭处理器可 veto(如文件未保存),veto 时补回历史条目。UI 主动关闭时延迟执行 history.back() 并校验当前条目,修复"关抽屉+开文件页"同提交的指针错位竞态。
离开守卫(WorkspaceLeaveGuard):历史栈用尽后再后退将离开 /workspace 时弹确认;Web 端刷新/关闭页面经 beforeunload 提示(桌面客户端豁免)。
涉及文件
新增:workspace-window-history.tsx、workspace-leave-guard.tsx
接入:drawer.tsx、workbench-route-context.tsx、workspace-context.tsx(closeAllFileTabs 返回 boolean 支持 veto)