Skip to content

BlockSuite API Documentation / @blocksuite/store / BlockCollection

Class: BlockCollection

Extends

Constructors

new BlockCollection()

new BlockCollection(__namedParameters): BlockCollection

Parameters

__namedParameters: DocOptions

Returns

BlockCollection

Overrides

Space.constructor

Source

packages/framework/store/src/store/doc/block-collection.ts:93

Properties

_collection

private readonly _collection: DocCollection

Source

packages/framework/store/src/store/doc/block-collection.ts:39


_docCRUD

private readonly _docCRUD: DocCRUD

Source

packages/framework/store/src/store/doc/block-collection.ts:41


_docMap

private _docMap: Map<BlockSelector, Doc>

Source

packages/framework/store/src/store/doc/block-collection.ts:46


_history

private _history: UndoManager

Source

packages/framework/store/src/store/doc/block-collection.ts:42


_idGenerator

private readonly _idGenerator: IdGenerator

Source

packages/framework/store/src/store/doc/block-collection.ts:40


_ready

private _ready: boolean = false

Indicate whether the block tree is ready

Source

packages/framework/store/src/store/doc/block-collection.ts:44


_shouldTransact

private _shouldTransact: boolean = true

Source

packages/framework/store/src/store/doc/block-collection.ts:45


_yBlocks

protected readonly _yBlocks: Map<YBlock>

Inherited from

Space._yBlocks

Source

packages/framework/store/src/store/space.ts:28


_ySpaceDoc

Internal

protected readonly _ySpaceDoc: Doc

Used for convenient access to the underlying Yjs map, can be used interchangeably with ySpace

Inherited from

Space._ySpaceDoc

Source

packages/framework/store/src/store/space.ts:27


awarenessStore

readonly awarenessStore: AwarenessStore<BlockSuiteFlags>

Inherited from

Space.awarenessStore

Source

packages/framework/store/src/store/space.ts:17


id

readonly id: string

Inherited from

Space.id

Source

packages/framework/store/src/store/space.ts:15


rootDoc

readonly rootDoc: BlockSuiteDoc

Inherited from

Space.rootDoc

Source

packages/framework/store/src/store/space.ts:16


slots

readonly slots: object

blockUpdated

blockUpdated: Slot<object | object | object>

historyUpdated

historyUpdated: Slot<void>

ready

ready: Slot<void>

This is always triggered after doc.load is called.

rootAdded

rootAdded: Slot<string>

This fires when the root block is added via API call or has just been initialized from existing ydoc. useful for internal block UI components to start subscribing following up events. Note that at this moment, the whole block tree may not be fully initialized yet.

rootDeleted

rootDeleted: Slot<string>

yBlockUpdated

yBlockUpdated: Slot<object | object>

Source

packages/framework/store/src/store/doc/block-collection.ts:48

Accessors

Text

get Text(): typeof Text

Returns

typeof Text

Source

packages/framework/store/src/store/doc/block-collection.ts:174


blob

get blob(): BlobManager

Returns

BlobManager

Source

packages/framework/store/src/store/doc/block-collection.ts:152


canRedo

get canRedo(): boolean

Returns

boolean

Source

packages/framework/store/src/store/doc/block-collection.ts:167


canUndo

get canUndo(): boolean

Returns

boolean

Source

packages/framework/store/src/store/doc/block-collection.ts:160


collection

get collection(): DocCollection

Returns

DocCollection

Source

packages/framework/store/src/store/doc/block-collection.ts:140


crud

get crud(): DocCRUD

Returns

DocCRUD

Source

packages/framework/store/src/store/doc/block-collection.ts:136


history

get history(): UndoManager

Returns

UndoManager

Source

packages/framework/store/src/store/doc/block-collection.ts:132


isEmpty

get isEmpty(): boolean

Returns

boolean

Source

packages/framework/store/src/store/doc/block-collection.ts:156


loaded

get loaded(): boolean

Returns

boolean

Source

packages/framework/store/src/store/space.ts:48


meta

get meta(): undefined | DocMeta

Returns

undefined | DocMeta

Source

packages/framework/store/src/store/doc/block-collection.ts:148


readonly

get readonly(): boolean

Returns

boolean

Source

packages/framework/store/src/store/doc/block-collection.ts:124


ready

get ready(): boolean

Returns

boolean

Source

packages/framework/store/src/store/doc/block-collection.ts:128


schema

get schema(): Schema

Returns

Schema

Source

packages/framework/store/src/store/doc/block-collection.ts:144


spaceDoc

get spaceDoc(): Doc

Returns

Doc

Source

packages/framework/store/src/store/space.ts:52


yBlocks

get yBlocks(): Map<State[keyof State]>

Returns

Map<State[keyof State]>

Source

packages/framework/store/src/store/space.ts:44

Methods

_handleVersion()

private _handleVersion(): void

Returns

void

Source

packages/framework/store/src/store/doc/block-collection.ts:311


_handleYBlockAdd()

private _handleYBlockAdd(id): void

Parameters

id: string

Returns

void

Source

packages/framework/store/src/store/doc/block-collection.ts:274


_handleYBlockDelete()

private _handleYBlockDelete(id): void

Parameters

id: string

Returns

void

Source

packages/framework/store/src/store/doc/block-collection.ts:278


_handleYEvent()

private _handleYEvent(event): void

Parameters

event: YEvent<Text | Array<unknown> | YBlock>

Returns

void

Source

packages/framework/store/src/store/doc/block-collection.ts:282


_handleYEvents()

private _handleYEvents(events): void

Parameters

events: YEvent<Text | YBlock>[]

Returns

void

Source

packages/framework/store/src/store/doc/block-collection.ts:307


_historyObserver()

private _historyObserver(): void

Returns

void

Source

packages/framework/store/src/store/doc/block-collection.ts:270


_initYBlocks()

private _initYBlocks(): void

Returns

void

Source

packages/framework/store/src/store/doc/block-collection.ts:257


captureSync()

captureSync(): void

Capture current operations to undo stack synchronously.

Returns

void

Source

packages/framework/store/src/store/doc/block-collection.ts:208


clear()

clear(): void

Returns

void

Inherited from

Space.clear

Source

packages/framework/store/src/store/space.ts:73


clearSelector()

clearSelector(selector): void

Parameters

selector: BlockSelector

Returns

void

Source

packages/framework/store/src/store/doc/block-collection.ts:120


destroy()

destroy(): void

Returns

void

Inherited from

Space.destroy

Source

packages/framework/store/src/store/space.ts:67


dispose()

dispose(): void

Returns

void

Source

packages/framework/store/src/store/doc/block-collection.ts:245


generateBlockId()

generateBlockId(): string

Returns

string

Source

packages/framework/store/src/store/doc/block-collection.ts:216


getDoc()

getDoc(selector): Doc

Parameters

selector: BlockSelector= defaultBlockSelector

Returns

Doc

Source

packages/framework/store/src/store/doc/block-collection.ts:106


load()

load(initFn?): this

Parameters

initFn?

Returns

this

Overrides

Space.load

Source

packages/framework/store/src/store/doc/block-collection.ts:220


redo()

redo(): void

Returns

void

Source

packages/framework/store/src/store/doc/block-collection.ts:199


remove()

remove(): void

Returns

void

Inherited from

Space.remove

Source

packages/framework/store/src/store/space.ts:62


resetHistory()

resetHistory(): void

Returns

void

Source

packages/framework/store/src/store/doc/block-collection.ts:212


transact()

transact(fn, shouldTransact): void

If shouldTransact is false, the transaction will not be push to the history stack.

Parameters

fn

shouldTransact: boolean= undefined

Returns

void

Overrides

Space.transact

Source

packages/framework/store/src/store/doc/block-collection.ts:184


undo()

undo(): void

Returns

void

Source

packages/framework/store/src/store/doc/block-collection.ts:191


withoutTransact()

withoutTransact(callback): void

Parameters

callback

Returns

void

Source

packages/framework/store/src/store/doc/block-collection.ts:178