mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 06:18:45 +08:00
@@ -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);
|
||||
```
|
||||
Reference in New Issue
Block a user