Skip to content

Commit 24d5b9d

Browse files
committed
Merge branch 'main' into release/v1.1
2 parents 02a9fda + 4da8068 commit 24d5b9d

18 files changed

Lines changed: 350 additions & 40 deletions

File tree

rspack.config.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,6 @@ export default defineConfig({
108108
},
109109
],
110110
},
111-
{
112-
type: "asset/source",
113-
test: /\.d\.ts$/,
114-
exclude: /node_modules/,
115-
},
116111
{
117112
type: "asset/source",
118113
test: /\.tpl$/,

scripts/crowdin-download.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import { execSync } from "child_process";
22
import { readdirSync, statSync, readFileSync, writeFileSync } from "fs";
33
import { join } from "path";
44

5+
console.log("Downloading translations from Crowdin...");
56
// 执行 crowdin download --skip-untranslated-strings
67
execSync("crowdin download --skip-untranslated-strings", { stdio: "inherit" });
78

89
// 将所有语言中的""删除
910
// 语言文件在 src/locales/*/*.json 排除zh-CN
1011
const localesPath = "./src/locales";
12+
console.log("Removing empty strings from locale files...");
1113
function removeEmptyStringsFromLocaleFiles(dir) {
1214
const files = readdirSync(dir);
1315
for (const file of files) {
@@ -17,7 +19,18 @@ function removeEmptyStringsFromLocaleFiles(dir) {
1719
} else if (file.endsWith(".json")) {
1820
const content = JSON.parse(readFileSync(filePath, "utf-8"));
1921
for (const key in content) {
20-
if (content[key] === "") {
22+
// 递归删除嵌套对象中的空字符串
23+
if (typeof content[key] === "object" && content[key] !== null) {
24+
for (const nestedKey in content[key]) {
25+
if (content[key][nestedKey] === "") {
26+
delete content[key][nestedKey];
27+
}
28+
}
29+
// 如果嵌套对象变为空对象,则删除该键
30+
if (Object.keys(content[key]).length === 0) {
31+
delete content[key];
32+
}
33+
} else if (content[key] === "") {
2134
delete content[key];
2235
}
2336
}

src/app/service/service_worker/runtime.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,11 @@ export class RuntimeService {
550550
return;
551551
}
552552
// 使注册时重新注入 chrome.runtime
553-
chrome.userScripts.resetWorldConfiguration();
553+
try {
554+
await chrome.userScripts.resetWorldConfiguration();
555+
} catch (e: any) {
556+
console.error("chrome.userScripts.resetWorldConfiguration() failed.", e);
557+
}
554558

555559
const [particularScriptList, generalScriptList] = await Promise.all([
556560
// registerScripts

src/locales/ach-UG/translation.json

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@
350350
"start_guide_content": "crwdns8560:0crwdne8560:0",
351351
"guide_installed_scripts": "crwdns8562:0crwdne8562:0",
352352
"guide_script_list_title": "crwdns8564:0crwdne8564:0",
353-
"guide_script_list_content": "crwdns8566:0crwdne8566:0",
353+
"guide_script_list_content": "crwdns10802:0crwdne10802:0",
354354
"guide_script_list_enable_title": "crwdns8568:0crwdne8568:0",
355355
"guide_script_list_enable_content": "crwdns8570:0crwdne8570:0",
356356
"guide_script_list_apply_to_run_status_title": "crwdns8572:0crwdne8572:0",
@@ -451,5 +451,25 @@
451451
"light": "crwdns10794:0crwdne10794:0",
452452
"dark": "crwdns10796:0crwdne10796:0",
453453
"individual_edit": "crwdns10798:0crwdne10798:0",
454-
"batch_edit": "crwdns10800:0crwdne10800:0"
454+
"batch_edit": "crwdns10800:0crwdne10800:0",
455+
"script_code": "crwdns10804:0crwdne10804:0",
456+
"enter_search_value": "crwdns10806:0{{search}}crwdne10806:0",
457+
"script_run_env": {
458+
"title": "crwdns10808:0crwdne10808:0",
459+
"default": "crwdns10810:0crwdne10810:0",
460+
"all": "crwdns10812:0crwdne10812:0",
461+
"normal-tabs": "crwdns10814:0crwdne10814:0",
462+
"incognito-tabs": "crwdns10816:0crwdne10816:0"
463+
},
464+
"editor_config": "crwdns10818:0crwdne10818:0",
465+
"editor_config_description": "crwdns10820:0crwdne10820:0",
466+
"editor_type_definition": "crwdns10822:0crwdne10822:0",
467+
"editor_type_definition_description": "crwdns10824:0crwdne10824:0",
468+
"eslint_rules_reset": "crwdns10826:0crwdne10826:0",
469+
"eslint_rules_saved": "crwdns10828:0crwdne10828:0",
470+
"editor_config_reset": "crwdns10830:0crwdne10830:0",
471+
"editor_config_saved": "crwdns10832:0crwdne10832:0",
472+
"editor_config_format_error": "crwdns10834:0crwdne10834:0",
473+
"editor_type_definition_reset": "crwdns10836:0crwdne10836:0",
474+
"editor_type_definition_saved": "crwdns10838:0crwdne10838:0"
455475
}

src/locales/en-US/translation.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,5 +453,23 @@
453453
"individual_edit": "Individual Edit",
454454
"batch_edit": "Batch Edit",
455455
"script_code": "Script Code",
456-
"enter_search_value": "Enter {{search}} to search"
456+
"enter_search_value": "Enter {{search}} to search",
457+
"script_run_env": {
458+
"title": "Operating environment",
459+
"default": "default",
460+
"all": "All",
461+
"normal-tabs": "Normal tags",
462+
"incognito-tabs": "Incognito tags"
463+
},
464+
"editor_config": "Editor Configuration",
465+
"editor_config_description": "You can refer to the compilerOptions in <Link href=\"https://code.visualstudio.com/docs/languages/jsconfig\">jsconfig.js</Link> for configuration",
466+
"editor_type_definition": "Editor Type Definition",
467+
"editor_type_definition_description": "You can customize your own type definitions, and the script editor will automatically load these type definitions",
468+
"eslint_rules_reset": "ESLint Rules Reset",
469+
"eslint_rules_saved": "ESLint Rules Saved",
470+
"editor_config_reset": "Editor Configuration Reset",
471+
"editor_config_saved": "Editor Configuration Saved",
472+
"editor_config_format_error": "Editor Configuration Format Error",
473+
"editor_type_definition_reset": "Editor Type Definition Reset",
474+
"editor_type_definition_saved": "Editor Type Definition Saved"
457475
}

src/locales/zh-CN/translation.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,5 +460,16 @@
460460
"all": "所有标签",
461461
"normal-tabs": "普通标签",
462462
"incognito-tabs": "隐身标签"
463-
}
463+
},
464+
"editor_config": "",
465+
"editor_config_description": "",
466+
"editor_type_definition": "",
467+
"editor_type_definition_description": "",
468+
"eslint_rules_reset": "",
469+
"eslint_rules_saved": "",
470+
"editor_config_reset": "",
471+
"editor_config_saved": "",
472+
"editor_config_format_error": "",
473+
"editor_type_definition_reset": "",
474+
"editor_type_definition_saved": ""
464475
}

src/locales/zh-TW/translation.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,5 +451,14 @@
451451
"light": "淺色模式",
452452
"dark": "暗色模式",
453453
"individual_edit": "单独编辑",
454-
"batch_edit": "批量編輯"
454+
"batch_edit": "批量編輯",
455+
"script_code": "脚本代码",
456+
"enter_search_value": "請輸入 {{search}} 進行搜尋",
457+
"script_run_env": {
458+
"title": "運作環境",
459+
"default": "預設",
460+
"all": "所有標籤",
461+
"normal-tabs": "普通標籤",
462+
"incognito-tabs": "隱身標籤"
463+
}
455464
}

src/pages/components/CodeEditor/index.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { LinterWorker } from "@App/pkg/utils/monaco-editor";
21
import { editor, Range } from "monaco-editor";
32
import React, { useEffect, useImperativeHandle, useRef, useState } from "react";
43
import { globalCache, systemConfig } from "@App/pages/store/global";
4+
import { LinterWorker } from "@App/pkg/utils/monaco-editor";
55

66
type Props = {
77
className?: string;
@@ -45,6 +45,9 @@ const CodeEditor: React.ForwardRefRenderFunction<{ editor: editor.IStandaloneCod
4545
// @ts-ignore
4646
if (diffCode) {
4747
edit = editor.createDiffEditor(inlineDiv, {
48+
hideUnchangedRegions: {
49+
enabled: true,
50+
},
4851
enableSplitViewResizing: false,
4952
renderSideBySide: false,
5053
folding: true,
@@ -77,9 +80,9 @@ const CodeEditor: React.ForwardRefRenderFunction<{ editor: editor.IStandaloneCod
7780
setEditor(edit);
7881
}
7982
return () => {
80-
if (edit) {
81-
edit.dispose();
82-
}
83+
// 目前会出现:Uncaught (in promise) Canceled: Canceled
84+
// 问题追踪:https://github.com/microsoft/monaco-editor/issues/4702
85+
edit?.dispose();
8386
};
8487
}, [div, code, diffCode, editable, id]);
8588

src/pages/components/CustomTrans/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import { useTranslation } from "react-i18next";
44

55
// 因为i18n的Trans组件打包后出现问题,所以自己实现一个
66
export const CustomTrans: React.FC<{
7+
className?: string;
78
i18nKey: string;
8-
}> = ({ i18nKey }) => {
9+
}> = ({ className, i18nKey }) => {
910
const { t } = useTranslation();
1011
const children: (JSX.Element | string)[] = [];
1112
let content = t(i18nKey);
@@ -39,7 +40,7 @@ export const CustomTrans: React.FC<{
3940
}
4041
}
4142

42-
return <div>{children}</div>;
43+
return <div className={className}>{children}</div>;
4344
};
4445

4546
export default CustomTrans;

src/pages/install/main.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import "@arco-design/web-react/dist/css/arco.css";
1111
import "@App/locales/locales";
1212
import "@App/index.css";
1313
import "./index.css";
14+
import registerEditor from "@App/pkg/utils/monaco-editor";
15+
16+
registerEditor();
1417

1518
// 初始化日志组件
1619
const loggerCore = new LoggerCore({

0 commit comments

Comments
 (0)