@@ -68,44 +68,58 @@ const view = (fileIcon, themeIcon, droppable) => (state, actions) =>
68
68
} else {
69
69
onDropAction ( actions ) ( ev , data , files ) ;
70
70
}
71
- }
71
+
72
+ actions . setGhost ( false ) ;
73
+ } ,
74
+
75
+ ondragleave : ( ) => actions . setGhost ( false ) ,
76
+ ondragenter : ( ) => actions . setGhost ( true ) ,
77
+ ondragover : ev => actions . setGhost ( ev )
72
78
} ) ;
73
79
}
74
- } , state . entries . map ( ( entry , index ) => {
75
- return h ( 'div' , {
76
- class : 'osjs-desktop-iconview__entry' + (
77
- state . selected === index
78
- ? ' osjs-desktop-iconview__entry--selected'
79
- : ''
80
- ) ,
81
- oncontextmenu : ev => actions . openContextMenu ( { ev, entry, index} ) ,
82
- ontouchstart : ev => tapper ( ev , ( ) => actions . openEntry ( { ev, entry, index} ) ) ,
83
- ondblclick : ev => actions . openEntry ( { ev, entry, index} ) ,
84
- onclick : ev => actions . selectEntry ( { ev, entry, index} )
85
- } , [
86
- h ( 'div' , {
87
- class : 'osjs-desktop-iconview__entry__inner'
80
+ } , [
81
+ ...state . entries . map ( ( entry , index ) => {
82
+ return h ( 'div' , {
83
+ class : 'osjs-desktop-iconview__entry' + (
84
+ state . selected === index
85
+ ? ' osjs-desktop-iconview__entry--selected'
86
+ : ''
87
+ ) ,
88
+ oncontextmenu : ev => actions . openContextMenu ( { ev, entry, index} ) ,
89
+ ontouchstart : ev => tapper ( ev , ( ) => actions . openEntry ( { ev, entry, index} ) ) ,
90
+ ondblclick : ev => actions . openEntry ( { ev, entry, index} ) ,
91
+ onclick : ev => actions . selectEntry ( { ev, entry, index} )
88
92
} , [
89
93
h ( 'div' , {
90
- class : 'osjs-desktop-iconview__entry__icon '
94
+ class : 'osjs-desktop-iconview__entry__inner '
91
95
} , [
92
- h ( 'img' , {
93
- src : entry . icon ? entry . icon : themeIcon ( fileIcon ( entry ) . name ) ,
94
- class : 'osjs-desktop-iconview__entry__icon__icon'
95
- } ) ,
96
- entry . shortcut !== false
97
- ? h ( 'img' , {
98
- src : themeIcon ( 'emblem-symbolic-link' ) ,
99
- class : 'osjs-desktop-iconview__entry__icon__shortcut'
100
- } )
101
- : null
102
- ] ) ,
103
- h ( 'div' , {
104
- class : 'osjs-desktop-iconview__entry__label'
105
- } , entry . filename )
106
- ] )
107
- ] ) ;
108
- } ) ) ;
96
+ h ( 'div' , {
97
+ class : 'osjs-desktop-iconview__entry__icon'
98
+ } , [
99
+ h ( 'img' , {
100
+ src : entry . icon ? entry . icon : themeIcon ( fileIcon ( entry ) . name ) ,
101
+ class : 'osjs-desktop-iconview__entry__icon__icon'
102
+ } ) ,
103
+ entry . shortcut !== false
104
+ ? h ( 'img' , {
105
+ src : themeIcon ( 'emblem-symbolic-link' ) ,
106
+ class : 'osjs-desktop-iconview__entry__icon__shortcut'
107
+ } )
108
+ : null
109
+ ] ) ,
110
+ h ( 'div' , {
111
+ class : 'osjs-desktop-iconview__entry__label'
112
+ } , entry . filename )
113
+ ] )
114
+ ] ) ;
115
+ } ) ,
116
+ h ( 'div' , {
117
+ class : 'osjs-desktop-iconview__entry osjs-desktop-iconview__entry--ghost' ,
118
+ style : {
119
+ display : state . ghost ? undefined : 'none'
120
+ }
121
+ } )
122
+ ] ) ;
109
123
110
124
const createShortcuts = ( root , readfile , writefile ) => {
111
125
const read = ( ) => {
@@ -195,32 +209,35 @@ export class DesktopIconView extends EventEmitter {
195
209
this . $root . style . right = `${ rect . right } px` ;
196
210
}
197
211
198
- _render ( root ) {
212
+ _render ( settings ) {
199
213
const oldRoot = this . root ;
200
- if ( root ) {
201
- this . root = root ;
214
+ if ( settings . path ) {
215
+ this . root = settings . path ;
202
216
}
203
217
204
218
if ( this . $root ) {
205
219
if ( this . root !== oldRoot ) {
206
220
this . iconview . reload ( ) ;
207
221
}
208
222
223
+ this . iconview . toggleGrid ( settings . grid ) ;
224
+
209
225
return false ;
210
226
}
211
227
212
228
return true ;
213
229
}
214
230
215
- render ( root ) {
216
- if ( ! this . _render ( root ) ) {
231
+ render ( settings ) {
232
+ if ( ! this . _render ( settings ) ) {
217
233
return ;
218
234
}
219
235
220
236
this . $root = document . createElement ( 'div' ) ;
221
237
this . $root . className = 'osjs-desktop-iconview' ;
222
238
this . core . $root . appendChild ( this . $root ) ;
223
239
240
+ const root = settings . path ;
224
241
const { droppable} = this . core . make ( 'osjs/dnd' ) ;
225
242
const { icon : fileIcon } = this . core . make ( 'osjs/fs' ) ;
226
243
const { icon : themeIcon } = this . core . make ( 'osjs/theme' ) ;
@@ -231,7 +248,8 @@ export class DesktopIconView extends EventEmitter {
231
248
232
249
this . iconview = app ( {
233
250
selected : - 1 ,
234
- entries : [ ]
251
+ entries : [ ] ,
252
+ ghost : false
235
253
} , {
236
254
setEntries : entries => ( { entries} ) ,
237
255
@@ -311,8 +329,11 @@ export class DesktopIconView extends EventEmitter {
311
329
read ( )
312
330
. then ( entries => entries . filter ( e => e . filename !== '..' ) )
313
331
. then ( entries => actions . setEntries ( entries ) ) ;
314
- }
332
+ } ,
315
333
334
+ setGhost : ev => {
335
+ return { ghost : ev } ;
336
+ }
316
337
} , view ( fileIcon , themeIcon , droppable ) , this . $root ) ;
317
338
318
339
this . iconview . reload ( ) ;
0 commit comments