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

tiptap-image-resizer

v1.0.0

Published

A fully-featured resizable image extension for Tiptap editors — resize, crop, rotate, flip, filters, watermark, border, caption and more.

Readme

tiptap-image-resizer

A fully-featured resizable image extension for Tiptap editors, built with React and Next.js.

License Next.js Tiptap


✨ Features

| Feature | Description | |---------|-------------| | 🔲 Resize | 8-handle resize with live W×H tooltip, Shift = aspect ratio lock | | 🔄 Rotate | 90° CW / CCW rotation with rotate-aware resize handles (Phases 1–4) | | ↔ Flip | Horizontal and vertical flip via native CSS transform | | ✋ Drag | Drag image anywhere within editor boundaries | | ✂ Crop | Non-destructive overlay preview → destructive canvas apply | | 🎨 Filters | 11 presets (Vivid, B&W, Vintage, etc.) + 8 individual sliders + Photon WASM bake | | 💧 Watermark | Text watermark with opacity, size, and position controls | | 🖼 Border | Radius, width, color, style (solid/dashed/dotted/double) | | 🌑 Shadow | 6 box-shadow presets | | 💬 Caption | Editable caption with alignment, synced with drag | | ↩ Undo/Redo | 50-step image-specific history | | 🔁 Master Reset | One-click reset — restores original image (pre-Photon), clears all filters, transforms, border, caption | | ⌨ Keyboard | Arrow nudge, Shift+Arrow 10px, Alt+Arrow resize, Del delete | | 🖱 Context Menu | Right-click menu with all actions | | 🔤 Alt Text | Inline alt text editing | | ⚙ Configurable | ResizableImage.configure({...}) for custom defaults |


🚀 Getting Started

Prerequisites

  • Node.js 18+
  • npm / yarn / pnpm

Installation

git clone https://github.com/zyronvexley1713/tiptap-image-resizer.git
cd tiptap-image-resizer
npm install

Run Development Server

npm run dev

Open http://localhost:3000 to see the demo.


📦 Usage

Basic

import { ResizableImage } from './components/editor/extensions/ResizableImage';

const editor = useEditor({
  extensions: [StarterKit, ResizableImage],
});

With Custom Options

const editor = useEditor({
  extensions: [
    StarterKit,
    ResizableImage.configure({
      defaultWidth:    400,      // Default insert width
      defaultHeight:   300,      // Default insert height
      defaultAlign:    'center', // 'left' | 'center' | 'right'
      minWidth:        60,       // Minimum resize width
      minHeight:       40,       // Minimum resize height
      maxWidth:        800,      // null = no limit
      lockAspectRatio: false,    // Lock ratio without Shift
      allowDrag:       true,     // Enable/disable drag
      allowCrop:       true,     // Enable/disable crop
      allowFilters:    true,     // Enable/disable filters
      allowRotate:     true,     // Enable/disable rotate/flip
      allowWatermark:  true,     // Enable/disable watermark
      allowCaption:    true,     // Enable/disable caption
      HTMLAttributes:  { class: 'my-image-wrapper' },
    }),
  ],
});

🔁 Master Reset

The Reset Image button in the toolbar resets everything back to the original state:

  • ✅ Restores original image source (before any Photon filter bake or watermark)
  • ✅ Resets all filters (brightness, contrast, saturation, blur, etc.)
  • ✅ Clears flip and rotation
  • ✅ Removes border and shadow
  • ✅ Clears caption and alt text
  • ✅ Resets position, alignment, and dimensions to defaults
  • ✅ Clears crop

The original image URL is saved automatically on first insert via originalSrc attribute, so even after multiple Photon bakes or watermarks, reset always goes back to the very first image.


⌨ Keyboard Shortcuts

| Key | Action | |-----|--------| | Arrow keys | Nudge image 1px | | Shift + Arrow | Nudge image 10px | | Alt + Arrow | Resize image | | Shift + drag handle | Lock aspect ratio | | Delete / Backspace | Delete image | | Escape | Deselect / cancel crop |


🗂 Project Structure

app/
  components/
    editor/
      extensions/
        ResizableImage.ts           # Tiptap node extension + configurable options
      components/
        ResizableImageComponent.tsx  # Main node view component
        ImageCaption.tsx             # Caption component
      hooks/
        useResize.ts                # Resize logic (rotate-aware, phases 1–4)
        useDrag.ts                  # Drag with boundary clamp
        useImageCrop.ts             # Crop overlay + apply
        useImageKeyboard.ts         # Keyboard shortcuts
        useImageHistory.ts          # Undo/redo (50 steps)
      panels/
        FilterPanel.tsx             # Filters, presets, Photon WASM, watermark
        BorderPanel.tsx             # Border & shadow UI
        CropPanel.tsx               # Crop overlay UI
      WorkspaceEditor.tsx           # Demo toolbar + editor UI

🛠 Tech Stack


📄 License

MIT © zyronvexley1713