phphe/he-tree

Add class on current dragging item

Closed this issue · 5 comments

Hi

It's possible to add class on current dragging item (the ghost item)?

image

fro change this:

image

Tks.

phphe commented

no, it is a image. use HTML Drag and Drop API's setDragImage method to custom drag image in ondragstart, check: https://hetree.phphe.com/v2/api#ondragstart

Hello, understood, one more question: Can I get the content of current element, for populate the div.innerText with name that element contains

In this case of image: React
...
div.innerText = 'React'

Tks.

phphe commented

ondragstart: (event) => event.target

I already try this, but event.target return the tree, and not de current element only.

console.log(event.target)

image
phphe commented

try add different class to each node, and get drag element by the class