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.4k stars 407 forks source link

Regarding the issue of data storage. #7525

Open nickGaooooooooooo opened 3 months ago

nickGaooooooooooo commented 3 months ago

I encountered some issues when storing document data in my Vue project after integrating BlockSuite. How should I store the editor content in my database so that I can retrieve and re-render it at any time? I couldn't find this part in the documentation and hope to get an official response. 我在我的vue项目中引入了blocksuite,在我存储文档数据的时候遇到了一些问题,我应该如何存储编辑器内容到我的数据库中,以便于我能随时拿出来并重新渲染。这部分我没有在文档中找到,希望得到官方的回答。

higuaifan commented 2 months ago

maybe you can see this #7298

ununian commented 2 months ago

本质上就是询问如何储存 page 的 Y.Doc,block suite 为了实现 affine local-first 的,整体数据储存做得非常复杂。 如果你不需要 local-first,只是想要一个富文本编辑器,那我推荐你使用 https://tiptap.dev/docs/hocuspocus/introduction 来自己实现协同服务器。 针对图片和文件的上传也没必要使用本地 blob 那套,直接上传到服务器就行,文档里面只储存 url。 下面是我为 hocuspocus 写的 provider,不过我现在用的是比较早版本的 block suite 且对 workspace 改动也很大,意会一下就好

@nickGaooooooooooo 可以看这里 https://juejin.cn/post/7401071898031767578

我写一遍文章来介绍如何使用 hocuspocus 来为 block suite 增加远程协同的能力。 https://juejin.cn/post/7401071898031767578