Skip to content

Commit

Permalink
feat: editor import PAC definition
Browse files Browse the repository at this point in the history
  • Loading branch information
dongchengjie committed May 18, 2024
1 parent bd3b41c commit b25cf5e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
"i18next": "^23.11.3",
"lodash-es": "^4.17.21",
"meta-json-schema": "1.18.4-beta5",
"monaco-editor": "^0.47.0",
"monaco-editor": "^0.48.0",
"monaco-yaml": "^5.1.1",
"types-pac": "^1.0.2",
"nanoid": "^5.0.7",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
39 changes: 25 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/components/profile/editor-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ 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";
import pac from "types-pac/pac.d.ts?raw";

interface Props {
mode: "profile" | "text";
Expand Down Expand Up @@ -51,6 +52,8 @@ configureMonacoYaml(monaco, {
},
],
});
// PAC definition
monaco.languages.typescript.javascriptDefaults.addExtraLib(pac, "pac.d.ts");

export const EditorViewer = (props: Props) => {
const { mode, property, open, language, schema, onClose, onChange } = props;
Expand Down

0 comments on commit b25cf5e

Please sign in to comment.