Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions readium/navigator/src/main/assets/_scripts/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ export function setProperty(key, value) {
removeProperty(key);
} else {
var root = document.documentElement;
// The `!important` annotation is added with `setProperty()` because if it's part of the
// `value`, it will be ignored by the Web View.
root.style.setProperty(key, value, "important");
}
}
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ interface Properties : Cssable {
}

return props
.map { (key, value) -> "$key: $value" }
.joinToString(";\n") + ";\n"
.map { (key, value) -> "$key: $value !important;" }
.joinToString("\n") + "\n"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ class PropertiesTest {
fun `Generate minimal inline CSS properties`() {
assertEquals(
"""
--USER__view: readium-scroll-on;
--USER__colCount: auto;
--USER__view: readium-scroll-on !important;
--USER__colCount: auto !important;

""".trimIndent(),
UserProperties(
Expand All @@ -276,28 +276,28 @@ class PropertiesTest {
fun `Generate full inline CSS properties`() {
assertEquals(
"""
--USER__view: readium-scroll-on;
--USER__colCount: auto;
--USER__pageMargins: 1.2;
--USER__appearance: readium-night-on;
--USER__darkenImages: readium-darken-on;
--USER__invertImages: readium-invert-on;
--USER__textColor: #FF0000;
--USER__backgroundColor: #00FF00;
--USER__fontOverride: readium-font-on;
--USER__fontFamily: "Times New", "Comic Sans";
--USER__fontSize: 2.3vmax;
--USER__advancedSettings: readium-advanced-on;
--USER__typeScale: 3.4;
--USER__textAlign: justify;
--USER__lineHeight: 4.5pt;
--USER__paraSpacing: 5.6pt;
--USER__paraIndent: 6.7rem;
--USER__wordSpacing: 7.8rem;
--USER__letterSpacing: 8.9rem;
--USER__bodyHyphens: auto;
--USER__ligatures: common-ligatures;
--USER__a11yNormalize: readium-a11y-on;
--USER__view: readium-scroll-on !important;
--USER__colCount: auto !important;
--USER__pageMargins: 1.2 !important;
--USER__appearance: readium-night-on !important;
--USER__darkenImages: readium-darken-on !important;
--USER__invertImages: readium-invert-on !important;
--USER__textColor: #FF0000 !important;
--USER__backgroundColor: #00FF00 !important;
--USER__fontOverride: readium-font-on !important;
--USER__fontFamily: "Times New", "Comic Sans" !important;
--USER__fontSize: 2.3vmax !important;
--USER__advancedSettings: readium-advanced-on !important;
--USER__typeScale: 3.4 !important;
--USER__textAlign: justify !important;
--USER__lineHeight: 4.5pt !important;
--USER__paraSpacing: 5.6pt !important;
--USER__paraIndent: 6.7rem !important;
--USER__wordSpacing: 7.8rem !important;
--USER__letterSpacing: 8.9rem !important;
--USER__bodyHyphens: auto !important;
--USER__ligatures: common-ligatures !important;
--USER__a11yNormalize: readium-a11y-on !important;

""".trimIndent(),
UserProperties(
Expand Down