@pie-element/math-inline 8.4.7-next.9 → 8.4.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/CHANGELOG.md +15 -0
- package/configure/CHANGELOG.md +11 -0
- package/configure/package.json +2 -2
- package/controller/CHANGELOG.md +11 -0
- package/controller/package.json +2 -2
- package/lib/main.js +84 -61
- package/lib/main.js.map +1 -1
- package/module/configure.js +2 -2
- package/module/element.js +79 -66
- package/module/manifest.json +2 -2
- package/module/print.js +79 -66
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.4.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-inline@8.4.6...@pie-element/math-inline@8.4.7) (2025-03-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update pie-lib/pie-toolbox PD-4872, PD-4093, PD-4588, PD-4812, PD-4867 ([2386fb5](https://github.com/pie-framework/pie-elements/commit/2386fb5f84cadb42305ab5a0e6248bd2b2279e0a))
|
|
12
|
+
* **math-inline:** avoid using hardcoded ids, use refs PD-4156 ([fba26df](https://github.com/pie-framework/pie-elements/commit/fba26df6641d0d59f42d31b2f779fd5ad2e2c9d0))
|
|
13
|
+
* **math-inline:** Refactor handleKeyDown for improved readability & fix arrow key behavior in math editor PD-4882 ([cf6b3fd](https://github.com/pie-framework/pie-elements/commit/cf6b3fd0aad4cce72068ecb9c0450e5204068090))
|
|
14
|
+
* **math-inline:** update local state based on session PD-4156 ([4836ac4](https://github.com/pie-framework/pie-elements/commit/4836ac4d4a7ac8e03a506631489a3aed44823225))
|
|
15
|
+
* **math-inline:** verify avtive Element by id not by aria label PD-4156 ([96a5197](https://github.com/pie-framework/pie-elements/commit/96a51973b342356c8f25f380f878dae9f98c1891))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
6
21
|
## [8.4.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-inline@8.4.5...@pie-element/math-inline@8.4.6) (2025-03-03)
|
|
7
22
|
|
|
8
23
|
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.3.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-inline-configure@8.3.6...@pie-element/math-inline-configure@8.3.7) (2025-03-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update pie-lib/pie-toolbox PD-4872, PD-4093, PD-4588, PD-4812, PD-4867 ([2386fb5](https://github.com/pie-framework/pie-elements/commit/2386fb5f84cadb42305ab5a0e6248bd2b2279e0a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [8.3.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-inline-configure@8.3.5...@pie-element/math-inline-configure@8.3.6) (2025-03-03)
|
|
7
18
|
|
|
8
19
|
|
package/configure/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/math-inline-configure",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "8.3.
|
|
4
|
+
"version": "8.3.7",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@material-ui/icons": "^3.0.1",
|
|
12
12
|
"@pie-framework/mathquill": "^1.1.3",
|
|
13
13
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
14
|
-
"@pie-lib/pie-toolbox": "2.10.
|
|
14
|
+
"@pie-lib/pie-toolbox": "2.10.1",
|
|
15
15
|
"classnames": "^2.2.5",
|
|
16
16
|
"debug": "^3.1.0",
|
|
17
17
|
"prop-types": "^15.6.2",
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [7.1.18](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-inline-controller@7.1.17...@pie-element/math-inline-controller@7.1.18) (2025-03-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update pie-lib/pie-toolbox PD-4872, PD-4093, PD-4588, PD-4812, PD-4867 ([2386fb5](https://github.com/pie-framework/pie-elements/commit/2386fb5f84cadb42305ab5a0e6248bd2b2279e0a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [7.1.17](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-inline-controller@7.1.16...@pie-element/math-inline-controller@7.1.17) (2025-03-03)
|
|
7
18
|
|
|
8
19
|
|
package/controller/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/math-inline-controller",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "7.1.
|
|
4
|
+
"version": "7.1.18",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@pie-framework/math-validation": "^1.2.3",
|
|
13
|
-
"@pie-lib/pie-toolbox": "2.10.
|
|
13
|
+
"@pie-lib/pie-toolbox": "2.10.1",
|
|
14
14
|
"debug": "^3.1.0",
|
|
15
15
|
"lodash": "^4.17.15"
|
|
16
16
|
},
|
package/lib/main.js
CHANGED
|
@@ -90,7 +90,7 @@ function isChildOfCurrentPieElement(child, parent) {
|
|
|
90
90
|
var node = child;
|
|
91
91
|
|
|
92
92
|
while (node !== null) {
|
|
93
|
-
if (node === parent) {
|
|
93
|
+
if (parent && node === parent) {
|
|
94
94
|
return true;
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -144,6 +144,24 @@ function prepareForStatic(model, state) {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
function parseAnswers(session, model) {
|
|
148
|
+
var answers = {};
|
|
149
|
+
|
|
150
|
+
if (model.config && model.config.expression) {
|
|
151
|
+
var answerBlocks = 1; // assume one at least
|
|
152
|
+
// build out local state model using responses declared in expression
|
|
153
|
+
|
|
154
|
+
(model.config.expression || '').replace(REGEX, function () {
|
|
155
|
+
answers["r".concat(answerBlocks)] = {
|
|
156
|
+
value: session && session.answers && session.answers["r".concat(answerBlocks)] && session.answers["r".concat(answerBlocks)].value || ''
|
|
157
|
+
};
|
|
158
|
+
answerBlocks += 1;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return answers;
|
|
163
|
+
}
|
|
164
|
+
|
|
147
165
|
var Main = /*#__PURE__*/function (_React$Component) {
|
|
148
166
|
(0, _inherits2["default"])(Main, _React$Component);
|
|
149
167
|
|
|
@@ -248,28 +266,27 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
248
266
|
}, 0);
|
|
249
267
|
});
|
|
250
268
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleKeyDown", function (event, id) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
var
|
|
254
|
-
var
|
|
255
|
-
var
|
|
256
|
-
|
|
257
|
-
var
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
if (isAnswerInputFocused && (event.key === 'ArrowDown' || isClickOrTouchEvent)) {
|
|
269
|
+
var _this$mqStatic$inputR;
|
|
270
|
+
|
|
271
|
+
var isTrigerredFromActualPieElement = isChildOfCurrentPieElement(event.target, _this.root);
|
|
272
|
+
var isAnswerInputFocused = _this.mqStatic && ((_this$mqStatic$inputR = _this.mqStatic.inputRef) === null || _this$mqStatic$inputR === void 0 ? void 0 : _this$mqStatic$inputR.current.contains(document.activeElement));
|
|
273
|
+
var key = event.key,
|
|
274
|
+
type = event.type;
|
|
275
|
+
var isClickOrTouchEvent = type === 'click' || type === 'touchstart';
|
|
276
|
+
|
|
277
|
+
if (isAnswerInputFocused && (key === 'ArrowDown' || isClickOrTouchEvent)) {
|
|
261
278
|
if (_this.state.activeAnswerBlock !== id && isTrigerredFromActualPieElement) {
|
|
262
279
|
_this.cleanupKeyDownListener();
|
|
263
280
|
|
|
264
281
|
_this.setState({
|
|
265
282
|
activeAnswerBlock: id
|
|
266
|
-
})
|
|
283
|
+
}, function () {
|
|
284
|
+
_this.onSubFieldFocus(id);
|
|
267
285
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
_this.focusFirstKeypadElement();
|
|
286
|
+
if (key === 'ArrowDown') {
|
|
287
|
+
_this.focusFirstKeypadElement();
|
|
288
|
+
}
|
|
289
|
+
});
|
|
273
290
|
}
|
|
274
291
|
} else if (event.key === 'Escape') {
|
|
275
292
|
_this.setState({
|
|
@@ -456,19 +473,10 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
456
473
|
// }
|
|
457
474
|
|
|
458
475
|
});
|
|
459
|
-
var
|
|
476
|
+
var _model = props.model,
|
|
477
|
+
_session = props.session;
|
|
460
478
|
|
|
461
|
-
|
|
462
|
-
var answerBlocks = 1; // assume one at least
|
|
463
|
-
// build out local state model using responses declared in expression
|
|
464
|
-
|
|
465
|
-
(props.model.config.expression || '').replace(REGEX, function () {
|
|
466
|
-
_answers["r".concat(answerBlocks)] = {
|
|
467
|
-
value: props.session && props.session.answers && props.session.answers["r".concat(answerBlocks)] && props.session.answers["r".concat(answerBlocks)].value || ''
|
|
468
|
-
};
|
|
469
|
-
answerBlocks += 1;
|
|
470
|
-
});
|
|
471
|
-
}
|
|
479
|
+
var _answers = parseAnswers(_session, _model);
|
|
472
480
|
|
|
473
481
|
_this.state = {
|
|
474
482
|
session: _objectSpread(_objectSpread({}, props.session), {}, {
|
|
@@ -521,7 +529,23 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
521
529
|
|
|
522
530
|
var _ref4 = nextProps.model || {},
|
|
523
531
|
_ref4$config = _ref4.config,
|
|
524
|
-
nextConfig = _ref4$config === void 0 ? {} : _ref4$config;
|
|
532
|
+
nextConfig = _ref4$config === void 0 ? {} : _ref4$config;
|
|
533
|
+
|
|
534
|
+
var session = this.props.session;
|
|
535
|
+
|
|
536
|
+
var _ref5 = nextProps || {},
|
|
537
|
+
_ref5$session = _ref5.session,
|
|
538
|
+
nextSession = _ref5$session === void 0 ? {} : _ref5$session; // in case session props changed in parent, we need to catch this and update local state
|
|
539
|
+
// example: when env is changing in pieoneer
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
if (session && nextSession && !(0, _isEqual["default"])(session.answers, nextSession.answers)) {
|
|
543
|
+
this.setState({
|
|
544
|
+
session: _objectSpread(_objectSpread({}, nextSession), {}, {
|
|
545
|
+
answers: parseAnswers(nextSession, this.props.model)
|
|
546
|
+
})
|
|
547
|
+
});
|
|
548
|
+
} // check if the note is the default one for prev language and change to the default one for new language
|
|
525
549
|
// this check is necessary in order to diferanciate between default and authour defined note
|
|
526
550
|
// and only change between languages for default ones
|
|
527
551
|
|
|
@@ -642,38 +666,38 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
642
666
|
session = _this$state2.session,
|
|
643
667
|
tooltipContainerRef = _this$state2.tooltipContainerRef;
|
|
644
668
|
|
|
645
|
-
var
|
|
646
|
-
config =
|
|
647
|
-
correctness =
|
|
648
|
-
disabled =
|
|
649
|
-
extraCSSRules =
|
|
650
|
-
view =
|
|
651
|
-
teacherInstructions =
|
|
652
|
-
rationale =
|
|
653
|
-
feedback =
|
|
654
|
-
animationsDisabled =
|
|
655
|
-
printMode =
|
|
656
|
-
alwaysShowCorrect =
|
|
657
|
-
language =
|
|
669
|
+
var _ref6 = model || {},
|
|
670
|
+
config = _ref6.config,
|
|
671
|
+
correctness = _ref6.correctness,
|
|
672
|
+
disabled = _ref6.disabled,
|
|
673
|
+
extraCSSRules = _ref6.extraCSSRules,
|
|
674
|
+
view = _ref6.view,
|
|
675
|
+
teacherInstructions = _ref6.teacherInstructions,
|
|
676
|
+
rationale = _ref6.rationale,
|
|
677
|
+
feedback = _ref6.feedback,
|
|
678
|
+
animationsDisabled = _ref6.animationsDisabled,
|
|
679
|
+
printMode = _ref6.printMode,
|
|
680
|
+
alwaysShowCorrect = _ref6.alwaysShowCorrect,
|
|
681
|
+
language = _ref6.language;
|
|
658
682
|
|
|
659
683
|
if (!config) {
|
|
660
684
|
return null;
|
|
661
685
|
}
|
|
662
686
|
|
|
663
|
-
var
|
|
664
|
-
showNote =
|
|
665
|
-
note =
|
|
666
|
-
prompt =
|
|
667
|
-
responses =
|
|
668
|
-
responseType =
|
|
669
|
-
equationEditor =
|
|
670
|
-
customKeys =
|
|
671
|
-
id =
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
var mode =
|
|
676
|
-
role =
|
|
687
|
+
var _ref7 = config || {},
|
|
688
|
+
showNote = _ref7.showNote,
|
|
689
|
+
note = _ref7.note,
|
|
690
|
+
prompt = _ref7.prompt,
|
|
691
|
+
responses = _ref7.responses,
|
|
692
|
+
responseType = _ref7.responseType,
|
|
693
|
+
equationEditor = _ref7.equationEditor,
|
|
694
|
+
customKeys = _ref7.customKeys,
|
|
695
|
+
id = _ref7.id,
|
|
696
|
+
_ref7$env = _ref7.env;
|
|
697
|
+
|
|
698
|
+
_ref7$env = _ref7$env === void 0 ? {} : _ref7$env;
|
|
699
|
+
var mode = _ref7$env.mode,
|
|
700
|
+
role = _ref7$env.role;
|
|
677
701
|
var displayNote = (showCorrect || mode === 'view' && role === 'instructor') && showNote && note;
|
|
678
702
|
var emptyResponse = (0, _isEmpty["default"])(responses);
|
|
679
703
|
var showCorrectAnswerToggle = !emptyResponse && correctness && correctness.correctness !== 'correct';
|
|
@@ -738,8 +762,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
738
762
|
ref: tooltipContainerRef,
|
|
739
763
|
className: (0, _classnames["default"])(classes.expression, (_cx = {}, (0, _defineProperty2["default"])(_cx, classes.incorrect, !emptyResponse && !correct && !showCorrect), (0, _defineProperty2["default"])(_cx, classes.correct, !emptyResponse && (correct || showCorrect)), (0, _defineProperty2["default"])(_cx, classes.showCorrectness, !emptyResponse && disabled && correctness && !view), (0, _defineProperty2["default"])(_cx, classes.correctAnswerShown, showCorrect), (0, _defineProperty2["default"])(_cx, classes.printCorrect, printMode && alwaysShowCorrect), _cx))
|
|
740
764
|
}, /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
741
|
-
ref: function ref(
|
|
742
|
-
return _this4.setTooltipRef(
|
|
765
|
+
ref: function ref(_ref8) {
|
|
766
|
+
return _this4.setTooltipRef(_ref8);
|
|
743
767
|
},
|
|
744
768
|
enterTouchDelay: 0,
|
|
745
769
|
interactive: true,
|
|
@@ -809,8 +833,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
809
833
|
|
|
810
834
|
if (tooltipModeEnabled && (showCorrectAnswerToggle || teacherInstructions && (0, _renderUi.hasText)(teacherInstructions) || rationale && (0, _renderUi.hasText)(rationale) || feedback)) {
|
|
811
835
|
return /*#__PURE__*/_react["default"].createElement(_renderUi.UiLayout, {
|
|
812
|
-
extraCSSRules: extraCSSRules
|
|
813
|
-
id: id
|
|
836
|
+
extraCSSRules: extraCSSRules
|
|
814
837
|
}, /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
815
838
|
interactive: true,
|
|
816
839
|
enterTouchDelay: 0,
|