@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.
- package/controller/lib/defaults.js +1 -66
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +15 -25
- package/controller/lib/index.js.map +1 -1
- package/docs/pie-schema.json +0 -65
- package/docs/pie-schema.json.md +1 -47
- package/lib/index.js +4 -27
- package/lib/index.js.map +1 -1
- package/lib/main.js +14 -44
- package/lib/main.js.map +1 -1
- package/package.json +2 -2
- package/lib/annotation/annotation-editor.js +0 -702
- package/lib/annotation/annotation-editor.js.map +0 -1
- package/lib/annotation/annotation-menu.js +0 -205
- package/lib/annotation/annotation-menu.js.map +0 -1
- package/lib/annotation/annotation-utils.js +0 -249
- package/lib/annotation/annotation-utils.js.map +0 -1
- package/lib/annotation/freeform-editor.js +0 -265
- package/lib/annotation/freeform-editor.js.map +0 -1
|
@@ -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"
|
|
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"}
|
package/controller/lib/index.js
CHANGED
|
@@ -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
|
|
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' ?
|
|
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
|
|
96
|
+
case 9:
|
|
101
97
|
equationEditor = 1;
|
|
102
|
-
return _context2.abrupt("break",
|
|
98
|
+
return _context2.abrupt("break", 18);
|
|
103
99
|
|
|
104
|
-
case
|
|
100
|
+
case 11:
|
|
105
101
|
equationEditor = 3;
|
|
106
|
-
return _context2.abrupt("break",
|
|
102
|
+
return _context2.abrupt("break", 18);
|
|
107
103
|
|
|
108
|
-
case
|
|
104
|
+
case 13:
|
|
109
105
|
equationEditor = 6;
|
|
110
|
-
return _context2.abrupt("break",
|
|
106
|
+
return _context2.abrupt("break", 18);
|
|
111
107
|
|
|
112
|
-
case
|
|
108
|
+
case 15:
|
|
113
109
|
equationEditor = 8;
|
|
114
|
-
return _context2.abrupt("break",
|
|
110
|
+
return _context2.abrupt("break", 18);
|
|
115
111
|
|
|
116
|
-
case
|
|
117
|
-
return _context2.abrupt("break",
|
|
112
|
+
case 17:
|
|
113
|
+
return _context2.abrupt("break", 18);
|
|
118
114
|
|
|
119
|
-
case
|
|
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
|
|
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","
|
|
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,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;AACMQ,YAAAA,kBAFD,GAEsBT,SAAS,CAACC,QAAD,CAF/B;AAICS,YAAAA,EAJD,GAKHF,GAAG,CAACG,IAAJ,KAAa,UAAb,IAA2BF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AL0B;AAM1BI,gBAAAA,mBAAmB,EAAnBA,mBAN0B;AAO1BQ,gBAAAA,SAAS,EAAEf,kBAAkB,CAACe,SAPJ;AAQ1BN,gBAAAA,cAAc,EAAdA;AAR0B,eAAL;AAAA,aAAhB,CAnCF;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;SA+CeO,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 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"}
|
package/docs/pie-schema.json
CHANGED
|
@@ -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#"
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -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: "
|
|
100
|
-
value: function
|
|
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
|
-
|
|
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
|
|
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","
|
|
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,GAJ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AL,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), "
|
|
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
|
-
|
|
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
|
-
|
|
114
|
-
|
|
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
|
-
}),
|
|
151
|
-
|
|
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
|
-
|
|
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","
|
|
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,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;;AACP,wBAAoC,KAAKF,KAAzC;AAAA,UAAQG,KAAR,eAAQA,KAAR;AAAA,UAAeC,OAAf,eAAeA,OAAf;AAAA,UAAwBC,OAAxB,eAAwBA,OAAxB;AACA,UAAQC,UAAR,GAA+FH,KAA/F,CAAQG,UAAR;AAAA,UAAoBC,QAApB,GAA+FJ,KAA/F,CA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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.
|
|
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": "
|
|
25
|
+
"gitHead": "ea80a2ace09b6699a74c8c14ee33caf446a87c60",
|
|
26
26
|
"scripts": {
|
|
27
27
|
"postpublish": "../../scripts/postpublish"
|
|
28
28
|
},
|