I have a TinyMCE editor that I need to add a tag to in its doncument’s head. I have this working by adding
$(tinyMCE.activeEditor.getDoc()).children().find('head').append('<base href=\"TheURL\">');
to a init_instance_callback function. When I inspect the DOM, I see that it was added properly. Any images I add to the editor now use the new base information. The issue is any existing items that were loaded into the editor do not use it as they already “errored” out before the base tag was added.
Any ideas how to add the tag before the document is loaded, or how to reload the document with the base tag in place?
Thanks,
Try to use the onBeforeSetContent event. This way the base-tag gets added before the editor gets filled with the initial content. You may want to set a global variable to true if the base-tag has been added in order to check for it and to add it only once and not on every onBeforeSetContent event.