Skip to content

Fix Removing a Newly Inserted Paragraph Break When Suggesting - #35

Open
iankirsch wants to merge 2 commits into
handlewithcarecollective:mainfrom
iankirsch:main
Open

iankirsch wants to merge 2 commits into
handlewithcarecollective:mainfrom
iankirsch:main

Conversation

@iankirsch

Copy link
Copy Markdown
Contributor

When suggesting, it is currently impossible to fully remove a paragraph break that was just added (the Enter-then-Backspace case in #11).

The break is held by invisible insertion anchors, so Backspace deletes an anchor instead of the break, and the break ends up marked as a deletion rather than removed.

This pull request adds a removeInsertedBreak command on Backspace/Delete that removes the break in one keystroke (paragraphs and list items), and updates suggestReplaceStep to join the blocks and drop the anchors when a step only deletes an inserted boundary. Real boundaries are still tracked as deletions. This brings removing added paragraph breaks in line with how removing regular inserted text already works, and with expected behaviour from Google Docs and similar editors.

This pull request only covers the first case in #11. The end-of-list Delete-then-Backspace case is a separate problem in suggestReplaceAroundStep, so I've left it for now.

@smoores-dev

Copy link
Copy Markdown
Member

Thanks @iankirsch! I'm finally going to have some time to sink back into this library starting tomorrow, so I'll take a look at this then. I am playing around with the idea of removing the insertion anchors entirely.

@iankirsch

Copy link
Copy Markdown
Contributor Author

No worries, thanks for your work on this library, it's been really useful for us! Happy to close this if the anchor rework ends up covering the same case!

@smoores-dev

Copy link
Copy Markdown
Member

Let's leave it open for now and see where the refactor gets us 😅 . Do you mind if I ask what you're using the library for in the mean time? It's awesome that folks are making use of it!

@iankirsch

iankirsch commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Not at all! We're building Storytide, which is sort of an IDE for social media content creation: teams run the whole thing in one place, from strategy and planning on a kanban board and calendar, to writing and live collaborative review, as well as scheduled publishing. The library powers the review side, giving us Google Docs-style suggestion tracking in our TipTap + Yjs editor so collaborators can propose tracked edits that the content owner accepts or rejects.

@smoores-dev

Copy link
Copy Markdown
Member

Very cool! Thanks for sharing 😁

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants