feat(legal): edit the legal documents in a WYSIWYG markdown editor - #38
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
It introduces a likely regression in published table overflow behavior and currently adds a TipTap version skew that can leave unsatisfied peer dependencies / risk runtime incompatibilities.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the admin legal-document editing experience to a WYSIWYG (markdown-backed) editor using Nuxt UI’s UEditor, removes the side-by-side preview, and unifies styling so the editor and published legal pages render consistently.
Changes:
- Replace the raw textarea + preview split with a rich-text
LegalEditorand a toggle for viewing/editing raw Markdown. - Move legal-document prose styling from a scoped component style to a shared global CSS file.
- Add a headless round-trip test to ensure TipTap markdown normalization does not change rendered output.
File summaries
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds TipTap packages / updates lockfile for new editor dependencies. |
| apps/docs/content/2.self-hosting/5.legal-pages.md | Updates documentation to describe the new rich-text editor + raw markdown toggle. |
| apps/app/tests/legal-editor-roundtrip.test.ts | Adds round-trip rendering invariance tests for templates and toolbar constructs. |
| apps/app/package.json | Adds TipTap deps (markdown, starter-kit, tables) and bumps nodemailer. |
| apps/app/nuxt.config.ts | Loads new global legal-document stylesheet. |
| apps/app/i18n/locales/fr.json | Updates admin/legal strings for the new editor toolbar + toggles. |
| apps/app/i18n/locales/en.json | Updates admin/legal strings for the new editor toolbar + toggles. |
| apps/app/app/pages/admin/legal.vue | Switches to rich editor, removes preview pane, adds raw markdown toggle, adjusts layout. |
| apps/app/app/components/LegalEditor.client.vue | Introduces client-only UEditor wrapper with constrained toolbar and table bubble menu. |
| apps/app/app/components/LegalDocument.vue | Removes scoped prose styling now handled globally. |
| apps/app/app/assets/css/legal-document.css | Adds shared prose styling for both editor content and published legal pages. |
Review details
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
- Files reviewed: 10/11 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+101
to
+111
| .legal-document.legal-document table { | ||
| margin-top: 0; | ||
| margin-bottom: 1.25rem; | ||
| width: 100%; | ||
| font-size: 0.875rem; | ||
| border: 1px solid var(--ui-border); | ||
| border-radius: calc(var(--ui-radius) * 2); | ||
| border-collapse: separate; | ||
| border-spacing: 0; | ||
| overflow: hidden; | ||
| } |
Comment on lines
+30
to
+32
| "@tiptap/extension-table": "^3.30.5", | ||
| "@tiptap/markdown": "^3.30.5", | ||
| "@tiptap/starter-kit": "^3.30.5", |
| /> | ||
| </div> | ||
| </div> | ||
| <!-- Takes the slack the rest of the page leaves, so the actions below it never fall off screen. `min-h-0` is what lets it shrink instead of pushing them down. --> |
Closed
1 task
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.
What this changes
Closes #37
The legal document editor becomes a WYSIWYG one:
UEditorin markdown mode, with a toolbar covering exactly what the legal pages render — headings, bold, italic, strike, lists, quote, link, inline code, rule and tables — and a bubble toolbar for row and column actions. The side-by-side preview is removed, and a "view raw markdown" button swaps the editor for the old textarea.Why
Writing a privacy policy is more intuitive when you see the document rather than its syntax, and dropping the preview gives the whole width of the page back to the editing pane.
A few notes on the shape of it:
The stored format does not change. The database still holds markdown, parsed by the same locked-down
parseLegalMarkdownas before.tests/legal-editor-roundtrip.test.tsruns each shipped template and each toolbar construct through TipTap headlessly and compares the parsed document before and after, so an edit that never touches a section cannot silently rewrite it.Images and mentions are off, matching the tag list the parser allows.
The prose styles moved out of
LegalDocument.vueintoapp/assets/css/legal-document.css, since the editor and the published page now have to look the same and were styling themselves separately.The editor fills the height the page leaves it rather than a fixed one, so the Save button stays on screen.
Also in the diff:
pnpm-lock.yamlpicks up@tiptap/extension-table,@tiptap/markdownand@tiptap/starter-kitalongside the copies Nuxt UI already depends on.Checks
pnpm lint,pnpm typecheckandpnpm testpasspnpm db:generate) — no schema changeNone of the three. The change is confined to the admin editing screen and the shared prose styles; the parser, the routes and the permission checks around
/admin/legalare untouched.Worth knowing when reviewing: the round-trip test is the guard that matters here, since the risk of a WYSIWYG editor over markdown is that opening a document and saving it rewrites parts nobody edited.
AI assistance
See CONTRIBUTING.md. Disclosure is not held against you: it tells
the reviewer where to look hardest.