Skip to content

feat(legal): edit the legal documents in a WYSIWYG markdown editor - #38

Merged
thoda-dev merged 2 commits into
masterfrom
ueditor-for-legal-documents
Sep 1, 2026
Merged

feat(legal): edit the legal documents in a WYSIWYG markdown editor#38
thoda-dev merged 2 commits into
masterfrom
ueditor-for-legal-documents

Conversation

@thoda-dev

Copy link
Copy Markdown
Owner

What this changes

Closes #37

The legal document editor becomes a WYSIWYG one: UEditor in 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 parseLegalMarkdown as before. tests/legal-editor-roundtrip.test.ts runs 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.vue into app/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.yaml picks up @tiptap/extension-table, @tiptap/markdown and @tiptap/starter-kit alongside the copies Nuxt UI already depends on.

Checks

  • pnpm lint, pnpm typecheck and pnpm test pass
  • Schema change? A migration is committed alongside it (pnpm db:generate) — no schema change
  • Touches crypto, authorization, or the paste read counter? Say so here — those get a closer read

None 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/legal are 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.

  • No AI tool was used
  • An AI tool was used — which one, and roughly how much of the change: Claude Code, all of it. I asked for the editor and the toolbar scope, reviewed the rendering pass by pass against screenshots, and called the removal of the preview.

Copilot AI lite review requested due to automatic review settings September 1, 2026 14:05

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.

🟡 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 LegalEditor and 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 thread apps/app/package.json
Comment on lines +30 to +32
"@tiptap/extension-table": "^3.30.5",
"@tiptap/markdown": "^3.30.5",
"@tiptap/starter-kit": "^3.30.5",
Comment thread apps/app/app/pages/admin/legal.vue Outdated
/>
</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. -->
@thoda-dev
thoda-dev merged commit af58a32 into master Sep 1, 2026
6 checks passed
@thoda-dev
thoda-dev deleted the ueditor-for-legal-documents branch September 1, 2026 15:22
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.

Editing a legal document means writing markdown by hand, next to a preview that eats half the screen

2 participants