Mister Verleg
Mister Verleg

Reputation: 4303

Is it possible to add a class to a custom tinyMCE button?

I have a a webpage in which i use jQuery UI and tinyMCE in combination. I have added a custom button with the intention to use this button to drag a draggeble textfield:

image of button

the code:

editor.addButton('drag', {
                text: 'Drag',
                icon: false,
                onclick: function() {
                // somehow add the class '.handle' to the drag button
                }
            });
        }

Can i add a class ".handle" to the custom tinyMCE drag button? or is this not posible.

Upvotes: 5

Views: 583

Answers (1)

Jeff Meatball Yang
Jeff Meatball Yang

Reputation: 39027

You can add a subtype property to the settings.

That will append a class with the name mce-[subtype].

Refer to this codepen

Upvotes: 3

Related Questions