fix: 使用npm安装meta-json-schema (#895)

* feat: allow manual selection of url-test group

* feat: fixed proxy indicator

* fix: try to fix traffic websocket no longer updating

* fixup: group delay test use defined url

* feat: connections sorted by start by default

* feat: Connection details show the full path of the process

* fix: editor no hints and add yaml support

* feat: quick suggestions

* chore: use monaco-editor

* chore: update schema url

* chore: change default merge config content

* fix: load schema via npm

* feat: runtime config viewer style auto adjust

* feat: adjust fixed proxy style

* fix: headState "showType" won't toggle hover text

* chore: switch version

* chore: Update pnpm lockfile
This commit is contained in:
dongchengjie
2024-04-19 13:54:16 +08:00
committed by GitHub
parent d13b8fd486
commit 0865b702a3
9 changed files with 766 additions and 717 deletions

View File

@@ -18,6 +18,10 @@ import * as monaco from "monaco-editor";
import { editor } from "monaco-editor/esm/vs/editor/editor.api";
import { configureMonacoYaml } from "monaco-yaml";
import { type JSONSchema7 } from "json-schema";
import metaSchema from "meta-json-schema/schemas/meta-json-schema.json";
import mergeSchema from "meta-json-schema/schemas/clash-verge-merge-json-schema.json";
interface Props {
uid: string;
open: boolean;
@@ -33,12 +37,14 @@ configureMonacoYaml(monaco, {
enableSchemaRequest: true,
schemas: [
{
uri: "https://fastly.jsdelivr.net/gh/dongchengjie/meta-json-schema@main/schemas/meta-json-schema.json",
uri: "http://example.com/meta-json-schema.json",
fileMatch: ["**/*.clash.yaml"],
schema: metaSchema as JSONSchema7,
},
{
uri: "https://fastly.jsdelivr.net/gh/dongchengjie/meta-json-schema@main/schemas/clash-verge-merge-json-schema.json",
uri: "http://example.com/clash-verge-merge-json-schema.json",
fileMatch: ["**/*.merge.yaml"],
schema: mergeSchema as JSONSchema7,
},
],
});
@@ -65,8 +71,10 @@ export const EditorViewer = (props: Props) => {
instanceRef.current = editor.create(editorRef.current, {
model: model,
language: language,
tabSize: ["yaml", "javascript"].includes(language) ? 2 : 4, // 根据语言类型设置缩进
theme: themeMode === "light" ? "vs" : "vs-dark",
minimap: { enabled: dom.clientWidth >= 1000 }, // 超过一定宽度显示minimap滚动条
mouseWheelZoom: true, // Ctrl+滚轮调节缩放
quickSuggestions: {
strings: true, // 字符串类型的建议
comments: true, // 注释类型的建议
@@ -102,7 +110,7 @@ export const EditorViewer = (props: Props) => {
<DialogTitle>{t("Edit File")}</DialogTitle>
<DialogContent
sx={{ width: "95%", height: "100vh", pb: 1, userSelect: "text" }}
sx={{ width: "94%", height: "100vh", pb: 1, userSelect: "text" }}
>
<div style={{ width: "100%", height: "100%" }} ref={editorRef} />
</DialogContent>