node_modules/y-codemirror/dist/demo.js
/**
     * Insert text at a given index.
     *
     * @param {number} index The index at which to start inserting.
     * @param {String} text The text to insert at the specified position.
     * @param {TextAttributes} [attributes] Optionally define some formatting
     *                                    information to apply on the inserted
     *                                    Text.
     * @public
     */
Insert text at a given index.
@param {number} index The index at which to start inserting.
@param {String} text The text to insert at the specified position.
@param {TextAttributes} [attributes] Optionally define some formatting
information to apply on the inserted
Text.
@public
Insert text at a given index . @param { number } index The index at which to start inserting . @param { String } text The text to insert at the specified position . @param { TextAttributes } [ attributes ] Optionally define some formatting information to apply on the inserted Text . @public
insert (index, text, attributes) {
      if (text.length <= 0) {
        return
      }
      const y = this.doc;
      if (y !== null) {
        transact(y, transaction => {
          const pos = findPosition(transaction, this, index);
          if (!attributes) {
            attributes = {};
            pos.currentAttributes.forEach((v, k) => { attributes[k] = v; });
          }
          insertText(transaction, this, pos, text, attributes);
        });
      } else {
         (this._pending).push(() => this.insert(index, text, attributes));
      }
    }
insert ( index , text , attributes ) { if ( text . length <= 0 ) { return } const y = this . doc ; if ( y !== null ) { transact ( y , transaction => { const pos = findPosition ( transaction , this , index ) ; if ( ! attributes ) { attributes = { } ; pos . currentAttributes . forEach ( ( v , k ) => { attributes [ k ] = v ; } ) ; } insertText ( transaction , this , pos , text , attributes ) ; } ) ; } else { ( this . _pending ) . push ( ( ) => this . insert ( index , text , attributes ) ) ; } }
Insert text at a given index.
Insert text at a given index .
// @ts-ignore /** @type {Array<function>} */