@@ -37,7 +37,9 @@ export class ColorPicker extends React.Component<
37
37
38
38
onDocumentClick = ( e : React . MouseEvent ) => {
39
39
const target = e . target as HTMLDivElement
40
- if ( target === this . container || this . container . contains ( target ) ) {
40
+ const picker = this . container . querySelector ( '.sketch-picker' ) !
41
+
42
+ if ( target === picker || picker . contains ( target ) ) {
41
43
return
42
44
}
43
45
@@ -59,12 +61,9 @@ export class ColorPicker extends React.Component<
59
61
if ( this . props . onChange ) {
60
62
this . props . onChange ( value , event )
61
63
}
62
-
63
64
this . setState ( {
64
- active : false ,
65
65
color : value . rgb ,
66
66
} )
67
- this . unbindDocEvent ( )
68
67
}
69
68
70
69
handleClick = ( e : React . MouseEvent ) => {
@@ -84,8 +83,10 @@ export class ColorPicker extends React.Component<
84
83
}
85
84
}
86
85
87
- refContainer = ( container : HTMLDivElement ) => {
88
- this . container = container
86
+ refContainer = ( popoverRef : { getContainer : ( ) => HTMLDivElement } ) => {
87
+ if ( popoverRef ) {
88
+ this . container = popoverRef . getContainer ( )
89
+ }
89
90
}
90
91
91
92
renderPicker ( ) {
@@ -123,10 +124,12 @@ export class ColorPicker extends React.Component<
123
124
{ ...popoverProps }
124
125
content = { this . renderPicker ( ) }
125
126
overlayClassName = { `${ baseCls } -overlay` }
127
+ destroyTooltipOnHide
128
+ ref = { this . refContainer }
129
+ trigger = { [ ] }
126
130
>
127
131
< div
128
132
style = { style }
129
- ref = { this . refContainer }
130
133
onClick = { this . handleClick }
131
134
className = { classNames ( baseCls , {
132
135
[ `${ baseCls } -disabled` ] : disabled ,
0 commit comments