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);
CKEditor 5 no longer comes with a configuration setting to change its height. The height can be easily controlled with CSS. ClassicEditor . create( document.
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.
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.
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.
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"
});
The following was taken from How to change or set width of Ckediotr TextBox area using ASP .Net.
Create a new ASP.NET webite and name it as Demo_application.
Download Ckeditor from here and add Ckeditor to the root Folder of your Application.
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>
Add Ckeditor TextBox to your .aspx file with id txtCkEditor
<asp:TextBox ID="txtCkEditor" runat="server" TextMode="MultiLine"></asp:TextBox>
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>
Test Your Application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With