File tree Expand file tree Collapse file tree 2 files changed +32
-6
lines changed Expand file tree Collapse file tree 2 files changed +32
-6
lines changed Original file line number Diff line number Diff line change @@ -79,21 +79,47 @@ export default class ResultView {
79
79
}
80
80
} )
81
81
82
- this . view . addEventListener ( 'click' , ( ) => {
83
- if ( ! ( this . overlayElement && this . overlayElement . parentNode ) ) return
84
- let edView
85
- if ( edView = atom . views . getView ( atom . workspace . getActiveTextEditor ( ) ) ) {
86
- edView . focus ( )
82
+ this . view . addEventListener ( 'mouseup' , ev => {
83
+ if ( ev . button === 1 ) {
84
+ // middle mouse button
85
+ this . model . remove ( )
86
+ this . focusEditor ( )
87
+ } else if ( document . getSelection ( ) . toString ( ) . length === 0 ) {
88
+ this . focusEditor ( )
87
89
}
88
90
} )
89
91
92
+ this . view . addEventListener ( 'mousedown' , ev => {
93
+ this . blurEditor ( )
94
+ } )
95
+
96
+ this . view . addEventListener ( 'mouseleave' , ev => {
97
+ this . focusEditor ( )
98
+ } )
99
+
90
100
if ( fade ) this . fadeIn ( )
91
101
if ( content != null ) this . setContent ( content , opts )
92
102
if ( loading ) this . setContent ( views . render ( span ( 'loading icon icon-gear' ) ) , opts )
93
103
94
104
return this . view
95
105
}
96
106
107
+ blurEditor ( ed ) {
108
+ const c = this . model . editor . component
109
+ if ( c && c . didBlurHiddenInput ) {
110
+ c . didBlurHiddenInput ( {
111
+ relatedTarget : null
112
+ } )
113
+ }
114
+ }
115
+
116
+ focusEditor ( ) {
117
+ const c = this . model . editor . component
118
+ if ( c && c . didFocus ) {
119
+ c . didFocus ( )
120
+ }
121
+ }
122
+
97
123
fadeIn ( ) {
98
124
this . view . classList . add ( 'ink-hide' )
99
125
setTimeout ( ( ) => this . view . classList . remove ( 'ink-hide' ) , 20 )
Original file line number Diff line number Diff line change @@ -196,7 +196,7 @@ atom-text-editor {
196
196
transition : all 0.2s , visibility 0s ;
197
197
opacity : 1 ;
198
198
cursor : default ;
199
- user-select : auto ;
199
+ user-select : text ;
200
200
201
201
border-radius : 3px ;
202
202
You can’t perform that action at this time.
0 commit comments