TinyMCE框架调整大小的跨浏览器问题

Cross browser issue with TinyMCE iframe resize

本文关键字:浏览器 问题 框架 调整 TinyMCE      更新时间:2023-09-26

我找到了一个解决方案来调整我的tinyMCE实例的大小(它们是只读的)。我遇到了一个问题,几个小时都解决不了。当我init tinyMCE一切都是OK的,但在Internet ExplorerChrome的早期版本这不起作用

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也不工作。如果有人能解决这个问题,我会很高兴的!提前感谢!

这是我工作的配置!

 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());
                });
            }
        });