我有一个 ckeditor,当前的高度和宽度为 auto,但我想固定这些参数。我首先尝试设置行和列,但这没有用:
<textarea id="editor1" name="editor1" rows="10" cols="10">
Example text goes here
</textarea>
然后我尝试将配置文件与此代码一起使用(仍然不起作用):
<script>
CKEDITOR.editorConfig = function(config) {
config.height = '100px';
config.width = '100px';
};
</script>
使用这两种方法后,ckeditor 的高度和宽度仍然是自动的(通过 chrome 的 inspect element 功能检查)
我的例子:http://strawberrycv.com/test.php
本页代码:
<!DOCTYPE html>
<html lang="en">
<head>
<script src="ckeditor/ckeditor.js"></script>
<style>
#ckeWrapper{
height: 700px;
width: 600px;
}
</style>
</head>
<body>
<form>
<div id='ckeWrapper'>
<textarea id="editor1" name="editor1" rows="60" cols="90">
the text goes here
</textarea>
</div>
<script>
// Replace the <textarea id="editor1"> with a CKEditor
// instance, using default configuration.
CKEDITOR.replace( 'editor1' );
</script>
</form>
</body>
</html>
最佳答案
嘿,我刚开始使用这个插件,但我想我为你找到了线索: 在这里找到 api:http://docs.ckeditor.com/#!/api/CKEDITOR.config
然后在底部 '' 中寻找相应的 JS 行
在您定义了 texarea 之后,JS 接管了工作,所以我认为您需要在 JS 而不是 CSS 中进行编辑。
关于css - CKEDITOR 不会调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20734640/