Digerkam
Digerkam

Reputation: 1921

Make TinyMCE "Context-Toolbar" Customizable

I am trying to customize context-toolbar which existing in editor area:

enter image description here

There is no information about it even in TinyMCE website,

How to customize that toolbar?

Upvotes: 1

Views: 964

Answers (1)

PrashanthBR
PrashanthBR

Reputation: 183

In Tinymce Init function, add a context toolbar to the required dom element and add custom buttons, like below:

tinymce.init({
         selector: '#main'
         , setup: function (main) {                
            main.addContextToolbar('span#content', 'editContent | deleteContent');//first parameter is the selector and second is a list of custom buttons list separated by pipe
            main.addButton('editContent', {
               icon: 'fa fa-pencil' //using font-awesome icons
               , tooltip: "Edit"
               , onclick: function (e) {
                  //Logic to make the content editable.
               }
            });
            main.addButton('deleteContent', {
               icon: 'fa fa-close' //using font-awesome icons
               , tooltip: "Delete"
               , onclick: function (e) {
                  //Logic to delete the content.
               }
            });
        }
    });

Upvotes: 2

Related Questions