Back to Affine

Affine Blocksuite format YDoc reader

packages/common/reader/README.md

0.26.6425 B
Original Source

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);