Migration v1 → v2
v2 is a breaking release. The changes below are the only ones you need to worry about.
1. Tailwind is no longer required
Remove any tailwind.config.js entries that referenced the library’s dist/ folder. Instead, import the bundled stylesheet:
// in your app entry (e.g. app/layout.tsx, main.tsx, _app.tsx)
import "@tolipovjs/rich-text/styles.css"2. apiKey prop removed
It was a no-op. If you were passing it, just delete it.
3. theme prop now actually works
<RichTextEditor theme="dark" />v1 ignored this prop. v2 wires it to a data-rte-theme attribute and the CSS variable tokens.
4. Sanitizer drops style by default
If you were relying on inline styles in editor output, opt back in:
HTMLSanitizer.sanitize(html, { allowStyle: true })This default change closes an XSS hole. Prefer adding semantic classes and styling them externally where possible.
5. RichTextEditor is now a forwardRef
If you wrapped the editor in a <div ref> and queried the DOM, migrate to the imperative API:
const ref = useRef<RichTextEditorHandle>(null)
<RichTextEditor ref={ref} />
ref.current?.getHTML()
ref.current?.focus()6. New props
theme,toolbar,customButtons,onImageUploadreadOnly,maxLength,autoFocusshowStats,allowHtmlMode,minHeightonFocus,onBlur,onSelectionChange
Full changelog
See the CHANGELOG.md in the repo for the comprehensive list.