Repository navigation
Conversation
Headings used equal top and bottom margins (my-2/my-3) that were smaller than the margins on paragraphs and embedded blocks, so margin collapsing left as much space after a heading as before it (or more after lists). Use larger top margins and small bottom margins so headings group with the content they introduce. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 23 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
…graph Tiptap's TrailingNode adds an empty paragraph after a trailing heading, list or embed, and the editor persists it. appendBlocks then inserted new blocks after it, so AI-built documents got a blank line after headings and before lists. Insert before a trailing empty paragraph instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2eddab1f27
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| get().blockDocuments.insertBlocks( | ||
| artifactId, | ||
| Number.POSITIVE_INFINITY, | ||
| content ? appendIndex(content) : Number.POSITIVE_INFINITY, |
There was a problem hiding this comment.
Preserve the active trailing paragraph’s cursor
When a user is typing in the editor-created trailing empty paragraph and an external appendBlocks call arrives (for example, an AI append), this inserts before that focused paragraph and shifts it right. BlockDocumentEditorRoot restores focused text selections by their previous numeric offsets rather than by block ID, so the caret is restored into the newly inserted block or its boundary instead of the empty paragraph; before this change that paragraph remained at its original offset. Map or preserve the trailing paragraph's selection when moving it so external appends do not disrupt active typing.
Useful? React with 👍 / 👎.
When the store replaces editor content, a focused text selection was restored by numeric offset. An append that lands before the trailing empty paragraph shifts that paragraph, so a user typing there had the caret moved into the new block. Restore the selection relative to its top-level block, found by block ID, and fall back to offsets otherwise. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two fixes for uneven spacing in block documents, most visible in AI-built ones.
1. Headings had no more space above than below
Headings used equal top/bottom margins (
my-2/my-3) smaller than the margins on paragraphs (~16px inprose-sm) and embedded blocks (my-4). Because vertical margins collapse, the neighbours set the spacing on both sides of a heading.BLOCK_DOCUMENT_CONTENT_CLASS_NAMEnow uses larger top margins (h1mt-8, h2mt-7, h3mt-5) and small bottom margins (mb-3/mb-2).2. Appended blocks landed after an empty paragraph
Tiptap's StarterKit enables
TrailingNode, which adds an empty paragraph whenever the document ends with a heading, list or embed. The editor persists that paragraph to the store, andappendBlocksthen inserted new blocks after it. An agent that appends a heading and then a paragraph produced heading, empty paragraph, paragraph: a visible blank line after headings and before lists.appendBlocksnow inserts before a trailing empty paragraph. This also fixes documents that already have one stored.insertBlockswith an explicit index is unchanged.Testing
@sqlrooms/documentstests pass (163), including a new test for appending before the trailing empty paragraph.🤖 Generated with Claude Code
Summary by CodeRabbit