@atlaskit/editor-common 122.12.0 → 123.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 (46) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/cjs/extensibility/ExtensionComponent.js +1 -1
  3. package/dist/cjs/extensions/extension-handlers.js +1 -2
  4. package/dist/cjs/lists/flatten-list.js +1 -73
  5. package/dist/cjs/lists/index.js +0 -26
  6. package/dist/cjs/lists/node.js +1 -78
  7. package/dist/cjs/lists/replace-content.js +1 -9
  8. package/dist/cjs/lists/selection.js +2 -29
  9. package/dist/cjs/monitoring/error.js +1 -1
  10. package/dist/cjs/node-anchor/node-anchor-provider.js +1 -3
  11. package/dist/cjs/ui/DropList/index.js +1 -1
  12. package/dist/es2019/extensibility/ExtensionComponent.js +1 -1
  13. package/dist/es2019/extensions/extension-handlers.js +1 -2
  14. package/dist/es2019/lists/flatten-list.js +1 -76
  15. package/dist/es2019/lists/index.js +2 -4
  16. package/dist/es2019/lists/node.js +0 -77
  17. package/dist/es2019/lists/replace-content.js +1 -3
  18. package/dist/es2019/lists/selection.js +1 -31
  19. package/dist/es2019/monitoring/error.js +1 -1
  20. package/dist/es2019/node-anchor/node-anchor-provider.js +1 -3
  21. package/dist/es2019/ui/DropList/index.js +1 -1
  22. package/dist/esm/extensibility/ExtensionComponent.js +1 -1
  23. package/dist/esm/extensions/extension-handlers.js +1 -2
  24. package/dist/esm/lists/flatten-list.js +1 -71
  25. package/dist/esm/lists/index.js +2 -4
  26. package/dist/esm/lists/node.js +0 -77
  27. package/dist/esm/lists/replace-content.js +1 -3
  28. package/dist/esm/lists/selection.js +1 -28
  29. package/dist/esm/monitoring/error.js +1 -1
  30. package/dist/esm/node-anchor/node-anchor-provider.js +1 -3
  31. package/dist/esm/ui/DropList/index.js +1 -1
  32. package/dist/types/lists/flatten-list.d.ts +0 -28
  33. package/dist/types/lists/index.d.ts +2 -4
  34. package/dist/types/lists/node.d.ts +0 -1
  35. package/dist/types/lists/replace-content.d.ts +1 -1
  36. package/dist/types/lists/selection.d.ts +1 -7
  37. package/package.json +4 -7
  38. package/dist/cjs/lists/indentation.js +0 -23
  39. package/dist/cjs/lists/wrapTaskListIntoListAbove.js +0 -30
  40. package/dist/es2019/lists/indentation.js +0 -18
  41. package/dist/es2019/lists/wrapTaskListIntoListAbove.js +0 -24
  42. package/dist/esm/lists/indentation.js +0 -17
  43. package/dist/esm/lists/wrapTaskListIntoListAbove.js +0 -24
  44. package/dist/types/lists/indentation.d.ts +0 -5
  45. package/dist/types/lists/wrapTaskListIntoListAbove.d.ts +0 -2
  46. package/lists/indentation/package.json +0 -10
@@ -1,4 +1,3 @@
1
- import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
2
1
  import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
3
2
  import { isListItemNode } from '../utils';
4
3
  import { numberNestedLists } from './numberNestedLists';
@@ -14,35 +13,6 @@ export const getListItemAttributes = $pos => {
14
13
  itemIndex
15
14
  };
16
15
  };
17
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
18
- export const normalizeListItemsSelection = ({
19
- selection,
20
- doc
21
- }) => {
22
- if (selection.empty) {
23
- return selection;
24
- }
25
- const {
26
- $from,
27
- $to
28
- } = selection;
29
- if (selection instanceof NodeSelection) {
30
- const head = resolvePositionToStartOfListItem($from);
31
- return new TextSelection(head, head);
32
- }
33
- const head = resolvePositionToStartOfListItem($from);
34
- const anchor = resolvePositionToEndOfListItem($to);
35
- return new TextSelection(anchor, head);
36
- };
37
- const resolvePositionToStartOfListItem = $pos => {
38
- const fromRange = $pos.blockRange($pos, isListItemNode);
39
- const fromPosition = fromRange && $pos.textOffset === 0 && fromRange.end - 1 === $pos.pos ? Selection.near($pos.doc.resolve(fromRange.end + 1), 1).$from : $pos;
40
- return fromPosition;
41
- };
42
- const resolvePositionToEndOfListItem = $pos => {
43
- const toRange = $pos.blockRange($pos, isListItemNode);
44
- const toPosition = toRange && $pos.textOffset === 0 && toRange.start + 1 === $pos.pos ? Selection.near($pos.doc.resolve(toRange.start - 1), -1).$to : $pos;
45
- return toPosition;
46
- };
16
+
47
17
  // eslint-disable-next-line @atlaskit/editor/no-re-export
48
18
  export { numberNestedLists } from './numberNestedLists';
@@ -13,7 +13,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
13
13
  const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
14
14
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
15
15
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
16
- const packageVersion = "122.11.1";
16
+ const packageVersion = "123.0.1";
17
17
  const sanitiseSentryEvents = (data, _hint) => {
18
18
  // Remove URL as it has UGC
19
19
  // Ignored via go/ees007
@@ -1,8 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { fg } from '@atlaskit/platform-feature-flags/fg';
3
2
  import { isEmptyDocument } from '../utils';
4
3
  import { DynamicBitArray } from './dynamic-bit-array';
5
- import { shouldEnableLimitedModeForDocument } from './should-enable-limited-mode';
6
4
 
7
5
  // The slice of `@atlaskit/editor-plugin-limited-mode`'s state read below. Declared
8
6
  // structurally because `editor-common` must not depend on a plugin package.
@@ -97,7 +95,7 @@ const nodeIdProviderMap = new WeakMap();
97
95
  */
98
96
  const isLimitedModeEnabled = editorView => {
99
97
  var _limitedModePluginKey, _limitedModePluginKey2;
100
- return fg('platform_editor_fix_limited_mode_leaking') ? (_limitedModePluginKey = (_limitedModePluginKey2 = limitedModePluginKey.getState(editorView.state)) === null || _limitedModePluginKey2 === void 0 ? void 0 : _limitedModePluginKey2.documentSizeBreachesThreshold) !== null && _limitedModePluginKey !== void 0 ? _limitedModePluginKey : false : shouldEnableLimitedModeForDocument(editorView.state.doc);
98
+ return (_limitedModePluginKey = (_limitedModePluginKey2 = limitedModePluginKey.getState(editorView.state)) === null || _limitedModePluginKey2 === void 0 ? void 0 : _limitedModePluginKey2.documentSizeBreachesThreshold) !== null && _limitedModePluginKey !== void 0 ? _limitedModePluginKey : false;
101
99
  };
102
100
 
103
101
  // Get the NodeIdProvider for a specific EditorView instance.
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags/fg';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "122.11.1";
17
+ const packageVersion = "123.0.1";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -287,7 +287,7 @@ var ExtensionComponentInner = /*#__PURE__*/function (_Component) {
287
287
  references: _this.props.references,
288
288
  isSelected: isSelected,
289
289
  loadingFallback: loadingFallback,
290
- showUnknownMacroPlaceholder: fg('tinymce_display_unknown_macro_body_content')
290
+ showUnknownMacroPlaceholder: true
291
291
  });
292
292
  }
293
293
  }
@@ -4,7 +4,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import React from 'react';
5
5
  import { useIntl } from 'react-intl';
6
6
  import Loadable from 'react-loadable';
7
- import { fg } from '@atlaskit/platform-feature-flags/fg';
8
7
  import { getExtensionKeyAndNodeKey, resolveImport } from './manifest-helpers';
9
8
  import { messages } from './messages';
10
9
  import { resolveImportSync } from './resolveImportSync';
@@ -115,7 +114,7 @@ function ExtensionLoading(props) {
115
114
  if (props.error || props.timedOut) {
116
115
  // eslint-disable-next-line no-console
117
116
  console.error('Error rendering extension', props.error);
118
- if (props.error && props.showUnknownMacroPlaceholder && extensionNode && isUnknownConfluenceMacroWithBody(extensionNode) && fg('tinymce_display_unknown_macro_body_content')) {
117
+ if (props.error && props.showUnknownMacroPlaceholder && extensionNode && isUnknownConfluenceMacroWithBody(extensionNode)) {
119
118
  return /*#__PURE__*/React.createElement(UnknownMacroPlaceholder, {
120
119
  extensionNode: extensionNode
121
120
  });
@@ -1,71 +1 @@
1
- /**
2
- * Type-specific predicates that vary between regular lists and task lists.
3
- */
4
-
5
- /**
6
- * Flattens a list-like PM structure (regular list or task list) into an
7
- * array of content-bearing items with computed depths.
8
- *
9
- * Uses `doc.nodesBetween` to walk the tree and delegates type-specific
10
- * decisions to the provided predicates. The core algorithm — selection
11
- * intersection, depth adjustment, index tracking — is shared.
12
- *
13
- * @private
14
- * @deprecated Cannot represent content placed between an item's sub-lists
15
- * (e.g. `li(p, ul, p, ul)`). Callers provide their own flatten that handles this.
16
- */
17
- export function flattenList(options, predicates) {
18
- var doc = options.doc,
19
- rootListStart = options.rootListStart,
20
- rootListEnd = options.rootListEnd,
21
- selectionFrom = options.selectionFrom,
22
- selectionTo = options.selectionTo,
23
- indentDelta = options.indentDelta,
24
- maxDepth = options.maxDepth;
25
- var isContentNode = predicates.isContentNode,
26
- getSelectionBounds = predicates.getSelectionBounds,
27
- getDepth = predicates.getDepth;
28
- var items = [];
29
- var startIndex = -1;
30
- var endIndex = -1;
31
- var exceedsMaxDepth = false;
32
- var rootDepth = doc.resolve(rootListStart).depth;
33
- doc.nodesBetween(rootListStart, rootListEnd, function (node, pos, parent) {
34
- if (!isContentNode(node, parent) || parent == null) {
35
- return true;
36
- }
37
- var _getSelectionBounds = getSelectionBounds(node, pos),
38
- start = _getSelectionBounds.start,
39
- end = _getSelectionBounds.end;
40
- var isSelected = selectionFrom === selectionTo ? selectionFrom >= start && selectionFrom <= end : start < selectionTo && end > selectionFrom;
41
- var resolvedDepth = doc.resolve(pos).depth;
42
- var depth = getDepth(resolvedDepth, rootDepth) + (isSelected ? indentDelta : 0);
43
- items.push({
44
- node: node,
45
- pos: pos,
46
- depth: depth,
47
- isSelected: isSelected,
48
- listType: parent.type.name,
49
- parentListAttrs: parent.attrs
50
- });
51
- if (isSelected) {
52
- var index = items.length - 1;
53
- if (startIndex === -1) {
54
- startIndex = index;
55
- }
56
- endIndex = index;
57
- if (maxDepth != null && depth >= maxDepth) {
58
- exceedsMaxDepth = true;
59
- }
60
- }
61
- return true;
62
- });
63
- if (items.length === 0 || startIndex === -1 || exceedsMaxDepth) {
64
- return null;
65
- }
66
- return {
67
- items: items,
68
- startIndex: startIndex,
69
- endIndex: endIndex
70
- };
71
- }
1
+ export {};
@@ -1,18 +1,16 @@
1
1
  // Disable no-re-export rule for entry point files
2
2
  /* eslint-disable @atlaskit/editor/no-re-export */
3
3
 
4
- export { getListItemAttributes, normalizeListItemsSelection } from './selection';
4
+ export { getListItemAttributes } from './selection';
5
5
  export { moveTargetIntoList } from './replace-content';
6
6
  export { JoinDirection } from './JoinDirection';
7
7
  export { isListNodeValidContent } from './isListNodeValidContent';
8
- export { joinSiblingLists, processNestedTaskListsInSameLevel } from './node';
8
+ export { joinSiblingLists } from './node';
9
9
  export { getCommonListAnalyticsAttributes } from './analytics';
10
10
  export { countListItemsInSelection } from './countListItemsInSelection';
11
- export { hasValidListIndentationLevel } from './indentation';
12
11
  export { restoreSelection, computeSelectionOffsets } from './restore-selection';
13
12
  export { buildReplacementFragment } from './build-replacement-fragment';
14
13
  export { narrowReplacementRange } from './narrow-replacement-range';
15
- export { flattenList } from './flatten-list';
16
14
  export { getBlockMarkAttrs, getFirstParagraphBlockMarkAttrs, reconcileBlockMarkForContainerAtPos, reconcileBlockMarkForParagraphAtPos, reconcileBlockMarkInRange } from './block-mark';
17
15
  export { isListNode, isListItemNode, isBulletList, isParagraphNode } from '../utils';
18
16
  export { messages } from './messages';
@@ -1,7 +1,6 @@
1
1
  import { isListItemNode, isListNode } from '../utils';
2
2
  import { isListNodeValidContent } from './isListNodeValidContent';
3
3
  import { JoinDirection } from './JoinDirection';
4
- import { wrapTaskListIntoListAbove } from './wrapTaskListIntoListAbove';
5
4
  export var joinSiblingLists = function joinSiblingLists(_ref) {
6
5
  var tr = _ref.tr,
7
6
  direction = _ref.direction,
@@ -75,82 +74,6 @@ export var joinSiblingLists = function joinSiblingLists(_ref) {
75
74
  return result;
76
75
  };
77
76
 
78
- /**
79
- * Returns the prosemirror position for the child at give index inside the parent node.
80
- * Example: Considering doc structure as below using the function
81
- * passing parent resolved position for li and index 2
82
- * would return starting position of taskList
83
- * DOC STRUCTURE:
84
- * ol()
85
- * ( li(
86
- * p('text'),
87
- * ul(content),
88
- * taskList(),
89
- * )
90
- * )
91
- * @param $from Starting resolved position for the parent node of the child we are looking for.
92
- * @param index Index of the child node we want the position for.
93
- * @returns
94
- */
95
- var findStartPositionOfChildWithIndex = function findStartPositionOfChildWithIndex($from, index) {
96
- var parent = $from.node();
97
- var currentPos = $from.pos + 1;
98
- for (var i = 0; i < index; i++) {
99
- currentPos += parent.child(i).nodeSize;
100
- }
101
- return currentPos;
102
- };
103
- var findGrandParentResolvedPos = function findGrandParentResolvedPos(tr, $from) {
104
- return $from.depth > 2 ? tr.doc.resolve($from.start($from.depth - 2)) : null;
105
- };
106
- var findNestedTaskListsIndexAtSameLevel = function findNestedTaskListsIndexAtSameLevel(tr, $from) {
107
- /*
108
- Currently our cursor would be inside a pargraph of a list of type numbered/bullet list,
109
- we need to find the grandparent of the cursor which is the list at same level of taskList.
110
- We can get the root list item(inside which various lists are being resolved before outdenting) by going one depth above that list.
111
- */
112
- var nestedListResolvedPos = findGrandParentResolvedPos(tr, $from);
113
- var rootListItem = nestedListResolvedPos === null || nestedListResolvedPos === void 0 ? void 0 : nestedListResolvedPos.node(nestedListResolvedPos.depth - 1);
114
- var nestedTaskListsIndexes = [];
115
- var rootListItemChildCount = (rootListItem === null || rootListItem === void 0 ? void 0 : rootListItem.childCount) || 0;
116
- // first child of list item is always paragraph (i = 0) so we start from 1
117
- for (var i = 1; i < rootListItemChildCount; i++) {
118
- if ((rootListItem === null || rootListItem === void 0 ? void 0 : rootListItem.child(i).type.name) === 'taskList') {
119
- nestedTaskListsIndexes.push(i);
120
- }
121
- }
122
- return nestedTaskListsIndexes;
123
- };
124
-
125
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
126
- export var processNestedTaskListsInSameLevel = function processNestedTaskListsInSameLevel(tr) {
127
- var $from = tr.selection.$from;
128
- var nestedTaskListIndexes = findNestedTaskListsIndexAtSameLevel(tr, $from);
129
- if (nestedTaskListIndexes.length === 0) {
130
- return;
131
- }
132
- var nestedListResolvedPos = findGrandParentResolvedPos(tr, $from);
133
- var rootListItemStart = nestedListResolvedPos === null || nestedListResolvedPos === void 0 ? void 0 : nestedListResolvedPos.start(nestedListResolvedPos.depth - 1);
134
-
135
- /* We need not wrap the taskList present above other lists since it doesn't affect the flow. */
136
- var nestedTaskListIndexesToWrap = nestedTaskListIndexes.filter(function (index) {
137
- return index > 1;
138
- });
139
-
140
- /*
141
- Wraps the taskLists present at each index mentioned in the nestedTaskListIndexesToWrap to the list above it.
142
- After each wrap the indexes changes since two lists are being merged into one,
143
- so we keep track of it and use it to access actual calculated taskList indexes.
144
- */
145
- if (rootListItemStart) {
146
- var taskListsFixedNested = 0;
147
- nestedTaskListIndexesToWrap.forEach(function (index) {
148
- wrapTaskListIntoListAbove(tr, findStartPositionOfChildWithIndex(tr.doc.resolve(rootListItemStart), index - taskListsFixedNested), findStartPositionOfChildWithIndex(tr.doc.resolve(rootListItemStart), index - 1 - taskListsFixedNested));
149
- taskListsFixedNested++;
150
- });
151
- }
152
- return;
153
- };
154
77
  // eslint-disable-next-line @atlaskit/editor/no-re-export
155
78
  export { isListNodeValidContent } from './isListNodeValidContent';
156
79
  // eslint-disable-next-line @atlaskit/editor/no-re-export
@@ -14,6 +14,4 @@ export var moveTargetIntoList = function moveTargetIntoList(_ref) {
14
14
  }
15
15
  var step = new ReplaceAroundStep(from, to, gapFrom, gapTo, $target.doc.slice(insertPosition, $target.pos), 0, true);
16
16
  return step;
17
- };
18
- // eslint-disable-next-line @atlaskit/editor/no-re-export
19
- export { wrapTaskListIntoListAbove } from './wrapTaskListIntoListAbove';
17
+ };
@@ -1,4 +1,3 @@
1
- import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
2
1
  import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
3
2
  import { isListItemNode } from '../utils';
4
3
  import { numberNestedLists } from './numberNestedLists';
@@ -14,32 +13,6 @@ export var getListItemAttributes = function getListItemAttributes($pos) {
14
13
  itemIndex: itemIndex
15
14
  };
16
15
  };
17
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
18
- export var normalizeListItemsSelection = function normalizeListItemsSelection(_ref) {
19
- var selection = _ref.selection,
20
- doc = _ref.doc;
21
- if (selection.empty) {
22
- return selection;
23
- }
24
- var $from = selection.$from,
25
- $to = selection.$to;
26
- if (selection instanceof NodeSelection) {
27
- var _head = resolvePositionToStartOfListItem($from);
28
- return new TextSelection(_head, _head);
29
- }
30
- var head = resolvePositionToStartOfListItem($from);
31
- var anchor = resolvePositionToEndOfListItem($to);
32
- return new TextSelection(anchor, head);
33
- };
34
- var resolvePositionToStartOfListItem = function resolvePositionToStartOfListItem($pos) {
35
- var fromRange = $pos.blockRange($pos, isListItemNode);
36
- var fromPosition = fromRange && $pos.textOffset === 0 && fromRange.end - 1 === $pos.pos ? Selection.near($pos.doc.resolve(fromRange.end + 1), 1).$from : $pos;
37
- return fromPosition;
38
- };
39
- var resolvePositionToEndOfListItem = function resolvePositionToEndOfListItem($pos) {
40
- var toRange = $pos.blockRange($pos, isListItemNode);
41
- var toPosition = toRange && $pos.textOffset === 0 && toRange.start + 1 === $pos.pos ? Selection.near($pos.doc.resolve(toRange.start - 1), -1).$to : $pos;
42
- return toPosition;
43
- };
16
+
44
17
  // eslint-disable-next-line @atlaskit/editor/no-re-export
45
18
  export { numberNestedLists } from './numberNestedLists';
@@ -19,7 +19,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
19
19
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
20
20
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
21
21
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
22
- var packageVersion = "122.11.1";
22
+ var packageVersion = "123.0.1";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -1,10 +1,8 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- import { fg } from '@atlaskit/platform-feature-flags/fg';
5
4
  import { isEmptyDocument } from '../utils';
6
5
  import { DynamicBitArray } from './dynamic-bit-array';
7
- import { shouldEnableLimitedModeForDocument } from './should-enable-limited-mode';
8
6
 
9
7
  // The slice of `@atlaskit/editor-plugin-limited-mode`'s state read below. Declared
10
8
  // structurally because `editor-common` must not depend on a plugin package.
@@ -117,7 +115,7 @@ var nodeIdProviderMap = new WeakMap();
117
115
  */
118
116
  var isLimitedModeEnabled = function isLimitedModeEnabled(editorView) {
119
117
  var _limitedModePluginKey, _limitedModePluginKey2;
120
- return fg('platform_editor_fix_limited_mode_leaking') ? (_limitedModePluginKey = (_limitedModePluginKey2 = limitedModePluginKey.getState(editorView.state)) === null || _limitedModePluginKey2 === void 0 ? void 0 : _limitedModePluginKey2.documentSizeBreachesThreshold) !== null && _limitedModePluginKey !== void 0 ? _limitedModePluginKey : false : shouldEnableLimitedModeForDocument(editorView.state.doc);
118
+ return (_limitedModePluginKey = (_limitedModePluginKey2 = limitedModePluginKey.getState(editorView.state)) === null || _limitedModePluginKey2 === void 0 ? void 0 : _limitedModePluginKey2.documentSizeBreachesThreshold) !== null && _limitedModePluginKey !== void 0 ? _limitedModePluginKey : false;
121
119
  };
122
120
 
123
121
  // Get the NodeIdProvider for a specific EditorView instance.
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags/fg';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "122.11.1";
24
+ var packageVersion = "123.0.1";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -16,36 +16,8 @@ export interface FlattenListOptions {
16
16
  selectionFrom: number;
17
17
  selectionTo: number;
18
18
  }
19
- /**
20
- * Type-specific predicates that vary between regular lists and task lists.
21
- */
22
- interface FlattenListPredicates {
23
- /** Computes the nesting depth for a node given its resolved depth and the root's depth. */
24
- getDepth: (resolvedDepth: number, rootDepth: number) => number;
25
- /** Returns the selection bounds for an item, used to check selection intersection. */
26
- getSelectionBounds: (node: PMNode, pos: number) => {
27
- end: number;
28
- start: number;
29
- };
30
- /** Returns true if `node` is a content-bearing item to include in the flattened output. */
31
- isContentNode: (node: PMNode, parent: PMNode | null) => boolean;
32
- }
33
19
  export interface FlattenListResult {
34
20
  endIndex: number;
35
21
  items: FlattenedItem[];
36
22
  startIndex: number;
37
23
  }
38
- /**
39
- * Flattens a list-like PM structure (regular list or task list) into an
40
- * array of content-bearing items with computed depths.
41
- *
42
- * Uses `doc.nodesBetween` to walk the tree and delegates type-specific
43
- * decisions to the provided predicates. The core algorithm — selection
44
- * intersection, depth adjustment, index tracking — is shared.
45
- *
46
- * @private
47
- * @deprecated Cannot represent content placed between an item's sub-lists
48
- * (e.g. `li(p, ul, p, ul)`). Callers provide their own flatten that handles this.
49
- */
50
- export declare function flattenList(options: FlattenListOptions, predicates: FlattenListPredicates): FlattenListResult | null;
51
- export {};
@@ -1,18 +1,16 @@
1
- export { getListItemAttributes, normalizeListItemsSelection } from './selection';
1
+ export { getListItemAttributes } from './selection';
2
2
  export { moveTargetIntoList } from './replace-content';
3
3
  export { JoinDirection } from './JoinDirection';
4
4
  export { isListNodeValidContent } from './isListNodeValidContent';
5
- export { joinSiblingLists, processNestedTaskListsInSameLevel } from './node';
5
+ export { joinSiblingLists } from './node';
6
6
  export { getCommonListAnalyticsAttributes } from './analytics';
7
7
  export { countListItemsInSelection } from './countListItemsInSelection';
8
- export { hasValidListIndentationLevel } from './indentation';
9
8
  export { restoreSelection, computeSelectionOffsets } from './restore-selection';
10
9
  export { buildReplacementFragment } from './build-replacement-fragment';
11
10
  export type { BuildResult } from './build-replacement-fragment';
12
11
  export { narrowReplacementRange } from './narrow-replacement-range';
13
12
  export type { NarrowedReplacement } from './narrow-replacement-range';
14
13
  export type { FlattenedItem } from './flatten-list';
15
- export { flattenList } from './flatten-list';
16
14
  export type { FlattenListOptions, FlattenListResult } from './flatten-list';
17
15
  export { getBlockMarkAttrs, getFirstParagraphBlockMarkAttrs, reconcileBlockMarkForContainerAtPos, reconcileBlockMarkForParagraphAtPos, reconcileBlockMarkInRange, } from './block-mark';
18
16
  export { isListNode, isListItemNode, isBulletList, isParagraphNode } from '../utils';
@@ -11,6 +11,5 @@ type ListsJoined = {
11
11
  orderedList: number;
12
12
  };
13
13
  export declare const joinSiblingLists: ({ tr, direction, forceListType, }: JoinSiblingListsProps) => ListsJoined;
14
- export declare const processNestedTaskListsInSameLevel: (tr: Transaction) => void;
15
14
  export { isListNodeValidContent } from './isListNodeValidContent';
16
15
  export { JoinDirection } from './JoinDirection';
@@ -5,4 +5,4 @@ type Params = {
5
5
  insertPosition: number;
6
6
  };
7
7
  export declare const moveTargetIntoList: ({ insertPosition, $target }: Params) => Step;
8
- export { wrapTaskListIntoListAbove } from './wrapTaskListIntoListAbove';
8
+ export {};
@@ -1,12 +1,6 @@
1
- import type { Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
- import { Selection } from '@atlaskit/editor-prosemirror/state';
1
+ import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
3
2
  export declare const getListItemAttributes: ($pos: ResolvedPos) => {
4
3
  indentLevel: number;
5
4
  itemIndex: number;
6
5
  };
7
- type NormalizeListItemsSelection = (props: {
8
- doc: PMNode;
9
- selection: Selection;
10
- }) => Selection;
11
- export declare const normalizeListItemsSelection: NormalizeListItemsSelection;
12
6
  export { numberNestedLists } from './numberNestedLists';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "122.12.0",
3
+ "version": "123.0.1",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,7 +32,7 @@
32
32
  "@atlaskit/adf-schema": "^57.5.0",
33
33
  "@atlaskit/adf-utils": "^20.9.0",
34
34
  "@atlaskit/afm-i18n-platform-editor-editor-common": "2.249.0",
35
- "@atlaskit/analytics-listeners": "^11.3.0",
35
+ "@atlaskit/analytics-listeners": "^11.4.0",
36
36
  "@atlaskit/analytics-namespaced-context": "^8.2.0",
37
37
  "@atlaskit/analytics-next": "^12.5.0",
38
38
  "@atlaskit/atlassian-context": "^1.2.0",
@@ -44,7 +44,7 @@
44
44
  "@atlaskit/dropdown-menu": "^18.3.0",
45
45
  "@atlaskit/editor-json-transformer": "^9.8.0",
46
46
  "@atlaskit/editor-palette": "^3.5.0",
47
- "@atlaskit/editor-prosemirror": "^8.0.0",
47
+ "@atlaskit/editor-prosemirror": "^9.0.0",
48
48
  "@atlaskit/editor-shared-styles": "^4.3.0",
49
49
  "@atlaskit/editor-tables": "^3.2.0",
50
50
  "@atlaskit/editor-toolbar": "^2.6.0",
@@ -85,7 +85,7 @@
85
85
  "@atlaskit/teams-app-config": "^3.1.0",
86
86
  "@atlaskit/textfield": "^10.2.0",
87
87
  "@atlaskit/tmp-editor-statsig": "^199.0.0",
88
- "@atlaskit/tokens": "^18.1.0",
88
+ "@atlaskit/tokens": "^18.2.0",
89
89
  "@atlaskit/tooltip": "^24.3.0",
90
90
  "@atlaskit/width-detector": "^7.2.0",
91
91
  "@babel/runtime": "^7.0.0",
@@ -229,9 +229,6 @@
229
229
  "jim-lower-ranking-in-jira-macro-search": {
230
230
  "type": "boolean"
231
231
  },
232
- "tinymce_display_unknown_macro_body_content": {
233
- "type": "boolean"
234
- },
235
232
  "platform_editor_media_border_radius_fix": {
236
233
  "type": "boolean"
237
234
  },
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.hasValidListIndentationLevel = void 0;
7
- var _numberNestedLists = require("./numberNestedLists");
8
- var hasValidListIndentationLevel = exports.hasValidListIndentationLevel = function hasValidListIndentationLevel(_ref) {
9
- var tr = _ref.tr,
10
- maxIndentation = _ref.maxIndentation;
11
- var initialIndentationLevel = (0, _numberNestedLists.numberNestedLists)(tr.selection.$from);
12
- var currentIndentationLevel;
13
- var currentPos = tr.selection.$to.pos;
14
- do {
15
- var resolvedPos = tr.doc.resolve(currentPos);
16
- currentIndentationLevel = (0, _numberNestedLists.numberNestedLists)(resolvedPos);
17
- if (currentIndentationLevel > maxIndentation) {
18
- return false;
19
- }
20
- currentPos++;
21
- } while (currentIndentationLevel >= initialIndentationLevel);
22
- return true;
23
- };
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.wrapTaskListIntoListAbove = void 0;
7
- var _model = require("@atlaskit/editor-prosemirror/model");
8
- var wrapTaskListIntoListAbove = exports.wrapTaskListIntoListAbove = function wrapTaskListIntoListAbove(tr, taskListStart, previousListStart) {
9
- var $taskListStart = tr.doc.resolve(taskListStart);
10
-
11
- /* Safecheck: if not passed a taskList node, return */
12
- if ($taskListStart.node().type.name !== 'taskList') {
13
- return;
14
- }
15
- var $previousListStart = tr.doc.resolve(previousListStart);
16
- var taskList = tr.doc.slice($taskListStart.pos, $taskListStart.after());
17
- var frag = _model.Fragment.from(taskList.content);
18
-
19
- /*
20
- Delete the existing taskList at the same level and insert inside above list provided
21
- 1. To delete the tasklist, we need wrapping positions before and after it to completely delete it.
22
- $taskListStart.after() would give us closing position enclosed by node itself using it would remove only the contents of taskList
23
- so we add 1 to it to get the position after the taskList node and completly remove it.
24
- 2. Inserting the taskList at the end() position safe inserts the taskList to next available position which would lead to deleting and inserting taskList at same place.
25
- Reason: $previousListStart.end() gives us end position of listItem but we can add content only inside listItem not at same level
26
- so we subtract 1 to get the position inside the list item and insert the TaskList same level as paragraph/content inside listItem.
27
- */
28
- tr.delete($taskListStart.before(), $taskListStart.after() + 1);
29
- tr.insert($previousListStart.end() - 1, frag);
30
- };
@@ -1,18 +0,0 @@
1
- import { numberNestedLists } from './numberNestedLists';
2
- export const hasValidListIndentationLevel = ({
3
- tr,
4
- maxIndentation
5
- }) => {
6
- const initialIndentationLevel = numberNestedLists(tr.selection.$from);
7
- let currentIndentationLevel;
8
- let currentPos = tr.selection.$to.pos;
9
- do {
10
- const resolvedPos = tr.doc.resolve(currentPos);
11
- currentIndentationLevel = numberNestedLists(resolvedPos);
12
- if (currentIndentationLevel > maxIndentation) {
13
- return false;
14
- }
15
- currentPos++;
16
- } while (currentIndentationLevel >= initialIndentationLevel);
17
- return true;
18
- };
@@ -1,24 +0,0 @@
1
- import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
- export const wrapTaskListIntoListAbove = (tr, taskListStart, previousListStart) => {
3
- const $taskListStart = tr.doc.resolve(taskListStart);
4
-
5
- /* Safecheck: if not passed a taskList node, return */
6
- if ($taskListStart.node().type.name !== 'taskList') {
7
- return;
8
- }
9
- const $previousListStart = tr.doc.resolve(previousListStart);
10
- const taskList = tr.doc.slice($taskListStart.pos, $taskListStart.after());
11
- const frag = Fragment.from(taskList.content);
12
-
13
- /*
14
- Delete the existing taskList at the same level and insert inside above list provided
15
- 1. To delete the tasklist, we need wrapping positions before and after it to completely delete it.
16
- $taskListStart.after() would give us closing position enclosed by node itself using it would remove only the contents of taskList
17
- so we add 1 to it to get the position after the taskList node and completly remove it.
18
- 2. Inserting the taskList at the end() position safe inserts the taskList to next available position which would lead to deleting and inserting taskList at same place.
19
- Reason: $previousListStart.end() gives us end position of listItem but we can add content only inside listItem not at same level
20
- so we subtract 1 to get the position inside the list item and insert the TaskList same level as paragraph/content inside listItem.
21
- */
22
- tr.delete($taskListStart.before(), $taskListStart.after() + 1);
23
- tr.insert($previousListStart.end() - 1, frag);
24
- };
@@ -1,17 +0,0 @@
1
- import { numberNestedLists } from './numberNestedLists';
2
- export var hasValidListIndentationLevel = function hasValidListIndentationLevel(_ref) {
3
- var tr = _ref.tr,
4
- maxIndentation = _ref.maxIndentation;
5
- var initialIndentationLevel = numberNestedLists(tr.selection.$from);
6
- var currentIndentationLevel;
7
- var currentPos = tr.selection.$to.pos;
8
- do {
9
- var resolvedPos = tr.doc.resolve(currentPos);
10
- currentIndentationLevel = numberNestedLists(resolvedPos);
11
- if (currentIndentationLevel > maxIndentation) {
12
- return false;
13
- }
14
- currentPos++;
15
- } while (currentIndentationLevel >= initialIndentationLevel);
16
- return true;
17
- };