rich-text@tolipovjs

Frequently asked questions

If your question isn’t here, open an issue on GitHub.

Do I need Tailwind to use this editor?

No. v2 ships its own stylesheet. Import @tolipovjs/rich-text/styles.css once and you’re done.

Does it work with Next.js App Router (SSR / RSC)?

Yes. The component is a client component (use 'use client' on the wrapping file). All document/window access inside the library is SSR-guarded.

How do I change colors without forking?

Override any --rte-* CSS variable in your own stylesheet or via the style prop. The whole visual surface is themeable.

Can I make the editor fully read-only?

Yes — pass readOnly. The toolbar hides and the surface is no longer contentEditable.

How do I upload images to my server instead of base64?

Pass onImageUpload — an async function that takes a File and returns the final URL string.

Is the output safe to render?

The library sanitizes content on every change: strips <script>/<iframe>/<object>/<embed>, blocks javascript:, removes on* handlers, and adds rel=noopener to target=_blank.

Can I export to Markdown?

Yes — import { htmlToMarkdown } from '@tolipovjs/rich-text' and pass it your HTML string.

Does it support React 19?

Yes. The peer range is react ^18 || ^19.

What browsers are supported?

Chrome 60+, Firefox 55+, Safari 12+, Edge 79+. The editor uses document.execCommand (deprecated but still supported in all modern browsers).

Is there a controlled API?

Yes. Pass value + onChange. There’s also an imperative ref API for focus/clear/getHTML and friends.