@ -17,13 +17,7 @@ export default class Droppable {
const els = Array . isArray ( el ) ? el : [ el ] ;
const els = Array . isArray ( el ) ? el : [ el ] ;
this . el = el ;
this . el = el ;
this . counter = 0 ;
this . counter = 0 ;
bindAll (
bindAll ( this , 'handleDragEnter' , 'handleDragOver' , 'handleDrop' , 'handleDragLeave' ) ;
this ,
'handleDragEnter' ,
'handleDragOver' ,
'handleDrop' ,
'handleDragLeave'
) ;
els . forEach ( el => this . toggleEffects ( el , 1 ) ) ;
els . forEach ( el => this . toggleEffects ( el , 1 ) ) ;
return this ;
return this ;
@ -52,7 +46,7 @@ export default class Droppable {
} ,
} ,
customTarget ( { event } ) {
customTarget ( { event } ) {
return doc . elementFromPoint ( event . clientX , event . clientY ) ;
return doc . elementFromPoint ( event . clientX , event . clientY ) ;
}
} ,
}
}
: null ;
: null ;
method ( frameEl , 'pointerenter' , this . handleDragEnter ) ;
method ( frameEl , 'pointerenter' , this . handleDragEnter ) ;
@ -60,7 +54,7 @@ export default class Droppable {
method ( document , 'pointerup' , this . handleDrop ) ;
method ( document , 'pointerup' , this . handleDrop ) ;
method ( frameEl , 'pointerout' , this . handleDragLeave ) ;
method ( frameEl , 'pointerout' , this . handleDragLeave ) ;
// Test with touche devices (seems like frameEl is not capturing pointer events).
// Test with touch devices (seems like frameEl is not capturing pointer events).
// on/off(document, 'pointermove', sorter.onMove); // for the sorter
// on/off(document, 'pointermove', sorter.onMove); // for the sorter
// enable && this.handleDragEnter({}); // no way to use pointerenter/pointerout
// enable && this.handleDragEnter({}); // no way to use pointerenter/pointerout
}
}
@ -123,7 +117,7 @@ export default class Droppable {
}
}
this . handleDragEnd ( comp , dt ) ;
this . handleDragEnd ( comp , dt ) ;
target . remove ( ) ;
target . remove ( ) ;
}
} ,
} ) ;
} ) ;
dragStop = cancel => dragger . stop ( ev , { cancel } ) ;
dragStop = cancel => dragger . stop ( ev , { cancel } ) ;
dragContent = cnt => ( content = cnt ) ;
dragContent = cnt => ( content = cnt ) ;
@ -141,7 +135,7 @@ export default class Droppable {
pfx : 'gjs-' ,
pfx : 'gjs-' ,
onEndMove : model => this . handleDragEnd ( model , dt ) ,
onEndMove : model => this . handleDragEnd ( model , dt ) ,
document : this . el . ownerDocument ,
document : this . el . ownerDocument ,
... ( this . sortOpts || { } )
... ( this . sortOpts || { } ) ,
} ) ;
} ) ;
sorter . setDropContent ( content ) ;
sorter . setDropContent ( content ) ;
sorter . startSort ( ) ;
sorter . startSort ( ) ;
@ -208,7 +202,7 @@ export default class Droppable {
content . push ( {
content . push ( {
type ,
type ,
file ,
file ,
attributes : { alt : file . name }
attributes : { alt : file . name } ,
} ) ;
} ) ;
}
}
}
}
@ -220,7 +214,7 @@ export default class Droppable {
content = {
content = {
type : 'link' ,
type : 'link' ,
attributes : { href : content } ,
attributes : { href : content } ,
content : content
content : content ,
} ;
} ;
} else if ( indexOf ( types , 'text/json' ) >= 0 ) {
} else if ( indexOf ( types , 'text/json' ) >= 0 ) {
const json = dt && dt . getData ( 'text/json' ) ;
const json = dt && dt . getData ( 'text/json' ) ;