tldraw icon indicating copy to clipboard operation
tldraw copied to clipboard

Add loading project from `.tldr` file and loading `.json` files.

Open FarazzShaikh opened this issue 4 years ago β€’ 4 comments

Depends on

  • #496

Closes

  • #491

If the user drags and drops a .tldr file into the editor. The Open Project flow is initiated.

Todo:

  • [x] Add JSON drag-and-drop

FarazzShaikh avatar Jan 11 '22 06:01 FarazzShaikh

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

tldraw – ./

πŸ” Inspect: https://vercel.com/tldraw/tldraw/BsJkMXTZrYVHLUtaYC1AvuhezT1y
βœ… Preview: https://tldraw-git-fork-farazzshaikh-feature-load-file-tldraw.vercel.app

core – ./

πŸ” Inspect: https://vercel.com/tldraw/core/BHgEAA56j3qp6cvryXggrhdbGTcX
βœ… Preview: https://core-git-fork-farazzshaikh-feature-load-file-tldraw.vercel.app

vercel[bot] avatar Jan 11 '22 06:01 vercel[bot]

@steveruizok We need to make it so that the asset table is not deleted from until some garbage clearing event. Currently, copyJson (which is also used in exportShapesAs) simply serializes the shape. Meaning it relies on there already being an asset table entry for the given shape's asset.

This means, we cannot seamlessly copy/export a shape as JSON from one project to another.

FarazzShaikh avatar Jan 11 '22 07:01 FarazzShaikh

That's a good point. The clipboard should include any relevant assets, right? Is that a blocker for this PR?

steveruizok avatar Jan 12 '22 13:01 steveruizok

Yes, and nope it’s not a blocker, however it will break if you do the following:

  • copy image
  • Delete that image
  • Paste

So I think we should Hold off on this till we have the fix in place

it affects this PR as draggin in JSON will often result in broken asset shapes

FarazzShaikh avatar Jan 12 '22 13:01 FarazzShaikh