When Drag and Drop is done from dialog in Mac ,Adobe XD Crashes?

function DragEvent(event,DragElement){ 
     event.dataTransfer.setData("text/uri-list", DragElement);  //This line crashes Adobe XD
     setTimeout(() => {document.getElementById("dialogbox").close()}, 500); 
}

This is the above code which i used for drag and drop from Dialog. It works fine in windows but crashes in Mac .My ultimate aim is to use SVG image for designing from Dialog. Kindly fix this issue or give any Suggestions to use SVG from Dialog .

What is DragElement?

text/uri-list expects that the data will be a string, with one or more lines being a URI (can be a file reference or a base64 encoded string). If this isn’t the case, a crash is quite likely.

Drag Element is the path of the file in the string format. I don’t think so drag element creates the problem because, I done this same drag and drop in panel. Its working but it crashes only in dialog on mac. I checked with my Windows its pretty good in both dialog and panel.

Is there a reason you’re dragging from a dialog and not a panel? Drag-and-drop was build with panels in mind, not dialogs (since the underlying canvas is now blocked).

Yeah I can understand drag and drop looks complex in dialog , that’s why I use timeout to close dialog and place image. If not drag and drop how to use the Svg from dialog to the artboard. I searched for several options Clipboard ( only text can be copied ), By grouping the Svg and placing to the artboard ( the same drag and drop logic will apply here but I don’t know how to group a Svg.) These are the methods I referred, clipboard doesn’t work and I don’t know to proceed with grouping of Svg. So I went for drag and drop. Can you help me in how to group the Svg so I can proceed with. (Eg: when I click the image it should be in Artboard)

I’m being dense here – is there a reason why your plugin has to work from a dialog and not a panel?

First of all I thank you for reply. Expecially when I ask this question none reply. And the reason is to view image in enlarged size, whereas in panel the size of the image will be small.

No one answer my question in this forum :man_shrugging:, thank you so much. This how you help developers by this forum

Your user can expand your panel as much as s/he wants to show a larger image. It’s always going to be a trade-off between showing a larger image and showing enough of the current document to do the drag’n’drop.

Thank you for your reply @cpryland, I have implemented it in panel. But I also want the same thing to happen in dialog, that’s why I was checking in forum . When referring other plugins I saw that they have implemented everything in dialog. Instead of drag and drop they have used clipboard to copy and paste the item then when double tapped on the image it automatically transferred to artboard. I don’t know how they do that, if you know can I get some idea, how it can be done