TinyMCE 编辑器固定大小且没有滚动条?
目前我有这个:
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 的编辑器。
现在在这个编辑器中,我想这样做你只能写,直到编辑器满为止。 (没有滚动条)
所以您无法输入更多文本,并且滚动条不应出现(禁用滚动)
现在您可以在编辑器内部的底部创建新行,它将添加滚动条 <- 我不希望发生
这种情况我该怎么办?这不可能吗?我已经研究了一段时间了,但也许只是我搜索错误..
谢谢
At the moment I have this:
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
});
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..
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在ccs文件中添加以下代码
,并在tinymce的content_css属性中添加css文件的路径
add in a ccs file the following code
and add the path of css file in content_css attribut of tinymce
您将需要编写一个自己的插件。检查每次击键的编辑器高度(您可以使用内置的tinymce事件
onKeyUp
)。如果高度发生变化,请删除最后插入的代码。编辑:如何获取当前编辑器 iframe 高度
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.EDIT: Howto get the current editor iframe heigth
我通过将其添加到我的额外的tinyMCE CSS文件中来使其工作:
以前,滚动条仅在Firefox中关闭。这也修复了 Chrome 的问题。但是,它确实在底部滚动条的一侧添加了一个灰色条,因此我需要放大文本编辑器的高度。
I got it to work by adding this to my extra tinyMCE CSS file:
Previously, the scrollbars were only off in Firefox. This fixes it for Chrome as well. However, it does add a gray bar the side of a scrollbar at the bottom, so I need to enlarge the height of my text editor.
对我来说,它只需向常规样式表添加规则即可工作,不需要将 css 文件添加到
content_css
属性(示例位于 scss 中)for me it worked by just adding rules to a regular stylesheet, it wasn't needed to add a css file to
content_css
attribute (example is in scss)更简单和容易的解决方案是:
解释:
在 Init 中回调获取 TinyMCE 的主体并根据需要更改样式。
在本例中要删除滚动条
overflow = 'hidden'
。A lot simpler and easy solution would be:
Explanation:
In Init callback get the body for TinyMCE and change style as required.
In this case to remove scrollbar
overflow = 'hidden'
.