How aslam97/minimal-tiptap works
Project Type and Purpose
• This is a “component library” full-stack project, but focused entirely on the frontend.
• It packages a customizable rich-text editor built on Tiptap and Shadcn UI, then publishes a block-registry JSON for shadcn/ui integration.
File Structure Analysis
Top-level artifacts:
• src/
– components/minimal-tiptap: the core editor module (extensions, hooks, styles, UI wrappers)
– components/ui: Shadcn UI wrapper components (button, dialog, tooltip, etc.)
– components/custom: example usage patterns (hero, grid, forms)
– lib/utils.ts, data/content.json
– main.tsx, App.tsx (demo harness)
• public/: static assets and manifest
• registry/block-registry.json: published registry manifest
• scripts/: build.ts (generates registry), schema.ts
• Vite & TypeScript configs, package.json
Key README Insights
• It’s installed via shadcn CLI or manually added.
• Exposes a <MinimalTiptapEditor> React component with props for value, onChange, toolbar configuration, image handling, etc.
• Image support is pluggable (uploadFn, validation, error handlers).
• Development workflow: run build-registry → host/serve registry → shadcn CLI consumes registry.
Main Components
A. Consumer Application
– Your React app that consumes the registry or imports minimal-tiptap directly.
B. shadcn CLI & Registry
– CLI (npx shadcn@latest) pulls block-registry.json
– registry/block-registry.json describes metadata & entry points
C. Minimal Tiptap Editor Package
1. Editor Core (Tiptap Starter Kit + custom extensions)
2. UI Layer (Shadcn UI wrappers, Tailwind CSS)
3. Hooks & Utils (useMinimalTiptap, useTheme, useThrottle, utils.ts)
4. Styles (CSS partials under minimal-tiptap/styles)
D. Build & Publish Pipeline
– scripts/build.ts and schema.ts generate registry manifest
– CI/Local host registry via npm run host-registry
E. Runtime Dependencies
Component Interactions
1. Consumer App → (via shadcn CLI or direct import) → registry/block-registry.json → pulls Editor Package
2. Consumer mounts <MinimalTiptapEditor> inside <TooltipProvider>
4. UI Layer renders toolbar sections (SectionOne, Two, Four, Five) and content area
5. User actions → Tiptap Transactions → onChange prop → consumer state
6. Image uploads: Editor calls uploadFn → custom uploader → returns URL → Tiptap mounts image node
7. Build scripts scan src/components/minimal-tiptap to generate block-registry.json for CLI
Architectural Patterns & Principles
• Component-Based Design: decoupled React components (core editor vs. UI vs. examples).
• Registry Pattern: external JSON manifest decouples publishing from code.
• Build Pipeline: scripts generate metadata for CLI consumers.
Technologies & Frameworks
– React + TypeScript + Vite
– Tiptap (ProseMirror)
– Shadcn UI (Radix UI + Tailwind CSS)
– Node scripts (TypeScript) for registry build
Diagramming Recommendations
– Orange for CLI & registry artifacts.
• Essential props/data flows: “value → onChange → output format (HTML/JSON/text)”, “uploadFn → HTTP request → image URL”.