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

Html / Epub reader implementation #836

Open
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

michalrentka
Copy link
Contributor

No description provided.

@jarbus
Copy link

jarbus commented Jan 29, 2024

I've literally been stalking this repo since last November because I've been so excited for epub support in Zotero haha, so great to see this PR

Copy link
Contributor

@mvasilak mvasilak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some first comments. More will follow.

scripts/bundle_reader.sh Outdated Show resolved Hide resolved
Zotero/Scenes/Detail/DetailCoordinator.swift Outdated Show resolved Hide resolved
Zotero/Models/Files.swift Show resolved Hide resolved
@chenggiant
Copy link

Looking forward to the epub and html support!

@haidar47x
Copy link

Glad to see it being implemented. :)

@mvasilak
Copy link
Contributor

@michalrentka some comments from testing ePUB attachments.

general

  • When I download an attachment to open, rarely, it opens empty and I have to close the reader and open it again, for the document to appear. Could there be a potential race issue when downloading, copying to temporary folder, and loading the document?
  • For images in the document, e.g. a cover, I can hold-tap to get a context menu, which is nice, unless we think it may cause some confusion.
Wuthering Heights
  • I can even select text on an image, which may be confusing if a user tries to annotate it (like I tried 😅).
Wuthering Heights

Annotations

  • Creating an annotation may create 2 annotations with some text overlapping.
Screenshot 2024-10-15 at 15 10 23
  • Creating further annotations, may not be rendered, although text is selected, and you get an error like:

[ERROR] Zotero(+0000001): HtmlEpubDocumentViewController: navigating to 6NREE26N failed - Error Domain=WKErrorDomain Code=4 "A JavaScript exception occurred" UserInfo={WKJavaScriptExceptionLineNumber=31037, WKJavaScriptExceptionMessage=Error: Unsupported FragmentSelector.conformsTo: undefined, WKJavaScriptExceptionColumnNumber=103, WKJavaScriptExceptionSourceURL=file:///.../view.js, NSLocalizedDescription=A JavaScript exception occurred}. [(155) HtmlEpubDocumentViewController.selectInDocument(key:); com.apple.main-thread]

  • Closing and re-opening the document after, in both iOS & macOS, will show a blank screen, as it seems corrupted. (No errors are logged in iOS log when re-opening)
  • Trying to delete an annotation from the sidebar in this state, logs this error (although the annotation is deleted):

[ERROR] Zotero(+0000000): HtmlEpubDocumentViewController: updating document failed - Error Domain=WKErrorDomain Code=4 "A JavaScript exception occurred" UserInfo={WKJavaScriptExceptionLineNumber=31037, WKJavaScriptExceptionMessage=Error: Unsupported FragmentSelector.conformsTo: undefined, WKJavaScriptExceptionColumnNumber=103, WKJavaScriptExceptionSourceURL=file:///.../view.js, NSLocalizedDescription=A JavaScript exception occurred}. [(167) HtmlEpubDocumentViewController.updateView(modifications:insertions:deletions:); com.apple.main-thread]

  • Deleting all the annotations (only possible in iOS), eliminates the corrupted state, and re-opening the document displays it as expected.

Rendering

  • It’s not always the same in macOS and iOS, which makes sense, but I may see empty pages in iOS, that I don’t see in macOS.
  • Decreasing reader height, e.g. by moving the toolbar to the top, may hide some of the bottom content.
  • Changing reader size in any way, e.g. by rotating, will render annotation rects in the wrong place.
Screenshot 2024-10-15 at 15 14 32

Navigation

  • It would be nice to have a table of contents in the sidebar.
  • It would be nice to have page controls in the toolbar.
  • Tapping a link would be nice to create a back button.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants