@pie-element/math-inline 5.8.12 → 5.9.1-beta.1443
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 +359 -0
- package/configure/CHANGELOG.md +334 -0
- package/configure/lib/configure.js +68 -47
- package/configure/lib/configure.js.map +1 -1
- package/configure/lib/defaults.js +20 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/general-config-block.js +82 -11
- package/configure/lib/general-config-block.js.map +1 -1
- package/configure/lib/index.js +16 -2
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/response.js +22 -8
- package/configure/lib/response.js.map +1 -1
- package/configure/lib/utils.js +18 -1
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +7 -7
- package/controller/CHANGELOG.md +49 -0
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +98 -16
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +4 -4
- package/docs/config-schema.json +105 -0
- package/docs/config-schema.json.md +81 -1
- package/docs/demo/config.js +2 -2
- package/docs/demo/generate.js +16 -15
- package/docs/demo/session.js +1 -1
- package/docs/pie-schema.json +33 -0
- package/docs/pie-schema.json.md +24 -0
- package/lib/index.js +6 -3
- package/lib/index.js.map +1 -1
- package/lib/main.js +71 -15
- package/lib/main.js.map +1 -1
- package/lib/print.js +133 -0
- package/lib/print.js.map +1 -0
- package/lib/simple-question-block.js +45 -38
- package/lib/simple-question-block.js.map +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +12 -8
|
@@ -50,6 +50,22 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
50
50
|
|
|
51
51
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
52
52
|
|
|
53
|
+
# `settingsPanelDisabled` (boolean)
|
|
54
|
+
|
|
55
|
+
Indicates if the settings panel is not available
|
|
56
|
+
|
|
57
|
+
# `spellCheck` (object)
|
|
58
|
+
|
|
59
|
+
Properties of the `spellCheck` object:
|
|
60
|
+
|
|
61
|
+
## `settings` (boolean)
|
|
62
|
+
|
|
63
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
64
|
+
|
|
65
|
+
## `label` (string)
|
|
66
|
+
|
|
67
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
68
|
+
|
|
53
69
|
# `scoringType` (object)
|
|
54
70
|
|
|
55
71
|
Properties of the `scoringType` object:
|
|
@@ -120,6 +136,54 @@ Indicates the label for the item that has to be displayed in the Settings Panel
|
|
|
120
136
|
Indicates the value of the item if it affects config-ui
|
|
121
137
|
(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
|
|
122
138
|
|
|
139
|
+
# `maxResponseAreas` (number)
|
|
140
|
+
|
|
141
|
+
Maximum number of response areas
|
|
142
|
+
|
|
143
|
+
# `maxImageWidth` (object)
|
|
144
|
+
|
|
145
|
+
Properties of the `maxImageWidth` object:
|
|
146
|
+
|
|
147
|
+
## `teacherInstructions` (number)
|
|
148
|
+
|
|
149
|
+
Indicates the max dimension for images in teacher instructions
|
|
150
|
+
|
|
151
|
+
## `prompt` (number)
|
|
152
|
+
|
|
153
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
154
|
+
|
|
155
|
+
## `rationale` (number)
|
|
156
|
+
|
|
157
|
+
Indicates the max dimension for images in rationale
|
|
158
|
+
|
|
159
|
+
# `maxImageHeight` (object)
|
|
160
|
+
|
|
161
|
+
Properties of the `maxImageHeight` object:
|
|
162
|
+
|
|
163
|
+
## `teacherInstructions` (number)
|
|
164
|
+
|
|
165
|
+
Indicates the max dimension for images in teacher instructions
|
|
166
|
+
|
|
167
|
+
## `prompt` (number)
|
|
168
|
+
|
|
169
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
170
|
+
|
|
171
|
+
## `rationale` (number)
|
|
172
|
+
|
|
173
|
+
Indicates the max dimension for images in rationale
|
|
174
|
+
|
|
175
|
+
# `withRubric` (object)
|
|
176
|
+
|
|
177
|
+
Properties of the `withRubric` object:
|
|
178
|
+
|
|
179
|
+
## `settings` (boolean)
|
|
180
|
+
|
|
181
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
182
|
+
|
|
183
|
+
## `label` (string)
|
|
184
|
+
|
|
185
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
186
|
+
|
|
123
187
|
# `showPrompt` (boolean)
|
|
124
188
|
|
|
125
189
|
Determines whether prompt field will be displayed or not
|
|
@@ -171,4 +235,20 @@ Indicates the label for the item that has to be displayed in the Settings Panel
|
|
|
171
235
|
### `enabled` (boolean)
|
|
172
236
|
|
|
173
237
|
Indicates the value of the item if it affects config-ui
|
|
174
|
-
(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
|
|
238
|
+
(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
|
|
239
|
+
|
|
240
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
241
|
+
|
|
242
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
243
|
+
|
|
244
|
+
### `teacherInstructions` (number)
|
|
245
|
+
|
|
246
|
+
Indicates the max dimension for images in teacher instructions
|
|
247
|
+
|
|
248
|
+
### `prompt` (number)
|
|
249
|
+
|
|
250
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
251
|
+
|
|
252
|
+
### `rationale` (number)
|
|
253
|
+
|
|
254
|
+
Indicates the max dimension for images in rationale
|
package/docs/demo/config.js
CHANGED
package/docs/demo/generate.js
CHANGED
|
@@ -8,8 +8,8 @@ const initialModel = {
|
|
|
8
8
|
answer: 'r=\\sqrt{\\frac{V}{7\\pi}}',
|
|
9
9
|
id: '1',
|
|
10
10
|
alternates: {},
|
|
11
|
-
validation: 'literal'
|
|
12
|
-
}
|
|
11
|
+
validation: 'literal',
|
|
12
|
+
},
|
|
13
13
|
],
|
|
14
14
|
note: 'The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.',
|
|
15
15
|
rationale:
|
|
@@ -17,25 +17,26 @@ const initialModel = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const E262456 = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
'
|
|
20
|
+
equationEditor: 3,
|
|
21
|
+
toolbarEditorPosition: 'bottom',
|
|
22
|
+
prompt:
|
|
23
|
+
'<p><strong>B.</strong> Find the value of the expression that you wrote in part A to find how much money the band members made.</p>\n\n<p>Use the on-screen keyboard to type your answer in the box below.</p>\n',
|
|
24
|
+
expression: '${{response}}',
|
|
25
|
+
responses: [
|
|
25
26
|
{
|
|
26
|
-
|
|
27
|
+
allowSpaces: true,
|
|
27
28
|
// 'validation': 'symbolic',
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
29
|
+
answer: '$410',
|
|
30
|
+
id: '1',
|
|
31
|
+
},
|
|
31
32
|
],
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
note: 'The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.',
|
|
34
|
+
responseType: 'Advanced Multi',
|
|
34
35
|
};
|
|
35
36
|
|
|
36
|
-
|
|
37
37
|
exports.model = (id, element) => ({
|
|
38
38
|
id,
|
|
39
39
|
element,
|
|
40
|
-
...E262456
|
|
40
|
+
...E262456,
|
|
41
|
+
rubricEnabled: false,
|
|
41
42
|
});
|
package/docs/demo/session.js
CHANGED
package/docs/pie-schema.json
CHANGED
|
@@ -426,6 +426,11 @@
|
|
|
426
426
|
"type": "boolean",
|
|
427
427
|
"title": "rationaleEnabled"
|
|
428
428
|
},
|
|
429
|
+
"spellCheckEnabled": {
|
|
430
|
+
"description": "Indicates if spellcheck is enabled for the author. Default value is true",
|
|
431
|
+
"type": "boolean",
|
|
432
|
+
"title": "spellCheckEnabled"
|
|
433
|
+
},
|
|
429
434
|
"studentInstructionsEnabled": {
|
|
430
435
|
"description": "Indicates if Student Instructions are enabled",
|
|
431
436
|
"type": "boolean",
|
|
@@ -451,6 +456,11 @@
|
|
|
451
456
|
"type": "string",
|
|
452
457
|
"title": "toolbarEditorPosition"
|
|
453
458
|
},
|
|
459
|
+
"rubricEnabled": {
|
|
460
|
+
"description": "Indicates if Rubric is enabled",
|
|
461
|
+
"type": "boolean",
|
|
462
|
+
"title": "rubricEnabled"
|
|
463
|
+
},
|
|
454
464
|
"id": {
|
|
455
465
|
"description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
|
|
456
466
|
"type": "string",
|
|
@@ -471,6 +481,8 @@
|
|
|
471
481
|
"ignoreOrderDefault",
|
|
472
482
|
"rationaleEnabled",
|
|
473
483
|
"responses",
|
|
484
|
+
"rubricEnabled",
|
|
485
|
+
"spellCheckEnabled",
|
|
474
486
|
"studentInstructionsEnabled",
|
|
475
487
|
"teacherInstructionsEnabled"
|
|
476
488
|
],
|
|
@@ -512,6 +524,27 @@
|
|
|
512
524
|
}
|
|
513
525
|
}
|
|
514
526
|
},
|
|
527
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
528
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
529
|
+
"type": "object",
|
|
530
|
+
"properties": {
|
|
531
|
+
"teacherInstructions": {
|
|
532
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
533
|
+
"type": "number",
|
|
534
|
+
"title": "teacherInstructions"
|
|
535
|
+
},
|
|
536
|
+
"prompt": {
|
|
537
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
538
|
+
"type": "number",
|
|
539
|
+
"title": "prompt"
|
|
540
|
+
},
|
|
541
|
+
"rationale": {
|
|
542
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
543
|
+
"type": "number",
|
|
544
|
+
"title": "rationale"
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
},
|
|
515
548
|
"ComplexFeedbackType": {
|
|
516
549
|
"title": "ComplexFeedbackType",
|
|
517
550
|
"type": "object",
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -196,6 +196,10 @@ Indicates if Feedback is enabled
|
|
|
196
196
|
|
|
197
197
|
Indicates if Rationale are enabled
|
|
198
198
|
|
|
199
|
+
# `spellCheckEnabled` (boolean, required)
|
|
200
|
+
|
|
201
|
+
Indicates if spellcheck is enabled for the author. Default value is true
|
|
202
|
+
|
|
199
203
|
# `studentInstructionsEnabled` (boolean, required)
|
|
200
204
|
|
|
201
205
|
Indicates if Student Instructions are enabled
|
|
@@ -219,6 +223,10 @@ This element must be one of the following enum values:
|
|
|
219
223
|
|
|
220
224
|
Default: `": 'bottom'"`
|
|
221
225
|
|
|
226
|
+
# `rubricEnabled` (boolean, required)
|
|
227
|
+
|
|
228
|
+
Indicates if Rubric is enabled
|
|
229
|
+
|
|
222
230
|
# `id` (string, required)
|
|
223
231
|
|
|
224
232
|
Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
|
|
@@ -262,6 +270,22 @@ Indicates the label for the item that has to be displayed in the Settings Panel
|
|
|
262
270
|
Indicates the value of the item if it affects config-ui
|
|
263
271
|
(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
|
|
264
272
|
|
|
273
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
274
|
+
|
|
275
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
276
|
+
|
|
277
|
+
### `teacherInstructions` (number)
|
|
278
|
+
|
|
279
|
+
Indicates the max dimension for images in teacher instructions
|
|
280
|
+
|
|
281
|
+
### `prompt` (number)
|
|
282
|
+
|
|
283
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
284
|
+
|
|
285
|
+
### `rationale` (number)
|
|
286
|
+
|
|
287
|
+
Indicates the max dimension for images in rationale
|
|
288
|
+
|
|
265
289
|
## `ComplexFeedbackType` (object)
|
|
266
290
|
|
|
267
291
|
Properties of the `ComplexFeedbackType` object:
|
package/lib/index.js
CHANGED
|
@@ -56,8 +56,8 @@ var MathInline = /*#__PURE__*/function (_HTMLElement) {
|
|
|
56
56
|
(0, _classCallCheck2["default"])(this, MathInline);
|
|
57
57
|
_this = _super.call(this);
|
|
58
58
|
_this._configuration = _defaults["default"].configuration;
|
|
59
|
-
_this.sessionChangedEventCaller = _lodash["default"].debounce(function (
|
|
60
|
-
_this.dispatchEvent(new _piePlayerEvents.SessionChangedEvent(
|
|
59
|
+
_this.sessionChangedEventCaller = _lodash["default"].debounce(function () {
|
|
60
|
+
_this.dispatchEvent(new _piePlayerEvents.SessionChangedEvent(_this.tagName.toLowerCase(), true));
|
|
61
61
|
}, 1000);
|
|
62
62
|
return _this;
|
|
63
63
|
}
|
|
@@ -72,6 +72,9 @@ var MathInline = /*#__PURE__*/function (_HTMLElement) {
|
|
|
72
72
|
}
|
|
73
73
|
}, {
|
|
74
74
|
key: "session",
|
|
75
|
+
get: function get() {
|
|
76
|
+
return this._session;
|
|
77
|
+
},
|
|
75
78
|
set: function set(s) {
|
|
76
79
|
this._session = s;
|
|
77
80
|
|
|
@@ -92,7 +95,7 @@ var MathInline = /*#__PURE__*/function (_HTMLElement) {
|
|
|
92
95
|
Object.keys(s).map(function (key) {
|
|
93
96
|
_this2._session[key] = s[key];
|
|
94
97
|
});
|
|
95
|
-
this.sessionChangedEventCaller(
|
|
98
|
+
this.sessionChangedEventCaller();
|
|
96
99
|
log('session: ', this._session);
|
|
97
100
|
}
|
|
98
101
|
}, {
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["log","MathInline","_configuration","defaults","configuration","sessionChangedEventCaller","_","debounce","
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["log","MathInline","_configuration","defaults","configuration","sessionChangedEventCaller","_","debounce","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","m","_model","ModelSetEvent","_render","_session","s","c","Object","keys","map","key","el","React","createElement","Main","model","session","onSessionChange","sessionChanged","bind","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,oBAAN,CAAZ;;IAIqBC,U;;;;;AACnB,wBAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,cAAL,GAAsBC,qBAASC,aAA/B;AACA,UAAKC,yBAAL,GAAiCC,mBAAEC,QAAF,CAAW,YAAM;AAChD,YAAKC,aAAL,CAAmB,IAAIC,oCAAJ,CAAwB,MAAKC,OAAL,CAAaC,WAAb,EAAxB,EAAoD,IAApD,CAAnB;AACD,KAFgC,EAE9B,IAF8B,CAAjC;AAHY;AAMb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKC,MAAL,GAAcD,CAAd;AACA,WAAKJ,aAAL,CAAmB,IAAIM,8BAAJ,CAAkB,KAAKD,MAAvB,EAA+B,IAA/B,EAAqC,CAAC,CAAC,KAAKA,MAA5C,CAAnB;;AACA,WAAKE,OAAL;AACD;;;SAOD,eAAc;AACZ,aAAO,KAAKC,QAAZ;AACD,K;SAPD,aAAYC,CAAZ,EAAe;AACb,WAAKD,QAAL,GAAgBC,CAAhB;;AACA,WAAKF,OAAL;AACD;;;SAMD,aAAkBG,CAAlB,EAAqB;AACnB,WAAKhB,cAAL,GAAsBgB,CAAtB;;AACA,WAAKH,OAAL;AACD;;;WAED,wBAAeE,CAAf,EAAkB;AAAA;;AAChBE,MAAAA,MAAM,CAACC,IAAP,CAAYH,CAAZ,EAAeI,GAAf,CAAmB,UAACC,GAAD,EAAS;AAC1B,QAAA,MAAI,CAACN,QAAL,CAAcM,GAAd,IAAqBL,CAAC,CAACK,GAAD,CAAtB;AACD,OAFD;AAIA,WAAKjB,yBAAL;AACAL,MAAAA,GAAG,CAAC,WAAD,EAAc,KAAKgB,QAAnB,CAAH;AACD;;;WAED,6BAAoB;AAClB,WAAKD,OAAL;AACD;;;WAED,mBAAU;AACR,UAAI,CAAC,KAAKF,MAAN,IAAgB,CAAC,KAAKG,QAA1B,EAAoC;AAClC;AACD;;AAED,UAAMO,EAAE,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACnCC,QAAAA,KAAK,EAAE,KAAKd,MADuB;AAEnCe,QAAAA,OAAO,EAAE,KAAKZ,QAFqB;AAGnCZ,QAAAA,aAAa,EAAE,KAAKF,cAHe;AAInC2B,QAAAA,eAAe,EAAE,KAAKC,cAAL,CAAoBC,IAApB,CAAyB,IAAzB;AAJkB,OAA1B,CAAX;;AAOAC,2BAASC,MAAT,CAAgBV,EAAhB,EAAoB,IAApB;AACD;;;kDAvDqCW,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport Main from './main';\nimport debug from 'debug';\nimport _ from 'lodash';\n\nimport { ModelSetEvent, SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport defaults from '../configure/lib/defaults';\n\nconst log = debug('pie-ui:math-inline');\n\nexport { Main as Component };\n\nexport default class MathInline extends HTMLElement {\n constructor() {\n super();\n this._configuration = defaults.configuration;\n this.sessionChangedEventCaller = _.debounce(() => {\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), true));\n }, 1000);\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(new ModelSetEvent(this._model, true, !!this._model));\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n set configuration(c) {\n this._configuration = c;\n this._render();\n }\n\n sessionChanged(s) {\n Object.keys(s).map((key) => {\n this._session[key] = s[key];\n });\n\n this.sessionChangedEventCaller();\n log('session: ', this._session);\n }\n\n connectedCallback() {\n this._render();\n }\n\n _render() {\n if (!this._model || !this._session) {\n return;\n }\n\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n configuration: this._configuration,\n onSessionChange: this.sessionChanged.bind(this),\n });\n\n ReactDOM.render(el, this);\n }\n}\n"],"file":"index.js"}
|
package/lib/main.js
CHANGED
|
@@ -49,9 +49,9 @@ var _mathquill = _interopRequireDefault(require("@pie-framework/mathquill"));
|
|
|
49
49
|
|
|
50
50
|
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
51
51
|
|
|
52
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
52
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
53
53
|
|
|
54
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
54
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
55
55
|
|
|
56
56
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
57
57
|
|
|
@@ -88,7 +88,9 @@ function prepareForStatic(model, state) {
|
|
|
88
88
|
|
|
89
89
|
var _ref2 = config || {},
|
|
90
90
|
expression = _ref2.expression,
|
|
91
|
-
responses = _ref2.responses
|
|
91
|
+
responses = _ref2.responses,
|
|
92
|
+
printMode = _ref2.printMode,
|
|
93
|
+
alwaysShowCorrect = _ref2.alwaysShowCorrect;
|
|
92
94
|
|
|
93
95
|
if (config && expression) {
|
|
94
96
|
var modelExpression = expression;
|
|
@@ -103,6 +105,11 @@ function prepareForStatic(model, state) {
|
|
|
103
105
|
return (modelExpression || '').replace(REGEX, function () {
|
|
104
106
|
var answer = state.session.answers["r".concat(answerBlocks)];
|
|
105
107
|
|
|
108
|
+
if (printMode && !alwaysShowCorrect) {
|
|
109
|
+
var blankSpace = '\\ \\ '.repeat(30) + '\\newline ';
|
|
110
|
+
return "\\MathQuillMathField[r".concat(answerBlocks++, "]{").concat(blankSpace.repeat(3), "}");
|
|
111
|
+
}
|
|
112
|
+
|
|
106
113
|
if (disabled) {
|
|
107
114
|
return "\\embed{answerBlock}[r".concat(answerBlocks++, "]");
|
|
108
115
|
}
|
|
@@ -300,7 +307,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
300
307
|
answers: _answers
|
|
301
308
|
}),
|
|
302
309
|
activeAnswerBlock: '',
|
|
303
|
-
showCorrect: false
|
|
310
|
+
showCorrect: _this.props.model.config.alwaysShowCorrect || false
|
|
304
311
|
};
|
|
305
312
|
return _this;
|
|
306
313
|
}
|
|
@@ -351,6 +358,12 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
351
358
|
}));
|
|
352
359
|
}
|
|
353
360
|
|
|
361
|
+
if (nextConfig.alwaysShowCorrect) {
|
|
362
|
+
this.setState({
|
|
363
|
+
showCorrect: true
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
354
367
|
if (config && config.responses && config.responses.length !== nextConfig.responses.length || !config && nextConfig && nextConfig.responses || config && nextConfig && config.expression !== nextConfig.expression) {
|
|
355
368
|
var newAnswers = {};
|
|
356
369
|
var answers = this.state.session.answers;
|
|
@@ -396,7 +409,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
396
409
|
// Safari Hack: https://stackoverflow.com/a/42764495/5757635
|
|
397
410
|
setTimeout(function () {
|
|
398
411
|
if (ref && IS_SAFARI) {
|
|
399
|
-
var div = document.querySelector(
|
|
412
|
+
var div = document.querySelector("[role='tooltip']");
|
|
400
413
|
|
|
401
414
|
if (div) {
|
|
402
415
|
var el = div.firstChild;
|
|
@@ -408,8 +421,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
408
421
|
}, {
|
|
409
422
|
key: "render",
|
|
410
423
|
value: function render() {
|
|
411
|
-
var
|
|
412
|
-
|
|
424
|
+
var _this4 = this,
|
|
425
|
+
_cx;
|
|
413
426
|
|
|
414
427
|
var _this$props2 = this.props,
|
|
415
428
|
model = _this$props2.model,
|
|
@@ -426,7 +439,10 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
426
439
|
view = _ref5.view,
|
|
427
440
|
teacherInstructions = _ref5.teacherInstructions,
|
|
428
441
|
rationale = _ref5.rationale,
|
|
429
|
-
feedback = _ref5.feedback
|
|
442
|
+
feedback = _ref5.feedback,
|
|
443
|
+
animationsDisabled = _ref5.animationsDisabled,
|
|
444
|
+
printMode = _ref5.printMode,
|
|
445
|
+
alwaysShowCorrect = _ref5.alwaysShowCorrect;
|
|
430
446
|
|
|
431
447
|
if (!config) {
|
|
432
448
|
return null;
|
|
@@ -448,11 +464,26 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
448
464
|
var displayNote = (showCorrect || mode === 'view' && role === 'instructor') && showNote && note;
|
|
449
465
|
var emptyResponse = (0, _isEmpty["default"])(responses);
|
|
450
466
|
var showCorrectAnswerToggle = !emptyResponse && correctness && correctness.correctness !== 'correct';
|
|
451
|
-
var tooltipModeEnabled = disabled && correctness
|
|
467
|
+
var tooltipModeEnabled = disabled && correctness;
|
|
452
468
|
var additionalKeys = generateAdditionalKeys(customKeys);
|
|
453
469
|
var correct = correctness && correctness.correct;
|
|
454
470
|
var staticLatex = prepareForStatic(model, this.state) || '';
|
|
455
471
|
var viewMode = disabled && !correctness;
|
|
472
|
+
var studentPrintMode = printMode && !alwaysShowCorrect;
|
|
473
|
+
|
|
474
|
+
var printView = /*#__PURE__*/_react["default"].createElement("div", {
|
|
475
|
+
className: classes.printContainer
|
|
476
|
+
}, /*#__PURE__*/_react["default"].createElement(_mathInput.mq.Static, {
|
|
477
|
+
ref: function ref(mqStatic) {
|
|
478
|
+
return _this4.mqStatic = mqStatic || _this4.mqStatic;
|
|
479
|
+
},
|
|
480
|
+
latex: staticLatex,
|
|
481
|
+
onSubFieldChange: this.subFieldChanged,
|
|
482
|
+
getFieldName: this.getFieldName,
|
|
483
|
+
setInput: this.setInput,
|
|
484
|
+
onSubFieldFocus: this.onSubFieldFocus,
|
|
485
|
+
onBlur: this.onBlur
|
|
486
|
+
}));
|
|
456
487
|
|
|
457
488
|
var midContent = /*#__PURE__*/_react["default"].createElement("div", {
|
|
458
489
|
className: classes.main
|
|
@@ -460,7 +491,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
460
491
|
className: classes.content
|
|
461
492
|
}, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
462
493
|
prompt: prompt
|
|
463
|
-
})), /*#__PURE__*/_react["default"].createElement(_renderUi.Readable, {
|
|
494
|
+
})), studentPrintMode ? printView : /*#__PURE__*/_react["default"].createElement(_renderUi.Readable, {
|
|
464
495
|
"false": true
|
|
465
496
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
466
497
|
className: classes.inputAndKeypadContainer
|
|
@@ -471,7 +502,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
471
502
|
model: model,
|
|
472
503
|
session: session
|
|
473
504
|
}), responseType === _utils.ResponseTypes.advanced && /*#__PURE__*/_react["default"].createElement("div", {
|
|
474
|
-
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), _cx))
|
|
505
|
+
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))
|
|
475
506
|
}, /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
476
507
|
ref: function ref(_ref7) {
|
|
477
508
|
return _this4.setTooltipRef(_ref7);
|
|
@@ -507,7 +538,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
507
538
|
setInput: this.setInput,
|
|
508
539
|
onSubFieldFocus: this.onSubFieldFocus,
|
|
509
540
|
onBlur: this.onBlur
|
|
510
|
-
}))))), viewMode && teacherInstructions && (0, _renderUi.hasText)(teacherInstructions) && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
|
541
|
+
}))))), viewMode && teacherInstructions && (0, _renderUi.hasText)(teacherInstructions) && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, !animationsDisabled ? /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
|
511
542
|
labels: {
|
|
512
543
|
hidden: 'Show Teacher Instructions',
|
|
513
544
|
visible: 'Hide Teacher Instructions'
|
|
@@ -516,7 +547,11 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
516
547
|
dangerouslySetInnerHTML: {
|
|
517
548
|
__html: teacherInstructions
|
|
518
549
|
}
|
|
519
|
-
}))
|
|
550
|
+
})) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
551
|
+
dangerouslySetInnerHTML: {
|
|
552
|
+
__html: teacherInstructions
|
|
553
|
+
}
|
|
554
|
+
}), /*#__PURE__*/_react["default"].createElement("br", null)), viewMode && rationale && (0, _renderUi.hasText)(rationale) && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, !animationsDisabled ? /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
|
520
555
|
labels: {
|
|
521
556
|
hidden: 'Show Rationale',
|
|
522
557
|
visible: 'Hide Rationale'
|
|
@@ -525,14 +560,18 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
525
560
|
dangerouslySetInnerHTML: {
|
|
526
561
|
__html: rationale
|
|
527
562
|
}
|
|
528
|
-
}))
|
|
563
|
+
})) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
564
|
+
dangerouslySetInnerHTML: {
|
|
565
|
+
__html: rationale
|
|
566
|
+
}
|
|
567
|
+
})), viewMode && displayNote && /*#__PURE__*/_react["default"].createElement("div", {
|
|
529
568
|
className: classes.note,
|
|
530
569
|
dangerouslySetInnerHTML: {
|
|
531
570
|
__html: "<strong>Note:</strong> ".concat(note)
|
|
532
571
|
}
|
|
533
572
|
}));
|
|
534
573
|
|
|
535
|
-
if (tooltipModeEnabled && (showCorrectAnswerToggle || teacherInstructions || rationale || feedback)) {
|
|
574
|
+
if (tooltipModeEnabled && (showCorrectAnswerToggle || teacherInstructions && (0, _renderUi.hasText)(teacherInstructions) || rationale && (0, _renderUi.hasText)(rationale) || feedback)) {
|
|
536
575
|
return /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
537
576
|
interactive: true,
|
|
538
577
|
classes: {
|
|
@@ -567,6 +606,16 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
567
606
|
prompt: rationale
|
|
568
607
|
})), /*#__PURE__*/_react["default"].createElement("br", {
|
|
569
608
|
key: "br"
|
|
609
|
+
})], displayNote && (0, _renderUi.hasText)(note) && [/*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
|
610
|
+
key: "collapsible",
|
|
611
|
+
labels: {
|
|
612
|
+
hidden: 'Show Note',
|
|
613
|
+
visible: 'Hide Note'
|
|
614
|
+
}
|
|
615
|
+
}, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
616
|
+
prompt: note
|
|
617
|
+
})), /*#__PURE__*/_react["default"].createElement("br", {
|
|
618
|
+
key: "br"
|
|
570
619
|
})], feedback && /*#__PURE__*/_react["default"].createElement(_renderUi.Feedback, {
|
|
571
620
|
correctness: correctness.correctness,
|
|
572
621
|
feedback: feedback
|
|
@@ -724,6 +773,9 @@ var styles = function styles(theme) {
|
|
|
724
773
|
padding: theme.spacing.unit,
|
|
725
774
|
letterSpacing: '0.5px'
|
|
726
775
|
},
|
|
776
|
+
printCorrect: {
|
|
777
|
+
border: "2px solid ".concat(_renderUi.color.correct(), " !important")
|
|
778
|
+
},
|
|
727
779
|
correct: {
|
|
728
780
|
borderColor: "".concat(_renderUi.color.correct(), " !important")
|
|
729
781
|
},
|
|
@@ -764,6 +816,10 @@ var styles = function styles(theme) {
|
|
|
764
816
|
}
|
|
765
817
|
}
|
|
766
818
|
}
|
|
819
|
+
},
|
|
820
|
+
printContainer: {
|
|
821
|
+
marginBottom: '10px',
|
|
822
|
+
pointerEvents: 'none'
|
|
767
823
|
}
|
|
768
824
|
};
|
|
769
825
|
};
|