Vivek R. Vivek R. - 4 months ago 22
PHP Question

Resize CKEditor served from CDN

I have added CKEditor to my PHP project via CDN (https://cdn.ckeditor.com/) to replace current textareas.

I have it linked in the head of applicable files:

<script src="//cdn.ckeditor.com/4.5.8/standard/ckeditor.js"></script>


In my main.js file I have replaced the textareas:

CKEDITOR.replace('message');
CKEDITOR.replace('address');
CKEDITOR.replace('note_message');
CKEDITOR.replace('reminder');
CKEDITOR.replace('save_the_date_message');
CKEDITOR.replace('thank_you_message');

//trial code
CKEDITOR.config.width = 600;


I have searched and tried reading the documentation but cannot figure out how to adjust the height/width of each textarea. This is the current appearance on my files:

mypic

Any insight on how to fix this would be greatly appreciated.

Answer

To change the size of it, you just have to change the HTML code of it. Example:

<textarea name="editor"></textarea>

At this code you have the text area, and to resize it, use CSS like this:

<textarea name="editor" style="width:400px; height:500px;"></textarea>

Or:

<textarea name="editor1" width="400" height="500"></textarea>

But, if you want to size it with javascript use this codes:

CKEDITOR.replace('editor', {
  width: '400',
  height: 500
});

Sincerely, Lucas S. Müller.

Comments