@pie-element/complex-rubric 2.11.1-next.14 → 2.11.1-next.4

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.
@@ -7,7 +7,7 @@
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
9
  "dependencies": {
10
- "@pie-lib/pie-toolbox": "1.20.1",
10
+ "@pie-lib/pie-toolbox": "1.20.0",
11
11
  "lodash": "^4.17.15"
12
12
  },
13
13
  "author": "",
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.13.0/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.12.1/module/index.js";
2
2
  import RubricConfigure from '@pie-element/rubric/configure/lib';
3
3
  import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@4.12.0/module/index.js";
4
4
  function _mergeNamespaces(n, m) {
@@ -145090,41 +145090,50 @@ const require$$8$e = _dll_prop_types;
145090
145090
  node: _propTypes["default"].object
145091
145091
  };
145092
145092
  core.normalizeNode = function (node) {
145093
- var addNodeBeforeArray = [];
145094
- if (node.object !== 'document') return;
145095
- node.findDescendant(function (d) {
145096
- if (d.type === 'table') {
145097
- var tablePath = node.getPath(d.key);
145098
- var prevNode = node.getPreviousNode(tablePath);
145099
- var nextNode = node.getNextNode(tablePath);
145100
- if (!prevNode || !nextNode) {
145101
- addNodeBeforeArray.push({
145102
- node: d,
145103
- prevNode: prevNode,
145104
- nextNode: nextNode
145105
- });
145106
- }
145107
- }
145093
+ if (node.object !== 'document') {
145094
+ return;
145095
+ }
145096
+ var tableAdded = node.findDescendant(function (d) {
145097
+ return d.data && d.data.get('newTable');
145108
145098
  });
145109
- if (!addNodeBeforeArray.length) {
145099
+ if (!tableAdded) {
145100
+ return;
145101
+ }
145102
+ var nodeToSearch = node.getParent(tableAdded.key) || node;
145103
+ var shouldAddTextAfterNode = false;
145104
+ var indexToNotHaveTableOn = nodeToSearch.nodes.size - 1;
145105
+ var indexOfLastTable = nodeToSearch.nodes.findLastIndex(function (d) {
145106
+ return d.type === 'table';
145107
+ });
145108
+ if (indexOfLastTable === indexToNotHaveTableOn) {
145109
+ shouldAddTextAfterNode = true;
145110
+ }
145111
+ if (!shouldAddTextAfterNode) {
145110
145112
  return;
145111
145113
  }
145112
145114
  return function (change) {
145113
- var newBlock = {
145114
- object: 'block',
145115
- type: 'div'
145116
- };
145117
- addNodeBeforeArray.forEach(function (n) {
145118
- var tablePath = change.value.document.getPath(n.node.key).toJSON();
145119
- var indexToAdd = tablePath.splice(-1)[0];
145120
- if (!n.prevNode) {
145121
- change.insertNodeByPath(tablePath, indexToAdd, newBlock);
145122
- return;
145123
- }
145124
- if (!n.nextNode) {
145125
- change.insertNodeByPath(tablePath, indexToAdd + 1, newBlock);
145126
- }
145127
- });
145115
+ if (shouldAddTextAfterNode) {
145116
+ var tableJSON = tableAdded.toJSON();
145117
+ change.removeNodeByKey(tableAdded.key);
145118
+ var newBlock = _slate.Block.create({
145119
+ object: 'block',
145120
+ type: 'div'
145121
+ });
145122
+ change.insertBlock(newBlock);
145123
+ change.withoutNormalization(function () {
145124
+ var prevText = change.value.document.getPreviousText(newBlock.key);
145125
+ if (prevText) {
145126
+ var _prevText$text, _prevText$text2;
145127
+ change.moveFocusTo(prevText.key, (_prevText$text = prevText.text) === null || _prevText$text === void 0 ? void 0 : _prevText$text.length).moveAnchorTo(prevText.key, (_prevText$text2 = prevText.text) === null || _prevText$text2 === void 0 ? void 0 : _prevText$text2.length);
145128
+ }
145129
+ change.insertBlock(_objectSpread(_objectSpread({}, tableJSON), {}, {
145130
+ data: _objectSpread(_objectSpread({}, tableJSON.data), {}, {
145131
+ newTable: true
145132
+ })
145133
+ }));
145134
+ moveFocusToBeginningOfTable(change);
145135
+ });
145136
+ }
145128
145137
  };
145129
145138
  };
145130
145139
  core.renderNode = Node;
package/module/element.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.13.0/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.12.1/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.12.0/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
@@ -135281,41 +135281,50 @@ const require$$8$f = _dll_prop_types;
135281
135281
  node: _propTypes["default"].object
135282
135282
  };
135283
135283
  core.normalizeNode = function (node) {
135284
- var addNodeBeforeArray = [];
135285
- if (node.object !== 'document') return;
135286
- node.findDescendant(function (d) {
135287
- if (d.type === 'table') {
135288
- var tablePath = node.getPath(d.key);
135289
- var prevNode = node.getPreviousNode(tablePath);
135290
- var nextNode = node.getNextNode(tablePath);
135291
- if (!prevNode || !nextNode) {
135292
- addNodeBeforeArray.push({
135293
- node: d,
135294
- prevNode: prevNode,
135295
- nextNode: nextNode
135296
- });
135297
- }
135298
- }
135284
+ if (node.object !== 'document') {
135285
+ return;
135286
+ }
135287
+ var tableAdded = node.findDescendant(function (d) {
135288
+ return d.data && d.data.get('newTable');
135299
135289
  });
135300
- if (!addNodeBeforeArray.length) {
135290
+ if (!tableAdded) {
135291
+ return;
135292
+ }
135293
+ var nodeToSearch = node.getParent(tableAdded.key) || node;
135294
+ var shouldAddTextAfterNode = false;
135295
+ var indexToNotHaveTableOn = nodeToSearch.nodes.size - 1;
135296
+ var indexOfLastTable = nodeToSearch.nodes.findLastIndex(function (d) {
135297
+ return d.type === 'table';
135298
+ });
135299
+ if (indexOfLastTable === indexToNotHaveTableOn) {
135300
+ shouldAddTextAfterNode = true;
135301
+ }
135302
+ if (!shouldAddTextAfterNode) {
135301
135303
  return;
135302
135304
  }
135303
135305
  return function (change) {
135304
- var newBlock = {
135305
- object: 'block',
135306
- type: 'div'
135307
- };
135308
- addNodeBeforeArray.forEach(function (n) {
135309
- var tablePath = change.value.document.getPath(n.node.key).toJSON();
135310
- var indexToAdd = tablePath.splice(-1)[0];
135311
- if (!n.prevNode) {
135312
- change.insertNodeByPath(tablePath, indexToAdd, newBlock);
135313
- return;
135314
- }
135315
- if (!n.nextNode) {
135316
- change.insertNodeByPath(tablePath, indexToAdd + 1, newBlock);
135317
- }
135318
- });
135306
+ if (shouldAddTextAfterNode) {
135307
+ var tableJSON = tableAdded.toJSON();
135308
+ change.removeNodeByKey(tableAdded.key);
135309
+ var newBlock = _slate.Block.create({
135310
+ object: 'block',
135311
+ type: 'div'
135312
+ });
135313
+ change.insertBlock(newBlock);
135314
+ change.withoutNormalization(function () {
135315
+ var prevText = change.value.document.getPreviousText(newBlock.key);
135316
+ if (prevText) {
135317
+ var _prevText$text, _prevText$text2;
135318
+ change.moveFocusTo(prevText.key, (_prevText$text = prevText.text) === null || _prevText$text === void 0 ? void 0 : _prevText$text.length).moveAnchorTo(prevText.key, (_prevText$text2 = prevText.text) === null || _prevText$text2 === void 0 ? void 0 : _prevText$text2.length);
135319
+ }
135320
+ change.insertBlock(_objectSpread(_objectSpread({}, tableJSON), {}, {
135321
+ data: _objectSpread(_objectSpread({}, tableJSON.data), {}, {
135322
+ newTable: true
135323
+ })
135324
+ }));
135325
+ moveFocusToBeginningOfTable(change);
135326
+ });
135327
+ }
135319
135328
  };
135320
135329
  };
135321
135330
  core.renderNode = Node;
@@ -4,7 +4,7 @@
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "1.13.0"
7
+ "version": "1.12.1"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
package/module/print.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.13.0/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.12.1/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.12.0/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
@@ -135281,41 +135281,50 @@ const require$$8$f = _dll_prop_types;
135281
135281
  node: _propTypes["default"].object
135282
135282
  };
135283
135283
  core.normalizeNode = function (node) {
135284
- var addNodeBeforeArray = [];
135285
- if (node.object !== 'document') return;
135286
- node.findDescendant(function (d) {
135287
- if (d.type === 'table') {
135288
- var tablePath = node.getPath(d.key);
135289
- var prevNode = node.getPreviousNode(tablePath);
135290
- var nextNode = node.getNextNode(tablePath);
135291
- if (!prevNode || !nextNode) {
135292
- addNodeBeforeArray.push({
135293
- node: d,
135294
- prevNode: prevNode,
135295
- nextNode: nextNode
135296
- });
135297
- }
135298
- }
135284
+ if (node.object !== 'document') {
135285
+ return;
135286
+ }
135287
+ var tableAdded = node.findDescendant(function (d) {
135288
+ return d.data && d.data.get('newTable');
135299
135289
  });
135300
- if (!addNodeBeforeArray.length) {
135290
+ if (!tableAdded) {
135291
+ return;
135292
+ }
135293
+ var nodeToSearch = node.getParent(tableAdded.key) || node;
135294
+ var shouldAddTextAfterNode = false;
135295
+ var indexToNotHaveTableOn = nodeToSearch.nodes.size - 1;
135296
+ var indexOfLastTable = nodeToSearch.nodes.findLastIndex(function (d) {
135297
+ return d.type === 'table';
135298
+ });
135299
+ if (indexOfLastTable === indexToNotHaveTableOn) {
135300
+ shouldAddTextAfterNode = true;
135301
+ }
135302
+ if (!shouldAddTextAfterNode) {
135301
135303
  return;
135302
135304
  }
135303
135305
  return function (change) {
135304
- var newBlock = {
135305
- object: 'block',
135306
- type: 'div'
135307
- };
135308
- addNodeBeforeArray.forEach(function (n) {
135309
- var tablePath = change.value.document.getPath(n.node.key).toJSON();
135310
- var indexToAdd = tablePath.splice(-1)[0];
135311
- if (!n.prevNode) {
135312
- change.insertNodeByPath(tablePath, indexToAdd, newBlock);
135313
- return;
135314
- }
135315
- if (!n.nextNode) {
135316
- change.insertNodeByPath(tablePath, indexToAdd + 1, newBlock);
135317
- }
135318
- });
135306
+ if (shouldAddTextAfterNode) {
135307
+ var tableJSON = tableAdded.toJSON();
135308
+ change.removeNodeByKey(tableAdded.key);
135309
+ var newBlock = _slate.Block.create({
135310
+ object: 'block',
135311
+ type: 'div'
135312
+ });
135313
+ change.insertBlock(newBlock);
135314
+ change.withoutNormalization(function () {
135315
+ var prevText = change.value.document.getPreviousText(newBlock.key);
135316
+ if (prevText) {
135317
+ var _prevText$text, _prevText$text2;
135318
+ change.moveFocusTo(prevText.key, (_prevText$text = prevText.text) === null || _prevText$text === void 0 ? void 0 : _prevText$text.length).moveAnchorTo(prevText.key, (_prevText$text2 = prevText.text) === null || _prevText$text2 === void 0 ? void 0 : _prevText$text2.length);
135319
+ }
135320
+ change.insertBlock(_objectSpread(_objectSpread({}, tableJSON), {}, {
135321
+ data: _objectSpread(_objectSpread({}, tableJSON.data), {}, {
135322
+ newTable: true
135323
+ })
135324
+ }));
135325
+ moveFocusToBeginningOfTable(change);
135326
+ });
135327
+ }
135319
135328
  };
135320
135329
  };
135321
135330
  core.renderNode = Node;
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@pie-element/complex-rubric",
3
3
  "repository": "pie-framework/pie-elements",
4
- "version": "2.11.1-next.14+5684f4f62",
4
+ "version": "2.11.1-next.4+dc2d40703",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "dependencies": {
9
9
  "@material-ui/core": "^3.9.2",
10
- "@pie-element/multi-trait-rubric": "^3.11.1-next.14+5684f4f62",
11
- "@pie-element/rubric": "^3.11.1-next.14+5684f4f62",
10
+ "@pie-element/multi-trait-rubric": "^3.11.1-next.4+dc2d40703",
11
+ "@pie-element/rubric": "^3.11.1-next.4+dc2d40703",
12
12
  "@pie-framework/pie-player-events": "^0.1.0",
13
13
  "classnames": "^2.2.5",
14
14
  "debug": "^4.1.1",
15
15
  "lodash": "^4.17.11",
16
16
  "prop-types": "^15.7.2"
17
17
  },
18
- "gitHead": "5684f4f62514a113e675718a8ae76613004883bf",
18
+ "gitHead": "dc2d40703768c722e59a1009b92a0b108d384046",
19
19
  "scripts": {
20
20
  "postpublish": "../../scripts/postpublish"
21
21
  },