user782104 user782104 - 10 months ago 52
Javascript Question

How to change the editor size of CKEditor?

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

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


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<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>

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

<input type="submit" />


Answer Source

try following

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' )

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 )