diff --git a/src/types/YText.js b/src/types/YText.js index e02b2514..a1fa1eb3 100644 --- a/src/types/YText.js +++ b/src/types/YText.js @@ -989,11 +989,12 @@ export class YText extends AbstractType { * @param {TextAttributes} [attributes] Optionally define some formatting * information to apply on the inserted * Text. + * @return {YText} Instance of the YText. * @public */ insert (index, text, attributes) { if (text.length <= 0) { - return + return this } const y = this.doc if (y !== null) { @@ -1009,6 +1010,7 @@ export class YText extends AbstractType { } else { /** @type {Array} */ (this._pending).push(() => this.insert(index, text, attributes)) } + return this } /** @@ -1041,12 +1043,13 @@ export class YText extends AbstractType { * * @param {number} index Index at which to start deleting. * @param {number} length The number of characters to remove. Defaults to 1. + * @return {YText} Instance of the YText. * * @public */ delete (index, length) { if (length === 0) { - return + return this } const y = this.doc if (y !== null) { @@ -1057,6 +1060,7 @@ export class YText extends AbstractType { } else { /** @type {Array} */ (this._pending).push(() => this.delete(index, length)) } + return this } /** @@ -1066,12 +1070,13 @@ export class YText extends AbstractType { * @param {number} length The amount of characters to assign properties to. * @param {TextAttributes} attributes Attribute information to apply on the * text. + * @return {YText} Instance of the YText. * * @public */ format (index, length, attributes) { if (length === 0) { - return + return this } const y = this.doc if (y !== null) { @@ -1085,6 +1090,7 @@ export class YText extends AbstractType { } else { /** @type {Array} */ (this._pending).push(() => this.format(index, length, attributes)) } + return this } /**