Add support for paginated and scrolled modes in EPUB reader

This commit is contained in:
adityachandelgit
2025-05-17 12:36:25 -06:00
committed by Aditya Chandel
parent 98a4272abf
commit 9675820052
12 changed files with 87 additions and 12 deletions
@@ -33,6 +33,7 @@ export interface EpubReaderSetting {
theme: string;
font: string;
fontSize: number;
flow: string;
}
export interface UserSettings {
@@ -120,6 +120,19 @@
</p-select>
</div>
<p>Flow:</p>
<div class="flex gap-4 justify-start">
<p-select
[options]="flowOptions"
[(ngModel)]="selectedFlow"
optionLabel="name"
optionValue="key"
placeholder="Select a Flow"
class="w-full md:w-56"
(ngModelChange)="onFlowChange()">
</p-select>
</div>
<p class="py-1">Font Size:</p>
<div class="flex gap-4 justify-start items-center">
<p-button icon="pi pi-minus" rounded="true" size="small" (click)="decreaseFontSize()"></p-button>
@@ -47,6 +47,11 @@ export class UserPreferences implements OnInit, OnDestroy {
{name: 'Monospace', key: 'monospace'}
];
flowOptions = [
{name: 'Paginated', key: 'paginated'},
{name: 'Scrolled', key: 'scrolled'}
];
readonly sortingOptions = [
{label: 'Name | Ascending', value: {field: 'name', order: 'asc'}},
{label: 'Name | Descending', value: {field: 'name', order: 'desc'}},
@@ -59,6 +64,7 @@ export class UserPreferences implements OnInit, OnDestroy {
selectedZoom!: string;
selectedTheme!: string;
selectedFont!: string;
selectedFlow!: string;
fontSize = 100;
showSidebar = false;
selectedPdfScope!: string;
@@ -93,6 +99,7 @@ export class UserPreferences implements OnInit, OnDestroy {
this.selectedZoom = settings.pdfReaderSetting.pageZoom;
this.showSidebar = settings.pdfReaderSetting.showSidebar;
this.selectedTheme = settings.epubReaderSetting.theme;
this.selectedFlow = settings.epubReaderSetting.flow;
this.fontSize = settings.epubReaderSetting.fontSize;
this.selectedFont = settings.epubReaderSetting.font;
this.selectedLibrarySorting = settings.sidebarLibrarySorting;
@@ -126,6 +133,10 @@ export class UserPreferences implements OnInit, OnDestroy {
this.updatePreference(['epubReaderSetting', 'font'], this.selectedFont);
}
onFlowChange() {
this.updatePreference(['epubReaderSetting', 'flow'], this.selectedFlow);
}
onFontSizeChange() {
this.updatePreference(['epubReaderSetting', 'fontSize'], this.fontSize);
}
@@ -167,5 +178,4 @@ export class UserPreferences implements OnInit, OnDestroy {
this.onFontSizeChange();
}
}
}