javascripttinymcetinymce-4

TinyMCE4: How to change Enter key functionality to Shift + Enter key?


On pressing Enter in TinyMCE4 a new paragraph is created. Is there any way to change the configuration of TinymCE4 so that Enter should work like Shift+Enter?

On a press of the Enter key, I want a <br/> tag instead of a <p> tag.


Solution

  • There is indeed an option for that mentioned in the documentation:

    https://www.tinymce.com/docs/configure/content-filtering/#forced_root_block

    Note that eliminating block elements is generally a "very bad idea" as many other actions in the editor really only work when the content is organized into blocks. Use this at your own risk.