I'm on WP 4.6, which has tinyMCE 4. I need to make the contents of my post editor visual tab more WYSIWYG. I'm attaching a CSS file containing my front end styles to the editor using add_editor_style
. But for the contents of the editor to take on many of those styles I also need to wrap them in a couple of HTML tags - divs with particular classes.
The tinyMCE documentation is a bit better than it used to be, but it's still a nightmare trying to figure out how to grab the content and wrap it when tinyMCE inits. I'm trying this test to append a string to the content:
tinymce.init({
selector: 'textarea#content.wp-editor-area',
setup : function(ed) {
ed.on('BeforeSetContent', function(event) {
event.content += '????????????????????????????????????????';
});
}
});
But this doesn't seem to be selecting the tinyMCE instance of the main post editor. I can't find any documentation on what is supported for the selector
, and even whether it is necessary. Can anyone point me in the right direction?