Open source

SynTextEditor

A rich text editor for React and Next.js (@syntext/react)

Type
Library
Built with
TypeScript
Source
Public repository
Librarypublic repo
ST
ReactViteTailwind CSS (dev)

Overview

A rich text editor for React and Next.js where the document is data, not HTML: the editor edits a small JSON model, a viewer renders it as React elements, and toHTML produces HTML when you need it.

Core features

One component from word-processor richness (fonts, sizes, colours, tables, media, checklists, find and replace) down to a plain comment box, with presets whose schema also filters paste and shortcuts; a direct React binding through useSynTextEditor with no provider; media over your own storage via four functions or REST endpoints; fully themeable through --se-* CSS variables; a configurable right-click menu; video with custom thumbnails and a library-drawn player; custom fonts; and slots to replace any part of the UI.

Architecture

Roughly 40 KB gzipped for the full editor UI and 9 KB for the viewer, with lucide-react as the only runtime dependency and React 18+ as a peer. Built with Vite in library mode with generated type declarations, tested with Vitest, documented page by page, and released as GitHub-release packages. It powers the rich text in CUT2STYLE, Synlor, SovereignTerminal and Commerza.

Frameworks, tools & libraries

The stack behind it

Frameworks

  • React
  • Vite
  • Tailwind CSS (dev)

Tools & infrastructure

  • pnpm workspaces
  • Vitest
  • vite-plugin-dts
  • GitHub Releases

Libraries

  • lucide-react

Where it runs

My own products that depend on this library.

Skills applied

What I brought to it

  1. 01

    Document-model design: JSON schema, editing operations and undo history

  2. 02

    React library architecture: instance-as-API, controlled options, slot-based customisation

  3. 03

    Rich-text engineering: selection, paste filtering, tables, media, find and replace

  4. 04

    Design-token theming with CSS variables

  5. 05

    Bundle-size discipline for a distributable component

  6. 06

    Unit testing with Vitest

Languages

What it's written in

  • TypeScript~32 files

    editor, viewer and tools

  • CSS~5 files

    themeable `se-*` styles

Next project

SynTools

Free browser-based media tools