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
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
Inherited from
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
Source
packages/framework/store/src/store/space.ts:27
awarenessStore
readonly
awarenessStore:AwarenessStore
<BlockSuiteFlags
>
Inherited from
Source
packages/framework/store/src/store/space.ts:17
id
readonly
id:string
Inherited from
Source
packages/framework/store/src/store/space.ts:15
rootDoc
readonly
rootDoc:BlockSuiteDoc
Inherited from
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(): typeofText
Returns
typeof Text
Source
packages/framework/store/src/store/doc/block-collection.ts:173
blob
get
blob():BlobManager
Returns
Source
packages/framework/store/src/store/doc/block-collection.ts:151
canRedo
get
canRedo():boolean
Returns
boolean
Source
packages/framework/store/src/store/doc/block-collection.ts:166
canUndo
get
canUndo():boolean
Returns
boolean
Source
packages/framework/store/src/store/doc/block-collection.ts:159
collection
get
collection():DocCollection
Returns
Source
packages/framework/store/src/store/doc/block-collection.ts:139
crud
get
crud():DocCRUD
Returns
DocCRUD
Source
packages/framework/store/src/store/doc/block-collection.ts:135
history
get
history():UndoManager
Returns
Source
packages/framework/store/src/store/doc/block-collection.ts:131
isEmpty
get
isEmpty():boolean
Returns
boolean
Source
packages/framework/store/src/store/doc/block-collection.ts:155
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:147
readonly
get
readonly():boolean
Returns
boolean
Source
packages/framework/store/src/store/doc/block-collection.ts:123
ready
get
ready():boolean
Returns
boolean
Source
packages/framework/store/src/store/doc/block-collection.ts:127
schema
get
schema():Schema
Returns
Source
packages/framework/store/src/store/doc/block-collection.ts:143
spaceDoc
get
spaceDoc():Doc
Returns
Source
packages/framework/store/src/store/space.ts:52
yBlocks
get
yBlocks():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