【问题标题】:Cross browser issue with TinyMCE iframe resizeTinyMCE iframe调整大小的跨浏览器问题
【发布时间】:2013-04-28 18:55:32
【问题描述】:

在我找到了调整 tinyMCE 实例大小的解决方案之后(它们是只读的)。我遇到了几个小时都无法解决的问题...当我 init 时,tinyMCE 一切正常,但在 Internet Explorer 和早期版本的 Chrome 中 这不起作用

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

另外,我在 jQuery 之下的 Java Script 尝试也不起作用。 如果有人对此有解决方案,我将非常高兴!提前致谢!

【问题讨论】:

  • 为什么不用ckeditor
  • 这不是我的问题的解决方案!
  • 您检查控制台是否有错误? “不工作”是什么意思?为什么标题报告跨域问题?
  • 对不起...我的意思是跨浏览器(现在已编辑)不起作用意味着在 IE 和早期版本的 Chrome 中,iFrame 不会调整大小。而且我找不到适用于每个浏览器的解决方案...
  • @vishalsharma:是的,但这使用户可以调整窗口大小。在这里,编辑器将在没有任何用户操作的情况下调整 oninit 的大小

标签: javascript jquery tinymce


【解决方案1】:

这是对我有用的配置!

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-10-12
    • 2014-08-30
    • 1970-01-01
    • 2011-10-04
    • 1970-01-01
    • 2011-11-19
    • 1970-01-01
    • 2019-06-24
    相关资源
    最近更新 更多