问题描述
目前我有这个:
tinyMCE.init({
// General options
mode : "exact",
elements : "fkField, lkField, ukcField, khField",
theme : "advanced",
plugins : "table",
width : "300",
height: "185",
// Theme options
theme_advanced_buttons1 : "fontsizeselect, bold,italic,underline,bullist, cleanup, |,justifyleft,justifycenter,justifyright",
theme_advanced_buttons2 : "tablecontrols",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "bottom",
theme_advanced_toolbar_align : "center",
theme_advanced_resizing : false
});
这给了我一个300x185大小的编辑器。
This gives me a editor with the size of 300x185.
现在在此编辑器中,我想这样做,您只能在编辑器装满之前编写。 (没有滚动条)
Now in this editor, I would like to do so you can only write until the editor is full. (without the scroller)
因此您将无法输入更多文本,并且滚动条也不应出现(禁用滚动条)
So you are unable to enter more text, and the scroller should not appear (disable scrolling)
现在您可以在编辑器内部的底部进行新行,它将添加滚动条<-我不想发生
Right now you can at the bottom of inside the editor just make new line and it will add the scroller <- which i do not want to happen
我怎样才能做到这一点?这是不可能的吗?我已经进行了一段时间的研究,但也许只是我搜索错误。.
How can i do this? Is this unpossible? I have made research for some time now, but maybe it's just me searching wrong..
谢谢
推荐答案
您将需要编写自己的插件。检查每个击键的编辑器高度(您可以使用内置的tinymce事件 onKeyUp
)。如果高度改变,则删除最后插入的代码。
You will need to write an own plugin. Check the editor height on each Keystroke (you may use the built in tinymce event onKeyUp
). If the heigth changes remove the last inserted code.
编辑:如何获取当前编辑器iframe高度
Howto get the current editor iframe heigth
var currentfr=document.getElementById(editor.id + '_ifr');
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;
}
这篇关于TinyMCE编辑器固定大小,没有滚动条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!