File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ export default class List extends EventDispatcher {
50
50
item . dataset . id = id ;
51
51
item . item = o ;
52
52
item . addEventListener ( "click" , f ) ;
53
+ item . addEventListener ( "dblclick" , f ) ;
53
54
}
54
55
}
55
56
@@ -87,9 +88,12 @@ export default class List extends EventDispatcher {
87
88
88
89
handleClick ( evt ) {
89
90
let id = evt . currentTarget . dataset . id , old = this . selected ;
90
- if ( this . multi ) {
91
+ if ( evt . type === "dblclick" ) {
92
+ if ( id != null ) { this . dispatchEvent ( "dblclick" ) ; }
93
+ return ;
94
+ } else if ( this . multi ) {
91
95
$ . toggleClass ( evt . currentTarget , "selected" ) ;
92
- } else if ( this . selected === id ) {
96
+ } else if ( old === id ) {
93
97
if ( id != null ) { this . dispatchEvent ( "selclick" ) ; }
94
98
return ;
95
99
} else {
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ export default class Sidebar {
146
146
this . listEl = $ . query ( "> .list" , this . fullEl ) ;
147
147
this . menuList = new List ( this . listEl , { data :content . kids , template :this . menuListTemplate } ) ;
148
148
this . menuList . on ( "change" , ( ) => this . show ( this . menuList . selectedItem ) ) ;
149
- this . menuList . on ( "selclick " , ( ) => this . _onSelClick ( this . menuList . selectedItem ) ) ;
149
+ this . menuList . on ( "dblclick " , ( ) => this . _onDblClick ( this . menuList . selectedItem ) ) ;
150
150
this . contentEl = $ . query ( "> .content" , this . fullEl ) ;
151
151
152
152
// set up minimized sidebar:
@@ -202,7 +202,7 @@ export default class Sidebar {
202
202
return false ;
203
203
}
204
204
205
- _onSelClick ( o ) {
205
+ _onDblClick ( o ) {
206
206
if ( o . token ) {
207
207
let expr = app . expression ;
208
208
if ( o . parent . id === "flags" ) { expr . toggleFlag ( o . token ) ; }
You can’t perform that action at this time.
0 commit comments