Docs › Writing helpers
Enter key mode
Choose whether Enter starts a paragraph or breaks the line (enterMode).
By default Enter starts a new paragraph (<p>) and Shift+Enter breaks the line (<br>). enterMode: 'br' swaps them. Use it when existing posts were written with <br> lines, or when Enter should not leave a paragraph gap.
Try it
This demo uses enterMode br. Press Enter and the line breaks inside this paragraph.
A new paragraph is Shift+Enter.
- In lists, Enter still makes a new item
Code for this demo
createEditor('#editor', {
toolbar: 'bold | bulletList | table',
enterMode: 'br',
});Side by side
| 'p' (default) | 'br' | |
|---|---|---|
| Enter | New paragraph | Line break |
| Shift+Enter | Line break | New paragraph |
| Enter in a table cell | New line in the cell | Line break (Shift+Enter too) |
<!-- enterMode: 'p', Enter after each line -->
<p>First line</p>
<p>Second line</p>
<!-- enterMode: 'br', Enter after each line -->
<p>First line<br>Second line</p>The same in both modes
- Lists, headings, code blocks, fold titles and image captions keep their usual Enter.
- Enter on an empty last line of a quote, callout or fold leaves the box.
- Enter on an empty last line of a code block leaves the code block.
- Enter on an empty heading right after a heading turns it into a paragraph.
Options
| Name | Type | Default | Description |
|---|---|---|---|
enterMode | 'p' | 'br' | 'p' | 'p': Enter new paragraph, Shift+Enter line break. 'br': the other way round. |