1
votes

I created a plugin for TinyMCE, and I can't find a way to use the default "image" button.

Any ideas how to do that?

//init
ed.addButton('extimage', {
title : 'advimage.image_desc',
cmd : 'mceExtImage'
});
//later on
tinymce.PluginManager.add('extimage', tinymce.plugins.ExtImagePlugin);

This one talks about custom buttons: http://www.tinymce.com/wiki.php/API3:method.tinymce.Editor.addButton

Here's another clarification: http://www.tinymce.com/wiki.php/Buttons/controls "advlink" overrides the "link" button, and uses the exact same image. How can I make my plugin do the same to the "image" button?

From what I understand, this code should work (and it doesn't..):

ed.addButton('image', {
title : 'advimage.image_desc',
cmd : 'mceExtImage'
});
tinymce.PluginManager.add('extimage', tinymce.plugins.ExtImagePlugin);
2

2 Answers

2
votes

The pluginname does not have anything to do with your button. You will need to add extimage to your buttonconfig in order to be able to see the button in the tinymce UI.

0
votes

If you need to create a plugin that uses a standard icon or a sprited icon you use the 'class' property of the image settings. E.g:

        ed.addButton('myImageButton',
        {
            title: 'advimage.image_desc',
            cmd: 'myImageCommand',
            'class': "mce_image"
        });