@pie-element/extended-text-entry 6.8.4-annotations.0 → 6.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/LICENSE.md +5 -0
- package/configure/CHANGELOG.md +51 -0
- package/configure/lib/defaults.js +6 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/main.js +11 -5
- package/configure/lib/main.js.map +1 -1
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +16 -0
- package/controller/lib/defaults.js +1 -66
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +3 -8
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/config-schema.json +16 -0
- package/docs/config-schema.json.md +12 -0
- package/docs/demo/generate.js +2 -1
- package/docs/pie-schema.json +7 -66
- package/docs/pie-schema.json.md +5 -47
- package/lib/index.js +4 -27
- package/lib/index.js.map +1 -1
- package/lib/main.js +18 -45
- package/lib/main.js.map +1 -1
- package/module/configure.js +395 -0
- package/module/controller.js +98 -0
- package/module/demo.js +38 -0
- package/module/element.js +277 -0
- package/module/index.html +21 -0
- package/module/manifest.json +18 -0
- package/module/print-demo.js +76 -0
- package/module/print.html +18 -0
- package/module/print.js +242 -0
- package/package.json +5 -5
- package/lib/annotation/annotation-editor.js +0 -703
- 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
package/docs/pie-schema.json
CHANGED
|
@@ -98,6 +98,11 @@
|
|
|
98
98
|
"type": "boolean",
|
|
99
99
|
"title": "rationaleEnabled"
|
|
100
100
|
},
|
|
101
|
+
"spellCheckEnabled": {
|
|
102
|
+
"description": "Indicates if spellcheck is enabled",
|
|
103
|
+
"type": "boolean",
|
|
104
|
+
"title": "spellCheckEnabled"
|
|
105
|
+
},
|
|
101
106
|
"studentInstructionsEnabled": {
|
|
102
107
|
"description": "Indicates if Student Instructions are enabled",
|
|
103
108
|
"type": "boolean",
|
|
@@ -116,41 +121,6 @@
|
|
|
116
121
|
"type": "string",
|
|
117
122
|
"title": "toolbarEditorPosition"
|
|
118
123
|
},
|
|
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
124
|
"playersToolbarPosition": {
|
|
155
125
|
"description": "Indicates the editor's toolbar position for the player, which can be 'bottom' or 'top'",
|
|
156
126
|
"default": ": 'bottom'",
|
|
@@ -178,6 +148,7 @@
|
|
|
178
148
|
"feedbackEnabled",
|
|
179
149
|
"id",
|
|
180
150
|
"rationaleEnabled",
|
|
151
|
+
"spellCheckEnabled",
|
|
181
152
|
"studentInstructionsEnabled",
|
|
182
153
|
"teacherInstructionsEnabled"
|
|
183
154
|
],
|
|
@@ -257,37 +228,7 @@
|
|
|
257
228
|
"required": [
|
|
258
229
|
"type"
|
|
259
230
|
]
|
|
260
|
-
},
|
|
261
|
-
"PredefinedAnnotation": {
|
|
262
|
-
"title": "PredefinedAnnotation",
|
|
263
|
-
"type": "object",
|
|
264
|
-
"properties": {
|
|
265
|
-
"label": {
|
|
266
|
-
"description": "Indicates the value displayed in the annotation button",
|
|
267
|
-
"type": "string",
|
|
268
|
-
"title": "label"
|
|
269
|
-
},
|
|
270
|
-
"text": {
|
|
271
|
-
"description": "Indicates the annotation value",
|
|
272
|
-
"type": "string",
|
|
273
|
-
"title": "text"
|
|
274
|
-
},
|
|
275
|
-
"type": {
|
|
276
|
-
"description": "Indicates the type of the annotation",
|
|
277
|
-
"enum": [
|
|
278
|
-
"negative",
|
|
279
|
-
"positive"
|
|
280
|
-
],
|
|
281
|
-
"type": "string",
|
|
282
|
-
"title": "type"
|
|
283
|
-
}
|
|
284
|
-
},
|
|
285
|
-
"required": [
|
|
286
|
-
"label",
|
|
287
|
-
"text",
|
|
288
|
-
"type"
|
|
289
|
-
]
|
|
290
231
|
}
|
|
291
232
|
},
|
|
292
233
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
293
|
-
}
|
|
234
|
+
}
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -80,6 +80,10 @@ Indicates if Feedback is enabled
|
|
|
80
80
|
|
|
81
81
|
Indicates if Rationale are enabled
|
|
82
82
|
|
|
83
|
+
# `spellCheckEnabled` (boolean, required)
|
|
84
|
+
|
|
85
|
+
Indicates if spellcheck is enabled
|
|
86
|
+
|
|
83
87
|
# `studentInstructionsEnabled` (boolean, required)
|
|
84
88
|
|
|
85
89
|
Indicates if Student Instructions are enabled
|
|
@@ -95,31 +99,6 @@ This element must be one of the following enum values:
|
|
|
95
99
|
* `bottom`
|
|
96
100
|
* `top`
|
|
97
101
|
|
|
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
102
|
# `playersToolbarPosition` (string, enum)
|
|
124
103
|
|
|
125
104
|
Indicates the editor's toolbar position for the player, which can be 'bottom' or 'top'
|
|
@@ -201,25 +180,4 @@ This element must be one of the following enum values:
|
|
|
201
180
|
|
|
202
181
|
### `default` (string)
|
|
203
182
|
|
|
204
|
-
Indicates the feedback value
|
|
205
|
-
|
|
206
|
-
## `PredefinedAnnotation` (object)
|
|
207
|
-
|
|
208
|
-
Properties of the `PredefinedAnnotation` object:
|
|
209
|
-
|
|
210
|
-
### `label` (string, required)
|
|
211
|
-
|
|
212
|
-
Indicates the value displayed in the annotation button
|
|
213
|
-
|
|
214
|
-
### `text` (string, required)
|
|
215
|
-
|
|
216
|
-
Indicates the annotation value
|
|
217
|
-
|
|
218
|
-
### `type` (string, enum, required)
|
|
219
|
-
|
|
220
|
-
Indicates the type of the annotation
|
|
221
|
-
|
|
222
|
-
This element must be one of the following enum values:
|
|
223
|
-
|
|
224
|
-
* `negative`
|
|
225
|
-
* `positive`
|
|
183
|
+
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;AAA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U,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
|
@@ -39,8 +39,6 @@ var _renderUi = require("@pie-lib/render-ui");
|
|
|
39
39
|
|
|
40
40
|
var _mathRendering = require("@pie-lib/math-rendering");
|
|
41
41
|
|
|
42
|
-
var _annotationEditor = _interopRequireDefault(require("./annotation/annotation-editor"));
|
|
43
|
-
|
|
44
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); }; }
|
|
45
43
|
|
|
46
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; } }
|
|
@@ -77,8 +75,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
80
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "
|
|
81
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeSessionComment", (0, _debounce["default"])(_this.props.onCommentChange, 1500));
|
|
78
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeSession", (0, _debounce["default"])(_this.props.onChange, 1500));
|
|
82
79
|
return _this;
|
|
83
80
|
}
|
|
84
81
|
|
|
@@ -97,24 +94,16 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
97
94
|
var _this$props = this.props,
|
|
98
95
|
model = _this$props.model,
|
|
99
96
|
classes = _this$props.classes,
|
|
100
|
-
session = _this$props.session
|
|
101
|
-
|
|
102
|
-
var animationsDisabled = model.animationsDisabled,
|
|
103
|
-
annotatorMode = model.annotatorMode,
|
|
104
|
-
customKeys = model.customKeys,
|
|
105
|
-
dimensions = model.dimensions,
|
|
97
|
+
session = _this$props.session;
|
|
98
|
+
var dimensions = model.dimensions,
|
|
106
99
|
disabled = model.disabled,
|
|
107
|
-
disabledAnnotator = model.disabledAnnotator,
|
|
108
|
-
equationEditor = model.equationEditor,
|
|
109
100
|
feedback = model.feedback,
|
|
110
|
-
mathInput = model.mathInput,
|
|
111
|
-
predefinedAnnotations = model.predefinedAnnotations,
|
|
112
|
-
prompt = model.prompt,
|
|
113
101
|
teacherInstructions = model.teacherInstructions,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
102
|
+
mathInput = model.mathInput,
|
|
103
|
+
animationsDisabled = model.animationsDisabled,
|
|
104
|
+
playersToolbarPosition = model.playersToolbarPosition,
|
|
105
|
+
spellCheckEnabled = model.spellCheckEnabled;
|
|
106
|
+
var value = session.value;
|
|
118
107
|
|
|
119
108
|
var _ref = dimensions || {},
|
|
120
109
|
width = _ref.width,
|
|
@@ -122,6 +111,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
122
111
|
|
|
123
112
|
var maxHeight = '40vh';
|
|
124
113
|
var toolbarOpts = {};
|
|
114
|
+
console.log(spellCheckEnabled, "spellcheck");
|
|
125
115
|
log('[render] disabled? ', disabled);
|
|
126
116
|
|
|
127
117
|
var teacherInstructionsDiv = /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
@@ -150,28 +140,14 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
150
140
|
visible: 'Hide Teacher Instructions'
|
|
151
141
|
},
|
|
152
142
|
className: classes.collapsible
|
|
153
|
-
}, teacherInstructionsDiv) : teacherInstructionsDiv, /*#__PURE__*/_react["default"].createElement("br", null)), prompt && /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
143
|
+
}, teacherInstructionsDiv) : teacherInstructionsDiv, /*#__PURE__*/_react["default"].createElement("br", null)), model.prompt && /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
154
144
|
className: classes.prompt
|
|
155
145
|
}, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
156
146
|
defaultClassName: "prompt",
|
|
157
|
-
prompt: prompt
|
|
158
|
-
})),
|
|
159
|
-
text: value || '',
|
|
160
|
-
annotations: annotations || [],
|
|
161
|
-
comment: comment || '',
|
|
162
|
-
predefinedAnnotations: predefinedAnnotations || [],
|
|
163
|
-
onChange: onAnnotationsChange,
|
|
164
|
-
onCommentChange: this.changeSessionComment,
|
|
165
|
-
width: width,
|
|
166
|
-
height: height,
|
|
167
|
-
maxHeight: maxHeight,
|
|
168
|
-
disabled: disabledAnnotator,
|
|
169
|
-
disabledMath: !mathInput,
|
|
170
|
-
customKeys: customKeys,
|
|
171
|
-
keypadMode: equationEditor
|
|
172
|
-
}) : /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
147
|
+
prompt: model.prompt
|
|
148
|
+
})), /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
173
149
|
className: "response-area-editor",
|
|
174
|
-
onChange: this.
|
|
150
|
+
onChange: this.changeSession,
|
|
175
151
|
markup: value || '',
|
|
176
152
|
width: width && width.toString(),
|
|
177
153
|
minHeight: height && height.toString(),
|
|
@@ -179,11 +155,12 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
179
155
|
disabled: disabled,
|
|
180
156
|
highlightShape: true,
|
|
181
157
|
toolbarOpts: toolbarOpts,
|
|
158
|
+
spellCheck: spellCheckEnabled,
|
|
182
159
|
pluginProps: {
|
|
183
160
|
math: {
|
|
184
161
|
disabled: !mathInput,
|
|
185
|
-
customKeys: customKeys,
|
|
186
|
-
keypadMode: equationEditor,
|
|
162
|
+
customKeys: this.props.model.customKeys,
|
|
163
|
+
keypadMode: this.props.model.equationEditor,
|
|
187
164
|
controlledKeypadMode: false
|
|
188
165
|
},
|
|
189
166
|
video: {
|
|
@@ -204,15 +181,11 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
204
181
|
|
|
205
182
|
exports.Main = Main;
|
|
206
183
|
(0, _defineProperty2["default"])(Main, "propTypes", {
|
|
207
|
-
|
|
208
|
-
onAnnotationsChange: _propTypes["default"].func.isRequired,
|
|
209
|
-
onCommentChange: _propTypes["default"].func.isRequired,
|
|
184
|
+
onChange: _propTypes["default"].func.isRequired,
|
|
210
185
|
model: _propTypes["default"].object,
|
|
211
186
|
classes: _propTypes["default"].object.isRequired,
|
|
212
187
|
session: _propTypes["default"].shape({
|
|
213
|
-
value: _propTypes["default"].string
|
|
214
|
-
annotations: _propTypes["default"].array,
|
|
215
|
-
comment: _propTypes["default"].string
|
|
188
|
+
value: _propTypes["default"].string
|
|
216
189
|
}).isRequired
|
|
217
190
|
});
|
|
218
191
|
|
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","playersToolbarPosition","spellCheckEnabled","value","height","maxHeight","toolbarOpts","console","teacherInstructionsDiv","position","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;;;;;;AAEA,IAAMA,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,KAAK,EAAEsB,sBAAUK;AADM,GAAhB,EAENH;AANc,C;;eA0GN,wBAAWpD,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 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, playersToolbarPosition, spellCheckEnabled } = model;\n const { value } = session;\n const { width, height } = dimensions || {};\n const maxHeight = '40vh';\n const toolbarOpts = {};\n\n console.log(spellCheckEnabled, \"spellcheck\")\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 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={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 />\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"}
|