@pie-element/extended-text-entry 6.5.4-next.428 → 6.5.4-next.430

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.
@@ -8,72 +8,7 @@ var _default = {
8
8
  dimensions: {
9
9
  height: 100,
10
10
  width: 500
11
- },
12
- predefinedAnnotations: [{
13
- label: 'good',
14
- text: 'good',
15
- type: 'positive'
16
- }, {
17
- label: '★',
18
- text: '★',
19
- type: 'positive'
20
- }, {
21
- label: ':-)',
22
- text: ':-)',
23
- type: 'positive'
24
- }, {
25
- label: 'creative',
26
- text: 'creative',
27
- type: 'positive'
28
- }, {
29
- label: 'run-on',
30
- text: 'run-on',
31
- type: 'negative'
32
- }, {
33
- label: 'frag',
34
- text: 'fragment',
35
- type: 'negative'
36
- }, {
37
- label: 'tran',
38
- text: 'transition',
39
- type: 'negative'
40
- }, {
41
- label: 'supp',
42
- text: 'support needed',
43
- type: 'negative'
44
- }, {
45
- label: 'punc',
46
- text: 'punctuation',
47
- type: 'negative'
48
- }, {
49
- label: 'agr',
50
- text: 'agreement wrong',
51
- type: 'negative'
52
- }, {
53
- label: 'unclear',
54
- text: 'unclear',
55
- type: 'negative'
56
- }, {
57
- label: 'cut',
58
- text: 'cut',
59
- type: 'negative'
60
- }, {
61
- label: 'sp',
62
- text: 'spelling',
63
- type: 'negative'
64
- }, {
65
- label: 'cap',
66
- text: 'capitalization',
67
- type: 'negative'
68
- }, {
69
- label: 'inf',
70
- text: 'informal',
71
- type: 'negative'
72
- }, {
73
- label: 'awk',
74
- text: 'awkward',
75
- type: 'negative'
76
- }]
11
+ }
77
12
  };
78
13
  exports["default"] = _default;
79
14
  //# sourceMappingURL=defaults.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/defaults.js"],"names":["dimensions","height","width","predefinedAnnotations","label","text","type"],"mappings":";;;;;;eAAe;AACbA,EAAAA,UAAU,EAAE;AACVC,IAAAA,MAAM,EAAE,GADE;AAEVC,IAAAA,K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A,IAAI,EAAE;AAHL,GAzCkB,EA6ClB;AACDF,IAAAA,KAAK,EAAE,KADN;AAEDC,IAAAA,IAAI,EAAE,KAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GA7CkB,EAiDlB;AACDF,IAAAA,KAAK,EAAE,IADN;AAEDC,IAAAA,IAAI,EAAE,UAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GAjDkB,EAqDlB;AACDF,IAAAA,KAAK,EAAE,KADN;AAEDC,IAAAA,IAAI,EAAE,gBAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GArDkB,EAyDlB;AACDF,IAAAA,KAAK,EAAE,KADN;AAEDC,IAAAA,IAAI,EAAE,UAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GAzDkB,EA6DlB;AACDF,IAAAA,KAAK,EAAE,KADN;AAEDC,IAAAA,IAAI,EAAE,SAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GA7DkB;AALV,C","sourcesContent":["export default {\n dimensions: {\n height: 100,\n width: 500,\n },\n predefinedAnnotations: [\n {\n label: 'good',\n text: 'good',\n type: 'positive'\n }, {\n label: '★',\n text: '★',\n type: 'positive'\n }, {\n label: ':-)',\n text: ':-)',\n type: 'positive'\n }, {\n label: 'creative',\n text: 'creative',\n type: 'positive'\n }, {\n label: 'run-on',\n text: 'run-on',\n type: 'negative'\n }, {\n label: 'frag',\n text: 'fragment',\n type: 'negative'\n }, {\n label: 'tran',\n text: 'transition',\n type: 'negative'\n }, {\n label: 'supp',\n text: 'support needed',\n type: 'negative'\n }, {\n label: 'punc',\n text: 'punctuation',\n type: 'negative'\n }, {\n label: 'agr',\n text: 'agreement wrong',\n type: 'negative'\n }, {\n label: 'unclear',\n text: 'unclear',\n type: 'negative'\n }, {\n label: 'cut',\n text: 'cut',\n type: 'negative'\n }, {\n label: 'sp',\n text: 'spelling',\n type: 'negative'\n }, {\n label: 'cap',\n text: 'capitalization',\n type: 'negative'\n }, {\n label: 'inf',\n text: 'informal',\n type: 'negative'\n }, {\n label: 'awk',\n text: 'awkward',\n type: 'negative'\n }\n ]\n};\n"],"file":"defaults.js"}
1
+ {"version":3,"sources":["../src/defaults.js"],"names":["dimensions","height","width"],"mappings":";;;;;;eAAe;AACbA,EAAAA,UAAU,EAAE;AACVC,IAAAA,MAAM,EAAE,GADE;AAEVC,IAAAA,KAAK,EAAE;AAFG;AADC,C","sourcesContent":["export default {\n dimensions: {\n height: 100,\n width: 500,\n }\n};\n"],"file":"defaults.js"}
@@ -72,17 +72,13 @@ function model(_x, _x2, _x3) {
72
72
 
73
73
  function _model() {
74
74
  _model = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(question, session, env) {
75
- var normalizedQuestion, fb, teacherInstructions, equationEditor, annotatorMode, disabledAnnotator;
75
+ var normalizedQuestion, fb, teacherInstructions, equationEditor;
76
76
  return _regenerator["default"].wrap(function _callee2$(_context2) {
77
77
  while (1) {
78
78
  switch (_context2.prev = _context2.next) {
79
79
  case 0:
80
80
  log('[question]', question);
81
- console.log('session', session);
82
- console.log('question', question);
83
- console.log('env', env);
84
81
  normalizedQuestion = normalize(question);
85
- console.log('normalizedQuestion', normalizedQuestion);
86
82
  fb = env.mode === 'evaluate' && normalizedQuestion.feedbackEnabled ? (0, _feedback.getFeedback)(normalizedQuestion.feedback, 'Your answer has been submitted') : Promise.resolve(undefined);
87
83
  teacherInstructions = null;
88
84
 
@@ -94,49 +90,43 @@ function _model() {
94
90
 
95
91
  equationEditor = normalizedQuestion.equationEditor || 'miscellaneous';
96
92
  _context2.t0 = normalizedQuestion.equationEditor;
97
- _context2.next = _context2.t0 === 'Grade 1 - 2' ? 13 : _context2.t0 === 'Grade 3 - 5' ? 15 : _context2.t0 === 'Grade 6 - 7' ? 17 : _context2.t0 === 'Grade 8 - HS' ? 19 : 21;
93
+ _context2.next = _context2.t0 === 'Grade 1 - 2' ? 9 : _context2.t0 === 'Grade 3 - 5' ? 11 : _context2.t0 === 'Grade 6 - 7' ? 13 : _context2.t0 === 'Grade 8 - HS' ? 15 : 17;
98
94
  break;
99
95
 
100
- case 13:
96
+ case 9:
101
97
  equationEditor = 1;
102
- return _context2.abrupt("break", 22);
98
+ return _context2.abrupt("break", 18);
103
99
 
104
- case 15:
100
+ case 11:
105
101
  equationEditor = 3;
106
- return _context2.abrupt("break", 22);
102
+ return _context2.abrupt("break", 18);
107
103
 
108
- case 17:
104
+ case 13:
109
105
  equationEditor = 6;
110
- return _context2.abrupt("break", 22);
106
+ return _context2.abrupt("break", 18);
111
107
 
112
- case 19:
108
+ case 15:
113
109
  equationEditor = 8;
114
- return _context2.abrupt("break", 22);
110
+ return _context2.abrupt("break", 18);
115
111
 
116
- case 21:
117
- return _context2.abrupt("break", 22);
112
+ case 17:
113
+ return _context2.abrupt("break", 18);
118
114
 
119
- case 22:
120
- annotatorMode = env.role === 'instructor' || env.mode === 'evaluate';
121
- disabledAnnotator = env.role !== 'instructor';
115
+ case 18:
122
116
  return _context2.abrupt("return", fb.then(function (feedback) {
123
117
  return {
124
118
  prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,
125
119
  dimensions: normalizedQuestion.dimensions,
126
120
  customKeys: normalizedQuestion.customKeys || [],
127
- id: normalizedQuestion.id,
128
121
  disabled: env.mode !== 'gather',
129
122
  feedback: feedback,
130
123
  teacherInstructions: teacherInstructions,
131
124
  mathInput: normalizedQuestion.mathInput,
132
- equationEditor: equationEditor,
133
- annotatorMode: annotatorMode,
134
- disabledAnnotator: disabledAnnotator,
135
- predefinedAnnotations: normalizedQuestion.predefinedAnnotations
125
+ equationEditor: equationEditor
136
126
  };
137
127
  }));
138
128
 
139
- case 25:
129
+ case 19:
140
130
  case "end":
141
131
  return _context2.stop();
142
132
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["log","createDefaultModel","model","defaults","normalize","question","feedbackEnabled","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","session","env","console","normalizedQuestion","fb","mode","feedback","Promise","resolve","undefined","teacherInstructions","role","equationEditor","annotatorMode","disabledAnnotator","then","prompt","dimensions","customKeys","id","disabled","mathInput","predefinedAnnotations","outcome","score","completed","note"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AAGA;;AAEA;;;;;;AAHA,IAAMA,GAAG,GAAG,uBAAM,6CAAN,CAAZ;;SAKsBC,kB;;;;;sGAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAkCC,YAAAA,KAAlC,2DAA0C,EAA1C;AACLF,YAAAA,GAAG,CAAC,sBAAD,EAAyBE,KAAzB,CAAH;AADK,6EAIAC,oBAJA,GAKAD,KALA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AASA,IAAME,SAAS,GAAG,SAAZA,SAAY,CAAAC,QAAQ;AAAA,yCAC5BF,oBAD4B;AAE/BG,IAAAA,eAAe,EAAE,IAFc;AAG/BC,IAAAA,gBAAgB,EAAE,IAHa;AAI/BC,IAAAA,aAAa,EAAE,IAJgB;AAK/BC,IAAAA,0BAA0B,EAAE,IALG;AAM/BC,IAAAA,0BAA0B,EAAE;AANG,KAO5BL,QAP4B;AAAA,CAA1B;;;;SAWeH,K;;;;;yFAAf,kBAAqBG,QAArB,EAA+BM,OAA/B,EAAwCC,GAAxC;AAAA;AAAA;AAAA;AAAA;AAAA;AACLZ,YAAAA,GAAG,CAAC,YAAD,EAAeK,QAAf,CAAH;AACAQ,YAAAA,OAAO,CAACb,GAAR,CAAY,SAAZ,EAAuBW,OAAvB;AACAE,YAAAA,OAAO,CAACb,GAAR,CAAY,UAAZ,EAAwBK,QAAxB;AACAQ,YAAAA,OAAO,CAACb,GAAR,CAAY,KAAZ,EAAmBY,GAAnB;AACME,YAAAA,kBALD,GAKsBV,SAAS,CAACC,QAAD,CAL/B;AAMLQ,YAAAA,OAAO,CAACb,GAAR,CAAY,oBAAZ,EAAkCc,kBAAlC;AAEMC,YAAAA,EARD,GASHH,GAAG,CAACI,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,gBAAAA,UAAU,EAAEd,kBAAkB,CAACc,UAFL;AAG1BC,gBAAAA,UAAU,EAAEf,kBAAkB,CAACe,UAAnB,IAAiC,EAHnB;AAI1BC,gBAAAA,EAAE,EAAEhB,kBAAkB,CAACgB,EAJG;AAK1BC,gBAAAA,QAAQ,EAAEnB,GAAG,CAACI,IAAJ,KAAa,QALG;AAM1BC,gBAAAA,QAAQ,EAARA,QAN0B;AAO1BI,gBAAAA,mBAAmB,EAAnBA,mBAP0B;AAQ1BW,gBAAAA,SAAS,EAAElB,kBAAkB,CAACkB,SARJ;AAS1BT,gBAAAA,cAAc,EAAdA,cAT0B;AAU1BC,gBAAAA,aAAa,EAAbA,aAV0B;AAW1BC,gBAAAA,iBAAiB,EAAjBA,iBAX0B;AAY1BQ,gBAAAA,qBAAqB,EAAEnB,kBAAkB,CAACmB;AAZhB,eAAL;AAAA,aAAhB,CA1CF;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;SA0DeC,O;;;;;2FAAf;AAAA;AAAA;AAAA;AAAA;AAAA,8CACE;AACLC,cAAAA,KAAK,EAAE,CADF;AAELC,cAAAA,SAAS,EAAE,KAFN;AAGLC,cAAAA,IAAI,EAAE;AAHD,aADF;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","sourcesContent":["import debug from 'debug';\n\nconst log = debug('@pie-element:extended-text-entry:controller');\nimport { getFeedback } from '@pie-lib/feedback';\n\nimport defaults from './defaults';\n\nexport async function createDefaultModel(model = {}) {\n log('[createDefaultModel]', model);\n\n return {\n ...defaults,\n ...model,\n };\n}\n\nexport const normalize = question => ({\n ...defaults,\n feedbackEnabled: true,\n rationaleEnabled: true,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\n\nexport async function model(question, session, env) {\n log('[question]', question);\n console.log('session', session);\n console.log('question', question);\n console.log('env', env);\n const normalizedQuestion = normalize(question);\n console.log('normalizedQuestion', normalizedQuestion);\n\n const fb =\n env.mode === 'evaluate' && normalizedQuestion.feedbackEnabled\n ? getFeedback(normalizedQuestion.feedback, 'Your answer has been submitted')\n : Promise.resolve(undefined);\n\n let teacherInstructions = null;\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n } else {\n teacherInstructions = null;\n }\n\n let equationEditor = normalizedQuestion.equationEditor || 'miscellaneous';\n\n switch (normalizedQuestion.equationEditor) {\n case 'Grade 1 - 2':\n equationEditor = 1;\n break;\n case 'Grade 3 - 5':\n equationEditor = 3;\n break;\n case 'Grade 6 - 7':\n equationEditor = 6;\n break;\n case 'Grade 8 - HS':\n equationEditor = 8;\n break;\n default:\n break;\n }\n\n const annotatorMode = env.role === 'instructor' || env.mode === 'evaluate';\n const disabledAnnotator = env.role !== 'instructor';\n\n return fb.then(feedback => ({\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n dimensions: normalizedQuestion.dimensions,\n customKeys: normalizedQuestion.customKeys || [],\n id: normalizedQuestion.id,\n disabled: env.mode !== 'gather',\n feedback,\n teacherInstructions,\n mathInput: normalizedQuestion.mathInput,\n equationEditor,\n annotatorMode,\n disabledAnnotator,\n predefinedAnnotations: normalizedQuestion.predefinedAnnotations\n }));\n}\n\nexport async function outcome(/*question, session, env*/) {\n return {\n score: 0,\n completed: 'n/a',\n note: 'Requires manual scoring'\n };\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["log","createDefaultModel","model","defaults","normalize","question","feedbackEnabled","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","session","env","normalizedQuestion","fb","mode","feedback","Promise","resolve","undefined","teacherInstructions","role","equationEditor","then","prompt","dimensions","customKeys","disabled","mathInput","outcome","score","completed","note"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AAGA;;AAEA;;;;;;AAHA,IAAMA,GAAG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,G","sourcesContent":["import debug from 'debug';\n\nconst log = debug('@pie-element:extended-text-entry:controller');\nimport { getFeedback } from '@pie-lib/feedback';\n\nimport defaults from './defaults';\n\nexport async function createDefaultModel(model = {}) {\n log('[createDefaultModel]', model);\n\n return {\n ...defaults,\n ...model,\n };\n}\n\nexport const normalize = question => ({\n ...defaults,\n feedbackEnabled: true,\n rationaleEnabled: true,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\n\nexport async function model(question, session, env) {\n log('[question]', question);\n const normalizedQuestion = normalize(question);\n\n const fb =\n env.mode === 'evaluate' && normalizedQuestion.feedbackEnabled\n ? getFeedback(normalizedQuestion.feedback, 'Your answer has been submitted')\n : Promise.resolve(undefined);\n\n let teacherInstructions = null;\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n } else {\n teacherInstructions = null;\n }\n\n let equationEditor = normalizedQuestion.equationEditor || 'miscellaneous';\n\n switch (normalizedQuestion.equationEditor) {\n case 'Grade 1 - 2':\n equationEditor = 1;\n break;\n case 'Grade 3 - 5':\n equationEditor = 3;\n break;\n case 'Grade 6 - 7':\n equationEditor = 6;\n break;\n case 'Grade 8 - HS':\n equationEditor = 8;\n break;\n default:\n break;\n }\n\n return fb.then(feedback => ({\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n dimensions: normalizedQuestion.dimensions,\n customKeys: normalizedQuestion.customKeys || [],\n disabled: env.mode !== 'gather',\n feedback,\n teacherInstructions,\n mathInput: normalizedQuestion.mathInput,\n equationEditor\n }));\n}\n\nexport async function outcome(/*question, session, env*/) {\n return {\n score: 0,\n completed: 'n/a',\n note: 'Requires manual scoring'\n };\n}\n"],"file":"index.js"}
@@ -116,41 +116,6 @@
116
116
  "type": "string",
117
117
  "title": "toolbarEditorPosition"
118
118
  },
119
- "predefinedAnnotations": {
120
- "description": "Indicates the predefined annotations for the annotation menu",
121
- "type": "array",
122
- "items": {
123
- "title": "PredefinedAnnotation",
124
- "type": "object",
125
- "properties": {
126
- "label": {
127
- "description": "Indicates the value displayed in the annotation button",
128
- "type": "string",
129
- "title": "label"
130
- },
131
- "text": {
132
- "description": "Indicates the annotation value",
133
- "type": "string",
134
- "title": "text"
135
- },
136
- "type": {
137
- "description": "Indicates the type of the annotation",
138
- "enum": [
139
- "negative",
140
- "positive"
141
- ],
142
- "type": "string",
143
- "title": "type"
144
- }
145
- },
146
- "required": [
147
- "label",
148
- "text",
149
- "type"
150
- ]
151
- },
152
- "title": "predefinedAnnotations"
153
- },
154
119
  "id": {
155
120
  "description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
156
121
  "type": "string",
@@ -247,36 +212,6 @@
247
212
  "required": [
248
213
  "type"
249
214
  ]
250
- },
251
- "PredefinedAnnotation": {
252
- "title": "PredefinedAnnotation",
253
- "type": "object",
254
- "properties": {
255
- "label": {
256
- "description": "Indicates the value displayed in the annotation button",
257
- "type": "string",
258
- "title": "label"
259
- },
260
- "text": {
261
- "description": "Indicates the annotation value",
262
- "type": "string",
263
- "title": "text"
264
- },
265
- "type": {
266
- "description": "Indicates the type of the annotation",
267
- "enum": [
268
- "negative",
269
- "positive"
270
- ],
271
- "type": "string",
272
- "title": "type"
273
- }
274
- },
275
- "required": [
276
- "label",
277
- "text",
278
- "type"
279
- ]
280
215
  }
281
216
  },
282
217
  "$schema": "http://json-schema.org/draft-07/schema#"
@@ -95,31 +95,6 @@ This element must be one of the following enum values:
95
95
  * `bottom`
96
96
  * `top`
97
97
 
98
- # `predefinedAnnotations` (array)
99
-
100
- Indicates the predefined annotations for the annotation menu
101
-
102
- The object is an array with all elements of the type `object`.
103
-
104
- The array object has the following properties:
105
-
106
- ## `label` (string, required)
107
-
108
- Indicates the value displayed in the annotation button
109
-
110
- ## `text` (string, required)
111
-
112
- Indicates the annotation value
113
-
114
- ## `type` (string, enum, required)
115
-
116
- Indicates the type of the annotation
117
-
118
- This element must be one of the following enum values:
119
-
120
- * `negative`
121
- * `positive`
122
-
123
98
  # `id` (string, required)
124
99
 
125
100
  Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
@@ -190,25 +165,4 @@ This element must be one of the following enum values:
190
165
 
191
166
  ### `default` (string)
192
167
 
193
- Indicates the feedback value
194
-
195
- ## `PredefinedAnnotation` (object)
196
-
197
- Properties of the `PredefinedAnnotation` object:
198
-
199
- ### `label` (string, required)
200
-
201
- Indicates the value displayed in the annotation button
202
-
203
- ### `text` (string, required)
204
-
205
- Indicates the annotation value
206
-
207
- ### `type` (string, enum, required)
208
-
209
- Indicates the type of the annotation
210
-
211
- This element must be one of the following enum values:
212
-
213
- * `negative`
214
- * `positive`
168
+ Indicates the feedback value
package/lib/index.js CHANGED
@@ -31,8 +31,6 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
31
31
 
32
32
  var _piePlayerEvents = require("@pie-framework/pie-player-events");
33
33
 
34
- var _mathRendering = require("@pie-lib/math-rendering");
35
-
36
34
  var _debug = _interopRequireDefault(require("debug"));
37
35
 
38
36
  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); }; }
@@ -96,25 +94,10 @@ var RootExtendedTextEntry = /*#__PURE__*/function (_HTMLElement) {
96
94
  this.render();
97
95
  }
98
96
  }, {
99
- key: "valueChange",
100
- value: function valueChange(value) {
97
+ key: "handleChange",
98
+ value: function handleChange(value) {
101
99
  this._session.value = value;
102
100
  this.dispatchEvent(new _piePlayerEvents.SessionChangedEvent(this.tagName.toLowerCase(), isComplete(value)));
103
- this.render();
104
- }
105
- }, {
106
- key: "annotationsChange",
107
- value: function annotationsChange(annotations) {
108
- this._session.annotations = annotations;
109
- this.dispatchEvent(new _piePlayerEvents.SessionChangedEvent(this.tagName.toLowerCase(), true));
110
- this.render();
111
- }
112
- }, {
113
- key: "commentChange",
114
- value: function commentChange(comment) {
115
- this._session.comment = comment;
116
- this.dispatchEvent(new _piePlayerEvents.SessionChangedEvent(this.tagName.toLowerCase(), isComplete(comment)));
117
- this.render();
118
101
  }
119
102
  }, {
120
103
  key: "connectedCallback",
@@ -124,20 +107,14 @@ var RootExtendedTextEntry = /*#__PURE__*/function (_HTMLElement) {
124
107
  }, {
125
108
  key: "render",
126
109
  value: function render() {
127
- var _this2 = this;
128
-
129
110
  if (this._model && this._session) {
130
111
  var elem = /*#__PURE__*/_react["default"].createElement(_main["default"], {
131
112
  model: this._model,
132
113
  session: this._session,
133
- onValueChange: this.valueChange.bind(this),
134
- onAnnotationsChange: this.annotationsChange.bind(this),
135
- onCommentChange: this.commentChange.bind(this)
114
+ onChange: this.handleChange.bind(this)
136
115
  });
137
116
 
138
- _reactDom["default"].render(elem, this, function () {
139
- (0, _mathRendering.renderMath)(_this2);
140
- });
117
+ _reactDom["default"].render(elem, this);
141
118
  }
142
119
  }
143
120
  }]);
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","annotations","comment","elem","React","createElement","Main","model","session","onValueChange","valueChange","bind","onAnnotationsChange","annotationsChange","onCommentChange","commentChange","ReactDOM","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAIA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,6BAAN,CAAZ;AAEA,IAAMC,SAAS,GACb,QAAOC,MAAP,0DAAOA,MAAP,OAAkB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from 'react';\nimport ReactDOM from 'react-dom';\nimport {\n ModelSetEvent,\n SessionChangedEvent\n} from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/math-rendering';\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\n try {\n const document = domParser.parseFromString(value, 'text/html');\n const textContent = document.body.textContent;\n\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\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 valueChange(value) {\n this._session.value = value;\n this.dispatchEvent(\n new SessionChangedEvent(this.tagName.toLowerCase(), isComplete(value))\n );\n\n this.render();\n }\n\n annotationsChange(annotations) {\n this._session.annotations = annotations;\n this.dispatchEvent(\n new SessionChangedEvent(this.tagName.toLowerCase(), true)\n );\n\n this.render();\n }\n\n commentChange(comment) {\n this._session.comment = comment;\n this.dispatchEvent(\n new SessionChangedEvent(this.tagName.toLowerCase(), isComplete(comment))\n );\n\n this.render();\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 onValueChange: this.valueChange.bind(this),\n onAnnotationsChange: this.annotationsChange.bind(this),\n onCommentChange: this.commentChange.bind(this),\n });\n\n ReactDOM.render(elem, this, () => {\n renderMath(this);\n });\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;;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,KAApB,EAA2B;AAChC,MAAMK,EAAE,GAAGN,WAAW,CAACC,KAAD,CAAtB;AACA,MAAMM,GAAG,GAAGD,EAAE,KAAKV,SAAP,IAAoBU,EAAE,CAACE,MAAH,GAAY,CAA5C;AACA,SAAOD,GAAP;AACD;;IAEoBE,qB;;;;;AACnB,mCAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,IAAhB;AAHY;AAIb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKF,MAAL,GAAcE,CAAd;AACA,WAAKC,aAAL,CACE,IAAIC,8BAAJ,CAAkB,KAAKC,OAAL,CAAaC,WAAb,EAAlB,EAA8C,KAA9C,EAAqD,CAAC,CAAC,KAAKN,MAA5D,CADF;AAIA,WAAKO,MAAL;AACD;;;SAED,aAAYC,CAAZ,EAAe;AACb,WAAKP,QAAL,GAAgBO,CAAhB;AACA,WAAKD,MAAL;AACD;;;WAED,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;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;;AAKAC,6BAASZ,MAAT,CAAgBG,IAAhB,EAAsB,IAAtB;AACD;AACF;;;kDA1CgDU,W","sourcesContent":["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"}
package/lib/main.js CHANGED
@@ -41,8 +41,6 @@ var _mathRendering = require("@pie-lib/math-rendering");
41
41
 
42
42
  var _classnames = _interopRequireDefault(require("classnames"));
43
43
 
44
- var _annotationEditor = _interopRequireDefault(require("./annotation/annotation-editor"));
45
-
46
44
  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); }; }
47
45
 
48
46
  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; } }
@@ -79,8 +77,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
79
77
  }
80
78
 
81
79
  _this = _super.call.apply(_super, [this].concat(args));
82
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeSessionValue", (0, _debounce["default"])(_this.props.onValueChange, 1500));
83
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeSessionComment", (0, _debounce["default"])(_this.props.onCommentChange, 1500));
80
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeSession", (0, _debounce["default"])(_this.props.onChange, 1500));
84
81
  return _this;
85
82
  }
86
83
 
@@ -99,23 +96,14 @@ var Main = /*#__PURE__*/function (_React$Component) {
99
96
  var _this$props = this.props,
100
97
  model = _this$props.model,
101
98
  classes = _this$props.classes,
102
- session = _this$props.session,
103
- onAnnotationsChange = _this$props.onAnnotationsChange;
104
- var animationsDisabled = model.animationsDisabled,
105
- annotatorMode = model.annotatorMode,
106
- customKeys = model.customKeys,
107
- dimensions = model.dimensions,
99
+ session = _this$props.session;
100
+ var dimensions = model.dimensions,
108
101
  disabled = model.disabled,
109
- disabledAnnotator = model.disabledAnnotator,
110
- equationEditor = model.equationEditor,
111
102
  feedback = model.feedback,
103
+ teacherInstructions = model.teacherInstructions,
112
104
  mathInput = model.mathInput,
113
- predefinedAnnotations = model.predefinedAnnotations,
114
- prompt = model.prompt,
115
- teacherInstructions = model.teacherInstructions;
116
- var annotations = session.annotations,
117
- comment = session.comment,
118
- value = session.value;
105
+ animationsDisabled = model.animationsDisabled;
106
+ var value = session.value;
119
107
 
120
108
  var _ref = dimensions || {},
121
109
  width = _ref.width,
@@ -142,27 +130,13 @@ var Main = /*#__PURE__*/function (_React$Component) {
142
130
  visible: 'Hide Teacher Instructions'
143
131
  },
144
132
  className: classes.collapsible
145
- }, teacherInstructionsDiv) : teacherInstructionsDiv, /*#__PURE__*/_react["default"].createElement("br", null)), prompt && /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
133
+ }, teacherInstructionsDiv) : teacherInstructionsDiv, /*#__PURE__*/_react["default"].createElement("br", null)), model.prompt && /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
146
134
  className: (0, _classnames["default"])(classes.prompt, 'prompt'),
147
135
  dangerouslySetInnerHTML: {
148
- __html: prompt
136
+ __html: model.prompt
149
137
  }
150
- }), annotatorMode ? /*#__PURE__*/_react["default"].createElement(_annotationEditor["default"], {
151
- text: value || '',
152
- annotations: annotations || [],
153
- comment: comment || '',
154
- predefinedAnnotations: predefinedAnnotations || [],
155
- onChange: onAnnotationsChange,
156
- onCommentChange: this.changeSessionComment,
157
- width: width,
158
- height: height,
159
- maxHeight: maxHeight,
160
- disabled: disabledAnnotator,
161
- disabledMath: !mathInput,
162
- customKeys: customKeys,
163
- keypadMode: equationEditor
164
- }) : /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
165
- onChange: this.changeSessionValue,
138
+ }), /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
139
+ onChange: this.changeSession,
166
140
  markup: value || '',
167
141
  width: width && width.toString(),
168
142
  minHeight: height && height.toString(),
@@ -172,8 +146,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
172
146
  pluginProps: {
173
147
  math: {
174
148
  disabled: !mathInput,
175
- customKeys: customKeys,
176
- keypadMode: equationEditor,
149
+ customKeys: this.props.model.customKeys,
150
+ keypadMode: this.props.model.equationEditor,
177
151
  controlledKeypadMode: false
178
152
  },
179
153
  video: {
@@ -194,15 +168,11 @@ var Main = /*#__PURE__*/function (_React$Component) {
194
168
 
195
169
  exports.Main = Main;
196
170
  (0, _defineProperty2["default"])(Main, "propTypes", {
197
- onValueChange: _propTypes["default"].func.isRequired,
198
- onAnnotationsChange: _propTypes["default"].func.isRequired,
199
- onCommentChange: _propTypes["default"].func.isRequired,
171
+ onChange: _propTypes["default"].func.isRequired,
200
172
  model: _propTypes["default"].object,
201
173
  classes: _propTypes["default"].object.isRequired,
202
174
  session: _propTypes["default"].shape({
203
- value: _propTypes["default"].string,
204
- annotations: _propTypes["default"].array,
205
- comment: _propTypes["default"].string
175
+ value: _propTypes["default"].string
206
176
  }).isRequired
207
177
  });
208
178
 
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","onValueChange","onCommentChange","containerRef","model","classes","session","onAnnotationsChange","animationsDisabled","annotatorMode","customKeys","dimensions","disabled","disabledAnnotator","equationEditor","feedback","mathInput","predefinedAnnotations","teacherInstructions","annotations","comment","value","height","maxHeight","teacherInstructionsDiv","__html","ref","hidden","visible","collapsible","changeSessionComment","changeSessionValue","toString","math","keypadMode","controlledKeypadMode","video","audio","React","Component","PropTypes","func","isRequired","object","shape","string","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;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;;;;;;;;;;;;;;;2GAoBU,0BAAS,MAAKC,KAAL,CAAWC,aAApB,EAAmC,IAAnC,C;6GAEE,0BAAS,MAAKD,KAAL,CAAWE,eAApB,EAAqC,IAArC,C;;;;;;WARvB,8BAAqB;AACnB,UAAI,KAAKC,YAAT,EAAuB;AACrB,uCAAW,KAAKA,YAAhB;AACD;AACF;;;WAMD,kBAAS;AAAA;;AACP,wBAAyD,K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AkBa,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';\nimport classNames from 'classnames';\nimport AnnotationEditor from './annotation/annotation-editor';\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 onValueChange: PropTypes.func.isRequired,\n onAnnotationsChange: PropTypes.func.isRequired,\n onCommentChange: PropTypes.func.isRequired,\n model: PropTypes.object,\n classes: PropTypes.object.isRequired,\n session: PropTypes.shape({\n value: PropTypes.string,\n annotations: PropTypes.array,\n comment: PropTypes.string\n }).isRequired\n };\n\n componentDidUpdate() {\n if (this.containerRef) {\n renderMath(this.containerRef);\n }\n }\n\n changeSessionValue = debounce(this.props.onValueChange, 1500);\n\n changeSessionComment = debounce(this.props.onCommentChange, 1500);\n\n render() {\n const { model, classes, session, onAnnotationsChange } = this.props;\n const {\n animationsDisabled,\n annotatorMode,\n customKeys,\n dimensions,\n disabled,\n disabledAnnotator,\n equationEditor,\n feedback,\n mathInput,\n predefinedAnnotations,\n prompt,\n teacherInstructions\n } = model;\n const { annotations, comment, value } = session;\n const { width, height } = dimensions || {};\n const maxHeight = '40vh';\n log('[render] disabled? ', disabled);\n\n const teacherInstructionsDiv = <div\n className=\"teacher-instructions\"\n dangerouslySetInnerHTML={{ __html: teacherInstructions }}\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 {prompt && (\n <Typography\n className={classNames(classes.prompt, 'prompt')}\n dangerouslySetInnerHTML={{ __html: prompt }}\n />\n )}\n {annotatorMode ? (\n <AnnotationEditor\n text={value || ''}\n annotations={annotations || []}\n comment={comment || ''}\n predefinedAnnotations={predefinedAnnotations || []}\n onChange={onAnnotationsChange}\n onCommentChange={this.changeSessionComment}\n width={width}\n height={height}\n maxHeight={maxHeight}\n disabled={disabledAnnotator}\n disabledMath={!mathInput}\n customKeys={customKeys}\n keypadMode={equationEditor}\n />\n ) : (\n <EditableHTML\n onChange={this.changeSessionValue}\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: customKeys,\n keypadMode: equationEditor,\n controlledKeypadMode: false\n },\n video: {\n disabled: true\n },\n audio: {\n disabled: true\n }\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","containerRef","model","classes","session","dimensions","disabled","feedback","teacherInstructions","mathInput","animationsDisabled","value","height","maxHeight","teacherInstructionsDiv","__html","ref","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;;AACA;;;;;;AAEA,IAA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,EAAE;AACJhB,YAAAA,QAAQ,EAAE,CAACG,SADP;AAEJc,YAAAA,UAAU,EAAE,KAAKxB,KAAL,CAAWG,KAAX,CAAiBqB,UAFzB;AAGJC,YAAAA,UAAU,EAAE,KAAKzB,KAAL,CAAWG,KAAX,CAAiBuB,cAHzB;AAIJC,YAAAA,oBAAoB,EAAE;AAJlB,WADK;AAOXC,UAAAA,KAAK,EAAE;AACLrB,YAAAA,QAAQ,EAAE;AADL,WAPI;AAUVsB,UAAAA,KAAK,EAAE;AACNtB,YAAAA,QAAQ,EAAE;AADJ;AAVG;AARf,QA3BF,EAkDGC,QAAQ,iBACP,0DACE,2CADF,eAEE,gCAAC,kBAAD;AAAU,QAAA,WAAW,EAAC,SAAtB;AAAgC,QAAA,QAAQ,EAAEA;AAA1C,QAFF,CAnDJ,CADF;AA2DD;;;EA1FuBsB,kBAAMC,S;;;iCAAnBhC,I,eACQ;AACjBE,EAAAA,QAAQ,EAAE+B,sBAAUC,IAAV,CAAeC,UADR;AAEjB/B,EAAAA,KAAK,EAAE6B,sBAAUG,MAFA;AAGjB/B,EAAAA,OAAO,EAAE4B,sBAAUG,MAAV,CAAiBD,UAHT;AAIjB7B,EAAAA,OAAO,EAAE2B,sBAAUI,KAAV,CAAgB;AACvBxB,IAAAA,KAAK,EAAEoB,sBAAUK;AADM,GAAhB,EAENH;AANc,C;;eA4FN,wBAAWhD,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';\nimport classNames from 'classnames';\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, animationsDisabled } = model;\n const { value } = session;\n const { width, height } = dimensions || {};\n const maxHeight = '40vh';\n log('[render] disabled? ', disabled);\n\n const teacherInstructionsDiv = <div\n className=\"teacher-instructions\"\n dangerouslySetInnerHTML={{ __html: teacherInstructions }}\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 className={classNames(classes.prompt, '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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/extended-text-entry",
3
- "version": "6.5.4-next.428+16d0c65ce",
3
+ "version": "6.5.4-next.430+ea80a2ace",
4
4
  "description": "",
5
5
  "repository": "pie-framework/pie-elements",
6
6
  "publishConfig": {
@@ -22,7 +22,7 @@
22
22
  "react": "^16.8.1",
23
23
  "react-dom": "^16.8.1"
24
24
  },
25
- "gitHead": "16d0c65cee4c19f26d7045e1794b8115bd4a5fbd",
25
+ "gitHead": "ea80a2ace09b6699a74c8c14ee33caf446a87c60",
26
26
  "scripts": {
27
27
  "postpublish": "../../scripts/postpublish"
28
28
  },