Javascript 调整编辑器大小

Javascript 调整编辑器大小,javascript,ckeditor,Javascript,Ckeditor,我正在使用CKEditor,希望调整编辑器的大小。我正在做以下工作: <head runat="server"> <script src="../../../../../js/jquery-1.10.2.min.js" type="text/javascript"></script> <script src="../../../../../ckeditor/ckeditor.js" type="text/javascript">&

我正在使用CKEditor,希望调整编辑器的大小。我正在做以下工作:

<head runat="server">

    <script src="../../../../../js/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script src="../../../../../ckeditor/ckeditor.js" type="text/javascript"></script>
    <script src="../../../../../js/ckeditor_initialize.js" type="text/javascript"></script>

    <script type="text/javascript">
        function ResizeEditor() {
            var editor = CKEDITOR.replace('tbEditor');
            editor.resize('100', '800');
        }
    </script>
</head>
<body onload="ResizeEditor();">
    <form id="form1" runat="server">
        <asp:TextBox class="ckeditor" ID="tbEditor" runat="server" ClientIDMode="Static" TextMode="MultiLine"></asp:TextBox>
    </form>
</body>

函数ResizeEditor(){
var editor=CKEDITOR.replace('tbEditor');
编辑器。调整大小('100','800');
}
但它似乎不起作用。我想我可能错误地获取了CKEditor实例。有人能解释一下我做错了什么吗


我正在将CKEditor 4与.net 4.5一起使用。

您可以直接在
CKEditor中设置大小。替换方法:

CKEDITOR.replace( 'tbEditor', { width: 800, height: 100 } );

您可以在<代码>编辑器中直接设置大小。替换方法:

CKEDITOR.replace( 'tbEditor', { width: 800, height: 100 } );

可以按以下方式调整Ckeditor的大小:-

var editor = CKEDITOR.instances[id];
editor.config.resize_dir = 'both';   //if you want to enable resizing, else use resize_enabled = false;
editor.config.height = 'your height';
editor.config.width = 'your width';

可以按以下方式调整Ckeditor的大小:-

var editor = CKEDITOR.instances[id];
editor.config.resize_dir = 'both';   //if you want to enable resizing, else use resize_enabled = false;
editor.config.height = 'your height';
editor.config.width = 'your width';

这里不使用替换,因为我需要在之前销毁,我知道您不必这样做

您可以通过以下方式调整大小:

var editor = CKEDITOR.instances['tbEditor'];
if (editor) {
     editor.resize(100, 800);
}

这里不使用替换,因为我需要在之前销毁,我知道您不必这样做

您可以通过以下方式调整大小:

var editor = CKEDITOR.instances['tbEditor'];
if (editor) {
     editor.resize(100, 800);
}

我只需要调整一个编辑器的大小,而不是页面上的所有编辑器。这就是我在版本4.7.0中所做的

CKEDITOR.on('instanceLoaded', function (e) {

     if (e.editor.name == 'html_name_of_your_DOM_element') {
        e.editor.resize(800, 350);
     }
});

我只需要调整一个编辑器的大小,而不是页面上的所有编辑器。这就是我在版本4.7.0中所做的

CKEDITOR.on('instanceLoaded', function (e) {

     if (e.editor.name == 'html_name_of_your_DOM_element') {
        e.editor.resize(800, 350);
     }
});