Custom button in Editor Bubble

Custom button in Editor Bubble

abarnesabarnes Posts: 16Questions: 5Answers: 0

Is there a way to add a custom button in an editor.bubble? For example a button that says generate that jquery could generate a random string and put it in the edit box?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin
    Answer ✓

    The buttons() method can be used with the bubble() method. Indeed you can even pass in button options:

    $('#myTable').on( 'click', 'tbody td:first-child', function () {
        editor.bubble( this, [ 'first_name', 'last_name' ], {
          buttons: [
            'submit',
            {
              text: 'Random string in first name',
              action: function () {
                editor.field('first_name').val('generate a random string here');
              }
           }
        ]
      } );
    } );
    

    Allan

  • abarnesabarnes Posts: 16Questions: 5Answers: 0

    Awesome. Thanks again.

This discussion has been closed.