-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
added: new variable to be able to disable the default behavior of wrapping draggable elements #27
added: new variable to be able to disable the default behavior of wrapping draggable elements #27
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're going in the right direction.
Maybe adding some console.warn
with information that elements should be wrapped manually by a developer could be useful, what do you think?
elements.forEach(function (draggableElement) { | ||
var wrapper = createElementWrapper(), | ||
draggableParent = draggableElement.parentNode; | ||
if (finalParams.wrapDraggableElements === TRUE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do it a different way.
wrapDraggableElements = function (elements) {
if (finalParams.wrapDraggableElements === FALSE) {
return FALSE;
}
elements.forEach(function (draggableElement) {
var wrapper = createElementWrapper(),
draggableParent = draggableElement.parentNode;
if (draggableParent.classList.contains(CLASS_DRAGGABLE)) {
return FALSE;
}
draggableParent.insertBefore(wrapper, draggableElement);
draggableParent.removeChild(draggableElement);
wrapper.appendChild(draggableElement);
});
};
It avoids the indentation of huge block of code.
Made the requested changes. |
@@ -201,6 +202,17 @@ | |||
* @return {Array} | |||
*/ | |||
wrapDraggableElements = function (elements) { | |||
if (finalParams.wrapDraggableElements === TRUE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finalParams.wrapDraggableElements === FALSE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OMG .. my bad .. sry
Fixed |
@Webtrix can you squash the commits into the one named: |
…pping draggable elements added: new variable to be able to disable the default behavior of wrapping draggable elements added: new variable to be able to disable the default behavior of wrapping draggable elements added: new variable to be able to disable the default behavior of wrapping draggable elements updated: made requested changes to PR fixed: typo TRUE --> FALSE typo: draggster --> dragster
Took me some searching but this OK? |
Being able to disable this default behavior might come useful for some people (myself included). I'm using your script in an Angular 2 project, and I need to disable this feature to get everything working correctly.
So would be cool if we could add this feature if possible.