npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

teem-editor

v0.2.0

Published

TeemEditor — simple, fast WYSIWYG for React and Next.js with full RTL (Persian, Arabic) and LTR support

Readme

TeemEditor

Simple. Efficient. Fast. A lightweight WYSIWYG editor for React and Next.js, with first-class RTL support for Persian and Arabic, plus English and other LTR languages.

TeemEditor screenshot

Why TeemEditor

  • Simple — one component, clear API, no heavy schema or plugin maze
  • Efficient — small surface area, focused features, easy to drop into any app
  • Performant — lean client-side editor built for real product UIs
  • React & Next.js ready — works in client components; easy dynamic import for App Router
  • RTL / LTR — full bidirectional UI and content direction (fa, ar, en, and more)

Features

  • Headings (h1h6), paragraphs, and preformatted text
  • Bullet and numbered lists
  • Bold, italic, strikethrough
  • Blockquote
  • Left / center / right alignment
  • Indent / outdent (without accidental blockquotes)
  • Link and image insert (secure upload or URL)
  • Horizontal rule
  • Text color and highlight
  • Undo / redo
  • Visual ↔ HTML source toggle
  • i18n UI: en (default), fa, ar

Install

npm install teem-editor dompurify

react and react-dom must already be in your project.

Optional font for Persian/Arabic UI: Vazirmatn

<link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;600;700&display=swap" rel="stylesheet" />

Usage (React)

import { useState } from 'react';
import { TeemEditor } from 'teem-editor';
import 'teem-editor/styles.css';

export default function MyPage() {
  const [html, setHtml] = useState('<p><br></p>');

  return (
    <TeemEditor
      value={html}
      onChange={setHtml}
      language="en"
      onUpload={async (file) => {
        const form = new FormData();
        form.append('file', file);
        const res = await fetch('/api/upload', { method: 'POST', body: form });
        const data = await res.json();
        return data.url;
      }}
    />
  );
}

Persian / Arabic (RTL)

<TeemEditor language="fa" value={html} onChange={setHtml} />
<TeemEditor language="ar" value={html} onChange={setHtml} />

dir defaults to ltr for English and rtl for fa / ar. Override anytime with the dir prop.

Next.js (App Router)

Client Component:

'use client';

import { useState } from 'react';
import { TeemEditor } from 'teem-editor';
import 'teem-editor/styles.css';

export default function RichEditor() {
  const [html, setHtml] = useState('<p>Hello world</p>');
  return (
    <TeemEditor
      language="en"
      value={html}
      onChange={setHtml}
      onUpload={uploadToServer}
    />
  );
}

Or load from a Server Component:

import dynamic from 'next/dynamic';

const TeemEditor = dynamic(
  () => import('teem-editor').then((m) => m.TeemEditor),
  { ssr: false }
);

Image upload security

Before upload, TeemEditor checks:

  1. Allowed extensions: .jpg .jpeg .png .gif .webp
  2. Allowed MIME types
  3. Real magic bytes (anti-spoof)
  4. Max size (default 2 MB)
  5. Filename sanitization
  6. HTML sanitization with DOMPurify (strips script, event handlers, javascript: URLs)

Production tip

Prefer onUpload and re-validate on your server. Without onUpload, images are embedded as base64 data URLs (works offline, larger HTML).

uploadOptions={{
  maxSizeBytes: 2 * 1024 * 1024,
  allowedMimeTypes: ['image/jpeg', 'image/png', 'image/webp', 'image/gif'],
}}

Props

| Prop | Type | Description | |------|------|-------------| | value | string | Controlled HTML | | defaultValue | string | Initial HTML (uncontrolled) | | onChange | (html) => void | Sanitized HTML callback | | language | 'en' \| 'fa' \| 'ar' | UI language (default: en) | | placeholder | string | Placeholder text | | dir | 'rtl' \| 'ltr' | Content direction (defaults from language) | | minHeight | number | Minimum editor height | | noscroll | boolean | Grow with content (default false → max height = viewport, scroll inside) | | disabled | boolean | Disable editing | | onUpload | (file, meta) => Promise<string> | Image upload → URL | | uploadOptions | object | Upload validation options | | toolbar | boolean | Show toolbar | | className / style | — | Root container styling |

Ref API

const ref = useRef(null);

ref.current.focus();
ref.current.getHTML();
ref.current.setHTML('<p>Hello</p>');
ref.current.clear();

Helpers

import {
  sanitizeHtml,
  validateImageFile,
  processImageUpload,
  getMessages,
} from 'teem-editor';

Local development

npm install
npm run dev    # Vite demo
npm run build  # Build dist for npm

License

MIT