    import YXmlText from 'yjs/src/Types/YXml/YXmlText.js'

public class | source

# YXmlText

#### Extends:

Item → Type → YArray → YText → 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 (f: Function) Observe all events that are created on this type. |
public | observeDeep (f: Function) Observe all events that are created by this type and its children. |
public | unobserve (f: Function) Unregister an observer function. |
public | unobserveDeep (f: Function) 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 | forEach (f: Function) 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 | map (f: Function): Array 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 | toArray (): Array Transforms this YArray to a JavaScript Array. |
public | toJSON (): Array 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 | toDelta (): Delta 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:

Name | Type | Attribute | Description

_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.

#### Return:

Element | The {@link https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element}