diff --git a/src/components/layers/JSONEditor.jsx b/src/components/layers/JSONEditor.jsx index 2b8f6a8..0b8625c 100644 --- a/src/components/layers/JSONEditor.jsx +++ b/src/components/layers/JSONEditor.jsx @@ -54,6 +54,7 @@ class JSONEditor extends React.Component { super(props) this.state = { isEditing: false, + showMessage: false, prevValue: this.props.getValue(this.props.layer), }; } @@ -82,17 +83,24 @@ class JSONEditor extends React.Component { this._doc.on('blur', this.onBlur); } - onFocus = () => { + onPointerDown = (cm, e) => { + this._keyEvent = "pointer"; + } + + onFocus = (cm, e) => { this.props.onFocus(); this.setState({ - isEditing: true + isEditing: true, + showMessage: (this._keyEvent === "keyboard"), }); } onBlur = () => { + this._keyEvent = "keyboard"; this.props.onBlur(); this.setState({ - isEditing: false + isEditing: false, + showMessage: false, }); } @@ -145,16 +153,22 @@ class JSONEditor extends React.Component { } render() { + const {showMessage} = this.state; const style = {}; if (this.props.maxHeight) { style.maxHeight = this.props.maxHeight; } - return