我使用的是 TinyMCE 3.3.9.3 的 jQuery 版本
在 Firefox 中,它工作得很好(10 秒的视频描述了它的使用情况):http://www.youtube.com/watch?v=TrAE0igfT3I
在 IE8 中(在 IE8 标准模式下),我无法键入或单击任何按钮。但是,如果我使用 ctrl+v 进行粘贴,那么我可以开始输入,但按钮仍然不起作用(一个 45 秒的视频描述了它的使用情况):http://www.youtube.com/watch?v=iBSRlE8D8F4
TinyMCE 网站上的 jQuery TinyMCE 演示在 IE8 中适用于我。
这是初始化代码:
$().ready(function(){
function tinymce_focus(){
$('.defaultSkin table.mceLayout').css({'border-color' : '#6478D7'});
$('.defaultSkin table.mceLayout tr.mceFirst td').css({'border-top-color' : '#6478D7'});
$('.defaultSkin table.mceLayout tr.mceLast td').css({'border-bottom-color' : '#6478D7'});
}
function tinymce_blur(){
$('.defaultSkin table.mceLayout').css({'border-color' : '#93a6e1'});
$('.defaultSkin table.mceLayout tr.mceFirst td').css({'border-top-color' : '#93a6e1'});
$('.defaultSkin table.mceLayout tr.mceLast td').css({'border-bottom-color' : '#93a6e1'});
}
$('textarea.tinymce').tinymce({
script_url : 'JS/tinymce/tiny_mce.js',
theme : "advanced",
mode : "exact",
invalid_elements : "b,i,iframe,font,input,textarea,select,button,form,fieldset,legend,script,noscript,object,embed,table,img,a,h1,h2,h3,h4,h5,h6",
//theme options
theme_advanced_buttons1 : "cut,copy,paste,pastetext,pasteword,selectall,|,undo,redo,|,cleanup,removeformat,|",
theme_advanced_buttons2 : "bold,italic,underline,|,bullist,numlist,|,forecolor,backcolor,|",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "none",
theme_advanced_resizing : false,
//plugins
plugins : "inlinepopups,paste",
dialog_type : "modal",
paste_auto_cleanup_on_paste : true,
setup: function(ed){
ed.onInit.add(function(ed){
//check for addEventListener -- primarily supported by firefox only
var edDoc = ed.getDoc();
if ("addEventListener" in edDoc){
edDoc.addEventListener("focus", function(){
tinymce_focus();
}, false);
edDoc.addEventListener("blur", function(){
tinymce_blur();
}, false);
}
});
}
});
});
关于为什么它在 IE8 中不起作用有什么想法吗?
[编辑]:从 init 中剥离所有内容(仅留下 script_url 和主题)会导致相同的症状
最佳答案
我已经有一段时间没有访问过这段代码了,所以更新到tinymce 3.4.4后我再次浏览了一遍。
事实证明,父字段集元素同时应用了position:relative 和z-index:-1。删除 z-index 属性后,tinymce 就可以正常工作了。
关于jquery - TinyMCE 在 IE8 中出现故障/无法使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4523900/