Drag and drop from plugin window

I want to second Ben_Smith’s request about event listeners in the editor.

It’s great to have the drop event in the API now, but on OSX (or rather with webkit specifically), dragging and dropping is not a great experience.

I gather this is because dragend is really the only event we can trigger the drop, since we are outside the plugin iframe. On Windows and Linux, this does not seem to be a problem, because dragend is called immediately when you drop an item outside the iframe. This is not the case on OSX. There’s a delay before dragend is called, as well as the “cancel” animation which pulls back the dragged item to origin.

If we wanted to solve this for web, it requires two steps:

  1. preventDefault on dragover event
  2. Make sure drop event is called

But in a figma plugin it becomes very tricky. We can’t preventDefault on dragover in the canvas since we are limited on the event listeners. Heck, even if I had access to a mouseup event, I could make it work.

It would be great if there was something you could do to make the experience of DND better on OSX, or even just expand the event listeners available in the API.

2 Likes