Yossi
Yossi

Reputation: 1056

Using the default image button for a TinyMCE plugin

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);

Upvotes: 1

Views: 2310

Answers (2)

bang
bang

Reputation: 5221

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"
        });

Upvotes: 0

Thariama
Thariama

Reputation: 50832

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.

Upvotes: 2

Related Questions