feat(pages): add a table of contents to the page side panel - #249
Conversation
Pages had no way to jump between sections. This adds an Outline tab to the right-hand panel that lists the page's headings, indented by level. Clicking an entry moves the caret to that heading and scrolls it into view. The panel toggle now opens the outline by default. The outline reads headings straight from the editor with useEditorState, so it stays in sync as you type without extra state wiring. Closes #189 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Strix Security ReviewNo security issues found. Updated for Reviewed by Strix |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds a new ChangesPage Outline Feature
Estimated code review effort: 2 (Simple) | ~15 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant PageDetailPage
participant PageOutline
participant Editor
User->>PageDetailPage: open side panel toggle
PageDetailPage->>PageDetailPage: set sidePanel to 'outline'
PageDetailPage->>PageOutline: render with editor prop
PageOutline->>Editor: useEditorState reads headings
Editor-->>PageOutline: heading list (level, text, pos)
User->>PageOutline: click heading entry
PageOutline->>Editor: focus and set selection at pos+1
PageOutline->>Editor: scroll heading into view
Estimated code review effort: 2 (Simple) | ~15 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Adds an Outline (table of contents) tab to the Page Detail right-hand side panel, enabling quick navigation between headings in long TipTap-edited pages.
Changes:
- Added
PageOutlinecomponent that derives headings from the TipTap editor state and navigates to a heading on click. - Wired the Outline into
PageDetailPageas a new side-panel tab and made the panel toggle open the Outline by default. - Exported
PageOutlinefrom the page-editor barrel.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| apps/web/src/pages/PageDetailPage.tsx | Adds “Outline” as a third side-panel tab and updates the panel toggle default behavior. |
| apps/web/src/components/page-editor/PageOutline.tsx | New component that reads editor headings and renders a clickable outline list. |
| apps/web/src/components/page-editor/index.ts | Re-exports PageOutline for consumption by pages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What
Closes #189. Pages had no outline, so there was no quick way to jump between sections on a long page. This adds an Outline tab to the page's right-hand side panel.
How
PageOutlinecomponent lists the page's headings, indented by their level. Clicking an entry moves the caret to that heading and scrolls it into view.useEditorState, so it stays in sync as you type without any extra state plumbing. An equality check keeps it from re-rendering on selection-only changes.Frontend-only, no API changes.
Testing
Created a page with an H1 and two H2 headings. The Outline tab listed all three with the H2s indented under the H1. Clicking "Configuration" moved the caret into that heading (confirmed the focused node was the H2) and scrolled to it. Verified in the browser with Playwright, no console errors.
AI assistance
Produced with the help of Claude Code (Claude Opus 4.8). AI-assisted commits carry a
Co-Authored-Bytrailer.Summary by CodeRabbit
New Features
Bug Fixes