BlockSuite API Documentation / @blocksuite/store / Page
Class: Page
Extends
Space
<FlatBlockMap
>
Constructors
new Page(__namedParameters)
new Page(
__namedParameters
):Page
Parameters
• __namedParameters: PageOptions
Returns
Overrides
@blocksuite/store.Space.constructor
Source
packages/store/src/workspace/page.ts:87
Properties
_blockTree
private
readonly
_blockTree:BlockTree
Source
packages/store/src/workspace/page.ts:41
_docLoaded
private
_docLoaded:boolean
=false
Indicate whether the underlying subdoc has been loaded.
Source
packages/store/src/workspace/page.ts:45
_history
private
_history:UndoManager
Source
packages/store/src/workspace/page.ts:42
_idGenerator
private
readonly
_idGenerator:IdGenerator
Source
packages/store/src/workspace/page.ts:40
_ready
private
_ready:boolean
=false
Indicate whether the block tree is ready
Source
packages/store/src/workspace/page.ts:47
_root
private
_root:null
|BlockModel
<object
> =null
Source
packages/store/src/workspace/page.ts:43
_shouldTransact
private
_shouldTransact:boolean
=true
Source
packages/store/src/workspace/page.ts:48
_workspace
private
readonly
_workspace:Workspace
Source
packages/store/src/workspace/page.ts:39
_yBlocks
protected
readonly
_yBlocks:Map
<YBlock
>
Inherited from
@blocksuite/store.Space._yBlocks
Source
packages/store/src/workspace/space.ts:29
_ySpaceDoc
protected
readonly
_ySpaceDoc:Doc
Used for convenient access to the underlying Yjs map, can be used interchangeably with ySpace
Inherited from
@blocksuite/store.Space._ySpaceDoc
Source
packages/store/src/workspace/space.ts:28
awarenessStore
readonly
awarenessStore:AwarenessStore
<BlockSuiteFlags
>
Inherited from
@blocksuite/store.Space.awarenessStore
Source
packages/store/src/workspace/space.ts:18
id
readonly
id:string
Inherited from
Source
packages/store/src/workspace/space.ts:16
rootDoc
readonly
rootDoc:BlockSuiteDoc
Inherited from
@blocksuite/store.Space.rootDoc
Source
packages/store/src/workspace/space.ts:17
slots
readonly
slots:Object
Type declaration
blockUpdated
blockUpdated:
Slot
<Object
|Object
|Object
>
historyUpdated
historyUpdated:
Slot
<void
>
ready
ready:
Slot
<void
>
This fires when the block tree is initialized via API call or underlying existing ydoc binary. Note that this is different with the doc.loaded
field, since loaded
only indicates that the ydoc is loaded, not the block tree.
rootAdded
rootAdded:
Slot
<BlockModel
<object
>>
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
>
Source
packages/store/src/workspace/page.ts:50
Accessors
Text
get
Text(): typeofText
Returns
typeof Text
Source
packages/store/src/workspace/page.ts:153
blob
get
blob():BlobManager
Returns
Source
packages/store/src/workspace/page.ts:127
canRedo
get
canRedo():boolean
Returns
boolean
Source
packages/store/src/workspace/page.ts:146
canUndo
get
canUndo():boolean
Returns
boolean
Source
packages/store/src/workspace/page.ts:139
history
get
history():UndoManager
Returns
Source
packages/store/src/workspace/page.ts:111
isEmpty
get
isEmpty():boolean
Returns
boolean
Source
packages/store/src/workspace/page.ts:135
loaded
get
loaded():boolean
Returns
boolean
Source
packages/store/src/workspace/space.ts:49
meta
get
meta():PageMeta
Returns
Source
packages/store/src/workspace/page.ts:123
readonly
get
readonly():boolean
Returns
boolean
Source
packages/store/src/workspace/page.ts:103
ready
get
ready():boolean
Returns
boolean
Source
packages/store/src/workspace/page.ts:107
root
get
root():null
|BlockModel
<object
>
Returns
null
| BlockModel
<object
>
Source
packages/store/src/workspace/page.ts:131
schema
get
schema():Schema
Returns
Source
packages/store/src/workspace/page.ts:119
spaceDoc
get
spaceDoc():Doc
Returns
Source
packages/store/src/workspace/space.ts:53
workspace
get
workspace():Workspace
Returns
Source
packages/store/src/workspace/page.ts:115
yBlocks
get
yBlocks():Map
<State
[keyofState
]>
Returns
Map
<State
[keyof State
]>
Source
packages/store/src/workspace/space.ts:45
Methods
_getYBlock()
private
_getYBlock(id
):null
|YBlock
Parameters
• id: string
Returns
null
| YBlock
Source
packages/store/src/workspace/page.ts:688
_handleVersion()
private
_handleVersion():void
Returns
void
Source
packages/store/src/workspace/page.ts:789
_handleYBlockAdd()
private
_handleYBlockAdd(id
):void
Parameters
• id: string
Returns
void
Source
packages/store/src/workspace/page.ts:698
_handleYBlockDelete()
private
_handleYBlockDelete(id
):void
Parameters
• id: string
Returns
void
Source
packages/store/src/workspace/page.ts:747
_handleYEvent()
private
_handleYEvent(event
):void
Parameters
• event: YEvent
<Text
| Array
<unknown
> | YBlock
>
Returns
void
Source
packages/store/src/workspace/page.ts:764
_handleYEvents()
private
_handleYEvents(events
):void
Parameters
• events: YEvent
<Text
| YBlock
>[]
Returns
void
Source
packages/store/src/workspace/page.ts:783
_historyObserver()
private
_historyObserver():void
Returns
void
Source
packages/store/src/workspace/page.ts:694
_initYBlocks()
private
_initYBlocks():void
Returns
void
Source
packages/store/src/workspace/page.ts:675
addBlock()
addBlock(
flavour
,blockProps
,parent
?,parentIndex
?):string
Parameters
• flavour: string
• blockProps: Partial
<BlockSysProps
& Object
& Omit
<BlockProps
, "flavour"
>>= {}
• parent?: null
| string
| BlockModel
<object
>
• parentIndex?: number
Returns
string
Source
packages/store/src/workspace/page.ts:339
addBlocks()
addBlocks(
blocks
,parent
?,parentIndex
?):string
[]
Parameters
• blocks: Object
[]
• parent?: null
| string
| BlockModel
<object
>
• parentIndex?: number
Returns
string
[]
Source
packages/store/src/workspace/page.ts:316
addSiblingBlocks()
addSiblingBlocks(
targetModel
,props
,place
):string
[]
Parameters
• targetModel: BlockModel
<object
>
• props: Partial
<BlockProps
>[]
• place: "after"
| "before"
= 'after'
Returns
string
[]
Source
packages/store/src/workspace/page.ts:530
captureSync()
captureSync():
void
Capture current operations to undo stack synchronously.
Returns
void
Source
packages/store/src/workspace/page.ts:187
clear()
clear():
void
Returns
void
Inherited from
Source
packages/store/src/workspace/space.ts:86
deleteBlock()
deleteBlock(
model
,options
):void
Parameters
• model: BlockModel
<object
>
• options: Object
= undefined
• options.bringChildrenTo?: BlockModel
<object
>
• options.deleteChildren?: boolean
Returns
void
Source
packages/store/src/workspace/page.ts:562
destroy()
destroy():
void
Returns
void
Inherited from
@blocksuite/store.Space.destroy
Source
packages/store/src/workspace/space.ts:80
dispose()
dispose():
void
Returns
void
Source
packages/store/src/workspace/page.ts:663
generateBlockId()
generateBlockId():
string
Returns
string
Source
packages/store/src/workspace/page.ts:195
getBlockByFlavour()
getBlockByFlavour(
blockFlavour
):BlockModel
<object
>[]
Parameters
• blockFlavour: string
| string
[]
Returns
BlockModel
<object
>[]
Source
packages/store/src/workspace/page.ts:205
getBlockById()
getBlockById<
Model
>(id
):null
|Model
Type parameters
• Model extends BlockModel
<object
> = BlockModel
<object
>
Parameters
• id: string
Returns
null
| Model
Source
packages/store/src/workspace/page.ts:199
getBlocks()
getBlocks():
BlockModel
<object
>[]
Returns
BlockModel
<object
>[]
Source
packages/store/src/workspace/page.ts:305
getInitialPropsByFlavour()
getInitialPropsByFlavour(
flavour
):Record
<string
,any
>
Parameters
• flavour: string
Returns
Record
<string
, any
>
Source
packages/store/src/workspace/page.ts:299
getNextSibling()
getNextSibling(
block
):null
|BlockModel
<object
>
Parameters
• block: BlockModel
<object
>
Returns
null
| BlockModel
<object
>
Source
packages/store/src/workspace/page.ts:267
getNextSiblings()
getNextSiblings(
block
):BlockModel
<object
>[]
Parameters
• block: BlockModel
<object
>
Returns
BlockModel
<object
>[]
Source
packages/store/src/workspace/page.ts:281
getParent()
getParent(
target
):null
|BlockModel
<object
>
Parameters
• target: string
| BlockModel
<object
>
Returns
null
| BlockModel
<object
>
Source
packages/store/src/workspace/page.ts:214
getPreviousSibling()
getPreviousSibling(
block
):null
|BlockModel
<object
>
Parameters
• block: BlockModel
<object
>
Returns
null
| BlockModel
<object
>
Source
packages/store/src/workspace/page.ts:239
getPreviousSiblings()
getPreviousSiblings(
block
):BlockModel
<object
>[]
Parameters
• block: BlockModel
<object
>
Returns
BlockModel
<object
>[]
Source
packages/store/src/workspace/page.ts:253
getSchemaByFlavour()
getSchemaByFlavour(
flavour
):undefined
|Object
Parameters
• flavour: string
Returns
undefined
| Object
Source
packages/store/src/workspace/page.ts:295
load()
load(
initFn
?):Promise
<Page
>
Parameters
• initFn?: () => void
| Promise
<void
>
Returns
Promise
<Page
>
Overrides
Source
packages/store/src/workspace/page.ts:801
moveBlocks()
moveBlocks(
blocksToMove
,newParent
,targetSibling
,shouldInsertBeforeSibling
):void
Parameters
• blocksToMove: BlockModel
<object
>[]
• newParent: BlockModel
<object
>
• targetSibling: null
| BlockModel
<object
>= null
• shouldInsertBeforeSibling: boolean
= true
Returns
void
Source
packages/store/src/workspace/page.ts:390
redo()
redo():
void
Returns
void
Source
packages/store/src/workspace/page.ts:178
remove()
remove():
void
Returns
void
Inherited from
@blocksuite/store.Space.remove
Source
packages/store/src/workspace/space.ts:75
resetHistory()
resetHistory():
void
Returns
void
Source
packages/store/src/workspace/page.ts:191
transact()
transact(
fn
,shouldTransact
):void
If shouldTransact
is false
, the transaction will not be push to the history stack.
Parameters
• fn: () => void
• shouldTransact: boolean
= undefined
Returns
void
Overrides
@blocksuite/store.Space.transact
Source
packages/store/src/workspace/page.ts:163
trySyncFromExistingDoc()
trySyncFromExistingDoc():
void
Returns
void
Source
packages/store/src/workspace/page.ts:640
undo()
undo():
void
Returns
void
Source
packages/store/src/workspace/page.ts:170
updateBlock()
updateBlock(model, props)
updateBlock<
T
>(model
,props
):void
Type parameters
• T extends Partial
<BlockProps
>
Parameters
• model: BlockModel
<object
>
• props: T
Returns
void
Source
packages/store/src/workspace/page.ts:481
updateBlock(model, callback)
updateBlock(
model
,callback
):void
Parameters
• model: BlockModel
<object
>
• callback: () => void
Returns
void
Source
packages/store/src/workspace/page.ts:482
waitForLoaded()
waitForLoaded():
Promise
<void
>
Returns
Promise
<void
>
Deprecated
use page.load() instead
Source
packages/store/src/workspace/page.ts:817
withoutTransact()
withoutTransact(
callback
):void
Parameters
• callback: () => void
Returns
void
Source
packages/store/src/workspace/page.ts:157
Generated using TypeDoc and typedoc-plugin-markdown.