ytext = new Y.Text(initialContent): Y.TextCreate an instance of Y.Text with existing content.
ytext.doc: Y.Doc | null(readonly) The Yjs document that this type is bound to. Is
nullwhen it is not bound yet.
ytext.parent: Y.AbstractType | null(readonly) The parent that holds this type. Is
ytextis a top-level type.
ytext.toString().length === ytext.length.
ytext.insert(index: number, content: String[, format: Object<string,any>])Insert content at a specified
index. Optionally, you may specify formatting attributes that are applied to the inserted string. By default, the formatting attributes before the insert position will be used.
ytext.format(index: number, length: number, format: Object<string,any>)Assign formatting attributes to a range of text.
ytext.applyDelta(delta: Delta)Apply a Text-Delta to the Y.Text instance.
ytext.delete(index: number, length: number)Delete
lengthcharacters starting from
ytext.toString(): StringRetrieve the string-representation (without formatting attributes) from the Y.Text instance.
ytext.toJSON(): StringRetrieves the string representation of the Y.Text instance.
ytext.clone(): Y.TextClone this type into a fresh Y.Text instance. The returned type can be included into the Yjs document.
ytext.observe(function(YTextEvent, Transaction))Registers a change observer that will be called synchronously every time this shared type is modified. In the case this type is modified in the observer call, the event listener will be called again after the current event listener returns.
ytext.unobserve(function)Unregisters a change observer that has been registered with
ytext.observeDeep(function(Array<Y.Event>, Transaction))Registers a change observer that will be called synchronously every time this type or any of its children is modified. In the case this type is modified in the event listener, the event listener will be called again after the current event listener returns. The event listener receives all Events created by itself or any of its children.
ytext.unobserveDeep(function)Unregisters a change observer that has been registered with