这是我的剧本:
$.ajaxSetup({async: false});
$.getScript('http://www.mydomain.com/dev/js/tinymce/tiny_mce.js', function(){
tinyMCE.init({
document_base_url : "http://www.mydomain.com/dev/js/tinymce/",
[...],
});
});
$.ajaxSetup({async: true});
它加载tiny_mce.js成功。但是当init在回调中使用时,在跟踪脚本不正确的情况下加载2:
http://www.mydomain.com/dev//langs/en.js
http://www.mydomain.com/dev//themes/advanced/editor_template.js
即使我使用了document_base_url,仍然会在路径上加载。
答案 0 :(得分:6)
我也遇到了这个问题,经过一天的工作后,我找到了一个解决方案,只需在tinymce.init()
方法之前添加此代码:
tinymce.dom.Event.domLoaded = true;
这对我的情况有用,也可能对你有帮助。
答案 1 :(得分:5)
我解决了这里写的问题:http://tinymce.moxiecode.com/forum/viewtopic.php?pid=23065#p23065
我通过jQuery动态加载tinyMCE的脚本现在是:
// JS_FOLDER = "http://mydomain.com/js"
function initTinyMCE(JS_FOLDER, selector)
{
var path = JS_FOLDER + '/GlobalUI/tinymce';
if (selector == undefined) selector = 'mceEditor';
var initFunct = function() {
tinyMCE.baseURL = path + '/jscripts/tiny_mce/'; // THE IMPORTANT LINE
tinyMCE.init({
mode: "specific_textareas",
editor_selector: selector,
width : "700px",
theme: "advanced",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,undo,redo,|,bullist,numlist,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect,forecolor,backcolor",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_resizing : true,
// Example content CSS (should be your site CSS)
content_css : path + "/css/custom_css.css"
});
}
if(typeof tinyMCE == "undefined") {
$.getScript(path + '/jscripts/tiny_mce/tiny_mce_src.js', function() {
initFunct();
});
} else {
initFunct();
}