Repository navigation
fix(editor): keep a paragraph after a table that ends the document - #28
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UAiVj14HzKtRDqK12BXTr6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The editor keeps a paragraph after a table that ends the document, as Word does. Text can now be typed below such a table.
Motivation
The sample document on
/editorends with a table. There was no paragraph after it, so clicking below the table could not place the caret, and nothing could be added there. Inserting a table at the end of a document left the same dead end. Word always keeps a paragraph mark after a table that ends the body, and adds one when it opens a file that has none. There is no linked issue; the maintainer reported it directly.Changes
EditorModel: when a model is created over a document, and when an edit commits, an empty paragraph is appended if the body does not end with one. It is added throughappendParagraph, so the library still makes the change.history.test.tsandrange-edit.test.ts: two existing tests built documents that end with a table; their expectations now include that paragraph.Testing
pnpm test: 1269 passed, 8 skipped.pnpm -r run typecheckandoxlintpass (2 pre-existing warnings)./editorsample document: clicking just below the table, and 250 px below it, puts the caret in the new paragraph. Typed text lands there.Breaking changes
None.
Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01UAiVj14HzKtRDqK12BXTr6