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

    const y = this.doc;

    if (y !== null) {
      transact(y, transaction => {
        const pos = findPosition(transaction, this, index);

        if (pos.right === null) {
          return;
        }

        formatText(transaction, this, pos, length, attributes);
      });
    } else {
      /** @type {Array<function>} */
      this._pending.push(() => this.format(index, length, attributes));
    }
  }
Assigns properties to a range of text.

@param {number} index The position where to start formatting.
@param {number} length The amount of characters to assign properties to.
@param {TextAttributes} attributes Attribute information to apply on the
                                   text.

@public