Skip to content

Commit

Permalink
Add option dnd5.preventLazyParents
Browse files Browse the repository at this point in the history
Close #988
  • Loading branch information
mar10 committed Jan 25, 2020
1 parent d97d487 commit 8e4f1c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* [Changed] The `enableAspx` option will default to 'false' in the future.
For now, a warning is emitted, to explicitly set it or use the `postProcess`
event instead.
* [Added] #988 New option `dnd5.preventLazyParents` prevents dropping items on
unloaded lazy nodes (defaults to true)
* [Fixed] #983 lazyLoad with promise not calling postProcess
* [Fixed] #984 ext-edit: Exception when cancelling addSibling or addChildren

Expand Down
5 changes: 5 additions & 0 deletions src/jquery.fancytree.dnd5.js
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,10 @@
node.debug("Reject dropping below own ancestor.");
DRAG_ENTER_RESPONSE = false;
break;
} else if (dndOpts.preventLazyParents && !node.isLoaded()) {
node.warn("Drop over unloaded target node prevented.");
DRAG_ENTER_RESPONSE = false;
break;
}
$dropMarker.show();

Expand Down Expand Up @@ -1025,6 +1029,7 @@
// dropEffect: "auto", // 'copy'|'link'|'move'|'auto'(calculate from `effectAllowed`+modifier keys) or callback(node, data) that returns such string.
dropEffectDefault: "move", // Default dropEffect ('copy', 'link', or 'move') when no modifier is pressed (overide in dragDrag, dragOver).
preventForeignNodes: false, // Prevent dropping nodes from different Fancytrees
preventLazyParents: true, // Prevent dropping items on unloaded lazy Fancytree nodes
preventNonNodes: false, // Prevent dropping items other than Fancytree nodes
preventRecursion: true, // Prevent dropping nodes on own descendants
preventSameParent: false, // Prevent dropping nodes under same direct parent
Expand Down

1 comment on commit 8e4f1c4

@Roinoss
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#988 - Maybe: preventLazyParents: true, // options: false, 'callLazyLoadBeforeDropping'

Please sign in to comment.