Creating a new rectangle element in the panel


i am trying to create a new rectangle element in the plugin panel, and setting the fill of it, add pluginData, and then having the ability to drag and drop it to the artboard.

i tried using this and appendChild


however, i am not sure how to change the pluginData of it.

i am succeeding to drag and drop an image to the artboard, however i don’t know how to add to it the pluginData. (i tried changing the element with editDocument when “dragend” action is happening but it doesn’t work.)

is there a simple way to add an element to the panel and add to it pluginData before i am dragging it to the artboard?

Hmm – I think I see what you’re getting at, and at the moment, there’s no mechanism for this yet.

We’re working on adding support for what we call “delayed drop” – meant for cases where you might need to download additional data (e.g., dragging a thumbnail, but then downloading the full image on drop). I think this would also serve your use case since you’d get a callback when the drop happened and would be able to finish additional work – or create new elements on the canvas.

Work on this has just started, though, so it’s going to be next year before this will be available to developers.