@pie-element/extended-text-entry 6.5.4-next.133 → 6.5.4-next.1335

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.
@@ -26,6 +26,30 @@ Indicates if the item has to be displayed in the Settings Panel
26
26
 
27
27
  Indicates the label for the item that has to be displayed in the Settings Panel
28
28
 
29
+ # `spanishInput` (object)
30
+
31
+ Properties of the `spanishInput` object:
32
+
33
+ ## `settings` (boolean)
34
+
35
+ Indicates if the item has to be displayed in the Settings Panel
36
+
37
+ ## `label` (string)
38
+
39
+ Indicates the label for the item that has to be displayed in the Settings Panel
40
+
41
+ # `specialInput` (object)
42
+
43
+ Properties of the `specialInput` object:
44
+
45
+ ## `settings` (boolean)
46
+
47
+ Indicates if the item has to be displayed in the Settings Panel
48
+
49
+ ## `label` (string)
50
+
51
+ Indicates the label for the item that has to be displayed in the Settings Panel
52
+
29
53
  # `multiple` (object)
30
54
 
31
55
  Properties of the `multiple` object:
@@ -67,6 +91,30 @@ Indicates if the item has to be displayed in the Settings Panel
67
91
 
68
92
  Indicates the label for the item that has to be displayed in the Settings Panel
69
93
 
94
+ # `spellCheck` (object)
95
+
96
+ Properties of the `spellCheck` object:
97
+
98
+ ## `settings` (boolean)
99
+
100
+ Indicates if the item has to be displayed in the Settings Panel
101
+
102
+ ## `label` (string)
103
+
104
+ Indicates the label for the item that has to be displayed in the Settings Panel
105
+
106
+ # `playerSpellCheck` (object)
107
+
108
+ Properties of the `playerSpellCheck` object:
109
+
110
+ ## `settings` (boolean)
111
+
112
+ Indicates if the item has to be displayed in the Settings Panel
113
+
114
+ ## `label` (string)
115
+
116
+ Indicates the label for the item that has to be displayed in the Settings Panel
117
+
70
118
  # `dimensions` (object)
71
119
 
72
120
  Properties of the `dimensions` object:
@@ -79,6 +127,50 @@ Indicates if the item has to be displayed in the Settings Panel
79
127
 
80
128
  Indicates the label for the item that has to be displayed in the Settings Panel
81
129
 
130
+ # `maxImageWidth` (object)
131
+
132
+ Properties of the `maxImageWidth` object:
133
+
134
+ ## `teacherInstructions` (number)
135
+
136
+ Indicates the max dimension for images in teacher instructions
137
+
138
+ ## `prompt` (number)
139
+
140
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
141
+
142
+ ## `rationale` (number)
143
+
144
+ Indicates the max dimension for images in rationale
145
+
146
+ # `maxImageHeight` (object)
147
+
148
+ Properties of the `maxImageHeight` object:
149
+
150
+ ## `teacherInstructions` (number)
151
+
152
+ Indicates the max dimension for images in teacher instructions
153
+
154
+ ## `prompt` (number)
155
+
156
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
157
+
158
+ ## `rationale` (number)
159
+
160
+ Indicates the max dimension for images in rationale
161
+
162
+ # `withRubric` (object)
163
+
164
+ Properties of the `withRubric` object:
165
+
166
+ ## `settings` (boolean)
167
+
168
+ Indicates if the item has to be displayed in the Settings Panel
169
+
170
+ ## `label` (string)
171
+
172
+ Indicates the label for the item that has to be displayed in the Settings Panel
173
+
82
174
  # `showPrompt` (boolean)
83
175
 
84
176
  Determines whether prompt field will be displayed or not
@@ -130,4 +222,20 @@ Indicates the label for the item that has to be displayed in the Settings Panel
130
222
  ### `enabled` (boolean)
131
223
 
132
224
  Indicates the value of the item if it affects config-ui
133
- (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
225
+ (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
226
+
227
+ ## `ConfigureMaxImageDimensionsProp` (object)
228
+
229
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
230
+
231
+ ### `teacherInstructions` (number)
232
+
233
+ Indicates the max dimension for images in teacher instructions
234
+
235
+ ### `prompt` (number)
236
+
237
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
238
+
239
+ ### `rationale` (number)
240
+
241
+ Indicates the max dimension for images in rationale
@@ -2,11 +2,14 @@ exports.model = (id, element) => ({
2
2
  id,
3
3
  element,
4
4
  customKeys: [
5
- "\\square"
5
+ '\\square'
6
6
  ],
7
7
  feedback: { type: 'default', default: 'this is default feedback' },
8
8
  prompt: 'This is the question prompt',
9
9
  promptEnabled: true,
10
10
  mathInput: true,
11
+ playersToolbarPosition: 'bottom',
11
12
  toolbarEditorPosition: 'bottom',
13
+ spellCheckEnabled: true,
14
+ rubricEnabled: false
12
15
  });
@@ -63,6 +63,18 @@
63
63
  "type": "boolean",
64
64
  "title": "mathInput"
65
65
  },
66
+ "spanishInput": {
67
+ "description": "Whether a control to allow insertion of spanish characters should be displayed",
68
+ "default": false,
69
+ "type": "boolean",
70
+ "title": "spanishInput"
71
+ },
72
+ "specialInput": {
73
+ "description": "Whether a control to allow insertion of special characters should be displayed",
74
+ "default": false,
75
+ "type": "boolean",
76
+ "title": "specialInput"
77
+ },
66
78
  "multiple": {
67
79
  "description": "Indicates if multiple parts are enabled",
68
80
  "type": "boolean",
@@ -98,6 +110,16 @@
98
110
  "type": "boolean",
99
111
  "title": "rationaleEnabled"
100
112
  },
113
+ "spellCheckEnabled": {
114
+ "description": "Indicates if spellcheck is enabled for the author. Default value is true",
115
+ "type": "boolean",
116
+ "title": "spellCheckEnabled"
117
+ },
118
+ "playerSpellCheckEnabled": {
119
+ "description": "Indicates if spellcheck is enabled for the player. Default value is true",
120
+ "type": "boolean",
121
+ "title": "playerSpellCheckEnabled"
122
+ },
101
123
  "studentInstructionsEnabled": {
102
124
  "description": "Indicates if Student Instructions are enabled",
103
125
  "type": "boolean",
@@ -116,6 +138,21 @@
116
138
  "type": "string",
117
139
  "title": "toolbarEditorPosition"
118
140
  },
141
+ "playersToolbarPosition": {
142
+ "description": "Indicates the editor's toolbar position for the player, which can be 'bottom' or 'top'",
143
+ "default": ": 'bottom'",
144
+ "enum": [
145
+ "bottom",
146
+ "top"
147
+ ],
148
+ "type": "string",
149
+ "title": "playersToolbarPosition"
150
+ },
151
+ "rubricEnabled": {
152
+ "description": "Indicates if Rubric is enabled",
153
+ "type": "boolean",
154
+ "title": "rubricEnabled"
155
+ },
119
156
  "id": {
120
157
  "description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
121
158
  "type": "string",
@@ -132,7 +169,10 @@
132
169
  "element",
133
170
  "feedbackEnabled",
134
171
  "id",
172
+ "playerSpellCheckEnabled",
135
173
  "rationaleEnabled",
174
+ "rubricEnabled",
175
+ "spellCheckEnabled",
136
176
  "studentInstructionsEnabled",
137
177
  "teacherInstructionsEnabled"
138
178
  ],
@@ -174,6 +214,27 @@
174
214
  }
175
215
  }
176
216
  },
217
+ "ConfigureMaxImageDimensionsProp": {
218
+ "title": "ConfigureMaxImageDimensionsProp",
219
+ "type": "object",
220
+ "properties": {
221
+ "teacherInstructions": {
222
+ "description": "Indicates the max dimension for images in teacher instructions",
223
+ "type": "number",
224
+ "title": "teacherInstructions"
225
+ },
226
+ "prompt": {
227
+ "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",
228
+ "type": "number",
229
+ "title": "prompt"
230
+ },
231
+ "rationale": {
232
+ "description": "Indicates the max dimension for images in rationale",
233
+ "type": "number",
234
+ "title": "rationale"
235
+ }
236
+ }
237
+ },
177
238
  "Dimensions": {
178
239
  "title": "Dimensions",
179
240
  "type": "object",
@@ -52,6 +52,18 @@ Whether a control to allow insertion of math forumulas should be displayed
52
52
 
53
53
  Default: `false`
54
54
 
55
+ # `spanishInput` (boolean)
56
+
57
+ Whether a control to allow insertion of spanish characters should be displayed
58
+
59
+ Default: `false`
60
+
61
+ # `specialInput` (boolean)
62
+
63
+ Whether a control to allow insertion of special characters should be displayed
64
+
65
+ Default: `false`
66
+
55
67
  # `multiple` (boolean)
56
68
 
57
69
  Indicates if multiple parts are enabled
@@ -80,6 +92,14 @@ Indicates if Feedback is enabled
80
92
 
81
93
  Indicates if Rationale are enabled
82
94
 
95
+ # `spellCheckEnabled` (boolean, required)
96
+
97
+ Indicates if spellcheck is enabled for the author. Default value is true
98
+
99
+ # `playerSpellCheckEnabled` (boolean, required)
100
+
101
+ Indicates if spellcheck is enabled for the player. Default value is true
102
+
83
103
  # `studentInstructionsEnabled` (boolean, required)
84
104
 
85
105
  Indicates if Student Instructions are enabled
@@ -95,6 +115,21 @@ This element must be one of the following enum values:
95
115
  * `bottom`
96
116
  * `top`
97
117
 
118
+ # `playersToolbarPosition` (string, enum)
119
+
120
+ Indicates the editor's toolbar position for the player, which can be 'bottom' or 'top'
121
+
122
+ This element must be one of the following enum values:
123
+
124
+ * `bottom`
125
+ * `top`
126
+
127
+ Default: `": 'bottom'"`
128
+
129
+ # `rubricEnabled` (boolean, required)
130
+
131
+ Indicates if Rubric is enabled
132
+
98
133
  # `id` (string, required)
99
134
 
100
135
  Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
@@ -138,6 +173,22 @@ Indicates the label for the item that has to be displayed in the Settings Panel
138
173
  Indicates the value of the item if it affects config-ui
139
174
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
140
175
 
176
+ ## `ConfigureMaxImageDimensionsProp` (object)
177
+
178
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
179
+
180
+ ### `teacherInstructions` (number)
181
+
182
+ Indicates the max dimension for images in teacher instructions
183
+
184
+ ### `prompt` (number)
185
+
186
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
187
+
188
+ ### `rationale` (number)
189
+
190
+ Indicates the max dimension for images in rationale
191
+
141
192
  ## `Dimensions` (object)
142
193
 
143
194
  Properties of the `Dimensions` object:
package/lib/index.js CHANGED
@@ -5,9 +5,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.textContent = textContent;
9
- exports.isComplete = isComplete;
10
8
  exports["default"] = void 0;
9
+ exports.isComplete = isComplete;
10
+ exports.textContent = textContent;
11
11
 
12
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
13
 
@@ -29,13 +29,15 @@ var _react = _interopRequireDefault(require("react"));
29
29
 
30
30
  var _reactDom = _interopRequireDefault(require("react-dom"));
31
31
 
32
+ var _mathRendering = require("@pie-lib/math-rendering");
33
+
32
34
  var _piePlayerEvents = require("@pie-framework/pie-player-events");
33
35
 
34
36
  var _debug = _interopRequireDefault(require("debug"));
35
37
 
36
38
  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); }; }
37
39
 
38
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
40
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
39
41
 
40
42
  var log = (0, _debug["default"])('@pie-ui:extended-text-entry');
41
43
  var domParser = (typeof window === "undefined" ? "undefined" : (0, _typeof2["default"])(window)) !== undefined ? new DOMParser() : {
@@ -89,6 +91,9 @@ var RootExtendedTextEntry = /*#__PURE__*/function (_HTMLElement) {
89
91
  }
90
92
  }, {
91
93
  key: "session",
94
+ get: function get() {
95
+ return this._session;
96
+ },
92
97
  set: function set(s) {
93
98
  this._session = s;
94
99
  this.render();
@@ -107,6 +112,8 @@ var RootExtendedTextEntry = /*#__PURE__*/function (_HTMLElement) {
107
112
  }, {
108
113
  key: "render",
109
114
  value: function render() {
115
+ var _this2 = this;
116
+
110
117
  if (this._model && this._session) {
111
118
  var elem = /*#__PURE__*/_react["default"].createElement(_main["default"], {
112
119
  model: this._model,
@@ -114,7 +121,9 @@ var RootExtendedTextEntry = /*#__PURE__*/function (_HTMLElement) {
114
121
  onChange: this.handleChange.bind(this)
115
122
  });
116
123
 
117
- _reactDom["default"].render(elem, this);
124
+ _reactDom["default"].render(elem, this, function () {
125
+ (0, _mathRendering.renderMath)(_this2);
126
+ });
118
127
  }
119
128
  }
120
129
  }]);
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["log","domParser","window","undefined","DOMParser","parseFromString","v","textContent","value","document","body","err","isComplete","tc","out","length","RootExtendedTextEntry","_model","_session","m","dispatchEvent","ModelSetEvent","tagName","toLowerCase","render","s","SessionChangedEvent","elem","React","createElement","Main","model","session","onChange","handleChange","bind","ReactDOM","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAIA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,6BAAN,CAAZ;AAEA,IAAMC,SAAS,GACb,QAAOC,MAAP,0DAAOA,MAAP,OAAkBC,SAAlB,GAA8B,IAAIC,SAAJ,EAA9B,GAAgD;AAAEC,EAAAA,eAAe,EAAE,yBAAAC,CAAC;AAAA,WAAIA,CAAJ;AAAA;AAApB,CADlD;;AAGO,SAASC,WAAT,CAAqBC,KAArB,EAA4B;AACjC,MAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;AAC7B,WAAOL,SAAP;AACD;;AACD,MAAI;AACF,QAAMM,QAAQ,GAAGR,SAAS,CAACI,eAAV,CAA0BG,KAA1B,EAAiC,WAAjC,CAAjB;AACA,QAAMD,YAAW,GAAGE,QAAQ,CAACC,IAAT,CAAcH,WAAlC;AACA,WAAOA,YAAP;AACD,GAJD,CAIE,OAAOI,GAAP,EAAY;AACZX,IAAAA,GAAG,CAAC,kCAAD,EAAqCQ,KAArC,CAAH;AACA,WAAOA,KAAP;AACD;AACF;;AAEM,SAASI,UAAT,CAAoBJ,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ent":["import Main from './main';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport {\n ModelSetEvent,\n SessionChangedEvent\n} from '@pie-framework/pie-player-events';\nimport debug from 'debug';\n\nconst log = debug('@pie-ui:extended-text-entry');\n\nconst domParser =\n typeof window !== undefined ? new DOMParser() : { parseFromString: v => v };\n\nexport function textContent(value) {\n if (typeof value !== 'string') {\n return undefined;\n }\n try {\n const document = domParser.parseFromString(value, 'text/html');\n const textContent = document.body.textContent;\n return textContent;\n } catch (err) {\n log('tried to parse as dom and failed', value);\n return value;\n }\n}\n\nexport function isComplete(value) {\n const tc = textContent(value);\n const out = tc !== undefined && tc.length > 0;\n return out;\n}\n\nexport default class RootExtendedTextEntry extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._session = null;\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(\n new ModelSetEvent(this.tagName.toLowerCase(), false, !!this._model)\n );\n\n this.render();\n }\n\n set session(s) {\n this._session = s;\n this.render();\n }\n\n handleChange(value) {\n this._session.value = value;\n\n this.dispatchEvent(\n new SessionChangedEvent(this.tagName.toLowerCase(), isComplete(value))\n );\n }\n\n connectedCallback() {\n this.render();\n }\n\n render() {\n if (this._model && this._session) {\n let elem = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onChange: this.handleChange.bind(this)\n });\n ReactDOM.render(elem, this);\n }\n }\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["log","domParser","window","undefined","DOMParser","parseFromString","v","textContent","value","document","body","err","isComplete","tc","out","length","RootExtendedTextEntry","_model","_session","m","dispatchEvent","ModelSetEvent","tagName","toLowerCase","render","s","SessionChangedEvent","elem","React","createElement","Main","model","session","onChange","handleChange","bind","ReactDOM","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AAIA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,6BAAN,CAAZ;AAEA,IAAMC,SAAS,GAC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D;;;WAMD,sBAAahB,KAAb,EAAoB;AAClB,WAAKU,QAAL,CAAcV,KAAd,GAAsBA,KAAtB;AAEA,WAAKY,aAAL,CACE,IAAIM,oCAAJ,CAAwB,KAAKJ,OAAL,CAAaC,WAAb,EAAxB,EAAoDX,UAAU,CAACJ,KAAD,CAA9D,CADF;AAGD;;;WAED,6BAAoB;AAClB,WAAKgB,MAAL;AACD;;;WAED,kBAAS;AAAA;;AACP,UAAI,KAAKP,MAAL,IAAe,KAAKC,QAAxB,EAAkC;AAChC,YAAIS,IAAI,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACnCC,UAAAA,KAAK,EAAE,KAAKd,MADuB;AAEnCe,UAAAA,OAAO,EAAE,KAAKd,QAFqB;AAGnCe,UAAAA,QAAQ,EAAE,KAAKC,YAAL,CAAkBC,IAAlB,CAAuB,IAAvB;AAHyB,SAA1B,CAAX;;AAMAC,6BAASZ,MAAT,CAAgBG,IAAhB,EAAsB,IAAtB,EAA4B,YAAM;AAChC,yCAAW,MAAX;AACD,SAFD;AAGD;AACF;;;kDAjDgDU,W","sourcesContent":["import Main from './main';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nimport {\n ModelSetEvent,\n SessionChangedEvent\n} from '@pie-framework/pie-player-events';\nimport debug from 'debug';\n\nconst log = debug('@pie-ui:extended-text-entry');\n\nconst domParser =\n typeof window !== undefined ? new DOMParser() : { parseFromString: v => v };\n\nexport function textContent(value) {\n if (typeof value !== 'string') {\n return undefined;\n }\n try {\n const document = domParser.parseFromString(value, 'text/html');\n const textContent = document.body.textContent;\n return textContent;\n } catch (err) {\n log('tried to parse as dom and failed', value);\n return value;\n }\n}\n\nexport function isComplete(value) {\n const tc = textContent(value);\n const out = tc !== undefined && tc.length > 0;\n return out;\n}\n\nexport default class RootExtendedTextEntry extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._session = null;\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(\n new ModelSetEvent(this.tagName.toLowerCase(), false, !!this._model)\n );\n\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 handleChange(value) {\n this._session.value = value;\n\n this.dispatchEvent(\n new SessionChangedEvent(this.tagName.toLowerCase(), isComplete(value))\n );\n }\n\n connectedCallback() {\n this.render();\n }\n\n render() {\n if (this._model && this._session) {\n let elem = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onChange: this.handleChange.bind(this)\n });\n\n ReactDOM.render(elem, this, () => {\n renderMath(this);\n });\n }\n }\n}\n"],"file":"index.js"}
package/lib/main.js CHANGED
@@ -41,7 +41,7 @@ var _mathRendering = require("@pie-lib/math-rendering");
41
41
 
42
42
  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); }; }
43
43
 
44
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
44
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
45
45
 
46
46
  var log = (0, _debug["default"])('@pie-ui:extended-text-entry');
47
47
 
@@ -80,13 +80,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
80
80
  }
81
81
 
82
82
  (0, _createClass2["default"])(Main, [{
83
- key: "componentDidUpdate",
84
- value: function componentDidUpdate() {
85
- if (this.containerRef) {
86
- (0, _mathRendering.renderMath)(this.containerRef);
87
- }
88
- }
89
- }, {
90
83
  key: "render",
91
84
  value: function render() {
92
85
  var _this2 = this;
@@ -99,7 +92,12 @@ var Main = /*#__PURE__*/function (_React$Component) {
99
92
  disabled = model.disabled,
100
93
  feedback = model.feedback,
101
94
  teacherInstructions = model.teacherInstructions,
102
- mathInput = model.mathInput;
95
+ mathInput = model.mathInput,
96
+ spanishInput = model.spanishInput,
97
+ specialInput = model.specialInput,
98
+ animationsDisabled = model.animationsDisabled,
99
+ playersToolbarPosition = model.playersToolbarPosition,
100
+ spellCheckEnabled = model.spellCheckEnabled;
103
101
  var value = session.value;
104
102
 
105
103
  var _ref = dimensions || {},
@@ -107,28 +105,57 @@ var Main = /*#__PURE__*/function (_React$Component) {
107
105
  height = _ref.height;
108
106
 
109
107
  var maxHeight = '40vh';
108
+ var toolbarOpts = {};
110
109
  log('[render] disabled? ', disabled);
110
+
111
+ var teacherInstructionsDiv = /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
112
+ defaultClassName: "teacher-instructions",
113
+ prompt: teacherInstructions
114
+ });
115
+
116
+ switch (playersToolbarPosition) {
117
+ case 'top':
118
+ toolbarOpts.position = 'top';
119
+ break;
120
+
121
+ default:
122
+ toolbarOpts.position = 'bottom';
123
+ break;
124
+ }
125
+
126
+ var languageCharactersProps = [];
127
+
128
+ if (spanishInput) {
129
+ languageCharactersProps.push({
130
+ language: 'spanish'
131
+ });
132
+ }
133
+
134
+ if (specialInput) {
135
+ languageCharactersProps.push({
136
+ language: 'special'
137
+ });
138
+ }
139
+
111
140
  return /*#__PURE__*/_react["default"].createElement("div", {
112
141
  className: classes.main,
113
142
  ref: function ref(_ref2) {
114
143
  _this2.containerRef = _ref2;
115
144
  }
116
- }, teacherInstructions && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
145
+ }, teacherInstructions && /*#__PURE__*/_react["default"].createElement("div", null, !animationsDisabled ? /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
117
146
  labels: {
118
147
  hidden: 'Show Teacher Instructions',
119
148
  visible: 'Hide Teacher Instructions'
120
149
  },
121
150
  className: classes.collapsible
122
- }, /*#__PURE__*/_react["default"].createElement("div", {
123
- dangerouslySetInnerHTML: {
124
- __html: teacherInstructions
125
- }
126
- })), /*#__PURE__*/_react["default"].createElement("br", null)), model.prompt && /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
127
- className: classes.prompt,
128
- dangerouslySetInnerHTML: {
129
- __html: model.prompt
130
- }
131
- }), /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
151
+ }, teacherInstructionsDiv) : teacherInstructionsDiv, /*#__PURE__*/_react["default"].createElement("br", null)), model.prompt && /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
152
+ component: 'span',
153
+ className: classes.prompt
154
+ }, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
155
+ defaultClassName: "prompt",
156
+ prompt: model.prompt
157
+ })), /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
158
+ className: "response-area-editor",
132
159
  onChange: this.changeSession,
133
160
  markup: value || '',
134
161
  width: width && width.toString(),
@@ -136,6 +163,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
136
163
  maxHeight: maxHeight,
137
164
  disabled: disabled,
138
165
  highlightShape: true,
166
+ toolbarOpts: toolbarOpts,
167
+ spellCheck: spellCheckEnabled,
139
168
  pluginProps: {
140
169
  math: {
141
170
  disabled: !mathInput,
@@ -149,7 +178,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
149
178
  audio: {
150
179
  disabled: true
151
180
  }
152
- }
181
+ },
182
+ languageCharactersProps: languageCharactersProps
153
183
  }), feedback && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement(_renderUi.Feedback, {
154
184
  correctness: "correct",
155
185
  feedback: feedback
package/lib/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/main.jsx"],"names":["log","style","theme","main","backgroundColor","color","background","text","prompt","width","marginBottom","spacing","unit","fontSize","Main","props","onChange","containerRef","model","classes","session","dimensions","disabled","feedback","teacherInstructions","mathInput","value","height","maxHeight","ref","hidden","visible","collapsible","__html","changeSession","toString","math","customKeys","keypadMode","equationEditor","controlledKeypadMode","video","audio","React","Component","PropTypes","func","isRequired","object","shape","string"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,6BAAN,CAAZ;;AAEA,IAAMC,KAAK,GAAG,SAARA,KAAQ,CAAAC,KAAK;AAAA,SAAK;AACtBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,eAAe,EAAEC,gBAAMC,UAAN,EADb;AAEJD,MAAAA,KAAK,EAAEA,gBAAME,IAAN;AAFH,KADgB;AAKtBC,IAAAA,MAAM,EAAE;AACNC,MAAAA,KAAK,EAAE,MADD;AAENJ,MAAAA,KAAK,EAAEA,gBAAME,IAAN,EAFD;AAGNG,MAAAA,YAAY,EAAER,KAAK,CAACS,OAAN,CAAcC,IAAd,GAAqB,CAH7B;AAINC,MAAAA,QAAQ,EAAE;AAJJ;AALc,GAAL;AAAA,CAAnB;;IAaaC,I;;;;;;;;;;;;;;;sGAgBK,0BAAS,MAAKC,KAAL,CAAWC,QAApB,EAA8B,IAA9B,C;;;;;;WANhB,8BAAqB;AACnB,UAAI,KAAKC,YAAT,EAAuB;AACrB,uCAAW,KAAKA,YAAhB;AACD;AACF;;;WAID,kBAAS;AAAA;;AAAA,wBAC6B,KAAKF,KADlC;AAAA,UACCG,KADD,eACCA,KADD;AAAA,UACQC,OADR,eACQA,OADR;AAAA,UACiBC,OADjB,eACiBA,OADjB;AAAA,UAECC,UAFD,GAEoEH,KAFpE,CAECG,UAFD;AAAA,UAEaC,QAFb,GAEo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EAAER,MAAM,IAAIA,MAAM,CAACQ,QAAP,EAJvB;AAKE,QAAA,SAAS,EAAEP,SALb;AAME,QAAA,QAAQ,EAAEN,QANZ;AAOE,QAAA,cAAc,EAAE,IAPlB;AAQE,QAAA,WAAW,EAAE;AACXc,UAAAA,IAAI,EAAE;AACJd,YAAAA,QAAQ,EAAE,CAACG,SADP;AAEJY,YAAAA,UAAU,EAAE,KAAKtB,KAAL,CAAWG,KAAX,CAAiBmB,UAFzB;AAGJC,YAAAA,UAAU,EAAE,KAAKvB,KAAL,CAAWG,KAAX,CAAiBqB,cAHzB;AAIJC,YAAAA,oBAAoB,EAAE;AAJlB,WADK;AAOXC,UAAAA,KAAK,EAAE;AACLnB,YAAAA,QAAQ,EAAE;AADL,WAPI;AAUVoB,UAAAA,KAAK,EAAE;AACNpB,YAAAA,QAAQ,EAAE;AADJ;AAVG;AARf,QAzBF,EAgDGC,QAAQ,iBACP,0DACE,2CADF,eAEE,gCAAC,kBAAD;AAAU,QAAA,WAAW,EAAC,SAAtB;AAAgC,QAAA,QAAQ,EAAEA;AAA1C,QAFF,CAjDJ,CADF;AAyDD;;;EAnFuBoB,kBAAMC,S;;;iCAAnB9B,I,eACQ;AACjBE,EAAAA,QAAQ,EAAE6B,sBAAUC,IAAV,CAAeC,UADR;AAEjB7B,EAAAA,KAAK,EAAE2B,sBAAUG,MAFA;AAGjB7B,EAAAA,OAAO,EAAE0B,sBAAUG,MAAV,CAAiBD,UAHT;AAIjB3B,EAAAA,OAAO,EAAEyB,sBAAUI,KAAV,CAAgB;AACvBvB,IAAAA,KAAK,EAAEmB,sBAAUK;AADM,GAAhB,EAENH;AANc,C;;eAqFN,wBAAW9C,KAAX,EAAkBa,IAAlB,C","sourcesContent":["import React from 'react';\nimport EditableHTML from '@pie-lib/editable-html';\nimport PropTypes from 'prop-types';\nimport Typography from '@material-ui/core/Typography';\nimport { withStyles } from '@material-ui/core/styles';\nimport debug from 'debug';\nimport debounce from 'lodash/debounce';\nimport { color, Feedback, Collapsible } from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nconst log = debug('@pie-ui:extended-text-entry');\n\nconst style = theme => ({\n main: {\n backgroundColor: color.background(),\n color: color.text()\n },\n prompt: {\n width: '100%',\n color: color.text(),\n marginBottom: theme.spacing.unit * 2,\n fontSize: 'inherit'\n }\n});\n\nexport class Main extends React.Component {\n static propTypes = {\n onChange: PropTypes.func.isRequired,\n model: PropTypes.object,\n classes: PropTypes.object.isRequired,\n session: PropTypes.shape({\n value: PropTypes.string\n }).isRequired\n };\n\n componentDidUpdate() {\n if (this.containerRef) {\n renderMath(this.containerRef);\n }\n }\n\n changeSession = debounce(this.props.onChange, 1500);\n\n render() {\n const { model, classes, session } = this.props;\n const { dimensions, disabled, feedback, teacherInstructions, mathInput } = model;\n const { value } = session;\n const { width, height } = dimensions || {};\n const maxHeight = '40vh';\n log('[render] disabled? ', disabled);\n\n return (\n <div\n className={classes.main}\n ref={ref => {\n this.containerRef = ref;\n }}\n >\n {\n teacherInstructions && (\n <div>\n <Collapsible\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n className={classes.collapsible}\n >\n <div dangerouslySetInnerHTML={{ __html: teacherInstructions }}/>\n </Collapsible>\n <br />\n </div>\n )\n }\n {model.prompt && (\n <Typography\n className={classes.prompt}\n dangerouslySetInnerHTML={{ __html: model.prompt }}\n />\n )}\n <EditableHTML\n onChange={this.changeSession}\n markup={value || ''}\n width={width && width.toString()}\n minHeight={height && height.toString()}\n maxHeight={maxHeight}\n disabled={disabled}\n highlightShape={true}\n pluginProps={{\n math: {\n disabled: !mathInput,\n customKeys: this.props.model.customKeys,\n keypadMode: this.props.model.equationEditor,\n controlledKeypadMode: false\n },\n video: {\n disabled: true\n },\n audio: {\n disabled: true\n }\n }}\n />\n {feedback && (\n <div>\n <br />\n <Feedback correctness=\"correct\" feedback={feedback}/>\n </div>\n )}\n </div>\n );\n }\n}\n\nexport default withStyles(style)(Main);\n"],"file":"main.js"}
1
+ {"version":3,"sources":["../src/main.jsx"],"names":["log","style","theme","main","backgroundColor","color","background","text","prompt","width","marginBottom","spacing","unit","fontSize","Main","props","onChange","model","classes","session","dimensions","disabled","feedback","teacherInstructions","mathInput","spanishInput","specialInput","animationsDisabled","playersToolbarPosition","spellCheckEnabled","value","height","maxHeight","toolbarOpts","teacherInstructionsDiv","position","languageCharactersProps","push","language","ref","containerRef","hidden","visible","collapsible","changeSession","toString","math","customKeys","keypadMode","equationEditor","controlledKeypadMode","video","audio","React","Component","PropTypes","func","isRequired","object","shape","string"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,6BAAN,CAAZ;;AAEA,IAAMC,KAAK,GAAG,SAARA,KAAQ,CAAAC,KAAK;AAAA,SAAK;AACtBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,eAAe,EAAEC,gBAAMC,UAAN,EADb;AAEJD,MAAAA,KAAK,EAAEA,gBAAME,IAAN;AAFH,KADgB;AAKtBC,IAAAA,MAAM,EAAE;AACNC,MAAAA,KAAK,EAAE,MADD;AAENJ,MAAAA,KAAK,EAAEA,gBAAME,IAAN,EAFD;AAGNG,MAAAA,YAAY,EAAER,KAAK,CAACS,OAAN,CAAcC,IAAd,GAAqB,CAH7B;AAINC,MAAAA,QAAQ,EAAE;AAJJ;AALc,GAAL;AAAA,CAAnB;;IAaaC,I;;;;;;;;;;;;;;;sGAUK,0BAAS,MAAKC,KAAL,CAAWC,QAApB,EAA8B,IAA9B,C;;;;;;WAEhB,kBAAS;AAAA;;AACP,wBAAoC,KAAKD,KAAzC;AAAA,UAAQE,KAAR,eAAQA,KAAR;AAAA,UAAeC,OAAf,eAAeA,OAAf;AAAA,UAAwBC,OAAxB,eAAwBA,OAAxB;AACA,UACEC,UADF,GAWIH,KAXJ,CACEG,UADF;AAAA,UAEEC,QAFF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AAE,KAAKjC,KAAL,CAAWE,KAAX,CAAiBgC,cAHzB;AAIJC,YAAAA,oBAAoB,EAAE;AAJlB,WADK;AAOXC,UAAAA,KAAK,EAAE;AACL9B,YAAAA,QAAQ,EAAE;AADL,WAPI;AAUV+B,UAAAA,KAAK,EAAE;AACN/B,YAAAA,QAAQ,EAAE;AADJ;AAVG,SAXf;AAyBE,QAAA,uBAAuB,EAAEe;AAzB3B,QA7BF,EAwDGd,QAAQ,iBACP,0DACE,2CADF,eAEE,gCAAC,kBAAD;AAAU,QAAA,WAAW,EAAC,SAAtB;AAAgC,QAAA,QAAQ,EAAEA;AAA1C,QAFF,CAzDJ,CADF;AAiED;;;EAvHuB+B,kBAAMC,S;;;iCAAnBxC,I,eACQ;AACjBE,EAAAA,QAAQ,EAAEuC,sBAAUC,IAAV,CAAeC,UADR;AAEjBxC,EAAAA,KAAK,EAAEsC,sBAAUG,MAFA;AAGjBxC,EAAAA,OAAO,EAAEqC,sBAAUG,MAAV,CAAiBD,UAHT;AAIjBtC,EAAAA,OAAO,EAAEoC,sBAAUI,KAAV,CAAgB;AACvB7B,IAAAA,KAAK,EAAEyB,sBAAUK;AADM,GAAhB,EAENH;AANc,C;;eAyHN,wBAAWxD,KAAX,EAAkBa,IAAlB,C","sourcesContent":["import React from 'react';\nimport EditableHTML from '@pie-lib/editable-html';\nimport PropTypes from 'prop-types';\nimport Typography from '@material-ui/core/Typography';\nimport { withStyles } from '@material-ui/core/styles';\nimport debug from 'debug';\nimport debounce from 'lodash/debounce';\nimport {color, Feedback, Collapsible, PreviewPrompt} from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nconst log = debug('@pie-ui:extended-text-entry');\n\nconst style = theme => ({\n main: {\n backgroundColor: color.background(),\n color: color.text()\n },\n prompt: {\n width: '100%',\n color: color.text(),\n marginBottom: theme.spacing.unit * 2,\n fontSize: 'inherit'\n }\n});\n\nexport class Main extends React.Component {\n static propTypes = {\n onChange: PropTypes.func.isRequired,\n model: PropTypes.object,\n classes: PropTypes.object.isRequired,\n session: PropTypes.shape({\n value: PropTypes.string\n }).isRequired\n };\n\n changeSession = debounce(this.props.onChange, 1500);\n\n render() {\n const { model, classes, session } = this.props;\n const {\n dimensions,\n disabled,\n feedback,\n teacherInstructions,\n mathInput,\n spanishInput,\n specialInput,\n animationsDisabled,\n playersToolbarPosition,\n spellCheckEnabled\n } = model;\n const { value } = session;\n const { width, height } = dimensions || {};\n const maxHeight = '40vh';\n const toolbarOpts = {};\n\n log('[render] disabled? ', disabled);\n\n const teacherInstructionsDiv = <PreviewPrompt defaultClassName=\"teacher-instructions\" prompt={teacherInstructions} />;\n\n switch (playersToolbarPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n\n const languageCharactersProps = [];\n\n if (spanishInput) {\n languageCharactersProps.push({ language: 'spanish' });\n }\n\n if (specialInput) {\n languageCharactersProps.push({ language: 'special' });\n }\n\n return (\n <div\n className={classes.main}\n ref={ref => {\n this.containerRef = ref;\n }}\n >\n {\n teacherInstructions && (\n <div>\n {!animationsDisabled ? (\n <Collapsible\n labels={{hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions'}}\n className={classes.collapsible}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n ) : teacherInstructionsDiv }\n <br/>\n </div>\n )\n }\n {model.prompt && (\n <Typography\n component={'span'}\n className={classes.prompt}\n >\n <PreviewPrompt defaultClassName=\"prompt\" prompt={model.prompt} />\n </Typography>\n )}\n <EditableHTML\n className=\"response-area-editor\"\n onChange={this.changeSession}\n markup={value || ''}\n width={width && width.toString()}\n minHeight={height && height.toString()}\n maxHeight={maxHeight}\n disabled={disabled}\n highlightShape={true}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n pluginProps={{\n math: {\n disabled: !mathInput,\n customKeys: this.props.model.customKeys,\n keypadMode: this.props.model.equationEditor,\n controlledKeypadMode: false\n },\n video: {\n disabled: true\n },\n audio: {\n disabled: true\n }\n }}\n languageCharactersProps={languageCharactersProps}\n />\n {feedback && (\n <div>\n <br />\n <Feedback correctness=\"correct\" feedback={feedback}/>\n </div>\n )}\n </div>\n );\n }\n}\n\nexport default withStyles(style)(Main);\n"],"file":"main.js"}