TinyMCE width and height disobedient!

前端 未结 12 1003
自闭症患者
自闭症患者 2020-12-14 08:09

According to the (conflicting) documentation of TinyMCE, the editor takes on the size of the textarea (or other) element that it replaces. It also says that you can set the

12条回答
  •  一生所求
    2020-12-14 08:28

    Yes, this is very annoying. I wrote my own function to adjust the height to the given input. You may modify it to set your height/width as you wish:

        resizeIframe: function(frameid) {
            var frameid = frameid ? frameid : this.editor.id+'_ifr';
            var currentfr=document.getElementById(frameid);
    
            if (currentfr && !window.opera){
                currentfr.style.display="block";
                if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) { //ns6 syntax
                    currentfr.height = currentfr.contentDocument.body.offsetHeight + 26;
                }
                else if (currentfr.Document && currentfr.Document.body.scrollHeight) { //ie5+ syntax
                        currentfr.height = currentfr.Document.body.scrollHeight;
                }
                styles = currentfr.getAttribute('style').split(';');
                for (var i=0; i

提交回复
热议问题