补充 json 示例
This commit is contained in:
parent
b96612b1f3
commit
7904d0c89d
|
@ -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}`
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue