-
-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Dear watate,
Hello!
I have recently been studying and using your open-source repository, epub_pro. I am incredibly impressed by its excellent and robust CFI (Canonical Fragment Identifier) management system. Thank you for contributing this outstanding work to the community.
As I try to integrate epub_pro into my own project, I've encountered a challenge regarding content rendering and precise CFI mapping.
As we know, EPUB content is essentially HTML. In Flutter, a common approach to rendering HTML is using the flutter_html library. However, flutter_html does not seem to provide any way to get callbacks for DOM nodes or to calculate a precise CFI.
The only workaround I can currently think of is to define a "fuzzy" CFI based on the external blocks rendered by flutter_html (e.g., based on the Flutter widget paragraphs it generates). However, this method can only locate an approximate paragraph (e.g., .../4/2[para_5]) and cannot pinpoint the specific text node and offset (e.g., .../4/2/1:50) that epub_pro's internal mechanism is designed to handle. This largely wastes the excellent, precise CFI management you've built, which is crucial for features like highlighting and accurate bookmarks.
I've observed that it seems only components like SelectableText, which perhaps cache (or allow access to) their internal text layout and DOM structure, could possibly interface with epub_pro's internal CFI logic.
Therefore, I would like to kindly ask for your advice: In your design, how do you solve the rendering of EPUB content (HTML) while simultaneously achieving the precise CFI support that matches epub_pro's internal logic? Are you using a specific rendering widget, or do you employ another clever method to bridge the "rendering layer" and the "CFI logic layer"?
Thank you very much for your valuable time. Any insights you could provide would be of immense help to me.
Best regards,