✨ 编辑器标签栏「+」支持选择新建脚本类型#1544
Merged
Merged
Conversation
指向「+」时弹出与「新建脚本」一致的类型选择菜单(普通/后台/定时), 直接点击仍沿用默认模板快速新建。 close scriptscat#1540 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Checklist / 检查清单
Description / 描述
close #1540
问题:新 UI 中脚本编辑器标签栏的「+」只能按页面默认模板新建脚本,无法像旧 UI 那样选择脚本类型(普通 / 后台 / 定时)。
方案:按 issue 的提案,指向「+」时弹出与脚本列表「新建脚本」一致的类型选择菜单(复用
useHoverMenu+ shadcnDropdownMenu的既有模式),点击菜单项以对应模板(`` /background/ `crontab`)新建标签;直接点击「+」保持原行为,沿用 URL 默认模板快速新建,不影响现有工作流。改动:
EditorTabs.tsx:「+」按钮外包一层 hover 触发的 DropdownMenu,onNew增加可选template参数;菜单文案复用现有script:命名空间 i18n key,无新增翻译。ScriptEditor/index.tsx:onNewTab接受可选template,未传时沿用 URL 的template参数(原行为)。EditorTabs.test.tsx:新增 5 个单元测试(TDD,先写失败测试再实现)。测试:
vitest全量 287 文件 / 3010 用例通过;pnpm run lint(prettier + tsc + eslint)通过。docs/VERIFICATION.md用 Playwright 驱动真实构建的扩展验证:hover「+」弹出三个类型项(Create User Script / Create Background Script / Create Scheduled Script),点击「Create Background Script」后新标签载入含// @background的后台脚本模板。Screenshots / 截图
(CLI 无法上传附件,验证截图见上述 Playwright 验证描述;如需可补充。)
🤖 Generated with Claude Code