BlockSuite API Documentation / @blocksuite/store / BlockCollection
Class: BlockCollection
Extends
Space<FlatBlockMap>
Constructors
new BlockCollection(__namedParameters)
new BlockCollection(
__namedParameters):BlockCollection
Parameters
• __namedParameters: DocOptions
Returns
Overrides
Source
packages/framework/store/src/store/doc/block-collection.ts:92
Properties
_collection
privatereadonly_collection:DocCollection
Source
packages/framework/store/src/store/doc/block-collection.ts:39
_docCRUD
privatereadonly_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
privatereadonly_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
Inherited from
Source
packages/framework/store/src/store/space.ts:28
_ySpaceDoc
Internal
protectedreadonly_ySpaceDoc:Doc
Used for convenient access to the underlying Yjs map, can be used interchangeably with ySpace
Inherited from
Source
packages/framework/store/src/store/space.ts:27
awarenessStore
readonlyawarenessStore:AwarenessStore<BlockSuiteFlags>
Inherited from
Source
packages/framework/store/src/store/space.ts:17
id
readonlyid:string
Inherited from
Source
packages/framework/store/src/store/space.ts:15
rootDoc
readonlyrootDoc:BlockSuiteDoc
Inherited from
Source
packages/framework/store/src/store/space.ts:16
slots
readonlyslots: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
getText(): typeofText
Returns
typeof Text
Source
packages/framework/store/src/store/doc/block-collection.ts:173
blob
getblob():BlobManager
Returns
Source
packages/framework/store/src/store/doc/block-collection.ts:151
canRedo
getcanRedo():boolean
Returns
boolean
Source
packages/framework/store/src/store/doc/block-collection.ts:166
canUndo
getcanUndo():boolean
Returns
boolean
Source
packages/framework/store/src/store/doc/block-collection.ts:159
collection
getcollection():DocCollection
Returns
Source
packages/framework/store/src/store/doc/block-collection.ts:139
crud
getcrud():DocCRUD
Returns
DocCRUD
Source
packages/framework/store/src/store/doc/block-collection.ts:135
history
gethistory():UndoManager
Returns
Source
packages/framework/store/src/store/doc/block-collection.ts:131
isEmpty
getisEmpty():boolean
Returns
boolean
Source
packages/framework/store/src/store/doc/block-collection.ts:155
loaded
getloaded():boolean
Returns
boolean
Source
packages/framework/store/src/store/space.ts:48
meta
getmeta():undefined|DocMeta
Returns
undefined | DocMeta
Source
packages/framework/store/src/store/doc/block-collection.ts:147
readonly
getreadonly():boolean
Returns
boolean
Source
packages/framework/store/src/store/doc/block-collection.ts:123
ready
getready():boolean
Returns
boolean
Source
packages/framework/store/src/store/doc/block-collection.ts:127
schema
getschema():Schema
Returns
Source
packages/framework/store/src/store/doc/block-collection.ts:143
spaceDoc
getspaceDoc():Doc
Returns
Source
packages/framework/store/src/store/space.ts:52
yBlocks
getyBlocks():Map<State[keyofState]>
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:305
_handleYBlockAdd()
private_handleYBlockAdd(id):void
Parameters
• id: string
Returns
void
Source
packages/framework/store/src/store/doc/block-collection.ts:273
_handleYBlockDelete()
private_handleYBlockDelete(id):void
Parameters
• id: string
Returns
void
Source
packages/framework/store/src/store/doc/block-collection.ts:277
_handleYEvent()
private_handleYEvent(event):void
Parameters
• event: YEvent<Text | Array<unknown> | YBlock>
Returns
void
Source
packages/framework/store/src/store/doc/block-collection.ts:281
_handleYEvents()
private_handleYEvents(events):void
Parameters
• events: YEvent<Text | YBlock>[]
Returns
void
Source
packages/framework/store/src/store/doc/block-collection.ts:301
_historyObserver()
private_historyObserver():void
Returns
void
Source
packages/framework/store/src/store/doc/block-collection.ts:269
_initYBlocks()
private_initYBlocks():void
Returns
void
Source
packages/framework/store/src/store/doc/block-collection.ts:256
captureSync()
captureSync():
void
Capture current operations to undo stack synchronously.
Returns
void
Source
packages/framework/store/src/store/doc/block-collection.ts:207
clear()
clear():
void
Returns
void
Inherited from
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:119
destroy()
destroy():
void
Returns
void
Inherited from
Source
packages/framework/store/src/store/space.ts:67
dispose()
dispose():
void
Returns
void
Source
packages/framework/store/src/store/doc/block-collection.ts:244
generateBlockId()
generateBlockId():
string
Returns
string
Source
packages/framework/store/src/store/doc/block-collection.ts:215
getDoc()
getDoc(
selector):Doc
Parameters
• selector: BlockSelector= defaultBlockSelector
Returns
Source
packages/framework/store/src/store/doc/block-collection.ts:105
load()
load(
initFn?):this
Parameters
• initFn?
Returns
this
Overrides
Source
packages/framework/store/src/store/doc/block-collection.ts:219
redo()
redo():
void
Returns
void
Source
packages/framework/store/src/store/doc/block-collection.ts:198
remove()
remove():
void
Returns
void
Inherited from
Source
packages/framework/store/src/store/space.ts:62
resetHistory()
resetHistory():
void
Returns
void
Source
packages/framework/store/src/store/doc/block-collection.ts:211
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
Source
packages/framework/store/src/store/doc/block-collection.ts:183
undo()
undo():
void
Returns
void
Source
packages/framework/store/src/store/doc/block-collection.ts:190
withoutTransact()
withoutTransact(
callback):void
Parameters
• callback
Returns
void
Source
packages/framework/store/src/store/doc/block-collection.ts:177