Skip to content

API > @blocksuite/block-std > ViewStore

Class: ViewStore ​

Constructors ​

constructor ​

new ViewStore(std): ViewStore

Parameters ​

ParameterType
stdBlockStdProvider

Returns ​

ViewStore

Defined In ​

block-std/src/view/view-store.ts:25

Properties ​

_cachedPath ​

private _cachedPath: Map< Node, NodeView[] >

Defined In ​

block-std/src/view/view-store.ts:21


_cachedTree ​

private _cachedTree: null | NodeViewTree = null

Defined In ​

block-std/src/view/view-store.ts:20


_observer ​

private _observer: MutationObserver

Defined In ​

block-std/src/view/view-store.ts:22


std ​

std: BlockStdProvider

Defined In ​

block-std/src/view/view-store.ts:25


viewSpec ​

readonly viewSpec: Set< BlockSuiteViewSpec< any > >

Defined In ​

block-std/src/view/view-store.ts:23

Methods ​

_calculateNodeViewPath ​

private _calculateNodeViewPath(node): NodeView[]

Parameters ​

ParameterType
nodeNode

Returns ​

NodeView[]

Defined In ​

block-std/src/view/view-store.ts:65


_getViewSpec ​

private _getViewSpec(type): undefined | BlockSuiteViewSpec< any >

Parameters ​

ParameterType
typestring

Returns ​

undefined | BlockSuiteViewSpec< any >

Defined In ​

block-std/src/view/view-store.ts:61


_indexOf ​

private _indexOf(path, parent): number

Parameters ​

ParameterType
pathstring[]
parentNodeViewTree

Returns ​

number

Defined In ​

block-std/src/view/view-store.ts:321


calculatePath ​

calculatePath(node): string[]

Parameters ​

ParameterType
nodeNode

Returns ​

string[]

Defined In ​

block-std/src/view/view-store.ts:56


findNext ​

findNext(path, fn): null | NodeViewTree

Parameters ​

ParameterType
pathstring[]
fnfunction

Returns ​

null | NodeViewTree

Defined In ​

block-std/src/view/view-store.ts:247


findPrev ​

findPrev(path, fn): null | NodeViewTree

Parameters ​

ParameterType
pathstring[]
fnfunction

Returns ​

null | NodeViewTree

Defined In ​

block-std/src/view/view-store.ts:192


fromPath ​

fromPath(path): null | NodeViewTree< unknown >

Parameters ​

ParameterType
pathstring[]

Returns ​

null | NodeViewTree< unknown >

Defined In ​

block-std/src/view/view-store.ts:129


getChildren ​

getChildren(path): NodeViewTree[]

Parameters ​

ParameterType
pathstring[]

Returns ​

NodeViewTree[]

Defined In ​

block-std/src/view/view-store.ts:32


getNodeView ​

getNodeView(node): null | NodeView

Parameters ​

ParameterType
nodeNode

Returns ​

null | NodeView

Defined In ​

block-std/src/view/view-store.ts:44


getNodeViewTree ​

getNodeViewTree(): NodeViewTree

Returns ​

NodeViewTree

Defined In ​

block-std/src/view/view-store.ts:94


getParent ​

getParent(path): null | NodeViewTree< unknown >

Parameters ​

ParameterType
pathstring[]

Returns ​

null | NodeViewTree< unknown >

Defined In ​

block-std/src/view/view-store.ts:185


indexOf ​

indexOf(path): number

Parameters ​

ParameterType
pathstring[]

Returns ​

number

Defined In ​

block-std/src/view/view-store.ts:302


mount ​

mount(): void

Returns ​

void

Defined In ​

block-std/src/view/view-store.ts:310


register ​

register<T>(spec): void

Type parameters ​

Parameter
T extends never

Parameters ​

ParameterType
specView[T]

Returns ​

void

Defined In ​

block-std/src/view/view-store.ts:40


unmount ​

unmount(): void

Returns ​

void

Defined In ​

block-std/src/view/view-store.ts:314


viewFromPath ​

viewFromPath<T>(type, path): null | SpecToNodeView< View[T] >

Type parameters ​

Parameter
T extends never

Parameters ​

ParameterType
typeT
pathstring[]

Returns ​

null | SpecToNodeView< View[T] >

Defined In ​

block-std/src/view/view-store.ts:143

viewFromPath<T>(type, path): null | SpecToNodeView< T >

Type parameters ​

Parameter
T extends BlockSuiteViewSpec< any >

Parameters ​

ParameterType
typestring
pathstring[]

Returns ​

null | SpecToNodeView< T >

Defined In ​

block-std/src/view/view-store.ts:147


walkThrough ​

walkThrough(fn, path = []): void

Parameters ​

ParameterTypeDefault value
fnfunctionundefined
pathstring[][]

Returns ​

void

Defined In ​

block-std/src/view/view-store.ts:162