I’m attempting to automatically add a class to all links created when clicking the “link” button in tinyMCE. I’ve found this snippet in the tinyMCE docs:
// Adds a class to all paragraphs in the active editor
tinyMCE.activeEditor.dom.addClass(tinyMCE.activeEditor.dom.select('p'), 'myclass');
I think this will be what I need if I change it to apply to anchors.
Question 1: Think this will work? Know of a better way to do it?
Question 2: How and where do I add this snippet to my theme? The theme I’m working with has a tinyMCE folder in the functions directory.
Thanks!
So I ended up doing a jQuery fix rather than going through tinyMCE. Code as follows: