Skip to content

Idea: Possibility to access initialSibling from outside the dragula function. #698

@NoCredits

Description

@NoCredits

Hi contributers,

canceling the dropping from within my code doesnt work because my code is waiting for a promise to resolve or reject.

So I added:

item['initialSibling']=_initialSibling to the drop method. Now I can insert the element at it origin:

const promise = new Promise ((resolve, reject) => {
doTheDrop (el, target, source, sibling, workflow);
});
promise.then( (data) => {
//great drop is ok
}, (reason) => {
// Rejected!
source.insertBefore ( el, el.initialSibling == undefined ? null : el.initialSibling );
});

However, I would rather not change dragula.js. Is it possible to access this property some other way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions