I was previously lamenting the fact that in the 5.x TinyMCE, you can’t specify a class on your toolbar button like you could in 4.x. Since there were several that are added by custom code and are then manipulated in some way (JS or CSS), I didn’t quite know how to proceed. Reading the issues for something else, I came across one where people were asking for the class parameter (as if it had never been there), and the response in 2019 was that they removed it intentionally so the UI is more consistent. It sounds as if it was a problem with their cloud version since they have to support whatever people do, so they limit what they can do.
One person commented with some code to add your class when you create the button, by doing a
find on a temp class you put in the
text parameter and then call
closest to get the button and add the class, and remove the temp text node. It’s pretty hacky, but something I was considering before this. Then I noticed that the function they used
tinymce.dom.DomQuery was deprecated in 5.10, to be removed in 6.0. It can still be done with vanilla JS, but really I wonder if 5.x is better in any way than 4.x.
About the same time I was reading the issues, someone commented on the WP ticket for the 5.x update, saying that 5.10 fixed a security issue present in all prior versions. But it’s only present while editing, so it likely doesn’t really affect the admin page. Also, it affects the
image plugins. We don’t use
link (there is
wplink) and the
image plugin is loaded, but there are custom interfaces being used. So I think it isn’t super important.
This wouldn’t apply to plugins that bundle TinyMCE (there are a lot!) or use the editor on the front end.