refactor(editor): rename LegalEditor to TextEditor - #42
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The changes are a consistent rename/refactor across component usage, CSS, and i18n keys with no remaining references to the old names found in the codebase.
Pull request overview
This PR refactors the Markdown WYSIWYG editor naming and associated vocabulary to be generic (TextEditor / rich-text / editor.* i18n) while preserving behavior and styling for the existing legal-document editing and rendering flows.
Changes:
- Renames the editor component usage to
TextEditorand moves tooltip i18n keys to the rooteditor.*namespace. - Renames the shared prose styling class from
legal-documenttorich-textand updates the global stylesheet accordingly. - Updates references in the admin legal page, the rendered legal document component, and the editor roundtrip test comments to reflect the new naming.
File summaries
| File | Description |
|---|---|
| apps/app/tests/editor-roundtrip.test.ts | Updates schema comment reference to TextEditor to match the component rename. |
| apps/app/nuxt.config.ts | Switches global CSS import to rich-text.css. |
| apps/app/i18n/locales/en.json | Moves editor toolbar tooltip strings to root editor.* and drops unused admin.legal.editor.title. |
| apps/app/i18n/locales/fr.json | Same i18n key move as English locale. |
| apps/app/app/pages/admin/legal.vue | Updates admin legal editor usage from <LegalEditor> to <TextEditor>. |
| apps/app/app/components/TextEditor.client.vue | Renames tooltip namespace to editor.* and updates UI base class to rich-text. |
| apps/app/app/components/LegalDocument.vue | Updates rendered document wrapper class to rich-text to keep styling consistent. |
| apps/app/app/assets/css/rich-text.css | Renames selectors from .legal-document to .rich-text and updates comments to reflect broader reuse. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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 #41
LegalEditor.client.vuebecomesTextEditor.client.vue, thelegal-documentclass becomesrich-textalong with its stylesheet, and the toolbar's tooltips move fromadmin.legal.editor.*to a rooteditor.*block. No behaviour changes: the editor renders the same toolbar over the same schema, and/admin/legaland/legal/[slug]look exactly as they did.Why
Nothing inside the editor was ever legal-specific — the marks, the table extension and the prose styling apply to any Markdown — but its name, its class, its i18n namespace and several of its comments all claimed otherwise. Issue #41 has the longer version, including why this lands on its own rather than inside the change that gives it a second caller.
Three things about the shape of it:
The class had to move with the component.
rich-textis not only the editor's content class:LegalDocument.vuecarries it too, because the published page has to look identical to what the editor showed. So the stylesheet, thenuxt.config.tsentry and the published-page component all follow, and the doubled selector (.rich-text.rich-text, which buys specificity over UEditor's utilities) is unchanged apart from its name.One i18n key is dropped, not moved.
admin.legal.editor.title("Document") is referenced nowhere —tip()builds its keys from the toolbar items and none of them istitle— and "Document" would be a poor thing to carry into a neutral namespace. The other 25 keys move unchanged, in both languages;tests/locales.test.tsstill sees identical key sets.LegalDocument.vueandLegalTable.vuekeep their names. They render the published legal page, which is genuinely what they are for. Making the renderer generic belongs to whatever eventually renders Markdown outside the legal pages, not here.The renames are
git mv, so the history follows.Checks
pnpm lint,pnpm typecheckandpnpm testpasspnpm db:generate) — no schema changeNone of the three. No server code is touched, and no route, payload or stored value changes.
Worth knowing when reviewing: the one thing a rename like this can silently break is a key that resolves at runtime. There is exactly one,
tip()in the component, and every key it can build is in the moved block — the toolbar items are the only callers.tests/editor-roundtrip.test.ts(renamed fromlegal-editor-roundtrip.test.ts) still drives the same schema over the same legal templates, which remain the only long Markdown documents in the repo and so the right corpus.AI assistance
See CONTRIBUTING.md. Disclosure is not held against you: it tells
the reviewer where to look hardest.