@atlaskit/editor-plugin-list 2.0.0 → 3.0.1

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 (45) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/actions/outdent-list-items-selected.js +40 -49
  3. package/dist/cjs/commands/index.js +4 -4
  4. package/dist/cjs/commands/outdent-list.js +7 -10
  5. package/dist/cjs/plugin.js +3 -3
  6. package/dist/cjs/pm-plugins/input-rules/create-list-input-rule.js +7 -11
  7. package/dist/cjs/pm-plugins/input-rules/index.js +2 -4
  8. package/dist/cjs/pm-plugins/input-rules/wrapping-join-rule.js +2 -3
  9. package/dist/cjs/pm-plugins/keymap.js +3 -3
  10. package/dist/cjs/pm-plugins/main.js +1 -7
  11. package/dist/es2019/actions/outdent-list-items-selected.js +43 -52
  12. package/dist/es2019/commands/index.js +4 -4
  13. package/dist/es2019/commands/outdent-list.js +9 -11
  14. package/dist/es2019/plugin.js +4 -4
  15. package/dist/es2019/pm-plugins/input-rules/create-list-input-rule.js +7 -11
  16. package/dist/es2019/pm-plugins/input-rules/index.js +2 -4
  17. package/dist/es2019/pm-plugins/input-rules/wrapping-join-rule.js +2 -3
  18. package/dist/es2019/pm-plugins/keymap.js +3 -3
  19. package/dist/es2019/pm-plugins/main.js +1 -7
  20. package/dist/esm/actions/outdent-list-items-selected.js +40 -49
  21. package/dist/esm/commands/index.js +4 -4
  22. package/dist/esm/commands/outdent-list.js +7 -10
  23. package/dist/esm/plugin.js +4 -4
  24. package/dist/esm/pm-plugins/input-rules/create-list-input-rule.js +7 -11
  25. package/dist/esm/pm-plugins/input-rules/index.js +2 -4
  26. package/dist/esm/pm-plugins/input-rules/wrapping-join-rule.js +2 -3
  27. package/dist/esm/pm-plugins/keymap.js +3 -3
  28. package/dist/esm/pm-plugins/main.js +1 -7
  29. package/dist/types/actions/outdent-list-items-selected.d.ts +1 -2
  30. package/dist/types/commands/index.d.ts +3 -3
  31. package/dist/types/commands/outdent-list.d.ts +2 -2
  32. package/dist/types/index.d.ts +1 -1
  33. package/dist/types/pm-plugins/input-rules/create-list-input-rule.d.ts +1 -3
  34. package/dist/types/pm-plugins/input-rules/index.d.ts +1 -2
  35. package/dist/types/pm-plugins/input-rules/wrapping-join-rule.d.ts +2 -3
  36. package/dist/types/types.d.ts +1 -3
  37. package/dist/types-ts4.5/actions/outdent-list-items-selected.d.ts +1 -2
  38. package/dist/types-ts4.5/commands/index.d.ts +3 -3
  39. package/dist/types-ts4.5/commands/outdent-list.d.ts +2 -2
  40. package/dist/types-ts4.5/index.d.ts +1 -1
  41. package/dist/types-ts4.5/pm-plugins/input-rules/create-list-input-rule.d.ts +1 -3
  42. package/dist/types-ts4.5/pm-plugins/input-rules/index.d.ts +1 -2
  43. package/dist/types-ts4.5/pm-plugins/input-rules/wrapping-join-rule.d.ts +2 -3
  44. package/dist/types-ts4.5/types.d.ts +1 -3
  45. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-list
2
2
 
3
+ ## 3.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#62165](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/62165) [`b44ac0968d79`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b44ac0968d79) - [ED-21562] Bump @atlaskit/adf-schema to 35.2.0 for border mark update
8
+
9
+ ## 3.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [#59319](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/59319) [`d2e34e936bf2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d2e34e936bf2) - [ED-15859] Clean up restartNumberedLists feature flag and set this feature as the default behaviour for ordered lists. Currently this feature is only rolled out in Confluence so this change will roll it out to all other products which adopt this version.
14
+
3
15
  ## 2.0.0
4
16
 
5
17
  ### Major Changes
@@ -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 = exports.outdentListItemsSelected = function outdentListItemsSelected(tr, featureFlags) {
21
+ var outdentListItemsSelected = exports.outdentListItemsSelected = function outdentListItemsSelected(tr) {
22
22
  var originalSelection = tr.selection;
23
23
  var normalizedSelection = (0, _lists.normalizeListItemsSelection)({
24
24
  selection: tr.selection,
@@ -52,8 +52,7 @@ var outdentListItemsSelected = exports.outdentListItemsSelected = function outde
52
52
  } else {
53
53
  extractListItemsRangeFromList({
54
54
  tr: tr,
55
- range: mappedRange,
56
- featureFlags: featureFlags
55
+ range: mappedRange
57
56
  });
58
57
  hasNormalizedToPositionLiftedOut = hasNormalizedToPositionLiftedOut || oldTo >= range.from && oldTo < range.to;
59
58
  hasNormalizedFromPositionLiftedOut = hasNormalizedFromPositionLiftedOut || oldFrom >= range.from && oldFrom < range.to;
@@ -173,8 +172,7 @@ var outdentRangeToParentList = function outdentRangeToParentList(_ref2) {
173
172
  };
174
173
  var extractListItemsRangeFromList = function extractListItemsRangeFromList(_ref3) {
175
174
  var tr = _ref3.tr,
176
- range = _ref3.range,
177
- featureFlags = _ref3.featureFlags;
175
+ range = _ref3.range;
178
176
  var list = range.parent;
179
177
  var $start = tr.doc.resolve(range.start);
180
178
  var listStart = $start.start(range.depth);
@@ -197,53 +195,48 @@ var extractListItemsRangeFromList = function extractListItemsRangeFromList(_ref3
197
195
  }
198
196
  var nextList = list.copy(_model.Fragment.empty);
199
197
  var nextListStartNumber;
200
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
201
- // if splitting a numbered list, keep the splitted item
202
- // counter as the start of the next (second half) list (instead
203
- // of reverting back to 1 as a starting number)
204
- var order = (0, _utils.getOrderFromOrderedListNode)(list);
205
- if (list.type.name === 'orderedList') {
206
- nextListStartNumber = range.endIndex - 1 + order;
207
- // @ts-ignore - [unblock prosemirror bump] assigning to readonly attrs
208
- nextList.attrs = _objectSpread(_objectSpread({}, nextList.attrs), {}, {
209
- order: nextListStartNumber
198
+ // if splitting a numbered list, keep the splitted item
199
+ // counter as the start of the next (second half) list (instead
200
+ // of reverting back to 1 as a starting number)
201
+ var order = (0, _utils.getOrderFromOrderedListNode)(list);
202
+ if (list.type.name === 'orderedList') {
203
+ nextListStartNumber = range.endIndex - 1 + order;
204
+ // @ts-ignore - [unblock prosemirror bump] assigning to readonly attrs
205
+ nextList.attrs = _objectSpread(_objectSpread({}, nextList.attrs), {}, {
206
+ order: nextListStartNumber
207
+ });
208
+ var _getRestartListsAttri = (0, _analytics2.getRestartListsAttributes)(tr),
209
+ splitListStartNumber = _getRestartListsAttri.splitListStartNumber;
210
+ if (typeof splitListStartNumber !== 'number') {
211
+ (0, _analytics2.storeRestartListsAttributes)(tr, {
212
+ splitListStartNumber: nextListStartNumber
210
213
  });
211
- var _getRestartListsAttri = (0, _analytics2.getRestartListsAttributes)(tr),
212
- splitListStartNumber = _getRestartListsAttri.splitListStartNumber;
213
- if (typeof splitListStartNumber !== 'number') {
214
- (0, _analytics2.storeRestartListsAttributes)(tr, {
215
- splitListStartNumber: nextListStartNumber
216
- });
217
- }
218
214
  }
219
215
  }
220
216
  var nextListFragment = listItemContent.append(_model.Fragment.from(nextList));
221
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
222
- // if the split list with nextListStartNumber is below another list
223
- // with order (e.g due to multi-level indent items being lifted), track the
224
- // list above's order instead, as it will be the split list's order after sibling joins
225
- nextListFragment.forEach(function (node, _offset, index) {
226
- var _node$attrs;
227
- if (node.type.name === 'orderedList' && ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.order) === nextListStartNumber) {
228
- var _prev$attrs;
229
- var prev = nextListFragment.child(index - 1);
230
- if ((prev === null || prev === void 0 || (_prev$attrs = prev.attrs) === null || _prev$attrs === void 0 ? void 0 : _prev$attrs.order) >= 0) {
231
- var _prev$attrs2;
232
- (0, _analytics2.storeRestartListsAttributes)(tr, {
233
- splitListStartNumber: prev === null || prev === void 0 || (_prev$attrs2 = prev.attrs) === null || _prev$attrs2 === void 0 ? void 0 : _prev$attrs2.order
234
- });
235
- }
217
+
218
+ // if the split list with nextListStartNumber is below another list
219
+ // with order (e.g due to multi-level indent items being lifted), track the
220
+ // list above's order instead, as it will be the split list's order after sibling joins
221
+ nextListFragment.forEach(function (node, _offset, index) {
222
+ var _node$attrs;
223
+ if (node.type.name === 'orderedList' && ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.order) === nextListStartNumber) {
224
+ var _prev$attrs;
225
+ var prev = nextListFragment.child(index - 1);
226
+ if ((prev === null || prev === void 0 || (_prev$attrs = prev.attrs) === null || _prev$attrs === void 0 ? void 0 : _prev$attrs.order) >= 0) {
227
+ var _prev$attrs2;
228
+ (0, _analytics2.storeRestartListsAttributes)(tr, {
229
+ splitListStartNumber: prev === null || prev === void 0 || (_prev$attrs2 = prev.attrs) === null || _prev$attrs2 === void 0 ? void 0 : _prev$attrs2.order
230
+ });
236
231
  }
237
- });
238
- }
232
+ }
233
+ });
239
234
  if (isTheEntireList) {
240
235
  var slice = new _model.Slice(listItemContent, 0, 0);
241
236
  var step = new _transform.ReplaceStep($start.pos - 1, range.end + 1, slice, false);
242
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
243
- (0, _analytics2.storeRestartListsAttributes)(tr, {
244
- outdentScenario: undefined
245
- });
246
- }
237
+ (0, _analytics2.storeRestartListsAttributes)(tr, {
238
+ outdentScenario: undefined
239
+ });
247
240
  tr.step(step);
248
241
  } else if (isAtTop) {
249
242
  var _slice = new _model.Slice(nextListFragment, 0, 1);
@@ -254,11 +247,9 @@ var extractListItemsRangeFromList = function extractListItemsRangeFromList(_ref3
254
247
  var _step2 = new _transform.ReplaceStep($start.pos, listEnd + 1, _slice2, false);
255
248
  tr.step(_step2);
256
249
  } else {
257
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
258
- (0, _analytics2.storeRestartListsAttributes)(tr, {
259
- outdentScenario: _analytics.OUTDENT_SCENARIOS.SPLIT_LIST
260
- });
261
- }
250
+ (0, _analytics2.storeRestartListsAttributes)(tr, {
251
+ outdentScenario: _analytics.OUTDENT_SCENARIOS.SPLIT_LIST
252
+ });
262
253
  var _slice3 = new _model.Slice(nextListFragment, 1, 1);
263
254
  var _step3 = new _transform.ReplaceAroundStep($start.pos, listEnd, range.end, listEnd, _slice3, _slice3.size, false);
264
255
  tr.step(_step3);
@@ -42,7 +42,7 @@ 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
44
  var enterKeyCommand = exports.enterKeyCommand = function enterKeyCommand(editorAnalyticsAPI) {
45
- return function (featureFlags) {
45
+ return function () {
46
46
  return function (state, dispatch) {
47
47
  var selection = state.selection;
48
48
  if (selection.empty) {
@@ -55,7 +55,7 @@ var enterKeyCommand = exports.enterKeyCommand = function enterKeyCommand(editorA
55
55
  /** Check if the wrapper has any visible content */
56
56
  var wrapperHasContent = (0, _utils.hasVisibleContent)(wrapper);
57
57
  if (!wrapperHasContent) {
58
- return (0, _preset.editorCommandToPMCommand)((0, _outdentList.outdentList)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD, featureFlags))(state, dispatch);
58
+ return (0, _preset.editorCommandToPMCommand)((0, _outdentList.outdentList)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD))(state, dispatch);
59
59
  } else if (!(0, _utils2.hasParentNodeOfType)(codeBlock)(selection)) {
60
60
  return splitListItem(listItem)(state, dispatch);
61
61
  }
@@ -66,7 +66,7 @@ var enterKeyCommand = exports.enterKeyCommand = function enterKeyCommand(editorA
66
66
  };
67
67
  };
68
68
  var backspaceKeyCommand = exports.backspaceKeyCommand = function backspaceKeyCommand(editorAnalyticsAPI) {
69
- return function (featureFlags) {
69
+ return function () {
70
70
  return function (state, dispatch) {
71
71
  return (0, _commands2.chainCommands)((0, _listBackspace.listBackspace)(editorAnalyticsAPI),
72
72
  // if we're at the start of a list item, we need to either backspace
@@ -75,7 +75,7 @@ var backspaceKeyCommand = exports.backspaceKeyCommand = function backspaceKeyCom
75
75
  // list items might have multiple paragraphs; only do this at the first one
76
76
  _isFirstChildOfParent.isFirstChildOfParent, function (state) {
77
77
  return (0, _selection2.isInsideListItem)(state.tr);
78
- }], (0, _commands2.chainCommands)(deletePreviousEmptyListItem, (0, _preset.editorCommandToPMCommand)((0, _outdentList.outdentList)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD, featureFlags)))),
78
+ }], (0, _commands2.chainCommands)(deletePreviousEmptyListItem, (0, _preset.editorCommandToPMCommand)((0, _outdentList.outdentList)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD)))),
79
79
  // if we're just inside a paragraph node (or gapcursor is shown) and backspace, then try to join
80
80
  // the text to the previous list item, if one exists
81
81
  (0, _utils.filterCommand)([_utils.isEmptySelectionAtStart, function (state) {
@@ -20,7 +20,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
20
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
- var featureFlags = arguments.length > 1 ? arguments[1] : undefined;
24
23
  return function (_ref) {
25
24
  var tr = _ref.tr;
26
25
  if (!(0, _selection.isInsideListItem)(tr)) {
@@ -37,21 +36,19 @@ var outdentList = exports.outdentList = function outdentList(editorAnalyticsAPI)
37
36
  (0, _history.closeHistory)(tr);
38
37
  var actionSubjectId = (0, _utils.isBulletList)(parentListNode.node) ? _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
39
38
  var customTr = tr;
40
- (0, _outdentListItemsSelected.outdentListItemsSelected)(customTr, featureFlags);
39
+ (0, _outdentListItemsSelected.outdentListItemsSelected)(customTr);
41
40
  if (!customTr || !customTr.docChanged) {
42
41
  // 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
43
42
  // If inside table cell and can't outdent list, then let it handle by table keymap
44
43
  return !(0, _selection.isInsideTableCell)(customTr) ? new _preset.PassiveTransaction() : null;
45
44
  }
46
45
  var restartListsAttributes = {};
47
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
48
- var _getRestartListsAttri = (0, _analytics2.getRestartListsAttributes)(customTr),
49
- outdentScenario = _getRestartListsAttri.outdentScenario,
50
- splitListStartNumber = _getRestartListsAttri.splitListStartNumber;
51
- if (outdentScenario === _analytics.OUTDENT_SCENARIOS.SPLIT_LIST) {
52
- restartListsAttributes.outdentScenario = outdentScenario;
53
- restartListsAttributes.splitListStartNumber = splitListStartNumber;
54
- }
46
+ var _getRestartListsAttri = (0, _analytics2.getRestartListsAttributes)(customTr),
47
+ outdentScenario = _getRestartListsAttri.outdentScenario,
48
+ splitListStartNumber = _getRestartListsAttri.splitListStartNumber;
49
+ if (outdentScenario === _analytics.OUTDENT_SCENARIOS.SPLIT_LIST) {
50
+ restartListsAttributes.outdentScenario = outdentScenario;
51
+ restartListsAttributes.splitListStartNumber = splitListStartNumber;
55
52
  }
56
53
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
57
54
  action: _analytics.ACTION.OUTDENTED,
@@ -41,7 +41,7 @@ var listPlugin = exports.listPlugin = function listPlugin(_ref) {
41
41
  commands: {
42
42
  indentList: (0, _commands.indentList)(editorAnalyticsAPI),
43
43
  outdentList: function outdentList(inputMethod) {
44
- return (0, _commands.outdentList)(editorAnalyticsAPI)(inputMethod, featureFlags);
44
+ return (0, _commands.outdentList)(editorAnalyticsAPI)(inputMethod);
45
45
  },
46
46
  toggleOrderedList: (0, _commands.toggleOrderedList)(editorAnalyticsAPI),
47
47
  toggleBulletList: (0, _commands.toggleBulletList)(editorAnalyticsAPI)
@@ -58,7 +58,7 @@ var listPlugin = exports.listPlugin = function listPlugin(_ref) {
58
58
  node: _adfSchema.bulletList
59
59
  }, {
60
60
  name: 'orderedList',
61
- node: options !== null && options !== void 0 && options.restartNumberedLists ? _adfSchema.orderedListWithOrder : _adfSchema.orderedList
61
+ node: _adfSchema.orderedListWithOrder
62
62
  }, {
63
63
  name: 'listItem',
64
64
  node: _adfSchema.listItem
@@ -77,7 +77,7 @@ var listPlugin = exports.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 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
80
+ return (0, _inputRules.default)(schema, 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',
@@ -13,7 +13,6 @@ var getOrder = function getOrder(matchResult) {
13
13
  function createRuleForListType(_ref) {
14
14
  var listType = _ref.listType,
15
15
  expression = _ref.expression,
16
- featureFlags = _ref.featureFlags,
17
16
  editorAnalyticsApi = _ref.editorAnalyticsApi;
18
17
  var joinScenario = _analytics.JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.NO_JOIN;
19
18
  var isBulletList = listType.name === 'bulletList';
@@ -28,7 +27,7 @@ function createRuleForListType(_ref) {
28
27
  inputMethod: _analytics.INPUT_METHOD.FORMATTING
29
28
  }
30
29
  };
31
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && listType === state.schema.nodes.orderedList && analyticsPayload.attributes) {
30
+ if (listType === state.schema.nodes.orderedList && analyticsPayload.attributes) {
32
31
  analyticsPayload.attributes.listStartNumber = getOrder(matchResult);
33
32
  analyticsPayload.attributes.joinScenario = joinScenario;
34
33
  // we reset the tracked joinScenario after storing it in the event payload
@@ -43,17 +42,14 @@ function createRuleForListType(_ref) {
43
42
  }
44
43
  return shouldJoin;
45
44
  };
46
- var getAttrs = {};
47
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
48
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
- getAttrs = function getAttrs(matchResult) {
50
- return {
51
- order: getOrder(matchResult)
52
- };
45
+
46
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
+ var getAttrs = function getAttrs(matchResult) {
48
+ return {
49
+ order: getOrder(matchResult)
53
50
  };
54
- }
51
+ };
55
52
  var inputRule = (0, _wrappingJoinRule.createWrappingJoinRule)({
56
- featureFlags: featureFlags,
57
53
  match: expression,
58
54
  nodeType: listType,
59
55
  getAttrs: getAttrs,
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = inputRulePlugin;
7
7
  var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
8
8
  var _createListInputRule = require("./create-list-input-rule");
9
- function inputRulePlugin(schema, featureFlags, editorAnalyticsApi) {
9
+ function inputRulePlugin(schema, editorAnalyticsApi) {
10
10
  var _schema$nodes = schema.nodes,
11
11
  bulletList = _schema$nodes.bulletList,
12
12
  orderedList = _schema$nodes.orderedList;
@@ -18,16 +18,14 @@ function inputRulePlugin(schema, featureFlags, editorAnalyticsApi) {
18
18
  // character into an escaped version.
19
19
  expression: /^\s*([\*\-\u2022]) $/,
20
20
  listType: bulletList,
21
- featureFlags: featureFlags,
22
21
  editorAnalyticsApi: editorAnalyticsApi
23
22
  }));
24
23
  }
25
- var expression = featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists ? /((^[1-9]{1}[0-9]{0,2})|^(0))[\.\)] $/ : /^(1)[\.\)] $/;
24
+ var expression = /((^[1-9]{1}[0-9]{0,2})|^(0))[\.\)] $/;
26
25
  if (orderedList) {
27
26
  rules.push((0, _createListInputRule.createRuleForListType)({
28
27
  expression: expression,
29
28
  listType: orderedList,
30
- featureFlags: featureFlags,
31
29
  editorAnalyticsApi: editorAnalyticsApi
32
30
  }));
33
31
  }
@@ -15,8 +15,7 @@ var createWrappingJoinRule = exports.createWrappingJoinRule = function createWra
15
15
  var match = _ref.match,
16
16
  nodeType = _ref.nodeType,
17
17
  getAttrs = _ref.getAttrs,
18
- joinPredicate = _ref.joinPredicate,
19
- featureFlags = _ref.featureFlags;
18
+ joinPredicate = _ref.joinPredicate;
20
19
  var handler = function handler(state, match, start, end) {
21
20
  var attrs = (getAttrs instanceof Function ? getAttrs(match) : getAttrs) || {};
22
21
  var tr = state.tr;
@@ -39,7 +38,7 @@ var createWrappingJoinRule = exports.createWrappingJoinRule = function createWra
39
38
 
40
39
  // if an orderedList node would be inserted by the input rule match, and
41
40
  // that orderedList node is being added directly after another orderedList
42
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && nodeType === state.schema.nodes.orderedList) {
41
+ if (nodeType === state.schema.nodes.orderedList) {
43
42
  var $end = tr.doc.resolve(tr.mapping.map(end));
44
43
  var _node = (0, _utils.findParentNodeOfTypeClosestToPos)($end, nodeType);
45
44
  if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.ordered-list-auto-join-improvements_mrlv5')) {
@@ -14,9 +14,9 @@ function keymapPlugin(featureFlags, editorAnalyticsAPI) {
14
14
  (0, _keymaps.bindKeymapWithEditorCommand)((0, _keymaps.findShortcutByKeymap)(_keymaps.toggleOrderedList), (0, _commands.toggleList)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD, 'orderedList'), list);
15
15
  (0, _keymaps.bindKeymapWithEditorCommand)((0, _keymaps.findShortcutByKeymap)(_keymaps.toggleBulletList), (0, _commands.toggleList)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD, 'bulletList'), list);
16
16
  (0, _keymaps.bindKeymapWithEditorCommand)(_keymaps.indentList.common, (0, _commands.indentList)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD), list);
17
- (0, _keymaps.bindKeymapWithEditorCommand)(_keymaps.outdentList.common, (0, _commands.outdentList)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD, featureFlags), list);
18
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.enter.common, (0, _commands.enterKeyCommand)(editorAnalyticsAPI)(featureFlags), list);
19
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.backspace.common, (0, _commands.backspaceKeyCommand)(editorAnalyticsAPI)(featureFlags), list);
17
+ (0, _keymaps.bindKeymapWithEditorCommand)(_keymaps.outdentList.common, (0, _commands.outdentList)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD), list);
18
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.enter.common, (0, _commands.enterKeyCommand)(editorAnalyticsAPI)(), list);
19
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.backspace.common, (0, _commands.backspaceKeyCommand)(editorAnalyticsAPI)(), list);
20
20
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.deleteKey.common, (0, _commands.deleteKeyCommand)(editorAnalyticsAPI), list);
21
21
 
22
22
  // This shortcut is Mac only
@@ -55,7 +55,7 @@ var getDecorations = exports.getDecorations = function getDecorations(doc, state
55
55
  decorations.push(_view.Decoration.node(from, to, {
56
56
  'data-indent-level': "".concat(depth)
57
57
  }));
58
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && node.type.name === 'orderedList') {
58
+ if (node.type.name === 'orderedList') {
59
59
  var _node$attrs;
60
60
  // If a numbered list has item counters numbering >= 100, we'll need to add special
61
61
  // spacing to account for the extra digit chars
@@ -68,12 +68,6 @@ var getDecorations = exports.getDecorations = function getDecorations(doc, state
68
68
  style: (0, _styles.getOrderedListInlineStyles)(digitsSize, 'string')
69
69
  }));
70
70
  }
71
- } else {
72
- if (node.childCount >= 100) {
73
- decorations.push(_view.Decoration.node(from, to, {
74
- 'data-child-count': '100+'
75
- }));
76
- }
77
71
  }
78
72
  }
79
73
  });
@@ -8,7 +8,7 @@ import { liftTarget, ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-pro
8
8
  import { getRestartListsAttributes, storeRestartListsAttributes } from '../utils/analytics';
9
9
  import { findFirstParentListItemNode, findRootParentListNode } from '../utils/find';
10
10
  import { createListNodeRange } from '../utils/selection';
11
- export const outdentListItemsSelected = (tr, featureFlags) => {
11
+ export const outdentListItemsSelected = tr => {
12
12
  const originalSelection = tr.selection;
13
13
  const normalizedSelection = normalizeListItemsSelection({
14
14
  selection: tr.selection,
@@ -44,8 +44,7 @@ export const outdentListItemsSelected = (tr, featureFlags) => {
44
44
  } else {
45
45
  extractListItemsRangeFromList({
46
46
  tr,
47
- range: mappedRange,
48
- featureFlags
47
+ range: mappedRange
49
48
  });
50
49
  hasNormalizedToPositionLiftedOut = hasNormalizedToPositionLiftedOut || oldTo >= range.from && oldTo < range.to;
51
50
  hasNormalizedFromPositionLiftedOut = hasNormalizedFromPositionLiftedOut || oldFrom >= range.from && oldFrom < range.to;
@@ -175,8 +174,7 @@ const outdentRangeToParentList = ({
175
174
  };
176
175
  const extractListItemsRangeFromList = ({
177
176
  tr,
178
- range,
179
- featureFlags
177
+ range
180
178
  }) => {
181
179
  const list = range.parent;
182
180
  const $start = tr.doc.resolve(range.start);
@@ -200,55 +198,50 @@ const extractListItemsRangeFromList = ({
200
198
  }
201
199
  let nextList = list.copy(Fragment.empty);
202
200
  let nextListStartNumber;
203
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
204
- // if splitting a numbered list, keep the splitted item
205
- // counter as the start of the next (second half) list (instead
206
- // of reverting back to 1 as a starting number)
207
- const order = getOrderFromOrderedListNode(list);
208
- if (list.type.name === 'orderedList') {
209
- nextListStartNumber = range.endIndex - 1 + order;
210
- // @ts-ignore - [unblock prosemirror bump] assigning to readonly attrs
211
- nextList.attrs = {
212
- ...nextList.attrs,
213
- order: nextListStartNumber
214
- };
215
- const {
216
- splitListStartNumber
217
- } = getRestartListsAttributes(tr);
218
- if (typeof splitListStartNumber !== 'number') {
219
- storeRestartListsAttributes(tr, {
220
- splitListStartNumber: nextListStartNumber
221
- });
222
- }
201
+ // if splitting a numbered list, keep the splitted item
202
+ // counter as the start of the next (second half) list (instead
203
+ // of reverting back to 1 as a starting number)
204
+ const order = getOrderFromOrderedListNode(list);
205
+ if (list.type.name === 'orderedList') {
206
+ nextListStartNumber = range.endIndex - 1 + order;
207
+ // @ts-ignore - [unblock prosemirror bump] assigning to readonly attrs
208
+ nextList.attrs = {
209
+ ...nextList.attrs,
210
+ order: nextListStartNumber
211
+ };
212
+ const {
213
+ splitListStartNumber
214
+ } = getRestartListsAttributes(tr);
215
+ if (typeof splitListStartNumber !== 'number') {
216
+ storeRestartListsAttributes(tr, {
217
+ splitListStartNumber: nextListStartNumber
218
+ });
223
219
  }
224
220
  }
225
221
  const nextListFragment = listItemContent.append(Fragment.from(nextList));
226
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
227
- // if the split list with nextListStartNumber is below another list
228
- // with order (e.g due to multi-level indent items being lifted), track the
229
- // list above's order instead, as it will be the split list's order after sibling joins
230
- nextListFragment.forEach((node, _offset, index) => {
231
- var _node$attrs;
232
- if (node.type.name === 'orderedList' && ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.order) === nextListStartNumber) {
233
- var _prev$attrs;
234
- const prev = nextListFragment.child(index - 1);
235
- if ((prev === null || prev === void 0 ? void 0 : (_prev$attrs = prev.attrs) === null || _prev$attrs === void 0 ? void 0 : _prev$attrs.order) >= 0) {
236
- var _prev$attrs2;
237
- storeRestartListsAttributes(tr, {
238
- splitListStartNumber: prev === null || prev === void 0 ? void 0 : (_prev$attrs2 = prev.attrs) === null || _prev$attrs2 === void 0 ? void 0 : _prev$attrs2.order
239
- });
240
- }
222
+
223
+ // if the split list with nextListStartNumber is below another list
224
+ // with order (e.g due to multi-level indent items being lifted), track the
225
+ // list above's order instead, as it will be the split list's order after sibling joins
226
+ nextListFragment.forEach((node, _offset, index) => {
227
+ var _node$attrs;
228
+ if (node.type.name === 'orderedList' && ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.order) === nextListStartNumber) {
229
+ var _prev$attrs;
230
+ const 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) {
232
+ var _prev$attrs2;
233
+ 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
235
+ });
241
236
  }
242
- });
243
- }
237
+ }
238
+ });
244
239
  if (isTheEntireList) {
245
240
  const slice = new Slice(listItemContent, 0, 0);
246
241
  const step = new ReplaceStep($start.pos - 1, range.end + 1, slice, false);
247
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
248
- storeRestartListsAttributes(tr, {
249
- outdentScenario: undefined
250
- });
251
- }
242
+ storeRestartListsAttributes(tr, {
243
+ outdentScenario: undefined
244
+ });
252
245
  tr.step(step);
253
246
  } else if (isAtTop) {
254
247
  const slice = new Slice(nextListFragment, 0, 1);
@@ -259,11 +252,9 @@ const extractListItemsRangeFromList = ({
259
252
  const step = new ReplaceStep($start.pos, listEnd + 1, slice, false);
260
253
  tr.step(step);
261
254
  } else {
262
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
263
- storeRestartListsAttributes(tr, {
264
- outdentScenario: OUTDENT_SCENARIOS.SPLIT_LIST
265
- });
266
- }
255
+ storeRestartListsAttributes(tr, {
256
+ outdentScenario: OUTDENT_SCENARIOS.SPLIT_LIST
257
+ });
267
258
  const slice = new Slice(nextListFragment, 1, 1);
268
259
  const step = new ReplaceAroundStep($start.pos, listEnd, range.end, listEnd, slice, slice.size, false);
269
260
  tr.step(step);
@@ -19,7 +19,7 @@ import { joinListItemForward } from './join-list-item-forward';
19
19
  import { listBackspace } from './listBackspace';
20
20
  import { outdentList } from './outdent-list';
21
21
  export { outdentList, indentList };
22
- export const enterKeyCommand = editorAnalyticsAPI => featureFlags => (state, dispatch) => {
22
+ export const enterKeyCommand = editorAnalyticsAPI => () => (state, dispatch) => {
23
23
  const {
24
24
  selection
25
25
  } = state;
@@ -36,7 +36,7 @@ export const enterKeyCommand = editorAnalyticsAPI => featureFlags => (state, dis
36
36
  /** Check if the wrapper has any visible content */
37
37
  const wrapperHasContent = hasVisibleContent(wrapper);
38
38
  if (!wrapperHasContent) {
39
- return editorCommandToPMCommand(outdentList(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, featureFlags))(state, dispatch);
39
+ return editorCommandToPMCommand(outdentList(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD))(state, dispatch);
40
40
  } else if (!hasParentNodeOfType(codeBlock)(selection)) {
41
41
  return splitListItem(listItem)(state, dispatch);
42
42
  }
@@ -44,13 +44,13 @@ export const enterKeyCommand = editorAnalyticsAPI => featureFlags => (state, dis
44
44
  }
45
45
  return false;
46
46
  };
47
- export const backspaceKeyCommand = editorAnalyticsAPI => featureFlags => (state, dispatch) => {
47
+ export const backspaceKeyCommand = editorAnalyticsAPI => () => (state, dispatch) => {
48
48
  return chainCommands(listBackspace(editorAnalyticsAPI),
49
49
  // if we're at the start of a list item, we need to either backspace
50
50
  // directly to an empty list item above, or outdent this node
51
51
  filter([isEmptySelectionAtStart,
52
52
  // list items might have multiple paragraphs; only do this at the first one
53
- isFirstChildOfParent, state => isInsideListItem(state.tr)], chainCommands(deletePreviousEmptyListItem, editorCommandToPMCommand(outdentList(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, featureFlags)))),
53
+ isFirstChildOfParent, state => isInsideListItem(state.tr)], chainCommands(deletePreviousEmptyListItem, editorCommandToPMCommand(outdentList(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)))),
54
54
  // if we're just inside a paragraph node (or gapcursor is shown) and backspace, then try to join
55
55
  // the text to the previous list item, if one exists
56
56
  filter([isEmptySelectionAtStart, state => canJoinToPreviousListItem(state.tr)], joinToPreviousListItem))(state, dispatch);
@@ -7,7 +7,7 @@ import { outdentListItemsSelected as outdentListAction } from '../actions/outden
7
7
  import { getRestartListsAttributes } from '../utils/analytics';
8
8
  import { findFirstParentListNode } from '../utils/find';
9
9
  import { isInsideListItem, isInsideTableCell } from '../utils/selection';
10
- export const outdentList = editorAnalyticsAPI => (inputMethod = INPUT_METHOD.KEYBOARD, featureFlags) => {
10
+ export const outdentList = editorAnalyticsAPI => (inputMethod = INPUT_METHOD.KEYBOARD) => {
11
11
  return function ({
12
12
  tr
13
13
  }) {
@@ -27,22 +27,20 @@ export const outdentList = editorAnalyticsAPI => (inputMethod = INPUT_METHOD.KEY
27
27
  closeHistory(tr);
28
28
  const actionSubjectId = isBulletList(parentListNode.node) ? ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
29
29
  let customTr = tr;
30
- outdentListAction(customTr, featureFlags);
30
+ outdentListAction(customTr);
31
31
  if (!customTr || !customTr.docChanged) {
32
32
  // 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
33
33
  // If inside table cell and can't outdent list, then let it handle by table keymap
34
34
  return !isInsideTableCell(customTr) ? new PassiveTransaction() : null;
35
35
  }
36
36
  const restartListsAttributes = {};
37
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
38
- const {
39
- outdentScenario,
40
- splitListStartNumber
41
- } = getRestartListsAttributes(customTr);
42
- if (outdentScenario === OUTDENT_SCENARIOS.SPLIT_LIST) {
43
- restartListsAttributes.outdentScenario = outdentScenario;
44
- restartListsAttributes.splitListStartNumber = splitListStartNumber;
45
- }
37
+ const {
38
+ outdentScenario,
39
+ splitListStartNumber
40
+ } = getRestartListsAttributes(customTr);
41
+ if (outdentScenario === OUTDENT_SCENARIOS.SPLIT_LIST) {
42
+ restartListsAttributes.outdentScenario = outdentScenario;
43
+ restartListsAttributes.splitListStartNumber = splitListStartNumber;
46
44
  }
47
45
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
48
46
  action: ACTION.OUTDENTED,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { bulletList, listItem, orderedList, orderedListWithOrder } from '@atlaskit/adf-schema';
2
+ import { bulletList, listItem, orderedListWithOrder } from '@atlaskit/adf-schema';
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { toggleBulletList, toggleOrderedList, tooltip } from '@atlaskit/editor-common/keymaps';
5
5
  import { listMessages as messages } from '@atlaskit/editor-common/messages';
@@ -35,7 +35,7 @@ export const listPlugin = ({
35
35
  },
36
36
  commands: {
37
37
  indentList: indentList(editorAnalyticsAPI),
38
- outdentList: inputMethod => outdentList(editorAnalyticsAPI)(inputMethod, featureFlags),
38
+ outdentList: inputMethod => outdentList(editorAnalyticsAPI)(inputMethod),
39
39
  toggleOrderedList: toggleOrderedListCommand(editorAnalyticsAPI),
40
40
  toggleBulletList: toggleBulletListCommand(editorAnalyticsAPI)
41
41
  },
@@ -51,7 +51,7 @@ export const listPlugin = ({
51
51
  node: bulletList
52
52
  }, {
53
53
  name: 'orderedList',
54
- node: options !== null && options !== void 0 && options.restartNumberedLists ? orderedListWithOrder : orderedList
54
+ node: orderedListWithOrder
55
55
  }, {
56
56
  name: 'listItem',
57
57
  node: listItem
@@ -70,7 +70,7 @@ export const listPlugin = ({
70
70
  featureFlags
71
71
  }) => {
72
72
  var _api$analytics2;
73
- 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);
73
+ return inputRulePlugin(schema, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
74
74
  }
75
75
  }, {
76
76
  name: 'listKeymap',