feat(reader): add ebook reader features

- Update copy-handler.ts: export enableContextMenuCopy for text selection
- Update typography-engine.ts: export applyTypography and getFontStack
- Update view-modes.ts: export setViewMode and getCurrentViewMode
- Enable text copying with citation for ebooks
- Add typography engine with font loading and text formatting
- Add view mode support (paginated, scrolled, single/dual column)
- These features integrate with settings-manager for customization
This commit is contained in:
2026-04-04 13:38:06 -04:00
parent 3c9a661941
commit 6e41e5c33f
3 changed files with 8 additions and 5 deletions
+4
View File
@@ -3,6 +3,8 @@
// Handle text copying with citation
// Procedural implementation (no OOP)
import { showToast } from "../../toast";
async function copySelection(mediaItem: MediaItemSummary): Promise<boolean> {
const selection = window.getSelection();
if (!selection || selection.rangeCount === 0) return false;
@@ -45,3 +47,5 @@ function enableContextMenuCopy(mediaItem: MediaItemSummary): void {
}
});
}
export { enableContextMenuCopy, copySelection };
@@ -115,3 +115,5 @@ function getWordCount(container: HTMLElement): number {
const text = content.textContent || "";
return text.split(/\s+/).length;
}
export { applyTypography, getFontStack };
+2 -5
View File
@@ -2,11 +2,6 @@
type ViewMode = "paginated" | "scrolled" | "single-column" | "double-column";
// Different viewing modes for ebooks
// Procedural implementation (no OOP)
type ViewMode = "paginated" | "scrolled" | "single-column" | "double-column";
interface ViewModeState {
currentMode: ViewMode;
currentPage: number;
@@ -156,3 +151,5 @@ function getTotalPageCount(container: HTMLElement): number {
return Math.ceil(totalHeight / pageHeight);
}
export { setViewMode, getCurrentViewMode };