YText
Direct Subclass:
Type that represents text with formatting information.
This type replaces y-richtext as this implementation is able to handle block formats (format information on a paragraph), embeds (complex elements like pictures and videos), and text formats (bold, italic).
Constructor Summary
Public Constructor | ||
public |
|
Method Summary
Public Methods | ||
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. |
Inherited Summary
From class Type | ||
public |
Compute the path from this type to the specified target. |
|
public |
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 |
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 |
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 |
Appends content to this YArray. |
|
public |
Transforms this YArray to a JavaScript Array. |
|
public |
Transforms this Shared Type to a JSON object. |
Public Constructors
Public Methods
public applyDelta(delta: Delta) source
Apply a Delta on this shared YText type.
Params:
Name | Type | Attribute | Description |
delta | Delta | The changes to apply on this element. |
public delete(index: Integer, length: Integer) source
Deletes text starting from an index.
Override:
YArray#deleteParams:
Name | Type | Attribute | Description |
index | Integer | Index at which to start deleting. |
|
length | Integer | The number of characters to remove. Defaults to 1. |
public format(index: Integer, length: Integer, attributes: TextAttributes) source
Assigns properties to a range of text.
Params:
Name | Type | Attribute | Description |
index | Integer | The position where to start formatting. |
|
length | Integer | The amount of characters to assign properties to. |
|
attributes | TextAttributes | Attribute information to apply on the text. |
public insert(index: Integer, text: String, attributes: TextAttributes) source
Insert text at a given index.
Override:
YArray#insertParams:
Name | Type | Attribute | Description |
index | Integer | The index at which to start inserting. |
|
text | String | The text to insert at the specified position. |
|
attributes | TextAttributes | Optionally define some formatting information to apply on the inserted Text. |
public insertEmbed(index: Integer, embed: Object, attributes: TextAttributes) source
Inserts an embed at a index.
Params:
Name | Type | Attribute | Description |
index | Integer | The index to insert the embed at. |
|
embed | Object | The Object that represents the embed. |
|
attributes | TextAttributes | Attribute information to apply on the embed |
public toString(): * source
Returns the unformatted string representation of this YText type.
Return:
* |