Assign CSS class to editor dialog

Assign CSS class to editor dialog

mguinnessmguinness Posts: 85Questions: 12Answers: 1

This question is along the same lines as Assign an CSS ID/class to bootstrap modal.

It's necessary to assign a class to the editor main modal as sometimes I have multiple editors per page and they need different styling. I'm currently using the open event to add a custom class to the editor.

 .on('open', function (e, mode, action) {
    $('div.DTE').addClass('DTED_Stacked');
})

I'm unsure if there is a better way, but it works for me right now. However it would be a nice addition to have a className option added to core options. Thoughts?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    Answer ✓

    The only change I would suggest is to use displayNode() to get the display element rather than div.DTE. It will basically do the same thing though.

    The other thing to mention would be that you might need to remove classes that were previously added by other event handlers.

    Allan

  • mguinnessmguinness Posts: 85Questions: 12Answers: 1

    Thanks for the link to displayNode which worked as described. Maybe for the next version you could add a className option to avoid relying on an event and to also manually remove existing classes.

This discussion has been closed.