feat(epub.js): add saving for settings of the font family to localstorage

This commit is contained in:
IgorKurkov
2025-10-26 18:47:56 +01:00
parent c5571fc359
commit 902368efa7
2 changed files with 11 additions and 3 deletions

View File

@@ -335,7 +335,7 @@
let defaultFont;
function selectFont(id) {
window.selectFont = function (id) {
if (!defaultFont) {
defaultFont = reader.rendition.getContents()[0]?.css("font-family");
}
@@ -346,12 +346,15 @@
}
document.getElementById(id).querySelector("span").textContent = "✓";
// Save font selection to localStorage
localStorage.setItem("calibre.reader.font", id);
if (id == "default") {
reader.rendition.themes.font(defaultFont);
return;
}
reader.rendition.themes.font(id);
}
};
function spread(id) {
spans = document.getElementById("layout").querySelectorAll("span");