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

Add class on current dragging item

Open maicolbruski opened this issue 1 year ago • 5 comments

Hi

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

image

fro change this:

image

Tks.

maicolbruski avatar May 15 '24 19:05 maicolbruski

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

phphe avatar May 16 '24 00:05 phphe

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.

maicolbruski avatar May 16 '24 22:05 maicolbruski

ondragstart: (event) => event.target

phphe avatar May 17 '24 01:05 phphe

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

console.log(event.target)

image

maicolbruski avatar May 17 '24 03:05 maicolbruski

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

phphe avatar May 20 '24 00:05 phphe