openreader/src/types/user-state.ts
Richard R d90e48aaf3 feat(html): add HTML/TXT/MD sentence and word highlighting, settings, and audiobook export support
Introduce sentence and word highlighting for HTML/TXT/MD documents, including new config options (`htmlHighlightEnabled`, `htmlWordHighlightEnabled`) and synced user preferences. Update the HTML viewer to support these highlights using custom spans, and add corresponding CSS styles. Extend document settings to allow toggling these features. Implement block-level locator sorting and display improvements. Add audiobook export support for HTML documents, including adapter and pipeline integration.

- Add `htmlHighlightEnabled` and `htmlWordHighlightEnabled` to config, user state, and Dexie storage
- Update HTML viewer to apply and manage highlights for sentences and words
- Add CSS for HTML highlight classes and scroll margin
- Extend document settings UI for HTML highlight toggles
- Support HTML audiobook export in modal and pipeline
- Improve block locator sorting and sidebar display for HTML
- Add HTML audiobook adapter and block parsing utilities
2026-05-17 11:14:02 -06:00

44 lines
1.1 KiB
TypeScript

import type { AppConfigValues } from '@/types/config';
export const SYNCED_PREFERENCE_KEYS = [
'viewType',
'voiceSpeed',
'audioPlayerSpeed',
'voice',
'skipBlank',
'epubTheme',
'smartSentenceSplitting',
'segmentPreloadDepthPages',
'segmentPreloadSentenceLookahead',
'ttsSegmentMaxBlockLength',
'headerMargin',
'footerMargin',
'leftMargin',
'rightMargin',
'providerRef',
'providerType',
'ttsModel',
'ttsInstructions',
'savedVoices',
'pdfHighlightEnabled',
'pdfWordHighlightEnabled',
'epubHighlightEnabled',
'epubWordHighlightEnabled',
'htmlHighlightEnabled',
'htmlWordHighlightEnabled',
] as const;
export type SyncedPreferenceKey = (typeof SYNCED_PREFERENCE_KEYS)[number];
type SyncedPreferences = Pick<AppConfigValues, SyncedPreferenceKey>;
export type SyncedPreferencesPatch = Partial<SyncedPreferences>;
export type ReaderType = 'pdf' | 'epub' | 'html';
export interface DocumentProgressRecord {
documentId: string;
readerType: ReaderType;
location: string;
progress: number | null;
clientUpdatedAtMs: number;
updatedAtMs: number;
}