superdesk/superdesk-client-core

View on GitHub
scripts/apps/archive/directives/DraggableItem.ts

Summary

Maintainability
A
0 mins
Test Coverage
import {dragStart} from 'utils/dragging';

export function DraggableItem() {
    return {
        link: function(scope, elem) {
            if (scope.item) {
                elem.attr('draggable', true);

                // set item data on event
                elem.on('dragstart', (event) => {
                    dragStart(event, scope.item);
                });

                scope.$on('$destroy', () => {
                    elem.off('dragstart');
                });
            }
        },
    };
}