# romikmakavana/tiptap-pagination architecture

> Architecture diagram of the GitHub repository romikmakavana/tiptap-pagination, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/romikmakavana/tiptap-pagination
- Repository: https://github.com/romikmakavana/tiptap-pagination

## Overview

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: [`src/ui/tiptap-editor.tsx`](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/ui/tiptap-editor.tsx) (Editor Shell), [`src/App.tsx`](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/App.tsx) (App), [`src/lib/contents`](https://github.com/romikmakavana/tiptap-pagination/tree/main/src/lib/contents) (Sample Content), [`src/components/image-plus/tiptap-editor.tsx`](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/components/image-plus/tiptap-editor.tsx) (Image Editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_app["App Shell"]
  node_node_main(("main<br/>React entry<br/>[main.tsx]"))
  node_node_app["App<br/>Shell<br/>[App.tsx]"]
end

subgraph group_group_demos["Demo Pages"]
  node_node_home["Home<br/>Landing page<br/>[Home.tsx]"]
  node_node_image_page["Image Plus<br/>Demo page<br/>[ImagePlus.tsx]"]
  node_node_table_with_page["Table + Paginate<br/>Demo page"]
  node_node_table_without_page["Table + No Paginate<br/>Demo page"]
end

subgraph group_group_editor["Editor Integration"]
  node_node_editor_shell["Editor Shell<br/>TipTap wrapper<br/>[tiptap-editor.tsx]"]
  node_node_image_editor["Image Editor<br/>Feature editor<br/>[tiptap-editor.tsx]"]
  node_node_table_pag_editor["Paginated Table Editor<br/>Feature editor<br/>[tiptap-editor.tsx]"]
  node_node_table_plain_editor["Plain Table Editor<br/>Feature editor<br/>[tiptap-editor.tsx]"]
  node_node_header_footer["Header/Footer<br/>Page chrome<br/>[header-footer.tsx]"]
  node_node_toolbar["Toolbar<br/>Editor controls<br/>[toolbar.tsx]"]
end

subgraph group_group_content["Content & Config"]
  node_node_contents[("Sample Content<br/>Document fixtures")]
  node_node_editor_content["Content Adapter<br/>Content helper<br/>[editor-content.ts]"]
  node_node_config["Config<br/>[config.ts]"]
  node_node_types["Types<br/>[index.ts]"]
end

subgraph group_group_ui["Shared UI"]
  node_node_ui_primitives["UI Primitives<br/>Shared components"]
  node_node_banners["Banners<br/>Promo UI<br/>[open-for-work.tsx]"]
  node_node_sponsor["Sponsor<br/>Promo UI<br/>[sponsor-work.tsx]"]
end

subgraph group_group_styles["Styling"]
  node_node_styles_global["Global CSS<br/>Stylesheets<br/>[index.css]"]
  node_node_styles_features["Feature CSS<br/>Stylesheets"]
end

subgraph group_group_build["Build & Deploy"]
  node_node_docs[("Docs Site<br/>Static build")]
  node_node_vite["Build Tooling<br/>Vite/TS config<br/>[vite.config.ts]"]
end

node_node_main -->|"mounts"| node_node_app
node_node_app -->|"routes to"| node_node_home
node_node_app -->|"routes to"| node_node_image_page
node_node_app -->|"routes to"| node_node_table_with_page
node_node_app -->|"routes to"| node_node_table_without_page
node_node_home -->|"navigates"| node_node_editor_shell
node_node_image_page -->|"uses"| node_node_image_editor
node_node_table_with_page -->|"uses"| node_node_table_pag_editor
node_node_table_without_page -->|"uses"| node_node_table_plain_editor
node_node_image_editor -->|"specializes"| node_node_editor_shell
node_node_table_pag_editor -->|"specializes"| node_node_editor_shell
node_node_table_plain_editor -->|"specializes"| node_node_editor_shell
node_node_editor_shell -->|"wraps"| node_node_header_footer
node_node_editor_shell -->|"exposes"| node_node_toolbar
node_node_editor_shell -->|"reads"| node_node_config
node_node_editor_shell -->|"loads"| node_node_editor_content
node_node_editor_content -->|"sources"| node_node_contents
node_node_config -->|"typed by"| node_node_types
node_node_image_editor -->|"uses"| node_node_contents
node_node_table_pag_editor -->|"uses"| node_node_contents
node_node_table_plain_editor -->|"uses"| node_node_contents
node_node_ui_primitives -->|"supports"| node_node_toolbar
node_node_banners -->|"decorates"| node_node_app
node_node_sponsor -->|"decorates"| node_node_app
node_node_styles_global -->|"styles"| node_node_editor_shell
node_node_styles_features -->|"styles"| node_node_editor_shell
node_node_vite -->|"builds"| node_node_docs
node_node_vite -->|"serves"| node_node_app

click node_node_main "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/main.tsx"
click node_node_app "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/App.tsx"
click node_node_home "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/pages/Home.tsx"
click node_node_image_page "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/pages/ImagePlus.tsx"
click node_node_table_with_page "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/pages/TablePlusWithPagination.tsx"
click node_node_table_without_page "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/pages/TablePlusWithoutPagination.tsx"
click node_node_editor_shell "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/ui/tiptap-editor.tsx"
click node_node_image_editor "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/components/image-plus/tiptap-editor.tsx"
click node_node_table_pag_editor "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/components/table-with-pagination/tiptap-editor.tsx"
click node_node_table_plain_editor "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/components/table-without-pagination/tiptap-editor.tsx"
click node_node_header_footer "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/ui/editor/header-footer.tsx"
click node_node_toolbar "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/ui/editor/toolbar.tsx"
click node_node_contents "https://github.com/romikmakavana/tiptap-pagination/tree/main/src/lib/contents"
click node_node_editor_content "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/lib/editor-content.ts"
click node_node_config "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/lib/config.ts"
click node_node_types "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/types/index.ts"
click node_node_ui_primitives "https://github.com/romikmakavana/tiptap-pagination/tree/main/src/components/ui"
click node_node_banners "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/ui/open-for-work.tsx"
click node_node_sponsor "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/ui/sponsor-work.tsx"
click node_node_styles_global "https://github.com/romikmakavana/tiptap-pagination/blob/main/src/index.css"
click node_node_styles_features "https://github.com/romikmakavana/tiptap-pagination/tree/main/src/styles"
click node_node_docs "https://github.com/romikmakavana/tiptap-pagination/tree/main/docs"
click node_node_vite "https://github.com/romikmakavana/tiptap-pagination/blob/main/vite.config.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_node_main,node_node_app,node_node_docs,node_node_vite toneBlue
class node_node_home,node_node_image_page,node_node_table_with_page,node_node_table_without_page toneAmber
class node_node_editor_shell,node_node_image_editor,node_node_table_pag_editor,node_node_table_plain_editor,node_node_header_footer,node_node_toolbar toneMint
class node_node_contents,node_node_editor_content,node_node_config,node_node_types toneRose
class node_node_ui_primitives,node_node_banners,node_node_sponsor toneIndigo
class node_node_styles_global,node_node_styles_features toneTeal
```

## Components

### App Shell

React entry and top-level routing/composition

- [main](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/main.tsx): React entry · Mounts the client-side app into the DOM · `src/main.tsx`
- [App](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/App.tsx): Shell · Top-level composition and navigation between demo views · `src/App.tsx`

### Demo Pages

Route-level scenarios that showcase pagination behaviors

- [Home](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/pages/Home.tsx): Landing page · Entry page and navigation hub for the demos · `src/pages/Home.tsx`
- [Image Plus](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/pages/ImagePlus.tsx): Demo page · Showcases image-aware pagination behavior · `src/pages/ImagePlus.tsx`
- [Table + Paginate](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/pages/TablePlusWithPagination.tsx): Demo page · Demonstrates table splitting across pages · `src/pages/TablePlusWithPagination.tsx`
- [Table + No Paginate](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/pages/TablePlusWithoutPagination.tsx): Demo page · Comparison view without table pagination · `src/pages/TablePlusWithoutPagination.tsx`

### Editor Integration

TipTap editor wrappers and surrounding chrome

- [Editor Shell](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/ui/tiptap-editor.tsx): TipTap wrapper · Shared editor wrapper used by demo pages · `src/ui/tiptap-editor.tsx`
- [Image Editor](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/components/image-plus/tiptap-editor.tsx): Feature editor · Image-plus specific editor configuration · `src/components/image-plus/tiptap-editor.tsx`
- [Paginated Table Editor](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/components/table-with-pagination/tiptap-editor.tsx): Feature editor · Table demo with pagination enabled · `src/components/table-with-pagination/tiptap-editor.tsx`
- [Plain Table Editor](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/components/table-without-pagination/tiptap-editor.tsx): Feature editor · Table demo without pagination enabled · `src/components/table-without-pagination/tiptap-editor.tsx`
- [Header/Footer](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/ui/editor/header-footer.tsx): Page chrome · Renders page headers and footers around editor content · `src/ui/editor/header-footer.tsx`
- [Toolbar](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/ui/editor/toolbar.tsx): Editor controls · Editor actions and pagination-related controls · `src/ui/editor/toolbar.tsx`

### Content & Config

Static example documents and shared editor settings

- [Sample Content](https://github.com/romikmakavana/tiptap-pagination/tree/main/src/lib/contents): Document fixtures · Static example documents for the demo scenarios · `src/lib/contents`
- [Content Adapter](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/lib/editor-content.ts): Content helper · Shared abstraction for supplying content into editors · `src/lib/editor-content.ts`
- [Config](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/lib/config.ts): Editor config · Shared editor settings and options · `src/lib/config.ts`
- [Types](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/types/index.ts): TypeScript models · App-specific config and content types · `src/types/index.ts`

### Shared UI

Reusable primitives and demo-site banners

- [UI Primitives](https://github.com/romikmakavana/tiptap-pagination/tree/main/src/components/ui): Shared components · Reusable buttons and toast primitives · `src/components/ui`
- [Banners](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/ui/open-for-work.tsx): Promo UI · Site-wide informational/promotional blocks · `src/ui/open-for-work.tsx`
- [Sponsor](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/ui/sponsor-work.tsx): Promo UI · Sponsor/support callout used in the site · `src/ui/sponsor-work.tsx`

### Styling

Global and feature styles that shape pagination and tables

- [Global CSS](https://github.com/romikmakavana/tiptap-pagination/blob/main/src/index.css): Stylesheets · App-wide and editor-specific styling foundations · `src/index.css`
- [Feature CSS](https://github.com/romikmakavana/tiptap-pagination/tree/main/src/styles): Stylesheets · Pagination, header/footer, and table styling · `src/styles`

### Build & Deploy

Local tooling and static deployment artifacts

- [Docs Site](https://github.com/romikmakavana/tiptap-pagination/tree/main/docs): Static build · Prebuilt deployed site artifact · `docs`
- [Build Tooling](https://github.com/romikmakavana/tiptap-pagination/blob/main/vite.config.ts): Vite/TS config · Development and build configuration layer · `vite.config.ts`

## Connections

- 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
