BlockSuite API Documentation / @blocksuite/store / Page
Class: Page ​
Contents ​
- Extends
- Constructors
- Properties
- Accessors
- Methods
- _getYBlock()
- _handleVersion()
- _handleYBlockAdd()
- _handleYBlockDelete()
- _handleYEvent()
- _handleYEvents()
- _historyObserver()
- _initYBlocks()
- addBlock()
- addBlocks()
- addSiblingBlocks()
- captureSync()
- clear()
- deleteBlock()
- destroy()
- dispose()
- generateBlockId()
- getBlockByFlavour()
- getBlockById()
- getInitialPropsByFlavour()
- getNextSibling()
- getNextSiblings()
- getParent()
- getPreviousSibling()
- getPreviousSiblings()
- getSchemaByFlavour()
- load()
- moveBlocks()
- redo()
- remove()
- resetHistory()
- transact()
- trySyncFromExistingDoc()
- undo()
- updateBlock()
waitForLoaded()- withoutTransact()
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:86
Properties ​
_blockTree ​
privatereadonly_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 ​
privatereadonly_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|BaseBlockModel<object> =null
Source ​
packages/store/src/workspace/page.ts:43
_shouldTransact ​
private_shouldTransact:boolean=true
Source ​
packages/store/src/workspace/page.ts:48
_workspace ​
privatereadonly_workspace:Workspace
Source ​
packages/store/src/workspace/page.ts:39
_yBlocks ​
protectedreadonly_yBlocks:Map<YBlock>
Inherited from ​
@blocksuite/store.Space._yBlocks
Source ​
packages/store/src/workspace/space.ts:29
_ySpaceDoc ​
protectedreadonly_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 ​
readonlyawarenessStore:AwarenessStore<BlockSuiteFlags>
Inherited from ​
@blocksuite/store.Space.awarenessStore
Source ​
packages/store/src/workspace/space.ts:18
id ​
readonlyid:string
Inherited from ​
Source ​
packages/store/src/workspace/space.ts:16
rootDoc ​
readonlyrootDoc:BlockSuiteDoc
Inherited from ​
@blocksuite/store.Space.rootDoc
Source ​
packages/store/src/workspace/space.ts:17
slots ​
readonlyslots: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<BaseBlockModel<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 ​
getText(): typeofText
Returns ​
typeof Text
Source ​
packages/store/src/workspace/page.ts:152
blob ​
getblob():BlobManager
Returns ​
Source ​
packages/store/src/workspace/page.ts:126
canRedo ​
getcanRedo():boolean
Returns ​
boolean
Source ​
packages/store/src/workspace/page.ts:145
canUndo ​
getcanUndo():boolean
Returns ​
boolean
Source ​
packages/store/src/workspace/page.ts:138
history ​
gethistory():UndoManager
Returns ​
Source ​
packages/store/src/workspace/page.ts:110
isEmpty ​
getisEmpty():boolean
Returns ​
boolean
Source ​
packages/store/src/workspace/page.ts:134
loaded ​
getloaded():boolean
Returns ​
boolean
Source ​
packages/store/src/workspace/space.ts:49
meta ​
getmeta():PageMeta
Returns ​
Source ​
packages/store/src/workspace/page.ts:122
readonly ​
getreadonly():boolean
Returns ​
boolean
Source ​
packages/store/src/workspace/page.ts:102
ready ​
getready():boolean
Returns ​
boolean
Source ​
packages/store/src/workspace/page.ts:106
root ​
getroot():null|BaseBlockModel<object>
Returns ​
null | BaseBlockModel<object>
Source ​
packages/store/src/workspace/page.ts:130
schema ​
getschema():Schema
Returns ​
Source ​
packages/store/src/workspace/page.ts:118
spaceDoc ​
getspaceDoc():Doc
Returns ​
Source ​
packages/store/src/workspace/space.ts:53
workspace ​
getworkspace():Workspace
Returns ​
Source ​
packages/store/src/workspace/page.ts:114
yBlocks ​
getyBlocks():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:679
_handleVersion() ​
private_handleVersion():void
Returns ​
void
Source ​
packages/store/src/workspace/page.ts:780
_handleYBlockAdd() ​
private_handleYBlockAdd(id):void
Parameters ​
• id: string
Returns ​
void
Source ​
packages/store/src/workspace/page.ts:689
_handleYBlockDelete() ​
private_handleYBlockDelete(id):void
Parameters ​
• id: string
Returns ​
void
Source ​
packages/store/src/workspace/page.ts:738
_handleYEvent() ​
private_handleYEvent(event):void
Parameters ​
• event: YEvent<Text | Array<unknown> | YBlock>
Returns ​
void
Source ​
packages/store/src/workspace/page.ts:755
_handleYEvents() ​
private_handleYEvents(events):void
Parameters ​
• events: YEvent<Text | YBlock>[]
Returns ​
void
Source ​
packages/store/src/workspace/page.ts:774
_historyObserver() ​
private_historyObserver():void
Returns ​
void
Source ​
packages/store/src/workspace/page.ts:685
_initYBlocks() ​
private_initYBlocks():void
Returns ​
void
Source ​
packages/store/src/workspace/page.ts:666
addBlock() ​
addBlock(
flavour,blockProps,parent?,parentIndex?):string
Parameters ​
• flavour: string
• blockProps: Partial<BlockSysProps & Object & Omit<BlockProps, "flavour">>= {}
• parent?: null | string | BaseBlockModel<object>
• parentIndex?: number
Returns ​
string
Source ​
packages/store/src/workspace/page.ts:327
addBlocks() ​
addBlocks(
blocks,parent?,parentIndex?):string[]
Parameters ​
• blocks: Object[]
• parent?: null | string | BaseBlockModel<object>
• parentIndex?: number
Returns ​
string[]
Source ​
packages/store/src/workspace/page.ts:304
addSiblingBlocks() ​
addSiblingBlocks(
targetModel,props,place):string[]
Parameters ​
• targetModel: BaseBlockModel<object>
• props: Partial<BlockProps>[]
• place: "after" | "before"= 'after'
Returns ​
string[]
Source ​
packages/store/src/workspace/page.ts:521
captureSync() ​
captureSync():
void
Capture current operations to undo stack synchronously.
Returns ​
void
Source ​
packages/store/src/workspace/page.ts:186
clear() ​
clear():
void
Returns ​
void
Inherited from ​
Source ​
packages/store/src/workspace/space.ts:86
deleteBlock() ​
deleteBlock(
model,options):void
Parameters ​
• model: BaseBlockModel<object>
• options: Object= undefined
• options.bringChildrenTo?: BaseBlockModel<object>
• options.deleteChildren?: boolean
Returns ​
void
Source ​
packages/store/src/workspace/page.ts:553
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:654
generateBlockId() ​
generateBlockId():
string
Returns ​
string
Source ​
packages/store/src/workspace/page.ts:194
getBlockByFlavour() ​
getBlockByFlavour(
blockFlavour):BaseBlockModel<object>[]
Parameters ​
• blockFlavour: string | string[]
Returns ​
BaseBlockModel<object>[]
Source ​
packages/store/src/workspace/page.ts:204
getBlockById() ​
getBlockById<
Model>(id):null|Model
Type parameters ​
• Model extends BaseBlockModel<object> = BaseBlockModel<object>
Parameters ​
• id: string
Returns ​
null | Model
Source ​
packages/store/src/workspace/page.ts:198
getInitialPropsByFlavour() ​
getInitialPropsByFlavour(
flavour):Record<string,any>
Parameters ​
• flavour: string
Returns ​
Record<string, any>
Source ​
packages/store/src/workspace/page.ts:298
getNextSibling() ​
getNextSibling(
block):null|BaseBlockModel<object>
Parameters ​
• block: BaseBlockModel<object>
Returns ​
null | BaseBlockModel<object>
Source ​
packages/store/src/workspace/page.ts:266
getNextSiblings() ​
getNextSiblings(
block):BaseBlockModel<object>[]
Parameters ​
• block: BaseBlockModel<object>
Returns ​
BaseBlockModel<object>[]
Source ​
packages/store/src/workspace/page.ts:280
getParent() ​
getParent(
target):null|BaseBlockModel<object>
Parameters ​
• target: string | BaseBlockModel<object>
Returns ​
null | BaseBlockModel<object>
Source ​
packages/store/src/workspace/page.ts:213
getPreviousSibling() ​
getPreviousSibling(
block):null|BaseBlockModel<object>
Parameters ​
• block: BaseBlockModel<object>
Returns ​
null | BaseBlockModel<object>
Source ​
packages/store/src/workspace/page.ts:238
getPreviousSiblings() ​
getPreviousSiblings(
block):BaseBlockModel<object>[]
Parameters ​
• block: BaseBlockModel<object>
Returns ​
BaseBlockModel<object>[]
Source ​
packages/store/src/workspace/page.ts:252
getSchemaByFlavour() ​
getSchemaByFlavour(
flavour):undefined|Object
Parameters ​
• flavour: string
Returns ​
undefined | Object
Source ​
packages/store/src/workspace/page.ts:294
load() ​
load(
initFn?):Promise<Page>
Parameters ​
• initFn?: () => void | Promise<void>
Returns ​
Promise<Page>
Overrides ​
Source ​
packages/store/src/workspace/page.ts:792
moveBlocks() ​
moveBlocks(
blocksToMove,newParent,targetSibling,shouldInsertBeforeSibling):void
Parameters ​
• blocksToMove: BaseBlockModel<object>[]
• newParent: BaseBlockModel<object>
• targetSibling: null | BaseBlockModel<object>= null
• shouldInsertBeforeSibling: boolean= true
Returns ​
void
Source ​
packages/store/src/workspace/page.ts:378
redo() ​
redo():
void
Returns ​
void
Source ​
packages/store/src/workspace/page.ts:177
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:190
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:162
trySyncFromExistingDoc() ​
trySyncFromExistingDoc():
void
Returns ​
void
Source ​
packages/store/src/workspace/page.ts:631
undo() ​
undo():
void
Returns ​
void
Source ​
packages/store/src/workspace/page.ts:169
updateBlock() ​
updateBlock(model, props) ​
updateBlock<
T>(model,props):void
Type parameters ​
• T extends Partial<BlockProps>
Parameters ​
• model: BaseBlockModel<object>
• props: T
Returns ​
void
Source ​
packages/store/src/workspace/page.ts:469
updateBlock(model, callback) ​
updateBlock(
model,callback):void
Parameters ​
• model: BaseBlockModel<object>
• callback: () => void
Returns ​
void
Source ​
packages/store/src/workspace/page.ts:473
waitForLoaded() ​
waitForLoaded():
Promise<void>
Returns ​
Promise<void>
Deprecated ​
use page.load() instead
Source ​
packages/store/src/workspace/page.ts:808
withoutTransact() ​
withoutTransact(
callback):void
Parameters ​
• callback: () => void
Returns ​
void
Source ​
packages/store/src/workspace/page.ts:156
Generated using typedoc-plugin-markdown and TypeDoc