@@ -35,27 +35,29 @@ var Leaf = React.createClass({
35
35
DTPath : p . DTPath ,
36
36
} ;
37
37
38
- var onLabelClick = this . _onClick . bind ( this , d ) ;
38
+ var onLabelClick = this . _onClick . bind ( this , d , true ) ;
39
+ var onValueClick = this . _onClick . bind ( this , d , false ) ;
39
40
var dataType = type ( this . data ( ) ) ;
40
41
var isLeaf = dataType !== 'Array' && dataType !== 'Object' ;
41
42
42
43
return D . div ( { className : this . getClassName ( ) , id : 'leaf-' + this . _rootPath ( ) } ,
43
44
D . input ( { className : 'json-inspector__radio' , type : 'radio' , name : p . id , id : id , tabIndex : - 1 } ) ,
44
- D . label ( { className : 'json-inspector__line' , htmlFor : id , onClick : onLabelClick } ,
45
+ D . label ( { className : 'json-inspector__line' , htmlFor : id , onClick : this . toggle } ,
45
46
D . div ( { className : 'json-inspector__flatpath' } ,
46
47
d . path ) ,
47
48
isLeaf ?
48
49
null :
49
50
this . state . expanded ? D . i ( { className : 'icon caret down' } ) : D . i ( { className : 'icon caret right' } ) ,
50
- D . span ( { className : isLeaf ? 'json-inspector__leafKey' : 'json-inspector__key' } ,
51
+ D . span ( { className : isLeaf ? 'json-inspector__leafKey' : 'json-inspector__key' ,
52
+ onClick : isLeaf ? onLabelClick : undefined } ,
51
53
this . format ( d . key ) ,
52
54
':' ,
53
55
this . renderInteractiveLabel ( d . key , true ) ) ,
54
- this . renderTitle ( ) ,
56
+ this . renderTitle ( onValueClick ) ,
55
57
this . renderShowOriginalButton ( ) ) ,
56
58
this . renderChildren ( ) ) ;
57
59
} ,
58
- renderTitle : function ( ) {
60
+ renderTitle : function ( onValueClick ) {
59
61
var data = this . data ( ) ;
60
62
var t = type ( data ) ;
61
63
@@ -67,7 +69,7 @@ var Leaf = React.createClass({
67
69
return D . span ( { className : 'json-inspector__value json-inspector__value_helper' } ,
68
70
'{} ' + items ( Object . keys ( data ) . length ) ) ;
69
71
default :
70
- return D . span ( { className : 'json-inspector__value json-inspector__value_' + t . toLowerCase ( ) } ,
72
+ return D . span ( { className : 'json-inspector__value json-inspector__value_' + t . toLowerCase ( ) , onClick : onValueClick } ,
71
73
this . format ( String ( data ) ) ,
72
74
this . renderInteractiveLabel ( data , false ) ) ;
73
75
}
@@ -194,9 +196,9 @@ var Leaf = React.createClass({
194
196
expanded : ! this . state . expanded
195
197
} ) ;
196
198
} ,
197
- _onClick : function ( data , e ) {
199
+ _onClick : function ( data , isLabel , e ) {
198
200
this . toggle ( ) ;
199
- this . props . onClick ( data ) ;
201
+ this . props . onClick ( data , isLabel ) ;
200
202
201
203
e . stopPropagation ( ) ;
202
204
} ,
0 commit comments