Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ckeditor change width

Tags:

ckeditor

I want to change the width and height of the Ckeditor but am not able to change it. Please know that I want to change it when call CKeditor , I dont want to hard code it inside the config.js...

The bottom code is not working, what do you suggest ?

var editor = CKEDITOR.replace('editorToday',
          {


            toolbar :
                [
                    { name: 'document', items : [ 'Preview' ] },
                    { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
                    { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','Scayt' ] },
                    { name: 'insert', items : [ 'Image','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'] },
                            '/',
                    { name: 'styles', items : [ 'Styles','Format' ] },
                    { name: 'basicstyles', items : [ 'Bold','Italic','Strike','-','RemoveFormat' ] },
                    { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote' ] },
                    { name: 'links', items : [ 'Link','Unlink','Anchor' ] },
                    { name: 'tools', items : [ 'Maximize','-','About' ] }

                ]

            });


CKEDITOR.instances.editor.resize(500, 400);
like image 281
rtp Avatar asked Oct 28 '11 07:10

rtp


People also ask

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 you set the width and height of CKEditor?

Besides defining a default size of the editor window you can also change the size of a CKEditor 4 instance on the fly. To achieve this, use the editor. resize() method to define the dimensions of the editor interface, assigning the window a width and height value in pixels or CSS-accepted units.

How do I change CKEditor height?

The CKEDITOR. config. height option sets the height of the editing area with CKEditor 4 content — it does not include the toolbar or the bottom bar. 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.

How do I reduce line spacing in CKEditor?

css in the ckeditor library with the class . cke_editable with the line-height property set to 1.6 . Update it with the value required. This will update the line-height in all the places its used in your application.


2 Answers

Try this:

 var editor = CKEDITOR.replace('editorToday',
      {


        toolbar :
            [
                { name: 'document', items : [ 'Preview' ] },
                { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
                { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','Scayt' ] },
                { name: 'insert', items : [ 'Image','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'] },
                        '/',
                { name: 'styles', items : [ 'Styles','Format' ] },
                { name: 'basicstyles', items : [ 'Bold','Italic','Strike','-','RemoveFormat' ] },
                { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote' ] },
                { name: 'links', items : [ 'Link','Unlink','Anchor' ] },
                { name: 'tools', items : [ 'Maximize','-','About' ] }

            ],
        width: "400px",
        height: "500px"

        });
like image 161
guiweb Avatar answered Sep 17 '22 17:09

guiweb


The following was taken from How to change or set width of Ckediotr TextBox area using ASP .Net.

Step1

Create a new ASP.NET webite and name it as Demo_application.

Step 2

Download Ckeditor from here and add Ckeditor to the root Folder of your Application.

Step 3

Call the Ckeditor Scripts in your .aspx page like below

<script type="text/javascript" src="scripts/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="ckeditor/adapters/jquery.js"></script>

Step 4

Add Ckeditor TextBox to your .aspx file with id txtCkEditor

<asp:TextBox ID="txtCkEditor" runat="server" TextMode="MultiLine"></asp:TextBox>

Step 5.

Call the Below JavaScript function to change the default width of Ckeditor TextBox area.

<script type="text/javascript">
    $(function () {  
      CKEDITOR.replace('<%=txtCkEditor.ClientID %>');
      CKEDITOR.config.width = 200;
    });
</script>

Step 6

Test Your Application.

like image 39
user3258189 Avatar answered Sep 16 '22 17:09

user3258189