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:
@@ -3,6 +3,8 @@
|
|||||||
// Handle text copying with citation
|
// Handle text copying with citation
|
||||||
// Procedural implementation (no OOP)
|
// Procedural implementation (no OOP)
|
||||||
|
|
||||||
|
import { showToast } from "../../toast";
|
||||||
|
|
||||||
async function copySelection(mediaItem: MediaItemSummary): Promise<boolean> {
|
async function copySelection(mediaItem: MediaItemSummary): Promise<boolean> {
|
||||||
const selection = window.getSelection();
|
const selection = window.getSelection();
|
||||||
if (!selection || selection.rangeCount === 0) return false;
|
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 || "";
|
const text = content.textContent || "";
|
||||||
return text.split(/\s+/).length;
|
return text.split(/\s+/).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export { applyTypography, getFontStack };
|
||||||
|
|||||||
@@ -2,11 +2,6 @@
|
|||||||
|
|
||||||
type ViewMode = "paginated" | "scrolled" | "single-column" | "double-column";
|
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 {
|
interface ViewModeState {
|
||||||
currentMode: ViewMode;
|
currentMode: ViewMode;
|
||||||
currentPage: number;
|
currentPage: number;
|
||||||
@@ -156,3 +151,5 @@ function getTotalPageCount(container: HTMLElement): number {
|
|||||||
|
|
||||||
return Math.ceil(totalHeight / pageHeight);
|
return Math.ceil(totalHeight / pageHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export { setViewMode, getCurrentViewMode };
|
||||||
|
|||||||
Reference in New Issue
Block a user