当tinymce在head中并且在dom之前加载时,一切都是正常的。但是,如果我尝试使用ajax(jquery.getScript())加载javascript,它不能工作。当用户点击内容区域时,我初始化tinymce,所以dom必须准备好。我想让它在不改变tinymce代码和head标签的情况下工作,因为脚本大约是65kb(gzipped)。我的代码如下所示:
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;
}
};发布于 2012-03-05 19:32:31
找到了问题所在。Tinymce试图从脚本标记中获取"baseURL“,但如果我将其动态加载,则没有匹配。它遍历页面上的每个脚本元素并进行检查,如下所示:/tiny_mce(|_gzip|_jquery|_prototype|_full)(_dev|_src)?.js/.test(n.src)。所以我就像这样覆盖了baseURL参数: tinyMCE.baseURL = "http://mysite.com/path_to_tinymce/";tinyMCE.init({ ...,... });
https://stackoverflow.com/questions/9564572
复制相似问题