All files / src/containers ContentDrag.ts

58.33% Statements 7/12
100% Branches 0/0
0% Functions 0/1
50% Lines 5/10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 511x 1x 1x       1x     1x                                                                                  
import { DragTypes } from '../Enums';
import { bindable, customElement } from 'aurelia-framework';
import { Content } from 'sn-client-js';
 
 
@customElement('content-drag')
export class ContentDrag{
 
    @bindable
    public Content: Content;
 
 
    dragStart(ev: DragEvent) {
        ev.stopPropagation();
        ev.dataTransfer.setData(DragTypes.Content, this.Content.Stringify());
        ev.dataTransfer.dropEffect = 'move';
        console.log('dragStart', this.Content.Path);
        return true;
    }
    
    // dragEnd(ev: DragEvent) {
    //     ev.preventDefault();
    //     ev.stopPropagation();
    //     console.log('dragEnd ???????????', this.Content.Path);
    // }
 
    // dragEnter(ev: DragEvent) {
    //     ev.preventDefault();
    //     ev.stopPropagation();
    // }
 
    // dragOver(ev: DragEvent) {
    //     ev.preventDefault();
    //     ev.stopPropagation();
       
    //     console.log('dragOver', this.Content.Path);
    //     return true;
    // }
 
    // dragDrop(ev: DragEvent) {
    //     ev.preventDefault();
    //     ev.stopPropagation();
    //     if (ev.dataTransfer.types.filter(d => d === DragTypes.Content) && this.Content.Path) {
    //         const droppedContent = this.Repository.ParseContent(ev.dataTransfer.getData(DragTypes.Content));
    //         if (this.Content.Path !== droppedContent.ParentPath && this.Content.Path !== droppedContent.Path && !droppedContent.IsAncestorOf(this.Content)){
    //             droppedContent.MoveTo(this.Content.Path);
    //         }
    //     }
    //     return true;
    // }
}