Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a custom button to add text to tinymce editor

Tags:

tinymce

I want a button in tinymce toolbar. On click of that button "HELLO" should come in the editor wherevere the cursor is.

Version:3.3.7

But I am not able to add that button.

I have tried adding button like this

setup: function (ed) {
    ed.addButton('example', {
         title : 'example.desc',
         image : '../jscripts/tiny_mce/plugins/example/img/example.gif',
         onclick : function() {
            ed.windowManager.alert('Hello world!! Selection: ' + ed.selection.getContent({format : 'text'}));
         }
      });
    }
like image 871
Veer Avatar asked Aug 16 '13 13:08

Veer


1 Answers

Don't forget to add your button to the toolbar option when initializing.

http://fiddle.tinymce.com/ngdaab/0

like image 154
MTVS Avatar answered Sep 29 '22 18:09

MTVS