diff --git a/src/components/layers/JSONEditor.jsx b/src/components/layers/JSONEditor.jsx index 2271c996..c9960237 100644 --- a/src/components/layers/JSONEditor.jsx +++ b/src/components/layers/JSONEditor.jsx @@ -56,6 +56,13 @@ class JSONEditor extends React.Component { } } + resetValue() { + console.log('reset') + this.setState({ + code: JSON.stringify(this.props.layer, null, 2) + }) + } + render() { const codeMirrorOptions = { mode: {name: "javascript", json: true}, @@ -69,6 +76,7 @@ class JSONEditor extends React.Component { return focused ? true : this.resetValue()} options={codeMirrorOptions} /> }