new YText(stringopt)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
string |
String |
<optional> |
The initial value of the YText. |
Extends
- AbstractType.<YTextEvent>
Members
-
nullable _pending :Array.<function(): void>
-
Array of pending operations on this type
-
_searchMarker :Array.<ArraySearchMarker>
-
-
doc :Doc
-
-
length :number
-
Number of characters of this text type.
Methods
-
_callObserver(transaction, parentSubs)
-
Creates YTextEvent and calls observers.
Parameters:
Name Type Description transactionTransaction parentSubsSet.<(null|string)> Keys changed on this type.
nullif list was modified. -
_integrate(y, item)
-
Parameters:
Name Type Description yDoc itemItem -
_write(encoder)
-
Parameters:
Name Type Description encoderAbstractUpdateEncoder -
applyDelta(delta, optsopt)
-
Apply a Delta on this shared YText type.
Parameters:
Name Type Attributes Description deltaany The changes to apply on this element.
optsobject <optional>
Properties
Name Type Attributes Description sanitizeboolean <optional>
Sanitize input delta. Removes ending newlines if set to true.
-
delete(index, length)
-
Deletes text starting from an index.
Parameters:
Name Type Description indexnumber Index at which to start deleting.
lengthnumber The number of characters to remove. Defaults to 1.
-
format(index, length, attributes)
-
Assigns properties to a range of text.
Parameters:
Name Type Description indexnumber The position where to start formatting.
lengthnumber The amount of characters to assign properties to.
attributesTextAttributes Attribute information to apply on the text.
-
insert(index, text, attributesopt)
-
Insert text at a given index.
Parameters:
Name Type Attributes Description indexnumber The index at which to start inserting.
textString The text to insert at the specified position.
attributesTextAttributes <optional>
Optionally define some formatting information to apply on the inserted Text.
-
insertEmbed(index, embed, attributes)
-
Inserts an embed at a index.
Parameters:
Name Type Description indexnumber The index to insert the embed at.
embedObject The Object that represents the embed.
attributesTextAttributes Attribute information to apply on the embed
-
toDelta(snapshotopt, prevSnapshotopt, computeYChangeopt) → {any}
-
Returns the Delta representation of this YText type.
Parameters:
Name Type Attributes Description snapshotSnapshot <optional>
prevSnapshotSnapshot <optional>
computeYChangefunction <optional>
Returns:
any -The Delta representation of this type.
-
toJSON() → {string}
-
Returns the unformatted string representation of this YText type.
Returns:
string -
toString()
-
Returns the unformatted string representation of this YText type.