@pie-element/extended-text-entry 6.8.4-annotations.1 → 6.8.6
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 +69 -0
- package/LICENSE.md +5 -0
- package/configure/CHANGELOG.md +59 -0
- package/configure/lib/defaults.js +12 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +2 -2
- package/configure/lib/main.js +16 -7
- package/configure/lib/main.js.map +1 -1
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +24 -0
- package/controller/lib/defaults.js +1 -66
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +11 -13
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/config-schema.json +32 -0
- package/docs/config-schema.json.md +24 -0
- package/docs/demo/generate.js +2 -1
- package/docs/pie-schema.json +13 -66
- package/docs/pie-schema.json.md +9 -47
- package/lib/index.js +6 -29
- package/lib/index.js.map +1 -1
- package/lib/main.js +18 -45
- package/lib/main.js.map +1 -1
- package/lib/print.js +2 -2
- package/module/configure.js +402 -0
- package/module/controller.js +99 -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 -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
package/docs/config-schema.json
CHANGED
|
@@ -88,6 +88,38 @@
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
|
+
"spellCheck": {
|
|
92
|
+
"title": "ConfigureProp",
|
|
93
|
+
"type": "object",
|
|
94
|
+
"properties": {
|
|
95
|
+
"settings": {
|
|
96
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
97
|
+
"type": "boolean",
|
|
98
|
+
"title": "settings"
|
|
99
|
+
},
|
|
100
|
+
"label": {
|
|
101
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
102
|
+
"type": "string",
|
|
103
|
+
"title": "label"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"playerSpellCheck": {
|
|
108
|
+
"title": "ConfigureProp",
|
|
109
|
+
"type": "object",
|
|
110
|
+
"properties": {
|
|
111
|
+
"settings": {
|
|
112
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
113
|
+
"type": "boolean",
|
|
114
|
+
"title": "settings"
|
|
115
|
+
},
|
|
116
|
+
"label": {
|
|
117
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
118
|
+
"type": "string",
|
|
119
|
+
"title": "label"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
91
123
|
"dimensions": {
|
|
92
124
|
"title": "ConfigureProp",
|
|
93
125
|
"type": "object",
|
|
@@ -67,6 +67,30 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
67
67
|
|
|
68
68
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
69
69
|
|
|
70
|
+
# `spellCheck` (object)
|
|
71
|
+
|
|
72
|
+
Properties of the `spellCheck` object:
|
|
73
|
+
|
|
74
|
+
## `settings` (boolean)
|
|
75
|
+
|
|
76
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
77
|
+
|
|
78
|
+
## `label` (string)
|
|
79
|
+
|
|
80
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
81
|
+
|
|
82
|
+
# `playerSpellCheck` (object)
|
|
83
|
+
|
|
84
|
+
Properties of the `playerSpellCheck` object:
|
|
85
|
+
|
|
86
|
+
## `settings` (boolean)
|
|
87
|
+
|
|
88
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
89
|
+
|
|
90
|
+
## `label` (string)
|
|
91
|
+
|
|
92
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
93
|
+
|
|
70
94
|
# `dimensions` (object)
|
|
71
95
|
|
|
72
96
|
Properties of the `dimensions` object:
|
package/docs/demo/generate.js
CHANGED
package/docs/pie-schema.json
CHANGED
|
@@ -98,6 +98,16 @@
|
|
|
98
98
|
"type": "boolean",
|
|
99
99
|
"title": "rationaleEnabled"
|
|
100
100
|
},
|
|
101
|
+
"spellCheckEnabled": {
|
|
102
|
+
"description": "Indicates if spellcheck is enabled for the author. Default value is true",
|
|
103
|
+
"type": "boolean",
|
|
104
|
+
"title": "spellCheckEnabled"
|
|
105
|
+
},
|
|
106
|
+
"playerSpellCheckEnabled": {
|
|
107
|
+
"description": "Indicates if spellcheck is enabled for the player. Default value is true",
|
|
108
|
+
"type": "boolean",
|
|
109
|
+
"title": "playerSpellCheckEnabled"
|
|
110
|
+
},
|
|
101
111
|
"studentInstructionsEnabled": {
|
|
102
112
|
"description": "Indicates if Student Instructions are enabled",
|
|
103
113
|
"type": "boolean",
|
|
@@ -116,41 +126,6 @@
|
|
|
116
126
|
"type": "string",
|
|
117
127
|
"title": "toolbarEditorPosition"
|
|
118
128
|
},
|
|
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
129
|
"playersToolbarPosition": {
|
|
155
130
|
"description": "Indicates the editor's toolbar position for the player, which can be 'bottom' or 'top'",
|
|
156
131
|
"default": ": 'bottom'",
|
|
@@ -177,7 +152,9 @@
|
|
|
177
152
|
"element",
|
|
178
153
|
"feedbackEnabled",
|
|
179
154
|
"id",
|
|
155
|
+
"playerSpellCheckEnabled",
|
|
180
156
|
"rationaleEnabled",
|
|
157
|
+
"spellCheckEnabled",
|
|
181
158
|
"studentInstructionsEnabled",
|
|
182
159
|
"teacherInstructionsEnabled"
|
|
183
160
|
],
|
|
@@ -257,37 +234,7 @@
|
|
|
257
234
|
"required": [
|
|
258
235
|
"type"
|
|
259
236
|
]
|
|
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
237
|
}
|
|
291
238
|
},
|
|
292
239
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
293
|
-
}
|
|
240
|
+
}
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -80,6 +80,14 @@ 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 for the author. Default value is true
|
|
86
|
+
|
|
87
|
+
# `playerSpellCheckEnabled` (boolean, required)
|
|
88
|
+
|
|
89
|
+
Indicates if spellcheck is enabled for the player. Default value is true
|
|
90
|
+
|
|
83
91
|
# `studentInstructionsEnabled` (boolean, required)
|
|
84
92
|
|
|
85
93
|
Indicates if Student Instructions are enabled
|
|
@@ -95,31 +103,6 @@ This element must be one of the following enum values:
|
|
|
95
103
|
* `bottom`
|
|
96
104
|
* `top`
|
|
97
105
|
|
|
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
106
|
# `playersToolbarPosition` (string, enum)
|
|
124
107
|
|
|
125
108
|
Indicates the editor's toolbar position for the player, which can be 'bottom' or 'top'
|
|
@@ -201,25 +184,4 @@ This element must be one of the following enum values:
|
|
|
201
184
|
|
|
202
185
|
### `default` (string)
|
|
203
186
|
|
|
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`
|
|
187
|
+
Indicates the feedback value
|
package/lib/index.js
CHANGED
|
@@ -5,9 +5,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.textContent = textContent;
|
|
9
|
-
exports.isComplete = isComplete;
|
|
10
8
|
exports["default"] = void 0;
|
|
9
|
+
exports.isComplete = isComplete;
|
|
10
|
+
exports.textContent = textContent;
|
|
11
11
|
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
13
|
|
|
@@ -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;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AKC,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,
|
|
@@ -150,28 +139,15 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
150
139
|
visible: 'Hide Teacher Instructions'
|
|
151
140
|
},
|
|
152
141
|
className: classes.collapsible
|
|
153
|
-
}, teacherInstructionsDiv) : teacherInstructionsDiv, /*#__PURE__*/_react["default"].createElement("br", null)), prompt && /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
142
|
+
}, teacherInstructionsDiv) : teacherInstructionsDiv, /*#__PURE__*/_react["default"].createElement("br", null)), model.prompt && /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
143
|
+
component: 'span',
|
|
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","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,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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Xa,UAAAA,IAAI,EAAE;AACJnB,YAAAA,QAAQ,EAAE,CAACG,SADP;AAEJiB,YAAAA,UAAU,EAAE,KAAK3B,KAAL,CAAWG,KAAX,CAAiBwB,UAFzB;AAGJC,YAAAA,UAAU,EAAE,KAAK5B,KAAL,CAAWG,KAAX,CAAiB0B,cAHzB;AAIJC,YAAAA,oBAAoB,EAAE;AAJlB,WADK;AAOXC,UAAAA,KAAK,EAAE;AACLxB,YAAAA,QAAQ,EAAE;AADL,WAPI;AAUVyB,UAAAA,KAAK,EAAE;AACNzB,YAAAA,QAAQ,EAAE;AADJ;AAVG;AAXf,QA7BF,EAuDGC,QAAQ,iBACP,0DACE,2CADF,eAEE,gCAAC,kBAAD;AAAU,QAAA,WAAW,EAAC,SAAtB;AAAgC,QAAA,QAAQ,EAAEA;AAA1C,QAFF,CAxDJ,CADF;AAgED;;;EAvGuByB,kBAAMC,S;;;iCAAnBnC,I,eACQ;AACjBE,EAAAA,QAAQ,EAAEkC,sBAAUC,IAAV,CAAeC,UADR;AAEjBlC,EAAAA,KAAK,EAAEgC,sBAAUG,MAFA;AAGjBlC,EAAAA,OAAO,EAAE+B,sBAAUG,MAAV,CAAiBD,UAHT;AAIjBhC,EAAAA,OAAO,EAAE8B,sBAAUI,KAAV,CAAgB;AACvBzB,IAAAA,KAAK,EAAEqB,sBAAUK;AADM,GAAhB,EAENH;AANc,C;;eAyGN,wBAAWnD,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 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 component={'span'}\n className={classes.prompt}\n >\n <PreviewPrompt defaultClassName=\"prompt\" prompt={model.prompt} />\n </Typography>\n )}\n <EditableHTML\n className=\"response-area-editor\"\n onChange={this.changeSession}\n markup={value || ''}\n width={width && width.toString()}\n minHeight={height && height.toString()}\n maxHeight={maxHeight}\n disabled={disabled}\n highlightShape={true}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n pluginProps={{\n math: {\n disabled: !mathInput,\n customKeys: this.props.model.customKeys,\n keypadMode: this.props.model.equationEditor,\n controlledKeypadMode: false\n },\n video: {\n disabled: true\n },\n audio: {\n disabled: true\n }\n }}\n />\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/lib/print.js
CHANGED
|
@@ -39,9 +39,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
39
39
|
|
|
40
40
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
41
41
|
|
|
42
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
42
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
43
43
|
|
|
44
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
44
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
45
45
|
|
|
46
46
|
var log = (0, _debug["default"])('pie-element:extended-text-entry:print');
|
|
47
47
|
|