TinyMCE autoresize:也想调整container div的大小
我正在使用 Jquery TinyMCE(TinyMCE 3.4.3.1 jQuery 包),并且我想自动调整编辑器的大小。为此,我使用自动调整大小插件(插件:“自动调整大小”...)。我的问题是我有一个用于左面板的 div,而 tinymce 正在加载到右侧的 div 中。调整大小后,我还需要调整这 2 个 div 的高度。我试过这个,
var resize_template_layout = function(){
if ( parseInt(textarea_h) >0 ) {
var maindiv_h = parseInt($("div[rel=resizeMain]").css("height"));
var tmce_h = parseInt($("#content_msg_tbl").attr("offsetHeight"));
alert("textarea="+textarea_h+"\nmaindiv="+maindiv_h+"\ntmce="+tmce_h);
h1 = parseInt(maindiv_h - tmce_h);
h2 = parseInt((tmce_h - textarea_h))-h1;
$("div[rel=resizeMain]").css("height",(maindiv_h+h2)+'px');
$("div[rel=resize]").each(function(){
var h_whiteDiv = parseInt($(this).css("height"));
$(this).css("height",(h2+h_whiteDiv)+'px');
});
}}
只有当我在所有事情完成并且页面加载完成后,从单击事件或从 Firefox 控制台调用它时,这才有效。但如果我把它放在 onInit 中,它就不起作用。 textarea_h是首先显示的textarea,并且有WYSWYG链接来显示tinymce,因此用户可以在textraea和tinymce之间切换。
我想做的是,当我显示tinymce时,我会得到编辑器的高度,并调整div的高度,当我切换回文本区域时,我会恢复到之前的高度。这可能吗?
I am using the Jquery TinyMCE (TinyMCE 3.4.3.1 jQuery package), and I want to auto resize the editor. For that I am using the autoresize plugin(plugins : "autoresize"...). My problem is I have a div for left panel and the tinymce is getting loaded in a div on the right. after resizing, I need to resize these 2 divs also, heightwise. I tried this
var resize_template_layout = function(){
if ( parseInt(textarea_h) >0 ) {
var maindiv_h = parseInt($("div[rel=resizeMain]").css("height"));
var tmce_h = parseInt($("#content_msg_tbl").attr("offsetHeight"));
alert("textarea="+textarea_h+"\nmaindiv="+maindiv_h+"\ntmce="+tmce_h);
h1 = parseInt(maindiv_h - tmce_h);
h2 = parseInt((tmce_h - textarea_h))-h1;
$("div[rel=resizeMain]").css("height",(maindiv_h+h2)+'px');
$("div[rel=resize]").each(function(){
var h_whiteDiv = parseInt($(this).css("height"));
$(this).css("height",(h2+h_whiteDiv)+'px');
});
}}
This only works if i call it after every thing is done and page load is complete, from an click event, or from console of firefox. But if I put this in the onInit, it doesnot work. The textarea_h is the textarea that is first displayed, and there is WYSWYG link to show the tinymce, so user can toggle between textraea and tinymce.
What I want to do is that when I show the tinymce I get the height of the editor and I adjust the height of the divs, and when i toggle back to the textarea, i revert back to previous heights. Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论