Content & editorial
Rich Text Editor
Generated from docs/plan/core/rich-text-editor/PLAN.md in the AstroBaaS repository. Nothing described below is implemented — it is the written plan for it.
Rich Text Editor provides a WYSIWYG editor for product descriptions, blog posts, and category content, allowing merchants to format text with bold, italic, underline, links, lists, tables, and image embeds without writing HTML. The editor exports clean HTML and integrates with all content forms across AstroBaaS. This is core GPL functionality: foundational CMS infrastructure, no per-country obligation, honest open-source implementation.
The problem
Merchants waste hours formatting content manually because they can’t apply bold, links, lists, or tables without switching to a HTML editor or external tool. Non-technical staff can’t write formatted content. Content looks plain and uninviting, hurting conversions.
What it does
- WYSIWYG editor: inline formatting (bold, italic, underline, strikethrough)
- Block formatting: headings (h1–h4), paragraph, blockquote, code block
- Lists: ordered (1, 2, 3) and unordered (bullets), nested lists supported
- Links: add link, edit URL, set target (_blank for external), remove link
- Tables: insert table (N rows × M cols), edit cell content, add/remove rows and columns
- Image embeds: drag-and-drop or ‘Add Image’ button, insert from asset store
- Undo/redo: full undo history (Ctrl+Z, Ctrl+Y)
- HTML export: clean, semantic HTML output (<strong>, <em>, <ul>, <table>)
- Paste from Word: convert Word doc formatting to semantic HTML (strip styling, keep structure)
- HTML import: edit existing HTML, editor parses and re-renders
What it deliberately does NOT do
Each boundary carries its reason. A boundary without a reason gets crossed by the next person who reads this.
- AI writing assistance (suggest next sentence) — scope is editing only; AI generation is separate
- Collaborative editing (multiple staff editing same post simultaneously) — scope is single-user editing; real-time collaboration requires separate infrastructure
- Advanced styling (custom CSS, classes, IDs) — scope is semantic HTML only; custom CSS is storefront responsibility
Data model
Core storage: content fields support HTML body (stored as string, validated on save). No schema migration if existing fields already support rich text.
API
- POST /api/editor/validate-html — validate HTML for semantic correctness (block/inline nesting rules)
- POST /api/editor/import-html — parse HTML, return JSON representation for editor
- POST /api/editor/export-html — convert editor state to clean HTML
Every route added here must also appear in src/pages/openapi.json.ts — a test
fails the build if it does not.
Admin
Editor embedded in every form with content (product description, blog post, category description). Toolbar shows formatting buttons: Bold, Italic, Link, Heading, List, Table, Image. Editor area is editable region with real-time preview of formatted output. Insert Table dialog: rows and columns input. Paste from Word converts formatting automatically.
The seam — why this is core
Core owns: entire rich text editor (WYSIWYG implementation, export logic, HTML validation). No paid pack owns this; it’s foundational GPL code.
GPL-3.0 core owns the interface + honest WYSIWYG implementation; no licensing or per-country obligations required.
Dependencies
- core-asset-store (image embed uses asset store)
Acceptance checks
Each of these must be able to fail. Before claiming this is done, break the code deliberately and watch each one go red.
- Typing ‘Test’ then selecting and clicking Bold button produces ‘<strong>Test</strong>’ in HTML
- Pasting content from Word doc with styles (bold, italics, bullets) converts to semantic HTML without inline styles
- Insert table: 3 rows × 2 cols creates <table> with cells
- Add link: select text ‘click here’, click Link, enter URL; produces ‘<a href=”…”>click here</a>’
- Undo (Ctrl+Z) removes last formatting change; Redo (Ctrl+Y) reapplies
- Export HTML is clean and semantic: no <span style=‘color: red’>, no nested <b><b>, valid XHTML
Risks
HTML parsing vulnerability: untrusted HTML injected (script tags, onclick handlers). Mitigation: sanitize on import and export. Editor state bloat on large documents (10,000+ words) causes performance lag. Table editing unintuitive (users expect Excel-like interface, not form dialog). Paste from Word produces bloated HTML; Word markup must be aggressively stripped.
Commercial context
| Suggested price | free (core) |
| Rival anchor | Shopify: included; Magento: included |
The anchor is what the nearest equivalent charges on Shopify or Magento today. It is context for a pricing decision, not the decision.
Generated from the commerce plan. See docs/COMMERCE-PLAN.md for the full
catalogue and ../../AI-GUIDE.md for how to work on this repository.