Home Reference Source
import YXmlText from 'yjs/src/Types/YXml/YXmlText.js'
public class | source

YXmlText

Extends:

ItemTypeYArrayYText → YXmlText

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

Method Summary

Public Methods
public

toDom(_document: Document, hooks: Object<key:hookDefinition>, binding: DomBinding): Element

Creates a Dom Element that mirrors this YXmlText.

Inherited Summary

From class Type
public

getPathTo(type: YType): Array<string>

Compute the path from this type to the specified target.

public

Observe all events that are created on this type.

public

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

public

Unregister an observer function.

public

Unregister an observer function.

From class YArray
public get

length: *

Computes the length of this YArray.

public

[Symbol.iterator](): {"next": *, "_item": *, "_itemElement": *, "_count": *}

public

delete(index: Integer, length: Integer)

Deletes elements starting from an index.

public

Executes a provided function on once on overy element of this YArray.

public

get(index: Integer): *

Returns the i-th element from a YArray.

public

insert(index: Integer, content: Array)

Inserts new content at an index.

public

Returns an Array with the result of calling a provided function on every element of this YArray.

public

push(content: Array)

Appends content to this YArray.

public

Transforms this YArray to a JavaScript Array.

public

Transforms this Shared Type to a JSON object.

From class YText
public

applyDelta(delta: Delta)

Apply a Delta on this shared YText type.

public

delete(index: Integer, length: Integer)

Deletes text starting from an index.

public

format(index: Integer, length: Integer, attributes: TextAttributes)

Assigns properties to a range of text.

public

insert(index: Integer, text: String, attributes: TextAttributes)

Insert text at a given index.

public

insertEmbed(index: Integer, embed: Object, attributes: TextAttributes)

Inserts an embed at a index.

public

Returns the Delta representation of this YText type.

public

toString(): *

Returns the unformatted string representation of this YText type.

Public Methods

public toDom(_document: Document, hooks: Object<key:hookDefinition>, binding: DomBinding): Element source

Creates a Dom Element that mirrors this YXmlText.

Params:

NameTypeAttributeDescription
_document Document
  • optional
  • default: document

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

hooks Object<key:hookDefinition>
  • optional

Optional property to customize how hooks are presented in the DOM

binding DomBinding
  • optional

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