I built a rich-text editor from scratch. No ProseMirror, no dependencies.
Description and use
Built a dependency‑free WYSIWYG editor Trevixal that can be embedded in apps and exports to many formats.
Problem
Developers often rely on existing rich-text engines (ProseMirror, Lexical, Slate, Quill, Draft.js) and want to understand the implications of building an editor without such dependencies.
Outcome
Trevixal delivers a feature‑rich editor (tables, equations, diagrams, suggesting mode, theming, extensive exports) while remaining dependency‑free and embeddable.
Workflow
- 1. Define a JSON schema for documents.
- 2. Implement undo as inversion of edit steps.
- 3. Sanitize pasted HTML using an allowlist and test against attack payloads.
- 4. Expose UI via optional chrome package or adapters.
- 5. Export to multiple formats (HTML, Markdown, Word, PDF, etc.).
Evidence
Trevixal is a WYSIWYG editor engine in about 60,000 lines of TypeScript and SCSS, with the document model, the undo system, the HTML sanitizer, the DOM renderer, the ZIP and XML writers behind Word export, and the LaTeX-to-MathML converter all written in this repository.
The core is headless. The chrome (menus, toolbar, dialogs) is a separate, optional package. There are adapters for React, Vue, Svelte and Angular, a web component, and an assembled "whole editor" you can mount in one call.
- Record date: 2026-10-22T10:26:08.765Z