When tinymce is loaded in the head and before dom, everything works fine. However, if I attempt to load the JavaScript with ajax using jquery.getScript()
, it doesn't work.
I initialize tinymce when the user clicks the content area, so the dom must be ready at that point.
I want to make it work without changing tinymce's code and not in the head tag, as the script is quite large (about 65kb gzipped). Here is my current code:
window.tab_offers.show_edit = function() {
if (init == true) {
tinymce.execCommand('mceToggleEditor', false, 'offers-tab-content');
} else {
tinyMCE.init({
mode : "exact",
elements: "offers-tab-content",
language : window.PAGE_LANG,
theme : "advanced",
content_css: site_url('css/parim/tinymce.css'),
plugins : "autoresize",
width: $('#offers-tab-content').width() + 18,
theme_advanced_buttons1 : "cancelforecolor,backcolor,separator,bold,italic,underline,strikethrough,separator,bullist,numlist,separator,undo,redo,separator,hr,removeformat,separator,charmap,separator,link,unlink",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : ""
});
init = true;
}
};