diff --git a/src/locales/ach-UG/translation.json b/src/locales/ach-UG/translation.json index eb22e8197..a9b37bf1a 100644 --- a/src/locales/ach-UG/translation.json +++ b/src/locales/ach-UG/translation.json @@ -20,6 +20,8 @@ "subscribe": "crwdns7918:0crwdne7918:0", "logs": "crwdns7920:0crwdne7920:0", "tools": "crwdns7922:0crwdne7922:0", + "find": "Find", + "replace": "Replace", "settings": "crwdns7924:0crwdne7924:0", "hide_main_sidebar": "Collapse sidebar", "show_main_sidebar": "Expand sidebar", @@ -219,6 +221,11 @@ "run_once": "crwdns8308:0crwdne8308:0", "stop": "crwdns8310:0crwdne8310:0", "edit": "crwdns8312:0crwdne8312:0", + "undo": "Undo", + "redo": "Redo", + "cut": "Cut", + "copy": "Copy", + "paste": "Paste", "exclude_on": "crwdns8922:0crwdne8922:0", "exclude_off": "crwdns8924:0crwdne8924:0", "user_config": "crwdns8320:0crwdne8320:0", diff --git a/src/locales/de-DE/translation.json b/src/locales/de-DE/translation.json index fb87be1b5..2fce23d86 100644 --- a/src/locales/de-DE/translation.json +++ b/src/locales/de-DE/translation.json @@ -20,6 +20,8 @@ "subscribe": "Abonnieren", "logs": "Protokolle", "tools": "Werkzeuge", + "find": "Suchen", + "replace": "Ersetzen", "settings": "Einstellungen", "hide_main_sidebar": "Seitenleiste einklappen", "show_main_sidebar": "Seitenleiste ausklappen", @@ -220,6 +222,11 @@ "run_once": "Einmal ausführen", "stop": "Stoppen", "edit": "Bearbeiten", + "undo": "Rückgängig", + "redo": "Wiederherstellen", + "cut": "Ausschneiden", + "copy": "Kopieren", + "paste": "Einfügen", "exclude_on": "Wiederherstellen auf $0 zur Ausführung", "exclude_off": "Ausschließen auf $0 zur Ausführung", "user_config": "Benutzerkonfiguration", diff --git a/src/locales/en-US/translation.json b/src/locales/en-US/translation.json index cf996df27..c805af961 100644 --- a/src/locales/en-US/translation.json +++ b/src/locales/en-US/translation.json @@ -20,6 +20,8 @@ "subscribe": "Subscribe", "logs": "Logs", "tools": "Tools", + "find": "Find", + "replace": "Replace", "settings": "Settings", "hide_main_sidebar": "Collapse sidebar", "show_main_sidebar": "Expand sidebar", @@ -220,6 +222,11 @@ "run_once": "Run Once", "stop": "Stop", "edit": "Edit", + "undo": "Undo", + "redo": "Redo", + "cut": "Cut", + "copy": "Copy", + "paste": "Paste", "exclude_on": "Reinstate $0's execution", "exclude_off": "Exclude $0's exeuction", "user_config": "User Config", diff --git a/src/locales/ja-JP/translation.json b/src/locales/ja-JP/translation.json index e47b20216..0d7c5dca0 100644 --- a/src/locales/ja-JP/translation.json +++ b/src/locales/ja-JP/translation.json @@ -20,6 +20,8 @@ "subscribe": "サブスクライブ", "logs": "ログ", "tools": "ツール", + "find": "検索", + "replace": "置換", "settings": "設定", "hide_main_sidebar": "サイドバーを折りたたむ", "show_main_sidebar": "サイドバーを展開", @@ -220,6 +222,11 @@ "run_once": "一度実行", "stop": "中止", "edit": "編集", + "undo": "元に戻す", + "redo": "やり直し", + "cut": "切り取り", + "copy": "コピー", + "paste": "貼り付け", "exclude_on": "$0の実行を復元", "exclude_off": "$0の実行を除外", "user_config": "ユーザー設定", diff --git a/src/locales/ru-RU/translation.json b/src/locales/ru-RU/translation.json index 352b7210e..d667bf515 100644 --- a/src/locales/ru-RU/translation.json +++ b/src/locales/ru-RU/translation.json @@ -20,6 +20,8 @@ "subscribe": "Подписаться", "logs": "Журналы", "tools": "Инструменты", + "find": "Найти", + "replace": "Заменить", "settings": "Настройки", "hide_main_sidebar": "Свернуть боковую панель", "show_main_sidebar": "Развернуть боковую панель", @@ -220,6 +222,11 @@ "run_once": "Запустить один раз", "stop": "Остановить", "edit": "Редактировать", + "undo": "Отменить", + "redo": "Повторить", + "cut": "Вырезать", + "copy": "Копировать", + "paste": "Вставить", "exclude_on": "Восстановить в $0 выполнении", "exclude_off": "Исключить в $0 выполнении", "user_config": "Конфигурация пользователя", diff --git a/src/locales/vi-VN/translation.json b/src/locales/vi-VN/translation.json index f4b4e996b..b88895764 100644 --- a/src/locales/vi-VN/translation.json +++ b/src/locales/vi-VN/translation.json @@ -20,6 +20,8 @@ "subscribe": "Đăng ký", "logs": "Nhật ký", "tools": "Công cụ", + "find": "Tìm kiếm", + "replace": "Thay thế", "settings": "Cài đặt", "hide_main_sidebar": "Thu gọn thanh bên", "show_main_sidebar": "Mở rộng thanh bên", @@ -220,6 +222,11 @@ "run_once": "Chạy một lần", "stop": "Dừng", "edit": "Sửa", + "undo": "Hoàn tác", + "redo": "Làm lại", + "cut": "Cắt", + "copy": "Sao chép", + "paste": "Dán", "exclude_on": "Cho phép chạy lại $0", "exclude_off": "Loại trừ chạy $0", "user_config": "Cấu hình người dùng", diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json index a85571397..a2e47bc3c 100644 --- a/src/locales/zh-CN/translation.json +++ b/src/locales/zh-CN/translation.json @@ -20,6 +20,8 @@ "subscribe": "订阅", "logs": "日志", "tools": "工具", + "find": "查找", + "replace": "替换", "settings": "设置", "hide_main_sidebar": "收起侧边栏", "show_main_sidebar": "展开侧边栏", @@ -220,6 +222,11 @@ "run_once": "运行一次", "stop": "停止", "edit": "编辑", + "undo": "撤销", + "redo": "重做", + "cut": "剪切", + "copy": "复制", + "paste": "粘贴", "exclude_on": "恢复在 $0 上执行", "exclude_off": "排除在 $0 上执行", "user_config": "用户配置", diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json index bfccdf42f..b89b5684d 100644 --- a/src/locales/zh-TW/translation.json +++ b/src/locales/zh-TW/translation.json @@ -20,6 +20,8 @@ "subscribe": "訂閱", "logs": "紀錄", "tools": "工具", + "find": "尋找", + "replace": "取代", "settings": "設定", "hide_main_sidebar": "摺疊側邊欄", "show_main_sidebar": "展開側邊欄", @@ -220,6 +222,11 @@ "run_once": "執行一次", "stop": "停止", "edit": "編輯", + "undo": "復原", + "redo": "重做", + "cut": "剪下", + "copy": "複製", + "paste": "貼上", "exclude_on": "恢復 $0 的執行", "exclude_off": "排除 $0 的執行", "user_config": "使用者設定", diff --git a/src/pages/options/routes/script/ScriptEditor.tsx b/src/pages/options/routes/script/ScriptEditor.tsx index 887075dfe..fc6e4c8b9 100644 --- a/src/pages/options/routes/script/ScriptEditor.tsx +++ b/src/pages/options/routes/script/ScriptEditor.tsx @@ -93,14 +93,18 @@ type EditorMenu = { title: string; tooltip?: string; action?: (script: Script, e: editor.ICodeEditor) => void; - items?: { - id: string; - title: string; - tooltip?: string; - hotKey?: number; - hotKeyString?: string; - action: (script: Script, e: editor.ICodeEditor) => void; - }[]; + items?: ( + | { + id: string; + title: string; + tooltip?: string; + hotKey?: number; + hotKeyString?: string; + action: (script: Script, e: editor.ICodeEditor) => void; + divider?: never; + } + | { divider: true } + )[]; }; const emptyScript = async (template: string, hotKeys: any, target?: string) => { @@ -498,6 +502,77 @@ function ScriptEditor() { }, ], }, + { + 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(); + }, + }, + { + id: "selectAll", + title: t("select_all"), + hotKeyString: "Ctrl+A", + action(_script, e) { + e.trigger("menu", "editor.action.selectAll", null); + }, + }, + ], + }, { title: t("run"), items: [ @@ -579,7 +654,7 @@ function ScriptEditor() { hotKeys.current = []; menu.forEach((item) => { item.items?.forEach((menuItem) => { - if (menuItem.hotKey) { + if (!menuItem.divider && menuItem.hotKey) { hotKeys.current.push({ id: menuItem.id, title: menuItem.title, @@ -841,16 +916,25 @@ function ScriptEditor() { } return ( {item.items.map((menuItem, i) => { + if (menuItem.divider) { + return ( +
+
+
+ ); + } const btn = (