Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
NoCredits opened this issue Aug 2, 2022 · 0 comments

Comments

@NoCredits
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant