Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Missing Automatic Pagination Support for Page-Based Editing in Tiptap #6192

Open
1 task done
ALGOREX-PH opened this issue Mar 22, 2025 · 0 comments
Open
1 task done
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@ALGOREX-PH
Copy link

ALGOREX-PH commented Mar 22, 2025

Affected Packages

Editor

Version(s)

2.11.5

Bug Description

📝 Description of the Issue
I’m currently building a page-based document editor using Tiptap, and I’ve encountered a major limitation: Tiptap doesn’t support automatic pagination. This is a critical feature for applications where users are expected to write across multiple page layouts—like resumes, formal reports, academic papers, or any print-ready document format.

Right now, as I type and fill up a styled page container (for example, a div sized like an A4 sheet), Tiptap allows the content to overflow rather than automatically pushing excess content onto a new page. Similarly, if I delete enough text, content from the next page doesn’t pull back to fill the previous one. This breaks the illusion of a natural, flowing document and disrupts both UX and layout integrity.

This kind of functionality is standard in editors like Google Docs, and I believe Tiptap should support it natively or at least provide hooks or extensions to make it feasible to implement.

✅ Expected Behavior
What I expect from Tiptap in a page-based editor setup:

It should automatically detect when a page is full and move the remaining content to a new, styled page container.

When content is deleted and space becomes available, content from the next page should move back up to fill the gap (reverse pagination).

The layout should:

Preserve formatting such as paragraphs, headings, lists, and tables

Avoid breaking paragraphs across pages awkwardly

Respect defined margins and prevent layout glitches

Dynamically reflow when the user adjusts font size, spacing, or window size

❌ Actual Behavior
Here’s what I’m seeing instead:

There’s no built-in mechanism for handling page boundaries.

Content simply overflows the page div, making it visually and functionally break from a proper paginated layout.

There’s no reverse flow of content when removing text.

I'm left trying to hack together pagination logic manually, which is hard to maintain and fragile—especially with more complex content like tables, images, or embeds.

Attempted CSS or observer-based workarounds only simulate pagination visually but do not enforce content structure between pages.

🧪 Steps to Reproduce
I styled a Tiptap editor inside a fixed-height container (e.g., simulating an A4 page with 1-inch margins).

I typed enough paragraphs to exceed the container’s visible space.

The content just continued down—no new page was created.

I tried deleting some content—nothing moved back up.

I added tables and images—these overlapped page boundaries, further breaking layout expectations.

📌 Why This Matters
This issue has been a blocker in building:

Google Docs-style document editors

Resume or CV builders that require strict layout control

Print-preview or PDF-generation tools

Education and enterprise applications that involve formal, multi-page documents

Without this feature:

The user experience suffers, since the document no longer behaves like a document.

Printed output becomes unpredictable or broken.

I have to write complex, fragile logic to manage pagination myself—something that ideally should be abstracted by the library.

💡 Suggested Enhancement
To fix this, I suggest adding an official pagination system or extension with the following features:

  1. Layout-aware Pagination Module
    Detect the height of content blocks within a styled page container.

Push excess nodes to the next container when a page is full.

  1. Content Flow Manager
    Dynamically shift nodes forward or backward across pages based on content changes.

  2. Page-Aware Node Rendering
    Prevent splitting large elements across pages.

Add page-break options for blocks like headings, paragraphs, images, etc.

  1. Virtualized Page Renderer
    Render only a few pages at a time (like infinite scroll) for performance, especially in long documents.

  2. Hooks or Events
    Provide lifecycle hooks when a page is added or removed.

Let developers customize pagination behavior or style it with their own logic.

📎 Temporary Workarounds I Tried (and Their Issues)
CSS max-height & overflow: Only hides content but doesn’t trigger a true content move.

Manual content splitting by node index: Unscalable and breaks with large or dynamic elements.

ResizeObserver tracking: Inconsistent results when used with real-time typing and image/media content.

None of these offer a solid, production-ready solution for true pagination.

📷 Visual Reference (What I’m Hoping For)
I type until Page 1 is full → content automatically flows into Page 2.

I delete from Page 1 → Page 2 content moves back up seamlessly.

Each page remains visually and structurally distinct—just like in Google Docs or Microsoft Word.

🔚 Conclusion
In my opinion, the lack of automatic pagination is one of the few but significant gaps in Tiptap for page-based editors. Adding true automatic pagination and dynamic content flow across pages would significantly boost Tiptap’s usability for a wide range of real-world applications.

I’d love to see this prioritized—whether as a core feature, a built-in extension, or even guidance on how to implement this in a maintainable way. I'm happy to help test or contribute if this becomes part of the roadmap.

Thanks for the great work on Tiptap!

Browser Used

Chrome

Code Example URL

No response

Expected Behavior

✅ Expected Behavior
What I expect from Tiptap in a page-based editor setup:

It should automatically detect when a page is full and move the remaining content to a new, styled page container.

When content is deleted and space becomes available, content from the next page should move back up to fill the gap (reverse pagination).

The layout should:

Preserve formatting such as paragraphs, headings, lists, and tables

Avoid breaking paragraphs across pages awkwardly

Respect defined margins and prevent layout glitches

Dynamically reflow when the user adjusts font size, spacing, or window size

Additional Context (Optional)

No response

Dependency Updates

  • Yes, I've updated all my dependencies.
@ALGOREX-PH ALGOREX-PH added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Mar 22, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Tiptap: Issues Mar 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
Status: Needs Triage
Development

No branches or pull requests

1 participant