Skip to content

Commit

Permalink
💩 Handle EPUB with pre-paginated layout & no spread (#2020)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwingt authored Jan 20, 2025
1 parent 27bf4b1 commit 95333c8
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/pages/reader/epub.vue
Original file line number Diff line number Diff line change
Expand Up @@ -368,13 +368,21 @@ export default {
),
});
const cfi = this.resumeFromLocalStorage();
this.rendition.themes.default({
body: {
'-webkit-text-size-adjust': 'none',
'text-size-adjust': 'none',
direction: 'ltr', // mitigate epubjs mixing up dir & page-progression-direction
},
});
const metadata = await this.book.loaded.metadata;
const bodyCSS = {
color: '#333',
'-webkit-text-size-adjust': 'none',
'text-size-adjust': 'none',
direction: 'ltr', // mitigate epubjs mixing up dir & page-progression-direction
};
if (metadata.layout === 'pre-paginated' && metadata.spread === 'none') {
// Make the page centered for book with pre-paginated layout and no spread (single page)
bodyCSS['transform-origin'] = 'center top !important';
bodyCSS['margin-left'] = 'auto';
bodyCSS['margin-right'] = 'auto';
}
this.rendition.themes.default({ body: bodyCSS });
this.rendition.themes.fontSize(`${this.fontSize}px`);
this.rendition.display(cfi);
this.rendition.on('rendered', (_, view) => {
Expand Down

0 comments on commit 95333c8

Please sign in to comment.