Remove text when dragged from the palette to the canvas。

This is an element of my palette.

When I drag it into a canvas, I need to get rid of the description. What should I do.

Couldn’t you use a Palette.nodeTemplate that is different than your Diagram.nodeTemplate?
For example: https://gojs.net/latest/intro/palette.html

Couldn’t you use a Palette.nodeTemplate that is different than your Diagram.nodeTemplate?
For example: https://gojs.net/latest/intro/palette.html

What if I want to remove the text when I start dragging an element ?
Let’s take this as exemple. We have already two templates one for the palette and one for the diagram.
What if I want to use a third template dedicated for the dragging preview ?

Like only removing the text “cyan” :
image
Or even to change completly the template to something else.

What’s the best practice to achieve this ?

A potential solution for this is to use “isDragging” and bind it with visible then change “isDragging” when the drag event starts but I’m not sure if this is the best practice. (Also this does not cover the third template question)

Did you want the TextBlock to disappear when a node is being copied within the diagram, rather than only when being dragged from a different diagram?

If so, try adding this to your TextBlock:

new go.Binding("visible", "layerName", n => n === "Tool").ofObject()