Decorations - <br> element

Hi all,

we use Decorations for different purposes in our ProseMirror-based Script Editor. When we start editing a node with a decoration, for some reason PM inserts a
(so new line) element in the DOM. Once we move the selection out of the node and click on another place in the document, the
DOM element disappears. Do you know what could be causing this behavior and how to avoid it?

Greetz, Pavel

1 Like

Does the <br> element cause any actual problems for you?

Hi Marijn, yes. It causes a visual new line effect. So if you have a script character: i.e.:

Line 1=> “PAVEL:”

it has the effect of: Line 1 => “PAVEL” Line 2 => “:”

Is there a way we can avoid it? Why it appears?

Strange. It should only do it at the end of the line, where the <br> is invisible and avoids problems with the way the browser displays the cursor. Can you set up a demo that shows the issue?

Hi Marijn,

Regarding the effect of the
pushing the line down. Could it be related, to the fact that we are adding decorations at the end of the line. i.e. the Colon symbol “:”, after the character name - this is a decoration. Maybe we are not adding it at the correct moment and so the decoration goes after the
=> then the
becomes not the last element in the line? (see pic attached)

Is the suffix rendered outside of the inline content container (text-value) intentionally? The editor is assuming that the textblock element that it’s rendering content into is the entire block element, and that it doesn’t have additional inline things rendered after it that should appear on the same line.