2013-05-04 56 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()); 
       }); 
      } 
     });