How to handle page breaks? #4960
Unanswered
EricHasegawa
asked this question in
Questions & Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using TipTap in a React application and need to implement page breaks at regular intervals (every 1,056px to be exact). Turns out that page breaks are actually super tricky in TipTap/ProseMirror, I've looked at [this community extension] (#3408) that creates a custom node, but this is not that helpful in my context as it can be moved around, deleted etc. I've looked at this "Should I use a state based plugin or a view based one" discussion in the ProseMirror forums and it provided some insight but nothing very specific, and I've also looked at this discussion which helps in handling printing but not dynamic page breaks.
Given all this, it's clear this will be super tricky. My two main options seem to be:
PageBreak
node, which I am not a huge fan of since I'll have to make it immovable, immutable, and will have to add a lot of custom logic to make content be inserted around it, finding where they should go etc.EditorContent
and manually insert a customdiv
every 1056 px that looks/feels like a page break.My main question is whether or not option 2 is possible. It seems like lots of logic is abstracted away in
<EditorContent>
and I'm not sure I can put my own divs in there and do all that I need to. There's not much documentation around customizing this, one question I have is what doessetRenderer
do and can it help me here? Also looking for general advice or suggestions on how to approach this.Beta Was this translation helpful? Give feedback.
All reactions