TinyMCE 在 IE8 中出现故障/无法使用
我正在使用 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 和主题)会导致相同的症状
I'm using the jQuery version of TinyMCE 3.3.9.3
In firefox, it works fine (10 sec video depicting it in use): http://www.youtube.com/watch?v=TrAE0igfT3I
In IE8 (in IE8 standards mode), I can't type or click any buttons. However, if I use ctrl+v to paste, then I can start typing, but the buttons still don't work (a 45 sec video depicting it in use): http://www.youtube.com/watch?v=iBSRlE8D8F4
The jQuery TinyMCE demo on TinyMCE's site works for me in IE8.
Here's the init code:
$().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);
}
});
}
});
});
Any ideas as to why it's not working in IE8?
[edit]: stripping everything out of the init (leaving just script_url and theme) results in the same symptoms
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我已经有一段时间没有访问过这段代码了,所以更新到tinymce 3.4.4后我再次浏览了一遍。
事实证明,父 fieldset 元素同时应用了position:relative 和 z-index:-1。删除 z-index 属性后,tinymce 就可以正常工作了。
It's been a while since I visited this code, so I went through it again after updating to tinymce 3.4.4.
As it turns out, a parent fieldset element had both position:relative and z-index:-1 applied. Removing the z-index property then allowed tinymce to work properly.
如果不向特定的 html 元素添加控制,就不会有 tinymce 实例。
要么将模式从“exact”设置为“textareas”,要么必须使用tinymce.execCommand('mceAddControl',true, element_id);*将Control添加到元素
There will be no tinymce instance without adding control to a specific html element.
Eigther you set mode from "exact" to "textareas" or you will have to addControl to an element using
tinymce.execCommand('mceAddControl',true, element_id);*
也许为时已晚
我遇到了同样的问题。在 ie9 和ie7 一切正常,但在 ie8 中无法键入或单击
页面上的任何按钮是带有内联样式的“noscrpipt”标签(我知道,顺便说一句,ie8 和 noscript 中的背景样式存在错误)
,解决方案是 - 删除内联样式在 noscript 标签(或标签本身)中,tinymce 开始完美工作
may be it would be too late
i met same problem. in ie9 & ie7 everything ok, but in ie8 can't type or click any buttons
on page was "noscrpipt" tag with inline-styles (i know, there is bug with ie8 and background style in noscript btw)
and solution was - remove inline-style in noscript tag (or tag itself), and tinymce began working perfectly
初始化编辑器时,检查 URL 中是否有 #。很奇怪,但我因此遇到了一些问题。确保 URL 中没有 # 确实解决了一些与此类似的问题。希望它能和你一起成功。
Check if you have a # in your URL while the Editor is initialized. Strange but I got a few problems because of it. Making sure there is no # in URL did solve a couple of problems similar to this. Hope it works out with you.