From 333e4035e3d517ad11f79bc0484105517986f24a Mon Sep 17 00:00:00 2001 From: liaoxuezhi Date: Tue, 30 Jul 2019 10:52:15 +0800 Subject: [PATCH] =?UTF-8?q?json=20=E5=BC=80=E5=90=AF=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E6=94=BE=E5=9C=A8=20components=20=E9=87=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Editor.tsx | 6 ++++++ src/renderers/Form/Editor.tsx | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/Editor.tsx b/src/components/Editor.tsx index 52ba1a1a..742b2d69 100644 --- a/src/components/Editor.tsx +++ b/src/components/Editor.tsx @@ -339,6 +339,12 @@ export class Editor extends React.Component { theme: editorTheme, }); + // json 默认开启验证。 + monaco.languages.json.jsonDefaults.setDiagnosticsOptions({ + enableSchemaRequest: true, + validate: true + }); + // After initializing monaco editor this.editorDidMount(this.editor, monaco); } diff --git a/src/renderers/Form/Editor.tsx b/src/renderers/Form/Editor.tsx index 7ae8b83b..1a146e7b 100644 --- a/src/renderers/Form/Editor.tsx +++ b/src/renderers/Form/Editor.tsx @@ -69,12 +69,6 @@ export default class EditorControl extends React.Component { 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() {