-
Notifications
You must be signed in to change notification settings - Fork 5
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
does it work well for 500+ pages? #41
Comments
thank you for responding so quick! |
np. See #27. The toolbar I have isn't part of this repo since this is the extension only - it gives you the power to have pages in your editor, not the toolbar. Same way that the table extension allows you to have tables but doesn't provide a toolbar to interface with. I've been working on #36 (see #39 for the active PR). It's fairly complex so might take me a while but if I get this working to a decent standard I'll consider putting a demo page together. |
Further to the above, the other reason for the toolbar not being a part of this repo is it should be agnostic of how consuming projects want the toolbar to be styled. E.g. in my ss above I'm using Material UI but someone else might want to use something different. So if I do end up making a demo page, it'll be a separate repo to keep dependencies down in this one |
Would it be possible to make performance improvements by using intersection observer and then only render the contents of a page when its in view? |
Interesting. Yeah possibly but I guess it really comes down to if Tiptap/prosemirror supports it. I.e. there might be some limitation we don't know about. |
I've done a bit of looking into this. While I don't think we can use an intersection observer, the algorithm for updating the page content could potentially be optimised a bit. We can't use an intersection observer (from what I can see) because code in this repo doesn't actually handle rendering the page nodes - all it does is apply some styling to the page node to set the height, width, margins, etc. Because I can't trigger the If anything, your feature request here should (imo) be directed towards Tiptap/PM. Having pages doesn't really have anything to do with it - it's just that currently the entire document is recomputed whenever a node height changes or you add/remove a node (e.g. Enter/Backspace/Delete key). For example, you could have some other kind of node which is "heavy" and have the same performance problem with a really long document since that node would still be rendered (added to the DOM) even if it's far outside the viewport. Following on from my first sentence, what I might be able to do is in the update method within https://github.com/hugs7/tiptap-extension-pagination/blob/7fbe0609982cc8fe77f4d9d552511e278c25b879/src/Plugins/Pagination.ts#L25, somehow be a bit more efficient in computing a new document, rather than re-rendering an entire new one each time. If we ignore multi-user support for a moment, we know that wherever the current selection is, that must be where the update just happened. So we can inspect nodes here, and do one of the following
This way, performance should hopefully be improved a bit but performance would be (slightly) biased to editing at the end of the document, since we never have to check above the current selection, but we do below it. Again, this isn't really a priority for me but happy to leave it open and revisit it in the future. |
Yep! Thanks for taking a look, if you keep this issue open, I'll give it a shot as well |
Hi, thanks for opensourcing your work :)
so i randomly tried putting this in umadoc and it kind of failed. so i wonder if you can try large content within your plugin and let me know if it does work without crashing the browser.
https://www.gutenberg.org/cache/epub/75051/pg75051-images.html
The text was updated successfully, but these errors were encountered: