svelte-drag-and-drop-actions icon indicating copy to clipboard operation
svelte-drag-and-drop-actions copied to clipboard

Droppable Passing a JSON structure

Open nfplay opened this issue 1 year ago • 0 comments

Hi, what's the current recommended way of passing a json structure in a droppable?

Is it through DataToOffer passing the structure in stringified format like this:

use:asDroppable={{
        Extras: "Text",
        relativeTo: "body",
        Operations: "copy",
        DataToOffer: {
          "application/json": '{"type": "custom", "name": "SQL Server"}'
        },
        onDropped,
      }}

And then use JSON.parse() on the "application/json" key once the droppable is dropped? Is there some better way to do this?

Thanks, Nuno

nfplay avatar Jan 18 '24 23:01 nfplay