@atlaskit/adf-schema 25.1.0 → 25.2.0

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.
Files changed (249) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/index.js +0 -2
  3. package/dist/cjs/json-schema/index.js +0 -3
  4. package/dist/cjs/schema/bitbucket-schema.js +0 -2
  5. package/dist/cjs/schema/confluence-schema.js +1 -4
  6. package/dist/cjs/schema/create-schema.js +12 -38
  7. package/dist/cjs/schema/default-schema.js +3 -16
  8. package/dist/cjs/schema/groups.js +13 -6
  9. package/dist/cjs/schema/index.js +0 -5
  10. package/dist/cjs/schema/inline-nodes.js +0 -5
  11. package/dist/cjs/schema/jira-schema.js +0 -36
  12. package/dist/cjs/schema/marks/alignment.js +0 -2
  13. package/dist/cjs/schema/marks/annotation.js +2 -14
  14. package/dist/cjs/schema/marks/code.js +0 -5
  15. package/dist/cjs/schema/marks/confluence-inline-comment.js +1 -1
  16. package/dist/cjs/schema/marks/data-consumer.js +2 -7
  17. package/dist/cjs/schema/marks/em.js +0 -2
  18. package/dist/cjs/schema/marks/fragment.js +0 -13
  19. package/dist/cjs/schema/marks/indentation.js +0 -2
  20. package/dist/cjs/schema/marks/index.js +0 -18
  21. package/dist/cjs/schema/marks/link.js +0 -17
  22. package/dist/cjs/schema/marks/strike.js +0 -2
  23. package/dist/cjs/schema/marks/strong.js +2 -3
  24. package/dist/cjs/schema/marks/subsup.js +0 -5
  25. package/dist/cjs/schema/marks/text-color.js +46 -37
  26. package/dist/cjs/schema/marks/type-ahead-query.js +0 -3
  27. package/dist/cjs/schema/marks/underline.js +0 -2
  28. package/dist/cjs/schema/nodes/block-card.js +1 -2
  29. package/dist/cjs/schema/nodes/blockquote.js +1 -1
  30. package/dist/cjs/schema/nodes/bodied-extension.js +0 -3
  31. package/dist/cjs/schema/nodes/caption.js +1 -1
  32. package/dist/cjs/schema/nodes/code-block.js +11 -29
  33. package/dist/cjs/schema/nodes/date.js +1 -1
  34. package/dist/cjs/schema/nodes/decision-item.js +2 -4
  35. package/dist/cjs/schema/nodes/decision-list.js +0 -2
  36. package/dist/cjs/schema/nodes/doc.js +1 -1
  37. package/dist/cjs/schema/nodes/embed-card.js +6 -6
  38. package/dist/cjs/schema/nodes/emoji.js +11 -9
  39. package/dist/cjs/schema/nodes/expand.js +1 -4
  40. package/dist/cjs/schema/nodes/extension.js +0 -3
  41. package/dist/cjs/schema/nodes/hard-break.js +1 -1
  42. package/dist/cjs/schema/nodes/heading.js +2 -2
  43. package/dist/cjs/schema/nodes/index.js +0 -45
  44. package/dist/cjs/schema/nodes/inline-card.js +4 -4
  45. package/dist/cjs/schema/nodes/inline-extension.js +0 -3
  46. package/dist/cjs/schema/nodes/layout-column.js +4 -5
  47. package/dist/cjs/schema/nodes/layout-section.js +1 -1
  48. package/dist/cjs/schema/nodes/media-group.js +1 -1
  49. package/dist/cjs/schema/nodes/media-inline.js +0 -2
  50. package/dist/cjs/schema/nodes/media-single.js +3 -14
  51. package/dist/cjs/schema/nodes/media.js +10 -28
  52. package/dist/cjs/schema/nodes/mention.js +4 -14
  53. package/dist/cjs/schema/nodes/nested-expand.js +1 -1
  54. package/dist/cjs/schema/nodes/ordered-list.js +3 -17
  55. package/dist/cjs/schema/nodes/panel.js +1 -13
  56. package/dist/cjs/schema/nodes/paragraph.js +1 -6
  57. package/dist/cjs/schema/nodes/placeholder.js +1 -1
  58. package/dist/cjs/schema/nodes/rule.js +1 -1
  59. package/dist/cjs/schema/nodes/status.js +4 -6
  60. package/dist/cjs/schema/nodes/tableNodes.js +12 -39
  61. package/dist/cjs/schema/nodes/task-item.js +2 -4
  62. package/dist/cjs/schema/nodes/task-list.js +0 -2
  63. package/dist/cjs/schema/nodes/text.js +1 -1
  64. package/dist/cjs/steps/analytics.js +4 -38
  65. package/dist/cjs/steps/set-attrs.js +0 -26
  66. package/dist/cjs/steps/table/add-column.js +33 -105
  67. package/dist/cjs/steps/table/constants.js +0 -1
  68. package/dist/cjs/steps/table/sort-column.js +0 -19
  69. package/dist/cjs/steps/table/utils/cell-step.js +18 -49
  70. package/dist/cjs/steps/table/utils/cells-at-column.js +2 -21
  71. package/dist/cjs/steps/table/utils/find-column.js +13 -17
  72. package/dist/cjs/steps/table/utils/get-table-rect-from-doc.js +6 -8
  73. package/dist/cjs/steps/table/utils/side-effects/rows.js +23 -78
  74. package/dist/cjs/steps/table/utils/side-effects/side-effects.js +0 -23
  75. package/dist/cjs/steps/table/utils/side-effects/table.js +2 -18
  76. package/dist/cjs/steps/table/utils/table-map.js +0 -6
  77. package/dist/cjs/steps/type-ahead.js +5 -25
  78. package/dist/cjs/steps.js +0 -6
  79. package/dist/cjs/utils/colors.js +13 -36
  80. package/dist/cjs/utils/confluence/emoji.js +6 -13
  81. package/dist/cjs/utils/extensions.js +0 -8
  82. package/dist/cjs/utils/index.js +0 -4
  83. package/dist/cjs/utils/parseDOM.js +0 -2
  84. package/dist/cjs/utils/url.js +3 -20
  85. package/dist/cjs/utils/uuid.js +0 -3
  86. package/dist/cjs/version.json +1 -1
  87. package/dist/es2019/index.js +1 -2
  88. package/dist/es2019/schema/bitbucket-schema.js +1 -1
  89. package/dist/es2019/schema/confluence-schema.js +1 -2
  90. package/dist/es2019/schema/create-schema.js +12 -25
  91. package/dist/es2019/schema/default-schema.js +3 -11
  92. package/dist/es2019/schema/groups.js +13 -6
  93. package/dist/es2019/schema/index.js +1 -2
  94. package/dist/es2019/schema/jira-schema.js +0 -24
  95. package/dist/es2019/schema/marks/alignment.js +1 -3
  96. package/dist/es2019/schema/marks/annotation.js +3 -9
  97. package/dist/es2019/schema/marks/breakout.js +0 -4
  98. package/dist/es2019/schema/marks/code.js +1 -5
  99. package/dist/es2019/schema/marks/confluence-inline-comment.js +1 -2
  100. package/dist/es2019/schema/marks/data-consumer.js +3 -5
  101. package/dist/es2019/schema/marks/em.js +1 -2
  102. package/dist/es2019/schema/marks/fragment.js +0 -8
  103. package/dist/es2019/schema/marks/indentation.js +0 -4
  104. package/dist/es2019/schema/marks/link.js +2 -11
  105. package/dist/es2019/schema/marks/strike.js +1 -2
  106. package/dist/es2019/schema/marks/strong.js +3 -7
  107. package/dist/es2019/schema/marks/subsup.js +0 -6
  108. package/dist/es2019/schema/marks/text-color.js +44 -29
  109. package/dist/es2019/schema/marks/type-ahead-query.js +0 -2
  110. package/dist/es2019/schema/marks/underline.js +1 -2
  111. package/dist/es2019/schema/marks/unsupported-mark.js +0 -1
  112. package/dist/es2019/schema/marks/unsupported-node-attributes.js +0 -1
  113. package/dist/es2019/schema/nodes/block-card.js +1 -3
  114. package/dist/es2019/schema/nodes/blockquote.js +1 -2
  115. package/dist/es2019/schema/nodes/bodied-extension.js +0 -4
  116. package/dist/es2019/schema/nodes/bullet-list.js +0 -2
  117. package/dist/es2019/schema/nodes/caption.js +1 -2
  118. package/dist/es2019/schema/nodes/code-block.js +11 -28
  119. package/dist/es2019/schema/nodes/confluence-jira-issue.js +0 -2
  120. package/dist/es2019/schema/nodes/confluence-unsupported-block.js +0 -4
  121. package/dist/es2019/schema/nodes/confluence-unsupported-inline.js +0 -4
  122. package/dist/es2019/schema/nodes/date.js +1 -2
  123. package/dist/es2019/schema/nodes/decision-item.js +0 -2
  124. package/dist/es2019/schema/nodes/decision-list.js +1 -2
  125. package/dist/es2019/schema/nodes/doc.js +1 -0
  126. package/dist/es2019/schema/nodes/embed-card.js +1 -2
  127. package/dist/es2019/schema/nodes/emoji.js +9 -6
  128. package/dist/es2019/schema/nodes/expand.js +1 -3
  129. package/dist/es2019/schema/nodes/extension.js +0 -4
  130. package/dist/es2019/schema/nodes/hard-break.js +1 -2
  131. package/dist/es2019/schema/nodes/heading.js +2 -3
  132. package/dist/es2019/schema/nodes/image.js +0 -4
  133. package/dist/es2019/schema/nodes/inline-card.js +4 -5
  134. package/dist/es2019/schema/nodes/inline-extension.js +0 -4
  135. package/dist/es2019/schema/nodes/layout-column.js +4 -6
  136. package/dist/es2019/schema/nodes/layout-section.js +1 -4
  137. package/dist/es2019/schema/nodes/list-item.js +0 -2
  138. package/dist/es2019/schema/nodes/media-group.js +1 -2
  139. package/dist/es2019/schema/nodes/media-single.js +3 -6
  140. package/dist/es2019/schema/nodes/media.js +10 -20
  141. package/dist/es2019/schema/nodes/mention.js +0 -11
  142. package/dist/es2019/schema/nodes/nested-expand.js +1 -2
  143. package/dist/es2019/schema/nodes/ordered-list.js +4 -14
  144. package/dist/es2019/schema/nodes/panel.js +3 -10
  145. package/dist/es2019/schema/nodes/paragraph.js +1 -7
  146. package/dist/es2019/schema/nodes/placeholder.js +1 -2
  147. package/dist/es2019/schema/nodes/rule.js +1 -2
  148. package/dist/es2019/schema/nodes/status.js +1 -2
  149. package/dist/es2019/schema/nodes/tableNodes.js +10 -26
  150. package/dist/es2019/schema/nodes/task-item.js +0 -2
  151. package/dist/es2019/schema/nodes/task-list.js +0 -2
  152. package/dist/es2019/schema/nodes/text.js +1 -0
  153. package/dist/es2019/schema/nodes/unknown-block.js +0 -2
  154. package/dist/es2019/schema/nodes/unsupported-block.js +0 -2
  155. package/dist/es2019/schema/nodes/unsupported-inline.js +0 -2
  156. package/dist/es2019/steps/analytics.js +13 -30
  157. package/dist/es2019/steps/set-attrs.js +3 -12
  158. package/dist/es2019/steps/table/add-column.js +33 -76
  159. package/dist/es2019/steps/table/constants.js +0 -1
  160. package/dist/es2019/steps/table/sort-column.js +1 -8
  161. package/dist/es2019/steps/table/utils/cell-step.js +15 -32
  162. package/dist/es2019/steps/table/utils/cells-at-column.js +6 -11
  163. package/dist/es2019/steps/table/utils/find-column.js +12 -15
  164. package/dist/es2019/steps/table/utils/get-table-rect-from-doc.js +7 -6
  165. package/dist/es2019/steps/table/utils/side-effects/rows.js +19 -59
  166. package/dist/es2019/steps/table/utils/side-effects/side-effects.js +0 -21
  167. package/dist/es2019/steps/table/utils/side-effects/table.js +0 -17
  168. package/dist/es2019/steps/type-ahead.js +3 -15
  169. package/dist/es2019/utils/colors.js +8 -18
  170. package/dist/es2019/utils/confluence/emoji.js +5 -8
  171. package/dist/es2019/utils/extensions.js +0 -4
  172. package/dist/es2019/utils/url.js +2 -12
  173. package/dist/es2019/utils/uuid.js +0 -2
  174. package/dist/es2019/version.json +1 -1
  175. package/dist/esm/index.js +1 -2
  176. package/dist/esm/schema/bitbucket-schema.js +1 -1
  177. package/dist/esm/schema/confluence-schema.js +1 -2
  178. package/dist/esm/schema/create-schema.js +12 -31
  179. package/dist/esm/schema/default-schema.js +3 -11
  180. package/dist/esm/schema/groups.js +13 -6
  181. package/dist/esm/schema/index.js +1 -2
  182. package/dist/esm/schema/jira-schema.js +0 -24
  183. package/dist/esm/schema/marks/alignment.js +1 -1
  184. package/dist/esm/schema/marks/annotation.js +3 -11
  185. package/dist/esm/schema/marks/code.js +1 -3
  186. package/dist/esm/schema/marks/confluence-inline-comment.js +1 -0
  187. package/dist/esm/schema/marks/data-consumer.js +3 -3
  188. package/dist/esm/schema/marks/em.js +1 -0
  189. package/dist/esm/schema/marks/fragment.js +0 -9
  190. package/dist/esm/schema/marks/link.js +0 -12
  191. package/dist/esm/schema/marks/strike.js +1 -0
  192. package/dist/esm/schema/marks/strong.js +3 -1
  193. package/dist/esm/schema/marks/subsup.js +0 -4
  194. package/dist/esm/schema/marks/text-color.js +46 -30
  195. package/dist/esm/schema/marks/underline.js +1 -0
  196. package/dist/esm/schema/nodes/block-card.js +1 -1
  197. package/dist/esm/schema/nodes/blockquote.js +1 -0
  198. package/dist/esm/schema/nodes/bodied-extension.js +0 -2
  199. package/dist/esm/schema/nodes/caption.js +1 -0
  200. package/dist/esm/schema/nodes/code-block.js +11 -26
  201. package/dist/esm/schema/nodes/date.js +1 -0
  202. package/dist/esm/schema/nodes/decision-item.js +2 -2
  203. package/dist/esm/schema/nodes/decision-list.js +1 -0
  204. package/dist/esm/schema/nodes/doc.js +1 -0
  205. package/dist/esm/schema/nodes/embed-card.js +6 -5
  206. package/dist/esm/schema/nodes/emoji.js +12 -7
  207. package/dist/esm/schema/nodes/expand.js +1 -1
  208. package/dist/esm/schema/nodes/extension.js +0 -2
  209. package/dist/esm/schema/nodes/hard-break.js +1 -0
  210. package/dist/esm/schema/nodes/heading.js +2 -1
  211. package/dist/esm/schema/nodes/inline-card.js +4 -3
  212. package/dist/esm/schema/nodes/inline-extension.js +0 -2
  213. package/dist/esm/schema/nodes/layout-column.js +4 -4
  214. package/dist/esm/schema/nodes/layout-section.js +1 -0
  215. package/dist/esm/schema/nodes/media-group.js +1 -0
  216. package/dist/esm/schema/nodes/media-single.js +3 -8
  217. package/dist/esm/schema/nodes/media.js +10 -18
  218. package/dist/esm/schema/nodes/mention.js +4 -13
  219. package/dist/esm/schema/nodes/nested-expand.js +1 -0
  220. package/dist/esm/schema/nodes/ordered-list.js +3 -13
  221. package/dist/esm/schema/nodes/panel.js +1 -10
  222. package/dist/esm/schema/nodes/paragraph.js +1 -5
  223. package/dist/esm/schema/nodes/placeholder.js +1 -0
  224. package/dist/esm/schema/nodes/rule.js +1 -0
  225. package/dist/esm/schema/nodes/status.js +5 -4
  226. package/dist/esm/schema/nodes/tableNodes.js +12 -25
  227. package/dist/esm/schema/nodes/task-item.js +2 -2
  228. package/dist/esm/schema/nodes/text.js +1 -0
  229. package/dist/esm/steps/analytics.js +5 -31
  230. package/dist/esm/steps/set-attrs.js +1 -17
  231. package/dist/esm/steps/table/add-column.js +33 -91
  232. package/dist/esm/steps/table/constants.js +0 -1
  233. package/dist/esm/steps/table/sort-column.js +1 -10
  234. package/dist/esm/steps/table/utils/cell-step.js +18 -42
  235. package/dist/esm/steps/table/utils/cells-at-column.js +2 -18
  236. package/dist/esm/steps/table/utils/find-column.js +13 -16
  237. package/dist/esm/steps/table/utils/get-table-rect-from-doc.js +7 -6
  238. package/dist/esm/steps/table/utils/side-effects/rows.js +23 -76
  239. package/dist/esm/steps/table/utils/side-effects/side-effects.js +0 -18
  240. package/dist/esm/steps/table/utils/side-effects/table.js +2 -13
  241. package/dist/esm/steps/type-ahead.js +6 -18
  242. package/dist/esm/utils/colors.js +12 -23
  243. package/dist/esm/utils/confluence/emoji.js +6 -10
  244. package/dist/esm/utils/extensions.js +0 -4
  245. package/dist/esm/utils/url.js +2 -12
  246. package/dist/esm/version.json +1 -1
  247. package/dist/types/schema/default-schema.d.ts +1 -1
  248. package/dist/types/utils/colors.d.ts +1 -1
  249. package/package.json +2 -2
@@ -5,21 +5,13 @@ import _createClass from "@babel/runtime/helpers/createClass";
5
5
  import _inherits from "@babel/runtime/helpers/inherits";
6
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
-
9
8
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
-
11
9
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
-
13
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
-
15
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
-
17
12
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
18
-
19
13
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
20
-
21
14
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
22
-
23
15
  import { Step, StepMap, StepResult, Transform } from 'prosemirror-transform';
24
16
  import { cellsAtColumn } from './utils/cells-at-column';
25
17
  import { findColumn } from './utils/find-column';
@@ -28,13 +20,10 @@ import { applyCellStep, createCellStep, getMapFromCellStep, invertCellStep } fro
28
20
  import { SideEffectsHandler } from './utils/side-effects/side-effects';
29
21
  import memoizeOne from 'memoize-one';
30
22
  var ADD_COLUMN_STEP = 'ak-add-column';
31
-
32
23
  function printColumnInfo(columnInfo) {
33
24
  var cellsFrom = [];
34
-
35
25
  var _iterator = _createForOfIteratorHelper(columnInfo.values()),
36
- _step;
37
-
26
+ _step;
38
27
  try {
39
28
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
40
29
  var cellInfo = _step.value;
@@ -45,31 +34,27 @@ function printColumnInfo(columnInfo) {
45
34
  } finally {
46
35
  _iterator.f();
47
36
  }
48
-
49
37
  return "[".concat(cellsFrom.join(','), "]");
50
38
  }
51
-
52
39
  function createColumnInfo(cellsInfo) {
53
40
  return new Map(cellsInfo.map(function (cellInfo) {
54
41
  return [cellInfo.from, cellInfo];
55
42
  }));
56
43
  }
57
-
58
44
  var getTableRectAndColumnFactory = function getTableRectAndColumnFactory(doc, pos, columnInfo) {
59
45
  return memoizeOne(function () {
60
46
  var rect = getTableRectFromDoc(doc, pos);
61
47
  var column = findColumn(columnInfo, rect);
62
-
63
48
  if (column === null) {
64
49
  throw new Error('no column');
65
50
  }
66
-
67
51
  return {
68
52
  rect: rect,
69
53
  column: column
70
54
  };
71
55
  });
72
56
  };
57
+
73
58
  /**
74
59
  * Index and positions looks like
75
60
  * 0 1 2 3 -> Add Column Index
@@ -78,20 +63,13 @@ var getTableRectAndColumnFactory = function getTableRectAndColumnFactory(doc, po
78
63
  * 0 1 2 x -> Remove Column Index
79
64
  *
80
65
  */
81
-
82
-
83
66
  export var AddColumnStep = /*#__PURE__*/function (_Step) {
84
67
  _inherits(AddColumnStep, _Step);
85
-
86
68
  var _super = _createSuper(AddColumnStep);
87
-
88
69
  function AddColumnStep(tablePos, addColumnStepInfo) {
89
70
  var _this;
90
-
91
71
  var isDelete = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
92
-
93
72
  _classCallCheck(this, AddColumnStep);
94
-
95
73
  _this = _super.call(this);
96
74
  _this.tablePos = tablePos;
97
75
  _this.isDelete = isDelete;
@@ -99,6 +77,7 @@ export var AddColumnStep = /*#__PURE__*/function (_Step) {
99
77
  _this.columnInfo = createColumnInfo(addColumnStepInfo.cells);
100
78
  return _this;
101
79
  }
80
+
102
81
  /**
103
82
  * Detect the column based on all the cells step in column info.
104
83
  * Recreate columnInfo based on the current document. We might need to add new cells added by insert row or unmerge cells.
@@ -113,41 +92,34 @@ export var AddColumnStep = /*#__PURE__*/function (_Step) {
113
92
  *
114
93
  * @param doc Current document
115
94
  */
116
-
117
-
118
95
  _createClass(AddColumnStep, [{
119
96
  key: "apply",
120
97
  value: function apply(doc) {
121
- var tablePos = this.tablePos; // Create transform base on the doc
122
-
98
+ var tablePos = this.tablePos;
99
+ // Create transform base on the doc
123
100
  var tr = new Transform(doc);
124
-
125
101
  if (this.sideEffectsHandler.table.handleAddTable(tr, this.isDelete)) {
126
102
  return StepResult.ok(tr.doc);
127
103
  }
128
-
129
104
  var tableRect;
130
-
131
105
  try {
132
106
  tableRect = getTableRectFromDoc(doc, tablePos);
133
107
  } catch (e) {
134
108
  return StepResult.fail(e.message);
135
109
  }
136
-
137
110
  var column = findColumn(this.columnInfo, tableRect);
138
-
139
111
  if (column === null) {
140
112
  return StepResult.fail("No column for this cells \"".concat(printColumnInfo(this.columnInfo), "\" in table at position \"").concat(tablePos, "\"."));
141
113
  }
142
-
143
114
  if (this.sideEffectsHandler.table.handleRemoveTable(tr, this.tablePos, tableRect, column, this.isDelete)) {
144
115
  return StepResult.ok(tr.doc);
145
116
  }
117
+ this.columnInfo = this.applyCellSteps(tr, tableRect, column, this.isDelete);
146
118
 
147
- this.columnInfo = this.applyCellSteps(tr, tableRect, column, this.isDelete); // Return the document modified.
148
-
119
+ // Return the document modified.
149
120
  return StepResult.ok(tr.doc);
150
121
  }
122
+
151
123
  /**
152
124
  * Update tablePos with the new position. If tablePos doesnt exist any more remove the step
153
125
  * Update all the cellStep inside columnInfo. If cellStep.from position gets deleted removed it from column info
@@ -155,41 +127,32 @@ export var AddColumnStep = /*#__PURE__*/function (_Step) {
155
127
  * Create a new step with all the position updated
156
128
  * @param mapping
157
129
  */
158
-
159
130
  }, {
160
131
  key: "map",
161
132
  value: function map(mapping) {
162
133
  var tablePosResult = mapping.mapResult(this.tablePos);
163
-
164
134
  if (tablePosResult.deleted) {
165
135
  // If table was deleted remove the step
166
136
  return null;
167
137
  }
168
-
169
138
  var cellSteps = [];
170
-
171
139
  var _iterator2 = _createForOfIteratorHelper(this.columnInfo.values()),
172
- _step2;
173
-
140
+ _step2;
174
141
  try {
175
142
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
176
143
  var oldCellStep = _step2.value;
177
144
  var fromResult = mapping.mapResult(oldCellStep.from);
178
145
  var toResult = mapping.mapResult(oldCellStep.to);
179
-
180
146
  if (fromResult.deleted && toResult.deleted) {
181
147
  continue;
182
148
  }
183
-
184
149
  var cellStep = _objectSpread(_objectSpread({}, oldCellStep), {}, {
185
150
  from: fromResult.pos,
186
151
  to: toResult.pos
187
152
  });
188
-
189
153
  if (oldCellStep.mergeWith !== undefined) {
190
154
  cellStep.mergeWith = mapping.map(oldCellStep.mergeWith);
191
155
  }
192
-
193
156
  cellSteps.push(cellStep);
194
157
  }
195
158
  } catch (err) {
@@ -197,17 +160,16 @@ export var AddColumnStep = /*#__PURE__*/function (_Step) {
197
160
  } finally {
198
161
  _iterator2.f();
199
162
  }
200
-
201
163
  if (cellSteps.length === 0) {
202
164
  return null;
203
165
  }
204
-
205
166
  var sideEffects = this.sideEffectsHandler.map(mapping);
206
167
  return new AddColumnStep(tablePosResult.pos, {
207
168
  cells: cellSteps,
208
169
  sideEffects: sideEffects
209
170
  }, this.isDelete);
210
171
  }
172
+
211
173
  /**
212
174
  * if isDelete
213
175
  * Get the original cell node at columnInfo.cellStep[].from to columnInfo.cellStep[].to
@@ -219,16 +181,15 @@ export var AddColumnStep = /*#__PURE__*/function (_Step) {
219
181
  * return new step inverted
220
182
  * @param originalDoc
221
183
  */
222
-
223
184
  }, {
224
185
  key: "invert",
225
186
  value: function invert(originalDoc) {
226
187
  var _this2 = this;
188
+ var stepMap = this.getMap();
227
189
 
228
- var stepMap = this.getMap(); // Memoize function to be called only on delete scenarios
229
-
230
- var getTableRectAndColumn = getTableRectAndColumnFactory(originalDoc, this.tablePos, this.columnInfo); // This is needed because the real pos of the cell in the generated document is affected by the previous operations.
231
-
190
+ // Memoize function to be called only on delete scenarios
191
+ var getTableRectAndColumn = getTableRectAndColumnFactory(originalDoc, this.tablePos, this.columnInfo);
192
+ // This is needed because the real pos of the cell in the generated document is affected by the previous operations.
232
193
  var newCellSteps = Array.from(this.columnInfo.values(), function (oldCellStep) {
233
194
  var newCellStep = invertCellStep(originalDoc, getTableRectAndColumn, oldCellStep, _this2.isDelete, stepMap);
234
195
  return newCellStep;
@@ -239,6 +200,7 @@ export var AddColumnStep = /*#__PURE__*/function (_Step) {
239
200
  sideEffects: sideEffects
240
201
  }, !this.isDelete);
241
202
  }
203
+
242
204
  /**
243
205
  * StepMap is created based on columnInfo.
244
206
  * ColumnInfo is created on constructor and once is applied (the document could have new cells that weren't part of the original set)
@@ -253,27 +215,20 @@ export var AddColumnStep = /*#__PURE__*/function (_Step) {
253
215
  * currentSize: Represent the affected range, this will be pos + currentSize
254
216
  * newSize: Represent the new values, pos + newSize
255
217
  */
256
-
257
218
  }, {
258
219
  key: "getMap",
259
220
  value: function getMap() {
260
221
  var tableMap = this.sideEffectsHandler.getTableMap(this.isDelete);
261
-
262
222
  if (tableMap) {
263
223
  return tableMap;
264
224
  }
265
-
266
225
  var ranges = [];
267
-
268
226
  var _iterator3 = _createForOfIteratorHelper(this.columnInfo.values()),
269
- _step3;
270
-
227
+ _step3;
271
228
  try {
272
229
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
273
230
  var _ranges;
274
-
275
231
  var cellStep = _step3.value;
276
-
277
232
  (_ranges = ranges).push.apply(_ranges, _toConsumableArray(getMapFromCellStep(cellStep, this.isDelete)));
278
233
  }
279
234
  } catch (err) {
@@ -281,30 +236,30 @@ export var AddColumnStep = /*#__PURE__*/function (_Step) {
281
236
  } finally {
282
237
  _iterator3.f();
283
238
  }
239
+ ranges = this.sideEffectsHandler.rows.addRowRanges(ranges, this.isDelete);
284
240
 
285
- ranges = this.sideEffectsHandler.rows.addRowRanges(ranges, this.isDelete); // If no steps, I create am empty stepMap
286
-
241
+ // If no steps, I create am empty stepMap
287
242
  return new StepMap(ranges);
288
243
  }
244
+
289
245
  /**
290
246
  * Try to merge this step with another one, to be applied directly
291
247
  * after it. Returns the merged step when possible, null if the
292
248
  * steps can't be merged.
293
249
  */
294
-
295
250
  }, {
296
251
  key: "merge",
297
252
  value: function merge(other) {
298
253
  // We cannot merge add column step at the moment
299
254
  return null;
300
255
  }
256
+
301
257
  /**
302
258
  * Create a JSON-serializeable representation of this step. When
303
259
  * defining this for a custom subclass, make sure the result object
304
260
  * includes the step type's [JSON id](#transform.Step^jsonID) under
305
261
  * the `stepType` property.
306
262
  */
307
-
308
263
  }, {
309
264
  key: "toJSON",
310
265
  value: function toJSON() {
@@ -316,62 +271,56 @@ export var AddColumnStep = /*#__PURE__*/function (_Step) {
316
271
  from: cellStep.from,
317
272
  to: cellStep.to
318
273
  };
319
-
320
274
  if (cellStep.mergeWith !== undefined) {
321
275
  cellStepJson.mergeWith = cellStep.mergeWith;
322
276
  }
323
-
324
277
  if (cellStep.newCell !== undefined) {
325
278
  cellStepJson.newCell = cellStep.newCell.toJSON();
326
279
  }
327
-
328
280
  return cellStepJson;
329
281
  }),
330
282
  isDelete: this.isDelete
331
283
  };
332
284
  var sideEffectsJSON = this.sideEffectsHandler.toJSON();
333
-
334
285
  if (sideEffectsJSON) {
335
286
  addColumnStepJson.sideEffects = sideEffectsJSON;
336
287
  }
337
-
338
288
  return addColumnStepJson;
339
289
  }
290
+
340
291
  /**
341
292
  * Deserialize a step from its JSON representation. Will call
342
293
  * through to the step class' own implementation of this method.
343
294
  */
344
-
345
295
  }, {
346
296
  key: "applyCellSteps",
347
297
  value: function applyCellSteps(tr, tableRect, column, isDelete) {
348
298
  var newColumnInfo = new Map();
349
299
  var rowsHandler = this.sideEffectsHandler.rows.start(this.isDelete);
350
300
  var iter = cellsAtColumn(tableRect, column);
351
- var next = iter.next(); // Iterate for all the cells in the current document
352
-
301
+ var next = iter.next();
302
+ // Iterate for all the cells in the current document
353
303
  while (!next.done) {
354
304
  var cell = next.value;
355
305
  var previousCellStep = this.columnInfo.get(cell.from);
356
- var newCellStep = createCellStep(cell, column, isDelete, previousCellStep); // If is the last cell in the row and doesnt have colspan I need to remove the whole row.
306
+ var newCellStep = createCellStep(cell, column, isDelete, previousCellStep);
357
307
 
308
+ // If is the last cell in the row and doesnt have colspan I need to remove the whole row.
358
309
  var removeRowResult = rowsHandler.handle(tr, tableRect, cell.row, column, cell);
359
-
360
310
  if (removeRowResult.handled) {
361
311
  next = iter.next(removeRowResult.skipRows);
362
312
  continue;
363
- } // Apply the step, to the pseudo document, get rows to skip, and the cellstep (might be modified, for example, a merge cell that remove the cell instead)
364
-
313
+ }
365
314
 
315
+ // Apply the step, to the pseudo document, get rows to skip, and the cellstep (might be modified, for example, a merge cell that remove the cell instead)
366
316
  var _applyCellStep = applyCellStep(tr, tableRect, cell, newCellStep, isDelete, column),
367
- skipRows = _applyCellStep.skipRows,
368
- cellStep = _applyCellStep.cellStep; // Store the new cell step. This could be an existing one or a new cell.
369
-
317
+ skipRows = _applyCellStep.skipRows,
318
+ cellStep = _applyCellStep.cellStep;
370
319
 
320
+ // Store the new cell step. This could be an existing one or a new cell.
371
321
  newColumnInfo.set(newCellStep.from, cellStep);
372
322
  next = iter.next(skipRows);
373
323
  }
374
-
375
324
  rowsHandler.end(tr, tableRect, column);
376
325
  return newColumnInfo;
377
326
  }
@@ -383,15 +332,12 @@ export var AddColumnStep = /*#__PURE__*/function (_Step) {
383
332
  var cell = _objectSpread(_objectSpread({}, cellsJson), {}, {
384
333
  newCell: cellsJson.newCell ? schema.nodeFromJSON(cellsJson.newCell) : undefined
385
334
  });
386
-
387
335
  return cell;
388
336
  });
389
337
  var sideEffects;
390
-
391
338
  if (json.sideEffects) {
392
339
  sideEffects = SideEffectsHandler.fromJSON(schema, json.sideEffects);
393
340
  }
394
-
395
341
  return new AddColumnStep(json.tablePos, {
396
342
  cells: cells,
397
343
  sideEffects: sideEffects
@@ -401,31 +347,27 @@ export var AddColumnStep = /*#__PURE__*/function (_Step) {
401
347
  key: "create",
402
348
  value: function create(doc, tablePos, column) {
403
349
  var isDelete = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
404
- var tableRect = getTableRectFromDoc(doc, tablePos); // By default add column will rely on default behaviour (add empty cell).
405
- // There is no need to add content
350
+ var tableRect = getTableRectFromDoc(doc, tablePos);
406
351
 
352
+ // By default add column will rely on default behaviour (add empty cell).
353
+ // There is no need to add content
407
354
  var cells = [];
408
355
  var iter = cellsAtColumn(tableRect, column);
409
356
  var next = iter.next();
410
-
411
357
  while (!next.done) {
412
358
  var cell = next.value;
413
359
  cells.push(createCellStep(cell, column, isDelete));
414
360
  var skipRows = 0;
415
-
416
361
  if (cell.attrs && cell.attrs.rowspan) {
417
362
  skipRows = cell.attrs.rowspan - 1;
418
363
  }
419
-
420
364
  next = iter.next(skipRows);
421
365
  }
422
-
423
366
  return new AddColumnStep(tablePos, {
424
367
  cells: cells
425
368
  }, isDelete);
426
369
  }
427
370
  }]);
428
-
429
371
  return AddColumnStep;
430
372
  }(Step);
431
373
  Step.jsonID(ADD_COLUMN_STEP, AddColumnStep);
@@ -1,5 +1,4 @@
1
1
  export var SortOrder;
2
-
3
2
  (function (SortOrder) {
4
3
  SortOrder["ASC"] = "asc";
5
4
  SortOrder["DESC"] = "desc";
@@ -3,31 +3,23 @@ import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/inherits";
4
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
-
7
6
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
-
9
7
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
10
-
11
8
  import { Slice } from 'prosemirror-model';
12
9
  import { ReplaceStep, Step, StepMap, StepResult } from 'prosemirror-transform';
13
10
  export var tableSortingStepType = 'atlaskit-table-sorting-ordering';
14
11
  export var TableSortStep = /*#__PURE__*/function (_Step) {
15
12
  _inherits(TableSortStep, _Step);
16
-
17
13
  var _super = _createSuper(TableSortStep);
18
-
19
14
  function TableSortStep(pos, prev, next) {
20
15
  var _this;
21
-
22
16
  _classCallCheck(this, TableSortStep);
23
-
24
17
  _this = _super.call(this);
25
18
  _this.prev = prev;
26
19
  _this.next = next;
27
20
  _this.pos = pos;
28
21
  return _this;
29
22
  }
30
-
31
23
  _createClass(TableSortStep, [{
32
24
  key: "invert",
33
25
  value: function invert() {
@@ -61,9 +53,8 @@ export var TableSortStep = /*#__PURE__*/function (_Step) {
61
53
  return new ReplaceStep(0, 0, Slice.empty);
62
54
  }
63
55
  }]);
64
-
65
56
  return TableSortStep;
66
57
  }(Step);
67
- /** Register this step with Prosemirror */
68
58
 
59
+ /** Register this step with Prosemirror */
69
60
  Step.jsonID(tableSortingStepType, TableSortStep);
@@ -1,20 +1,16 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
-
4
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
-
6
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
-
8
5
  import { addColSpan, removeColSpan } from '@atlaskit/editor-tables/utils';
9
6
  var EmptyCellNodeSize = 4;
10
-
11
7
  function calculateRowsToSkip(attrs) {
12
8
  if (attrs && attrs.rowspan) {
13
9
  return attrs.rowspan - 1;
14
10
  }
15
-
16
11
  return 0;
17
12
  }
13
+
18
14
  /**
19
15
  * Given a cell step, this function has to do the specific transformation to executed that step.
20
16
  * It returns the applied cellStep and rows that needs to skip (because it was already handled).
@@ -25,15 +21,12 @@ function calculateRowsToSkip(attrs) {
25
21
  * @param isDelete
26
22
  * @param column
27
23
  */
28
-
29
-
30
24
  export function applyCellStep(tr, tableRect, cell, cellStep, isDelete, column) {
31
25
  // Apply the merge actions,
32
26
  if (cellStep.mergeWith !== undefined) {
33
27
  var cellNode = tr.doc.nodeAt(tr.mapping.map(cellStep.mergeWith));
34
28
  var columns = column - tableRect.map.colCount(cellStep.mergeWith - tableRect.tableStart);
35
29
  var cellAttrs = isDelete ? removeColSpan(cellNode.attrs, columns) : addColSpan(cellNode.attrs, columns);
36
-
37
30
  if (cellAttrs.colspan > 0) {
38
31
  // When colspan is 0 should remove the cell
39
32
  tr.setNodeMarkup(tr.mapping.map(cellStep.mergeWith), undefined, cellAttrs);
@@ -42,20 +35,18 @@ export function applyCellStep(tr, tableRect, cell, cellStep, isDelete, column) {
42
35
  skipRows: calculateRowsToSkip(cellAttrs),
43
36
  cellStep: cellStep
44
37
  };
45
- } // When the new colspan is 0, I need to change the operation to a delete operation
46
- // Update cellStep with the proper data
47
-
38
+ }
48
39
 
40
+ // When the new colspan is 0, I need to change the operation to a delete operation
41
+ // Update cellStep with the proper data
49
42
  cellStep.from = cellStep.mergeWith;
50
43
  cellStep.to = cellStep.from + cellNode.nodeSize;
51
44
  cellStep.mergeWith = undefined;
52
45
  }
53
-
54
- var skipRows = 0; // Modify temporary document
55
-
46
+ var skipRows = 0;
47
+ // Modify temporary document
56
48
  if (isDelete) {
57
49
  var _cellNode = tr.doc.nodeAt(tr.mapping.map(cellStep.from));
58
-
59
50
  skipRows = calculateRowsToSkip(_cellNode.attrs);
60
51
  tr.delete(tr.mapping.map(cellStep.from), tr.mapping.map(cellStep.to));
61
52
  } else {
@@ -66,35 +57,33 @@ export function applyCellStep(tr, tableRect, cell, cellStep, isDelete, column) {
66
57
  tr.insert(tr.mapping.map(cellStep.from), cell.type.createAndFill());
67
58
  }
68
59
  }
69
-
70
60
  return {
71
61
  tr: tr,
72
62
  skipRows: skipRows,
73
63
  cellStep: cellStep
74
64
  };
75
65
  }
66
+
76
67
  /**
77
68
  * Given a cell step, this functions return un StepMap representing this action.
78
69
  * [position, oldSize, newSize]
79
70
  * @param cellStep
80
71
  * @param isDelete
81
72
  */
82
-
83
73
  export function getMapFromCellStep(cellStep, isDelete) {
84
74
  if (cellStep.mergeWith !== undefined) {
85
75
  return [cellStep.mergeWith, 1, 1];
86
76
  }
87
-
88
77
  if (isDelete) {
89
78
  return [cellStep.from, cellStep.to - cellStep.from, 0];
90
79
  } else {
91
80
  if (cellStep.newCell) {
92
81
  return [cellStep.from, 0, cellStep.newCell.nodeSize];
93
82
  }
94
-
95
83
  return [cellStep.from, 0, EmptyCellNodeSize];
96
84
  }
97
85
  }
86
+
98
87
  /**
99
88
  * Helper to calculate the offset of the inverted cells.
100
89
  * When you delete consecutive rows in a single step, the position in the generated document
@@ -103,19 +92,17 @@ export function getMapFromCellStep(cellStep, isDelete) {
103
92
  * @param cellStep
104
93
  * @param isDelete
105
94
  */
106
-
107
95
  function getOffset(map, cellStep, isDelete) {
108
96
  if (isDelete) {
109
97
  return map.map(cellStep.from) - cellStep.from;
110
98
  }
111
-
112
99
  var _getMapFromCellStep = getMapFromCellStep(cellStep, isDelete),
113
- _getMapFromCellStep2 = _slicedToArray(_getMapFromCellStep, 3),
114
- oldSize = _getMapFromCellStep2[1],
115
- newSize = _getMapFromCellStep2[2];
116
-
100
+ _getMapFromCellStep2 = _slicedToArray(_getMapFromCellStep, 3),
101
+ oldSize = _getMapFromCellStep2[1],
102
+ newSize = _getMapFromCellStep2[2];
117
103
  return map.map(cellStep.from) - cellStep.from - (newSize - oldSize);
118
104
  }
105
+
119
106
  /**
120
107
  * Given a cell step, this function invert that step.
121
108
  * @param doc
@@ -124,8 +111,6 @@ function getOffset(map, cellStep, isDelete) {
124
111
  * @param isDelete
125
112
  * @param stepMap
126
113
  */
127
-
128
-
129
114
  export function invertCellStep(doc, getTableRectAndColumn, cellStep, isDelete, stepMap) {
130
115
  /**
131
116
  * We need a correct map when a cell is added
@@ -147,40 +132,36 @@ export function invertCellStep(doc, getTableRectAndColumn, cellStep, isDelete, s
147
132
  * For a delete action this not happen, it will always return the right value
148
133
  */
149
134
  var offset = getOffset(stepMap, cellStep, isDelete);
150
-
151
135
  var newCellStepInfo = _objectSpread(_objectSpread({}, cellStep), {}, {
152
136
  // Map the position to position of the generated document
153
137
  from: cellStep.from + offset,
154
138
  to: cellStep.to + offset
155
139
  });
156
-
157
140
  if (cellStep.mergeWith !== undefined) {
158
141
  newCellStepInfo.mergeWith = cellStep.mergeWith + offset;
159
142
  }
160
-
161
143
  if (isDelete) {
162
144
  // Add the removed cell as the new cell of the inverted step
163
145
  var removedCell = doc.nodeAt(cellStep.from);
164
- newCellStepInfo.newCell = removedCell.copy(removedCell.content); // When we delete a column we can end in a position that doesnt represent the right column.
146
+ newCellStepInfo.newCell = removedCell.copy(removedCell.content);
147
+
148
+ // When we delete a column we can end in a position that doesnt represent the right column.
165
149
  // This only happens on merged cell that ends in the deleted column.
166
150
  // We need to remap this position to the "next" cell (AKA cellStep.to)
167
-
168
151
  var _getTableRectAndColum = getTableRectAndColumn(),
169
- column = _getTableRectAndColum.column,
170
- rect = _getTableRectAndColum.rect;
171
-
152
+ column = _getTableRectAndColum.column,
153
+ rect = _getTableRectAndColum.rect;
172
154
  if (column < rect.map.width) {
173
155
  var isAtTheEnd = rect.map.colCount(cellStep.from - rect.tableStart) + removedCell.attrs.colspan - 1 === column;
174
-
175
156
  if (cellStep.mergeWith !== undefined && isAtTheEnd) {
176
157
  newCellStepInfo.mergeWith = newCellStepInfo.from;
177
158
  newCellStepInfo.from = newCellStepInfo.to;
178
159
  }
179
160
  }
180
161
  }
181
-
182
162
  return newCellStepInfo;
183
163
  }
164
+
184
165
  /**
185
166
  * Create a cell step based on the current cell and operation (add/delete)
186
167
  * @param cell
@@ -188,29 +169,24 @@ export function invertCellStep(doc, getTableRectAndColumn, cellStep, isDelete, s
188
169
  * @param isDelete
189
170
  * @param previousCellStep
190
171
  */
191
-
192
172
  export function createCellStep(cell, column, isDelete, previousCellStep) {
193
173
  var newCellStepInfo = {
194
174
  from: cell.from,
195
175
  to: cell.to
196
176
  };
197
-
198
177
  if (cell.hasMergedCells) {
199
178
  // Check what column has to merge
200
179
  if (column !== cell.col || isDelete) {
201
180
  newCellStepInfo.mergeWith = cell.from;
202
181
  }
203
182
  }
204
-
205
183
  if (previousCellStep) {
206
184
  if (previousCellStep.mergeWith !== undefined) {
207
185
  newCellStepInfo.mergeWith = previousCellStep.mergeWith;
208
186
  }
209
-
210
187
  if (previousCellStep.newCell) {
211
188
  newCellStepInfo.newCell = previousCellStep.newCell;
212
189
  }
213
190
  }
214
-
215
191
  return newCellStepInfo;
216
192
  }