@pie-element/extended-text-entry 6.8.0 → 6.8.3

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/module/element.js CHANGED
@@ -1,7 +1,7 @@
1
- import {_dll_debug, _dll_lodash, _dll_react_dom, _dll_prop_types, _dll_react, _dll_react_dom_server, _dll_material_ui__core, _dll_classnames, _dll_material_ui__core_styles, _dll_material_ui__icons, _dll_pie_lib__render_ui} from "../../../@pie-lib/shared-module@^1.2.17/module/index.js";
2
- import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.20/module/index.js";
3
- import {_dll_pie_lib__math_toolbar} from "../../../@pie-lib/math-edit-module@^1.1.16/module/index.js";
4
- import {_dll_pie_lib__drag} from "../../../@pie-lib/drag-module@^1.0.18/module/index.js";
1
+ import {_dll_debug, _dll_lodash, _dll_react_dom, _dll_prop_types, _dll_react, _dll_react_dom_server, _dll_material_ui__core, _dll_classnames, _dll_material_ui__core_styles, _dll_material_ui__icons, _dll_pie_lib__render_ui} from "../../../@pie-lib/shared-module@^1.4.1/module/index.js";
2
+ import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.26/module/index.js";
3
+ import {_dll_pie_lib__math_toolbar} from "../../../@pie-lib/math-edit-module@^1.1.22/module/index.js";
4
+ import {_dll_pie_lib__drag} from "../../../@pie-lib/drag-module@^1.0.24/module/index.js";
5
5
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
6
6
  function getDefaultExportFromCjs(x) {
7
7
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -21958,6 +21958,18 @@ const htmlDecode = input => {
21958
21958
  const getTagName = el => {
21959
21959
  return (el && el.tagName || '').toLowerCase();
21960
21960
  };
21961
+ const lessThanHandling = input => {
21962
+ const arrowSplit = input.split('<');
21963
+ if (input.length > 2) {
21964
+ return arrowSplit.reduce((st, part) => {
21965
+ if (part.match(/<[a-zA-Z/][\s\S]*>/ig)) {
21966
+ return `${st}${st ? '<' : ''}${part}`;
21967
+ }
21968
+ return `${st}${st ? '&lt;' : ''}${part}`;
21969
+ }, '');
21970
+ }
21971
+ return input;
21972
+ };
21961
21973
  const serialization$4 = {
21962
21974
  deserialize(el) {
21963
21975
  const tagName = getTagName(el);
@@ -22002,14 +22014,14 @@ const serialization$4 = {
22002
22014
  const l = object.data.get('latex');
22003
22015
  const wrapper = object.data.get('wrapper');
22004
22016
  log$f('[serialize] latex: ', l);
22005
- const decoded = htmlDecode(l);
22017
+ const decoded = htmlDecode(lessThanHandling(l));
22006
22018
  return React$p.createElement('span', {
22007
22019
  'data-latex': "",
22008
22020
  'data-raw': decoded,
22009
22021
  __self: this,
22010
22022
  __source: {
22011
22023
  fileName: _jsxFileName$o,
22012
- lineNumber: 238
22024
+ lineNumber: 268
22013
22025
  }
22014
22026
  }, wrapMath(decoded, wrapper));
22015
22027
  }
@@ -22023,7 +22035,7 @@ const serialization$4 = {
22023
22035
  __self: this,
22024
22036
  __source: {
22025
22037
  fileName: _jsxFileName$o,
22026
- lineNumber: 250
22038
+ lineNumber: 280
22027
22039
  }
22028
22040
  });
22029
22041
  }
@@ -30642,20 +30654,24 @@ var TablePlugin = (opts, toolbarPlugins) => {
30642
30654
  if (node.object !== 'document') {
30643
30655
  return;
30644
30656
  }
30657
+ const tableAdded = node.findDescendant(d => d.data && d.data.get('newTable'));
30658
+ if (!tableAdded) {
30659
+ return;
30660
+ }
30661
+ const nodeToSearch = node.getParent(tableAdded.key) || node;
30645
30662
  let shouldAddTextAfterNode = false;
30646
- const indexToNotHaveTableOn = node.nodes.size - 1;
30647
- const indexOfLastTable = node.nodes.findLastIndex(d => d.type === 'table');
30663
+ const indexToNotHaveTableOn = nodeToSearch.nodes.size - 1;
30664
+ const indexOfLastTable = nodeToSearch.nodes.findLastIndex(d => d.type === 'table');
30648
30665
  if (indexOfLastTable === indexToNotHaveTableOn) {
30649
30666
  shouldAddTextAfterNode = true;
30650
30667
  }
30651
30668
  if (!shouldAddTextAfterNode) {
30652
30669
  return;
30653
30670
  }
30654
- const tableNode = node.nodes.get(indexOfLastTable);
30655
30671
  return change => {
30656
30672
  if (shouldAddTextAfterNode) {
30657
- const tableJSON = tableNode.toJSON();
30658
- change.removeNodeByKey(tableNode.key);
30673
+ const tableJSON = tableAdded.toJSON();
30674
+ change.removeNodeByKey(tableAdded.key);
30659
30675
  const newBlock = Block.create({
30660
30676
  object: 'block',
30661
30677
  type: 'div'
@@ -30780,13 +30796,13 @@ const serialization$1 = {
30780
30796
  __self: this,
30781
30797
  __source: {
30782
30798
  fileName: _jsxFileName$e,
30783
- lineNumber: 413
30799
+ lineNumber: 418
30784
30800
  }
30785
30801
  }, React$f.createElement('tbody', {
30786
30802
  __self: this,
30787
30803
  __source: {
30788
30804
  fileName: _jsxFileName$e,
30789
- lineNumber: 414
30805
+ lineNumber: 419
30790
30806
  }
30791
30807
  }, children));
30792
30808
  }
@@ -30796,7 +30812,7 @@ const serialization$1 = {
30796
30812
  __self: this,
30797
30813
  __source: {
30798
30814
  fileName: _jsxFileName$e,
30799
- lineNumber: 419
30815
+ lineNumber: 424
30800
30816
  }
30801
30817
  }, children);
30802
30818
  }
@@ -30810,7 +30826,7 @@ const serialization$1 = {
30810
30826
  __self: this,
30811
30827
  __source: {
30812
30828
  fileName: _jsxFileName$e,
30813
- lineNumber: 425
30829
+ lineNumber: 430
30814
30830
  }
30815
30831
  }, children);
30816
30832
  } else {
@@ -30819,7 +30835,7 @@ const serialization$1 = {
30819
30835
  __self: this,
30820
30836
  __source: {
30821
30837
  fileName: _jsxFileName$e,
30822
- lineNumber: 427
30838
+ lineNumber: 432
30823
30839
  }
30824
30840
  }, children);
30825
30841
  }
@@ -31282,7 +31298,7 @@ const ExplicitConstructedResponse = props => {
31282
31298
  };
31283
31299
  ExplicitConstructedResponse.propTypes = {
31284
31300
  attributes: PropTypes$5.object,
31285
- value: PropTypes$5.object
31301
+ value: PropTypes$5.string
31286
31302
  };
31287
31303
  const defaultECR = index => Inline.create({
31288
31304
  type: 'explicit_constructed_response',
@@ -31324,14 +31340,19 @@ const {isUndefined: isUndefined} = _dll_lodash;
31324
31340
  const _jsxFileName$8 = "/home/circleci/repo/node_modules/@pie-lib/editable-html/src/plugins/respArea/index.jsx";
31325
31341
  const log$8 = debug$8('@pie-lib:editable-html:plugins:respArea');
31326
31342
  const lastIndexMap = {};
31327
- const elTypesArray = ['inline_dropdown', 'explicit_constructed_response', 'drag_in_the_blank'];
31343
+ const elTypesMap = {
31344
+ 'inline-dropdown': 'inline_dropdown',
31345
+ 'explicit-constructed-response': 'explicit_constructed_response',
31346
+ 'drag-in-the-blank': 'drag_in_the_blank'
31347
+ };
31348
+ const elTypesArray = Object.values(elTypesMap);
31328
31349
  function ResponseAreaPlugin(opts) {
31329
31350
  const toolbar = {
31330
31351
  icon: React$9.createElement(ToolbarIcon, {
31331
31352
  __self: this,
31332
31353
  __source: {
31333
31354
  fileName: _jsxFileName$8,
31334
- lineNumber: 18
31355
+ lineNumber: 23
31335
31356
  }
31336
31357
  }),
31337
31358
  buttonStyles: {
@@ -31394,7 +31415,7 @@ function ResponseAreaPlugin(opts) {
31394
31415
  __self: this,
31395
31416
  __source: {
31396
31417
  fileName: _jsxFileName$8,
31397
- lineNumber: 88
31418
+ lineNumber: 93
31398
31419
  }
31399
31420
  });
31400
31421
  }
@@ -31409,7 +31430,7 @@ function ResponseAreaPlugin(opts) {
31409
31430
  __self: this,
31410
31431
  __source: {
31411
31432
  fileName: _jsxFileName$8,
31412
- lineNumber: 95
31433
+ lineNumber: 100
31413
31434
  }
31414
31435
  });
31415
31436
  }
@@ -31421,12 +31442,12 @@ function ResponseAreaPlugin(opts) {
31421
31442
  __self: this,
31422
31443
  __source: {
31423
31444
  fileName: _jsxFileName$8,
31424
- lineNumber: 102
31445
+ lineNumber: 107
31425
31446
  }
31426
31447
  });
31427
31448
  }
31428
31449
  },
31429
- onChange(change) {
31450
+ onChange(change, editor) {
31430
31451
  const type = opts.type.replace(/-/g, '_');
31431
31452
  if (isUndefined(lastIndexMap[type])) {
31432
31453
  lastIndexMap[type] = 0;
@@ -31439,6 +31460,18 @@ function ResponseAreaPlugin(opts) {
31439
31460
  }
31440
31461
  });
31441
31462
  }
31463
+ if (!editor.value) {
31464
+ return;
31465
+ }
31466
+ const isOfCurrentType = d => d.type === opts.type || d.type === elTypesMap[opts.type];
31467
+ const currentRespAreaList = change.value.document.filterDescendants(isOfCurrentType);
31468
+ const oldRespAreaList = editor.value.document.filterDescendants(isOfCurrentType);
31469
+ const arrayToFilter = oldRespAreaList.size > currentRespAreaList.size ? oldRespAreaList : currentRespAreaList;
31470
+ const arrayToUseForFilter = arrayToFilter === oldRespAreaList ? currentRespAreaList : oldRespAreaList;
31471
+ const elementsWithChangedStatus = arrayToFilter.filter(d => !arrayToUseForFilter.find(e => e.data.get('index') === d.data.get('index')));
31472
+ if (elementsWithChangedStatus.size && oldRespAreaList.size > currentRespAreaList.size) {
31473
+ opts.onHandleAreaChange(elementsWithChangedStatus);
31474
+ }
31442
31475
  },
31443
31476
  onDrop(event, change, editor) {
31444
31477
  const closestEl = event.target.closest('[data-key]');
@@ -31502,7 +31535,7 @@ const serialization = {
31502
31535
  __self: this,
31503
31536
  __source: {
31504
31537
  fileName: _jsxFileName$8,
31505
- lineNumber: 181
31538
+ lineNumber: 207
31506
31539
  }
31507
31540
  });
31508
31541
  }
@@ -31516,7 +31549,7 @@ const serialization = {
31516
31549
  __self: this,
31517
31550
  __source: {
31518
31551
  fileName: _jsxFileName$8,
31519
- lineNumber: 187
31552
+ lineNumber: 213
31520
31553
  }
31521
31554
  });
31522
31555
  }
@@ -31532,7 +31565,7 @@ const serialization = {
31532
31565
  __self: this,
31533
31566
  __source: {
31534
31567
  fileName: _jsxFileName$8,
31535
- lineNumber: 198
31568
+ lineNumber: 224
31536
31569
  }
31537
31570
  });
31538
31571
  }
@@ -31860,7 +31893,7 @@ class Toolbar extends React$7.Component {
31860
31893
  position: PropTypes$4.oneOf(['bottom', 'top']),
31861
31894
  alignment: PropTypes$4.oneOf(['left', 'right']),
31862
31895
  alwaysVisible: PropTypes$4.bool,
31863
- ref: PropTypes$4.obj,
31896
+ ref: PropTypes$4.func,
31864
31897
  showDone: PropTypes$4.bool
31865
31898
  }),
31866
31899
  onDataChange: PropTypes$4.func
@@ -32674,6 +32707,7 @@ class Editor extends React$3.Component {
32674
32707
  classes: PropTypes$2.object.isRequired,
32675
32708
  highlightShape: PropTypes$2.bool,
32676
32709
  disabled: PropTypes$2.bool,
32710
+ spellCheck: PropTypes$2.bool,
32677
32711
  nonEmpty: PropTypes$2.bool,
32678
32712
  disableUnderline: PropTypes$2.bool,
32679
32713
  autoWidthToolbar: PropTypes$2.bool,
@@ -32683,7 +32717,7 @@ class Editor extends React$3.Component {
32683
32717
  type: PropTypes$2.oneOf(['explicit-constructed-response', 'inline-dropdown', 'drag-in-the-blank']),
32684
32718
  options: PropTypes$2.object,
32685
32719
  respAreaToolbar: PropTypes$2.func,
32686
- onDelete: PropTypes$2.func
32720
+ onHandleAreaChange: PropTypes$2.func
32687
32721
  }),
32688
32722
  toolbarOpts: PropTypes$2.shape({
32689
32723
  position: PropTypes$2.oneOf(['bottom', 'top']),
@@ -32785,6 +32819,7 @@ class Editor extends React$3.Component {
32785
32819
  type: props.responseAreaProps && props.responseAreaProps.type,
32786
32820
  options: props.responseAreaProps && props.responseAreaProps.options,
32787
32821
  respAreaToolbar: props.responseAreaProps && props.responseAreaProps.respAreaToolbar,
32822
+ onHandleAreaChange: props.responseAreaProps && props.responseAreaProps.onHandleAreaChange,
32788
32823
  onFocus: () => {
32789
32824
  log$3('[table:onFocus]...');
32790
32825
  this.onPluginFocus();
@@ -33088,7 +33123,7 @@ class Editor extends React$3.Component {
33088
33123
  };
33089
33124
  }
33090
33125
  render() {
33091
- const {disabled, highlightShape, classes, className, placeholder, pluginProps, onKeyDown} = this.props;
33126
+ const {disabled, spellCheck, highlightShape, classes, className, placeholder, pluginProps, onKeyDown} = this.props;
33092
33127
  const {value, focusedNode, toolbarOpts} = this.state;
33093
33128
  log$3('[render] value: ', value);
33094
33129
  const sizeStyle = this.buildSizeStyle();
@@ -33105,7 +33140,7 @@ class Editor extends React$3.Component {
33105
33140
  __self: this,
33106
33141
  __source: {
33107
33142
  fileName: _jsxFileName$2,
33108
- lineNumber: 542
33143
+ lineNumber: 547
33109
33144
  }
33110
33145
  }, React$3.createElement(Editor$2, {
33111
33146
  plugins: this.plugins,
@@ -33130,6 +33165,7 @@ class Editor extends React$3.Component {
33130
33165
  focusedNode: focusedNode,
33131
33166
  normalize: this.normalize,
33132
33167
  readOnly: disabled,
33168
+ spellCheck: spellCheck,
33133
33169
  className: classes.slateEditor,
33134
33170
  style: {
33135
33171
  minHeight: sizeStyle.minHeight,
@@ -33143,7 +33179,7 @@ class Editor extends React$3.Component {
33143
33179
  __self: this,
33144
33180
  __source: {
33145
33181
  fileName: _jsxFileName$2,
33146
- lineNumber: 547
33182
+ lineNumber: 552
33147
33183
  }
33148
33184
  }));
33149
33185
  }
@@ -33339,10 +33375,11 @@ class Main extends React$1.Component {
33339
33375
  }
33340
33376
  render() {
33341
33377
  const {model, classes, session} = this.props;
33342
- const {dimensions, disabled, feedback, teacherInstructions, mathInput, animationsDisabled} = model;
33378
+ const {dimensions, disabled, feedback, teacherInstructions, mathInput, animationsDisabled, playersToolbarPosition} = model;
33343
33379
  const {value} = session;
33344
33380
  const {width, height} = dimensions || ({});
33345
33381
  const maxHeight = '40vh';
33382
+ const toolbarOpts = {};
33346
33383
  log$1('[render] disabled? ', disabled);
33347
33384
  const teacherInstructionsDiv = React$1.createElement(PreviewPrompt, {
33348
33385
  defaultClassName: "teacher-instructions",
@@ -33350,9 +33387,17 @@ class Main extends React$1.Component {
33350
33387
  __self: this,
33351
33388
  __source: {
33352
33389
  fileName: _jsxFileName,
33353
- lineNumber: 52
33390
+ lineNumber: 54
33354
33391
  }
33355
33392
  });
33393
+ switch (playersToolbarPosition) {
33394
+ case 'top':
33395
+ toolbarOpts.position = 'top';
33396
+ break;
33397
+ default:
33398
+ toolbarOpts.position = 'bottom';
33399
+ break;
33400
+ }
33356
33401
  return React$1.createElement('div', {
33357
33402
  className: classes.main,
33358
33403
  ref: ref => {
@@ -33361,13 +33406,13 @@ class Main extends React$1.Component {
33361
33406
  __self: this,
33362
33407
  __source: {
33363
33408
  fileName: _jsxFileName,
33364
- lineNumber: 55
33409
+ lineNumber: 66
33365
33410
  }
33366
33411
  }, teacherInstructions && React$1.createElement('div', {
33367
33412
  __self: this,
33368
33413
  __source: {
33369
33414
  fileName: _jsxFileName,
33370
- lineNumber: 63
33415
+ lineNumber: 74
33371
33416
  }
33372
33417
  }, !animationsDisabled ? React$1.createElement(Collapsible, {
33373
33418
  labels: {
@@ -33378,20 +33423,20 @@ class Main extends React$1.Component {
33378
33423
  __self: this,
33379
33424
  __source: {
33380
33425
  fileName: _jsxFileName,
33381
- lineNumber: 65
33426
+ lineNumber: 76
33382
33427
  }
33383
33428
  }, teacherInstructionsDiv) : teacherInstructionsDiv, React$1.createElement('br', {
33384
33429
  __self: this,
33385
33430
  __source: {
33386
33431
  fileName: _jsxFileName,
33387
- lineNumber: 72
33432
+ lineNumber: 83
33388
33433
  }
33389
33434
  })), model.prompt && React$1.createElement(Typography, {
33390
33435
  className: classes.prompt,
33391
33436
  __self: this,
33392
33437
  __source: {
33393
33438
  fileName: _jsxFileName,
33394
- lineNumber: 77
33439
+ lineNumber: 88
33395
33440
  }
33396
33441
  }, React$1.createElement(PreviewPrompt, {
33397
33442
  defaultClassName: "prompt",
@@ -33399,7 +33444,7 @@ class Main extends React$1.Component {
33399
33444
  __self: this,
33400
33445
  __source: {
33401
33446
  fileName: _jsxFileName,
33402
- lineNumber: 80
33447
+ lineNumber: 91
33403
33448
  }
33404
33449
  })), React$1.createElement(EditableHtml, {
33405
33450
  className: "response-area-editor",
@@ -33410,6 +33455,7 @@ class Main extends React$1.Component {
33410
33455
  maxHeight: maxHeight,
33411
33456
  disabled: disabled,
33412
33457
  highlightShape: true,
33458
+ toolbarOpts: toolbarOpts,
33413
33459
  pluginProps: {
33414
33460
  math: {
33415
33461
  disabled: !mathInput,
@@ -33427,19 +33473,19 @@ class Main extends React$1.Component {
33427
33473
  __self: this,
33428
33474
  __source: {
33429
33475
  fileName: _jsxFileName,
33430
- lineNumber: 83
33476
+ lineNumber: 94
33431
33477
  }
33432
33478
  }), feedback && React$1.createElement('div', {
33433
33479
  __self: this,
33434
33480
  __source: {
33435
33481
  fileName: _jsxFileName,
33436
- lineNumber: 108
33482
+ lineNumber: 120
33437
33483
  }
33438
33484
  }, React$1.createElement('br', {
33439
33485
  __self: this,
33440
33486
  __source: {
33441
33487
  fileName: _jsxFileName,
33442
- lineNumber: 109
33488
+ lineNumber: 121
33443
33489
  }
33444
33490
  }), React$1.createElement(Feedback, {
33445
33491
  correctness: "correct",
@@ -33447,7 +33493,7 @@ class Main extends React$1.Component {
33447
33493
  __self: this,
33448
33494
  __source: {
33449
33495
  fileName: _jsxFileName,
33450
- lineNumber: 110
33496
+ lineNumber: 122
33451
33497
  }
33452
33498
  })));
33453
33499
  }
package/module/index.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/extended-text-entry@6.7.8</title>
5
+ <title>@pie-element/extended-text-entry@6.8.2</title>
6
6
  <script
7
7
  type="module"
8
8
  src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "@pie-element/extended-text-entry",
3
- "version": "6.7.8",
3
+ "version": "6.8.2",
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/shared-module",
7
- "version": "^1.2.17"
7
+ "version": "^1.4.1"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/math-rendering-module",
11
- "version": "^1.0.20"
11
+ "version": "^1.0.26"
12
12
  },
13
13
  {
14
14
  "name": "@pie-lib/math-edit-module",
15
- "version": "^1.1.16"
15
+ "version": "^1.1.22"
16
16
  },
17
17
  {
18
18
  "name": "@pie-lib/drag-module",
19
- "version": "^1.0.18"
19
+ "version": "^1.0.24"
20
20
  }
21
21
  ]
22
22
  }
@@ -12,7 +12,8 @@ generate.model = (id, element) => ({
12
12
  prompt: 'This is the question prompt',
13
13
  promptEnabled: true,
14
14
  mathInput: true,
15
- toolbarEditorPosition: 'bottom',
15
+ playersToolbarPosition: 'bottom',
16
+ toolbarEditorPosition: 'bottom'
16
17
  });
17
18
 
18
19
  const { model } = generate;
package/module/print.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/extended-text-entry@6.7.8</title>
5
+ <title>@pie-element/extended-text-entry@6.8.2</title>
6
6
  <link
7
7
  href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
8
8
  rel="stylesheet"