category | order | url | menu-title | meta-title-short |
---|---|---|---|---|
output-control |
60 |
features/enterkey |
Enter Key Configuration |
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 {@linkapi CKEDITOR.config.enterMode CKEDITOR.config.enterMode} and {@linkapi CKEDITOR.config.shiftEnterMode CKEDITOR.config.shiftEnterMode}, respectively.
Both configuration settings can use one of the following options:
- {@linkapi CKEDITOR.ENTER_P CKEDITOR.ENTER_P} – new
<p>
paragraphs are created; - {@linkapi CKEDITOR.ENTER_BR CKEDITOR.ENTER_BR} – lines are broken with
<br>
elements; - {@linkapi CKEDITOR.ENTER_DIV CKEDITOR.ENTER_DIV} – new
<div>
blocks are created.
Changing the {@linkapi CKEDITOR.config#enterMode Enter Mode}
setting to BR
or DIV
is not recommended. The default
{@linkapi CKEDITOR#ENTER_P 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; }
See the {@linkexample enterkey working "Enter Key Configuration" sample} that showcases the effects of using different settings for Enter and Shift+Enter keys on editor output.