I built a rich-text editor from scratch. No ProseMirror, no dependencies.
说明与用途
构建了一个无依赖的 WYSIWYG 编辑器 Trevixal,可嵌入应用并导出多种格式。
问题
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.
结果
Trevixal delivers a feature‑rich editor (tables, equations, diagrams, suggesting mode, theming, extensive exports) while remaining dependency‑free and embeddable.
工作流
- 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.).
证据
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.
- 记录日期: 2026-10-22T10:26:08.765Z