json 开启验证放在 components 里面

This commit is contained in:
liaoxuezhi 2019-07-30 10:52:15 +08:00
parent 8783ce1c21
commit 333e4035e3
2 changed files with 6 additions and 6 deletions

View File

@ -339,6 +339,12 @@ export class Editor extends React.Component<EditorProps, any> {
theme: editorTheme,
});
// json 默认开启验证。
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
enableSchemaRequest: true,
validate: true
});
// After initializing monaco editor
this.editorDidMount(this.editor, monaco);
}

View File

@ -69,12 +69,6 @@ export default class EditorControl extends React.Component<EditorProps, any> {
this.toDispose.push(editor.onDidFocusEditorWidget(this.updateContainerSize).dispose);
this.toDispose.push(editor.onDidChangeModelContent(this.updateContainerSize).dispose);
this.props.editorDidMount && this.props.editorDidMount(editor, monaco);
// json 默认开启验证。
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
enableSchemaRequest: true,
validate: true
});
}
updateContainerSize() {