Enter Key Configuration
When CKEditor 4 is integrated in some environments you may want to configure the default behavior of the Enter and Shift+Enter keys to generate matching output. This is possible thanks to CKEDITOR.config.enterMode and CKEDITOR.config.shiftEnterMode, respectively.
Both configuration settings can use one of the following options:
- CKEDITOR.ENTER_P – new
<p>
paragraphs are created; - CKEDITOR.ENTER_BR – lines are broken with
<br>
elements; - CKEDITOR.ENTER_DIV – new
<div>
blocks are created.
Changing the Enter Mode
setting to BR
or DIV
is not recommended. The default
CKEDITOR.ENTER_P
mode is fully supported by all editor features and plugins and is also the most correct one
in terms of best practices for creating web content.
If you want to change it to control paragraph spacing, you should use stylesheets instead. Edit the
contents.css
file and set up a suitable margin value for <p>
elements, for example:
p { margin: 0; }
# Enter Key Configuration Demo
See the working “Enter Key Configuration” sample that showcases the effects of using different settings for Enter and Shift+Enter keys on editor output.