Skip to content

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

Class: XmlText

Represents text in a Dom Element. In the future this type will also handle simple formatting information like bold and italic.

Extends

Constructors

new XmlText()

new XmlText(string?): XmlText

Parameters

string?: string

The initial value of the YText.

Returns

XmlText

Inherited from

Text.constructor

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YText.d.ts:97

Properties

_dEH

_dEH: EventHandler<YEvent<any>[], Transaction>

Deep event handlers

Inherited from

Text._dEH

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/AbstractType.d.ts:46


_eH

_eH: EventHandler<YTextEvent, Transaction>

Event handlers

Inherited from

Text._eH

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/AbstractType.d.ts:41


_hasFormatting

_hasFormatting: boolean

Whether this YText contains formatting attributes. This flag is updated when a formatting item is integrated (see ContentFormat.integrate)

Inherited from

Text._hasFormatting

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YText.d.ts:107


_item

_item: null | Item

Inherited from

Text._item

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/AbstractType.d.ts:23


_length

_length: number

Inherited from

Text._length

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/AbstractType.d.ts:36


_map

_map: Map<string, Item>

Inherited from

Text._map

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/AbstractType.d.ts:27


_pending

_pending: null | () => void[]

Array of pending operations on this type

Inherited from

Text._pending

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YText.d.ts:102


_searchMarker

_searchMarker: null | ArraySearchMarker[]

Inherited from

Text._searchMarker

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/AbstractType.d.ts:50


_start

_start: null | Item

Inherited from

Text._start

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/AbstractType.d.ts:31


doc

doc: null | Doc

Inherited from

Text.doc

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/AbstractType.d.ts:35

Accessors

_first

get _first(): null | Item

The first non-deleted item

Returns

null | Item

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/AbstractType.d.ts:85


length

get length(): number

Number of characters of this text type.

Returns

number

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YText.d.ts:113


nextSibling

get nextSibling(): null | XmlText | XmlElement<object>

Returns

null | XmlText | XmlElement<object>

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YXmlText.d.ts:9


parent

get parent(): null | AbstractType<any>

Returns

null | AbstractType<any>

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/AbstractType.d.ts:54


prevSibling

get prevSibling(): null | XmlText | XmlElement<object>

Returns

null | XmlText | XmlElement<object>

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YXmlText.d.ts:15

Methods

_callObserver()

_callObserver(transaction, _parentSubs): void

Creates YEvent and calls all type observers. Must be implemented by each type.

Parameters

transaction: Transaction

_parentSubs: Set<null | string>

Keys changed on this type. null if list was modified.

Returns

void

Inherited from

Text._callObserver

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/AbstractType.d.ts:93


_copy()

_copy(): XmlText

Returns

XmlText

Overrides

Text._copy

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YXmlText.d.ts:18


_integrate()

_integrate(y, item): void

Integrate this type into the Yjs instance.

  • Save this struct in the os
  • This type is sent to other client
  • Observer functions are fired

Parameters

y: Doc

The Yjs instance

item: Item

Returns

void

Inherited from

Text._integrate

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YText.d.ts:118


_write()

_write(_encoder): void

Parameters

_encoder: UpdateEncoderV1 | UpdateEncoderV2

Returns

void

Inherited from

Text._write

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/AbstractType.d.ts:81


applyDelta()

applyDelta(delta, opts?): void

Apply a Delta on this shared YText type.

Parameters

delta: any

The changes to apply on this element.

opts?

opts.sanitize?: boolean

Sanitize input delta. Removes ending newlines if set to true.

Returns

void

Inherited from

Text.applyDelta

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YText.d.ts:145


clone()

clone(): XmlText

Makes a copy of this data type that can be included somewhere else.

Note that the content is only readable after it has been included somewhere in the Ydoc.

Returns

XmlText

Overrides

Text.clone

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YXmlText.d.ts:26


delete()

delete(index, length): void

Deletes text starting from an index.

Parameters

index: number

Index at which to start deleting.

length: number

The number of characters to remove. Defaults to 1.

Returns

void

Inherited from

Text.delete

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YText.d.ts:189


format()

format(index, length, attributes): void

Assigns properties to a range of text.

Parameters

index: number

The position where to start formatting.

length: number

The amount of characters to assign properties to.

attributes: Object

Attribute information to apply on the text.

Returns

void

Inherited from

Text.format

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YText.d.ts:200


getAttribute()

getAttribute(attributeName): any

Returns an attribute value that belongs to the attribute name.

Parameters

attributeName: string

The attribute name that identifies the queried value.

Returns

any

The queried attribute value.

Inherited from

Text.getAttribute

Note

Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YText.d.ts:233


getAttributes()

getAttributes(): object

Returns all attribute name/value pairs in a JSON Object.

Returns

object

A JSON Object that describes the attributes.

Inherited from

Text.getAttributes

Note

Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YText.d.ts:243


insert()

insert(index, text, attributes?): void

Insert text at a given index.

Parameters

index: number

The index at which to start inserting.

text: string

The text to insert at the specified position.

attributes?: Object

Optionally define some formatting information to apply on the inserted Text.

Returns

void

Inherited from

Text.insert

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YText.d.ts:169


insertEmbed()

insertEmbed(index, embed, attributes?): void

Inserts an embed at a index.

Parameters

index: number

The index to insert the embed at.

embed: Object | AbstractType<any>

The Object that represents the embed.

attributes?: Object

Attribute information to apply on the embed

Returns

void

Inherited from

Text.insertEmbed

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YText.d.ts:180


observe()

observe(f): void

Observe all events that are created on this type.

Parameters

f

Observer function

Returns

void

Inherited from

Text.observe

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/AbstractType.d.ts:99


observeDeep()

observeDeep(f): void

Observe all events that are created by this type and its children.

Parameters

f

Observer function

Returns

void

Inherited from

Text.observeDeep

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/AbstractType.d.ts:105


removeAttribute()

removeAttribute(attributeName): void

Removes an attribute.

Parameters

attributeName: string

The attribute name that is to be removed.

Returns

void

Inherited from

Text.removeAttribute

Note

Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YText.d.ts:210


setAttribute()

setAttribute(attributeName, attributeValue): void

Sets or updates an attribute.

Parameters

attributeName: string

The attribute name that is to be set.

attributeValue: any

The attribute value that is to be set.

Returns

void

Inherited from

Text.setAttribute

Note

Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YText.d.ts:221


toDOM()

toDOM(_document?, hooks?, binding?): Text

Creates a Dom Element that mirrors this YXmlText.

Parameters

_document?: Document

The document object (you must define this when calling this method in nodejs)

hooks?

Optional property to customize how hooks are presented in the DOM

binding?: any

You should not set this property. This is used if DomBinding wants to create a association to the created DOM type.

Returns

Text

The Element

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YXmlText.d.ts:42


toDelta()

toDelta(snapshot?, prevSnapshot?, computeYChange?): any

Returns the Delta representation of this YText type.

Parameters

snapshot?: Snapshot

prevSnapshot?: Snapshot

computeYChange?

Returns

any

The Delta representation of this type.

Inherited from

Text.toDelta

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YText.d.ts:158


toJSON()

toJSON(): string

Returns the unformatted string representation of this YText type.

Returns

string

Inherited from

Text.toJSON

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YText.d.ts:134


toString()

toString(): any

Returns

any

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/YXmlText.d.ts:45


unobserve()

unobserve(f): void

Unregister an observer function.

Parameters

f

Observer function

Returns

void

Inherited from

Text.unobserve

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/AbstractType.d.ts:111


unobserveDeep()

unobserveDeep(f): void

Unregister an observer function.

Parameters

f

Observer function

Returns

void

Inherited from

Text.unobserveDeep

Source

node_modules/.pnpm/yjs@13.6.15/node_modules/yjs/dist/src/types/AbstractType.d.ts:117