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

@standhigher/shopify-rich-text-editor

v1.0.0

Published

React rich text editor for Shopify Apps, built with Tiptap 3, Shopify Polaris, and Shopify image upload hooks.

Downloads

1,114

Readme

@standhigher/shopify-rich-text-editor

npm version npm downloads CI License: MIT Storybook

React rich text editor for Shopify Apps, built with Tiptap 3, Shopify Polaris, and Shopify image upload hooks.

Links

Installation

pnpm add @standhigher/shopify-rich-text-editor
pnpm add @shopify/polaris react react-dom

Import styles once:

@import "@shopify/polaris/build/esm/styles.css";
@import "@standhigher/shopify-rich-text-editor/styles.css";

Basic Usage

"use client";

import { useState } from "react";
import type { JSONContent } from "@tiptap/core";
import {
  RichTextEditor,
  type RichTextError,
  type ShopifyImageUploadResult
} from "@standhigher/shopify-rich-text-editor";

const emptyContent: JSONContent = {
  type: "doc",
  content: [{ type: "paragraph" }]
};

async function uploadToShopify(file: File): Promise<ShopifyImageUploadResult> {
  const formData = new FormData();
  formData.append("file", file);

  const response = await fetch("/api/shopify/files/upload", {
    method: "POST",
    body: formData
  });

  if (!response.ok) {
    throw new Error("Image upload failed");
  }

  return response.json();
}

export function ProductDescriptionEditor() {
  const [content, setContent] = useState<JSONContent>(emptyContent);

  function handleError(error: RichTextError) {
    console.error(error.code, error.message);
  }

  return (
    <RichTextEditor
      value={content}
      onChange={setContent}
      onUploadImage={uploadToShopify}
      onError={handleError}
      placeholder="Write product content..."
    />
  );
}

Shopify resource provider (experimental)

Resource APIs are opt-in and experimental in 1.0. New integrations should import the provider types from @standhigher/shopify-rich-text-editor/experimental. The root type export remains available for 0.6.x source compatibility.

Resource selection is injected by the host Shopify App. The editor does not import App Bridge, Shopify Admin SDK, or hold Admin API tokens.

import type { ResourceProvider } from "@standhigher/shopify-rich-text-editor";

const resourceProvider: ResourceProvider = {
  async selectResource({ resourceType, selectionLimit }) {
    // Call the host app's Resource Picker and map its result to this contract.
    // Return null when the user cancels.
    return selectFromHostApp({ resourceType, selectionLimit });
  }
};

<RichTextEditor
  value={content}
  onChange={setContent}
  resourceProvider={resourceProvider}
/>;

The provider returns only a stable Shopify GID and an optional display snapshot:

interface ResourceReference {
  resourceType: "product" | "collection" | "variant";
  id: string;
  title?: string;
  handle?: string;
  image?: string;
}

Cancellation returns null and does not create an empty node. Provider failures use PERMISSION_DENIED, NETWORK_ERROR, or RESOURCE_NOT_FOUND; the editor reports an unexpected selection failure through onError without modifying the document.

Component Overview

export interface RichTextEditorProps {
  value: JSONContent;
  onChange?: (content: JSONContent) => void;
  onError?: (error: RichTextError) => void;
  readOnly?: boolean;
  disabled?: boolean;
  placeholder?: string;
  extensionContracts?: readonly EditorExtension[];
  resourceProvider?: ResourceProvider;
  onUploadImage?: (file: File) => Promise<ShopifyImageUploadResult>;
}

export interface RichTextError {
  code: "IMAGE_UPLOAD_FAILED" | "RESOURCE_SELECTION_FAILED";
  message: string;
  recoverable: boolean;
  cause: unknown;
}

export interface ShopifyImageUploadResult {
  src: string;
  alt?: string;
  title?: string;
  shopifyFileId?: string;
}

Compatibility

| Package | Supported | | --- | --- | | React | ^18.3.1 | | React DOM | ^18.3.1 | | Shopify Polaris | ^12.0.0 | | Tiptap | ^3.0.0 | | TypeScript | ^5.8.2 | | Node.js | >=22.0.0 | | Protocol / schema | 1 / 2026-08 |

Editor states

  • readOnly hides the toolbar and prevents editing.
  • disabled keeps the toolbar visible but disables editing controls.
  • onError receives structured recoverable upload errors.
  • Pending debounced changes are flushed when the editor unmounts.

Extension contracts

The editor accepts optional EditorExtension contracts. The default StarterKit, Link, Underline, and Image setup remains registered automatically, so existing 0.3.x usage does not change.

import { Node } from "@tiptap/core";
import { RichTextEditor, type EditorExtension } from "@standhigher/shopify-rich-text-editor";

const calloutExtension: EditorExtension = {
  id: "callout",
  version: "1.0.0",
  nodes: ["callout"],
  client: {
    extensions: [Node.create({ name: "callout", group: "block", content: "inline*" })]
  }
};

<RichTextEditor value={emptyContent} extensionContracts={[calloutExtension]} />;

The registry resolves dependencies first and rejects duplicate extension IDs, duplicate node or mark names, missing dependencies, and dependency cycles with structured ExtensionRegistryError values. Client registration does not make a node safe for server rendering by itself.

Package Quality

The published package includes dist, TypeScript declarations, styles.css, README, and MIT license only.

Maintenance

This package is maintained by Standhigher for Shopify App rich text workflows. Please report bugs and feature requests on GitHub Issues.

Local Development

pnpm install
pnpm dev
pnpm storybook
pnpm -r typecheck
pnpm test
pnpm build

Release Preparation

npm run lint
npm run test
npm run typecheck
npm run build
npm run build-storybook
pnpm pack:dry-run