delete(index, length) {
    if (length === 0) {
      return;
    }

    const y = this.doc;

    if (y !== null) {
      transact(y, transaction => {
        deleteText(transaction, findPosition(transaction, this, index), length);
      });
    } else {
      /** @type {Array<function>} */
      this._pending.push(() => this.delete(index, length));
    }
  }
Deletes text starting from an index.

@param {number} index Index at which to start deleting.
@param {number} length The number of characters to remove. Defaults to 1.

@public