Commit Graph
276 Commits
Author SHA1 Message Date
John Factotum b26cde2527 FXL: don't use book viewport if it's empty
Fixes https://github.com/johnfactotum/foliate-js/issues/52#issuecomment-2956113877
2025-06-10 20:51:27 +08:00
Huang Xin 4ee127d88f Textwalker with optional filter func parameter (#77) 2025-06-10 12:45:43 +00:00
Huang Xin d7affcf969 Create ID lookup cache for manifest (#75) 2025-06-10 12:09:54 +00:00
Huang Xin f2d32152df Add transform target for KF8 files (#74) 2025-06-10 10:43:34 +00:00
John Factotum 76527e8324 Create eslint.yml (#72) 2025-05-31 04:32:22 +00:00
John Factotum 12dd11d1aa Run eslint --fix 2025-05-31 12:24:30 +08:00
Protected 1fe4803888 Mitigate fixed-layout exception on render when there's no available source for blankWidth and blankHeight (#70) 2025-05-31 04:18:01 +00:00
Protected 42dea3be3d Fix for fixed-layout transform anchor point in RTL context. (#68)
If the viewer is running in an RTL context (this is not the same as the
reading direction of the Book itself), and a fixed-layout rendered view
is scaled (which is often the case), anchoring the transform to the
left breaks page positioning.
2025-05-31 03:52:04 +00:00
Protected ed6400ddcb Re-render single pages when paginating fixed layout (#61) 2025-05-30 08:46:42 +00:00
Protected 9fc0b62803 Fix for FixedLayout.index returning incorrect values depending on position in spread. (#59) 2025-05-13 13:18:03 +00:00
Protected 1e8080754c Generate full document for comic-book iframes in order to prevent warning spam. (#60)
Prevents the document from rendering in quirks mode unnecessarily and warnings about encoding.
2025-05-13 13:17:02 +00:00
Protected 55f1a28406 Prevent exception on Firefox due to getSelection returning null (#57) 2025-05-13 12:49:18 +00:00
John Factotum 052123beaf Add an EventTarget for transforming the book
And use it to do paginator-specific CSS replacements.

And use it to catch loading errors in reader.js.

Fixes #14
Closes #18
2025-03-29 15:09:23 +08:00
John Factotum d4696cea4b FB2: only check <binary>s when getting data
Fixes https://github.com/johnfactotum/foliate/issues/1492
2025-03-12 17:28:30 +08:00
Ray-D-Song e2014ee753 Fix selection handling in Paginator component (#46) 2025-02-13 07:52:19 +00:00
Huang Xin 27f8b57d05 Init view TTS with text segmentation granularity (#47)
in order to support more TTS backends

This PR also fixes a potential off-by-one error at the end boundary of the segment using `sentence` granularity.
2025-02-13 07:52:03 +00:00
John Factotum 34b9079a1b Fix comparing CFIs with different number of !s
Fixes #45
2024-12-21 04:56:43 +08:00
John Factotum 63a5dbf3e3 Don't scroll to anchor if caret's moved by pointer
In Safari, clicking on links triggers `selectionchange`. Since we do not
move the caret when flipping through pages, when you have flipped to the
next or previous pages and click on any link, it would take you back to
the caret instead of activating the link.

Note that the bug occurs in Safari 17 but not in WebKitGTK 2.46.

Not sure if there's a way to fix this and still retain the "set anchor
to caret on click" behavior. But I guess this behavior isn't really that
essential, anyway. So removing it for now.

Fixes #44
2024-12-12 09:35:33 +08:00
John Factotum cc2882ff39 Update README.md
Reflect the changes after 022ea7da87, and
other clarifications.
2024-12-02 18:39:45 +08:00
John Factotum 2e30f3db35 Footnotes: improve superscript detection 2024-12-02 17:57:01 +08:00
John Factotum 6f8eb1b85b Fix missing trailing comma 2024-12-02 09:54:55 +08:00
John Factotum 936c4f78e5 FB2: fix tables
Fixes https://github.com/johnfactotum/foliate/issues/1445
2024-12-02 09:47:58 +08:00
John Factotum b5ae4c22c1 CBZ: remove body margin
Fixes https://github.com/johnfactotum/foliate/issues/1421
2024-11-04 05:37:40 +08:00
John Factotum 24187b79f9 EPUB: fix opf:file-as
Fixes #39
2024-11-03 11:19:14 +08:00
John Factotum 519c0329b2 PDF: improve metadata 2024-10-18 13:42:49 +08:00
Huang Xin f24e611c4e Lazy loading of PDF documents (#37) (#38) 2024-10-18 04:05:31 +00:00
John Factotum 022ea7da87 Make <foliate-view> handle opening files directly 2024-10-12 10:48:51 +08:00
John Factotum 76c15569db Fix linguist-vendored attribute 2024-10-12 07:55:17 +08:00
John Factotum ae61c5e85f Make zip.js, fflate, and PDF.js dev dependencies
Previously, zip.js and fflate were built from the main Foliate repo.
And PDF.js files were copied manually. Now they all build here.

Unfortunately, two CSS files still need to be copied manually.
2024-10-12 07:44:33 +08:00
John Factotum b82ec0b294 FXL: add zoom setting
The value of the `zoom` attribute can be either `"fit-page"` (default),
`"fit-width"`, or a number.
2024-10-11 06:41:32 +08:00
John Factotum 7cbc36b489 Media Overlay: fix skipping
- Fix not seeking when skipping to another section when paused
- Fix not playing when skipping when not paused in WebKit
2024-10-07 11:00:57 +08:00
John Factotum fa85f135df EPUB: fix metadata 2024-10-06 11:29:32 +08:00
John Factotum 2e8b4fab0d OPDS: improve metadata 2024-10-06 10:16:46 +08:00
John Factotum e384aaf6dd Media Overlay: add stop() method
And don't remove highlight when pausing
2024-09-30 19:31:14 +08:00
John Factotum bf9adef636 Paginator: react to selection only on input 2024-09-30 19:00:11 +08:00
John Factotum 916dfb13ac View: don't destroy book on close
The book object is not created by the view class so it has no business
destroying it.

Fix bug caused by 1e952102bd where closing
the footnote view destroys the book, when it should not be destroyed,
being still displayed by another view
2024-09-30 18:50:07 +08:00
John Factotum 4cd2ca2eb3 PDF: fix comment 2024-09-28 19:32:14 +08:00
John Factotum 3409674e66 PDF: set isEvalSupported to false
`eval()` would be blocked by CSP and thus not supported
2024-09-28 19:17:12 +08:00
John Factotum 45d67a0db3 PDF: add CMaps and fonts 2024-09-28 17:41:38 +08:00
John Factotum be76724699 PDF: fix text selection 2024-09-28 17:38:59 +08:00
John Factotum ffb4f7b74e Create FUNDING.yml 2024-09-28 06:39:01 +00:00
John Factotum 693341f008 PDF: fix links 2024-09-28 14:29:47 +08:00
John Factotum 1e952102bd PDF: rerender when scale changes
The fixed-layout renderer now accepts an object for the return value of
`load()` (on the `book.sections` items). If it's an object, the `src`
is the URL of the section, and `onZoom`, if present, will be called
when the viewport is zoomed. With this you can scale the page yourself
rather than relying on the renderer's own scaling with CSS transform.

Also upgraded to PDF.js 4.6.82. And now internal links are broken...
Don't know how to fix that yet.
2024-09-28 12:12:59 +08:00
John Factotum ba403301a2 View: add ability to automatically hide cursor
Controlled by the boolean attribute `autohide-cursor`
2024-09-27 10:24:45 +08:00
John Factotum f3afcabd96 Media Overlay: support playback-active-class 2024-09-26 13:23:40 +08:00
John Factotum 357c129b5d Media Overlay: don't seek in canplaythrough
So this is what was causing the `canplaythrough` loop in Chromium and
Firefox.
2024-09-26 12:56:09 +08:00
John Factotum 22189f184e EPUB: fix media overlay playback
For some reason `canplaythrough` is firing more than once
2024-09-26 12:37:06 +08:00
John Factotum e94b85ce09 FB2: don't throw when image has no xlink:href
Fixes #35
2024-09-25 23:15:02 +08:00
John Factotum dcd4ff403e Paginator: fix scrolling to collapsed ranges that contain elements 2024-09-25 22:41:20 +08:00
John Factotum 02a24ea25c Grammar 2024-09-25 22:33:02 +08:00