insertEmbed(index, embed, attributes = {}) {
    const y = this.doc;

    if (y !== null) {
      transact(y, transaction => {
        const pos = findPosition(transaction, this, index);
        insertText(transaction, this, pos, embed, attributes);
      });
    } else {
      /** @type {Array<function>} */
      this._pending.push(() => this.insertEmbed(index, embed, attributes));
    }
  }
Inserts an embed at a index.

@param {number} index The index to insert the embed at.
@param {Object | AbstractType<any>} embed The Object that represents the embed.
@param {TextAttributes} attributes Attribute information to apply on the
                                   embed

@public