refactor: export getDefaultSettings for reader module use

- Export getDefaultSettings function for use in reader-navigation
- Minor formatting improvements in settings-manager.ts
- Add tabindex and ebook-content class to reader-content in template
This commit is contained in:
2026-04-05 21:15:07 -04:00
parent ceab60e3d1
commit b455f54d3c
2 changed files with 30 additions and 19 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ templ Reader(user User, metadata ReaderMetadata, progress ReadingProgress, bookm
</div>
</div>
</div>
<main id="reader-content" class="w-full h-full">
<main id="reader-content" tabindex="0" class="ebook-content w-full h-full">
<!-- Content loaded by JavaScript based on media type -->
</main>
@DictionaryPopup()
+28 -17
View File
@@ -15,24 +15,35 @@ export function init(context: ReaderContext): void {
context.events.emit("settings:loaded", currentSettings);
});
context.events.on("settings:save", async (detail: { settings: Partial<ReaderSettings> }) => {
await saveSettings(detail.settings);
currentSettings = await loadSettings();
context.events.emit("settings:changed", currentSettings);
});
context.events.on(
"settings:save",
async (detail: { settings: Partial<ReaderSettings> }) => {
await saveSettings(detail.settings);
currentSettings = await loadSettings();
context.events.emit("settings:changed", currentSettings);
},
);
context.events.on("settings:get", (detail: { key?: keyof ReaderSettings }) => {
if (currentSettings) {
const value = detail.key ? currentSettings[detail.key] : currentSettings;
context.events.emit("settings:current", { value });
}
});
context.events.on(
"settings:get",
(detail: { key?: keyof ReaderSettings }) => {
if (currentSettings) {
const value = detail.key
? currentSettings[detail.key]
: currentSettings;
context.events.emit("settings:current", { value });
}
},
);
context.events.on("settings:set", async (detail: { key: keyof ReaderSettings; value: any }) => {
await saveSettings({ [detail.key]: detail.value });
currentSettings = await loadSettings();
context.events.emit("settings:changed", currentSettings);
});
context.events.on(
"settings:set",
async (detail: { key: keyof ReaderSettings; value: any }) => {
await saveSettings({ [detail.key]: detail.value });
currentSettings = await loadSettings();
context.events.emit("settings:changed", currentSettings);
},
);
context.events.on("settings:sync", async () => {
await syncSettings();
@@ -93,7 +104,7 @@ async function syncSettings(): Promise<void> {
}
}
function getDefaultSettings(): ReaderSettings {
export function getDefaultSettings(): ReaderSettings {
return {
chrome_behavior: "auto-hide",
progress_mode: "pages",