File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -50,11 +50,11 @@ class JsonAddValue extends Component {
5050 const { inputRefKey, inputRefValue } = this . state ;
5151 const { onlyValue } = this . props ;
5252
53- if ( inputRefKey ) {
53+ if ( inputRefKey && ( typeof inputRefKey . focus === 'function' ) ) {
5454 inputRefKey . focus ( ) ;
5555 }
5656
57- if ( onlyValue && inputRefValue ) {
57+ if ( onlyValue && inputRefValue && ( typeof inputRefValue . focus === 'function' ) ) {
5858 inputRefValue . focus ( ) ;
5959 }
6060 }
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ class JsonValue extends Component {
7777 const { editEnabled, inputRef } = this . state ;
7878 const { readOnly } = this . props ;
7979
80- if ( editEnabled && ! readOnly ) {
80+ if ( editEnabled && ! readOnly && ( typeof inputRef . focus === 'function' ) ) {
8181 inputRef . focus ( ) ;
8282 }
8383 }
@@ -142,13 +142,13 @@ class JsonValue extends Component {
142142 const cancelButtonElementLayout = React . cloneElement ( cancelButtonElement , {
143143 onClick : this . handleCancelEdit ,
144144 } ) ;
145- const inputElementLayout = React . cloneElement ( textareaElement , {
145+ const textareaElementLayout = React . cloneElement ( textareaElement , {
146146 ref : this . refInput ,
147147 defaultValue : originalValue ,
148148 } ) ;
149149
150150 result = ( < span className = "rejt-edit-form" style = { style . editForm } >
151- { inputElementLayout } { cancelButtonElementLayout } { editButtonElementLayout }
151+ { textareaElementLayout } { cancelButtonElementLayout } { editButtonElementLayout }
152152 </ span > ) ;
153153 minusElement = null ;
154154 } else {
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ class JsonValue extends Component {
7777 const { editEnabled, inputRef } = this . state ;
7878 const { readOnly } = this . props ;
7979
80- if ( editEnabled && ! readOnly ) {
80+ if ( editEnabled && ! readOnly && ( typeof inputRef . focus === 'function' ) ) {
8181 inputRef . focus ( ) ;
8282 }
8383 }
You can’t perform that action at this time.
0 commit comments