Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 has 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> 
like image 324
user782104 Avatar asked Apr 03 '12 09:04

user782104


People also ask

How do you change the height of CKEditor?

Editor Height This configuration option accepts an integer (to denote a value in pixels) or any CSS-defined length unit except percent ( % ) values which are not supported. For example: config. height = 500; // 500 pixels high.

How do you change the width and height of a CKEditor 5?

CKEditor 5 no longer comes with a configuration setting to change its height. The height can be easily controlled with CSS. ClassicEditor . create( document.

How do I edit CKEditor toolbar?

Basic Toolbar Configurator You can modify the order of the toolbar groups by clicking the Up and Down arrows and toggle button visibility by selecting and deselecting the checkboxes. Use the “Add row separator” button to create a new toolbar row.

What is the difference between CKEditor 4 and 5?

In a nutshell: CKEditor 4 leverages the browser as much as possible. Consequence: any tiny difference in behavior across browsers in low-level APIs has a huge negative impact. CKEditor 5 therefore avoids using the browser for many low-level operations, and re-implements many things.


2 Answers

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 ) 

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

like image 149
Hemant Metalia Avatar answered Sep 25 '22 05:09

Hemant Metalia


For CKEditor 4.0, I had to use:

  CKEDITOR.replace('body', {height: 500}); 
like image 28
tommy chheng Avatar answered Sep 23 '22 05:09

tommy chheng