feat(common): add blocksuite reader lib (#11955)

close CLOUD-202
This commit is contained in:
fengmk2
2025-05-14 14:52:41 +00:00
parent a1bcf77447
commit 6792c3e656
18 changed files with 2877 additions and 844 deletions
+25
View File
@@ -0,0 +1,25 @@
# Affine Blocksuite format YDoc reader
## Usage
### read rootYDoc
```ts
import { readAllDocsFromRootDoc } from '@affine/reader';
const docs = readAllDocsFromRootDoc(rootDoc);
console.log(Array.from(docsWithTrash.entries()));
// [
// 'doc-id-1', { title: 'test doc title' },
// // ...
// ]
```
### read YDoc
```ts
import { readAllBlocksFromDoc } from '@affine/reader';
const blocks = readAllBlocksFromDoc(doc);
```