insertAtCursor(insert) {
    const textarea = this.$('textarea')[0];
    const value = this.value();
    const index = textarea ? textarea.selectionStart : value.length;

    this.setValue(value.slice(0, index) + insert + value.slice(index));

    // Move the textarea cursor to the end of the content we just inserted.
    if (textarea) {
      const pos = index + insert.length;
      this.setSelectionRange(pos, pos);
    }

    textarea.dispatchEvent(new CustomEvent('input', {bubbles: true, cancelable: true}));
  }
/**
   * Insert content into the textarea at the position of the cursor.
   *
   * @param {String} insert
   */
Insert content into the textarea at the position of the cursor.
@param {String} insert
Insert content into the textarea at the position of the cursor . @param { String } insert
insertAtCursor(insert) {
    const textarea = this.$('textarea')[0];
    const value = this.value();
    const index = textarea ? textarea.selectionStart : value.length;
    this.setValue(value.slice(0, index) + insert + value.slice(index));
    if (textarea) {
      const pos = index + insert.length;
      this.setSelectionRange(pos, pos);
    }
    textarea.dispatchEvent(new CustomEvent('input', {bubbles: true, cancelable: true}));
  }
insertAtCursor ( insert ) { const textarea = this . $ ( 'textarea' ) [ 0 ] ; const value = this . value ( ) ; const index = textarea ? textarea . selectionStart : value . length ; this . setValue ( value . slice ( 0 , index ) + insert + value . slice ( index ) ) ; if ( textarea ) { const pos = index + insert . length ; this . setSelectionRange ( pos , pos ) ; } textarea . dispatchEvent ( new CustomEvent ( 'input' , { bubbles : true , cancelable : true } ) ) ; }
Insert content into the textarea at the position of the cursor.
Insert content into the textarea at the position of the cursor .
// Move the textarea cursor to the end of the content we just inserted.