@pie-element/explicit-constructed-response 7.3.4-next.0 → 7.3.4-next.11

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.
@@ -8,7 +8,7 @@
8
8
  "@material-ui/core": "^3.9.2",
9
9
  "@material-ui/icons": "^3.0.1",
10
10
  "@pie-framework/pie-configure-events": "^1.3.0",
11
- "@pie-lib/pie-toolbox": "2.9.2",
11
+ "@pie-lib/pie-toolbox": "2.9.3",
12
12
  "classnames": "^2.2.6",
13
13
  "debug": "^3.1.0",
14
14
  "lodash": "^4.17.15",
@@ -8,7 +8,7 @@
8
8
  "author": "",
9
9
  "license": "ISC",
10
10
  "dependencies": {
11
- "@pie-lib/pie-toolbox": "2.9.2",
11
+ "@pie-lib/pie-toolbox": "2.9.3",
12
12
  "debug": "^3.1.0",
13
13
  "lodash": "^4.17.15",
14
14
  "type-of": "^2.0.1"
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.1/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@5.10.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.2/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@5.10.2/module/index.js";
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
  function getDefaultExportFromCjs(x) {
5
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
package/module/element.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_classnames, _dll_react_dom, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.1/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.10.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_classnames, _dll_react_dom, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.2/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.10.2/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
5
5
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
@@ -140667,7 +140667,7 @@ const require$$11$s = _dll_prop_types;
140667
140667
  },
140668
140668
  label: {
140669
140669
  color: ("").concat(color.text(), " !important"),
140670
- display: 'inline-block',
140670
+ display: 'flex',
140671
140671
  verticalAlign: 'middle',
140672
140672
  cursor: 'pointer',
140673
140673
  '& > p': {
@@ -176382,36 +176382,74 @@ var reduceRedundantNewLineCharacters = function reduceRedundantNewLineCharacters
176382
176382
  }
176383
176383
  return markup;
176384
176384
  };
176385
- var wrapHtmlProperly = function wrapHtmlProperly(markup) {
176386
- var el = document.createElement('div');
176387
- el.innerHTML = markup;
176385
+ var fixHtmlCode = function fixHtmlCode(markup) {
176386
+ var wrapperEl = document.createElement('div');
176387
+ wrapperEl.innerHTML = markup;
176388
+ var fixParagraphs = function fixParagraphs(child) {
176389
+ var p = document.createElement('p');
176390
+ p.innerHTML = child.innerHTML;
176391
+ Array.from(child.attributes).forEach(function (attr) {
176392
+ p.setAttribute(attr.name, attr.value);
176393
+ });
176394
+ child.replaceWith(p);
176395
+ };
176396
+ var fixTables = function fixTables(tableArray) {
176397
+ tableArray.forEach(function (el) {
176398
+ var index = el.index, child = el.child, parent = el.parent;
176399
+ var nodesBefore = [];
176400
+ var nodesAfter = [];
176401
+ var allNodes = Array.from(parent.childNodes);
176402
+ var i;
176403
+ for (i = 0; i < allNodes.length; i++) {
176404
+ var node = allNodes[i];
176405
+ if (i < index) {
176406
+ nodesBefore.push(node);
176407
+ } else if (i > index) {
176408
+ nodesAfter.push(node);
176409
+ }
176410
+ }
176411
+ var beforeEl = document.createElement(parent.nodeName);
176412
+ beforeEl.append.apply(beforeEl, nodesBefore);
176413
+ parent.replaceWith(beforeEl);
176414
+ beforeEl.after(child);
176415
+ var afterEl = document.createElement(parent.nodeName);
176416
+ afterEl.append.apply(afterEl, nodesAfter);
176417
+ child.after(afterEl);
176418
+ });
176419
+ };
176388
176420
  var parseNode = function parseNode(el) {
176389
- var childArray = Array.from(el.children);
176421
+ var childArray = Array.from(el.childNodes);
176390
176422
  var hasParagraphs = childArray.find(function (child) {
176391
176423
  return child.nodeName === 'P';
176392
176424
  });
176393
- childArray.forEach(function (child) {
176425
+ var tables = [];
176426
+ childArray.forEach(function (child, index) {
176394
176427
  if ((child.nodeName === 'DIV' || child.nodeName === 'P') && child.childNodes.length === 0) {
176395
176428
  child.remove();
176396
176429
  return;
176397
176430
  }
176398
176431
  if (hasParagraphs && child.nodeName === 'DIV') {
176399
- var p = document.createElement('p');
176400
- p.innerHTML = child.innerHTML;
176401
- Array.from(child.attributes).forEach(function (attr) {
176402
- p.setAttribute(attr.name, attr.value);
176432
+ fixParagraphs(child);
176433
+ }
176434
+ if (wrapperEl !== el && child.nodeName === 'TABLE') {
176435
+ tables.push({
176436
+ index: index,
176437
+ child: child,
176438
+ parent: el
176403
176439
  });
176404
- child.replaceWith(p);
176405
176440
  }
176406
176441
  parseNode(child);
176407
176442
  });
176443
+ if (tables.length) {
176444
+ fixTables(tables);
176445
+ }
176408
176446
  };
176409
- parseNode(el);
176410
- return el.innerHTML;
176447
+ parseNode(wrapperEl);
176448
+ return wrapperEl.innerHTML;
176411
176449
  };
176412
176450
  var htmlToValue = function htmlToValue(html) {
176413
176451
  try {
176414
- return serializer.deserialize(wrapHtmlProperly(reduceRedundantNewLineCharacters(reduceMultipleBrs(html))));
176452
+ return serializer.deserialize(fixHtmlCode(reduceRedundantNewLineCharacters(reduceMultipleBrs(html))));
176415
176453
  } catch (e) {
176416
176454
  console.log("Couldn't parse html: ", e);
176417
176455
  return {};
@@ -4,11 +4,11 @@
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "3.3.1"
7
+ "version": "3.3.2"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
11
- "version": "5.10.1"
11
+ "version": "5.10.2"
12
12
  }
13
13
  ]
14
14
  }
package/module/print.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_classnames, _dll_react_dom, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.1/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.10.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_classnames, _dll_react_dom, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.2/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.10.2/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
5
5
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
@@ -140630,7 +140630,7 @@ const require$$11$s = _dll_prop_types;
140630
140630
  },
140631
140631
  label: {
140632
140632
  color: ("").concat(color.text(), " !important"),
140633
- display: 'inline-block',
140633
+ display: 'flex',
140634
140634
  verticalAlign: 'middle',
140635
140635
  cursor: 'pointer',
140636
140636
  '& > p': {
@@ -176345,36 +176345,74 @@ var reduceRedundantNewLineCharacters = function reduceRedundantNewLineCharacters
176345
176345
  }
176346
176346
  return markup;
176347
176347
  };
176348
- var wrapHtmlProperly = function wrapHtmlProperly(markup) {
176349
- var el = document.createElement('div');
176350
- el.innerHTML = markup;
176348
+ var fixHtmlCode = function fixHtmlCode(markup) {
176349
+ var wrapperEl = document.createElement('div');
176350
+ wrapperEl.innerHTML = markup;
176351
+ var fixParagraphs = function fixParagraphs(child) {
176352
+ var p = document.createElement('p');
176353
+ p.innerHTML = child.innerHTML;
176354
+ Array.from(child.attributes).forEach(function (attr) {
176355
+ p.setAttribute(attr.name, attr.value);
176356
+ });
176357
+ child.replaceWith(p);
176358
+ };
176359
+ var fixTables = function fixTables(tableArray) {
176360
+ tableArray.forEach(function (el) {
176361
+ var index = el.index, child = el.child, parent = el.parent;
176362
+ var nodesBefore = [];
176363
+ var nodesAfter = [];
176364
+ var allNodes = Array.from(parent.childNodes);
176365
+ var i;
176366
+ for (i = 0; i < allNodes.length; i++) {
176367
+ var node = allNodes[i];
176368
+ if (i < index) {
176369
+ nodesBefore.push(node);
176370
+ } else if (i > index) {
176371
+ nodesAfter.push(node);
176372
+ }
176373
+ }
176374
+ var beforeEl = document.createElement(parent.nodeName);
176375
+ beforeEl.append.apply(beforeEl, nodesBefore);
176376
+ parent.replaceWith(beforeEl);
176377
+ beforeEl.after(child);
176378
+ var afterEl = document.createElement(parent.nodeName);
176379
+ afterEl.append.apply(afterEl, nodesAfter);
176380
+ child.after(afterEl);
176381
+ });
176382
+ };
176351
176383
  var parseNode = function parseNode(el) {
176352
- var childArray = Array.from(el.children);
176384
+ var childArray = Array.from(el.childNodes);
176353
176385
  var hasParagraphs = childArray.find(function (child) {
176354
176386
  return child.nodeName === 'P';
176355
176387
  });
176356
- childArray.forEach(function (child) {
176388
+ var tables = [];
176389
+ childArray.forEach(function (child, index) {
176357
176390
  if ((child.nodeName === 'DIV' || child.nodeName === 'P') && child.childNodes.length === 0) {
176358
176391
  child.remove();
176359
176392
  return;
176360
176393
  }
176361
176394
  if (hasParagraphs && child.nodeName === 'DIV') {
176362
- var p = document.createElement('p');
176363
- p.innerHTML = child.innerHTML;
176364
- Array.from(child.attributes).forEach(function (attr) {
176365
- p.setAttribute(attr.name, attr.value);
176395
+ fixParagraphs(child);
176396
+ }
176397
+ if (wrapperEl !== el && child.nodeName === 'TABLE') {
176398
+ tables.push({
176399
+ index: index,
176400
+ child: child,
176401
+ parent: el
176366
176402
  });
176367
- child.replaceWith(p);
176368
176403
  }
176369
176404
  parseNode(child);
176370
176405
  });
176406
+ if (tables.length) {
176407
+ fixTables(tables);
176408
+ }
176371
176409
  };
176372
- parseNode(el);
176373
- return el.innerHTML;
176410
+ parseNode(wrapperEl);
176411
+ return wrapperEl.innerHTML;
176374
176412
  };
176375
176413
  var htmlToValue = function htmlToValue(html) {
176376
176414
  try {
176377
- return serializer.deserialize(wrapHtmlProperly(reduceRedundantNewLineCharacters(reduceMultipleBrs(html))));
176415
+ return serializer.deserialize(fixHtmlCode(reduceRedundantNewLineCharacters(reduceMultipleBrs(html))));
176378
176416
  } catch (e) {
176379
176417
  console.log("Couldn't parse html: ", e);
176380
176418
  return {};
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "7.3.4-next.0+9c442d981",
7
+ "version": "7.3.4-next.11+9ab7c3e03",
8
8
  "description": "",
9
9
  "scripts": {
10
10
  "postpublish": "../../scripts/postpublish"
@@ -12,7 +12,7 @@
12
12
  "dependencies": {
13
13
  "@material-ui/core": "^3.9.2",
14
14
  "@pie-framework/pie-player-events": "^0.1.0",
15
- "@pie-lib/pie-toolbox": "2.9.2",
15
+ "@pie-lib/pie-toolbox": "2.9.3",
16
16
  "classnames": "^2.2.5",
17
17
  "lodash": "^4.17.10",
18
18
  "prop-types": "^15.6.1",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "author": "",
23
23
  "license": "ISC",
24
- "gitHead": "9c442d98161ec031607b6953435694826911b0f5",
24
+ "gitHead": "9ab7c3e03dc26a84de7a5df5e0dd0a8d3d5a5e7b",
25
25
  "main": "lib/index.js",
26
26
  "module": "src/index.js",
27
27
  "exports": {