CK Editor Enter Mode

   —   
This article describes how to set the default behavior of the Enter key in the CK Editor.
The default behavior, when pressing the enter key inside an editable text region produces a line break <br>, when viewing the source as seen in the screenshot below.



You can change the default value to create either a new paragraph <p>, or a new div block <div>.  To make this change, you will need to edit the CK Editor configuration file located in the following location: ~\CMSAdminControls\CKeditor\config.js.  Opening this file, you should see the code below located around line 10.  This is the code responsible for the default <br> tag in an editable region.



You have two options to change this behavior:
1.)  CKEDITOR.ENTER_P – new <p> paragraphs are created.
2.)  CKEDITOR.ENTER_DIV – new <div> blocks are created.

If you want to change the default behavior to create a new <p> paragraph, replace the CKEDITOR.ENTER_BR with the code below:
    config.enterMode = CKEDITOR.ENTER_P;




After saving these changes to ~\CMSAdminControls\CKeditor\config.js file, you will need to restart the application, clear the application cache, and clear the browser cache depending on which browser you are using.  You can restart the application and clear the application cache from Site Manager -> Administration -> System.
 
-eh-


See also: For older versions of Kentico CMS, which use FCK Editor, see here: Modifying ENTER Key Behavior in the WYSIWYG Editor

Applies to: Kentico CMS 6.x
Share this article on   LinkedIn