@atlaskit/editor-plugin-list 1.3.2 → 1.3.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/actions/indent-list-items-selected.js +1 -2
  3. package/dist/cjs/actions/indent-list.js +2 -3
  4. package/dist/cjs/actions/join-list-items-forward.js +2 -3
  5. package/dist/cjs/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +1 -2
  6. package/dist/cjs/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +2 -3
  7. package/dist/cjs/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +2 -3
  8. package/dist/cjs/actions/join-list-items-scenarios/join-paragraph-with-list.js +2 -3
  9. package/dist/cjs/actions/join-list-items-scenarios/join-sibling-list-items.js +2 -3
  10. package/dist/cjs/actions/outdent-list-items-selected.js +3 -4
  11. package/dist/cjs/commands/indent-list.js +3 -4
  12. package/dist/cjs/commands/index.js +10 -17
  13. package/dist/cjs/commands/isFirstChildOfParent.js +2 -3
  14. package/dist/cjs/commands/join-list-item-forward.js +3 -4
  15. package/dist/cjs/commands/listBackspace.js +4 -6
  16. package/dist/cjs/commands/outdent-list.js +3 -4
  17. package/dist/cjs/messages.js +2 -3
  18. package/dist/cjs/plugin.js +7 -8
  19. package/dist/cjs/pm-plugins/input-rules/wrapping-join-rule.js +2 -3
  20. package/dist/cjs/pm-plugins/keymap.js +1 -2
  21. package/dist/cjs/pm-plugins/main.js +8 -11
  22. package/dist/cjs/types.js +1 -2
  23. package/dist/cjs/utils/analytics.js +4 -7
  24. package/dist/cjs/utils/find.js +2 -3
  25. package/dist/cjs/utils/indentation.js +2 -3
  26. package/dist/cjs/utils/mark.js +2 -3
  27. package/dist/cjs/utils/selection.js +9 -17
  28. package/dist/esm/actions/outdent-list-items-selected.js +2 -2
  29. package/dist/esm/commands/indent-list.js +1 -1
  30. package/dist/esm/commands/index.js +3 -3
  31. package/dist/esm/commands/join-list-item-forward.js +1 -1
  32. package/dist/esm/commands/listBackspace.js +1 -1
  33. package/dist/esm/commands/outdent-list.js +1 -1
  34. package/dist/esm/plugin.js +5 -5
  35. package/dist/esm/pm-plugins/main.js +4 -4
  36. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-plugin-list
2
2
 
3
+ ## 1.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#43379](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43379) [`482c025520d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/482c025520d) - ED-20763 Upgrade ADF schema version to 33.2.3 for MBE nodes.
8
+ - Updated dependencies
9
+
10
+ ## 1.3.3
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 1.3.2
4
17
 
5
18
  ### Patch Changes
@@ -12,7 +12,7 @@ var _utils = require("@atlaskit/editor-common/utils");
12
12
  var _model = require("@atlaskit/editor-prosemirror/model");
13
13
  var _state = require("@atlaskit/editor-prosemirror/state");
14
14
  var _find = require("../utils/find");
15
- var indentListItemsSelected = function indentListItemsSelected(tr) {
15
+ var indentListItemsSelected = exports.indentListItemsSelected = function indentListItemsSelected(tr) {
16
16
  var originalSelection = tr.selection;
17
17
  var normalizedSelection = (0, _lists.normalizeListItemsSelection)({
18
18
  selection: originalSelection,
@@ -78,7 +78,6 @@ var indentListItemsSelected = function indentListItemsSelected(tr) {
78
78
  });
79
79
  tr.setSelection(nextSelection);
80
80
  };
81
- exports.indentListItemsSelected = indentListItemsSelected;
82
81
  var calculateRange = function calculateRange(_ref) {
83
82
  var selection = _ref.selection;
84
83
  var $from = selection.$from,
@@ -7,7 +7,7 @@ exports.indentList = void 0;
7
7
  var _model = require("@atlaskit/editor-prosemirror/model");
8
8
  var _transform = require("@atlaskit/editor-prosemirror/transform");
9
9
  // adapted from https://github.com/ProseMirror/prosemirror-schema-list/blob/master/src/schema-list.js#L206:L231
10
- var indentList = function indentList(tr) {
10
+ var indentList = exports.indentList = function indentList(tr) {
11
11
  var _tr$selection = tr.selection,
12
12
  $from = _tr$selection.$from,
13
13
  $to = _tr$selection.$to;
@@ -45,5 +45,4 @@ var indentList = function indentList(tr) {
45
45
  var before = range.start;
46
46
  var after = range.end;
47
47
  tr.step(new _transform.ReplaceAroundStep(before - (isPreviousListNested ? 3 : 1), after, before, after, slice, 1, true));
48
- };
49
- exports.indentList = indentList;
48
+ };
@@ -8,7 +8,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
8
8
  var _utils = require("@atlaskit/editor-common/utils");
9
9
  var _selection = require("../utils/selection");
10
10
  var _joinListItemsScenarios = require("./join-list-items-scenarios");
11
- var calcJoinListScenario = function calcJoinListScenario(walkNode, $head) {
11
+ var calcJoinListScenario = exports.calcJoinListScenario = function calcJoinListScenario(walkNode, $head) {
12
12
  var $next = walkNode.$pos,
13
13
  nextFoundNode = walkNode.foundNode;
14
14
  var headParent = $head.parent;
@@ -55,5 +55,4 @@ var calcJoinListScenario = function calcJoinListScenario(walkNode, $head) {
55
55
  return [_analytics.LIST_TEXT_SCENARIOS.JOIN_SIBLINGS, _joinListItemsScenarios.joinSiblingListItems];
56
56
  }
57
57
  return [_analytics.LIST_TEXT_SCENARIOS.JOIN_PARENT_SIBLING_TO_PARENT_CHILD, _joinListItemsScenarios.joinListItemWithParentNestedList];
58
- };
59
- exports.calcJoinListScenario = calcJoinListScenario;
58
+ };
@@ -8,7 +8,7 @@ var _utils = require("@atlaskit/editor-common/utils");
8
8
  var _model = require("@atlaskit/editor-prosemirror/model");
9
9
  // Case for when a users selection is at the end of a paragraph, the paragraph
10
10
  // is followed by a list, and they delete forward
11
- var joinListItemWithParagraph = function joinListItemWithParagraph(_ref) {
11
+ var joinListItemWithParagraph = exports.joinListItemWithParagraph = function joinListItemWithParagraph(_ref) {
12
12
  var tr = _ref.tr,
13
13
  $next = _ref.$next,
14
14
  $head = _ref.$head;
@@ -82,7 +82,6 @@ var joinListItemWithParagraph = function joinListItemWithParagraph(_ref) {
82
82
  }, insertions, deletions);
83
83
  return true;
84
84
  };
85
- exports.joinListItemWithParagraph = joinListItemWithParagraph;
86
85
  var hasSingleChild = function hasSingleChild(node) {
87
86
  return node.childCount === 1;
88
87
  };
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.joinListItemWithParentNestedList = void 0;
7
7
  var _utils = require("@atlaskit/editor-common/utils");
8
8
  //Case for two adjacent list items with the first being of greater indentation
9
- var joinListItemWithParentNestedList = function joinListItemWithParentNestedList(_ref) {
9
+ var joinListItemWithParentNestedList = exports.joinListItemWithParentNestedList = function joinListItemWithParentNestedList(_ref) {
10
10
  var tr = _ref.tr,
11
11
  $next = _ref.$next,
12
12
  $head = _ref.$head;
@@ -81,5 +81,4 @@ var joinListItemWithParentNestedList = function joinListItemWithParentNestedList
81
81
  return tr.doc.resolve(textInsertPos);
82
82
  }, containsChildrenO ? [[textContent, textInsertPos], [childrenMContent, childrenMInsertPos], [childrenOContent, childrenOInsertPos]] : [[textContent, textInsertPos], [childrenMContent, childrenMInsertPos]], [[beforeListItemK, afterListItemK]]);
83
83
  return true;
84
- };
85
- exports.joinListItemWithParentNestedList = joinListItemWithParentNestedList;
84
+ };
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.joinNestedListWithParentListItem = void 0;
7
7
  var _utils = require("@atlaskit/editor-common/utils");
8
8
  //Case for two adjacent list items with the first being of lower indentation
9
- var joinNestedListWithParentListItem = function joinNestedListWithParentListItem(_ref) {
9
+ var joinNestedListWithParentListItem = exports.joinNestedListWithParentListItem = function joinNestedListWithParentListItem(_ref) {
10
10
  var tr = _ref.tr,
11
11
  $next = _ref.$next,
12
12
  $head = _ref.$head;
@@ -75,5 +75,4 @@ var joinNestedListWithParentListItem = function joinNestedListWithParentListItem
75
75
  return tr.doc.resolve(textInsertPos);
76
76
  }, containsChildrenJ ? [[textContent, textInsertPos], [childrenHContent, childrenHInsertPos], [childrenJContent, childrenJInsertPos]] : [[textContent, textInsertPos], [childrenHContent, childrenHInsertPos]], [shouldRemoveListE ? [beforeListE, afterListE] : [beforeListItemF, afterListItemF]]);
77
77
  return true;
78
- };
79
- exports.joinNestedListWithParentListItem = joinNestedListWithParentListItem;
78
+ };
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.joinParagrapWithList = void 0;
7
7
  var _utils = require("@atlaskit/editor-common/utils");
8
8
  //Case for two adjacent nodes with the first being a list item and the last being a paragraph
9
- var joinParagrapWithList = function joinParagrapWithList(_ref) {
9
+ var joinParagrapWithList = exports.joinParagrapWithList = function joinParagrapWithList(_ref) {
10
10
  var tr = _ref.tr,
11
11
  $next = _ref.$next,
12
12
  $head = _ref.$head;
@@ -41,5 +41,4 @@ var joinParagrapWithList = function joinParagrapWithList(_ref) {
41
41
  return tr.doc.resolve(textInsertPos);
42
42
  }, [[textContent, textInsertPos]], [[beforeParagraphE, afterParagraphE]]);
43
43
  return true;
44
- };
45
- exports.joinParagrapWithList = joinParagrapWithList;
44
+ };
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.joinSiblingListItems = void 0;
7
7
  var _utils = require("@atlaskit/editor-common/utils");
8
8
  //Case for two adjacent list items of the same indentation
9
- var joinSiblingListItems = function joinSiblingListItems(_ref) {
9
+ var joinSiblingListItems = exports.joinSiblingListItems = function joinSiblingListItems(_ref) {
10
10
  var tr = _ref.tr,
11
11
  $next = _ref.$next,
12
12
  $head = _ref.$head;
@@ -52,5 +52,4 @@ var joinSiblingListItems = function joinSiblingListItems(_ref) {
52
52
  return tr.doc.resolve(textInsertPos);
53
53
  }, [[textContent, textInsertPos], [childrenGContent, childrenGInsertPos]], [[beforeListItemE, afterListItemE]]);
54
54
  return true;
55
- };
56
- exports.joinSiblingListItems = joinSiblingListItems;
55
+ };
@@ -18,7 +18,7 @@ var _find = require("../utils/find");
18
18
  var _selection2 = require("../utils/selection");
19
19
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
20
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
- var outdentListItemsSelected = function outdentListItemsSelected(tr, featureFlags) {
21
+ var outdentListItemsSelected = exports.outdentListItemsSelected = function outdentListItemsSelected(tr, featureFlags) {
22
22
  var originalSelection = tr.selection;
23
23
  var normalizedSelection = (0, _lists.normalizeListItemsSelection)({
24
24
  selection: tr.selection,
@@ -74,7 +74,6 @@ var outdentListItemsSelected = function outdentListItemsSelected(tr, featureFlag
74
74
  direction: _lists.JoinDirection.RIGHT
75
75
  });
76
76
  };
77
- exports.outdentListItemsSelected = outdentListItemsSelected;
78
77
  var calculateNewSelection = function calculateNewSelection(_ref) {
79
78
  var tr = _ref.tr,
80
79
  originalSelection = _ref.originalSelection,
@@ -228,10 +227,10 @@ var extractListItemsRangeFromList = function extractListItemsRangeFromList(_ref3
228
227
  if (node.type.name === 'orderedList' && ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.order) === nextListStartNumber) {
229
228
  var _prev$attrs;
230
229
  var prev = nextListFragment.child(index - 1);
231
- if ((prev === null || prev === void 0 ? void 0 : (_prev$attrs = prev.attrs) === null || _prev$attrs === void 0 ? void 0 : _prev$attrs.order) >= 0) {
230
+ if ((prev === null || prev === void 0 || (_prev$attrs = prev.attrs) === null || _prev$attrs === void 0 ? void 0 : _prev$attrs.order) >= 0) {
232
231
  var _prev$attrs2;
233
232
  (0, _analytics2.storeRestartListsAttributes)(tr, {
234
- splitListStartNumber: prev === null || prev === void 0 ? void 0 : (_prev$attrs2 = prev.attrs) === null || _prev$attrs2 === void 0 ? void 0 : _prev$attrs2.order
233
+ splitListStartNumber: prev === null || prev === void 0 || (_prev$attrs2 = prev.attrs) === null || _prev$attrs2 === void 0 ? void 0 : _prev$attrs2.order
235
234
  });
236
235
  }
237
236
  }
@@ -17,7 +17,7 @@ var _find = require("../utils/find");
17
17
  var _selection = require("../utils/selection");
18
18
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
19
19
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
20
- var indentList = function indentList(editorAnalyticsAPI) {
20
+ var indentList = exports.indentList = function indentList(editorAnalyticsAPI) {
21
21
  return function () {
22
22
  var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
23
23
  return function (_ref) {
@@ -53,7 +53,7 @@ var indentList = function indentList(editorAnalyticsAPI) {
53
53
  // Even though this is a non-operation, we don't want to send this event to the browser. Because if we return false, the browser will move the focus to another place
54
54
  return new _preset.PassiveTransaction();
55
55
  }
56
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
56
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
57
57
  action: _analytics.ACTION.INDENTED,
58
58
  actionSubject: _analytics.ACTION_SUBJECT.LIST,
59
59
  actionSubjectId: actionSubjectId,
@@ -65,5 +65,4 @@ var indentList = function indentList(editorAnalyticsAPI) {
65
65
  return tr;
66
66
  };
67
67
  };
68
- };
69
- exports.indentList = indentList;
68
+ };
@@ -41,7 +41,7 @@ var _listBackspace = require("./listBackspace");
41
41
  var _outdentList = require("./outdent-list");
42
42
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
43
43
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
44
- var enterKeyCommand = function enterKeyCommand(editorAnalyticsAPI) {
44
+ var enterKeyCommand = exports.enterKeyCommand = function enterKeyCommand(editorAnalyticsAPI) {
45
45
  return function (featureFlags) {
46
46
  return function (state, dispatch) {
47
47
  var selection = state.selection;
@@ -65,8 +65,7 @@ var enterKeyCommand = function enterKeyCommand(editorAnalyticsAPI) {
65
65
  };
66
66
  };
67
67
  };
68
- exports.enterKeyCommand = enterKeyCommand;
69
- var backspaceKeyCommand = function backspaceKeyCommand(editorAnalyticsAPI) {
68
+ var backspaceKeyCommand = exports.backspaceKeyCommand = function backspaceKeyCommand(editorAnalyticsAPI) {
70
69
  return function (featureFlags) {
71
70
  return function (state, dispatch) {
72
71
  return (0, _commands2.chainCommands)((0, _listBackspace.listBackspace)(editorAnalyticsAPI),
@@ -85,14 +84,12 @@ var backspaceKeyCommand = function backspaceKeyCommand(editorAnalyticsAPI) {
85
84
  };
86
85
  };
87
86
  };
88
- exports.backspaceKeyCommand = backspaceKeyCommand;
89
- var deleteKeyCommand = function deleteKeyCommand(editorAnalyticsAPI) {
87
+ var deleteKeyCommand = exports.deleteKeyCommand = function deleteKeyCommand(editorAnalyticsAPI) {
90
88
  return (0, _joinListItemForward.joinListItemForward)(editorAnalyticsAPI);
91
89
  };
92
90
 
93
91
  // Get the depth of the nearest ancestor list
94
- exports.deleteKeyCommand = deleteKeyCommand;
95
- var rootListDepth = function rootListDepth(pos, nodes) {
92
+ var rootListDepth = exports.rootListDepth = function rootListDepth(pos, nodes) {
96
93
  var bulletList = nodes.bulletList,
97
94
  orderedList = nodes.orderedList,
98
95
  listItem = nodes.listItem;
@@ -108,7 +105,6 @@ var rootListDepth = function rootListDepth(pos, nodes) {
108
105
  }
109
106
  return depth;
110
107
  };
111
- exports.rootListDepth = rootListDepth;
112
108
  function untoggleSelectedList(tr) {
113
109
  var _tr = tr,
114
110
  selection = _tr.selection;
@@ -119,7 +115,7 @@ function untoggleSelectedList(tr) {
119
115
  }
120
116
  return (0, _transforms.liftTextSelectionList)(selection, tr);
121
117
  }
122
- var toggleList = function toggleList(editorAnalyticsAPI) {
118
+ var toggleList = exports.toggleList = function toggleList(editorAnalyticsAPI) {
123
119
  return function (inputMethod, listType) {
124
120
  return function (_ref) {
125
121
  var tr = _ref.tr;
@@ -138,7 +134,7 @@ var toggleList = function toggleList(editorAnalyticsAPI) {
138
134
  if ((fromNode === null || fromNode === void 0 ? void 0 : fromNode.type.name) === listType && (toNode === null || toNode === void 0 ? void 0 : toNode.type.name) === listType) {
139
135
  var commonAttributes = (0, _lists.getCommonListAnalyticsAttributes)(tr);
140
136
  untoggleSelectedList(tr);
141
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
137
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
142
138
  action: _analytics.ACTION.CONVERTED,
143
139
  actionSubject: _analytics.ACTION_SUBJECT.LIST,
144
140
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.TEXT,
@@ -154,7 +150,7 @@ var toggleList = function toggleList(editorAnalyticsAPI) {
154
150
  tr: tr,
155
151
  nextListNodeType: listNodeType
156
152
  });
157
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
153
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
158
154
  action: _analytics.ACTION.CONVERTED,
159
155
  actionSubject: _analytics.ACTION_SUBJECT.LIST,
160
156
  actionSubjectId: actionSubjectId,
@@ -169,7 +165,7 @@ var toggleList = function toggleList(editorAnalyticsAPI) {
169
165
  // For example, if trying to convert centre or right aligned paragraphs to lists
170
166
  (0, _mark.sanitiseMarksInSelection)(tr, listNodeType);
171
167
  (0, _wrapAndJoinLists.wrapInListAndJoin)(listNodeType, tr);
172
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
168
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
173
169
  action: _analytics.ACTION.INSERTED,
174
170
  actionSubject: _analytics.ACTION_SUBJECT.LIST,
175
171
  actionSubjectId: actionSubjectId,
@@ -189,15 +185,13 @@ var toggleList = function toggleList(editorAnalyticsAPI) {
189
185
  };
190
186
  };
191
187
  };
192
- exports.toggleList = toggleList;
193
- var toggleBulletList = function toggleBulletList(editorAnalyticsAPI) {
188
+ var toggleBulletList = exports.toggleBulletList = function toggleBulletList(editorAnalyticsAPI) {
194
189
  return function () {
195
190
  var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.TOOLBAR;
196
191
  return toggleList(editorAnalyticsAPI)(inputMethod, 'bulletList');
197
192
  };
198
193
  };
199
- exports.toggleBulletList = toggleBulletList;
200
- var toggleOrderedList = function toggleOrderedList(editorAnalyticsAPI) {
194
+ var toggleOrderedList = exports.toggleOrderedList = function toggleOrderedList(editorAnalyticsAPI) {
201
195
  return function () {
202
196
  var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.TOOLBAR;
203
197
  return toggleList(editorAnalyticsAPI)(inputMethod, 'orderedList');
@@ -209,7 +203,6 @@ var toggleOrderedList = function toggleOrderedList(editorAnalyticsAPI) {
209
203
  * @param itemType Node
210
204
  * Splits the list items, specific implementation take from PM
211
205
  */
212
- exports.toggleOrderedList = toggleOrderedList;
213
206
  function splitListItem(itemType) {
214
207
  return function (state, dispatch) {
215
208
  var ref = state.selection;
@@ -5,8 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.isFirstChildOfParent = void 0;
7
7
  var _selection = require("@atlaskit/editor-common/selection");
8
- var isFirstChildOfParent = function isFirstChildOfParent(state) {
8
+ var isFirstChildOfParent = exports.isFirstChildOfParent = function isFirstChildOfParent(state) {
9
9
  var $from = state.selection.$from;
10
10
  return $from.depth > 1 ? state.selection instanceof _selection.GapCursorSelection && $from.parentOffset === 0 || $from.index($from.depth - 1) === 0 : true;
11
- };
12
- exports.isFirstChildOfParent = isFirstChildOfParent;
11
+ };
@@ -10,7 +10,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
10
10
  var _utils = require("@atlaskit/editor-common/utils");
11
11
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
12
12
  var _joinListItemsForward = require("../actions/join-list-items-forward");
13
- var joinListItemForward = function joinListItemForward(editorAnalyticsAPI) {
13
+ var joinListItemForward = exports.joinListItemForward = function joinListItemForward(editorAnalyticsAPI) {
14
14
  return function (state, dispatch) {
15
15
  var tr = state.tr,
16
16
  $head = state.selection.$head;
@@ -41,7 +41,7 @@ var joinListItemForward = function joinListItemForward(editorAnalyticsAPI) {
41
41
  if (listParent && listParent.node.type === orderedList) {
42
42
  actionSubjectId = _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
43
43
  }
44
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
44
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
45
45
  action: _analytics.ACTION.LIST_ITEM_JOINED,
46
46
  actionSubject: _analytics.ACTION_SUBJECT.LIST,
47
47
  actionSubjectId: actionSubjectId,
@@ -57,5 +57,4 @@ var joinListItemForward = function joinListItemForward(editorAnalyticsAPI) {
57
57
  }
58
58
  return true;
59
59
  };
60
- };
61
- exports.joinListItemForward = joinListItemForward;
60
+ };
@@ -209,7 +209,7 @@ var listBackspaceCase4 = function listBackspaceCase4(tr, dispatch, $prev, $head,
209
209
  return true;
210
210
  };
211
211
  var BACKSPACE_COMMANDS = (_BACKSPACE_COMMANDS = {}, (0, _defineProperty2.default)(_BACKSPACE_COMMANDS, _analytics.LIST_TEXT_SCENARIOS.JOIN_SIBLINGS, listBackspaceCase2), (0, _defineProperty2.default)(_BACKSPACE_COMMANDS, _analytics.LIST_TEXT_SCENARIOS.JOIN_DESCENDANT_TO_PARENT, listBackspaceCase3), (0, _defineProperty2.default)(_BACKSPACE_COMMANDS, _analytics.LIST_TEXT_SCENARIOS.JOIN_TO_SIBLING_DESCENDANT, listBackspaceCase4), _BACKSPACE_COMMANDS);
212
- var calcJoinListScenario = function calcJoinListScenario(walkNode, $head, tr) {
212
+ var calcJoinListScenario = exports.calcJoinListScenario = function calcJoinListScenario(walkNode, $head, tr) {
213
213
  var $prev = walkNode.$pos,
214
214
  prevFoundNode = walkNode.foundNode;
215
215
  var prevInList = (0, _selection.isPosInsideList)($prev);
@@ -246,8 +246,7 @@ var calcJoinListScenario = function calcJoinListScenario(walkNode, $head, tr) {
246
246
  }
247
247
  return false;
248
248
  };
249
- exports.calcJoinListScenario = calcJoinListScenario;
250
- var listBackspace = function listBackspace(editorAnalyticsAPI) {
249
+ var listBackspace = exports.listBackspace = function listBackspace(editorAnalyticsAPI) {
251
250
  return function (state, dispatch) {
252
251
  var tr = state.tr,
253
252
  $head = state.selection.$head;
@@ -267,7 +266,7 @@ var listBackspace = function listBackspace(editorAnalyticsAPI) {
267
266
  if (listParent && listParent.node.type === orderedList) {
268
267
  actionSubjectId = _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
269
268
  }
270
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
269
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
271
270
  action: _analytics.ACTION.LIST_ITEM_JOINED,
272
271
  actionSubject: _analytics.ACTION_SUBJECT.LIST,
273
272
  actionSubjectId: actionSubjectId,
@@ -280,5 +279,4 @@ var listBackspace = function listBackspace(editorAnalyticsAPI) {
280
279
  })(tr);
281
280
  return BACKSPACE_COMMANDS[scenario[0]](tr, dispatch, walkNode.$pos, $head, scenario[1]);
282
281
  };
283
- };
284
- exports.listBackspace = listBackspace;
282
+ };
@@ -17,7 +17,7 @@ var _find = require("../utils/find");
17
17
  var _selection = require("../utils/selection");
18
18
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
19
19
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
20
- var outdentList = function outdentList(editorAnalyticsAPI) {
20
+ var outdentList = exports.outdentList = function outdentList(editorAnalyticsAPI) {
21
21
  return function () {
22
22
  var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
23
23
  var featureFlags = arguments.length > 1 ? arguments[1] : undefined;
@@ -53,7 +53,7 @@ var outdentList = function outdentList(editorAnalyticsAPI) {
53
53
  restartListsAttributes.splitListStartNumber = splitListStartNumber;
54
54
  }
55
55
  }
56
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
56
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
57
57
  action: _analytics.ACTION.OUTDENTED,
58
58
  actionSubject: _analytics.ACTION_SUBJECT.LIST,
59
59
  actionSubjectId: actionSubjectId,
@@ -65,5 +65,4 @@ var outdentList = function outdentList(editorAnalyticsAPI) {
65
65
  return customTr;
66
66
  };
67
67
  };
68
- };
69
- exports.outdentList = outdentList;
68
+ };
@@ -7,7 +7,7 @@ exports.messages = void 0;
7
7
  var _reactIntlNext = require("react-intl-next");
8
8
  // Common Translations will live here
9
9
 
10
- var messages = (0, _reactIntlNext.defineMessages)({
10
+ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
11
11
  unorderedList: {
12
12
  id: 'fabric.editor.unorderedList',
13
13
  defaultMessage: 'Bullet list',
@@ -33,5 +33,4 @@ var messages = (0, _reactIntlNext.defineMessages)({
33
33
  defaultMessage: 'Lists',
34
34
  description: 'Menu shows ordered/bullet list and unordered/numbered lists'
35
35
  }
36
- });
37
- exports.messages = messages;
36
+ });
@@ -26,12 +26,12 @@ var _selection = require("./utils/selection");
26
26
  * List plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
27
27
  * from `@atlaskit/editor-core`.
28
28
  */
29
- var listPlugin = function listPlugin(_ref) {
29
+ var listPlugin = exports.listPlugin = function listPlugin(_ref) {
30
30
  var _api$analytics;
31
31
  var options = _ref.config,
32
32
  api = _ref.api;
33
33
  var featureFlags = (api === null || api === void 0 ? void 0 : api.featureFlags.sharedState.currentState()) || {};
34
- var editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
34
+ var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
35
35
  return {
36
36
  name: 'list',
37
37
  actions: {
@@ -77,13 +77,13 @@ var listPlugin = function listPlugin(_ref) {
77
77
  var _api$analytics2;
78
78
  var schema = _ref3.schema,
79
79
  featureFlags = _ref3.featureFlags;
80
- return (0, _inputRules.default)(schema, featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
80
+ return (0, _inputRules.default)(schema, featureFlags, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
81
81
  }
82
82
  }, {
83
83
  name: 'listKeymap',
84
84
  plugin: function plugin() {
85
85
  var _api$analytics3;
86
- return (0, _keymap.default)(featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
86
+ return (0, _keymap.default)(featureFlags, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
87
87
  }
88
88
  }];
89
89
  },
@@ -102,7 +102,7 @@ var listPlugin = function listPlugin(_ref) {
102
102
  },
103
103
  action: function action(insert, state) {
104
104
  var tr = insert(state.schema.nodes.bulletList.createChecked({}, state.schema.nodes.listItem.createChecked({}, state.schema.nodes.paragraph.createChecked())));
105
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
105
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
106
106
  action: _analytics.ACTION.INSERTED,
107
107
  actionSubject: _analytics.ACTION_SUBJECT.LIST,
108
108
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_BULLET,
@@ -125,7 +125,7 @@ var listPlugin = function listPlugin(_ref) {
125
125
  },
126
126
  action: function action(insert, state) {
127
127
  var tr = insert(state.schema.nodes.orderedList.createChecked({}, state.schema.nodes.listItem.createChecked({}, state.schema.nodes.paragraph.createChecked())));
128
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
128
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
129
129
  action: _analytics.ACTION.INSERTED,
130
130
  actionSubject: _analytics.ACTION_SUBJECT.LIST,
131
131
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER,
@@ -140,5 +140,4 @@ var listPlugin = function listPlugin(_ref) {
140
140
  }
141
141
  }
142
142
  };
143
- };
144
- exports.listPlugin = listPlugin;
143
+ };
@@ -10,7 +10,7 @@ var _utils = require("@atlaskit/editor-prosemirror/utils");
10
10
  var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
11
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
12
 
13
- var createWrappingJoinRule = function createWrappingJoinRule(_ref) {
13
+ var createWrappingJoinRule = exports.createWrappingJoinRule = function createWrappingJoinRule(_ref) {
14
14
  var match = _ref.match,
15
15
  nodeType = _ref.nodeType,
16
16
  getAttrs = _ref.getAttrs,
@@ -56,5 +56,4 @@ var createWrappingJoinRule = function createWrappingJoinRule(_ref) {
56
56
  return tr;
57
57
  };
58
58
  return (0, _prosemirrorInputRules.createRule)(match, handler);
59
- };
60
- exports.createWrappingJoinRule = createWrappingJoinRule;
59
+ };
@@ -23,5 +23,4 @@ function keymapPlugin(featureFlags, editorAnalyticsAPI) {
23
23
  (0, _keymaps.bindKeymapWithCommand)((0, _keymaps.findKeyMapForBrowser)(_keymaps.forwardDelete), (0, _commands.deleteKeyCommand)(editorAnalyticsAPI), list);
24
24
  return (0, _keymap.keymap)(list);
25
25
  }
26
- var _default = keymapPlugin;
27
- exports.default = _default;
26
+ var _default = exports.default = keymapPlugin;
@@ -17,8 +17,7 @@ var _selection2 = require("../utils/selection");
17
17
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
18
18
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
19
19
  var listPluginKey = new _state.PluginKey('listPlugin');
20
- var pluginKey = listPluginKey;
21
- exports.pluginKey = pluginKey;
20
+ var pluginKey = exports.pluginKey = listPluginKey;
22
21
  var initialState = {
23
22
  bulletListActive: false,
24
23
  bulletListDisabled: false,
@@ -26,7 +25,7 @@ var initialState = {
26
25
  orderedListDisabled: false,
27
26
  decorationSet: _view.DecorationSet.empty
28
27
  };
29
- var getDecorations = function getDecorations(doc, state, featureFlags) {
28
+ var getDecorations = exports.getDecorations = function getDecorations(doc, state, featureFlags) {
30
29
  var decorations = [];
31
30
 
32
31
  // this stack keeps track of each (nested) list to calculate the indentation level
@@ -62,7 +61,7 @@ var getDecorations = function getDecorations(doc, state, featureFlags) {
62
61
  // spacing to account for the extra digit chars
63
62
  var digitsSize = (0, _utils.getItemCounterDigitsSize)({
64
63
  itemsCount: node === null || node === void 0 ? void 0 : node.childCount,
65
- order: node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.order
64
+ order: node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.order
66
65
  });
67
66
  if (digitsSize) {
68
67
  decorations.push(_view.Decoration.node(from, to, {
@@ -80,7 +79,6 @@ var getDecorations = function getDecorations(doc, state, featureFlags) {
80
79
  });
81
80
  return _view.DecorationSet.empty.add(doc, decorations);
82
81
  };
83
- exports.getDecorations = getDecorations;
84
82
  var handleDocChanged = function handleDocChanged(featureFlags) {
85
83
  return function (tr, pluginState, editorState) {
86
84
  var nextPluginState = handleSelectionChanged(tr, pluginState);
@@ -122,7 +120,7 @@ var createInitialState = function createInitialState(featureFlags) {
122
120
  });
123
121
  };
124
122
  };
125
- var createPlugin = function createPlugin(eventDispatch, featureFlags) {
123
+ var createPlugin = exports.createPlugin = function createPlugin(eventDispatch, featureFlags) {
126
124
  var _pluginFactory = (0, _utils.pluginFactory)(listPluginKey, reducer(), {
127
125
  onDocChanged: handleDocChanged(featureFlags),
128
126
  onSelectionChanged: handleSelectionChanged
@@ -146,10 +144,10 @@ var createPlugin = function createPlugin(eventDispatch, featureFlags) {
146
144
  var _view$state$schema$no = view.state.schema.nodes,
147
145
  listItem = _view$state$schema$no.listItem,
148
146
  codeBlock = _view$state$schema$no.codeBlock;
149
- if ((nodeAtPos === null || nodeAtPos === void 0 ? void 0 : nodeAtPos.type) === listItem && (nodeAtPos === null || nodeAtPos === void 0 ? void 0 : (_nodeAtPos$firstChild = nodeAtPos.firstChild) === null || _nodeAtPos$firstChild === void 0 ? void 0 : _nodeAtPos$firstChild.type) === codeBlock) {
150
- var _document, _document$elementFrom;
147
+ if ((nodeAtPos === null || nodeAtPos === void 0 ? void 0 : nodeAtPos.type) === listItem && (nodeAtPos === null || nodeAtPos === void 0 || (_nodeAtPos$firstChild = nodeAtPos.firstChild) === null || _nodeAtPos$firstChild === void 0 ? void 0 : _nodeAtPos$firstChild.type) === codeBlock) {
148
+ var _document;
151
149
  var bufferPx = 50;
152
- var isCodeBlockNextToListMarker = Boolean((_document = document) === null || _document === void 0 ? void 0 : (_document$elementFrom = _document.elementFromPoint(event.clientX + (_styles.listItemCounterPadding + bufferPx), event.clientY)) === null || _document$elementFrom === void 0 ? void 0 : _document$elementFrom.closest(".".concat(_styles.CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER)));
150
+ var isCodeBlockNextToListMarker = Boolean((_document = document) === null || _document === void 0 || (_document = _document.elementFromPoint(event.clientX + (_styles.listItemCounterPadding + bufferPx), event.clientY)) === null || _document === void 0 ? void 0 : _document.closest(".".concat(_styles.CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER)));
153
151
  if (isCodeBlockNextToListMarker) {
154
152
  // +1 needed to put cursor inside li
155
153
  // otherwise gap cursor markup will be injected as immediate child of ul resulting in invalid html
@@ -162,5 +160,4 @@ var createPlugin = function createPlugin(eventDispatch, featureFlags) {
162
160
  }
163
161
  }
164
162
  });
165
- };
166
- exports.createPlugin = createPlugin;
163
+ };
package/dist/cjs/types.js CHANGED
@@ -4,5 +4,4 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.MAX_NESTED_LIST_INDENTATION = void 0;
7
- var MAX_NESTED_LIST_INDENTATION = 6;
8
- exports.MAX_NESTED_LIST_INDENTATION = MAX_NESTED_LIST_INDENTATION;
7
+ var MAX_NESTED_LIST_INDENTATION = exports.MAX_NESTED_LIST_INDENTATION = 6;
@@ -8,15 +8,12 @@ exports.storeRestartListsAttributes = exports.getRestartListsAttributes = export
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
10
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
- var RESTART_LISTS_ANALYTICS_KEY = 'restartListsAnalytics';
12
- exports.RESTART_LISTS_ANALYTICS_KEY = RESTART_LISTS_ANALYTICS_KEY;
13
- var getRestartListsAttributes = function getRestartListsAttributes(tr) {
11
+ var RESTART_LISTS_ANALYTICS_KEY = exports.RESTART_LISTS_ANALYTICS_KEY = 'restartListsAnalytics';
12
+ var getRestartListsAttributes = exports.getRestartListsAttributes = function getRestartListsAttributes(tr) {
14
13
  var _tr$getMeta;
15
14
  return (_tr$getMeta = tr.getMeta(RESTART_LISTS_ANALYTICS_KEY)) !== null && _tr$getMeta !== void 0 ? _tr$getMeta : {};
16
15
  };
17
- exports.getRestartListsAttributes = getRestartListsAttributes;
18
- var storeRestartListsAttributes = function storeRestartListsAttributes(tr, attributes) {
16
+ var storeRestartListsAttributes = exports.storeRestartListsAttributes = function storeRestartListsAttributes(tr, attributes) {
19
17
  var meta = getRestartListsAttributes(tr);
20
18
  tr.setMeta(RESTART_LISTS_ANALYTICS_KEY, _objectSpread(_objectSpread({}, meta), attributes));
21
- };
22
- exports.storeRestartListsAttributes = storeRestartListsAttributes;
19
+ };
@@ -44,7 +44,7 @@ function findFirstParentListItemNode($pos) {
44
44
  pos: listItemNodePosition.pos
45
45
  };
46
46
  }
47
- var findRootParentListNode = function findRootParentListNode($pos) {
47
+ var findRootParentListNode = exports.findRootParentListNode = function findRootParentListNode($pos) {
48
48
  var doc = $pos.doc;
49
49
  if ($pos.pos + 1 > doc.content.size) {
50
50
  return null;
@@ -64,5 +64,4 @@ var findRootParentListNode = function findRootParentListNode($pos) {
64
64
  }
65
65
  var listNodePosition = doc.resolve(parentList.pos);
66
66
  return findRootParentListNode(listNodePosition);
67
- };
68
- exports.findRootParentListNode = findRootParentListNode;
67
+ };
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getListLiftTarget = void 0;
7
7
  var _utils = require("@atlaskit/editor-common/utils");
8
8
  // This will return (depth - 1) for root list parent of a list.
9
- var getListLiftTarget = function getListLiftTarget(resPos) {
9
+ var getListLiftTarget = exports.getListLiftTarget = function getListLiftTarget(resPos) {
10
10
  var target = resPos.depth;
11
11
  for (var i = resPos.depth; i > 0; i--) {
12
12
  var node = resPos.node(i);
@@ -18,5 +18,4 @@ var getListLiftTarget = function getListLiftTarget(resPos) {
18
18
  }
19
19
  }
20
20
  return target - 1;
21
- };
22
- exports.getListLiftTarget = getListLiftTarget;
21
+ };
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.sanitiseMarksInSelection = void 0;
7
- var sanitiseMarksInSelection = function sanitiseMarksInSelection(tr, newParentType) {
7
+ var sanitiseMarksInSelection = exports.sanitiseMarksInSelection = function sanitiseMarksInSelection(tr, newParentType) {
8
8
  var _tr$selection = tr.selection,
9
9
  from = _tr$selection.from,
10
10
  to = _tr$selection.to;
@@ -36,5 +36,4 @@ var sanitiseMarksInSelection = function sanitiseMarksInSelection(tr, newParentTy
36
36
  });
37
37
  });
38
38
  return nodesSanitized;
39
- };
40
- exports.sanitiseMarksInSelection = sanitiseMarksInSelection;
39
+ };
@@ -8,16 +8,14 @@ var _selection = require("@atlaskit/editor-common/selection");
8
8
  var _utils = require("@atlaskit/editor-common/utils");
9
9
  var _transform = require("@atlaskit/editor-prosemirror/transform");
10
10
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
11
- var isPosInsideParagraph = function isPosInsideParagraph($pos) {
11
+ var isPosInsideParagraph = exports.isPosInsideParagraph = function isPosInsideParagraph($pos) {
12
12
  return $pos.parent.type.name === 'paragraph';
13
13
  };
14
- exports.isPosInsideParagraph = isPosInsideParagraph;
15
- var isPosInsideList = function isPosInsideList($pos) {
14
+ var isPosInsideList = exports.isPosInsideList = function isPosInsideList($pos) {
16
15
  var posGrandParent = $pos.node(-1);
17
16
  return (0, _utils.isListItemNode)($pos.parent) || (0, _utils.isListNode)($pos.parent) || (0, _utils.isListItemNode)(posGrandParent);
18
17
  };
19
- exports.isPosInsideList = isPosInsideList;
20
- var isWrappingPossible = function isWrappingPossible(nodeType, selection) {
18
+ var isWrappingPossible = exports.isWrappingPossible = function isWrappingPossible(nodeType, selection) {
21
19
  var $from = selection.$from,
22
20
  $to = selection.$to;
23
21
  var range;
@@ -38,8 +36,7 @@ var isWrappingPossible = function isWrappingPossible(nodeType, selection) {
38
36
  };
39
37
 
40
38
  // canOutdent
41
- exports.isWrappingPossible = isWrappingPossible;
42
- var isInsideListItem = function isInsideListItem(tr) {
39
+ var isInsideListItem = exports.isInsideListItem = function isInsideListItem(tr) {
43
40
  var parent = tr.selection.$from.parent;
44
41
  var listItem = tr.doc.type.schema.nodes.listItem;
45
42
  if (tr.selection instanceof _selection.GapCursorSelection) {
@@ -47,15 +44,13 @@ var isInsideListItem = function isInsideListItem(tr) {
47
44
  }
48
45
  return (0, _utils2.hasParentNodeOfType)(listItem)(tr.selection) && (0, _utils.isParagraphNode)(parent);
49
46
  };
50
- exports.isInsideListItem = isInsideListItem;
51
- var isInsideTableCell = function isInsideTableCell(tr) {
47
+ var isInsideTableCell = exports.isInsideTableCell = function isInsideTableCell(tr) {
52
48
  var _tr$doc$type$schema$n = tr.doc.type.schema.nodes,
53
49
  tableCell = _tr$doc$type$schema$n.tableCell,
54
50
  tableHeader = _tr$doc$type$schema$n.tableHeader;
55
51
  return !!(0, _utils2.findParentNodeOfType)([tableCell, tableHeader])(tr.selection);
56
52
  };
57
- exports.isInsideTableCell = isInsideTableCell;
58
- var canJoinToPreviousListItem = function canJoinToPreviousListItem(tr) {
53
+ var canJoinToPreviousListItem = exports.canJoinToPreviousListItem = function canJoinToPreviousListItem(tr) {
59
54
  var $from = tr.selection.$from;
60
55
  var $before = tr.doc.resolve($from.pos - 1);
61
56
  var nodeBefore = $before ? $before.nodeBefore : null;
@@ -64,8 +59,7 @@ var canJoinToPreviousListItem = function canJoinToPreviousListItem(tr) {
64
59
  }
65
60
  return (0, _utils.isListNode)(nodeBefore);
66
61
  };
67
- exports.canJoinToPreviousListItem = canJoinToPreviousListItem;
68
- var selectionContainsList = function selectionContainsList(tr) {
62
+ var selectionContainsList = exports.selectionContainsList = function selectionContainsList(tr) {
69
63
  var _tr$selection = tr.selection,
70
64
  from = _tr$selection.from,
71
65
  to = _tr$selection.to;
@@ -81,8 +75,7 @@ var selectionContainsList = function selectionContainsList(tr) {
81
75
  });
82
76
  return foundListNode;
83
77
  };
84
- exports.selectionContainsList = selectionContainsList;
85
- var createListNodeRange = function createListNodeRange(_ref) {
78
+ var createListNodeRange = exports.createListNodeRange = function createListNodeRange(_ref) {
86
79
  var selection = _ref.selection;
87
80
  var $from = selection.$from,
88
81
  $to = selection.$to;
@@ -91,5 +84,4 @@ var createListNodeRange = function createListNodeRange(_ref) {
91
84
  return null;
92
85
  }
93
86
  return range;
94
- };
95
- exports.createListNodeRange = createListNodeRange;
87
+ };
@@ -220,10 +220,10 @@ var extractListItemsRangeFromList = function extractListItemsRangeFromList(_ref3
220
220
  if (node.type.name === 'orderedList' && ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.order) === nextListStartNumber) {
221
221
  var _prev$attrs;
222
222
  var prev = nextListFragment.child(index - 1);
223
- if ((prev === null || prev === void 0 ? void 0 : (_prev$attrs = prev.attrs) === null || _prev$attrs === void 0 ? void 0 : _prev$attrs.order) >= 0) {
223
+ if ((prev === null || prev === void 0 || (_prev$attrs = prev.attrs) === null || _prev$attrs === void 0 ? void 0 : _prev$attrs.order) >= 0) {
224
224
  var _prev$attrs2;
225
225
  storeRestartListsAttributes(tr, {
226
- splitListStartNumber: prev === null || prev === void 0 ? void 0 : (_prev$attrs2 = prev.attrs) === null || _prev$attrs2 === void 0 ? void 0 : _prev$attrs2.order
226
+ splitListStartNumber: prev === null || prev === void 0 || (_prev$attrs2 = prev.attrs) === null || _prev$attrs2 === void 0 ? void 0 : _prev$attrs2.order
227
227
  });
228
228
  }
229
229
  }
@@ -46,7 +46,7 @@ export var indentList = function indentList(editorAnalyticsAPI) {
46
46
  // Even though this is a non-operation, we don't want to send this event to the browser. Because if we return false, the browser will move the focus to another place
47
47
  return new PassiveTransaction();
48
48
  }
49
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
49
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
50
50
  action: ACTION.INDENTED,
51
51
  actionSubject: ACTION_SUBJECT.LIST,
52
52
  actionSubjectId: actionSubjectId,
@@ -115,7 +115,7 @@ export var toggleList = function toggleList(editorAnalyticsAPI) {
115
115
  if ((fromNode === null || fromNode === void 0 ? void 0 : fromNode.type.name) === listType && (toNode === null || toNode === void 0 ? void 0 : toNode.type.name) === listType) {
116
116
  var commonAttributes = getCommonListAnalyticsAttributes(tr);
117
117
  untoggleSelectedList(tr);
118
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
118
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
119
119
  action: ACTION.CONVERTED,
120
120
  actionSubject: ACTION_SUBJECT.LIST,
121
121
  actionSubjectId: ACTION_SUBJECT_ID.TEXT,
@@ -131,7 +131,7 @@ export var toggleList = function toggleList(editorAnalyticsAPI) {
131
131
  tr: tr,
132
132
  nextListNodeType: listNodeType
133
133
  });
134
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
134
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
135
135
  action: ACTION.CONVERTED,
136
136
  actionSubject: ACTION_SUBJECT.LIST,
137
137
  actionSubjectId: actionSubjectId,
@@ -146,7 +146,7 @@ export var toggleList = function toggleList(editorAnalyticsAPI) {
146
146
  // For example, if trying to convert centre or right aligned paragraphs to lists
147
147
  sanitiseMarksInSelection(tr, listNodeType);
148
148
  wrapInListAndJoin(listNodeType, tr);
149
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
149
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
150
150
  action: ACTION.INSERTED,
151
151
  actionSubject: ACTION_SUBJECT.LIST,
152
152
  actionSubjectId: actionSubjectId,
@@ -34,7 +34,7 @@ export var joinListItemForward = function joinListItemForward(editorAnalyticsAPI
34
34
  if (listParent && listParent.node.type === orderedList) {
35
35
  actionSubjectId = ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
36
36
  }
37
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
37
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
38
38
  action: ACTION.LIST_ITEM_JOINED,
39
39
  actionSubject: ACTION_SUBJECT.LIST,
40
40
  actionSubjectId: actionSubjectId,
@@ -259,7 +259,7 @@ export var listBackspace = function listBackspace(editorAnalyticsAPI) {
259
259
  if (listParent && listParent.node.type === orderedList) {
260
260
  actionSubjectId = ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
261
261
  }
262
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
262
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
263
263
  action: ACTION.LIST_ITEM_JOINED,
264
264
  actionSubject: ACTION_SUBJECT.LIST,
265
265
  actionSubjectId: actionSubjectId,
@@ -46,7 +46,7 @@ export var outdentList = function outdentList(editorAnalyticsAPI) {
46
46
  restartListsAttributes.splitListStartNumber = splitListStartNumber;
47
47
  }
48
48
  }
49
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
49
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
50
50
  action: ACTION.OUTDENTED,
51
51
  actionSubject: ACTION_SUBJECT.LIST,
52
52
  actionSubjectId: actionSubjectId,
@@ -25,7 +25,7 @@ export var listPlugin = function listPlugin(_ref) {
25
25
  var options = _ref.config,
26
26
  api = _ref.api;
27
27
  var featureFlags = (api === null || api === void 0 ? void 0 : api.featureFlags.sharedState.currentState()) || {};
28
- var editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
28
+ var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
29
29
  return {
30
30
  name: 'list',
31
31
  actions: {
@@ -71,13 +71,13 @@ export var listPlugin = function listPlugin(_ref) {
71
71
  var _api$analytics2;
72
72
  var schema = _ref3.schema,
73
73
  featureFlags = _ref3.featureFlags;
74
- return inputRulePlugin(schema, featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
74
+ return inputRulePlugin(schema, featureFlags, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
75
75
  }
76
76
  }, {
77
77
  name: 'listKeymap',
78
78
  plugin: function plugin() {
79
79
  var _api$analytics3;
80
- return keymapPlugin(featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
80
+ return keymapPlugin(featureFlags, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
81
81
  }
82
82
  }];
83
83
  },
@@ -96,7 +96,7 @@ export var listPlugin = function listPlugin(_ref) {
96
96
  },
97
97
  action: function action(insert, state) {
98
98
  var tr = insert(state.schema.nodes.bulletList.createChecked({}, state.schema.nodes.listItem.createChecked({}, state.schema.nodes.paragraph.createChecked())));
99
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
99
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
100
100
  action: ACTION.INSERTED,
101
101
  actionSubject: ACTION_SUBJECT.LIST,
102
102
  actionSubjectId: ACTION_SUBJECT_ID.FORMAT_LIST_BULLET,
@@ -119,7 +119,7 @@ export var listPlugin = function listPlugin(_ref) {
119
119
  },
120
120
  action: function action(insert, state) {
121
121
  var tr = insert(state.schema.nodes.orderedList.createChecked({}, state.schema.nodes.listItem.createChecked({}, state.schema.nodes.paragraph.createChecked())));
122
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
122
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
123
123
  action: ACTION.INSERTED,
124
124
  actionSubject: ACTION_SUBJECT.LIST,
125
125
  actionSubjectId: ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER,
@@ -54,7 +54,7 @@ export var getDecorations = function getDecorations(doc, state, featureFlags) {
54
54
  // spacing to account for the extra digit chars
55
55
  var digitsSize = getItemCounterDigitsSize({
56
56
  itemsCount: node === null || node === void 0 ? void 0 : node.childCount,
57
- order: node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.order
57
+ order: node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.order
58
58
  });
59
59
  if (digitsSize) {
60
60
  decorations.push(Decoration.node(from, to, {
@@ -137,10 +137,10 @@ export var createPlugin = function createPlugin(eventDispatch, featureFlags) {
137
137
  var _view$state$schema$no = view.state.schema.nodes,
138
138
  listItem = _view$state$schema$no.listItem,
139
139
  codeBlock = _view$state$schema$no.codeBlock;
140
- if ((nodeAtPos === null || nodeAtPos === void 0 ? void 0 : nodeAtPos.type) === listItem && (nodeAtPos === null || nodeAtPos === void 0 ? void 0 : (_nodeAtPos$firstChild = nodeAtPos.firstChild) === null || _nodeAtPos$firstChild === void 0 ? void 0 : _nodeAtPos$firstChild.type) === codeBlock) {
141
- var _document, _document$elementFrom;
140
+ if ((nodeAtPos === null || nodeAtPos === void 0 ? void 0 : nodeAtPos.type) === listItem && (nodeAtPos === null || nodeAtPos === void 0 || (_nodeAtPos$firstChild = nodeAtPos.firstChild) === null || _nodeAtPos$firstChild === void 0 ? void 0 : _nodeAtPos$firstChild.type) === codeBlock) {
141
+ var _document;
142
142
  var bufferPx = 50;
143
- var isCodeBlockNextToListMarker = Boolean((_document = document) === null || _document === void 0 ? void 0 : (_document$elementFrom = _document.elementFromPoint(event.clientX + (listItemCounterPadding + bufferPx), event.clientY)) === null || _document$elementFrom === void 0 ? void 0 : _document$elementFrom.closest(".".concat(CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER)));
143
+ var isCodeBlockNextToListMarker = Boolean((_document = document) === null || _document === void 0 || (_document = _document.elementFromPoint(event.clientX + (listItemCounterPadding + bufferPx), event.clientY)) === null || _document === void 0 ? void 0 : _document.closest(".".concat(CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER)));
144
144
  if (isCodeBlockNextToListMarker) {
145
145
  // +1 needed to put cursor inside li
146
146
  // otherwise gap cursor markup will be injected as immediate child of ul resulting in invalid html
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-list",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "List plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,9 +31,9 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/adf-schema": "^32.0.0",
35
- "@atlaskit/editor-common": "^76.1.0",
36
- "@atlaskit/editor-plugin-analytics": "^0.2.0",
34
+ "@atlaskit/adf-schema": "^33.2.3",
35
+ "@atlaskit/editor-common": "^76.22.0",
36
+ "@atlaskit/editor-plugin-analytics": "^0.3.0",
37
37
  "@atlaskit/editor-plugin-feature-flags": "^1.0.0",
38
38
  "@atlaskit/editor-prosemirror": "1.1.0",
39
39
  "@atlaskit/prosemirror-input-rules": "^2.4.0",