Skip to content

API > @blocksuite/store > Y > Item

Class: Item ​

Abstract class that represents any content.

Extends ​

Constructors ​

constructor ​

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

Parameters ​

ParameterTypeDescription
idID-
leftnull | Item-
originnull | ID-
rightnull | Item-
rightOriginnull | ID-
parentnull | AbstractType< any > | IDIs 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.
parentSubnull | string-
contentAbstractContent-

Returns ​

Item

Overrides ​

AbstractStruct.constructor

Defined In ​

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

Properties ​

content ​

content: AbstractContent

Defined In ​

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


id ​

id: ID

Defined In ​

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

Inherited from ​

AbstractStruct.id


info ​

info: number

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

Defined In ​

node_modules/.pnpm/yjs@13.6.8/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.

Defined In ​

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


length ​

length: number

Defined In ​

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

Inherited from ​

AbstractStruct.length


origin ​

origin: null | ID

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

Defined In ​

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


parent ​

parent: null | AbstractType< any > | ID

Defined In ​

node_modules/.pnpm/yjs@13.6.8/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.

Defined In ​

node_modules/.pnpm/yjs@13.6.8/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.

Defined In ​

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


right: null | Item

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

Defined In ​

node_modules/.pnpm/yjs@13.6.8/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.

Defined In ​

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

Accessors ​

countable ​

get countable(): boolean

Defined In ​

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


deleted ​

get deleted(): boolean

Defined In ​

node_modules/.pnpm/yjs@13.6.8/node_modules/yjs/dist/src/structs/Item.d.ts:86

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

Overrides ​

AbstractStruct.deleted


keep ​

get keep(): boolean

Defined In ​

node_modules/.pnpm/yjs@13.6.8/node_modules/yjs/dist/src/structs/Item.d.ts:80

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


lastId ​

get lastId(): ID

Defined In ​

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


marker ​

get marker(): boolean

Defined In ​

node_modules/.pnpm/yjs@13.6.8/node_modules/yjs/dist/src/structs/Item.d.ts:78

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


next ​

get next(): null | Item

Defined In ​

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


prev ​

get prev(): null | Item

Defined In ​

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

Methods ​

delete ​

delete(transaction): void

Mark this Item as deleted.

Parameters ​

ParameterType
transactionTransaction

Returns ​

void

Defined In ​

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


gc ​

gc(store, parentGCd): void

Parameters ​

ParameterType
storeStructStore
parentGCdboolean

Returns ​

void

Defined In ​

node_modules/.pnpm/yjs@13.6.8/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 ​

ParameterType
transactionTransaction
storeStructStore

Returns ​

null | number

Defined In ​

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


integrate ​

integrate(transaction, offset): void

Parameters ​

ParameterType
transactionTransaction
offsetnumber

Returns ​

void

Inherited from ​

AbstractStruct.integrate

Defined In ​

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


markDeleted ​

markDeleted(): void

Returns ​

void

Defined In ​

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


mergeWith ​

mergeWith(right): boolean

Try to merge two items

Parameters ​

ParameterType
rightItem

Returns ​

boolean

Overrides ​

AbstractStruct.mergeWith

Defined In ​

node_modules/.pnpm/yjs@13.6.8/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 ​

ParameterTypeDescription
encoderUpdateEncoderV1 | UpdateEncoderV2The encoder to write data to.
offsetnumber-

Returns ​

void

Overrides ​

AbstractStruct.write

Defined In ​

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