How do i add a soft break in Rich Text Editor in vaadin

I want to use SHIFT + ENTER shortcut to insert a line break and continue inside the same parahraph. However RTC is creating a new paragraph which looks very bad.


I found that a bug is already opened Add soft line breaks support to RichTextEditor · Issue #6302 · vaadin/flow-components · GitHub.
Do we have a workaround here ?
I tried to replace the </p><p> tags with <br> but even after replacing RTE seems to reparse the value and add these tags again.

Someone should try this with most recent Vaadin 25 alpha release, as it has Quill updated to v2: refactor!: update to Quill v2.0 and use getSemanticHTML by web-padawan · Pull Request #9007 · vaadin/web-components · GitHub

Hi, Ankesh,

Unfortunately, there’s no built-in way in Vaadin’s RichTextEditor to make Shift + Enter produce a soft break (i.e., a <br>instead of a new <p>), AFAIK. The component’s HTML support does allow <br>, but when editing, it re-parses and forces <p> tags.

There is an open GitHub issue for this missing behavior. One possible workaround is to work with the editor’s HTML or Delta value programmatically: after the user inputs text, intercept the value, replace <p></p> pairs (or </p><p>) with <br>, then set it back. It’s a bit hacky, but that’s what’s feasible for now.

Also worth noting: newer versions of Vaadin (or alpha/preview builds) may include updates — for example, Vaadin 25’s upcoming Quill integration might behave differently, so it’s worth testing if you can.