mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
26 lines
426 B
Markdown
26 lines
426 B
Markdown
# 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);
|
|
```
|