diff options
| author | Dhravya <[email protected]> | 2024-06-30 20:50:24 -0500 |
|---|---|---|
| committer | Dhravya <[email protected]> | 2024-06-30 20:50:24 -0500 |
| commit | ffd141ade4e6074ee486da7f74f31e3905807cb9 (patch) | |
| tree | 505d73b0a7c04cdec93d7f5be88c635642716c15 /apps/web/lib/loadSnap.ts | |
| parent | show updates in the extension (diff) | |
| parent | Merge pull request #93 from Dhravya/editor (diff) | |
| download | supermemory-ffd141ade4e6074ee486da7f74f31e3905807cb9.tar.xz supermemory-ffd141ade4e6074ee486da7f74f31e3905807cb9.zip | |
merge conflicts
Diffstat (limited to 'apps/web/lib/loadSnap.ts')
| -rw-r--r-- | apps/web/lib/loadSnap.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/web/lib/loadSnap.ts b/apps/web/lib/loadSnap.ts new file mode 100644 index 00000000..083603eb --- /dev/null +++ b/apps/web/lib/loadSnap.ts @@ -0,0 +1,14 @@ +import { createTLStore, defaultShapeUtils, loadSnapshot } from "tldraw"; +import { getCanvasData } from "../app/actions/fetchers"; +import { twitterCardUtil } from "../components/canvas/twitterCard"; +import { textCardUtil } from "../components/canvas/textCard"; + +export async function loadRemoteSnapshot(id: string) { + const snapshot = await getCanvasData(id); + + const newStore = createTLStore({ + shapeUtils: [...defaultShapeUtils, twitterCardUtil, textCardUtil], + }); + loadSnapshot(newStore, snapshot.snapshot); + return newStore; +} |