@khanacademy/perseus 17.4.0 → 17.5.0
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/CHANGELOG.md +15 -0
- package/dist/es/index.css +1 -1
- package/dist/es/index.js +25 -16
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +25 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__stories__/article-renderer.stories.tsx +2 -0
- package/src/__tests__/server-item-renderer.test.tsx +15 -18
- package/src/article-renderer.tsx +20 -15
- package/src/server-item-renderer.tsx +23 -20
- package/src/styles/perseus-renderer.less +1 -1
- package/src/styles/variables.less +1 -0
- package/tsconfig-build.tsbuildinfo +1 -1
package/dist/index.css
CHANGED
|
@@ -2508,7 +2508,7 @@ img.zoom-img {
|
|
|
2508
2508
|
padding-bottom: 2px;
|
|
2509
2509
|
}
|
|
2510
2510
|
.framework-perseus:not(.perseus-mobile) table tr:nth-child(odd) td {
|
|
2511
|
-
background-color: #
|
|
2511
|
+
background-color: #f7f8fa;
|
|
2512
2512
|
}
|
|
2513
2513
|
.framework-perseus:not(.perseus-mobile) .perseus-titled-table {
|
|
2514
2514
|
display: inline-block;
|
package/dist/index.js
CHANGED
|
@@ -44337,7 +44337,7 @@ const init = function (options) {
|
|
|
44337
44337
|
|
|
44338
44338
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
44339
44339
|
const libName = "@khanacademy/perseus";
|
|
44340
|
-
const libVersion = "17.
|
|
44340
|
+
const libVersion = "17.5.0";
|
|
44341
44341
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
44342
44342
|
|
|
44343
44343
|
const apiVersion = {
|
|
@@ -44404,6 +44404,17 @@ class ArticleRenderer extends React__namespace.Component {
|
|
|
44404
44404
|
});
|
|
44405
44405
|
focusedInput = this.sectionRenderers[sectionIndex].getDOMNodeForPath(focusPath);
|
|
44406
44406
|
}
|
|
44407
|
+
const {
|
|
44408
|
+
onFocusChange
|
|
44409
|
+
} = this.props.apiOptions;
|
|
44410
|
+
if (onFocusChange) {
|
|
44411
|
+
// Wait for the keypad to mount before getting the height
|
|
44412
|
+
setTimeout(() => {
|
|
44413
|
+
const keypadDomNode = keypadElement?.getDOMNode();
|
|
44414
|
+
const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
|
|
44415
|
+
onFocusChange(this._currentFocus, prevFocusPath, keypadHeight, didFocusInput ? focusedInput : null);
|
|
44416
|
+
}, 0);
|
|
44417
|
+
}
|
|
44407
44418
|
if (keypadElement && isMobile) {
|
|
44408
44419
|
if (didFocusInput) {
|
|
44409
44420
|
keypadElement.activate();
|
|
@@ -44411,11 +44422,6 @@ class ArticleRenderer extends React__namespace.Component {
|
|
|
44411
44422
|
keypadElement.dismiss();
|
|
44412
44423
|
}
|
|
44413
44424
|
}
|
|
44414
|
-
if (this.props.apiOptions.onFocusChange != null) {
|
|
44415
|
-
const keypadDomNode = keypadElement?.getDOMNode();
|
|
44416
|
-
const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
|
|
44417
|
-
this.props.apiOptions.onFocusChange(this._currentFocus, prevFocusPath, keypadHeight, didFocusInput ? focusedInput : null);
|
|
44418
|
-
}
|
|
44419
44425
|
};
|
|
44420
44426
|
_onRendererBlur = blurPath => {
|
|
44421
44427
|
const blurringFocusPath = this._currentFocus;
|
|
@@ -44953,6 +44959,19 @@ class ServerItemRenderer extends React__namespace.Component {
|
|
|
44953
44959
|
const didFocusInput = this._currentFocus && inputPaths.some(inputPath => {
|
|
44954
44960
|
return Util.inputPathsEqual(inputPath, this._currentFocus);
|
|
44955
44961
|
});
|
|
44962
|
+
if (onFocusChange != null) {
|
|
44963
|
+
// Wait for the keypad to mount before getting the height
|
|
44964
|
+
setTimeout(() => {
|
|
44965
|
+
// First, calculate the current keypad height
|
|
44966
|
+
const keypadDomNode = keypadElement?.getDOMNode();
|
|
44967
|
+
const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
|
|
44968
|
+
|
|
44969
|
+
// Then call the callback
|
|
44970
|
+
onFocusChange(this._currentFocus, prevFocus, keypadHeight,
|
|
44971
|
+
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.
|
|
44972
|
+
didFocusInput && this.questionRenderer.getDOMNodeForPath(newFocus));
|
|
44973
|
+
}, 0);
|
|
44974
|
+
}
|
|
44956
44975
|
if (keypadElement && isMobile) {
|
|
44957
44976
|
if (didFocusInput) {
|
|
44958
44977
|
keypadElement.activate();
|
|
@@ -44960,16 +44979,6 @@ class ServerItemRenderer extends React__namespace.Component {
|
|
|
44960
44979
|
keypadElement.dismiss();
|
|
44961
44980
|
}
|
|
44962
44981
|
}
|
|
44963
|
-
if (onFocusChange != null) {
|
|
44964
|
-
// First, calculate the current keypad height
|
|
44965
|
-
const keypadDomNode = keypadElement?.getDOMNode();
|
|
44966
|
-
const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
|
|
44967
|
-
|
|
44968
|
-
// Then call the callback
|
|
44969
|
-
onFocusChange(this._currentFocus, prevFocus, keypadHeight,
|
|
44970
|
-
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.
|
|
44971
|
-
didFocusInput && this.questionRenderer.getDOMNodeForPath(newFocus));
|
|
44972
|
-
}
|
|
44973
44982
|
}
|
|
44974
44983
|
_onRendererBlur(blurPath) {
|
|
44975
44984
|
const blurringFocusPath = this._currentFocus;
|