@pie-element/select-text 6.5.20 → 6.5.21
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 +8 -0
- package/configure/CHANGELOG.md +8 -0
- package/configure/lib/utils.js +4 -1
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +1 -1
- package/controller/CHANGELOG.md +8 -0
- package/controller/lib/index.js +1 -1
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/demo/generate.js +28 -346
- package/docs/demo/session.js +18 -5
- package/lib/index.js +38 -2
- package/lib/index.js.map +1 -1
- package/lib/main.js +18 -4
- package/lib/main.js.map +1 -1
- package/lib/utils.js +4 -1
- package/lib/utils.js.map +1 -1
- package/module/configure.js +3 -1
- package/module/controller.js +6 -1
- package/module/demo.js +28 -346
- package/module/element.js +45 -19
- package/module/index.html +1 -1
- package/module/manifest.json +1 -1
- package/module/print-demo.js +28 -346
- package/module/print.html +1 -1
- package/module/print.js +30 -19
- package/package.json +2 -2
package/module/demo.js
CHANGED
|
@@ -61,7 +61,7 @@ const base = extras =>
|
|
|
61
61
|
Object.assign(
|
|
62
62
|
{},
|
|
63
63
|
{
|
|
64
|
-
highlightChoices: true,
|
|
64
|
+
// highlightChoices: true,
|
|
65
65
|
feedback: {
|
|
66
66
|
correct: {
|
|
67
67
|
type: 'default',
|
|
@@ -211,375 +211,57 @@ generate.htmlAscii = (id, element) => ({
|
|
|
211
211
|
|
|
212
212
|
generate.model = (id, element) => {
|
|
213
213
|
return Object.assign({}, { id, element }, base( {
|
|
214
|
+
// "id": "8a808081701d693801703174fb900421",
|
|
215
|
+
"teacherInstructions": "",
|
|
214
216
|
"partialScoring": true,
|
|
217
|
+
"prompt": "<p>Select the sentence from "The Gymnast" that <span class=\"relative-emphasis\">best</span> represents the theme.</p>",
|
|
218
|
+
"rationale": "<p>The final sentence of the passage best exemplifies the theme of the short story because Natasha's practice and determination finally pays off.</p>",
|
|
215
219
|
"tokens": [
|
|
216
220
|
{
|
|
217
|
-
"
|
|
221
|
+
"text": "She thought about what she had to do, struggling to rein in her wild, fearful thoughts.",
|
|
222
|
+
"end": 90,
|
|
218
223
|
"start": 3,
|
|
219
|
-
"
|
|
220
|
-
"text": "Our"
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
"correct": false,
|
|
224
|
-
"start": 7,
|
|
225
|
-
"end": 16,
|
|
226
|
-
"text": "challenge"
|
|
224
|
+
"correct": false
|
|
227
225
|
},
|
|
228
226
|
{
|
|
229
|
-
"
|
|
230
|
-
"
|
|
231
|
-
"
|
|
232
|
-
"
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
"correct": false,
|
|
236
|
-
"start": 22,
|
|
237
|
-
"end": 30,
|
|
238
|
-
"text": "tomorrow"
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
"correct": false,
|
|
242
|
-
"start": 31,
|
|
243
|
-
"end": 34,
|
|
244
|
-
"text": "but"
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
"correct": false,
|
|
248
|
-
"start": 35,
|
|
249
|
-
"end": 40,
|
|
250
|
-
"text": "today"
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
"correct": false,
|
|
254
|
-
"start": 42,
|
|
255
|
-
"end": 44,
|
|
256
|
-
"text": "is"
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
"correct": false,
|
|
260
|
-
"start": 45,
|
|
261
|
-
"end": 47,
|
|
262
|
-
"text": "to"
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
"correct": false,
|
|
266
|
-
"start": 48,
|
|
267
|
-
"end": 58,
|
|
268
|
-
"text": "accomplish"
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
"correct": false,
|
|
272
|
-
"start": 59,
|
|
273
|
-
"end": 69,
|
|
274
|
-
"text": "objectives"
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
"correct": false,
|
|
278
|
-
"start": 70,
|
|
279
|
-
"end": 75,
|
|
280
|
-
"text": "which"
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
"correct": false,
|
|
284
|
-
"start": 76,
|
|
285
|
-
"end": 80,
|
|
286
|
-
"text": "have"
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
"correct": false,
|
|
290
|
-
"start": 81,
|
|
291
|
-
"end": 87,
|
|
292
|
-
"text": "eluded"
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
"correct": false,
|
|
296
|
-
"start": 88,
|
|
297
|
-
"end": 95,
|
|
298
|
-
"text": "mankind"
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
"correct": false,
|
|
302
|
-
"start": 96,
|
|
303
|
-
"end": 101,
|
|
304
|
-
"text": "since"
|
|
227
|
+
"start": 449,
|
|
228
|
+
"end": 585,
|
|
229
|
+
"text": "Just for a hair of a moment, Natasha wondered if she really wanted a perfect 10, so weary was she of trying for but never achieving one.",
|
|
230
|
+
"correct": false
|
|
305
231
|
},
|
|
306
232
|
{
|
|
233
|
+
"end": 627,
|
|
307
234
|
"correct": false,
|
|
308
|
-
"
|
|
309
|
-
"
|
|
310
|
-
"text": "the"
|
|
235
|
+
"text": "At last Natasha's moment arrived.",
|
|
236
|
+
"start": 594
|
|
311
237
|
},
|
|
312
238
|
{
|
|
239
|
+
"end": 743,
|
|
240
|
+
"text": "The faces of past giants of gymnastics swam before her mind's eye, now razor–sharp with fierce determination.",
|
|
313
241
|
"correct": false,
|
|
314
|
-
"start":
|
|
315
|
-
"end": 115,
|
|
316
|
-
"text": "beginning"
|
|
242
|
+
"start": 628
|
|
317
243
|
},
|
|
318
244
|
{
|
|
245
|
+
"text": "Suddenly, the din of the gymnasium was silent to her.",
|
|
246
|
+
"end": 997,
|
|
319
247
|
"correct": false,
|
|
320
|
-
"start":
|
|
321
|
-
"end": 118,
|
|
322
|
-
"text": "of"
|
|
248
|
+
"start": 944
|
|
323
249
|
},
|
|
324
250
|
{
|
|
251
|
+
"end": 1087,
|
|
252
|
+
"start": 998,
|
|
325
253
|
"correct": false,
|
|
326
|
-
"
|
|
327
|
-
"end": 123,
|
|
328
|
-
"text": "time"
|
|
329
|
-
},
|
|
330
|
-
{
|
|
331
|
-
"correct": false,
|
|
332
|
-
"start": 125,
|
|
333
|
-
"end": 127,
|
|
334
|
-
"text": "We"
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
"correct": false,
|
|
338
|
-
"start": 128,
|
|
339
|
-
"end": 132,
|
|
340
|
-
"text": "must"
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
"correct": false,
|
|
344
|
-
"start": 133,
|
|
345
|
-
"end": 138,
|
|
346
|
-
"text": "bring"
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
"correct": false,
|
|
350
|
-
"start": 139,
|
|
351
|
-
"end": 144,
|
|
352
|
-
"text": "equal"
|
|
353
|
-
},
|
|
354
|
-
{
|
|
355
|
-
"correct": false,
|
|
356
|
-
"start": 145,
|
|
357
|
-
"end": 152,
|
|
358
|
-
"text": "justice"
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
"correct": false,
|
|
362
|
-
"start": 153,
|
|
363
|
-
"end": 155,
|
|
364
|
-
"text": "to"
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
"correct": false,
|
|
368
|
-
"start": 156,
|
|
369
|
-
"end": 159,
|
|
370
|
-
"text": "all"
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
"correct": false,
|
|
374
|
-
"start": 160,
|
|
375
|
-
"end": 163,
|
|
376
|
-
"text": "our"
|
|
377
|
-
},
|
|
378
|
-
{
|
|
379
|
-
"correct": false,
|
|
380
|
-
"start": 164,
|
|
381
|
-
"end": 172,
|
|
382
|
-
"text": "citizens"
|
|
383
|
-
},
|
|
384
|
-
{
|
|
385
|
-
"correct": false,
|
|
386
|
-
"start": 174,
|
|
387
|
-
"end": 176,
|
|
388
|
-
"text": "We"
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
"correct": false,
|
|
392
|
-
"start": 177,
|
|
393
|
-
"end": 181,
|
|
394
|
-
"text": "must"
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
"correct": false,
|
|
398
|
-
"start": 182,
|
|
399
|
-
"end": 189,
|
|
400
|
-
"text": "abolish"
|
|
401
|
-
},
|
|
402
|
-
{
|
|
403
|
-
"correct": false,
|
|
404
|
-
"start": 190,
|
|
405
|
-
"end": 195,
|
|
406
|
-
"text": "human"
|
|
254
|
+
"text": "Forcing all sound out of her mind, she focused on the gleaming balance beam ahead of her."
|
|
407
255
|
},
|
|
408
256
|
{
|
|
409
257
|
"correct": true,
|
|
410
|
-
"start":
|
|
411
|
-
"end":
|
|
412
|
-
"text": "
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
"correct": false,
|
|
416
|
-
"start": 205,
|
|
417
|
-
"end": 207,
|
|
418
|
-
"text": "We"
|
|
419
|
-
},
|
|
420
|
-
{
|
|
421
|
-
"correct": false,
|
|
422
|
-
"start": 208,
|
|
423
|
-
"end": 212,
|
|
424
|
-
"text": "must"
|
|
425
|
-
},
|
|
426
|
-
{
|
|
427
|
-
"correct": false,
|
|
428
|
-
"start": 213,
|
|
429
|
-
"end": 222,
|
|
430
|
-
"text": "eradicate"
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
"correct": false,
|
|
434
|
-
"start": 223,
|
|
435
|
-
"end": 230,
|
|
436
|
-
"text": "killing"
|
|
437
|
-
},
|
|
438
|
-
{
|
|
439
|
-
"correct": false,
|
|
440
|
-
"start": 231,
|
|
441
|
-
"end": 234,
|
|
442
|
-
"text": "and"
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
"correct": false,
|
|
446
|
-
"start": 235,
|
|
447
|
-
"end": 244,
|
|
448
|
-
"text": "crippling"
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
"correct": true,
|
|
452
|
-
"start": 245,
|
|
453
|
-
"end": 252,
|
|
454
|
-
"text": "disease"
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
"correct": false,
|
|
458
|
-
"start": 253,
|
|
459
|
-
"end": 256,
|
|
460
|
-
"text": "and"
|
|
461
|
-
},
|
|
462
|
-
{
|
|
463
|
-
"correct": false,
|
|
464
|
-
"start": 257,
|
|
465
|
-
"end": 265,
|
|
466
|
-
"text": "lengthen"
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
"correct": false,
|
|
470
|
-
"start": 266,
|
|
471
|
-
"end": 269,
|
|
472
|
-
"text": "the"
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
"correct": false,
|
|
476
|
-
"start": 270,
|
|
477
|
-
"end": 274,
|
|
478
|
-
"text": "span"
|
|
479
|
-
},
|
|
480
|
-
{
|
|
481
|
-
"correct": false,
|
|
482
|
-
"start": 275,
|
|
483
|
-
"end": 277,
|
|
484
|
-
"text": "of"
|
|
485
|
-
},
|
|
486
|
-
{
|
|
487
|
-
"correct": false,
|
|
488
|
-
"start": 278,
|
|
489
|
-
"end": 282,
|
|
490
|
-
"text": "life"
|
|
491
|
-
},
|
|
492
|
-
{
|
|
493
|
-
"correct": false,
|
|
494
|
-
"start": 283,
|
|
495
|
-
"end": 285,
|
|
496
|
-
"text": "to"
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
"correct": false,
|
|
500
|
-
"start": 286,
|
|
501
|
-
"end": 289,
|
|
502
|
-
"text": "100"
|
|
503
|
-
},
|
|
504
|
-
{
|
|
505
|
-
"correct": false,
|
|
506
|
-
"start": 290,
|
|
507
|
-
"end": 292,
|
|
508
|
-
"text": "or"
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
"correct": false,
|
|
512
|
-
"start": 293,
|
|
513
|
-
"end": 296,
|
|
514
|
-
"text": "200"
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
"correct": false,
|
|
518
|
-
"start": 297,
|
|
519
|
-
"end": 302,
|
|
520
|
-
"text": "years"
|
|
521
|
-
},
|
|
522
|
-
{
|
|
523
|
-
"correct": false,
|
|
524
|
-
"start": 304,
|
|
525
|
-
"end": 306,
|
|
526
|
-
"text": "We"
|
|
527
|
-
},
|
|
528
|
-
{
|
|
529
|
-
"correct": false,
|
|
530
|
-
"start": 307,
|
|
531
|
-
"end": 311,
|
|
532
|
-
"text": "must"
|
|
533
|
-
},
|
|
534
|
-
{
|
|
535
|
-
"correct": false,
|
|
536
|
-
"start": 312,
|
|
537
|
-
"end": 321,
|
|
538
|
-
"text": "eliminate"
|
|
539
|
-
},
|
|
540
|
-
{
|
|
541
|
-
"correct": true,
|
|
542
|
-
"start": 322,
|
|
543
|
-
"end": 332,
|
|
544
|
-
"text": "illiteracy"
|
|
545
|
-
},
|
|
546
|
-
{
|
|
547
|
-
"correct": false,
|
|
548
|
-
"start": 333,
|
|
549
|
-
"end": 338,
|
|
550
|
-
"text": "among"
|
|
551
|
-
},
|
|
552
|
-
{
|
|
553
|
-
"correct": false,
|
|
554
|
-
"start": 339,
|
|
555
|
-
"end": 342,
|
|
556
|
-
"text": "all"
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
"correct": false,
|
|
560
|
-
"start": 343,
|
|
561
|
-
"end": 345,
|
|
562
|
-
"text": "of"
|
|
563
|
-
},
|
|
564
|
-
{
|
|
565
|
-
"correct": false,
|
|
566
|
-
"start": 346,
|
|
567
|
-
"end": 349,
|
|
568
|
-
"text": "our"
|
|
569
|
-
},
|
|
570
|
-
{
|
|
571
|
-
"correct": false,
|
|
572
|
-
"start": 350,
|
|
573
|
-
"end": 356,
|
|
574
|
-
"text": "people"
|
|
258
|
+
"start": 1088,
|
|
259
|
+
"end": 1225,
|
|
260
|
+
"text": "Taking a deep breath, Natasha made her graceful, yet powerful approach, mounted the beam flawlessly, and...executed her first perfect 10."
|
|
575
261
|
}
|
|
576
262
|
],
|
|
577
|
-
// "id": "0",
|
|
578
|
-
"text": "<p>Our challenge, not tomorrow but today, is to accomplish objectives which have eluded mankind since the beginning of time. We must bring equal justice to all our citizens. We must abolish human poverty. We must eradicate killing and crippling disease and lengthen the span of life to 100 or 200 years. We must eliminate illiteracy among all of our people.</p>\n",
|
|
579
|
-
"prompt": "<p>Select the <span class=\"relative-emphasis\">three</span> words from below that specifically describe the “enemies” which Johnson wants to eliminate.</p>",
|
|
580
|
-
"rationale": "<p>In paragraph 6, Johnson refers to the “ancient enemies”—which he defines as poverty, disease, illiteracy, strife, and bigotry. In paragraph 3, he talks about this idea by explaining that he wants to “accomplish objectives which have eluded mankind;” that is, to eliminate these enemies.</p>",
|
|
581
263
|
// "element": "select-text",
|
|
582
|
-
"
|
|
264
|
+
"text": "<p>She thought about what she had to do, struggling to rein in her wild, fearful thoughts. Coach Cummings always said that an undisciplined mind never scored a perfect 10. Natasha wanted to please her Coach, yet sometimes his approval wasn't as exciting as his anger. The gymnasts were unanimous about one thing: Coach Cummings's fits of disapproving rage were much more humorous to witness than his infrequent, backslapping moments of high praise. Just for a hair of a moment, Natasha wondered if she really wanted a perfect 10, so weary was she of trying for but never achieving one.</p>\n\n<p>At last Natasha's moment arrived. The faces of past giants of gymnastics swam before her mind's eye, now razor–sharp with fierce determination. \"I am talented. I am not afraid. I will make a perfect 10,\" she spoke aloud to herself, as she approached the mat, dusted her hands with chalk to prevent slippage, and returned to her starting point. Suddenly, the din of the gymnasium was silent to her. Forcing all sound out of her mind, she focused on the gleaming balance beam ahead of her. Taking a deep breath, Natasha made her graceful, yet powerful approach, mounted the beam flawlessly, and...executed her first perfect 10.</p>\n"
|
|
583
265
|
} ));
|
|
584
266
|
};
|
|
585
267
|
|
package/module/element.js
CHANGED
|
@@ -2182,7 +2182,9 @@ var generateModel = model => {
|
|
|
2182
2182
|
...token,
|
|
2183
2183
|
text: tokenText,
|
|
2184
2184
|
start: newStart,
|
|
2185
|
-
end: newEnd
|
|
2185
|
+
end: newEnd,
|
|
2186
|
+
oldStart: token.start,
|
|
2187
|
+
oldEnd: token.end
|
|
2186
2188
|
}];
|
|
2187
2189
|
}, []);
|
|
2188
2190
|
return {
|
|
@@ -2242,7 +2244,7 @@ class Main extends React$1.Component {
|
|
|
2242
2244
|
}
|
|
2243
2245
|
__init2() {
|
|
2244
2246
|
this.correctAnswer = () => {
|
|
2245
|
-
const {model} = this.
|
|
2247
|
+
const {model} = this.state;
|
|
2246
2248
|
return model.tokens.filter(t => t.correct);
|
|
2247
2249
|
};
|
|
2248
2250
|
}
|
|
@@ -2256,13 +2258,13 @@ class Main extends React$1.Component {
|
|
|
2256
2258
|
__self: this,
|
|
2257
2259
|
__source: {
|
|
2258
2260
|
fileName: _jsxFileName,
|
|
2259
|
-
lineNumber:
|
|
2261
|
+
lineNumber: 61
|
|
2260
2262
|
}
|
|
2261
2263
|
}, model.teacherInstructions && hasText(model.teacherInstructions) && React$1.createElement(React$1.Fragment, {
|
|
2262
2264
|
__self: this,
|
|
2263
2265
|
__source: {
|
|
2264
2266
|
fileName: _jsxFileName,
|
|
2265
|
-
lineNumber:
|
|
2267
|
+
lineNumber: 64
|
|
2266
2268
|
}
|
|
2267
2269
|
}, !model.animationsDisabled ? React$1.createElement(Collapsible, {
|
|
2268
2270
|
labels: {
|
|
@@ -2273,41 +2275,41 @@ class Main extends React$1.Component {
|
|
|
2273
2275
|
__self: this,
|
|
2274
2276
|
__source: {
|
|
2275
2277
|
fileName: _jsxFileName,
|
|
2276
|
-
lineNumber:
|
|
2278
|
+
lineNumber: 65
|
|
2277
2279
|
}
|
|
2278
2280
|
}, React$1.createElement(PreviewPrompt, {
|
|
2279
2281
|
prompt: model.teacherInstructions,
|
|
2280
2282
|
__self: this,
|
|
2281
2283
|
__source: {
|
|
2282
2284
|
fileName: _jsxFileName,
|
|
2283
|
-
lineNumber:
|
|
2285
|
+
lineNumber: 69
|
|
2284
2286
|
}
|
|
2285
2287
|
})) : React$1.createElement(PreviewPrompt, {
|
|
2286
2288
|
prompt: model.teacherInstructions,
|
|
2287
2289
|
__self: this,
|
|
2288
2290
|
__source: {
|
|
2289
2291
|
fileName: _jsxFileName,
|
|
2290
|
-
lineNumber:
|
|
2292
|
+
lineNumber: 72
|
|
2291
2293
|
}
|
|
2292
2294
|
}), React$1.createElement('br', {
|
|
2293
2295
|
__self: this,
|
|
2294
2296
|
__source: {
|
|
2295
2297
|
fileName: _jsxFileName,
|
|
2296
|
-
lineNumber:
|
|
2298
|
+
lineNumber: 74
|
|
2297
2299
|
}
|
|
2298
2300
|
})), React$1.createElement('div', {
|
|
2299
2301
|
className: classes.prompt,
|
|
2300
2302
|
__self: this,
|
|
2301
2303
|
__source: {
|
|
2302
2304
|
fileName: _jsxFileName,
|
|
2303
|
-
lineNumber:
|
|
2305
|
+
lineNumber: 78
|
|
2304
2306
|
}
|
|
2305
2307
|
}, React$1.createElement(PreviewPrompt, {
|
|
2306
2308
|
prompt: model.prompt,
|
|
2307
2309
|
__self: this,
|
|
2308
2310
|
__source: {
|
|
2309
2311
|
fileName: _jsxFileName,
|
|
2310
|
-
lineNumber:
|
|
2312
|
+
lineNumber: 79
|
|
2311
2313
|
}
|
|
2312
2314
|
})), !model.alwaysShowCorrect && React$1.createElement(CorrectAnswerToggle, {
|
|
2313
2315
|
show: model.disabled && model.incorrect,
|
|
@@ -2316,7 +2318,7 @@ class Main extends React$1.Component {
|
|
|
2316
2318
|
__self: this,
|
|
2317
2319
|
__source: {
|
|
2318
2320
|
fileName: _jsxFileName,
|
|
2319
|
-
lineNumber:
|
|
2321
|
+
lineNumber: 82
|
|
2320
2322
|
}
|
|
2321
2323
|
}), React$1.createElement(TextSelect, {
|
|
2322
2324
|
className: classes.textSelect,
|
|
@@ -2324,20 +2326,29 @@ class Main extends React$1.Component {
|
|
|
2324
2326
|
text: model.text,
|
|
2325
2327
|
tokens: model.tokens,
|
|
2326
2328
|
selectedTokens: selectedTokens,
|
|
2327
|
-
onChange:
|
|
2329
|
+
onChange: selection => {
|
|
2330
|
+
const newSelections = selection.map(select => {
|
|
2331
|
+
const token = model.tokens.find(({start, end}) => select.start === start && select.end === end);
|
|
2332
|
+
if (token) {
|
|
2333
|
+
return token;
|
|
2334
|
+
}
|
|
2335
|
+
return select;
|
|
2336
|
+
});
|
|
2337
|
+
onSelectionChange(newSelections);
|
|
2338
|
+
},
|
|
2328
2339
|
highlightChoices: model.highlightChoices,
|
|
2329
2340
|
maxNoOfSelections: model.maxSelections,
|
|
2330
2341
|
animationsDisabled: model.animationsDisabled,
|
|
2331
2342
|
__self: this,
|
|
2332
2343
|
__source: {
|
|
2333
2344
|
fileName: _jsxFileName,
|
|
2334
|
-
lineNumber:
|
|
2345
|
+
lineNumber: 88
|
|
2335
2346
|
}
|
|
2336
2347
|
}), model.rationale && hasText(model.rationale) && React$1.createElement(React$1.Fragment, {
|
|
2337
2348
|
__self: this,
|
|
2338
2349
|
__source: {
|
|
2339
2350
|
fileName: _jsxFileName,
|
|
2340
|
-
lineNumber:
|
|
2351
|
+
lineNumber: 114
|
|
2341
2352
|
}
|
|
2342
2353
|
}, !model.animationsDisabled ? React$1.createElement(Collapsible, {
|
|
2343
2354
|
labels: {
|
|
@@ -2349,21 +2360,21 @@ class Main extends React$1.Component {
|
|
|
2349
2360
|
__self: this,
|
|
2350
2361
|
__source: {
|
|
2351
2362
|
fileName: _jsxFileName,
|
|
2352
|
-
lineNumber:
|
|
2363
|
+
lineNumber: 115
|
|
2353
2364
|
}
|
|
2354
2365
|
}, React$1.createElement(PreviewPrompt, {
|
|
2355
2366
|
prompt: model.rationale,
|
|
2356
2367
|
__self: this,
|
|
2357
2368
|
__source: {
|
|
2358
2369
|
fileName: _jsxFileName,
|
|
2359
|
-
lineNumber:
|
|
2370
|
+
lineNumber: 119
|
|
2360
2371
|
}
|
|
2361
2372
|
})) : React$1.createElement(PreviewPrompt, {
|
|
2362
2373
|
prompt: model.rationale,
|
|
2363
2374
|
__self: this,
|
|
2364
2375
|
__source: {
|
|
2365
2376
|
fileName: _jsxFileName,
|
|
2366
|
-
lineNumber:
|
|
2377
|
+
lineNumber: 121
|
|
2367
2378
|
}
|
|
2368
2379
|
})), model.correctness && model.feedback && !showCorrectAnswer && React$1.createElement(Feedback, {
|
|
2369
2380
|
correctness: model.correctness,
|
|
@@ -2371,7 +2382,7 @@ class Main extends React$1.Component {
|
|
|
2371
2382
|
__self: this,
|
|
2372
2383
|
__source: {
|
|
2373
2384
|
fileName: _jsxFileName,
|
|
2374
|
-
lineNumber:
|
|
2385
|
+
lineNumber: 126
|
|
2375
2386
|
}
|
|
2376
2387
|
}));
|
|
2377
2388
|
}
|
|
@@ -2440,7 +2451,7 @@ class Stateful extends React$1.Component {
|
|
|
2440
2451
|
__self: this,
|
|
2441
2452
|
__source: {
|
|
2442
2453
|
fileName: _jsxFileName,
|
|
2443
|
-
lineNumber:
|
|
2454
|
+
lineNumber: 181
|
|
2444
2455
|
}
|
|
2445
2456
|
});
|
|
2446
2457
|
}
|
|
@@ -2460,6 +2471,21 @@ class SelectText extends HTMLElement {
|
|
|
2460
2471
|
}
|
|
2461
2472
|
set session(s) {
|
|
2462
2473
|
this._session = s;
|
|
2474
|
+
if (this._model) {
|
|
2475
|
+
const generatedModel = generateModel(this._model) || ({});
|
|
2476
|
+
const {tokens} = generatedModel;
|
|
2477
|
+
const areCorrect = (s.selectedTokens || []).filter(({start, end}) => tokens.find(({start: tStart, end: tEnd}) => start === tStart && end === tEnd)).length;
|
|
2478
|
+
if (!areCorrect) {
|
|
2479
|
+
const generatedModel = generateModel({
|
|
2480
|
+
...this._model,
|
|
2481
|
+
tokens: s.selectedTokens
|
|
2482
|
+
}) || ({});
|
|
2483
|
+
const {tokens} = generatedModel;
|
|
2484
|
+
if (tokens) {
|
|
2485
|
+
this._session.selectedTokens = tokens;
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2463
2489
|
if (!Array.isArray(this._session.selectedTokens)) {
|
|
2464
2490
|
this._session.selectedTokens = [];
|
|
2465
2491
|
}
|
package/module/index.html
CHANGED