如何更改CKEditor的编辑器大小?

新手上路,请多包涵

因为它是一个 textarea ,我在 html 属性中尝试了 cols=“50” 但它不起作用。

另外,我从上一个问题中找到了答案。他说我可以通过添加来做到这一点。 CKEDITOR.instances.myinstance.resize(1000, 900); 但是,大小仍然没有改变。

这是我尝试的代码,谢谢。

更新

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <script src="../plugin/jquery-1.6.1.min.js"></script>
    <script src="../plugin/jquery.validate.min.js"></script>
    <script type="text/javascript" src="../plugin/ckeditor/ckeditor.js"></script>

    <script>
$(document).ready(function(){
$("#addlist").validate();
var editor = CKEDITOR.replace('editor1');
var div = document.getElementById('editor');
editor.resize($(div).width(),'900');
});
    </script>
</head>
<body>
    <form method="post" action="confirm.php">
        <p><br />
        <div id="editor">
            <textarea id="editor1" name="editor1">
            </div>
            <? if (isset($_GET['file']))
            {$filepath=$_GET['file'];
                require_once("../template/".$filepath);}?> </textarea>
        </p>
        </br>
            File Name </br>
            <b>(Naming Without .html e.g. MyTemplate1) :</b>
            </br>
            <input id="tname" name="tname" class="required" />

            <input type="submit" />

        </p>
    </form>
</body>
</html>

原文由 user782104 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1k
2 个回答

尝试以下

为此,请使用 调整大小 功能来定义编辑器界面的尺寸,为窗口分配以像素或 CSS 接受的单位为单位的宽度和高度值。

 // Set editor width to 100% and height to 350px.
editor.resize( '100%', '350' )

在设置高度值时,使用 isContentHeight 参数来决定该值是适用于整个编辑器界面还是仅适用于编辑区域。

 // The height value now applies to the editing area.
editor.resize( '100%', '350', true )

http://docs.cksource.com/CKEditor_3.x/Howto/Editor_Size_On_The_Fly

原文由 Hemant Metalia 发布,翻译遵循 CC BY-SA 3.0 许可协议

只需转到 ckeditor 文件夹并找到 config.js

     CKEDITOR.editorConfig = function( config ) {
    // Define changes to default configuration here. For example:
    // config.language = 'fr';
    // config.uiColor = '#AADC6E';
     config.height = '80vh';

};

这将根据屏幕大小调整您的 ckeditor 的大小。

原文由 Nere 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
logo
Stack Overflow 翻译
子站问答
访问
宣传栏