ProseMirror-trailingBreak probably not needed with gapcursor

See original GitHub issue

There is a <br class="ProseMirror-trailingBreak"> added to inline content (e.g. a inline image) if they are a leaf node (If I got that correctly).

As far as I understand from the following comment, this is due to usability reasons, so that a editor can continue writing where it wouldn’t be possible otherwise: https://discuss.prosemirror.net/t/parser-adds-br-tag-to-every-paragraph/1539/6

With the prosemirror-gapcursor extenstion (or the @tiptap/extension-gapcursor in our case) this seems not to be necessary. Also, our designer complains.

Instead of hiding this via CSS I’d like to turn the trailing break element off. If this is not an option, can it be turned off when gapcursor is active on the leaf node?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
thetcommented, Feb 15, 2022

I agreed with the designer that we just try to set it display: none if it is really causing any problems. We did foresee some usability problems, also the problem with users trying to delete the break and deleting the image instead. I’m watching the issue and will bring it up again if it really hurts us. Thanks so far for everything!

0reactions
alessiostallacommented, Apr 29, 2022

Oh, I see. I was using a span tag as a block node to avoid the “no mixing of inline and block nodes” rule, and it would only break the line when empty. I’ve refactored the schema to avoid using a block node.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parser adds <br> tag to every paragraph - Discuss - ProseMirror
When I supply supply a content div which contains a paragraph with trailing line breaks, then I parse that div according to the...
Read more >
Enforce empty trailing block - Discuss - ProseMirror
One solution to this is to enable the gapcursor plugin, which allows you to move your cursor below such an element and start...
Read more >
Issues with gapCursor - Discuss - ProseMirror
When inserting new content, it's like this: ... it breaks the editor, everything stops working, I need to reload to fix it.
Read more >
ProseMirror Changelog
The clipboard parser will no longer drop trailing <br> nodes that appear in an inline parent element. ... The GapCursor constructor is now...
Read more >
Changing the way line breaks are handled - Discuss
How would you go about removing a hard break through Prosemirror transaction? This is what I have tried in the keymap command with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found