补充 json 示例

This commit is contained in:
liaoxuezhi 2019-07-25 10:06:22 +08:00
parent b96612b1f3
commit 7904d0c89d
2 changed files with 14 additions and 11 deletions

View File

@ -11,23 +11,34 @@ export default {
controls: [
{
name: "javascript",
type: "javascript-editor",
type: "editor",
label: "Javascript",
language: 'javascript',
value: "console.log(1, 2, 3);"
},
{
name: "html",
type: "html-editor",
type: "editor",
language: 'html',
label: "Html",
value: "<html><head><title>Hello</title></head><body><p>world</p></body></html>"
},
{
name: "css",
type: "css-editor",
type: "editor",
language: 'css',
label: "CSS",
value: "body {color: red;}"
},
{
name: "json",
type: "editor",
language: 'json',
label: "JSON",
value: `{"a": 1, "b": 2}`
}
]
}

View File

@ -181,13 +181,6 @@ export default class PlayGround extends React.Component {
);
}
handleEditorMount(editor, monaco) {
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
enableSchemaRequest: true,
validate: true
});
}
handleChange(value) {
this.setState({
schemaCode: value
@ -239,7 +232,6 @@ export default class PlayGround extends React.Component {
value={this.state.schemaCode}
onChange={this.handleChange}
language="json"
editorDidMount={this.handleEditorMount}
/>
);
}