How romikmakavana/tiptap-pagination works
This repository is a demo/documentation site for the tiptap-pagination-plus TipTap extension, not the extension package itself. The app’s job is to showcase pagination behavior, especially page headers/footers and table splitting, in a few focused scenarios.
1. Overall shape
- It is a client-side React + TypeScript app built with Vite.
- There is no backend or data API in the repo; all examples are static, local, and content-driven.
- The important architectural split is between sample content/configuration and the TipTap editor shell that renders that content with pagination features.
2. Entry and app shell
- src/main.tsx mounts the React app.
- src/App.tsx is the top-level composition point.
- src/pages/* provides the main routes/views: Home, ImagePlus, TablePlusWithPagination, and TablePlusWithoutPagination.
- This is a multi-demo site: each page isolates one behavior of the editor extension.
3. Page-level demos
- Home.tsx is likely the landing page and navigation hub.
- ImagePlus.tsx showcases image-aware editor behavior.
- TablePlusWithPagination.tsx demonstrates tables that split across pages.
- TablePlusWithoutPagination.tsx shows the same editor surface without the table pagination behavior for comparison.
- This “with vs without” split is a key architectural boundary in the demo.
4. Editor integration layer
- The main editor wrapper lives in src/ui/tiptap-editor.tsx.
- Feature-specific editor wrappers also exist under src/components/.../tiptap-editor.tsx, one each for image-plus and the two table variants.
- These wrappers are where the TipTap editor is configured, extensions are assembled, and page-specific demo behavior is injected.
5. Content layer
- Static example content is centralized in src/lib/contents/.
- Files like image-plus-content.ts, table-plus-with-pagination.ts, and table-plus-without-pagination.ts provide the document bodies used by each demo.
- src/lib/editor-content.ts likely acts as a shared abstraction for supplying content into the editor components.
- This makes the demos reproducible and keeps page components thin.
6. Configuration and shared utilities
- src/lib/config.ts and src/lib/utils.ts hold shared editor configuration and helper logic.
- src/types/index.ts defines app-specific TypeScript types for those configs and content models.
- This layer decouples the page components from low-level editor options.
7. UI chrome around the editor
- src/ui/editor/header-footer.tsx and src/ui/editor/toolbar.tsx provide the editor’s surrounding controls and page chrome.
- src/ui/open-for-work.tsx and src/ui/sponsor-work.tsx are likely promotional/info banners used in the demo site.
- src/components/ui/button.tsx and src/components/ui/sonner.tsx provide shared UI primitives, including button styling and toast notifications.
8. Styling system
- Styling is split between app-level CSS and feature CSS:
- src/index.css, src/App.css
- src/styles/editor.css, header-footer.css, pagination.css, table.css
- The pagination and table demos are visually dependent on these styles; they are not just cosmetic, they shape how page breaks, headers, and tables are perceived.
- tailwind.config.ts and components.json indicate a utility/component-oriented styling setup, with some generated/shared UI conventions.
9. Data flow through the app
- User opens a demo page.
- The page component selects example content and editor options.
- Those are passed into a TipTap editor wrapper.
- The editor renders the content, applies pagination/table extensions, and uses shared header/footer/toolbar UI around the document.
- User actions in the toolbar or editor update editor state and extension behavior, but there is no server round-trip.
10. Documentation/build output boundary
- docs/ contains a prebuilt static site, including bundled JS/CSS assets and index.html.
- That suggests the repo publishes a static demo/docs site, likely for hosting on GitHub Pages or similar.
- vite.config.ts, eslint.config.js, tsconfig*.json, and Gruntfile.cjs support local development and production builds, while ecosystem.config.cjs suggests a process/runtime wrapper for serving or deploying the site.
11. External dependency boundary
- The central external dependency is TipTap, plus the tiptap-pagination-plus extension this site documents.
- The README shows the extension’s configuration model: page sizing, margins, headers/footers, per-page overrides, click callbacks, and table pagination commands.
- The demo site’s architecture is organized to exercise those extension features in isolation and make the rendering behavior visible.
In diagram terms, this repo is best drawn as a static React demo site with a thin page/navigation layer on top, a shared TipTap editor integration layer in the middle, and static sample content/configuration feeding that editor from below. The docs/ directory is the deployment artifact of the same app.
Main entry points: ui/tiptap-editor.tsx Editor Shell · App.tsx App · contents Sample Content · image-plus/tiptap-editor.tsx Image Editor
Components 23
App Shell
React entry and top-level routing/composition
Demo Pages
Route-level scenarios that showcase pagination behaviors
- Home · Entry page and navigation hub for the demos
src/pages/Home.tsx - Image Plus · Showcases image-aware pagination behavior
src/pages/ImagePlus.tsx - Table + Paginate · Demonstrates table splitting across pages
src/pages/TablePlusWithPagination.tsx - Table + No Paginate · Comparison view without table pagination
src/pages/TablePlusWithoutPagination.tsx
Editor Integration
TipTap editor wrappers and surrounding chrome
- Editor Shell · Shared editor wrapper used by demo pages
src/ui/tiptap-editor.tsx - Image Editor · Image-plus specific editor configuration
src/components/image-plus/tiptap-editor.tsx - Paginated Table Editor · Table demo with pagination enabled
src/components/table-with-pagination/tiptap-editor.tsx - Plain Table Editor · Table demo without pagination enabled
src/components/table-without-pagination/tiptap-editor.tsx - Header/Footer · Renders page headers and footers around editor content
src/ui/editor/header-footer.tsx - Toolbar · Editor actions and pagination-related controls
src/ui/editor/toolbar.tsx
Content & Config
Static example documents and shared editor settings
- Sample Content · Static example documents for the demo scenarios
src/lib/contents - Content Adapter · Shared abstraction for supplying content into editors
src/lib/editor-content.ts - Config · Shared editor settings and options
src/lib/config.ts - Types · App-specific config and content types
src/types/index.ts
Shared UI
Reusable primitives and demo-site banners
- UI Primitives · Reusable buttons and toast primitives
src/components/ui - Banners · Site-wide informational/promotional blocks
src/ui/open-for-work.tsx - Sponsor · Sponsor/support callout used in the site
src/ui/sponsor-work.tsx
Styling
Global and feature styles that shape pagination and tables
- Global CSS · App-wide and editor-specific styling foundations
src/index.css - Feature CSS · Pagination, header/footer, and table styling
src/styles
Build & Deploy
Local tooling and static deployment artifacts
- Docs Site · Prebuilt deployed site artifact
docs - Build Tooling · Development and build configuration layer
vite.config.ts
Connections 28
- main → App: mounts · Bootstraps the React application
- App → Home: routes to · Provides the landing page
- App → Image Plus: routes to · Provides the image demo page
- App → Table + Paginate: routes to · Provides the paginated table demo page
- App → Table + No Paginate: routes to · Provides the non-paginated comparison page
- Home → Editor Shell: navigates · Entry point into the shared editor demo experience
- Image Plus → Image Editor: uses · Mounts the image-specific editor wrapper
- Table + Paginate → Paginated Table Editor: uses · Mounts the paginated table editor wrapper
- Table + No Paginate → Plain Table Editor: uses · Mounts the non-paginated table editor wrapper
- Image Editor → Editor Shell: specializes · Feature editor builds on the shared editor shell
- Paginated Table Editor → Editor Shell: specializes · Feature editor builds on the shared editor shell
- Plain Table Editor → Editor Shell: specializes · Feature editor builds on the shared editor shell
- Editor Shell → Header/Footer: wraps · Adds page chrome around the editable document
- Editor Shell → Toolbar: exposes · Provides controls for editor actions
- Editor Shell → Config: reads · Consumes shared editor settings
- Editor Shell → Content Adapter: loads · Accepts document content through a shared adapter
- Content Adapter → Sample Content: sources · Backed by static example documents
- Config → Types: typed by · Configuration is shaped by shared TypeScript models
- Image Editor → Sample Content: uses · Injects image demo content
- Paginated Table Editor → Sample Content: uses · Injects paginated table demo content
- Plain Table Editor → Sample Content: uses · Injects non-paginated table demo content
- UI Primitives → Toolbar: supports · Provides shared interactive UI elements
- Banners → App: decorates · Adds informational site chrome
- Sponsor → App: decorates · Adds promotional site chrome
- Global CSS → Editor Shell: styles · Applies base editor and app styling
- Feature CSS → Editor Shell: styles · Shapes pagination, headers, and tables
- Build Tooling → Docs Site: builds · Produces the static docs site artifact
- Build Tooling → App: serves · Supports local development and bundling