File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
src/mentionPlugin/MentionSearch/MentionOption Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,25 @@ export default class MentionOption extends Component {
9
9
10
10
constructor ( props ) {
11
11
super ( props ) ;
12
- this . state = { } ;
12
+ this . mouseDown = false ;
13
13
}
14
14
15
- onMentionSelect = ( ) => {
16
- this . props . onMentionSelect ( this . props . mention ) ;
15
+ componentDidUpdate ( ) {
16
+ this . mouseDown = false ;
17
+ }
18
+
19
+ onMouseUp = ( ) => {
20
+ if ( this . mouseDown ) {
21
+ this . mouseDown = false ;
22
+ this . props . onMentionSelect ( this . props . mention ) ;
23
+ }
24
+ } ;
25
+
26
+ onMouseDown = ( event ) => {
27
+ // Note: important to avoid a content edit change
28
+ event . preventDefault ( ) ;
29
+
30
+ this . mouseDown = true ;
17
31
} ;
18
32
19
33
onMouseEnter = ( ) => {
@@ -25,7 +39,8 @@ export default class MentionOption extends Component {
25
39
return (
26
40
< div
27
41
className = { className }
28
- onClick = { this . onMentionSelect }
42
+ onMouseDown = { this . onMouseDown }
43
+ onMouseUp = { this . onMouseUp }
29
44
onMouseEnter = { this . onMouseEnter }
30
45
role = "option"
31
46
>
You can’t perform that action at this time.
0 commit comments