toeverything / blocksuite

🧩 Content editing tech stack for the web - BlockSuite is a toolkit for building editors and collaborative applications.
https://blocksuite.io
Mozilla Public License 2.0
4.09k stars 353 forks source link

Can I use the fromDocSnapshot method in the backend? #6924

Closed matheusriios closed 2 months ago

matheusriios commented 2 months ago

Hello, I hope you're all doing well.

I'm using Affine and need to export the database data to another internal project.

However, the data stored in Affine consists of the blocks generated by the blocksuit through its editor.

So, to fully decode the data, I need to use some resources from the blocksuit.

Thanks to everyone for the time spent responding to me

doodlewind commented 2 months ago

Yes, the raw data store in AFFiNE is the CRDT binary (yjs Y.Docs) to keep it collaboration-ready. To get the JSON format from the ydoc, you can import @blocksuite/store in node, which should be node compatible without DOM dependencies.

matheusriios commented 2 months ago

@doodlewind Could you please share with me an example of how to transform data into binary for BlockSuit and then convert it to Markdown?

The examples we have in the BlockSuit docs are not very clear to me.

Thank you if you can help