问题
As most of you know, Firefox 11 update was released few days ago. After the release I was notified that there was some strange behavior in our web app. We have multiple instances of TinyMCE on a single page and only the first instance works as it should. The other instances don't seem to be editable to the naked eye, but in fact changes made to the "other" instances will be saved on submit.
After a nice google session I noticed other people had this same problem but in most cases the solution was to update Tiny to 3.5b2 (I'm currently using 3.37), or removing/adding some plugins. Neither worked for me.
I also noticed that when Tiny is manually resized, the text gets rendered and the resized instance works fine.
Anyone?
UPDATE: I made a fresh web page with multiple instances (ver. 3.5b2) and everything worked perfectly on FF11. The problem seems to be somewhere else in our web app. I will post this as an answer in a few hours.
回答1:
Add this script just before body tag closing
jQuery(window).load( function() {
jQuery(".mceEditor .mceLayout").each(function(i,ele){
jQuery("#"+ele.id).css('width',jQuery("#"+ele.id).width()+10)
});
});
回答2:
solution without jquery
try {
function addEvent(obj, evType, fn){
if (obj.addEventListener){
obj.addEventListener(evType, fn, false);
return true;
} else if (obj.attachEvent){
var r = obj.attachEvent("on"+evType, fn);
return r;
} else {
return false;
}
}
addEvent(window, 'load', function() {
var divs = document.getElementsByClassName('mceEditor');
for (d in divs) {
var iframes = divs[d].getElementsByTagName('iframe');
for (i in iframes) {
iframes[i].style.width = iframes[i].style.width = '500px';
}
}
}
);
} catch(err) {}
回答3:
This is my solution for my 3.3.9.3 (thanks Thomas for your input):
$(window).load(function(){
$('.mceEditor').hover(function(){
el = $('.mceFirst iframe');
el_w = el.width();
el.css("width",el_w+1);
el.css("width",el_w-1);
});
});
回答4:
I made a fresh web page with multiple instances (ver. 3.5b2) and everything worked perfectly on FF11. The problem seems to be somewhere else in our web app.
来源:https://stackoverflow.com/questions/9837629/tinymce-and-firefox-11