@concord-consortium/lara-interactive-api 1.9.3-pre.6 → 1.9.3-pre.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +4 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -5592,7 +5592,8 @@ var useAccessibility = function (props) {
|
|
|
5592
5592
|
var _a = props || {}, updateHtmlFontSize = _a.updateHtmlFontSize, addBodyClass = _a.addBodyClass, fontFamilySelector = _a.fontFamilySelector;
|
|
5593
5593
|
var initMessage = (0, exports.useInitMessage)();
|
|
5594
5594
|
var _b = (0, react_1.useState)(exports.DefaultAccessibilitySettings), accessibility = _b[0], setAccessibility = _b[1];
|
|
5595
|
-
|
|
5595
|
+
// text may be optional while font type setting is rolled out from staging to production through AP
|
|
5596
|
+
var normalizeClass = function (text) { return (text || "").toLowerCase().replace(/\s/, "-"); };
|
|
5596
5597
|
(0, react_1.useEffect)(function () {
|
|
5597
5598
|
var _a;
|
|
5598
5599
|
if (initMessage && initMessage.mode === "runtime") {
|
|
@@ -5602,14 +5603,14 @@ var useAccessibility = function (props) {
|
|
|
5602
5603
|
if (updateHtmlFontSize || addBodyClass || fontFamilySelector) {
|
|
5603
5604
|
var html = document.getElementsByTagName("html").item(0);
|
|
5604
5605
|
var body = document.getElementsByTagName("body").item(0);
|
|
5605
|
-
if (updateHtmlFontSize && html) {
|
|
5606
|
+
if (updateHtmlFontSize && html && fontSizeInPx) {
|
|
5606
5607
|
html.style.fontSize = fontSizeInPx + "px";
|
|
5607
5608
|
}
|
|
5608
5609
|
if (addBodyClass && body) {
|
|
5609
5610
|
body.classList.add("font-size-" + normalizeClass(fontSize));
|
|
5610
5611
|
body.classList.add("font-type-" + normalizeClass(fontType));
|
|
5611
5612
|
}
|
|
5612
|
-
if (fontFamilySelector) {
|
|
5613
|
+
if (fontFamilySelector && fontFamilyForType) {
|
|
5613
5614
|
var style = document.createElement("style");
|
|
5614
5615
|
document.head.appendChild(style);
|
|
5615
5616
|
(_a = style.sheet) === null || _a === void 0 ? void 0 : _a.insertRule(fontFamilySelector + " { font-family: " + fontFamilyForType + "; }", 0);
|