How to load data from JSON? #5330
Replies: 1 comment
-
Thanks for the feedback! The import { Job, Workspace } from '@blocksuite/store';
const workspace = new Workspace();
const job = new Job({ workspace });
const json = await job.pageToSnapshot(page);
const newPage = await job.snapshotToPage(json); You can also use the But snapshot leads to page-level importing and exporting. BlockSuite also supports provider-based incremental state update over WebSocket and IndexedDB. In this case, you can simply store the CRDT binary (somewhat like encoded protobuf). I plan to rewrite the https://github.com/toeverything/blocksuite/blob/master/packages/docs/data-persistence.md doc this week to clarify the data persistence matters. |
Beta Was this translation helpful? Give feedback.
-
You can get the JSON from, e.g.
$0.workspace.doc.toJSON()
. Let's say you then save that in a DB and want to load it later. What is the command to load that back into thedoc
? I can't see this in the docs anywhere.Beta Was this translation helpful? Give feedback.
All reactions