1
1
// Event bus
2
- import EventBus from ' ./../../../eventBus' ;
2
+ import EventBus from " ./../../../eventBus" ;
3
3
4
4
export default {
5
5
computed : {
@@ -64,7 +64,10 @@ export default {
64
64
* @param path
65
65
*/
66
66
selectDirectory ( path ) {
67
- this . $store . dispatch ( `fm/${ this . manager } /selectDirectory` , { path, history : true } ) ;
67
+ this . $store . dispatch ( `fm/${ this . manager } /selectDirectory` , {
68
+ path,
69
+ history : true ,
70
+ } ) ;
68
71
} ,
69
72
70
73
/**
@@ -74,10 +77,16 @@ export default {
74
77
// if this a not root directory
75
78
if ( this . selectedDirectory ) {
76
79
// calculate up directory path
77
- const pathUp = this . selectedDirectory . split ( '/' ) . slice ( 0 , - 1 ) . join ( '/' ) ;
80
+ const pathUp = this . selectedDirectory
81
+ . split ( "/" )
82
+ . slice ( 0 , - 1 )
83
+ . join ( "/" ) ;
78
84
79
85
// load directory
80
- this . $store . dispatch ( `fm/${ this . manager } /selectDirectory` , { path : pathUp || null , history : true } ) ;
86
+ this . $store . dispatch ( `fm/${ this . manager } /selectDirectory` , {
87
+ path : pathUp || null ,
88
+ history : true ,
89
+ } ) ;
81
90
}
82
91
} ,
83
92
@@ -107,12 +116,16 @@ export default {
107
116
this . $store . commit ( `fm/${ this . manager } /setSelected` , { type, path } ) ;
108
117
} else {
109
118
// remove selected item
110
- this . $store . commit ( `fm/${ this . manager } /removeSelected` , { type, path } ) ;
119
+ this . $store . commit ( `fm/${ this . manager } /removeSelected` , {
120
+ type,
121
+ path,
122
+ } ) ;
111
123
}
112
124
}
113
125
114
126
// single select
115
- if ( ! event . ctrlKey && ! alreadySelected ) this . $store . commit ( `fm/${ this . manager } /changeSelected` , { type, path } ) ;
127
+ if ( ! event . ctrlKey && ! alreadySelected )
128
+ this . $store . commit ( `fm/${ this . manager } /changeSelected` , { type, path } ) ;
116
129
} ,
117
130
118
131
/**
@@ -122,7 +135,7 @@ export default {
122
135
*/
123
136
contextMenu ( item , event ) {
124
137
// el type
125
- const type = item . type === ' dir' ? ' directories' : ' files' ;
138
+ const type = item . type === " dir" ? " directories" : " files" ;
126
139
// search in selected array
127
140
const alreadySelected = this . selected [ type ] . includes ( item . path ) ;
128
141
@@ -136,7 +149,7 @@ export default {
136
149
}
137
150
138
151
// create event
139
- EventBus . $emit ( ' contextMenu' , event ) ;
152
+ EventBus . $emit ( " contextMenu" , event ) ;
140
153
} ,
141
154
142
155
/**
@@ -147,14 +160,16 @@ export default {
147
160
selectAction ( path , extension ) {
148
161
// if is set fileCallback
149
162
if ( this . $store . state . fm . fileCallback ) {
150
- this . $store . dispatch ( 'fm/url' , {
151
- disk : this . selectedDisk ,
152
- path,
153
- } ) . then ( ( response ) => {
154
- if ( response . data . result . status === 'success' ) {
155
- this . $store . state . fm . fileCallback ( response . data . url ) ;
156
- }
157
- } ) ;
163
+ this . $store
164
+ . dispatch ( "fm/url" , {
165
+ disk : this . selectedDisk ,
166
+ path,
167
+ } )
168
+ . then ( ( response ) => {
169
+ if ( response . data . result . status === "success" ) {
170
+ this . $store . state . fm . fileCallback ( response . data . url ) ;
171
+ }
172
+ } ) ;
158
173
159
174
return ;
160
175
}
@@ -165,32 +180,44 @@ export default {
165
180
}
166
181
167
182
// show, play..
168
- if ( this . $store . state . fm . settings . imageExtensions
169
- . includes ( extension . toLowerCase ( ) ) ) {
183
+ if (
184
+ this . $store . state . fm . settings . imageExtensions . includes (
185
+ extension . toLowerCase ( )
186
+ )
187
+ ) {
170
188
// show image
171
- this . $store . commit ( ' fm/modal/setModalState' , {
172
- modalName : ' Preview' ,
189
+ this . $store . commit ( " fm/modal/setModalState" , {
190
+ modalName : " Preview" ,
173
191
show : true ,
174
192
} ) ;
175
- } else if ( Object . keys ( this . $store . state . fm . settings . textExtensions )
176
- . includes ( extension . toLowerCase ( ) ) ) {
193
+ } else if (
194
+ Object . keys ( this . $store . state . fm . settings . textExtensions ) . includes (
195
+ extension . toLowerCase ( )
196
+ )
197
+ ) {
177
198
// show text file
178
- this . $store . commit ( ' fm/modal/setModalState' , {
179
- modalName : ' TextEdit' ,
199
+ this . $store . commit ( " fm/modal/setModalState" , {
200
+ modalName : " TextEdit" ,
180
201
show : true ,
181
202
} ) ;
182
- } else if ( this . $store . state . fm . settings . audioExtensions
183
- . includes ( extension . toLowerCase ( ) ) ) {
203
+ } else if (
204
+ this . $store . state . fm . settings . audioExtensions . includes (
205
+ extension . toLowerCase ( )
206
+ )
207
+ ) {
184
208
// show player modal
185
- this . $store . commit ( ' fm/modal/setModalState' , {
186
- modalName : ' AudioPlayer' ,
209
+ this . $store . commit ( " fm/modal/setModalState" , {
210
+ modalName : " AudioPlayer" ,
187
211
show : true ,
188
212
} ) ;
189
- } else if ( this . $store . state . fm . settings . videoExtensions
190
- . includes ( extension . toLowerCase ( ) ) ) {
213
+ } else if (
214
+ this . $store . state . fm . settings . videoExtensions . includes (
215
+ extension . toLowerCase ( )
216
+ )
217
+ ) {
191
218
// show player modal
192
- this . $store . commit ( ' fm/modal/setModalState' , {
193
- modalName : ' VideoPlayer' ,
219
+ this . $store . commit ( " fm/modal/setModalState" , {
220
+ modalName : " VideoPlayer" ,
194
221
show : true ,
195
222
} ) ;
196
223
}
0 commit comments