Merged
Conversation
CodFrm
commented
Mar 21, 2026
Collaborator
|
@CodFrm ${i.toString()}应该是 ${i} |
Contributor
There was a problem hiding this comment.
Pull request overview
该 PR 旨在让用户更容易发现并使用 Monaco Editor 内置的查找/替换能力,通过在脚本编辑器顶部菜单中新增入口来触发对应的 Monaco actions,同时补齐多语言文案支持。
Changes:
- 在
ScriptEditor顶部菜单新增一组编辑相关菜单项(含查找/替换、撤销/重做、剪切/复制/粘贴、全选)并实现触发 Monaco 对应 action/command。 - 为新增菜单项补充 8 种语言的 i18n 翻译键值(find/replace/undo/redo/cut/copy/paste)。
- 调整
ExternalWhitelist(新增sleazyfork.org,并移除未使用的ExternalMessage常量)。
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pages/options/routes/script/ScriptEditor.tsx | 新增编辑菜单与查找/替换入口;引入菜单分隔线渲染逻辑 |
| src/locales/zh-TW/translation.json | 新增 find/replace/undo/redo/cut/copy/paste 翻译 |
| src/locales/zh-CN/translation.json | 新增 find/replace/undo/redo/cut/copy/paste 翻译 |
| src/locales/vi-VN/translation.json | 新增 find/replace/undo/redo/cut/copy/paste 翻译 |
| src/locales/ru-RU/translation.json | 新增 find/replace/undo/redo/cut/copy/paste 翻译 |
| src/locales/ja-JP/translation.json | 新增 find/replace/undo/redo/cut/copy/paste 翻译 |
| src/locales/en-US/translation.json | 新增 find/replace/undo/redo/cut/copy/paste 翻译 |
| src/locales/de-DE/translation.json | 新增 find/replace/undo/redo/cut/copy/paste 翻译 |
| src/locales/ach-UG/translation.json | 新增 find/replace/undo/redo/cut/copy/paste 翻译(占位/英文) |
| src/app/const.ts | 更新 ExternalWhitelist(新增 sleazyfork.org)并移除 ExternalMessage |
Comment on lines
+933
to
+935
| <div key={`divider_${i}`} style={{ padding: "4px 0", background: "var(--color-secondary)" }}> | ||
| <div style={{ height: "1px", backgroundColor: "var(--color-neutral-4)" }} /> | ||
| </div> |
There was a problem hiding this comment.
这里用普通的
作为 Menu 的分隔线子元素,会丢失 Menu 组件的语义结构(如 role=separator)、键盘导航一致性以及主题样式一致性。建议使用 Arco Menu 提供的分隔组件/能力(如 Menu.Divider 或 disabled 的 Menu.Item 作为分隔),避免在 Menu 内混入非 Menu 子节点。
Suggested change
| <div key={`divider_${i}`} style={{ padding: "4px 0", background: "var(--color-secondary)" }}> | |
| <div style={{ height: "1px", backgroundColor: "var(--color-neutral-4)" }} /> | |
| </div> | |
| <Menu.Divider | |
| key={`divider_${i}`} | |
| style={{ | |
| margin: "4px 0", | |
| background: "var(--color-secondary)", | |
| borderBottomColor: "var(--color-neutral-4)", | |
| }} | |
| /> |
Comment on lines
+505
to
+566
| { | ||
| title: t("edit"), | ||
| items: [ | ||
| { | ||
| id: "undo", | ||
| title: t("undo"), | ||
| hotKeyString: "Ctrl+Z", | ||
| action(_script, e) { | ||
| e.trigger("menu", "undo", null); | ||
| }, | ||
| }, | ||
| { | ||
| id: "redo", | ||
| title: t("redo"), | ||
| hotKeyString: "Ctrl+Shift+Z", | ||
| action(_script, e) { | ||
| e.trigger("menu", "redo", null); | ||
| }, | ||
| }, | ||
| { divider: true }, | ||
| { | ||
| id: "cut", | ||
| title: t("cut"), | ||
| hotKeyString: "Ctrl+X", | ||
| action(_script, e) { | ||
| e.trigger("menu", "editor.action.clipboardCutAction", null); | ||
| }, | ||
| }, | ||
| { | ||
| id: "copy", | ||
| title: t("copy"), | ||
| hotKeyString: "Ctrl+C", | ||
| action(_script, e) { | ||
| e.trigger("menu", "editor.action.clipboardCopyAction", null); | ||
| }, | ||
| }, | ||
| { | ||
| id: "paste", | ||
| title: t("paste"), | ||
| hotKeyString: "Ctrl+V", | ||
| action(_script, e) { | ||
| e.trigger("menu", "editor.action.clipboardPasteAction", null); | ||
| }, | ||
| }, | ||
| { divider: true }, | ||
| { | ||
| id: "find", | ||
| title: t("find"), | ||
| hotKeyString: "Ctrl+F", | ||
| action(_script, e) { | ||
| e.getAction("actions.find")?.run(); | ||
| }, | ||
| }, | ||
| { | ||
| id: "replace", | ||
| title: t("replace"), | ||
| hotKeyString: "Ctrl+H", | ||
| action(_script, e) { | ||
| e.getAction("editor.action.startFindReplaceAction")?.run(); | ||
| }, | ||
| }, | ||
| { |
There was a problem hiding this comment.
PR 描述/标题提到在「工具」菜单里增加「查找/替换」入口,但这里实际新增的是顶层「编辑」菜单,并把「查找/替换」放在其中;「工具」菜单并未包含这两个入口。建议要么把这两项移动到 tools 菜单下以符合需求/Issue,要么同步更新 PR 描述与交互文案说明为何改为新增“编辑”菜单。
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.
Summary
Closes #1103
Test plan