【发布时间】:2012-04-28 23:38:42
【问题描述】:
我将 tinyMCE 库用于我的文本区域,也用于图像上传,但是当它们都在一个页面上时它不起作用。当它是其中之一时很好,但是只要我在页面上放置一个 tinyMCE 文本区域和一个启动 imagemanager 对话框的按钮,对话框就会加载,但旋转的加载图标只是继续运行,而不是从我的根路径。
在我的文件的开头我有:
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
editor_selector : "mceEditor",
editor_deselector : "mceNoEditor",
plugins : "style,advlink,inlinepopups,preview,contextmenu,paste,directionality,fullscreen,noneditable,imagemanager,media",
// Theme options
theme_advanced_buttons1 : "cut,copy,paste,pastetext,pasteword,|,undo,redo,|,link,unlink,code,|,fullscreen",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "bottom",
theme_advanced_toolbar_align : "center",
theme_advanced_resizing : false,
media_strict: false
});
这对我的 textareas 非常有用,然后使用 jQuery on document.ready() 我有以下上传内容:
$('.add_image_button').click(function(){
mcImageManager.open(''{
rootpath : '{0}/',
oninsert:function(o){
var location = o.focusedFile.path;
location = location.substr(4);
location = '_uploads/'+location;
var preview_image = '../' + location;
$('#selected_image > img').attr('src', preview_image);
$('#image_path').val(location);
}
});
return false;
});
如果我在页面上有一个 MCE 文本区域并按下我的上传图片按钮,我会收到以下 javascript 错误:
未捕获的类型错误:无法将属性“innerHTML”设置为 null - editor_plugin.js:1 未捕获的类型错误:无法调用未定义的方法 'getArgs' - index.php:1
我在 DOM 准备好后尝试了 tinyMCE.init(),但没有任何乐趣。
感觉可能是imagemanager之类的路径配置冲突。 有谁知道是否有办法查看根路径是否在 imagemanager 上以某种方式被搞砸了?
干杯
【问题讨论】:
-
关闭Imagemanager窗口再打开是否有效?
-
不,有时当我的页面上只有一个 imagemanager 按钮时,它会启动并且不会完全加载(当这种情况发生时,它看起来像是在做一些身份验证的事情),然后当我关闭并重新打开时这是固定的,但是当我有一个 textarea 时不会发生这种情况。
标签: javascript tinymce mcimagemanager