如何更改CKEditor的编辑器大小? [英] How to change the editor size of CKEditor?

查看:151
本文介绍了如何更改CKEditor的编辑器大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为它是一个textarea,我尝试cols =50在html属性,但它不工作。

Since it is a textarea , i tried cols="50" in html attribute but it does not work.

此外,我发现上一个问题的答案。他说我可以通过添加
CKEDITOR.instances.myinstance.resize(1000,900); 但是,大小仍然没有改变。

Also , i found the answer from the previous question . He said i can do this by adding CKEDITOR.instances.myinstance.resize(1000, 900); however , the size still have not changed.

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

Here is the code i attempted, thank you

更新 >

Updated

<!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>


推荐答案

请尝试以下

要实现此目的,请使用调整大小功能来定义尺寸

To achieve this, use the resize function to define the dimensions of the editor interface, assigning the window a width and height value in pixels or CSS-accepted units.

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

值,使用isContentHeight参数来决定该值是否适用于整个编辑器界面或仅适用于编辑区域。

While setting the height value, use the isContentHeight parameter to decide whether the value applies to the whole editor interface or just the editing area.

// 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

这篇关于如何更改CKEditor的编辑器大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆