2013-05-04 80 views
0

在找到调整我的tinyMCE实例(它们是只读)的解决方案后。我面对的是,当我初始化 TinyMCE的一切都OK,我不能从小时解决......一个问题,但在的Internet Explorer早期版本的Chrome这不起作用TinyMCE iframe调整大小后出现跨浏览器问题

tinyMCE.init({ 
     mode: "textareas", 
     theme: "advanced", 
     readonly: true, 
     theme_advanced_path: false, 
     theme_advanced_resize_horizontal: false, 
     autoresize: true, 
     width: "870", 
     setup: function(ed) { 
      ed.onLoadContent.add(function(ed, o) { 
       var iFrameID = "#" + ($(this).attr('id')) + "_ifr"; 
       $(iFrameID).height($(iFrameID).contents().find("html").height()); 
       //iFrameID.height = iFrameID.contentWindow.document.body.scrollHeight + "px"; 
      }); 
     } 
    }); 

另外我的Java脚本尝试是低于jQuery也不起作用。 如果有人得到解决方案,我会更高兴!提前致谢!

+0

为什么不使用[ckeditor](http://ckeditor.com)? – 2013-05-04 13:17:55

+1

这不是我的问题的解决方案! – cyrat 2013-05-04 13:20:47

+0

你检查了控制台的错误吗?你对“不工作”意味着什么?为什么标题报告跨域问题? – 2013-05-04 13:21:04

回答

0

这里是配置,为我工作!

tinyMCE.init({ 
      mode: "textareas", 
      theme: "advanced", 
      theme_advanced_path: false, 
      theme_advanced_resize_horizontal: false, 
      autoresize: true, 
      readonly: true, 
      width: "870", 
      plugins: 'autoresize', 
      autoresize_min_height: "200", 
      autoresize_max_height: "50000", 
      init_instance_callback: function(inst) { 
       inst.execCommand('mceAutoResize'); 
      }, 
      setup: function(ed) { 
       ed.onLoadContent.add(function(ed, o) { 
        var iFrameID = "#" + ($(this).attr('id')) + "_ifr"; 
        $(iFrameID).contents().find("html").children().append("<base target=_blank>"); 

        //The following row not works in IE - $(iFrameID).height($(iFrameID).contents().find("html").height()); 
       }); 
      } 
     });