Skip to content

Typing

ENTER Key

The way ENTER key behaves can be customized using the enter option. There are 3 possible options:

By default the editor is using P tags. When ENTER key is hit, a new P tag is created.

The editor can use DIV tags. When ENTER key is hit, a new DIV tag is created.

The editor can use BR tags. When ENTER key is hit, a BR tag is inserted.

Edit in JSFiddle

HTML

<div id="froala-editor-p">
  By default the editor is using <code>P</code> tags. When ENTER key is hit, a new <code>P</code> tag is created.
</div>
<br/>
<div id="froala-editor-div">
  The editor can use <code>DIV</code> tags. When ENTER key is hit, a new <code>DIV</code> tag is created.
</div>
<br/>
<div id="froala-editor-br">
  The editor can use <code>BR</code> tags. When ENTER key is hit, a <code>BR</code> tag is inserted.
</div>

JAVASCRIPT

<script>
  $(function() {
    $('div#froala-editor-p').froalaEditor();

    $('div#froala-editor-div').froalaEditor({
      enter: $.FroalaEditor.ENTER_DIV
    });

    $('div#froala-editor-br').froalaEditor({
      enter: $.FroalaEditor.ENTER_BR
    });
  });
</script>
File: 3898