diff --git a/src/components/Forms/Json.tsx b/src/components/Forms/Json.tsx index 520056a..603a94a 100644 --- a/src/components/Forms/Json.tsx +++ b/src/components/Forms/Json.tsx @@ -8,7 +8,8 @@ import { import { Button, Dropdown, Form, Space } from "antd"; import { DownOutlined } from "@ant-design/icons"; import { jsonFormat, jsonStringFormat, jsonParse } from "../../uitls"; -import { MonacoEditor } from "../../uitls/userMonacoWorker"; +import * as monaco from "monaco-editor"; +import { MonacoEditor, getModel, model, modelUri } from "../../uitls/userMonacoWorker"; import { Template } from "../../templates"; import { render } from "react-dom"; import { useServerConfig } from "../../uitls/server"; @@ -92,6 +93,7 @@ const JsonForm: React.FC = (props) => { formRef={formRef} modalProps={{ destroyOnClose: true, + maskClosable: false, }} > {hasTemplate ? ( @@ -193,7 +195,12 @@ const JsonForm: React.FC = (props) => { // selectOnLineNumbers: true, minimap: { enabled: false }, // readOnly: readOnly, + // json 数据格式测试 + // model: monaco.editor.createModel('', "json", modelUri) + // model: getModel('') + // model: model }} + > diff --git a/src/components/List/Public.tsx b/src/components/List/Public.tsx index adea3e8..f855400 100644 --- a/src/components/List/Public.tsx +++ b/src/components/List/Public.tsx @@ -138,7 +138,7 @@ const PublicList: React.FC = (props) => {
obj._id_ || obj.name} - scroll={{ y: 246 }} + scroll={{ y: 290 }} size="small" dataSource={showList} columns={[ @@ -275,6 +275,7 @@ const PublicList: React.FC = (props) => { }, }, ]} + pagination={false} >
); diff --git a/src/templates/otherOrigin.ts b/src/templates/otherOrigin.ts index 00e5893..fb0c8e8 100644 --- a/src/templates/otherOrigin.ts +++ b/src/templates/otherOrigin.ts @@ -16,7 +16,7 @@ export const getRedisTemplate = (name: string, type?: string) => { "addr": "127.0.0.1:6379", "db": "1", "password": "123456", - ${type ? `"type": "${type}"` : ""} + ${type ? `"type": "${type}",` : ""} "key": "gost:${name}-0" } }`; diff --git a/src/uitls/userMonacoWorker.ts b/src/uitls/userMonacoWorker.ts index 835478d..7bb49b3 100644 --- a/src/uitls/userMonacoWorker.ts +++ b/src/uitls/userMonacoWorker.ts @@ -30,12 +30,47 @@ self.MonacoEnvironment = { return new editorWorker(); }, }; + +var modelUri = monaco.Uri.parse("a://b/foo.json"); // a made up unique URI for our model +var getModel = (value: string) => { + return monaco.editor.createModel(value, "json", modelUri); +}; +var model = getModel(''); + monaco.languages.json.jsonDefaults.setDiagnosticsOptions({ allowComments: true, trailingCommas: "warning", + validate: true, + // json 数据格式测试 + schemas: [ + { + uri: "http://gost/config.json", // id of the first schema + fileMatch: [modelUri.toString()], // associate with our model + schema: { + type: "object", + properties: { + p1: { + enum: ["v1", "v2"], + }, + p2: { + $ref: "http://myserver/bar-schema.json", // reference the second schema + }, + }, + }, + }, + { + uri: "http://myserver/bar-schema.json", // id of the second schema + schema: { + type: "object", + properties: { + q1: { + enum: ["x1", "x2"], + }, + }, + }, + }, + ], }); monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true); -export { - MonacoEditor -} \ No newline at end of file +export { MonacoEditor, modelUri, getModel, model };