目前我有这个:
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
});
Run Code Online (Sandbox Code Playgroud)
这给了我一个大小为 300x185 的编辑器。
现在在这个编辑器中,我想这样做你只能写到编辑器满了。(没有滚动条)
因此您无法输入更多文本,并且不应出现滚动条(禁用滚动)
现在,您可以在编辑器内部的底部创建新行,它将添加滚动条 <- 我不想发生
我怎样才能做到这一点?这是不可能的吗?我已经研究了一段时间了,但也许只是我找错了..
谢谢
您将需要编写一个自己的插件。检查每次击键的编辑器高度(您可以使用内置的tinymce事件onKeyUp)。如果高度发生变化,请删除最后插入的代码。
编辑:如何获取当前编辑器 iframe 高度
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;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11482 次 |
| 最近记录: |