Skip to content

Add standalone Reading Mode for mobile - #259

Open
AbeJellinek wants to merge 2 commits into
zotero:masterfrom
AbeJellinek:standalone-mobile-reading-mode
Open

AbeJellinek wants to merge 2 commits into
zotero:masterfrom
AbeJellinek:standalone-mobile-reading-mode

Conversation

@AbeJellinek

Copy link
Copy Markdown
Member

Only supports PDF, since snapshots will have an underlying reader.

PDF annotation sort indexes won't always be exactly the same here because we don't have pdf.js, so we're using post-normalization character counts from SDT. @mrtcode, is that an issue?

@michalrentka, the app will need to listen for onRequestPageRegionImages and then call setPageRegionImages with the result (a data URL). See index.ios.js for the signatures.

@mrtcode

mrtcode commented Sep 25, 2026

Copy link
Copy Markdown
Member

@AbeJellinek

PDF annotation sort indexes won't always be exactly the same here because we don't have pdf.js, so we're using post-normalization character counts from SDT. @mrtcode, is that an issue?

Should be fine, because sort indexes synced from desktop also have the same issue.

Note: There’s a bug where preformatted blocks in SDT currently don’t have textMap, which means neither sort indexes nor annotations work correctly on them. But I’m fixing that on another branch.

@michalrentka

Copy link
Copy Markdown
Contributor

@michalrentka, the app will need to listen for onRequestPageRegionImages and then call setPageRegionImages with the result (a data URL). See index.ios.js for the signatures.

That sounds good, should work just fine.

@michalrentka

Copy link
Copy Markdown
Contributor

@AbeJellinek one possible blocker is I got Module not found: Error: Can't resolve '../pdf/lib/sdt-block-crops' in '/Users/michalrentka/Development/Zotero/zotero-ios/reader/src/common' when trying to build current PR, maybe you forgot to git add some file(s)?

Otherwise when fixed can we merge it?

@AbeJellinek

Copy link
Copy Markdown
Member Author

Indeed... sorry about that! Try again now.

@michalrentka

michalrentka commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Indeed... sorry about that! Try again now.

Seems to be working fine now! Even rendering images is fine. I may raise some smaller bugs later, but this is good to merge now.

Actually, I found another issue: only pdf-view.js and epub-view.ts emit outlinePath, SDTView._updateViewStats doesn't (viewStats don't contain outlinePath in reading mode), so the outline in sidebar doesn't get selected as I'm scrolling the document. I can see the same in desktop app. But since we have outline available, shouldn't this be available as well?

One slightly weird thing is that onChangeViewStats are not sent as the user is scrolling, so current page updates only after the scrolling stops completely. In epub reader it's not so apparent because it updates after page change, but since reading mode has smooth scrolling, it's quite visible that pages don't change, only after it completely stops.

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.

3 participants