Skip to content

fix(editor): keep a paragraph after a table that ends the document - #28

Merged
baseballyama merged 1 commit into
mainfrom
fix/paragraph-after-final-table
Oct 5, 2026
Merged

baseballyama merged 1 commit into
mainfrom
fix/paragraph-after-final-table

Conversation

@baseballyama

Copy link
Copy Markdown
Member

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 /editor ends 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 through appendParagraph, so the library still makes the change.
  • history.test.ts and range-edit.test.ts: two existing tests built documents that end with a table; their expectations now include that paragraph.

Testing

  • New test: a document ending with a table gets the paragraph on open, and inserting a table at the end keeps a paragraph last.
  • pnpm test: 1269 passed, 8 skipped. pnpm -r run typecheck and oxlint pass (2 pre-existing warnings).
  • Chromium, /editor sample 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

  • I have read CLAUDE.md and followed the project's conventions.
  • I have added or updated tests for the change.
  • I have added or updated documentation where user-visible behavior changed.
  • If this is a breaking change, I have added a changeset / CHANGELOG entry and flagged it above.
  • I have re-read my own diff and removed dead code, debug prints, and stale comments.
  • If I used an LLM to draft this PR, I have verified each change myself, the PR represents real work that warrants a maintainer's review, and I am willing to defend each line in review.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UAiVj14HzKtRDqK12BXTr6

Copilot AI balanced review requested due to automatic review settings October 5, 2026 17:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@baseballyama
baseballyama merged commit baf2d5c into main Oct 5, 2026
5 checks passed
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