@atlaskit/editor-plugin-list 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +6 -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 +1 -1
@@ -5,7 +5,6 @@ const getOrder = matchResult => Number(matchResult[1]);
5
5
  export function createRuleForListType({
6
6
  listType,
7
7
  expression,
8
- featureFlags,
9
8
  editorAnalyticsApi
10
9
  }) {
11
10
  let joinScenario = JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.NO_JOIN;
@@ -21,7 +20,7 @@ export function createRuleForListType({
21
20
  inputMethod: INPUT_METHOD.FORMATTING
22
21
  }
23
22
  };
24
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && listType === state.schema.nodes.orderedList && analyticsPayload.attributes) {
23
+ if (listType === state.schema.nodes.orderedList && analyticsPayload.attributes) {
25
24
  analyticsPayload.attributes.listStartNumber = getOrder(matchResult);
26
25
  analyticsPayload.attributes.joinScenario = joinScenario;
27
26
  // we reset the tracked joinScenario after storing it in the event payload
@@ -36,17 +35,14 @@ export function createRuleForListType({
36
35
  }
37
36
  return shouldJoin;
38
37
  };
39
- let getAttrs = {};
40
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
41
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
- getAttrs = matchResult => {
43
- return {
44
- order: getOrder(matchResult)
45
- };
38
+
39
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
+ let getAttrs = matchResult => {
41
+ return {
42
+ order: getOrder(matchResult)
46
43
  };
47
- }
44
+ };
48
45
  const inputRule = createWrappingJoinRule({
49
- featureFlags,
50
46
  match: expression,
51
47
  nodeType: listType,
52
48
  getAttrs,
@@ -1,6 +1,6 @@
1
1
  import { createPlugin } from '@atlaskit/prosemirror-input-rules';
2
2
  import { createRuleForListType } from './create-list-input-rule';
3
- export default function inputRulePlugin(schema, featureFlags, editorAnalyticsApi) {
3
+ export default function inputRulePlugin(schema, editorAnalyticsApi) {
4
4
  const {
5
5
  nodes: {
6
6
  bulletList,
@@ -15,16 +15,14 @@ export default function inputRulePlugin(schema, featureFlags, editorAnalyticsApi
15
15
  // character into an escaped version.
16
16
  expression: /^\s*([\*\-\u2022]) $/,
17
17
  listType: bulletList,
18
- featureFlags,
19
18
  editorAnalyticsApi
20
19
  }));
21
20
  }
22
- const expression = featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists ? /((^[1-9]{1}[0-9]{0,2})|^(0))[\.\)] $/ : /^(1)[\.\)] $/;
21
+ const expression = /((^[1-9]{1}[0-9]{0,2})|^(0))[\.\)] $/;
23
22
  if (orderedList) {
24
23
  rules.push(createRuleForListType({
25
24
  expression,
26
25
  listType: orderedList,
27
- featureFlags,
28
26
  editorAnalyticsApi
29
27
  }));
30
28
  }
@@ -10,8 +10,7 @@ export const createWrappingJoinRule = ({
10
10
  match,
11
11
  nodeType,
12
12
  getAttrs,
13
- joinPredicate,
14
- featureFlags
13
+ joinPredicate
15
14
  }) => {
16
15
  const handler = (state, match, start, end) => {
17
16
  const attrs = (getAttrs instanceof Function ? getAttrs(match) : getAttrs) || {};
@@ -35,7 +34,7 @@ export const createWrappingJoinRule = ({
35
34
 
36
35
  // if an orderedList node would be inserted by the input rule match, and
37
36
  // that orderedList node is being added directly after another orderedList
38
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && nodeType === state.schema.nodes.orderedList) {
37
+ if (nodeType === state.schema.nodes.orderedList) {
39
38
  const $end = tr.doc.resolve(tr.mapping.map(end));
40
39
  const node = findParentNodeOfTypeClosestToPos($end, nodeType);
41
40
  if (getBooleanFF('platform.editor.ordered-list-auto-join-improvements_mrlv5')) {
@@ -7,9 +7,9 @@ export function keymapPlugin(featureFlags, editorAnalyticsAPI) {
7
7
  bindKeymapWithEditorCommand(findShortcutByKeymap(toggleOrderedList), toggleList(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, 'orderedList'), list);
8
8
  bindKeymapWithEditorCommand(findShortcutByKeymap(toggleBulletList), toggleList(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, 'bulletList'), list);
9
9
  bindKeymapWithEditorCommand(indentList.common, indentListCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), list);
10
- bindKeymapWithEditorCommand(outdentList.common, outdentListCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, featureFlags), list);
11
- bindKeymapWithCommand(enter.common, enterKeyCommand(editorAnalyticsAPI)(featureFlags), list);
12
- bindKeymapWithCommand(backspace.common, backspaceKeyCommand(editorAnalyticsAPI)(featureFlags), list);
10
+ bindKeymapWithEditorCommand(outdentList.common, outdentListCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), list);
11
+ bindKeymapWithCommand(enter.common, enterKeyCommand(editorAnalyticsAPI)(), list);
12
+ bindKeymapWithCommand(backspace.common, backspaceKeyCommand(editorAnalyticsAPI)(), list);
13
13
  bindKeymapWithCommand(deleteKey.common, deleteKeyCommand(editorAnalyticsAPI), list);
14
14
 
15
15
  // This shortcut is Mac only
@@ -45,7 +45,7 @@ export const getDecorations = (doc, state, featureFlags) => {
45
45
  decorations.push(Decoration.node(from, to, {
46
46
  'data-indent-level': `${depth}`
47
47
  }));
48
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && node.type.name === 'orderedList') {
48
+ if (node.type.name === 'orderedList') {
49
49
  var _node$attrs;
50
50
  // If a numbered list has item counters numbering >= 100, we'll need to add special
51
51
  // spacing to account for the extra digit chars
@@ -58,12 +58,6 @@ export const getDecorations = (doc, state, featureFlags) => {
58
58
  style: getOrderedListInlineStyles(digitsSize, 'string')
59
59
  }));
60
60
  }
61
- } else {
62
- if (node.childCount >= 100) {
63
- decorations.push(Decoration.node(from, to, {
64
- 'data-child-count': '100+'
65
- }));
66
- }
67
61
  }
68
62
  }
69
63
  });
@@ -11,7 +11,7 @@ import { liftTarget, ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-pro
11
11
  import { getRestartListsAttributes, storeRestartListsAttributes } from '../utils/analytics';
12
12
  import { findFirstParentListItemNode, findRootParentListNode } from '../utils/find';
13
13
  import { createListNodeRange } from '../utils/selection';
14
- export var outdentListItemsSelected = function outdentListItemsSelected(tr, featureFlags) {
14
+ export var outdentListItemsSelected = function outdentListItemsSelected(tr) {
15
15
  var originalSelection = tr.selection;
16
16
  var normalizedSelection = normalizeListItemsSelection({
17
17
  selection: tr.selection,
@@ -45,8 +45,7 @@ export var outdentListItemsSelected = function outdentListItemsSelected(tr, feat
45
45
  } else {
46
46
  extractListItemsRangeFromList({
47
47
  tr: tr,
48
- range: mappedRange,
49
- featureFlags: featureFlags
48
+ range: mappedRange
50
49
  });
51
50
  hasNormalizedToPositionLiftedOut = hasNormalizedToPositionLiftedOut || oldTo >= range.from && oldTo < range.to;
52
51
  hasNormalizedFromPositionLiftedOut = hasNormalizedFromPositionLiftedOut || oldFrom >= range.from && oldFrom < range.to;
@@ -166,8 +165,7 @@ var outdentRangeToParentList = function outdentRangeToParentList(_ref2) {
166
165
  };
167
166
  var extractListItemsRangeFromList = function extractListItemsRangeFromList(_ref3) {
168
167
  var tr = _ref3.tr,
169
- range = _ref3.range,
170
- featureFlags = _ref3.featureFlags;
168
+ range = _ref3.range;
171
169
  var list = range.parent;
172
170
  var $start = tr.doc.resolve(range.start);
173
171
  var listStart = $start.start(range.depth);
@@ -190,53 +188,48 @@ var extractListItemsRangeFromList = function extractListItemsRangeFromList(_ref3
190
188
  }
191
189
  var nextList = list.copy(Fragment.empty);
192
190
  var nextListStartNumber;
193
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
194
- // if splitting a numbered list, keep the splitted item
195
- // counter as the start of the next (second half) list (instead
196
- // of reverting back to 1 as a starting number)
197
- var order = getOrderFromOrderedListNode(list);
198
- if (list.type.name === 'orderedList') {
199
- nextListStartNumber = range.endIndex - 1 + order;
200
- // @ts-ignore - [unblock prosemirror bump] assigning to readonly attrs
201
- nextList.attrs = _objectSpread(_objectSpread({}, nextList.attrs), {}, {
202
- order: nextListStartNumber
191
+ // if splitting a numbered list, keep the splitted item
192
+ // counter as the start of the next (second half) list (instead
193
+ // of reverting back to 1 as a starting number)
194
+ var order = getOrderFromOrderedListNode(list);
195
+ if (list.type.name === 'orderedList') {
196
+ nextListStartNumber = range.endIndex - 1 + order;
197
+ // @ts-ignore - [unblock prosemirror bump] assigning to readonly attrs
198
+ nextList.attrs = _objectSpread(_objectSpread({}, nextList.attrs), {}, {
199
+ order: nextListStartNumber
200
+ });
201
+ var _getRestartListsAttri = getRestartListsAttributes(tr),
202
+ splitListStartNumber = _getRestartListsAttri.splitListStartNumber;
203
+ if (typeof splitListStartNumber !== 'number') {
204
+ storeRestartListsAttributes(tr, {
205
+ splitListStartNumber: nextListStartNumber
203
206
  });
204
- var _getRestartListsAttri = getRestartListsAttributes(tr),
205
- splitListStartNumber = _getRestartListsAttri.splitListStartNumber;
206
- if (typeof splitListStartNumber !== 'number') {
207
- storeRestartListsAttributes(tr, {
208
- splitListStartNumber: nextListStartNumber
209
- });
210
- }
211
207
  }
212
208
  }
213
209
  var nextListFragment = listItemContent.append(Fragment.from(nextList));
214
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
215
- // if the split list with nextListStartNumber is below another list
216
- // with order (e.g due to multi-level indent items being lifted), track the
217
- // list above's order instead, as it will be the split list's order after sibling joins
218
- nextListFragment.forEach(function (node, _offset, index) {
219
- var _node$attrs;
220
- if (node.type.name === 'orderedList' && ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.order) === nextListStartNumber) {
221
- var _prev$attrs;
222
- var prev = nextListFragment.child(index - 1);
223
- if ((prev === null || prev === void 0 || (_prev$attrs = prev.attrs) === null || _prev$attrs === void 0 ? void 0 : _prev$attrs.order) >= 0) {
224
- var _prev$attrs2;
225
- storeRestartListsAttributes(tr, {
226
- splitListStartNumber: prev === null || prev === void 0 || (_prev$attrs2 = prev.attrs) === null || _prev$attrs2 === void 0 ? void 0 : _prev$attrs2.order
227
- });
228
- }
210
+
211
+ // if the split list with nextListStartNumber is below another list
212
+ // with order (e.g due to multi-level indent items being lifted), track the
213
+ // list above's order instead, as it will be the split list's order after sibling joins
214
+ nextListFragment.forEach(function (node, _offset, index) {
215
+ var _node$attrs;
216
+ if (node.type.name === 'orderedList' && ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.order) === nextListStartNumber) {
217
+ var _prev$attrs;
218
+ var prev = nextListFragment.child(index - 1);
219
+ if ((prev === null || prev === void 0 || (_prev$attrs = prev.attrs) === null || _prev$attrs === void 0 ? void 0 : _prev$attrs.order) >= 0) {
220
+ var _prev$attrs2;
221
+ storeRestartListsAttributes(tr, {
222
+ splitListStartNumber: prev === null || prev === void 0 || (_prev$attrs2 = prev.attrs) === null || _prev$attrs2 === void 0 ? void 0 : _prev$attrs2.order
223
+ });
229
224
  }
230
- });
231
- }
225
+ }
226
+ });
232
227
  if (isTheEntireList) {
233
228
  var slice = new Slice(listItemContent, 0, 0);
234
229
  var step = new ReplaceStep($start.pos - 1, range.end + 1, slice, false);
235
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
236
- storeRestartListsAttributes(tr, {
237
- outdentScenario: undefined
238
- });
239
- }
230
+ storeRestartListsAttributes(tr, {
231
+ outdentScenario: undefined
232
+ });
240
233
  tr.step(step);
241
234
  } else if (isAtTop) {
242
235
  var _slice = new Slice(nextListFragment, 0, 1);
@@ -247,11 +240,9 @@ var extractListItemsRangeFromList = function extractListItemsRangeFromList(_ref3
247
240
  var _step2 = new ReplaceStep($start.pos, listEnd + 1, _slice2, false);
248
241
  tr.step(_step2);
249
242
  } else {
250
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
251
- storeRestartListsAttributes(tr, {
252
- outdentScenario: OUTDENT_SCENARIOS.SPLIT_LIST
253
- });
254
- }
243
+ storeRestartListsAttributes(tr, {
244
+ outdentScenario: OUTDENT_SCENARIOS.SPLIT_LIST
245
+ });
255
246
  var _slice3 = new Slice(nextListFragment, 1, 1);
256
247
  var _step3 = new ReplaceAroundStep($start.pos, listEnd, range.end, listEnd, _slice3, _slice3.size, false);
257
248
  tr.step(_step3);
@@ -23,7 +23,7 @@ import { listBackspace } from './listBackspace';
23
23
  import { outdentList } from './outdent-list';
24
24
  export { outdentList, indentList };
25
25
  export var enterKeyCommand = function enterKeyCommand(editorAnalyticsAPI) {
26
- return function (featureFlags) {
26
+ return function () {
27
27
  return function (state, dispatch) {
28
28
  var selection = state.selection;
29
29
  if (selection.empty) {
@@ -36,7 +36,7 @@ export var enterKeyCommand = function enterKeyCommand(editorAnalyticsAPI) {
36
36
  /** Check if the wrapper has any visible content */
37
37
  var 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
  }
@@ -47,7 +47,7 @@ export var enterKeyCommand = function enterKeyCommand(editorAnalyticsAPI) {
47
47
  };
48
48
  };
49
49
  export var backspaceKeyCommand = function backspaceKeyCommand(editorAnalyticsAPI) {
50
- return function (featureFlags) {
50
+ return function () {
51
51
  return function (state, dispatch) {
52
52
  return chainCommands(listBackspace(editorAnalyticsAPI),
53
53
  // if we're at the start of a list item, we need to either backspace
@@ -56,7 +56,7 @@ export var backspaceKeyCommand = function backspaceKeyCommand(editorAnalyticsAPI
56
56
  // list items might have multiple paragraphs; only do this at the first one
57
57
  isFirstChildOfParent, function (state) {
58
58
  return isInsideListItem(state.tr);
59
- }], chainCommands(deletePreviousEmptyListItem, editorCommandToPMCommand(outdentList(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, featureFlags)))),
59
+ }], chainCommands(deletePreviousEmptyListItem, editorCommandToPMCommand(outdentList(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)))),
60
60
  // if we're just inside a paragraph node (or gapcursor is shown) and backspace, then try to join
61
61
  // the text to the previous list item, if one exists
62
62
  filter([isEmptySelectionAtStart, function (state) {
@@ -13,7 +13,6 @@ import { isInsideListItem, isInsideTableCell } from '../utils/selection';
13
13
  export var outdentList = function outdentList(editorAnalyticsAPI) {
14
14
  return function () {
15
15
  var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INPUT_METHOD.KEYBOARD;
16
- var featureFlags = arguments.length > 1 ? arguments[1] : undefined;
17
16
  return function (_ref) {
18
17
  var tr = _ref.tr;
19
18
  if (!isInsideListItem(tr)) {
@@ -30,21 +29,19 @@ export var outdentList = function outdentList(editorAnalyticsAPI) {
30
29
  closeHistory(tr);
31
30
  var actionSubjectId = isBulletList(parentListNode.node) ? ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
32
31
  var customTr = tr;
33
- outdentListAction(customTr, featureFlags);
32
+ outdentListAction(customTr);
34
33
  if (!customTr || !customTr.docChanged) {
35
34
  // 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
36
35
  // If inside table cell and can't outdent list, then let it handle by table keymap
37
36
  return !isInsideTableCell(customTr) ? new PassiveTransaction() : null;
38
37
  }
39
38
  var restartListsAttributes = {};
40
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
41
- var _getRestartListsAttri = getRestartListsAttributes(customTr),
42
- outdentScenario = _getRestartListsAttri.outdentScenario,
43
- splitListStartNumber = _getRestartListsAttri.splitListStartNumber;
44
- if (outdentScenario === OUTDENT_SCENARIOS.SPLIT_LIST) {
45
- restartListsAttributes.outdentScenario = outdentScenario;
46
- restartListsAttributes.splitListStartNumber = splitListStartNumber;
47
- }
39
+ var _getRestartListsAttri = getRestartListsAttributes(customTr),
40
+ outdentScenario = _getRestartListsAttri.outdentScenario,
41
+ splitListStartNumber = _getRestartListsAttri.splitListStartNumber;
42
+ if (outdentScenario === OUTDENT_SCENARIOS.SPLIT_LIST) {
43
+ restartListsAttributes.outdentScenario = outdentScenario;
44
+ restartListsAttributes.splitListStartNumber = splitListStartNumber;
48
45
  }
49
46
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
50
47
  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 var listPlugin = function listPlugin(_ref) {
35
35
  commands: {
36
36
  indentList: indentList(editorAnalyticsAPI),
37
37
  outdentList: function outdentList(inputMethod) {
38
- return _outdentList(editorAnalyticsAPI)(inputMethod, featureFlags);
38
+ return _outdentList(editorAnalyticsAPI)(inputMethod);
39
39
  },
40
40
  toggleOrderedList: toggleOrderedListCommand(editorAnalyticsAPI),
41
41
  toggleBulletList: toggleBulletListCommand(editorAnalyticsAPI)
@@ -52,7 +52,7 @@ export var listPlugin = function listPlugin(_ref) {
52
52
  node: bulletList
53
53
  }, {
54
54
  name: 'orderedList',
55
- node: options !== null && options !== void 0 && options.restartNumberedLists ? orderedListWithOrder : orderedList
55
+ node: orderedListWithOrder
56
56
  }, {
57
57
  name: 'listItem',
58
58
  node: listItem
@@ -71,7 +71,7 @@ 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 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
74
+ return inputRulePlugin(schema, 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',
@@ -7,7 +7,6 @@ var getOrder = function getOrder(matchResult) {
7
7
  export function createRuleForListType(_ref) {
8
8
  var listType = _ref.listType,
9
9
  expression = _ref.expression,
10
- featureFlags = _ref.featureFlags,
11
10
  editorAnalyticsApi = _ref.editorAnalyticsApi;
12
11
  var joinScenario = JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.NO_JOIN;
13
12
  var isBulletList = listType.name === 'bulletList';
@@ -22,7 +21,7 @@ export function createRuleForListType(_ref) {
22
21
  inputMethod: INPUT_METHOD.FORMATTING
23
22
  }
24
23
  };
25
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && listType === state.schema.nodes.orderedList && analyticsPayload.attributes) {
24
+ if (listType === state.schema.nodes.orderedList && analyticsPayload.attributes) {
26
25
  analyticsPayload.attributes.listStartNumber = getOrder(matchResult);
27
26
  analyticsPayload.attributes.joinScenario = joinScenario;
28
27
  // we reset the tracked joinScenario after storing it in the event payload
@@ -37,17 +36,14 @@ export function createRuleForListType(_ref) {
37
36
  }
38
37
  return shouldJoin;
39
38
  };
40
- var getAttrs = {};
41
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
42
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
- getAttrs = function getAttrs(matchResult) {
44
- return {
45
- order: getOrder(matchResult)
46
- };
39
+
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
+ var getAttrs = function getAttrs(matchResult) {
42
+ return {
43
+ order: getOrder(matchResult)
47
44
  };
48
- }
45
+ };
49
46
  var inputRule = createWrappingJoinRule({
50
- featureFlags: featureFlags,
51
47
  match: expression,
52
48
  nodeType: listType,
53
49
  getAttrs: getAttrs,
@@ -1,6 +1,6 @@
1
1
  import { createPlugin } from '@atlaskit/prosemirror-input-rules';
2
2
  import { createRuleForListType } from './create-list-input-rule';
3
- export default function inputRulePlugin(schema, featureFlags, editorAnalyticsApi) {
3
+ export default function inputRulePlugin(schema, editorAnalyticsApi) {
4
4
  var _schema$nodes = schema.nodes,
5
5
  bulletList = _schema$nodes.bulletList,
6
6
  orderedList = _schema$nodes.orderedList;
@@ -12,16 +12,14 @@ export default function inputRulePlugin(schema, featureFlags, editorAnalyticsApi
12
12
  // character into an escaped version.
13
13
  expression: /^\s*([\*\-\u2022]) $/,
14
14
  listType: bulletList,
15
- featureFlags: featureFlags,
16
15
  editorAnalyticsApi: editorAnalyticsApi
17
16
  }));
18
17
  }
19
- var expression = featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists ? /((^[1-9]{1}[0-9]{0,2})|^(0))[\.\)] $/ : /^(1)[\.\)] $/;
18
+ var expression = /((^[1-9]{1}[0-9]{0,2})|^(0))[\.\)] $/;
20
19
  if (orderedList) {
21
20
  rules.push(createRuleForListType({
22
21
  expression: expression,
23
22
  listType: orderedList,
24
- featureFlags: featureFlags,
25
23
  editorAnalyticsApi: editorAnalyticsApi
26
24
  }));
27
25
  }
@@ -10,8 +10,7 @@ export var createWrappingJoinRule = function createWrappingJoinRule(_ref) {
10
10
  var match = _ref.match,
11
11
  nodeType = _ref.nodeType,
12
12
  getAttrs = _ref.getAttrs,
13
- joinPredicate = _ref.joinPredicate,
14
- featureFlags = _ref.featureFlags;
13
+ joinPredicate = _ref.joinPredicate;
15
14
  var handler = function handler(state, match, start, end) {
16
15
  var attrs = (getAttrs instanceof Function ? getAttrs(match) : getAttrs) || {};
17
16
  var tr = state.tr;
@@ -34,7 +33,7 @@ export var createWrappingJoinRule = function createWrappingJoinRule(_ref) {
34
33
 
35
34
  // if an orderedList node would be inserted by the input rule match, and
36
35
  // that orderedList node is being added directly after another orderedList
37
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && nodeType === state.schema.nodes.orderedList) {
36
+ if (nodeType === state.schema.nodes.orderedList) {
38
37
  var $end = tr.doc.resolve(tr.mapping.map(end));
39
38
  var _node = findParentNodeOfTypeClosestToPos($end, nodeType);
40
39
  if (getBooleanFF('platform.editor.ordered-list-auto-join-improvements_mrlv5')) {
@@ -7,9 +7,9 @@ export function keymapPlugin(featureFlags, editorAnalyticsAPI) {
7
7
  bindKeymapWithEditorCommand(findShortcutByKeymap(toggleOrderedList), toggleList(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, 'orderedList'), list);
8
8
  bindKeymapWithEditorCommand(findShortcutByKeymap(toggleBulletList), toggleList(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, 'bulletList'), list);
9
9
  bindKeymapWithEditorCommand(indentList.common, indentListCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), list);
10
- bindKeymapWithEditorCommand(outdentList.common, outdentListCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, featureFlags), list);
11
- bindKeymapWithCommand(enter.common, enterKeyCommand(editorAnalyticsAPI)(featureFlags), list);
12
- bindKeymapWithCommand(backspace.common, backspaceKeyCommand(editorAnalyticsAPI)(featureFlags), list);
10
+ bindKeymapWithEditorCommand(outdentList.common, outdentListCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), list);
11
+ bindKeymapWithCommand(enter.common, enterKeyCommand(editorAnalyticsAPI)(), list);
12
+ bindKeymapWithCommand(backspace.common, backspaceKeyCommand(editorAnalyticsAPI)(), list);
13
13
  bindKeymapWithCommand(deleteKey.common, deleteKeyCommand(editorAnalyticsAPI), list);
14
14
 
15
15
  // This shortcut is Mac only
@@ -48,7 +48,7 @@ export var getDecorations = function getDecorations(doc, state, featureFlags) {
48
48
  decorations.push(Decoration.node(from, to, {
49
49
  'data-indent-level': "".concat(depth)
50
50
  }));
51
- if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && node.type.name === 'orderedList') {
51
+ if (node.type.name === 'orderedList') {
52
52
  var _node$attrs;
53
53
  // If a numbered list has item counters numbering >= 100, we'll need to add special
54
54
  // spacing to account for the extra digit chars
@@ -61,12 +61,6 @@ export var getDecorations = function getDecorations(doc, state, featureFlags) {
61
61
  style: getOrderedListInlineStyles(digitsSize, 'string')
62
62
  }));
63
63
  }
64
- } else {
65
- if (node.childCount >= 100) {
66
- decorations.push(Decoration.node(from, to, {
67
- 'data-child-count': '100+'
68
- }));
69
- }
70
64
  }
71
65
  }
72
66
  });
@@ -1,3 +1,2 @@
1
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
2
1
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
- export declare const outdentListItemsSelected: (tr: Transaction, featureFlags: FeatureFlags) => void;
2
+ export declare const outdentListItemsSelected: (tr: Transaction) => void;
@@ -1,13 +1,13 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import type { Command, EditorCommand, FeatureFlags } from '@atlaskit/editor-common/types';
3
+ import type { Command, EditorCommand } from '@atlaskit/editor-common/types';
4
4
  import type { NodeType, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
5
5
  import { indentList } from './indent-list';
6
6
  import { outdentList } from './outdent-list';
7
7
  export { outdentList, indentList };
8
8
  export type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
9
- export declare const enterKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (featureFlags: FeatureFlags) => Command;
10
- export declare const backspaceKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (featureFlags: FeatureFlags) => Command;
9
+ export declare const enterKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => () => Command;
10
+ export declare const backspaceKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => () => Command;
11
11
  export declare const deleteKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
12
12
  export declare const rootListDepth: (pos: ResolvedPos, nodes: Record<string, NodeType>) => number | undefined;
13
13
  export declare const toggleList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: InputMethod, listType: 'bulletList' | 'orderedList') => EditorCommand;
@@ -1,6 +1,6 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import type { EditorCommand, FeatureFlags } from '@atlaskit/editor-common/types';
3
+ import type { EditorCommand } from '@atlaskit/editor-common/types';
4
4
  type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
5
- export declare const outdentList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: InputMethod | undefined, featureFlags: FeatureFlags) => EditorCommand;
5
+ export declare const outdentList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: InputMethod) => EditorCommand;
6
6
  export {};
@@ -1,2 +1,2 @@
1
- export type { ListPlugin, ListPluginOptions, FindRootParentListNode, ListState, InputMethod, } from './types';
1
+ export type { ListPlugin, FindRootParentListNode, ListState, InputMethod, } from './types';
2
2
  export { listPlugin } from './plugin';
@@ -1,11 +1,9 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
3
2
  import type { NodeType } from '@atlaskit/editor-prosemirror/model';
4
3
  type Props = {
5
4
  listType: NodeType;
6
5
  expression: RegExp;
7
- featureFlags: FeatureFlags;
8
6
  editorAnalyticsApi: EditorAnalyticsAPI | undefined;
9
7
  };
10
- export declare function createRuleForListType({ listType, expression, featureFlags, editorAnalyticsApi, }: Props): import("@atlaskit/editor-common/types").InputRuleWrapper;
8
+ export declare function createRuleForListType({ listType, expression, editorAnalyticsApi, }: Props): import("@atlaskit/prosemirror-input-rules").InputRuleWrapper;
11
9
  export {};
@@ -1,5 +1,4 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
4
3
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
5
- export default function inputRulePlugin(schema: Schema, featureFlags: FeatureFlags, editorAnalyticsApi: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
4
+ export default function inputRulePlugin(schema: Schema, editorAnalyticsApi: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
@@ -1,13 +1,12 @@
1
1
  import { JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST } from '@atlaskit/editor-common/analytics';
2
- import type { FeatureFlags, InputRuleWrapper } from '@atlaskit/editor-common/types';
2
+ import type { InputRuleWrapper } from '@atlaskit/editor-common/types';
3
3
  import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
4
  type Attrs = Record<string, any>;
5
5
  type WrappingRuleProps = {
6
- featureFlags: FeatureFlags;
7
6
  match: RegExp;
8
7
  nodeType: NodeType;
9
8
  getAttrs?: Attrs | ((matchResult: RegExpExecArray) => Attrs);
10
9
  joinPredicate?: (matchResult: RegExpExecArray, node: PMNode, joinScenario: JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST) => boolean;
11
10
  };
12
- export declare const createWrappingJoinRule: ({ match, nodeType, getAttrs, joinPredicate, featureFlags, }: WrappingRuleProps) => InputRuleWrapper;
11
+ export declare const createWrappingJoinRule: ({ match, nodeType, getAttrs, joinPredicate, }: WrappingRuleProps) => InputRuleWrapper;
13
12
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
- import type { EditorCommand, FeatureFlags, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
3
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
4
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
5
5
  import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
@@ -7,7 +7,6 @@ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
7
7
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
8
  export type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
9
9
  export declare const MAX_NESTED_LIST_INDENTATION = 6;
10
- export type ListPluginOptions = Pick<FeatureFlags, 'restartNumberedLists'>;
11
10
  export type IndentList = (inputMethod: InputMethod) => EditorCommand;
12
11
  export type OutdentList = (inputMethod: InputMethod) => EditorCommand;
13
12
  export type ToggleOrderedList = (inputMethod: InputMethod) => EditorCommand;
@@ -22,7 +21,6 @@ export interface ListState {
22
21
  decorationSet: DecorationSet;
23
22
  }
24
23
  export type ListPlugin = NextEditorPlugin<'list', {
25
- pluginConfiguration: ListPluginOptions | undefined;
26
24
  dependencies: [
27
25
  OptionalPlugin<FeatureFlagsPlugin>,
28
26
  OptionalPlugin<AnalyticsPlugin>
@@ -1,3 +1,2 @@
1
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
2
1
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
- export declare const outdentListItemsSelected: (tr: Transaction, featureFlags: FeatureFlags) => void;
2
+ export declare const outdentListItemsSelected: (tr: Transaction) => void;
@@ -1,13 +1,13 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import type { Command, EditorCommand, FeatureFlags } from '@atlaskit/editor-common/types';
3
+ import type { Command, EditorCommand } from '@atlaskit/editor-common/types';
4
4
  import type { NodeType, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
5
5
  import { indentList } from './indent-list';
6
6
  import { outdentList } from './outdent-list';
7
7
  export { outdentList, indentList };
8
8
  export type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
9
- export declare const enterKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (featureFlags: FeatureFlags) => Command;
10
- export declare const backspaceKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (featureFlags: FeatureFlags) => Command;
9
+ export declare const enterKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => () => Command;
10
+ export declare const backspaceKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => () => Command;
11
11
  export declare const deleteKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
12
12
  export declare const rootListDepth: (pos: ResolvedPos, nodes: Record<string, NodeType>) => number | undefined;
13
13
  export declare const toggleList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: InputMethod, listType: 'bulletList' | 'orderedList') => EditorCommand;
@@ -1,6 +1,6 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import type { EditorCommand, FeatureFlags } from '@atlaskit/editor-common/types';
3
+ import type { EditorCommand } from '@atlaskit/editor-common/types';
4
4
  type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
5
- export declare const outdentList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: InputMethod | undefined, featureFlags: FeatureFlags) => EditorCommand;
5
+ export declare const outdentList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: InputMethod) => EditorCommand;
6
6
  export {};