editor

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

Code for this demo

createEditor('#editor', {
  toolbar: 'bold | bulletList | table',
  enterMode: 'br',
});

Side by side

'p' (default)'br'
EnterNew paragraphLine break
Shift+EnterLine breakNew paragraph
Enter in a table cellNew line in the cellLine 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

NameTypeDefaultDescription
enterMode'p' | 'br''p''p': Enter new paragraph, Shift+Enter line break. 'br': the other way round.