@pie-element/image-cloze-association 3.6.2 → 3.6.3-next.1008
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 +176 -0
- package/configure/CHANGELOG.md +117 -0
- package/configure/lib/defaults.js +11 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +3 -3
- package/configure/lib/root.js +20 -7
- package/configure/lib/root.js.map +1 -1
- package/configure/package.json +2 -2
- package/configure/src/defaults.js +12 -1
- package/configure/src/root.jsx +34 -21
- package/controller/CHANGELOG.md +30 -0
- package/controller/lib/index.js +4 -3
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js +3 -3
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +1 -1
- package/controller/src/utils.js +1 -2
- package/docs/config-schema.json +79 -0
- package/docs/config-schema.json.md +61 -1
- package/docs/pie-schema.json +28 -1
- package/docs/pie-schema.json.md +20 -0
- package/lib/image-container.js +7 -3
- package/lib/image-container.js.map +1 -1
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/interactive-section.js +1 -1
- package/lib/interactive-section.js.map +1 -1
- package/lib/possible-response.js +11 -4
- package/lib/possible-response.js.map +1 -1
- package/lib/root.js +63 -14
- package/lib/root.js.map +1 -1
- package/lib/utils-correctness.js +31 -3
- package/lib/utils-correctness.js.map +1 -1
- package/package.json +6 -4
- package/src/__tests__/__snapshots__/root.test.jsx.snap +6 -0
- package/src/index.js +5 -0
- package/src/possible-response.jsx +12 -3
- package/src/root.jsx +78 -29
- package/src/utils-correctness.js +22 -0
- package/module/configure.js +0 -529
- package/module/controller.js +0 -18992
- package/module/demo.js +0 -93
- package/module/element.js +0 -1021
- package/module/index.html +0 -16
- package/module/manifest.json +0 -10
package/module/configure.js
DELETED
|
@@ -1,529 +0,0 @@
|
|
|
1
|
-
import {_dll_pie_lib__config_ui, _dll_pie_lib__editable_html, _dll_pie_framework__pie_configure_events} from "../../shared-config@^1.8.13/module/index.js";
|
|
2
|
-
import {_dll_material_ui__core_styles, _dll_react, _dll_prop_types, _dll_react_dom} from "../../../@pie-ui/shared-lib@^4.3.3/module/index.js";
|
|
3
|
-
function createCommonjsModule(fn, module) {
|
|
4
|
-
return (module = {
|
|
5
|
-
exports: {}
|
|
6
|
-
}, fn(module, module.exports), module.exports);
|
|
7
|
-
}
|
|
8
|
-
var s = 1000;
|
|
9
|
-
var m = s * 60;
|
|
10
|
-
var h = m * 60;
|
|
11
|
-
var d = h * 24;
|
|
12
|
-
var w = d * 7;
|
|
13
|
-
var y = d * 365.25;
|
|
14
|
-
var ms = function (val, options) {
|
|
15
|
-
options = options || ({});
|
|
16
|
-
var type = typeof val;
|
|
17
|
-
if (type === 'string' && val.length > 0) {
|
|
18
|
-
return parse(val);
|
|
19
|
-
} else if (type === 'number' && isFinite(val)) {
|
|
20
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
21
|
-
}
|
|
22
|
-
throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
|
|
23
|
-
};
|
|
24
|
-
function parse(str) {
|
|
25
|
-
str = String(str);
|
|
26
|
-
if (str.length > 100) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
var match = (/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i).exec(str);
|
|
30
|
-
if (!match) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
var n = parseFloat(match[1]);
|
|
34
|
-
var type = (match[2] || 'ms').toLowerCase();
|
|
35
|
-
switch (type) {
|
|
36
|
-
case 'years':
|
|
37
|
-
case 'year':
|
|
38
|
-
case 'yrs':
|
|
39
|
-
case 'yr':
|
|
40
|
-
case 'y':
|
|
41
|
-
return n * y;
|
|
42
|
-
case 'weeks':
|
|
43
|
-
case 'week':
|
|
44
|
-
case 'w':
|
|
45
|
-
return n * w;
|
|
46
|
-
case 'days':
|
|
47
|
-
case 'day':
|
|
48
|
-
case 'd':
|
|
49
|
-
return n * d;
|
|
50
|
-
case 'hours':
|
|
51
|
-
case 'hour':
|
|
52
|
-
case 'hrs':
|
|
53
|
-
case 'hr':
|
|
54
|
-
case 'h':
|
|
55
|
-
return n * h;
|
|
56
|
-
case 'minutes':
|
|
57
|
-
case 'minute':
|
|
58
|
-
case 'mins':
|
|
59
|
-
case 'min':
|
|
60
|
-
case 'm':
|
|
61
|
-
return n * m;
|
|
62
|
-
case 'seconds':
|
|
63
|
-
case 'second':
|
|
64
|
-
case 'secs':
|
|
65
|
-
case 'sec':
|
|
66
|
-
case 's':
|
|
67
|
-
return n * s;
|
|
68
|
-
case 'milliseconds':
|
|
69
|
-
case 'millisecond':
|
|
70
|
-
case 'msecs':
|
|
71
|
-
case 'msec':
|
|
72
|
-
case 'ms':
|
|
73
|
-
return n;
|
|
74
|
-
default:
|
|
75
|
-
return undefined;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
function fmtShort(ms) {
|
|
79
|
-
var msAbs = Math.abs(ms);
|
|
80
|
-
if (msAbs >= d) {
|
|
81
|
-
return Math.round(ms / d) + 'd';
|
|
82
|
-
}
|
|
83
|
-
if (msAbs >= h) {
|
|
84
|
-
return Math.round(ms / h) + 'h';
|
|
85
|
-
}
|
|
86
|
-
if (msAbs >= m) {
|
|
87
|
-
return Math.round(ms / m) + 'm';
|
|
88
|
-
}
|
|
89
|
-
if (msAbs >= s) {
|
|
90
|
-
return Math.round(ms / s) + 's';
|
|
91
|
-
}
|
|
92
|
-
return ms + 'ms';
|
|
93
|
-
}
|
|
94
|
-
function fmtLong(ms) {
|
|
95
|
-
var msAbs = Math.abs(ms);
|
|
96
|
-
if (msAbs >= d) {
|
|
97
|
-
return plural(ms, msAbs, d, 'day');
|
|
98
|
-
}
|
|
99
|
-
if (msAbs >= h) {
|
|
100
|
-
return plural(ms, msAbs, h, 'hour');
|
|
101
|
-
}
|
|
102
|
-
if (msAbs >= m) {
|
|
103
|
-
return plural(ms, msAbs, m, 'minute');
|
|
104
|
-
}
|
|
105
|
-
if (msAbs >= s) {
|
|
106
|
-
return plural(ms, msAbs, s, 'second');
|
|
107
|
-
}
|
|
108
|
-
return ms + ' ms';
|
|
109
|
-
}
|
|
110
|
-
function plural(ms, msAbs, n, name) {
|
|
111
|
-
var isPlural = msAbs >= n * 1.5;
|
|
112
|
-
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
113
|
-
}
|
|
114
|
-
function setup(env) {
|
|
115
|
-
createDebug.debug = createDebug;
|
|
116
|
-
createDebug.default = createDebug;
|
|
117
|
-
createDebug.coerce = coerce;
|
|
118
|
-
createDebug.disable = disable;
|
|
119
|
-
createDebug.enable = enable;
|
|
120
|
-
createDebug.enabled = enabled;
|
|
121
|
-
createDebug.humanize = ms;
|
|
122
|
-
Object.keys(env).forEach(function (key) {
|
|
123
|
-
createDebug[key] = env[key];
|
|
124
|
-
});
|
|
125
|
-
createDebug.instances = [];
|
|
126
|
-
createDebug.names = [];
|
|
127
|
-
createDebug.skips = [];
|
|
128
|
-
createDebug.formatters = {};
|
|
129
|
-
function selectColor(namespace) {
|
|
130
|
-
var hash = 0;
|
|
131
|
-
for (var i = 0; i < namespace.length; i++) {
|
|
132
|
-
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
133
|
-
hash |= 0;
|
|
134
|
-
}
|
|
135
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
136
|
-
}
|
|
137
|
-
createDebug.selectColor = selectColor;
|
|
138
|
-
function createDebug(namespace) {
|
|
139
|
-
var prevTime;
|
|
140
|
-
function debug() {
|
|
141
|
-
if (!debug.enabled) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
145
|
-
args[_key] = arguments[_key];
|
|
146
|
-
}
|
|
147
|
-
var self = debug;
|
|
148
|
-
var curr = Number(new Date());
|
|
149
|
-
var ms = curr - (prevTime || curr);
|
|
150
|
-
self.diff = ms;
|
|
151
|
-
self.prev = prevTime;
|
|
152
|
-
self.curr = curr;
|
|
153
|
-
prevTime = curr;
|
|
154
|
-
args[0] = createDebug.coerce(args[0]);
|
|
155
|
-
if (typeof args[0] !== 'string') {
|
|
156
|
-
args.unshift('%O');
|
|
157
|
-
}
|
|
158
|
-
var index = 0;
|
|
159
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
|
|
160
|
-
if (match === '%%') {
|
|
161
|
-
return match;
|
|
162
|
-
}
|
|
163
|
-
index++;
|
|
164
|
-
var formatter = createDebug.formatters[format];
|
|
165
|
-
if (typeof formatter === 'function') {
|
|
166
|
-
var val = args[index];
|
|
167
|
-
match = formatter.call(self, val);
|
|
168
|
-
args.splice(index, 1);
|
|
169
|
-
index--;
|
|
170
|
-
}
|
|
171
|
-
return match;
|
|
172
|
-
});
|
|
173
|
-
createDebug.formatArgs.call(self, args);
|
|
174
|
-
var logFn = self.log || createDebug.log;
|
|
175
|
-
logFn.apply(self, args);
|
|
176
|
-
}
|
|
177
|
-
debug.namespace = namespace;
|
|
178
|
-
debug.enabled = createDebug.enabled(namespace);
|
|
179
|
-
debug.useColors = createDebug.useColors();
|
|
180
|
-
debug.color = selectColor(namespace);
|
|
181
|
-
debug.destroy = destroy;
|
|
182
|
-
debug.extend = extend;
|
|
183
|
-
if (typeof createDebug.init === 'function') {
|
|
184
|
-
createDebug.init(debug);
|
|
185
|
-
}
|
|
186
|
-
createDebug.instances.push(debug);
|
|
187
|
-
return debug;
|
|
188
|
-
}
|
|
189
|
-
function destroy() {
|
|
190
|
-
var index = createDebug.instances.indexOf(this);
|
|
191
|
-
if (index !== -1) {
|
|
192
|
-
createDebug.instances.splice(index, 1);
|
|
193
|
-
return true;
|
|
194
|
-
}
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
197
|
-
function extend(namespace, delimiter) {
|
|
198
|
-
return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
199
|
-
}
|
|
200
|
-
function enable(namespaces) {
|
|
201
|
-
createDebug.save(namespaces);
|
|
202
|
-
createDebug.names = [];
|
|
203
|
-
createDebug.skips = [];
|
|
204
|
-
var i;
|
|
205
|
-
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
206
|
-
var len = split.length;
|
|
207
|
-
for (i = 0; i < len; i++) {
|
|
208
|
-
if (!split[i]) {
|
|
209
|
-
continue;
|
|
210
|
-
}
|
|
211
|
-
namespaces = split[i].replace(/\*/g, '.*?');
|
|
212
|
-
if (namespaces[0] === '-') {
|
|
213
|
-
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
|
214
|
-
} else {
|
|
215
|
-
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
for (i = 0; i < createDebug.instances.length; i++) {
|
|
219
|
-
var instance = createDebug.instances[i];
|
|
220
|
-
instance.enabled = createDebug.enabled(instance.namespace);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
function disable() {
|
|
224
|
-
createDebug.enable('');
|
|
225
|
-
}
|
|
226
|
-
function enabled(name) {
|
|
227
|
-
if (name[name.length - 1] === '*') {
|
|
228
|
-
return true;
|
|
229
|
-
}
|
|
230
|
-
var i;
|
|
231
|
-
var len;
|
|
232
|
-
for ((i = 0, len = createDebug.skips.length); i < len; i++) {
|
|
233
|
-
if (createDebug.skips[i].test(name)) {
|
|
234
|
-
return false;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
for ((i = 0, len = createDebug.names.length); i < len; i++) {
|
|
238
|
-
if (createDebug.names[i].test(name)) {
|
|
239
|
-
return true;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
return false;
|
|
243
|
-
}
|
|
244
|
-
function coerce(val) {
|
|
245
|
-
if (val instanceof Error) {
|
|
246
|
-
return val.stack || val.message;
|
|
247
|
-
}
|
|
248
|
-
return val;
|
|
249
|
-
}
|
|
250
|
-
createDebug.enable(createDebug.load());
|
|
251
|
-
return createDebug;
|
|
252
|
-
}
|
|
253
|
-
var common = setup;
|
|
254
|
-
var browser = createCommonjsModule(function (module, exports) {
|
|
255
|
-
function _typeof(obj) {
|
|
256
|
-
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
257
|
-
_typeof = function _typeof(obj) {
|
|
258
|
-
return typeof obj;
|
|
259
|
-
};
|
|
260
|
-
} else {
|
|
261
|
-
_typeof = function _typeof(obj) {
|
|
262
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
return _typeof(obj);
|
|
266
|
-
}
|
|
267
|
-
exports.log = log;
|
|
268
|
-
exports.formatArgs = formatArgs;
|
|
269
|
-
exports.save = save;
|
|
270
|
-
exports.load = load;
|
|
271
|
-
exports.useColors = useColors;
|
|
272
|
-
exports.storage = localstorage();
|
|
273
|
-
exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
|
|
274
|
-
function useColors() {
|
|
275
|
-
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
276
|
-
return true;
|
|
277
|
-
}
|
|
278
|
-
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
279
|
-
return false;
|
|
280
|
-
}
|
|
281
|
-
return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
282
|
-
}
|
|
283
|
-
function formatArgs(args) {
|
|
284
|
-
args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
|
|
285
|
-
if (!this.useColors) {
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
var c = 'color: ' + this.color;
|
|
289
|
-
args.splice(1, 0, c, 'color: inherit');
|
|
290
|
-
var index = 0;
|
|
291
|
-
var lastC = 0;
|
|
292
|
-
args[0].replace(/%[a-zA-Z%]/g, function (match) {
|
|
293
|
-
if (match === '%%') {
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
index++;
|
|
297
|
-
if (match === '%c') {
|
|
298
|
-
lastC = index;
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
args.splice(lastC, 0, c);
|
|
302
|
-
}
|
|
303
|
-
function log() {
|
|
304
|
-
var _console;
|
|
305
|
-
return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
|
|
306
|
-
}
|
|
307
|
-
function save(namespaces) {
|
|
308
|
-
try {
|
|
309
|
-
if (namespaces) {
|
|
310
|
-
exports.storage.setItem('debug', namespaces);
|
|
311
|
-
} else {
|
|
312
|
-
exports.storage.removeItem('debug');
|
|
313
|
-
}
|
|
314
|
-
} catch (error) {}
|
|
315
|
-
}
|
|
316
|
-
function load() {
|
|
317
|
-
var r;
|
|
318
|
-
try {
|
|
319
|
-
r = exports.storage.getItem('debug');
|
|
320
|
-
} catch (error) {}
|
|
321
|
-
if (!r && typeof process !== 'undefined' && ('env' in process)) {
|
|
322
|
-
r = process.env.DEBUG;
|
|
323
|
-
}
|
|
324
|
-
return r;
|
|
325
|
-
}
|
|
326
|
-
function localstorage() {
|
|
327
|
-
try {
|
|
328
|
-
return localStorage;
|
|
329
|
-
} catch (error) {}
|
|
330
|
-
}
|
|
331
|
-
module.exports = common(exports);
|
|
332
|
-
var formatters = module.exports.formatters;
|
|
333
|
-
formatters.j = function (v) {
|
|
334
|
-
try {
|
|
335
|
-
return JSON.stringify(v);
|
|
336
|
-
} catch (error) {
|
|
337
|
-
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
});
|
|
341
|
-
browser.log;
|
|
342
|
-
browser.formatArgs;
|
|
343
|
-
browser.save;
|
|
344
|
-
browser.load;
|
|
345
|
-
browser.useColors;
|
|
346
|
-
browser.storage;
|
|
347
|
-
browser.colors;
|
|
348
|
-
const React = _dll_react;
|
|
349
|
-
const PropTypes = _dll_prop_types;
|
|
350
|
-
const {withStyles: withStyles} = _dll_material_ui__core_styles;
|
|
351
|
-
const {settings: settings} = _dll_pie_lib__config_ui;
|
|
352
|
-
const {layout: layout} = _dll_pie_lib__config_ui;
|
|
353
|
-
const {InputContainer: InputContainer} = _dll_pie_lib__config_ui;
|
|
354
|
-
const EditableHtml = _dll_pie_lib__editable_html;
|
|
355
|
-
const _jsxFileName = "/home/ede/dev/github/pie-framework/pie-elements/packages/image-cloze-association/configure/src/root.jsx";
|
|
356
|
-
const {Panel, toggle} = settings;
|
|
357
|
-
class Root extends React.Component {
|
|
358
|
-
constructor(...args) {
|
|
359
|
-
super(...args);
|
|
360
|
-
Root.prototype.__init.call(this);
|
|
361
|
-
}
|
|
362
|
-
__init() {
|
|
363
|
-
this.onTeacherInstructionsChanged = teacherInstructions => {
|
|
364
|
-
this.props.onModelChanged({
|
|
365
|
-
...this.props.model,
|
|
366
|
-
teacherInstructions
|
|
367
|
-
});
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
render() {
|
|
371
|
-
const {classes, model, configuration, onModelChanged, onConfigurationChanged, imageSupport} = this.props;
|
|
372
|
-
const {teacherInstructions = {}} = configuration || ({});
|
|
373
|
-
return React.createElement(layout.ConfigLayout, {
|
|
374
|
-
settings: React.createElement(Panel, {
|
|
375
|
-
model: model,
|
|
376
|
-
configuration: configuration,
|
|
377
|
-
onChangeModel: model => onModelChanged(model),
|
|
378
|
-
onChangeConfiguration: config => onConfigurationChanged(config),
|
|
379
|
-
groups: {
|
|
380
|
-
'Properties': {
|
|
381
|
-
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label)
|
|
382
|
-
}
|
|
383
|
-
},
|
|
384
|
-
__self: this,
|
|
385
|
-
__source: {
|
|
386
|
-
fileName: _jsxFileName,
|
|
387
|
-
lineNumber: 28
|
|
388
|
-
}
|
|
389
|
-
}),
|
|
390
|
-
__self: this,
|
|
391
|
-
__source: {
|
|
392
|
-
fileName: _jsxFileName,
|
|
393
|
-
lineNumber: 26
|
|
394
|
-
}
|
|
395
|
-
}, React.createElement('div', {
|
|
396
|
-
className: classes.content,
|
|
397
|
-
__self: this,
|
|
398
|
-
__source: {
|
|
399
|
-
fileName: _jsxFileName,
|
|
400
|
-
lineNumber: 41
|
|
401
|
-
}
|
|
402
|
-
}, model && model.teacherInstructionsEnabled && React.createElement(InputContainer, {
|
|
403
|
-
label: teacherInstructions.label,
|
|
404
|
-
className: classes.promptHolder,
|
|
405
|
-
__self: this,
|
|
406
|
-
__source: {
|
|
407
|
-
fileName: _jsxFileName,
|
|
408
|
-
lineNumber: 43
|
|
409
|
-
}
|
|
410
|
-
}, React.createElement(EditableHtml, {
|
|
411
|
-
className: classes.prompt,
|
|
412
|
-
markup: model.teacherInstructions || '',
|
|
413
|
-
onChange: this.onTeacherInstructionsChanged,
|
|
414
|
-
imageSupport: imageSupport,
|
|
415
|
-
nonEmpty: false,
|
|
416
|
-
__self: this,
|
|
417
|
-
__source: {
|
|
418
|
-
fileName: _jsxFileName,
|
|
419
|
-
lineNumber: 44
|
|
420
|
-
}
|
|
421
|
-
})), "Image cloze association"));
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
const styles = theme => ({
|
|
425
|
-
base: {
|
|
426
|
-
marginTop: theme.spacing.unit * 3
|
|
427
|
-
},
|
|
428
|
-
promptHolder: {
|
|
429
|
-
width: '100%',
|
|
430
|
-
paddingTop: theme.spacing.unit * 2
|
|
431
|
-
},
|
|
432
|
-
prompt: {
|
|
433
|
-
paddingTop: theme.spacing.unit * 2,
|
|
434
|
-
width: '100%'
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
|
-
Root.propTypes = {
|
|
438
|
-
classes: PropTypes.object.isRequired,
|
|
439
|
-
onModelChanged: PropTypes.func,
|
|
440
|
-
onConfigurationChanged: PropTypes.func,
|
|
441
|
-
model: PropTypes.object.isRequired,
|
|
442
|
-
configuration: PropTypes.object.isRequired,
|
|
443
|
-
imageSupport: PropTypes.shape({
|
|
444
|
-
add: PropTypes.func.isRequired,
|
|
445
|
-
delete: PropTypes.func.isRequired
|
|
446
|
-
})
|
|
447
|
-
};
|
|
448
|
-
var Root$1 = withStyles(styles)(Root);
|
|
449
|
-
var sensibleDefaults = {
|
|
450
|
-
model: {
|
|
451
|
-
rationaleEnabled: true,
|
|
452
|
-
teacherInstructionsEnabled: true,
|
|
453
|
-
studentInstructionsEnabled: true
|
|
454
|
-
},
|
|
455
|
-
configuration: {
|
|
456
|
-
teacherInstructions: {
|
|
457
|
-
settings: true,
|
|
458
|
-
label: 'Teacher Instructions'
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
const {DeleteImageEvent: DeleteImageEvent} = _dll_pie_framework__pie_configure_events;
|
|
463
|
-
const {InsertImageEvent: InsertImageEvent} = _dll_pie_framework__pie_configure_events;
|
|
464
|
-
const {ModelUpdatedEvent: ModelUpdatedEvent} = _dll_pie_framework__pie_configure_events;
|
|
465
|
-
const React$1 = _dll_react;
|
|
466
|
-
const ReactDOM = _dll_react_dom;
|
|
467
|
-
const log = browser('image-cloze-association:configure');
|
|
468
|
-
class ImageClozeAssociationConfigure extends HTMLElement {
|
|
469
|
-
static __initStatic() {
|
|
470
|
-
this.createDefaultModel = (model = {}) => ({
|
|
471
|
-
...sensibleDefaults.model,
|
|
472
|
-
...model
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
constructor() {
|
|
476
|
-
super();
|
|
477
|
-
this._model = ImageClozeAssociationConfigure.createDefaultModel();
|
|
478
|
-
this.onModelChanged = this.onModelChanged.bind(this);
|
|
479
|
-
this._configuration = sensibleDefaults.configuration;
|
|
480
|
-
}
|
|
481
|
-
set model(s) {
|
|
482
|
-
this._model = ImageClozeAssociationConfigure.createDefaultModel(s);
|
|
483
|
-
this._render();
|
|
484
|
-
}
|
|
485
|
-
set configuration(c) {
|
|
486
|
-
this._configuration = c;
|
|
487
|
-
this._render();
|
|
488
|
-
}
|
|
489
|
-
set disableSidePanel(s) {
|
|
490
|
-
this._disableSidePanel = s;
|
|
491
|
-
this._render();
|
|
492
|
-
}
|
|
493
|
-
dispatchModelUpdated(reset) {
|
|
494
|
-
const resetValue = !!reset;
|
|
495
|
-
this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));
|
|
496
|
-
}
|
|
497
|
-
onModelChanged(m, reset) {
|
|
498
|
-
this._model = m;
|
|
499
|
-
this.dispatchModelUpdated(reset);
|
|
500
|
-
this._render();
|
|
501
|
-
}
|
|
502
|
-
onConfigurationChanged(config) {
|
|
503
|
-
this._configuration = config;
|
|
504
|
-
this._render();
|
|
505
|
-
}
|
|
506
|
-
insertImage(handler) {
|
|
507
|
-
this.dispatchEvent(new InsertImageEvent(handler));
|
|
508
|
-
}
|
|
509
|
-
onDeleteImage(src, done) {
|
|
510
|
-
this.dispatchEvent(new DeleteImageEvent(src, done));
|
|
511
|
-
}
|
|
512
|
-
_render() {
|
|
513
|
-
log('_render');
|
|
514
|
-
let element = React$1.createElement(Root$1, {
|
|
515
|
-
disableSidePanel: this._disableSidePanel,
|
|
516
|
-
model: this._model,
|
|
517
|
-
configuration: this._configuration,
|
|
518
|
-
onModelChanged: this.onModelChanged.bind(this),
|
|
519
|
-
onConfigurationChanged: this.onConfigurationChanged.bind(this),
|
|
520
|
-
imageSupport: {
|
|
521
|
-
add: this.insertImage.bind(this),
|
|
522
|
-
delete: this.onDeleteImage.bind(this)
|
|
523
|
-
}
|
|
524
|
-
});
|
|
525
|
-
ReactDOM.render(element, this);
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
ImageClozeAssociationConfigure.__initStatic();
|
|
529
|
-
export default ImageClozeAssociationConfigure;
|