通过使用jQuery按需加载tinymce [英] load tinymce on demand by using jquery
本文介绍了通过使用jQuery按需加载tinymce的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的脚本:
$.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.但是在回调中初始化tinymce时,tinymce会加载以下两个路径错误的脚本:
It load tiny_mce.js success. But when init tinymce in callback, tinymce load 2 following scripts with incorrect path:
http://www.mydomain.com/dev//langs/en.js
http://www.mydomain.com/dev//themes/advanced/editor_template.js
无论我是否使用document_base_url,tinymce仍会在路径上方加载.
Even I use document_base_url or not, tinymce still load above path.
推荐答案
我也遇到了麻烦,经过一天的工作,我找到了一个解决方案,只需将此代码添加到您的tinymce.init()
方法之前:
i am having this trouble too, after a day's work , i found a solution , just add this code before your tinymce.init()
method:
tinymce.dom.Event.domLoaded = true;
这可以解决我的情况,也许对您有帮助.
this would work on my case, may this help you too.
有关更多详细信息,请参见此处: tiny mce can动态加载js时不会被初始化
see here for more detail:tiny mce can't be inited when load js dynamically
这篇关于通过使用jQuery按需加载tinymce的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文