Skip to content

refactor(editor): rename LegalEditor to TextEditor - #42

Merged
thoda-dev merged 1 commit into
masterfrom
rename-editor-to-text-editor
Sep 1, 2026
Merged

refactor(editor): rename LegalEditor to TextEditor#42
thoda-dev merged 1 commit into
masterfrom
rename-editor-to-text-editor

Conversation

@thoda-dev

Copy link
Copy Markdown
Owner

What this changes

Closes #41

LegalEditor.client.vue becomes TextEditor.client.vue, the legal-document class becomes rich-text along with its stylesheet, and the toolbar's tooltips move from admin.legal.editor.* to a root editor.* block. No behaviour changes: the editor renders the same toolbar over the same schema, and /admin/legal and /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-text is not only the editor's content class: LegalDocument.vue carries it too, because the published page has to look identical to what the editor showed. So the stylesheet, the nuxt.config.ts entry 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 is title — 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.ts still sees identical key sets.

LegalDocument.vue and LegalTable.vue keep 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 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. 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 from legal-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.

  • 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 component to be renamed and for the legal-specific class names to go with it; it found what else was carrying the vocabulary (the i18n namespace, the stylesheet, the comments) and drew the line at the published-page components.

Copilot AI lite review requested due to automatic review settings September 1, 2026 18:11

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.

🟢 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 TextEditor and moves tooltip i18n keys to the root editor.* namespace.
  • Renames the shared prose styling class from legal-document to rich-text and 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.

@thoda-dev
thoda-dev merged commit 85e5b2f into master Sep 1, 2026
7 checks passed
@thoda-dev
thoda-dev deleted the rename-editor-to-text-editor branch September 1, 2026 18:21
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.

The Markdown editor is named and wired as though it could only ever serve the legal pages

2 participants