Add targetNode to canDrag rule
See original GitHub issueI have a BoxListContainer and BoxListItem
The BoxListContainer is set to only accept BoxListItems
BoxListContainer.craft.rules.canMoveIn = incomingNode => incomingNode.data.type === BoxListItem
Now I need to also set that BoxListItem can be dragged only into BoxListContainer. How do I do that?
canDrag(currentNode: Node, helpers: NodeHelpers) => boolean
canMoveIn(incomingNode: Node, currentNode: Node, helpers: NodeHelpers) => boolean
canMoveout(outgoingNode: Node, currentNode: Node, helpers: NodeHelpers) => boolean
I am missing targetNode
in canDrag
, the other two have both nodes available.
this:
canDrag(currentNode: Node, targetNode: Node, helpers: NodeHelpers) => boolean
BoxListItem.craft.rules.canMoveIn = (_currentNode, targetNode) => targetNode.data.type === BoxListContainer
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Node
rules Object. canDrag (currentNode: Node) => boolean. Specifies if the current Node can be ... canDrop (targetNode: Node, currentNode: Node) => boolean.
Read more >Drag & Drop from Datatree to Datatree | Infragistics Forums
i can drag a node, but i can only drop them to the second tree element, ... wan't a event that says "this...
Read more >How can I drag and drop a node in a treeview but that ... - MSDN
In this code I can drag and drop nodes and change the nodes places. ... Insert(draggedindex, targetNode); } // If it is a...
Read more >Editing the Objects in a Decision - SAS Help Center
On the Decision Flow tab, you can drag rule sets, branches, models, treatment groups, ... but you can move the target node of...
Read more >Working with Node Type Qualifiers - Cloud - Oracle Help Center
When comparing, locating, and adding or inserting nodes across node types (using ... If the target node type has a default qualifier defined,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It seems to me now that you’re interested in implementing a
canDrop
rule which is not related to thecanDrag
rule that you created this issue for. Hence, this whole misunderstanding is happening now.But anyways, with that brief example of yours, a
canDrop
rule might make sense. I would be glad to review a PR for this.If you were to import an external component and you want to use as a
<Canvas />
, you will have to create a wrapper for it anyway in order for you to specify configuration for it.p.s. Stop spamming the issues tracker. We can use Discord for more long-winded discussions such as this. It also doesn’t help that you occasionally post your questions/issues on both platforms.
Isn’t this use case supported by
canDrag
already ? For example, let’s say we want our component to only be able to move out depending on the parent it is in:Currently, Craft depends on both the component’s
canDrag
and the target parent’scanMoveOut
for the component to be successfully moved out, so I think this already does what you want, or am I missing something ?