@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.
@@ -59,7 +59,7 @@ const base = extras =>
59
59
  Object.assign(
60
60
  {},
61
61
  {
62
- highlightChoices: true,
62
+ // highlightChoices: true,
63
63
  feedback: {
64
64
  correct: {
65
65
  type: 'default',
@@ -209,375 +209,57 @@ generate.htmlAscii = (id, element) => ({
209
209
 
210
210
  generate.model = (id, element) => {
211
211
  return Object.assign({}, { id, element }, base( {
212
+ // "id": "8a808081701d693801703174fb900421",
213
+ "teacherInstructions": "",
212
214
  "partialScoring": true,
215
+ "prompt": "<p>Select the sentence from&#160;&#34;The Gymnast&#34; that <span class=\"relative-emphasis\">best</span> represents the theme.</p>",
216
+ "rationale": "<p>The final sentence of the passage best exemplifies the theme of the short story because Natasha&#39;s practice and determination finally pays off.</p>",
213
217
  "tokens": [
214
218
  {
215
- "correct": false,
219
+ "text": "She thought about what she had to do, struggling to rein in her wild, fearful thoughts.",
220
+ "end": 90,
216
221
  "start": 3,
217
- "end": 6,
218
- "text": "Our"
219
- },
220
- {
221
- "correct": false,
222
- "start": 7,
223
- "end": 16,
224
- "text": "challenge"
222
+ "correct": false
225
223
  },
226
224
  {
227
- "correct": false,
228
- "start": 18,
229
- "end": 21,
230
- "text": "not"
231
- },
232
- {
233
- "correct": false,
234
- "start": 22,
235
- "end": 30,
236
- "text": "tomorrow"
237
- },
238
- {
239
- "correct": false,
240
- "start": 31,
241
- "end": 34,
242
- "text": "but"
243
- },
244
- {
245
- "correct": false,
246
- "start": 35,
247
- "end": 40,
248
- "text": "today"
249
- },
250
- {
251
- "correct": false,
252
- "start": 42,
253
- "end": 44,
254
- "text": "is"
255
- },
256
- {
257
- "correct": false,
258
- "start": 45,
259
- "end": 47,
260
- "text": "to"
261
- },
262
- {
263
- "correct": false,
264
- "start": 48,
265
- "end": 58,
266
- "text": "accomplish"
267
- },
268
- {
269
- "correct": false,
270
- "start": 59,
271
- "end": 69,
272
- "text": "objectives"
273
- },
274
- {
275
- "correct": false,
276
- "start": 70,
277
- "end": 75,
278
- "text": "which"
279
- },
280
- {
281
- "correct": false,
282
- "start": 76,
283
- "end": 80,
284
- "text": "have"
285
- },
286
- {
287
- "correct": false,
288
- "start": 81,
289
- "end": 87,
290
- "text": "eluded"
291
- },
292
- {
293
- "correct": false,
294
- "start": 88,
295
- "end": 95,
296
- "text": "mankind"
297
- },
298
- {
299
- "correct": false,
300
- "start": 96,
301
- "end": 101,
302
- "text": "since"
225
+ "start": 449,
226
+ "end": 585,
227
+ "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.",
228
+ "correct": false
303
229
  },
304
230
  {
231
+ "end": 627,
305
232
  "correct": false,
306
- "start": 102,
307
- "end": 105,
308
- "text": "the"
233
+ "text": "At last Natasha's moment arrived.",
234
+ "start": 594
309
235
  },
310
236
  {
237
+ "end": 743,
238
+ "text": "The faces of past giants of gymnastics swam before her mind's eye, now razor&#8211;sharp with fierce determination.",
311
239
  "correct": false,
312
- "start": 106,
313
- "end": 115,
314
- "text": "beginning"
240
+ "start": 628
315
241
  },
316
242
  {
243
+ "text": "Suddenly, the din of the gymnasium was silent to her.",
244
+ "end": 997,
317
245
  "correct": false,
318
- "start": 116,
319
- "end": 118,
320
- "text": "of"
246
+ "start": 944
321
247
  },
322
248
  {
249
+ "end": 1087,
250
+ "start": 998,
323
251
  "correct": false,
324
- "start": 119,
325
- "end": 123,
326
- "text": "time"
327
- },
328
- {
329
- "correct": false,
330
- "start": 125,
331
- "end": 127,
332
- "text": "We"
333
- },
334
- {
335
- "correct": false,
336
- "start": 128,
337
- "end": 132,
338
- "text": "must"
339
- },
340
- {
341
- "correct": false,
342
- "start": 133,
343
- "end": 138,
344
- "text": "bring"
345
- },
346
- {
347
- "correct": false,
348
- "start": 139,
349
- "end": 144,
350
- "text": "equal"
351
- },
352
- {
353
- "correct": false,
354
- "start": 145,
355
- "end": 152,
356
- "text": "justice"
357
- },
358
- {
359
- "correct": false,
360
- "start": 153,
361
- "end": 155,
362
- "text": "to"
363
- },
364
- {
365
- "correct": false,
366
- "start": 156,
367
- "end": 159,
368
- "text": "all"
369
- },
370
- {
371
- "correct": false,
372
- "start": 160,
373
- "end": 163,
374
- "text": "our"
375
- },
376
- {
377
- "correct": false,
378
- "start": 164,
379
- "end": 172,
380
- "text": "citizens"
381
- },
382
- {
383
- "correct": false,
384
- "start": 174,
385
- "end": 176,
386
- "text": "We"
387
- },
388
- {
389
- "correct": false,
390
- "start": 177,
391
- "end": 181,
392
- "text": "must"
393
- },
394
- {
395
- "correct": false,
396
- "start": 182,
397
- "end": 189,
398
- "text": "abolish"
399
- },
400
- {
401
- "correct": false,
402
- "start": 190,
403
- "end": 195,
404
- "text": "human"
252
+ "text": "Forcing all sound out of her mind, she focused on the gleaming balance beam ahead of her."
405
253
  },
406
254
  {
407
255
  "correct": true,
408
- "start": 196,
409
- "end": 203,
410
- "text": "poverty"
411
- },
412
- {
413
- "correct": false,
414
- "start": 205,
415
- "end": 207,
416
- "text": "We"
417
- },
418
- {
419
- "correct": false,
420
- "start": 208,
421
- "end": 212,
422
- "text": "must"
423
- },
424
- {
425
- "correct": false,
426
- "start": 213,
427
- "end": 222,
428
- "text": "eradicate"
429
- },
430
- {
431
- "correct": false,
432
- "start": 223,
433
- "end": 230,
434
- "text": "killing"
435
- },
436
- {
437
- "correct": false,
438
- "start": 231,
439
- "end": 234,
440
- "text": "and"
441
- },
442
- {
443
- "correct": false,
444
- "start": 235,
445
- "end": 244,
446
- "text": "crippling"
447
- },
448
- {
449
- "correct": true,
450
- "start": 245,
451
- "end": 252,
452
- "text": "disease"
453
- },
454
- {
455
- "correct": false,
456
- "start": 253,
457
- "end": 256,
458
- "text": "and"
459
- },
460
- {
461
- "correct": false,
462
- "start": 257,
463
- "end": 265,
464
- "text": "lengthen"
465
- },
466
- {
467
- "correct": false,
468
- "start": 266,
469
- "end": 269,
470
- "text": "the"
471
- },
472
- {
473
- "correct": false,
474
- "start": 270,
475
- "end": 274,
476
- "text": "span"
477
- },
478
- {
479
- "correct": false,
480
- "start": 275,
481
- "end": 277,
482
- "text": "of"
483
- },
484
- {
485
- "correct": false,
486
- "start": 278,
487
- "end": 282,
488
- "text": "life"
489
- },
490
- {
491
- "correct": false,
492
- "start": 283,
493
- "end": 285,
494
- "text": "to"
495
- },
496
- {
497
- "correct": false,
498
- "start": 286,
499
- "end": 289,
500
- "text": "100"
501
- },
502
- {
503
- "correct": false,
504
- "start": 290,
505
- "end": 292,
506
- "text": "or"
507
- },
508
- {
509
- "correct": false,
510
- "start": 293,
511
- "end": 296,
512
- "text": "200"
513
- },
514
- {
515
- "correct": false,
516
- "start": 297,
517
- "end": 302,
518
- "text": "years"
519
- },
520
- {
521
- "correct": false,
522
- "start": 304,
523
- "end": 306,
524
- "text": "We"
525
- },
526
- {
527
- "correct": false,
528
- "start": 307,
529
- "end": 311,
530
- "text": "must"
531
- },
532
- {
533
- "correct": false,
534
- "start": 312,
535
- "end": 321,
536
- "text": "eliminate"
537
- },
538
- {
539
- "correct": true,
540
- "start": 322,
541
- "end": 332,
542
- "text": "illiteracy"
543
- },
544
- {
545
- "correct": false,
546
- "start": 333,
547
- "end": 338,
548
- "text": "among"
549
- },
550
- {
551
- "correct": false,
552
- "start": 339,
553
- "end": 342,
554
- "text": "all"
555
- },
556
- {
557
- "correct": false,
558
- "start": 343,
559
- "end": 345,
560
- "text": "of"
561
- },
562
- {
563
- "correct": false,
564
- "start": 346,
565
- "end": 349,
566
- "text": "our"
567
- },
568
- {
569
- "correct": false,
570
- "start": 350,
571
- "end": 356,
572
- "text": "people"
256
+ "start": 1088,
257
+ "end": 1225,
258
+ "text": "Taking a deep breath, Natasha made her graceful, yet powerful approach, mounted the beam flawlessly, and...executed her first perfect 10."
573
259
  }
574
260
  ],
575
- // "id": "0",
576
- "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",
577
- "prompt": "<p>Select the <span class=\"relative-emphasis\">three</span> words from below that specifically describe the &#8220;enemies&#8221; which Johnson wants to eliminate.</p>",
578
- "rationale": "<p>In paragraph 6, Johnson refers to the &#8220;ancient enemies&#8221;&#8212;which he defines as poverty, disease, illiteracy, strife, and bigotry. In paragraph 3, he talks about this idea by explaining that he wants to &#8220;accomplish objectives which have eluded mankind;&#8221; that is, to eliminate these enemies.</p>",
579
261
  // "element": "select-text",
580
- "maxSelections": 3
262
+ "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&#8211;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"
581
263
  } ));
582
264
  };
583
265
 
package/module/print.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/select-text@6.5.19</title>
5
+ <title>@pie-element/select-text@6.5.20</title>
6
6
  <link
7
7
  href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
8
8
  rel="stylesheet"
package/module/print.js CHANGED
@@ -2145,7 +2145,9 @@ var generateModel = model => {
2145
2145
  ...token,
2146
2146
  text: tokenText,
2147
2147
  start: newStart,
2148
- end: newEnd
2148
+ end: newEnd,
2149
+ oldStart: token.start,
2150
+ oldEnd: token.end
2149
2151
  }];
2150
2152
  }, []);
2151
2153
  return {
@@ -2205,7 +2207,7 @@ class Main extends React$1.Component {
2205
2207
  }
2206
2208
  __init2() {
2207
2209
  this.correctAnswer = () => {
2208
- const {model} = this.props;
2210
+ const {model} = this.state;
2209
2211
  return model.tokens.filter(t => t.correct);
2210
2212
  };
2211
2213
  }
@@ -2219,13 +2221,13 @@ class Main extends React$1.Component {
2219
2221
  __self: this,
2220
2222
  __source: {
2221
2223
  fileName: _jsxFileName,
2222
- lineNumber: 63
2224
+ lineNumber: 61
2223
2225
  }
2224
2226
  }, model.teacherInstructions && hasText(model.teacherInstructions) && React$1.createElement(React$1.Fragment, {
2225
2227
  __self: this,
2226
2228
  __source: {
2227
2229
  fileName: _jsxFileName,
2228
- lineNumber: 66
2230
+ lineNumber: 64
2229
2231
  }
2230
2232
  }, !model.animationsDisabled ? React$1.createElement(Collapsible, {
2231
2233
  labels: {
@@ -2236,41 +2238,41 @@ class Main extends React$1.Component {
2236
2238
  __self: this,
2237
2239
  __source: {
2238
2240
  fileName: _jsxFileName,
2239
- lineNumber: 67
2241
+ lineNumber: 65
2240
2242
  }
2241
2243
  }, React$1.createElement(PreviewPrompt, {
2242
2244
  prompt: model.teacherInstructions,
2243
2245
  __self: this,
2244
2246
  __source: {
2245
2247
  fileName: _jsxFileName,
2246
- lineNumber: 71
2248
+ lineNumber: 69
2247
2249
  }
2248
2250
  })) : React$1.createElement(PreviewPrompt, {
2249
2251
  prompt: model.teacherInstructions,
2250
2252
  __self: this,
2251
2253
  __source: {
2252
2254
  fileName: _jsxFileName,
2253
- lineNumber: 74
2255
+ lineNumber: 72
2254
2256
  }
2255
2257
  }), React$1.createElement('br', {
2256
2258
  __self: this,
2257
2259
  __source: {
2258
2260
  fileName: _jsxFileName,
2259
- lineNumber: 76
2261
+ lineNumber: 74
2260
2262
  }
2261
2263
  })), React$1.createElement('div', {
2262
2264
  className: classes.prompt,
2263
2265
  __self: this,
2264
2266
  __source: {
2265
2267
  fileName: _jsxFileName,
2266
- lineNumber: 80
2268
+ lineNumber: 78
2267
2269
  }
2268
2270
  }, React$1.createElement(PreviewPrompt, {
2269
2271
  prompt: model.prompt,
2270
2272
  __self: this,
2271
2273
  __source: {
2272
2274
  fileName: _jsxFileName,
2273
- lineNumber: 81
2275
+ lineNumber: 79
2274
2276
  }
2275
2277
  })), !model.alwaysShowCorrect && React$1.createElement(CorrectAnswerToggle, {
2276
2278
  show: model.disabled && model.incorrect,
@@ -2279,7 +2281,7 @@ class Main extends React$1.Component {
2279
2281
  __self: this,
2280
2282
  __source: {
2281
2283
  fileName: _jsxFileName,
2282
- lineNumber: 84
2284
+ lineNumber: 82
2283
2285
  }
2284
2286
  }), React$1.createElement(TextSelect, {
2285
2287
  className: classes.textSelect,
@@ -2287,20 +2289,29 @@ class Main extends React$1.Component {
2287
2289
  text: model.text,
2288
2290
  tokens: model.tokens,
2289
2291
  selectedTokens: selectedTokens,
2290
- onChange: onSelectionChange,
2292
+ onChange: selection => {
2293
+ const newSelections = selection.map(select => {
2294
+ const token = model.tokens.find(({start, end}) => select.start === start && select.end === end);
2295
+ if (token) {
2296
+ return token;
2297
+ }
2298
+ return select;
2299
+ });
2300
+ onSelectionChange(newSelections);
2301
+ },
2291
2302
  highlightChoices: model.highlightChoices,
2292
2303
  maxNoOfSelections: model.maxSelections,
2293
2304
  animationsDisabled: model.animationsDisabled,
2294
2305
  __self: this,
2295
2306
  __source: {
2296
2307
  fileName: _jsxFileName,
2297
- lineNumber: 90
2308
+ lineNumber: 88
2298
2309
  }
2299
2310
  }), model.rationale && hasText(model.rationale) && React$1.createElement(React$1.Fragment, {
2300
2311
  __self: this,
2301
2312
  __source: {
2302
2313
  fileName: _jsxFileName,
2303
- lineNumber: 103
2314
+ lineNumber: 114
2304
2315
  }
2305
2316
  }, !model.animationsDisabled ? React$1.createElement(Collapsible, {
2306
2317
  labels: {
@@ -2312,21 +2323,21 @@ class Main extends React$1.Component {
2312
2323
  __self: this,
2313
2324
  __source: {
2314
2325
  fileName: _jsxFileName,
2315
- lineNumber: 104
2326
+ lineNumber: 115
2316
2327
  }
2317
2328
  }, React$1.createElement(PreviewPrompt, {
2318
2329
  prompt: model.rationale,
2319
2330
  __self: this,
2320
2331
  __source: {
2321
2332
  fileName: _jsxFileName,
2322
- lineNumber: 108
2333
+ lineNumber: 119
2323
2334
  }
2324
2335
  })) : React$1.createElement(PreviewPrompt, {
2325
2336
  prompt: model.rationale,
2326
2337
  __self: this,
2327
2338
  __source: {
2328
2339
  fileName: _jsxFileName,
2329
- lineNumber: 110
2340
+ lineNumber: 121
2330
2341
  }
2331
2342
  })), model.correctness && model.feedback && !showCorrectAnswer && React$1.createElement(Feedback, {
2332
2343
  correctness: model.correctness,
@@ -2334,7 +2345,7 @@ class Main extends React$1.Component {
2334
2345
  __self: this,
2335
2346
  __source: {
2336
2347
  fileName: _jsxFileName,
2337
- lineNumber: 115
2348
+ lineNumber: 126
2338
2349
  }
2339
2350
  }));
2340
2351
  }
@@ -2403,7 +2414,7 @@ class Stateful extends React$1.Component {
2403
2414
  __self: this,
2404
2415
  __source: {
2405
2416
  fileName: _jsxFileName,
2406
- lineNumber: 170
2417
+ lineNumber: 181
2407
2418
  }
2408
2419
  });
2409
2420
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "6.5.20",
7
+ "version": "6.5.21",
8
8
  "description": "",
9
9
  "dependencies": {
10
10
  "@material-ui/core": "^3.9.2",
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "author": "",
21
21
  "license": "ISC",
22
- "gitHead": "820dc9994e5f621018ca2c262f9a999996fd2079",
22
+ "gitHead": "33d4ab30ff656b628bbd7a108728bed1ef1b9a83",
23
23
  "scripts": {
24
24
  "postpublish": "../../scripts/postpublish"
25
25
  },