liquor-tree icon indicating copy to clipboard operation
liquor-tree copied to clipboard

Drag&Drop only for changing the parent node

Open ruxoft opened this issue 5 years ago • 2 comments

Hallo, is it possible to use drag&drop only to change the parent node? Not for reordering in the same parent node or in other parent node? As a result, the blue line below the node would not be displayed, but only the rectangle around the new parent node. Thank you.

ruxoft avatar Jan 14 '19 10:01 ruxoft

Hi. Yes, it is possible. Use onDragOn and onDragFinish properties for that. I'm not able to check now but hope it works :) Try this code:

 {
  dnd: {
    onDragOn(targetNode, destinationNode) {
      return destinationNode.children.length > 0
    }
  }
 }

amsik avatar Jan 14 '19 14:01 amsik

Thank you, it can help, but what I need in other words: There are three types of drop: ABOVE, BELOW and ON. I need to disable above and below and keep only ON type. I tried rewrite css styles:

.drag-above > .tree-content::before, .drag-below > .tree-content::after { content: none!important; }

and handle events onDragOn and onDragFinish, but wihout success in this time. The new parametr "destination" of these events would help.

ruxoft avatar Jan 28 '19 08:01 ruxoft