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

@unizap/html-editor

v0.2.0

Published

A TipTap-based rich HTML paste/edit component with style-preserving paste and code output view.

Readme

@unizap/html-editor

A rich HTML paste/edit component built on TipTap, designed to preserve formatting exactly as it's copied from external sources (Google Docs, Word, web pages, etc.) while giving you clean, sanitized HTML output.

Features

  • Style-preserving paste — retains inline styles, block-level formatting, and images from pasted content instead of stripping it down to plain text.
  • Sanitized input — pasted HTML is sanitized via DOMPurify before it reaches the editor.
  • Built-in toolbar — headings, text alignment, tables, links, images, and more, out of the box.
  • Code output view — a syntax-highlighted (via Shiki), copyable, optionally prettified view of the editor's HTML output.
  • Fully typed — ships with TypeScript declarations.

Install

npm install @unizap/html-editor

Peer dependencies

This package expects react and react-dom (v18+) to already be installed in your project.

Usage

Import the component and its stylesheet, then wire it up as a controlled input. By default the editor grows with its content (starting at a min-height, no forced height):

"use client";

import { useState } from "react";
import { HtmlEditor, CodeOutput } from "@unizap/html-editor";
import "@unizap/html-editor/styles.css";

export default function Example() {
  const [html, setHtml] = useState("");

  return (
    <div className="mx-auto flex max-w-4xl flex-col gap-4 p-4">
      <HtmlEditor value={html} onChange={setHtml} placeholder="Paste or type..." />
      <CodeOutput code={html} />
    </div>
  );
}

To instead place the editor in a bounded flex layout (fixed height, independently scrollable — e.g. a two-pane dashboard), pass contentClassName:

<div className="flex h-screen gap-4 p-4">
  <HtmlEditor
    value={html}
    onChange={setHtml}
    className="flex min-h-0 flex-1 flex-col"
    contentClassName="flex min-h-0 flex-1 flex-col"
  />
  <CodeOutput code={html} className="min-h-0 flex-1" />
</div>

Note: HtmlEditor and CodeOutput are client components — use them inside a component marked "use client" (or import them from one) if you're using React Server Components / Next.js App Router.

API

<HtmlEditor />

| Prop | Type | Required | Description | | ------------------ | ------------------------ | -------- | --------------------------------------------------------- | | value | string | Yes | The current HTML content, as an HTML string. | | onChange | (html: string) => void | Yes | Called with the updated HTML string on every edit. | | placeholder | string | No | Placeholder text shown when the editor is empty. Defaults to "Paste or type...". | | className | string | No | Class applied to the editor's outer wrapping element. | | contentClassName | string | No | Class applied to the scrollable editor content area. Pass a bounded-flex className (e.g. "flex min-h-0 flex-1 flex-col") to make the editor fill and scroll within a fixed-height layout; omit it to let the editor grow with its content. |

The editor also shows a dashed-border "dropzone" hint when it's empty and unfocused.

<CodeOutput />

| Prop | Type | Required | Description | | ----------- | -------- | -------- | ----------------------------------------------------- | | code | string | Yes | The HTML string to render, highlight, and make copyable. | | className | string | No | Class applied to the output panel's wrapping element. |

Includes a "Prettify" toggle and a "Copy" button in its header bar.

Other exports

For advanced use cases, the underlying TipTap extensions and utilities used by HtmlEditor are also exported:

  • Toolbar — the formatting toolbar used internally by HtmlEditor.
  • PreserveStyle, PreserveStyleBlock, PreserveStyleSpan — TipTap extensions that retain inline/block styles on pasted content.
  • PreservedImage — a TipTap image extension configured to allow base64 image data.
  • sanitizePastedHtml(html: string): string — sanitizes raw pasted HTML using DOMPurify.
  • prettifyHtml(html: string): string — formats/indents an HTML string for readability.

License

MIT