@atlaskit/editor-core 187.8.7 → 187.8.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.
Files changed (157) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/index.js +0 -6
  3. package/dist/cjs/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
  4. package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +4 -4
  5. package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +5 -5
  6. package/dist/cjs/plugins/layout/pm-plugins/main.js +1 -1
  7. package/dist/cjs/plugins/list/actions/conversions.js +5 -5
  8. package/dist/cjs/plugins/list/actions/indent-list-items-selected.js +11 -11
  9. package/dist/cjs/plugins/list/actions/join-list-items-forward.js +6 -6
  10. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +6 -7
  11. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +3 -4
  12. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +3 -4
  13. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +2 -2
  14. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +2 -2
  15. package/dist/cjs/plugins/list/actions/merge-lists.js +3 -3
  16. package/dist/cjs/plugins/list/actions/outdent-list-items-selected.js +11 -11
  17. package/dist/cjs/plugins/list/actions/wrap-and-join-lists.js +2 -2
  18. package/dist/cjs/plugins/list/commands/indent-list.js +6 -7
  19. package/dist/cjs/plugins/list/commands/index.js +8 -10
  20. package/dist/cjs/plugins/list/commands/join-list-item-forward.js +5 -5
  21. package/dist/cjs/plugins/list/commands/listBackspace.js +13 -14
  22. package/dist/cjs/plugins/list/commands/outdent-list.js +4 -3
  23. package/dist/cjs/plugins/list/pm-plugins/main.js +5 -6
  24. package/dist/cjs/plugins/list/utils/analytics.js +1 -35
  25. package/dist/cjs/plugins/list/utils/indentation.js +2 -20
  26. package/dist/cjs/plugins/list/utils/node.js +2 -106
  27. package/dist/cjs/plugins/list/utils/selection.js +3 -54
  28. package/dist/cjs/plugins/tasks-and-decisions/commands.js +2 -2
  29. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +17 -18
  30. package/dist/cjs/plugins/text-formatting/index.js +23 -21
  31. package/dist/cjs/plugins/text-formatting/pm-plugins/input-rule.js +48 -54
  32. package/dist/cjs/plugins/text-formatting/pm-plugins/smart-input-rule.js +28 -33
  33. package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
  34. package/dist/cjs/utils/commands.js +3 -109
  35. package/dist/cjs/utils/document.js +1 -26
  36. package/dist/cjs/utils/index.js +0 -6
  37. package/dist/cjs/version-wrapper.js +1 -1
  38. package/dist/cjs/version.json +1 -1
  39. package/dist/es2019/index.js +1 -1
  40. package/dist/es2019/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
  41. package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +1 -1
  42. package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +1 -1
  43. package/dist/es2019/plugins/layout/pm-plugins/main.js +1 -1
  44. package/dist/es2019/plugins/list/actions/conversions.js +2 -2
  45. package/dist/es2019/plugins/list/actions/indent-list-items-selected.js +2 -2
  46. package/dist/es2019/plugins/list/actions/join-list-items-forward.js +1 -1
  47. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +1 -2
  48. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +2 -2
  49. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +2 -2
  50. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +1 -1
  51. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +1 -1
  52. package/dist/es2019/plugins/list/actions/merge-lists.js +1 -1
  53. package/dist/es2019/plugins/list/actions/outdent-list-items-selected.js +3 -3
  54. package/dist/es2019/plugins/list/actions/wrap-and-join-lists.js +1 -1
  55. package/dist/es2019/plugins/list/commands/indent-list.js +3 -4
  56. package/dist/es2019/plugins/list/commands/index.js +4 -5
  57. package/dist/es2019/plugins/list/commands/join-list-item-forward.js +1 -1
  58. package/dist/es2019/plugins/list/commands/listBackspace.js +1 -2
  59. package/dist/es2019/plugins/list/commands/outdent-list.js +3 -2
  60. package/dist/es2019/plugins/list/pm-plugins/main.js +1 -1
  61. package/dist/es2019/plugins/list/utils/analytics.js +0 -36
  62. package/dist/es2019/plugins/list/utils/indentation.js +0 -18
  63. package/dist/es2019/plugins/list/utils/node.js +3 -89
  64. package/dist/es2019/plugins/list/utils/selection.js +1 -52
  65. package/dist/es2019/plugins/tasks-and-decisions/commands.js +1 -1
  66. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
  67. package/dist/es2019/plugins/text-formatting/index.js +15 -10
  68. package/dist/es2019/plugins/text-formatting/pm-plugins/input-rule.js +20 -18
  69. package/dist/es2019/plugins/text-formatting/pm-plugins/smart-input-rule.js +11 -12
  70. package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
  71. package/dist/es2019/utils/commands.js +2 -102
  72. package/dist/es2019/utils/document.js +1 -26
  73. package/dist/es2019/utils/index.js +1 -1
  74. package/dist/es2019/version-wrapper.js +1 -1
  75. package/dist/es2019/version.json +1 -1
  76. package/dist/esm/index.js +1 -1
  77. package/dist/esm/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
  78. package/dist/esm/plugins/block-type/pm-plugins/keymap.js +1 -1
  79. package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +1 -1
  80. package/dist/esm/plugins/layout/pm-plugins/main.js +1 -1
  81. package/dist/esm/plugins/list/actions/conversions.js +2 -2
  82. package/dist/esm/plugins/list/actions/indent-list-items-selected.js +2 -2
  83. package/dist/esm/plugins/list/actions/join-list-items-forward.js +1 -1
  84. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +1 -2
  85. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +2 -2
  86. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +2 -2
  87. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +1 -1
  88. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +1 -1
  89. package/dist/esm/plugins/list/actions/merge-lists.js +1 -1
  90. package/dist/esm/plugins/list/actions/outdent-list-items-selected.js +3 -3
  91. package/dist/esm/plugins/list/actions/wrap-and-join-lists.js +1 -1
  92. package/dist/esm/plugins/list/commands/indent-list.js +3 -4
  93. package/dist/esm/plugins/list/commands/index.js +4 -5
  94. package/dist/esm/plugins/list/commands/join-list-item-forward.js +1 -1
  95. package/dist/esm/plugins/list/commands/listBackspace.js +1 -2
  96. package/dist/esm/plugins/list/commands/outdent-list.js +3 -2
  97. package/dist/esm/plugins/list/pm-plugins/main.js +1 -1
  98. package/dist/esm/plugins/list/utils/analytics.js +0 -32
  99. package/dist/esm/plugins/list/utils/indentation.js +0 -17
  100. package/dist/esm/plugins/list/utils/node.js +3 -81
  101. package/dist/esm/plugins/list/utils/selection.js +3 -51
  102. package/dist/esm/plugins/tasks-and-decisions/commands.js +1 -1
  103. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
  104. package/dist/esm/plugins/text-formatting/index.js +23 -21
  105. package/dist/esm/plugins/text-formatting/pm-plugins/input-rule.js +48 -54
  106. package/dist/esm/plugins/text-formatting/pm-plugins/smart-input-rule.js +26 -31
  107. package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
  108. package/dist/esm/utils/commands.js +2 -100
  109. package/dist/esm/utils/document.js +1 -26
  110. package/dist/esm/utils/index.js +1 -1
  111. package/dist/esm/version-wrapper.js +1 -1
  112. package/dist/esm/version.json +1 -1
  113. package/dist/types/index.d.ts +1 -1
  114. package/dist/types/plugins/list/actions/join-list-items-forward.d.ts +1 -1
  115. package/dist/types/plugins/list/commands/indent-list.d.ts +2 -1
  116. package/dist/types/plugins/list/commands/index.d.ts +2 -1
  117. package/dist/types/plugins/list/commands/join-list-item-forward.d.ts +1 -1
  118. package/dist/types/plugins/list/commands/listBackspace.d.ts +1 -1
  119. package/dist/types/plugins/list/commands/outdent-list.d.ts +2 -1
  120. package/dist/types/plugins/list/utils/analytics.d.ts +2 -4
  121. package/dist/types/plugins/list/utils/indentation.d.ts +0 -5
  122. package/dist/types/plugins/list/utils/node.d.ts +2 -17
  123. package/dist/types/plugins/list/utils/selection.d.ts +1 -12
  124. package/dist/types/plugins/text-formatting/pm-plugins/input-rule.d.ts +2 -1
  125. package/dist/types/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +2 -2
  126. package/dist/types/utils/commands.d.ts +3 -32
  127. package/dist/types/utils/document.d.ts +0 -4
  128. package/dist/types/utils/index.d.ts +1 -1
  129. package/dist/types-ts4.5/index.d.ts +1 -1
  130. package/dist/types-ts4.5/plugins/list/actions/join-list-items-forward.d.ts +1 -1
  131. package/dist/types-ts4.5/plugins/list/commands/indent-list.d.ts +2 -1
  132. package/dist/types-ts4.5/plugins/list/commands/index.d.ts +2 -1
  133. package/dist/types-ts4.5/plugins/list/commands/join-list-item-forward.d.ts +1 -1
  134. package/dist/types-ts4.5/plugins/list/commands/listBackspace.d.ts +1 -1
  135. package/dist/types-ts4.5/plugins/list/commands/outdent-list.d.ts +2 -1
  136. package/dist/types-ts4.5/plugins/list/utils/analytics.d.ts +2 -4
  137. package/dist/types-ts4.5/plugins/list/utils/indentation.d.ts +0 -5
  138. package/dist/types-ts4.5/plugins/list/utils/node.d.ts +2 -17
  139. package/dist/types-ts4.5/plugins/list/utils/selection.d.ts +1 -12
  140. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/input-rule.d.ts +2 -1
  141. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +2 -2
  142. package/dist/types-ts4.5/utils/commands.d.ts +3 -38
  143. package/dist/types-ts4.5/utils/document.d.ts +0 -4
  144. package/dist/types-ts4.5/utils/index.d.ts +1 -1
  145. package/package.json +2 -2
  146. package/report.api.md +0 -3
  147. package/tmp/api-report-tmp.d.ts +0 -3
  148. package/dist/cjs/plugins/list/utils/replace-content.js +0 -24
  149. package/dist/cjs/utils/prosemirror/autojoin.js +0 -68
  150. package/dist/es2019/plugins/list/utils/replace-content.js +0 -18
  151. package/dist/es2019/utils/prosemirror/autojoin.js +0 -57
  152. package/dist/esm/plugins/list/utils/replace-content.js +0 -17
  153. package/dist/esm/utils/prosemirror/autojoin.js +0 -63
  154. package/dist/types/plugins/list/utils/replace-content.d.ts +0 -8
  155. package/dist/types/utils/prosemirror/autojoin.d.ts +0 -13
  156. package/dist/types-ts4.5/plugins/list/utils/replace-content.d.ts +0 -8
  157. package/dist/types-ts4.5/utils/prosemirror/autojoin.d.ts +0 -13
@@ -24,22 +24,20 @@ var _model = require("@atlaskit/editor-prosemirror/model");
24
24
  var _state = require("@atlaskit/editor-prosemirror/state");
25
25
  var baseCommand = _interopRequireWildcard(require("@atlaskit/editor-prosemirror/commands"));
26
26
  var _utils = require("@atlaskit/editor-prosemirror/utils");
27
- var _document = require("../../../utils/document");
28
- var _commands2 = require("../../../utils/commands");
29
27
  var _utils2 = require("@atlaskit/editor-common/utils");
28
+ var _commands2 = require("../../../utils/commands");
30
29
  var _utils3 = require("../../../utils");
30
+ var _lists = require("@atlaskit/editor-common/lists");
31
31
  var _transforms = require("../transforms");
32
32
  var _gapCursorSelection = require("../../selection/gap-cursor-selection");
33
33
  var _analytics = require("@atlaskit/editor-common/analytics");
34
34
  var _selection = require("../utils/selection");
35
- var _analytics2 = require("../utils/analytics");
36
35
  var _listBackspace = require("./listBackspace");
37
36
  var _joinListItemForward = require("./join-list-item-forward");
38
37
  var _conversions = require("../actions/conversions");
39
38
  var _wrapAndJoinLists = require("../actions/wrap-and-join-lists");
40
39
  var _outdentList = require("./outdent-list");
41
40
  var _indentList = require("./indent-list");
42
- var _replaceContent = require("../utils/replace-content");
43
41
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
44
42
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
45
43
  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; }
@@ -56,7 +54,7 @@ var enterKeyCommand = function enterKeyCommand(editorAnalyticsAPI) {
56
54
  var wrapper = $from.node($from.depth - 1);
57
55
  if (wrapper && wrapper.type === listItem) {
58
56
  /** Check if the wrapper has any visible content */
59
- var wrapperHasContent = (0, _document.hasVisibleContent)(wrapper);
57
+ var wrapperHasContent = (0, _utils2.hasVisibleContent)(wrapper);
60
58
  if (!wrapperHasContent) {
61
59
  return (0, _outdentList.outdentList)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD, featureFlags)(state, dispatch);
62
60
  } else if (!(0, _utils.hasParentNodeOfType)(codeBlock)(selection)) {
@@ -75,12 +73,12 @@ var backspaceKeyCommand = function backspaceKeyCommand(editorAnalyticsAPI) {
75
73
  return baseCommand.chainCommands((0, _listBackspace.listBackspace)(editorAnalyticsAPI),
76
74
  // if we're at the start of a list item, we need to either backspace
77
75
  // directly to an empty list item above, or outdent this node
78
- (0, _utils2.filterCommands)([_commands2.isEmptySelectionAtStart,
76
+ (0, _utils2.filterCommand)([_utils2.isEmptySelectionAtStart,
79
77
  // list items might have multiple paragraphs; only do this at the first one
80
78
  _commands2.isFirstChildOfParent, _selection.isInsideListItem], baseCommand.chainCommands(deletePreviousEmptyListItem, (0, _outdentList.outdentList)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD, featureFlags))),
81
79
  // if we're just inside a paragraph node (or gapcursor is shown) and backspace, then try to join
82
80
  // the text to the previous list item, if one exists
83
- (0, _utils2.filterCommands)([_commands2.isEmptySelectionAtStart, _selection.canJoinToPreviousListItem], joinToPreviousListItem))(state, dispatch);
81
+ (0, _utils2.filterCommand)([_utils2.isEmptySelectionAtStart, _selection.canJoinToPreviousListItem], joinToPreviousListItem))(state, dispatch);
84
82
  };
85
83
  };
86
84
  };
@@ -142,7 +140,7 @@ var toggleList = function toggleList(editorAnalyticsAPI) {
142
140
  actionSubject: _analytics.ACTION_SUBJECT.LIST,
143
141
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.TEXT,
144
142
  eventType: _analytics.EVENT_TYPE.TRACK,
145
- attributes: _objectSpread(_objectSpread({}, (0, _analytics2.getCommonListAnalyticsAttributes)(state)), {}, {
143
+ attributes: _objectSpread(_objectSpread({}, (0, _lists.getCommonListAnalyticsAttributes)(state)), {}, {
146
144
  transformedFrom: transformedFrom,
147
145
  inputMethod: inputMethod
148
146
  })
@@ -161,7 +159,7 @@ var toggleList = function toggleList(editorAnalyticsAPI) {
161
159
  actionSubject: _analytics.ACTION_SUBJECT.LIST,
162
160
  actionSubjectId: actionSubjectId,
163
161
  eventType: _analytics.EVENT_TYPE.TRACK,
164
- attributes: _objectSpread(_objectSpread({}, (0, _analytics2.getCommonListAnalyticsAttributes)(state)), {}, {
162
+ attributes: _objectSpread(_objectSpread({}, (0, _lists.getCommonListAnalyticsAttributes)(state)), {}, {
165
163
  transformedFrom: transformedFrom,
166
164
  inputMethod: inputMethod
167
165
  })
@@ -314,7 +312,7 @@ var joinToPreviousListItem = function joinToPreviousListItem(state, dispatch) {
314
312
  var list = $cut.nodeBefore.copy($cut.nodeBefore.content.append(_model.Fragment.from(listItem.createChecked({}, $cut.nodeAfter))));
315
313
  tr.replaceWith(nodeBeforePos, $from.pos + $cut.nodeAfter.nodeSize, list);
316
314
  } else {
317
- var step = (0, _replaceContent.moveTargetIntoList)({
315
+ var step = (0, _lists.moveTargetIntoList)({
318
316
  insertPosition: $lastNode.pos,
319
317
  $target: $cut
320
318
  });
@@ -6,16 +6,16 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.joinListItemForward = void 0;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
- var _commands = require("../../../utils/commands");
9
+ var _utils = require("@atlaskit/editor-common/utils");
10
10
  var _analytics = require("@atlaskit/editor-common/analytics");
11
- var _utils = require("@atlaskit/editor-prosemirror/utils");
11
+ var _utils2 = require("@atlaskit/editor-prosemirror/utils");
12
12
  var _joinListItemsForward = require("../actions/join-list-items-forward");
13
13
  var joinListItemForward = function joinListItemForward(editorAnalyticsAPI) {
14
14
  return function (state, dispatch) {
15
15
  var tr = state.tr,
16
16
  $head = state.selection.$head;
17
- var walkNode = (0, _commands.walkNextNode)($head);
18
- if (!(0, _commands.isEmptySelectionAtEnd)(state)) {
17
+ var walkNode = (0, _utils.walkNextNode)($head);
18
+ if (!(0, _utils.isEmptySelectionAtEnd)(state)) {
19
19
  return false;
20
20
  }
21
21
  var scenarios = (0, _joinListItemsForward.calcJoinListScenario)(walkNode, $head);
@@ -36,7 +36,7 @@ var joinListItemForward = function joinListItemForward(editorAnalyticsAPI) {
36
36
  var _state$schema$nodes = state.schema.nodes,
37
37
  bulletList = _state$schema$nodes.bulletList,
38
38
  orderedList = _state$schema$nodes.orderedList;
39
- var listParent = (0, _utils.findParentNodeOfType)([bulletList, orderedList])(tr.selection);
39
+ var listParent = (0, _utils2.findParentNodeOfType)([bulletList, orderedList])(tr.selection);
40
40
  var actionSubjectId = _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_BULLET;
41
41
  if (listParent && listParent.node.type === orderedList) {
42
42
  actionSubjectId = _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.listBackspace = exports.calcJoinListScenario = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _commands = require("../../../utils/commands");
9
+ var _utils = require("@atlaskit/editor-common/utils");
10
10
  var _analytics = require("@atlaskit/editor-common/analytics");
11
- var _utils = require("@atlaskit/editor-prosemirror/utils");
12
- var _utils2 = require("@atlaskit/editor-common/utils");
11
+ var _utils2 = require("@atlaskit/editor-prosemirror/utils");
13
12
  var _selection = require("../utils/selection");
14
13
  var _BACKSPACE_COMMANDS;
15
14
  //Cases below refer to the cases found in this document: https://product-fabric.atlassian.net/wiki/spaces/E/pages/1146954996/List+Backspace+and+Delete+Behaviour
@@ -51,7 +50,7 @@ var listBackspaceCase2 = function listBackspaceCase2(tr, dispatch, $prev, $head)
51
50
  var childrenGInsertPos = $prev.pos;
52
51
  var textContent = $head.parent.content;
53
52
  var childrenGContent = listItemE.content.cut(listItemE.firstChild.nodeSize);
54
- (0, _commands.insertContentDeleteRange)(tr, function (tr) {
53
+ (0, _utils.insertContentDeleteRange)(tr, function (tr) {
55
54
  return tr.doc.resolve(textInsertPos);
56
55
  }, [[textContent, textInsertPos], [childrenGContent, childrenGInsertPos]], [[beforeListItemE, afterListItemE]]);
57
56
  if (dispatch) {
@@ -109,7 +108,7 @@ var listBackspaceCase3 = function listBackspaceCase3(tr, dispatch, $prev, $head)
109
108
  var afterListE = $head.after(-2);
110
109
  var afterListItemF = $head.after(-1);
111
110
  var startListE = $head.start(-2);
112
- var containsChildrenJ = (0, _utils2.isListNode)(listItemF.lastChild);
111
+ var containsChildrenJ = (0, _utils.isListNode)(listItemF.lastChild);
113
112
  var shouldRemoveListE = listE.childCount === 1 && !containsChildrenJ; //Assures no Children J and K
114
113
  var textInsertPos = $prev.pos;
115
114
  var childrenHInsertPos = afterParagraphD;
@@ -118,7 +117,7 @@ var listBackspaceCase3 = function listBackspaceCase3(tr, dispatch, $prev, $head)
118
117
  var childrenHContent = containsChildrenJ ? listItemF.content.cut(listItemF.firstChild.nodeSize, listItemF.nodeSize - listItemF.lastChild.nodeSize - 2) : listItemF.content.cut(listItemF.firstChild.nodeSize); //If Children J doesn't exist then Children H will include the last node
119
118
  var childrenJContent = listItemF.lastChild.content; //Will be invalid if there are no Children J but it will be unused
120
119
 
121
- (0, _commands.insertContentDeleteRange)(tr, function (tr) {
120
+ (0, _utils.insertContentDeleteRange)(tr, function (tr) {
122
121
  return tr.doc.resolve(textInsertPos);
123
122
  }, containsChildrenJ ? [[textContent, textInsertPos], [childrenHContent, childrenHInsertPos], [childrenJContent, childrenJInsertPos]] : [[textContent, textInsertPos], [childrenHContent, childrenHInsertPos]], [shouldRemoveListE ? [beforeListE, afterListE] : [beforeListItemF, afterListItemF]]);
124
123
  if (dispatch) {
@@ -193,7 +192,7 @@ var listBackspaceCase4 = function listBackspaceCase4(tr, dispatch, $prev, $head,
193
192
  var beforeListItemK = $head.before(-1);
194
193
  var afterParagraphJ = $last.after();
195
194
  var afterListItemK = $head.after(-1);
196
- var containsChildrenO = (0, _utils2.isListNode)(listItemK.lastChild);
195
+ var containsChildrenO = (0, _utils.isListNode)(listItemK.lastChild);
197
196
  var textInsertPos = $last.pos;
198
197
  var childrenMInsertPos = afterParagraphJ;
199
198
  var childrenOInsertPos = $prev.pos - 1; //Last item of listItem B must be a list therefore we can simply decrement $prev to get there
@@ -201,7 +200,7 @@ var listBackspaceCase4 = function listBackspaceCase4(tr, dispatch, $prev, $head,
201
200
  var textContent = paragraphL.content;
202
201
  var childrenMContent = containsChildrenO ? listItemK.content.cut(listItemK.firstChild.nodeSize, listItemK.nodeSize - listItemK.lastChild.nodeSize - 2) : listItemK.content.cut(listItemK.firstChild.nodeSize);
203
202
  var childrenOContent = listItemK.lastChild.content;
204
- (0, _commands.insertContentDeleteRange)(tr, function (tr) {
203
+ (0, _utils.insertContentDeleteRange)(tr, function (tr) {
205
204
  return tr.doc.resolve(textInsertPos);
206
205
  }, containsChildrenO ? [[textContent, textInsertPos], [childrenMContent, childrenMInsertPos], [childrenOContent, childrenOInsertPos]] : [[textContent, textInsertPos], [childrenMContent, childrenMInsertPos]], [[beforeListItemK, afterListItemK]]);
207
206
  if (dispatch) {
@@ -227,15 +226,15 @@ var calcJoinListScenario = function calcJoinListScenario(walkNode, $head, tr) {
227
226
  if (prevInParagraph) {
228
227
  return [_analytics.LIST_TEXT_SCENARIOS.JOIN_DESCENDANT_TO_PARENT, null];
229
228
  }
230
- var prevParentLastChildIsList = $prev.parent.lastChild && (0, _utils2.isListNode)($prev.parent.lastChild);
231
- var prevParentLastChildIsParagraph = (0, _utils2.isParagraphNode)($prev.parent.lastChild);
229
+ var prevParentLastChildIsList = $prev.parent.lastChild && (0, _utils.isListNode)($prev.parent.lastChild);
230
+ var prevParentLastChildIsParagraph = (0, _utils.isParagraphNode)($prev.parent.lastChild);
232
231
 
233
232
  // Will search for the possible last node for case 4 (where the list could be indented multiple times)
234
233
  // $last is required to determine whether we are in case 2 or 4
235
234
  var $last = tr.doc.resolve($prev.pos);
236
235
  var lastFoundNode;
237
236
  do {
238
- var _walkNode = (0, _commands.walkPrevNode)($last);
237
+ var _walkNode = (0, _utils.walkPrevNode)($last);
239
238
  $last = _walkNode.$pos;
240
239
  lastFoundNode = _walkNode.foundNode;
241
240
  } while (lastFoundNode && !$last.parent.isTextblock);
@@ -252,8 +251,8 @@ var listBackspace = function listBackspace(editorAnalyticsAPI) {
252
251
  return function (state, dispatch) {
253
252
  var tr = state.tr,
254
253
  $head = state.selection.$head;
255
- var walkNode = (0, _commands.walkPrevNode)($head);
256
- if (!(0, _commands.isEmptySelectionAtStart)(state)) {
254
+ var walkNode = (0, _utils.walkPrevNode)($head);
255
+ if (!(0, _utils.isEmptySelectionAtStart)(state)) {
257
256
  return false;
258
257
  }
259
258
  var scenario = calcJoinListScenario(walkNode, $head, tr);
@@ -263,7 +262,7 @@ var listBackspace = function listBackspace(editorAnalyticsAPI) {
263
262
  var _state$schema$nodes = state.schema.nodes,
264
263
  bulletList = _state$schema$nodes.bulletList,
265
264
  orderedList = _state$schema$nodes.orderedList;
266
- var listParent = (0, _utils.findParentNodeOfType)([bulletList, orderedList])(tr.selection);
265
+ var listParent = (0, _utils2.findParentNodeOfType)([bulletList, orderedList])(tr.selection);
267
266
  var actionSubjectId = _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_BULLET;
268
267
  if (listParent && listParent.node.type === orderedList) {
269
268
  actionSubjectId = _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.outdentList = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _lists = require("@atlaskit/editor-common/lists");
9
10
  var _analytics = require("@atlaskit/editor-common/analytics");
10
11
  var _selection = require("../utils/selection");
11
- var _node = require("../utils/node");
12
+ var _utils = require("@atlaskit/editor-common/utils");
12
13
  var _find = require("../utils/find");
13
14
  var _analytics2 = require("../utils/analytics");
14
15
  var _outdentListItemsSelected = require("../actions/outdent-list-items-selected");
@@ -32,7 +33,7 @@ var outdentList = function outdentList(editorAnalyticsAPI) {
32
33
 
33
34
  // Save the history, so it could undo/revert to the same state before the outdent, see https://product-fabric.atlassian.net/browse/ED-14753
34
35
  (0, _history.closeHistory)(state.tr);
35
- var actionSubjectId = (0, _node.isBulletList)(parentListNode.node) ? _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
36
+ var actionSubjectId = (0, _utils.isBulletList)(parentListNode.node) ? _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
36
37
  var customTr = state.tr;
37
38
  (0, _outdentListItemsSelected.outdentListItemsSelected)(customTr, state, featureFlags);
38
39
  if (!customTr || !customTr.docChanged) {
@@ -55,7 +56,7 @@ var outdentList = function outdentList(editorAnalyticsAPI) {
55
56
  actionSubject: _analytics.ACTION_SUBJECT.LIST,
56
57
  actionSubjectId: actionSubjectId,
57
58
  eventType: _analytics.EVENT_TYPE.TRACK,
58
- attributes: _objectSpread(_objectSpread(_objectSpread({}, (0, _analytics2.getCommonListAnalyticsAttributes)(state)), restartListsAttributes), {}, {
59
+ attributes: _objectSpread(_objectSpread(_objectSpread({}, (0, _lists.getCommonListAnalyticsAttributes)(state)), restartListsAttributes), {}, {
59
60
  inputMethod: inputMethod
60
61
  })
61
62
  })(customTr);
@@ -11,12 +11,11 @@ var _state = require("@atlaskit/editor-prosemirror/state");
11
11
  var _view = require("@atlaskit/editor-prosemirror/view");
12
12
  var _utils = require("@atlaskit/editor-prosemirror/utils");
13
13
  var _selection = require("../utils/selection");
14
- var _node = require("../utils/node");
14
+ var _utils2 = require("@atlaskit/editor-common/utils");
15
15
  var _pluginStateFactory = require("../../../utils/plugin-state-factory");
16
- var _utils2 = require("../../../utils");
16
+ var _utils3 = require("../../../utils");
17
17
  var _selection2 = require("@atlaskit/editor-common/selection");
18
18
  var _styles = require("@atlaskit/editor-common/styles");
19
- var _utils3 = require("@atlaskit/editor-common/utils");
20
19
  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; }
21
20
  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) { (0, _defineProperty2.default)(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; }
22
21
  var listPluginKey = new _state.PluginKey('listPlugin');
@@ -48,7 +47,7 @@ var getDecorations = function getDecorations(doc, state, featureFlags) {
48
47
  }
49
48
  }
50
49
  }
51
- if ((0, _node.isListNode)(node)) {
50
+ if ((0, _utils2.isListNode)(node)) {
52
51
  processedListsStack.push({
53
52
  node: node,
54
53
  startPos: currentNodeStartPos
@@ -63,7 +62,7 @@ var getDecorations = function getDecorations(doc, state, featureFlags) {
63
62
  var _node$attrs;
64
63
  // If a numbered list has item counters numbering >= 100, we'll need to add special
65
64
  // spacing to account for the extra digit chars
66
- var digitsSize = (0, _utils3.getItemCounterDigitsSize)({
65
+ var digitsSize = (0, _utils2.getItemCounterDigitsSize)({
67
66
  itemsCount: node === null || node === void 0 ? void 0 : node.childCount,
68
67
  order: node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.order
69
68
  });
@@ -156,7 +155,7 @@ var createPlugin = function createPlugin(eventDispatch, featureFlags) {
156
155
  if (isCodeBlockNextToListMarker) {
157
156
  // +1 needed to put cursor inside li
158
157
  // otherwise gap cursor markup will be injected as immediate child of ul resulting in invalid html
159
- (0, _utils2.setGapCursorSelection)(view, pos + 1, _selection2.Side.LEFT);
158
+ (0, _utils3.setGapCursorSelection)(view, pos + 1, _selection2.Side.LEFT);
160
159
  return true;
161
160
  }
162
161
  }
@@ -4,44 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.storeRestartListsAttributes = exports.getRestartListsAttributes = exports.getCommonListAnalyticsAttributes = exports.countListItemsInSelection = exports.RESTART_LISTS_ANALYTICS_KEY = void 0;
7
+ exports.storeRestartListsAttributes = exports.getRestartListsAttributes = exports.RESTART_LISTS_ANALYTICS_KEY = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _utils = require("@atlaskit/editor-common/utils");
10
- var _selection = require("./selection");
11
9
  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; }
12
10
  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) { (0, _defineProperty2.default)(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; }
13
- var getCommonListAnalyticsAttributes = function getCommonListAnalyticsAttributes(state) {
14
- var _state$selection = state.selection,
15
- $from = _state$selection.$from,
16
- $to = _state$selection.$to;
17
- var fromAttrs = (0, _selection.getListItemAttributes)($from);
18
- var toAttrs = (0, _selection.getListItemAttributes)($to);
19
- return {
20
- itemIndexAtSelectionStart: fromAttrs.itemIndex,
21
- itemIndexAtSelectionEnd: toAttrs.itemIndex,
22
- indentLevelAtSelectionStart: fromAttrs.indentLevel,
23
- indentLevelAtSelectionEnd: toAttrs.indentLevel,
24
- itemsInSelection: countListItemsInSelection(state)
25
- };
26
- };
27
- exports.getCommonListAnalyticsAttributes = getCommonListAnalyticsAttributes;
28
- var countListItemsInSelection = function countListItemsInSelection(state) {
29
- var _state$selection2 = state.selection,
30
- from = _state$selection2.from,
31
- to = _state$selection2.to;
32
- if (from === to) {
33
- return 1;
34
- }
35
- var count = 0;
36
- var listSlice = state.doc.cut(from, to);
37
- listSlice.content.nodesBetween(0, listSlice.content.size, function (node, pos, parent, index) {
38
- if (parent && (0, _utils.isListItemNode)(parent) && !(0, _utils.isListNode)(node) && index === 0) {
39
- count++;
40
- }
41
- });
42
- return count;
43
- };
44
- exports.countListItemsInSelection = countListItemsInSelection;
45
11
  var RESTART_LISTS_ANALYTICS_KEY = 'restartListsAnalytics';
46
12
  exports.RESTART_LISTS_ANALYTICS_KEY = RESTART_LISTS_ANALYTICS_KEY;
47
13
  var getRestartListsAttributes = function getRestartListsAttributes(tr) {
@@ -3,8 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.hasValidListIndentationLevel = exports.getListLiftTarget = void 0;
7
- var _selection = require("./selection");
6
+ exports.getListLiftTarget = void 0;
8
7
  var _utils = require("@atlaskit/editor-common/utils");
9
8
  // This will return (depth - 1) for root list parent of a list.
10
9
  var getListLiftTarget = function getListLiftTarget(resPos) {
@@ -20,21 +19,4 @@ var getListLiftTarget = function getListLiftTarget(resPos) {
20
19
  }
21
20
  return target - 1;
22
21
  };
23
- exports.getListLiftTarget = getListLiftTarget;
24
- var hasValidListIndentationLevel = function hasValidListIndentationLevel(_ref) {
25
- var tr = _ref.tr,
26
- maxIndentation = _ref.maxIndentation;
27
- var initialIndentationLevel = (0, _selection.numberNestedLists)(tr.selection.$from);
28
- var currentIndentationLevel;
29
- var currentPos = tr.selection.$to.pos;
30
- do {
31
- var resolvedPos = tr.doc.resolve(currentPos);
32
- currentIndentationLevel = (0, _selection.numberNestedLists)(resolvedPos);
33
- if (currentIndentationLevel > maxIndentation) {
34
- return false;
35
- }
36
- currentPos++;
37
- } while (currentIndentationLevel >= initialIndentationLevel);
38
- return true;
39
- };
40
- exports.hasValidListIndentationLevel = hasValidListIndentationLevel;
22
+ exports.getListLiftTarget = getListLiftTarget;
@@ -3,32 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.JoinDirection = void 0;
7
- Object.defineProperty(exports, "isBulletList", {
8
- enumerable: true,
9
- get: function get() {
10
- return _utils.isBulletList;
11
- }
12
- });
13
- Object.defineProperty(exports, "isListItemNode", {
14
- enumerable: true,
15
- get: function get() {
16
- return _utils.isListItemNode;
17
- }
18
- });
19
- Object.defineProperty(exports, "isListNode", {
20
- enumerable: true,
21
- get: function get() {
22
- return _utils.isListNode;
23
- }
24
- });
25
- Object.defineProperty(exports, "isParagraphNode", {
26
- enumerable: true,
27
- get: function get() {
28
- return _utils.isParagraphNode;
29
- }
30
- });
31
- exports.joinSiblingLists = void 0;
6
+ exports.isListNodeValidContent = isListNodeValidContent;
32
7
  var _model = require("@atlaskit/editor-prosemirror/model");
33
8
  var _utils = require("@atlaskit/editor-common/utils");
34
9
  function isListNodeValidContent(node) {
@@ -38,83 +13,4 @@ function isListNodeValidContent(node) {
38
13
  }
39
14
  var listFragment = _model.Fragment.from(bulletList.createAndFill());
40
15
  return !(0, _utils.isListItemNode)(node) && node.type.validContent(listFragment);
41
- }
42
- var JoinDirection = /*#__PURE__*/function (JoinDirection) {
43
- JoinDirection[JoinDirection["LEFT"] = 1] = "LEFT";
44
- JoinDirection[JoinDirection["RIGHT"] = -1] = "RIGHT";
45
- return JoinDirection;
46
- }({});
47
- exports.JoinDirection = JoinDirection;
48
- var joinSiblingLists = function joinSiblingLists(_ref) {
49
- var tr = _ref.tr,
50
- direction = _ref.direction,
51
- forceListType = _ref.forceListType;
52
- var result = {
53
- orderedList: 0,
54
- bulletList: 0
55
- };
56
- var doc = tr.doc,
57
- _tr$selection = tr.selection,
58
- $from = _tr$selection.$from,
59
- $to = _tr$selection.$to,
60
- selection = tr.selection;
61
- var range = $from.blockRange($to, isListNodeValidContent);
62
- if (!range) {
63
- return result;
64
- }
65
- var rootListNode = doc.nodeAt(range.start);
66
- var from = (0, _utils.isListNode)(rootListNode) ? range.start : 0;
67
- var to = (0, _utils.isListNode)(rootListNode) ? range.end : tr.doc.content.size;
68
- var joins = [];
69
- doc.nodesBetween(from, to, function (node, pos, parent) {
70
- var resolvedPos = doc.resolve(pos);
71
- var nodeBefore = resolvedPos.nodeBefore,
72
- nodeAfter = resolvedPos.nodeAfter;
73
- if (!nodeBefore || !nodeAfter || !(0, _utils.isListNode)(nodeBefore) || !(0, _utils.isListNode)(nodeAfter)) {
74
- return;
75
- }
76
- var isNestedList = (0, _utils.isListItemNode)(parent);
77
- if (!isNestedList && nodeBefore.type !== nodeAfter.type && !forceListType) {
78
- return;
79
- }
80
- var index = resolvedPos.index();
81
- var positionPreviousNode = resolvedPos.posAtIndex(index - 1);
82
- var positionCurrentNode = resolvedPos.posAtIndex(index);
83
-
84
- // If the previous node is part of the selection, OR
85
- // If the previous node is not part of the selection and the previous node has the same list type that we’re converting to
86
- var joinBefore = positionPreviousNode >= from || nodeBefore.type === forceListType;
87
- if (forceListType) {
88
- if (joinBefore) {
89
- tr.setNodeMarkup(positionPreviousNode, forceListType);
90
- }
91
- tr.setNodeMarkup(positionCurrentNode, forceListType);
92
- }
93
- if (isNestedList && nodeBefore.type !== nodeAfter.type) {
94
- var nodeType = direction === JoinDirection.RIGHT ? nodeAfter.type : nodeBefore.type;
95
- tr.setNodeMarkup(positionPreviousNode, nodeType);
96
- }
97
- if (joinBefore) {
98
- joins.push(pos);
99
- }
100
- });
101
- if (selection.empty && rootListNode && (0, _utils.isListNode)(rootListNode)) {
102
- var resolvedPos = doc.resolve(range.start + rootListNode.nodeSize);
103
- var nodeBefore = resolvedPos.nodeBefore,
104
- nodeAfter = resolvedPos.nodeAfter;
105
- if (nodeBefore && nodeAfter && (0, _utils.isListNode)(nodeBefore) && (0, _utils.isListNode)(nodeAfter) && nodeAfter.type === nodeBefore.type) {
106
- joins.push(resolvedPos.pos);
107
- }
108
- }
109
- for (var i = joins.length - 1; i >= 0; i--) {
110
- var listNode = tr.doc.nodeAt(joins[i]);
111
- var listName = listNode === null || listNode === void 0 ? void 0 : listNode.type.name;
112
- if (listName && (listName === 'orderedList' || listName === 'bulletList')) {
113
- var amount = result[listName] || 0;
114
- result[listName] = amount + 1;
115
- }
116
- tr.join(joins[i]);
117
- }
118
- return result;
119
- };
120
- exports.joinSiblingLists = joinSiblingLists;
16
+ }
@@ -3,9 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.selectionContainsList = exports.numberNestedLists = exports.normalizeListItemsSelection = exports.isWrappingPossible = exports.isPosInsideParagraph = exports.isPosInsideList = exports.isInsideTableCell = exports.isInsideListItem = exports.getListItemAttributes = exports.createListNodeRange = exports.canJoinToPreviousListItem = void 0;
6
+ exports.selectionContainsList = exports.isWrappingPossible = exports.isPosInsideParagraph = exports.isPosInsideList = exports.isInsideTableCell = exports.isInsideListItem = exports.createListNodeRange = exports.canJoinToPreviousListItem = void 0;
7
7
  var _transform = require("@atlaskit/editor-prosemirror/transform");
8
- var _state = require("@atlaskit/editor-prosemirror/state");
9
8
  var _utils = require("@atlaskit/editor-prosemirror/utils");
10
9
  var _selection = require("@atlaskit/editor-common/selection");
11
10
  var _utils2 = require("@atlaskit/editor-common/utils");
@@ -83,58 +82,8 @@ var selectionContainsList = function selectionContainsList(tr) {
83
82
  return foundListNode;
84
83
  };
85
84
  exports.selectionContainsList = selectionContainsList;
86
- var numberNestedLists = function numberNestedLists(resolvedPos) {
87
- var count = 0;
88
- for (var i = resolvedPos.depth - 1; i > 0; i--) {
89
- var node = resolvedPos.node(i);
90
- if ((0, _utils2.isListNode)(node)) {
91
- count += 1;
92
- }
93
- }
94
- return count;
95
- };
96
- exports.numberNestedLists = numberNestedLists;
97
- var getListItemAttributes = function getListItemAttributes($pos) {
98
- var indentLevel = numberNestedLists($pos) - 1;
99
- var itemAtPos = (0, _utils.findParentNodeClosestToPos)($pos, _utils2.isListItemNode);
100
-
101
- // Get the index of the current item relative to parent (parent is at item depth - 1)
102
- var itemIndex = $pos.index(itemAtPos ? itemAtPos.depth - 1 : undefined);
103
- return {
104
- indentLevel: indentLevel,
105
- itemIndex: itemIndex
106
- };
107
- };
108
- exports.getListItemAttributes = getListItemAttributes;
109
- var normalizeListItemsSelection = function normalizeListItemsSelection(_ref) {
110
- var selection = _ref.selection,
111
- doc = _ref.doc;
112
- if (selection.empty) {
113
- return selection;
114
- }
115
- var $from = selection.$from,
116
- $to = selection.$to;
117
- if (selection instanceof _state.NodeSelection) {
118
- var _head = resolvePositionToStartOfListItem($from);
119
- return new _state.TextSelection(_head, _head);
120
- }
121
- var head = resolvePositionToStartOfListItem($from);
122
- var anchor = resolvePositionToEndOfListItem($to);
123
- return new _state.TextSelection(anchor, head);
124
- };
125
- exports.normalizeListItemsSelection = normalizeListItemsSelection;
126
- var resolvePositionToStartOfListItem = function resolvePositionToStartOfListItem($pos) {
127
- var fromRange = $pos.blockRange($pos, _utils2.isListItemNode);
128
- var fromPosition = fromRange && $pos.textOffset === 0 && fromRange.end - 1 === $pos.pos ? _state.Selection.near($pos.doc.resolve(fromRange.end + 1), 1).$from : $pos;
129
- return fromPosition;
130
- };
131
- var resolvePositionToEndOfListItem = function resolvePositionToEndOfListItem($pos) {
132
- var toRange = $pos.blockRange($pos, _utils2.isListItemNode);
133
- var toPosition = toRange && $pos.textOffset === 0 && toRange.start + 1 === $pos.pos ? _state.Selection.near($pos.doc.resolve(toRange.start - 1), -1).$to : $pos;
134
- return toPosition;
135
- };
136
- var createListNodeRange = function createListNodeRange(_ref2) {
137
- var selection = _ref2.selection;
85
+ var createListNodeRange = function createListNodeRange(_ref) {
86
+ var selection = _ref.selection;
138
87
  var $from = selection.$from,
139
88
  $to = selection.$to;
140
89
  var range = $from.blockRange($to, _utils2.isListNode);
@@ -12,7 +12,7 @@ var _adfSchema = require("@atlaskit/adf-schema");
12
12
  var _analytics = require("../analytics");
13
13
  var _gapCursorSelection = require("../selection/gap-cursor-selection");
14
14
  var _pluginKey = require("./pm-plugins/plugin-key");
15
- var _autojoin = require("../../utils/prosemirror/autojoin");
15
+ var _utils2 = require("@atlaskit/editor-common/utils");
16
16
  var getContextData = function getContextData() {
17
17
  var contextProvider = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18
18
  var objectId = contextProvider.objectId,
@@ -102,7 +102,7 @@ var insertTaskDecisionAction = function insertTaskDecisionAction(state, listType
102
102
  if (!tr) {
103
103
  return state.tr;
104
104
  }
105
- (0, _autojoin.autoJoinTr)(tr, ['taskList', 'decisionList']);
105
+ (0, _utils2.autoJoinTr)(tr, ['taskList', 'decisionList']);
106
106
  return tr;
107
107
  };
108
108
  exports.insertTaskDecisionAction = insertTaskDecisionAction;