Skip to content

BlockSuite API Documentation / @blocksuite/store / Y / Item

Class: Item ​

Abstract class that represents any content.

Contents ​

Extends ​

Constructors ​

new Item(id, left, origin, right, rightOrigin, parent, parentSub, content) ​

new Item(id, left, origin, right, rightOrigin, parent, parentSub, content): Item

Parameters ​

• id: ID

• left: null | Item

• origin: null | ID

• right: null | Item

• rightOrigin: null | ID

• parent: null | AbstractType<any> | ID

Is a type if integrated, is null if it is possible to copy parent from left or right, is ID before integration to search for it.

• parentSub: null | string

• content: AbstractContent

Returns ​

Item

Overrides ​

@blocksuite/store.Y.AbstractStruct.constructor

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:22

Properties ​

content ​

content: AbstractContent

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:64


id ​

id: ID

Inherited from ​

@blocksuite/store.Y.AbstractStruct.id

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/AbstractStruct.d.ts:7


info ​

info: number

bit1: keep bit2: countable bit3: deleted bit4: mark - mark node as fast-search-marker

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:72


left ​

left: null | Item

The item that is currently to the left of this item.

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:32


length ​

length: number

Inherited from ​

@blocksuite/store.Y.AbstractStruct.length

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/AbstractStruct.d.ts:8


origin ​

origin: null | ID

The item that was originally to the left of this item.

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:27


parent ​

parent: null | AbstractType<any> | ID

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:46


parentSub ​

parentSub: null | string

If the parent refers to this item with some kind of key (e.g. YMap, the key is specified here. The key is then used to refer to the list in which to insert this item. If parentSub = null type._start is the list in which to insert to. Otherwise it is parent._map.

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:54


redone ​

redone: null | ID

If this type's effect is redone this type refers to the type that undid this operation.

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:60


right: null | Item

The item that is currently to the right of this item.

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:37


rightOrigin ​

rightOrigin: null | ID

The item that was originally to the right of this item.

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:42

Accessors ​

countable ​

get countable(): boolean

Returns ​

boolean

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:85


deleted ​

get deleted(): boolean

Whether this item was deleted or not.

set deleted(arg): void

Parameters ​

• arg: boolean

Returns ​

boolean

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:91


keep ​

get keep(): boolean

If true, do not garbage collect this Item.

set keep(arg): void

Parameters ​

• arg: boolean

Returns ​

boolean

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:84


lastId ​

get lastId(): ID

Computes the last content address of this Item.

Returns ​

ID

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:112


marker ​

get marker(): boolean

set marker(arg): void

This is used to mark the item as an indexed fast-search marker

Parameters ​

• arg: boolean

Returns ​

boolean

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:79


next ​

get next(): null | Item

Returns the next non-deleted item

Returns ​

null | Item

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:104


prev ​

get prev(): null | Item

Returns the previous non-deleted item

Returns ​

null | Item

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:108

Methods ​

delete() ​

delete(transaction): void

Mark this Item as deleted.

Parameters ​

• transaction: Transaction

Returns ​

void

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:125


gc() ​

gc(store, parentGCd): void

Parameters ​

• store: StructStore

• parentGCd: boolean

Returns ​

void

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:130


getMissing() ​

getMissing(transaction, store): null | number

Return the creator clientID of the missing op or define missing items and return null.

Parameters ​

• transaction: Transaction

• store: StructStore

Returns ​

null | number

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:100


integrate() ​

integrate(transaction, offset): void

Parameters ​

• transaction: Transaction

• offset: number

Returns ​

void

Inherited from ​

@blocksuite/store.Y.AbstractStruct.integrate

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/AbstractStruct.d.ts:31


markDeleted() ​

markDeleted(): void

Returns ​

void

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:92


mergeWith() ​

mergeWith(right): boolean

Try to merge two items

Parameters ​

• right: Item

Returns ​

boolean

Overrides ​

@blocksuite/store.Y.AbstractStruct.mergeWith

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:119


write() ​

write(encoder, offset): void

Transform the properties of this type to binary and write it to an BinaryEncoder.

This is called when this Item is sent to a remote peer.

Parameters ​

• encoder: UpdateEncoderV1 | UpdateEncoderV2

The encoder to write data to.

• offset: number

Returns ​

void

Overrides ​

@blocksuite/store.Y.AbstractStruct.write

Source ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/structs/Item.d.ts:140


Generated using typedoc-plugin-markdown and TypeDoc