@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.
- package/CHANGELOG.md +30 -0
- package/dist/cjs/extensibility/ExtensionComponent.js +1 -1
- package/dist/cjs/extensions/extension-handlers.js +1 -2
- package/dist/cjs/lists/flatten-list.js +1 -73
- package/dist/cjs/lists/index.js +0 -26
- package/dist/cjs/lists/node.js +1 -78
- package/dist/cjs/lists/replace-content.js +1 -9
- package/dist/cjs/lists/selection.js +2 -29
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/node-anchor/node-anchor-provider.js +1 -3
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/extensibility/ExtensionComponent.js +1 -1
- package/dist/es2019/extensions/extension-handlers.js +1 -2
- package/dist/es2019/lists/flatten-list.js +1 -76
- package/dist/es2019/lists/index.js +2 -4
- package/dist/es2019/lists/node.js +0 -77
- package/dist/es2019/lists/replace-content.js +1 -3
- package/dist/es2019/lists/selection.js +1 -31
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/node-anchor/node-anchor-provider.js +1 -3
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/extensibility/ExtensionComponent.js +1 -1
- package/dist/esm/extensions/extension-handlers.js +1 -2
- package/dist/esm/lists/flatten-list.js +1 -71
- package/dist/esm/lists/index.js +2 -4
- package/dist/esm/lists/node.js +0 -77
- package/dist/esm/lists/replace-content.js +1 -3
- package/dist/esm/lists/selection.js +1 -28
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/node-anchor/node-anchor-provider.js +1 -3
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/lists/flatten-list.d.ts +0 -28
- package/dist/types/lists/index.d.ts +2 -4
- package/dist/types/lists/node.d.ts +0 -1
- package/dist/types/lists/replace-content.d.ts +1 -1
- package/dist/types/lists/selection.d.ts +1 -7
- package/package.json +4 -7
- package/dist/cjs/lists/indentation.js +0 -23
- package/dist/cjs/lists/wrapTaskListIntoListAbove.js +0 -30
- package/dist/es2019/lists/indentation.js +0 -18
- package/dist/es2019/lists/wrapTaskListIntoListAbove.js +0 -24
- package/dist/esm/lists/indentation.js +0 -17
- package/dist/esm/lists/wrapTaskListIntoListAbove.js +0 -24
- package/dist/types/lists/indentation.d.ts +0 -5
- package/dist/types/lists/wrapTaskListIntoListAbove.d.ts +0 -2
- package/lists/indentation/package.json +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 123.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5c5d8787bebca`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5c5d8787bebca) -
|
|
8
|
+
clean up feature gate tinymce_display_unknown_macro_body_content
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 123.0.0
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- [`3b3e57040d2d0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3b3e57040d2d0) -
|
|
16
|
+
Remove retired flexible-list feature controls and schema styles while preserving shipped list
|
|
17
|
+
normalization, hidden-marker rendering for wrapper list items, task paste and task-list tab
|
|
18
|
+
behavior, and toolbar indentation behavior.
|
|
19
|
+
|
|
20
|
+
Remove unused legacy list utilities after the flexible-list rollout: `flattenList`,
|
|
21
|
+
`normalizeListItemsSelection`, `hasValidListIndentationLevel`,
|
|
22
|
+
`processNestedTaskListsInSameLevel`, and `wrapTaskListIntoListAbove`. The
|
|
23
|
+
`@atlaskit/editor-common/lists/indentation` entrypoint is also removed.
|
|
24
|
+
|
|
25
|
+
Consumers of the removed runtime helpers should use the editor list plugin's indent/outdent
|
|
26
|
+
commands. The shared `FlattenedItem`, `FlattenListOptions`, and `FlattenListResult` types remain
|
|
27
|
+
available for the active list implementations.
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies
|
|
32
|
+
|
|
3
33
|
## 122.12.0
|
|
4
34
|
|
|
5
35
|
### Minor Changes
|
|
@@ -296,7 +296,7 @@ var ExtensionComponentInner = /*#__PURE__*/function (_Component) {
|
|
|
296
296
|
references: _this.props.references,
|
|
297
297
|
isSelected: isSelected,
|
|
298
298
|
loadingFallback: loadingFallback,
|
|
299
|
-
showUnknownMacroPlaceholder:
|
|
299
|
+
showUnknownMacroPlaceholder: true
|
|
300
300
|
});
|
|
301
301
|
}
|
|
302
302
|
}
|
|
@@ -20,7 +20,6 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
20
20
|
var _react = _interopRequireDefault(require("react"));
|
|
21
21
|
var _reactIntl = require("react-intl");
|
|
22
22
|
var _reactLoadable = _interopRequireDefault(require("react-loadable"));
|
|
23
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
24
23
|
var _manifestHelpers = require("./manifest-helpers");
|
|
25
24
|
var _messages = require("./messages");
|
|
26
25
|
var _resolveImportSync = require("./resolveImportSync");
|
|
@@ -130,7 +129,7 @@ function ExtensionLoading(props) {
|
|
|
130
129
|
if (props.error || props.timedOut) {
|
|
131
130
|
// eslint-disable-next-line no-console
|
|
132
131
|
console.error('Error rendering extension', props.error);
|
|
133
|
-
if (props.error && props.showUnknownMacroPlaceholder && extensionNode && isUnknownConfluenceMacroWithBody(extensionNode)
|
|
132
|
+
if (props.error && props.showUnknownMacroPlaceholder && extensionNode && isUnknownConfluenceMacroWithBody(extensionNode)) {
|
|
134
133
|
return /*#__PURE__*/_react.default.createElement(_UnknownMacroPlaceholder.UnknownMacroPlaceholder, {
|
|
135
134
|
extensionNode: extensionNode
|
|
136
135
|
});
|
|
@@ -2,76 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.flattenList = flattenList;
|
|
7
|
-
/**
|
|
8
|
-
* Type-specific predicates that vary between regular lists and task lists.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Flattens a list-like PM structure (regular list or task list) into an
|
|
13
|
-
* array of content-bearing items with computed depths.
|
|
14
|
-
*
|
|
15
|
-
* Uses `doc.nodesBetween` to walk the tree and delegates type-specific
|
|
16
|
-
* decisions to the provided predicates. The core algorithm — selection
|
|
17
|
-
* intersection, depth adjustment, index tracking — is shared.
|
|
18
|
-
*
|
|
19
|
-
* @private
|
|
20
|
-
* @deprecated Cannot represent content placed between an item's sub-lists
|
|
21
|
-
* (e.g. `li(p, ul, p, ul)`). Callers provide their own flatten that handles this.
|
|
22
|
-
*/
|
|
23
|
-
function flattenList(options, predicates) {
|
|
24
|
-
var doc = options.doc,
|
|
25
|
-
rootListStart = options.rootListStart,
|
|
26
|
-
rootListEnd = options.rootListEnd,
|
|
27
|
-
selectionFrom = options.selectionFrom,
|
|
28
|
-
selectionTo = options.selectionTo,
|
|
29
|
-
indentDelta = options.indentDelta,
|
|
30
|
-
maxDepth = options.maxDepth;
|
|
31
|
-
var isContentNode = predicates.isContentNode,
|
|
32
|
-
getSelectionBounds = predicates.getSelectionBounds,
|
|
33
|
-
getDepth = predicates.getDepth;
|
|
34
|
-
var items = [];
|
|
35
|
-
var startIndex = -1;
|
|
36
|
-
var endIndex = -1;
|
|
37
|
-
var exceedsMaxDepth = false;
|
|
38
|
-
var rootDepth = doc.resolve(rootListStart).depth;
|
|
39
|
-
doc.nodesBetween(rootListStart, rootListEnd, function (node, pos, parent) {
|
|
40
|
-
if (!isContentNode(node, parent) || parent == null) {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
var _getSelectionBounds = getSelectionBounds(node, pos),
|
|
44
|
-
start = _getSelectionBounds.start,
|
|
45
|
-
end = _getSelectionBounds.end;
|
|
46
|
-
var isSelected = selectionFrom === selectionTo ? selectionFrom >= start && selectionFrom <= end : start < selectionTo && end > selectionFrom;
|
|
47
|
-
var resolvedDepth = doc.resolve(pos).depth;
|
|
48
|
-
var depth = getDepth(resolvedDepth, rootDepth) + (isSelected ? indentDelta : 0);
|
|
49
|
-
items.push({
|
|
50
|
-
node: node,
|
|
51
|
-
pos: pos,
|
|
52
|
-
depth: depth,
|
|
53
|
-
isSelected: isSelected,
|
|
54
|
-
listType: parent.type.name,
|
|
55
|
-
parentListAttrs: parent.attrs
|
|
56
|
-
});
|
|
57
|
-
if (isSelected) {
|
|
58
|
-
var index = items.length - 1;
|
|
59
|
-
if (startIndex === -1) {
|
|
60
|
-
startIndex = index;
|
|
61
|
-
}
|
|
62
|
-
endIndex = index;
|
|
63
|
-
if (maxDepth != null && depth >= maxDepth) {
|
|
64
|
-
exceedsMaxDepth = true;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return true;
|
|
68
|
-
});
|
|
69
|
-
if (items.length === 0 || startIndex === -1 || exceedsMaxDepth) {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
return {
|
|
73
|
-
items: items,
|
|
74
|
-
startIndex: startIndex,
|
|
75
|
-
endIndex: endIndex
|
|
76
|
-
};
|
|
77
|
-
}
|
|
5
|
+
});
|
package/dist/cjs/lists/index.js
CHANGED
|
@@ -27,12 +27,6 @@ Object.defineProperty(exports, "countListItemsInSelection", {
|
|
|
27
27
|
return _countListItemsInSelection.countListItemsInSelection;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
Object.defineProperty(exports, "flattenList", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function get() {
|
|
33
|
-
return _flattenList.flattenList;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
30
|
Object.defineProperty(exports, "getBlockMarkAttrs", {
|
|
37
31
|
enumerable: true,
|
|
38
32
|
get: function get() {
|
|
@@ -57,12 +51,6 @@ Object.defineProperty(exports, "getListItemAttributes", {
|
|
|
57
51
|
return _selection.getListItemAttributes;
|
|
58
52
|
}
|
|
59
53
|
});
|
|
60
|
-
Object.defineProperty(exports, "hasValidListIndentationLevel", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function get() {
|
|
63
|
-
return _indentation.hasValidListIndentationLevel;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
54
|
Object.defineProperty(exports, "isBulletList", {
|
|
67
55
|
enumerable: true,
|
|
68
56
|
get: function get() {
|
|
@@ -117,18 +105,6 @@ Object.defineProperty(exports, "narrowReplacementRange", {
|
|
|
117
105
|
return _narrowReplacementRange.narrowReplacementRange;
|
|
118
106
|
}
|
|
119
107
|
});
|
|
120
|
-
Object.defineProperty(exports, "normalizeListItemsSelection", {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
get: function get() {
|
|
123
|
-
return _selection.normalizeListItemsSelection;
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
Object.defineProperty(exports, "processNestedTaskListsInSameLevel", {
|
|
127
|
-
enumerable: true,
|
|
128
|
-
get: function get() {
|
|
129
|
-
return _node.processNestedTaskListsInSameLevel;
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
108
|
Object.defineProperty(exports, "reconcileBlockMarkForContainerAtPos", {
|
|
133
109
|
enumerable: true,
|
|
134
110
|
get: function get() {
|
|
@@ -160,11 +136,9 @@ var _isListNodeValidContent = require("./isListNodeValidContent");
|
|
|
160
136
|
var _node = require("./node");
|
|
161
137
|
var _analytics = require("./analytics");
|
|
162
138
|
var _countListItemsInSelection = require("./countListItemsInSelection");
|
|
163
|
-
var _indentation = require("./indentation");
|
|
164
139
|
var _restoreSelection = require("./restore-selection");
|
|
165
140
|
var _buildReplacementFragment = require("./build-replacement-fragment");
|
|
166
141
|
var _narrowReplacementRange = require("./narrow-replacement-range");
|
|
167
|
-
var _flattenList = require("./flatten-list");
|
|
168
142
|
var _blockMark = require("./block-mark");
|
|
169
143
|
var _utils = require("../utils");
|
|
170
144
|
var _messages = require("./messages");
|
package/dist/cjs/lists/node.js
CHANGED
|
@@ -15,11 +15,10 @@ Object.defineProperty(exports, "isListNodeValidContent", {
|
|
|
15
15
|
return _isListNodeValidContent.isListNodeValidContent;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
exports.
|
|
18
|
+
exports.joinSiblingLists = void 0;
|
|
19
19
|
var _utils = require("../utils");
|
|
20
20
|
var _isListNodeValidContent = require("./isListNodeValidContent");
|
|
21
21
|
var _JoinDirection = require("./JoinDirection");
|
|
22
|
-
var _wrapTaskListIntoListAbove = require("./wrapTaskListIntoListAbove");
|
|
23
22
|
var joinSiblingLists = exports.joinSiblingLists = function joinSiblingLists(_ref) {
|
|
24
23
|
var tr = _ref.tr,
|
|
25
24
|
direction = _ref.direction,
|
|
@@ -93,82 +92,6 @@ var joinSiblingLists = exports.joinSiblingLists = function joinSiblingLists(_ref
|
|
|
93
92
|
return result;
|
|
94
93
|
};
|
|
95
94
|
|
|
96
|
-
/**
|
|
97
|
-
* Returns the prosemirror position for the child at give index inside the parent node.
|
|
98
|
-
* Example: Considering doc structure as below using the function
|
|
99
|
-
* passing parent resolved position for li and index 2
|
|
100
|
-
* would return starting position of taskList
|
|
101
|
-
* DOC STRUCTURE:
|
|
102
|
-
* ol()
|
|
103
|
-
* ( li(
|
|
104
|
-
* p('text'),
|
|
105
|
-
* ul(content),
|
|
106
|
-
* taskList(),
|
|
107
|
-
* )
|
|
108
|
-
* )
|
|
109
|
-
* @param $from Starting resolved position for the parent node of the child we are looking for.
|
|
110
|
-
* @param index Index of the child node we want the position for.
|
|
111
|
-
* @returns
|
|
112
|
-
*/
|
|
113
|
-
var findStartPositionOfChildWithIndex = function findStartPositionOfChildWithIndex($from, index) {
|
|
114
|
-
var parent = $from.node();
|
|
115
|
-
var currentPos = $from.pos + 1;
|
|
116
|
-
for (var i = 0; i < index; i++) {
|
|
117
|
-
currentPos += parent.child(i).nodeSize;
|
|
118
|
-
}
|
|
119
|
-
return currentPos;
|
|
120
|
-
};
|
|
121
|
-
var findGrandParentResolvedPos = function findGrandParentResolvedPos(tr, $from) {
|
|
122
|
-
return $from.depth > 2 ? tr.doc.resolve($from.start($from.depth - 2)) : null;
|
|
123
|
-
};
|
|
124
|
-
var findNestedTaskListsIndexAtSameLevel = function findNestedTaskListsIndexAtSameLevel(tr, $from) {
|
|
125
|
-
/*
|
|
126
|
-
Currently our cursor would be inside a pargraph of a list of type numbered/bullet list,
|
|
127
|
-
we need to find the grandparent of the cursor which is the list at same level of taskList.
|
|
128
|
-
We can get the root list item(inside which various lists are being resolved before outdenting) by going one depth above that list.
|
|
129
|
-
*/
|
|
130
|
-
var nestedListResolvedPos = findGrandParentResolvedPos(tr, $from);
|
|
131
|
-
var rootListItem = nestedListResolvedPos === null || nestedListResolvedPos === void 0 ? void 0 : nestedListResolvedPos.node(nestedListResolvedPos.depth - 1);
|
|
132
|
-
var nestedTaskListsIndexes = [];
|
|
133
|
-
var rootListItemChildCount = (rootListItem === null || rootListItem === void 0 ? void 0 : rootListItem.childCount) || 0;
|
|
134
|
-
// first child of list item is always paragraph (i = 0) so we start from 1
|
|
135
|
-
for (var i = 1; i < rootListItemChildCount; i++) {
|
|
136
|
-
if ((rootListItem === null || rootListItem === void 0 ? void 0 : rootListItem.child(i).type.name) === 'taskList') {
|
|
137
|
-
nestedTaskListsIndexes.push(i);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return nestedTaskListsIndexes;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
144
|
-
var processNestedTaskListsInSameLevel = exports.processNestedTaskListsInSameLevel = function processNestedTaskListsInSameLevel(tr) {
|
|
145
|
-
var $from = tr.selection.$from;
|
|
146
|
-
var nestedTaskListIndexes = findNestedTaskListsIndexAtSameLevel(tr, $from);
|
|
147
|
-
if (nestedTaskListIndexes.length === 0) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
var nestedListResolvedPos = findGrandParentResolvedPos(tr, $from);
|
|
151
|
-
var rootListItemStart = nestedListResolvedPos === null || nestedListResolvedPos === void 0 ? void 0 : nestedListResolvedPos.start(nestedListResolvedPos.depth - 1);
|
|
152
|
-
|
|
153
|
-
/* We need not wrap the taskList present above other lists since it doesn't affect the flow. */
|
|
154
|
-
var nestedTaskListIndexesToWrap = nestedTaskListIndexes.filter(function (index) {
|
|
155
|
-
return index > 1;
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
/*
|
|
159
|
-
Wraps the taskLists present at each index mentioned in the nestedTaskListIndexesToWrap to the list above it.
|
|
160
|
-
After each wrap the indexes changes since two lists are being merged into one,
|
|
161
|
-
so we keep track of it and use it to access actual calculated taskList indexes.
|
|
162
|
-
*/
|
|
163
|
-
if (rootListItemStart) {
|
|
164
|
-
var taskListsFixedNested = 0;
|
|
165
|
-
nestedTaskListIndexesToWrap.forEach(function (index) {
|
|
166
|
-
(0, _wrapTaskListIntoListAbove.wrapTaskListIntoListAbove)(tr, findStartPositionOfChildWithIndex(tr.doc.resolve(rootListItemStart), index - taskListsFixedNested), findStartPositionOfChildWithIndex(tr.doc.resolve(rootListItemStart), index - 1 - taskListsFixedNested));
|
|
167
|
-
taskListsFixedNested++;
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
return;
|
|
171
|
-
};
|
|
172
95
|
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
173
96
|
|
|
174
97
|
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
@@ -4,14 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.moveTargetIntoList = void 0;
|
|
7
|
-
Object.defineProperty(exports, "wrapTaskListIntoListAbove", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function get() {
|
|
10
|
-
return _wrapTaskListIntoListAbove.wrapTaskListIntoListAbove;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
7
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
14
|
-
var _wrapTaskListIntoListAbove = require("./wrapTaskListIntoListAbove");
|
|
15
8
|
var moveTargetIntoList = exports.moveTargetIntoList = function moveTargetIntoList(_ref) {
|
|
16
9
|
var _$target$nodeAfter;
|
|
17
10
|
var insertPosition = _ref.insertPosition,
|
|
@@ -27,5 +20,4 @@ var moveTargetIntoList = exports.moveTargetIntoList = function moveTargetIntoLis
|
|
|
27
20
|
}
|
|
28
21
|
var step = new _transform.ReplaceAroundStep(from, to, gapFrom, gapTo, $target.doc.slice(insertPosition, $target.pos), 0, true);
|
|
29
22
|
return step;
|
|
30
|
-
};
|
|
31
|
-
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
23
|
+
};
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getListItemAttributes = void 0;
|
|
7
7
|
Object.defineProperty(exports, "numberNestedLists", {
|
|
8
8
|
enumerable: true,
|
|
9
9
|
get: function get() {
|
|
10
10
|
return _numberNestedLists.numberNestedLists;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
13
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
15
14
|
var _utils2 = require("../utils");
|
|
16
15
|
var _numberNestedLists = require("./numberNestedLists");
|
|
@@ -26,31 +25,5 @@ var getListItemAttributes = exports.getListItemAttributes = function getListItem
|
|
|
26
25
|
itemIndex: itemIndex
|
|
27
26
|
};
|
|
28
27
|
};
|
|
29
|
-
|
|
30
|
-
var normalizeListItemsSelection = exports.normalizeListItemsSelection = function normalizeListItemsSelection(_ref) {
|
|
31
|
-
var selection = _ref.selection,
|
|
32
|
-
doc = _ref.doc;
|
|
33
|
-
if (selection.empty) {
|
|
34
|
-
return selection;
|
|
35
|
-
}
|
|
36
|
-
var $from = selection.$from,
|
|
37
|
-
$to = selection.$to;
|
|
38
|
-
if (selection instanceof _state.NodeSelection) {
|
|
39
|
-
var _head = resolvePositionToStartOfListItem($from);
|
|
40
|
-
return new _state.TextSelection(_head, _head);
|
|
41
|
-
}
|
|
42
|
-
var head = resolvePositionToStartOfListItem($from);
|
|
43
|
-
var anchor = resolvePositionToEndOfListItem($to);
|
|
44
|
-
return new _state.TextSelection(anchor, head);
|
|
45
|
-
};
|
|
46
|
-
var resolvePositionToStartOfListItem = function resolvePositionToStartOfListItem($pos) {
|
|
47
|
-
var fromRange = $pos.blockRange($pos, _utils2.isListItemNode);
|
|
48
|
-
var fromPosition = fromRange && $pos.textOffset === 0 && fromRange.end - 1 === $pos.pos ? _state.Selection.near($pos.doc.resolve(fromRange.end + 1), 1).$from : $pos;
|
|
49
|
-
return fromPosition;
|
|
50
|
-
};
|
|
51
|
-
var resolvePositionToEndOfListItem = function resolvePositionToEndOfListItem($pos) {
|
|
52
|
-
var toRange = $pos.blockRange($pos, _utils2.isListItemNode);
|
|
53
|
-
var toPosition = toRange && $pos.textOffset === 0 && toRange.start + 1 === $pos.pos ? _state.Selection.near($pos.doc.resolve(toRange.start - 1), -1).$to : $pos;
|
|
54
|
-
return toPosition;
|
|
55
|
-
};
|
|
28
|
+
|
|
56
29
|
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
@@ -27,7 +27,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
27
27
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
28
28
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
29
29
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
30
|
-
var packageVersion = "
|
|
30
|
+
var packageVersion = "123.0.1";
|
|
31
31
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
32
32
|
// Remove URL as it has UGC
|
|
33
33
|
// Ignored via go/ees007
|
|
@@ -8,10 +8,8 @@ exports.getNodeIdProvider = exports.NodeAnchorProvider = void 0;
|
|
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
12
11
|
var _utils = require("../utils");
|
|
13
12
|
var _dynamicBitArray = require("./dynamic-bit-array");
|
|
14
|
-
var _shouldEnableLimitedMode = require("./should-enable-limited-mode");
|
|
15
13
|
// The slice of `@atlaskit/editor-plugin-limited-mode`'s state read below. Declared
|
|
16
14
|
// structurally because `editor-common` must not depend on a plugin package.
|
|
17
15
|
|
|
@@ -123,7 +121,7 @@ var nodeIdProviderMap = new WeakMap();
|
|
|
123
121
|
*/
|
|
124
122
|
var isLimitedModeEnabled = function isLimitedModeEnabled(editorView) {
|
|
125
123
|
var _limitedModePluginKey, _limitedModePluginKey2;
|
|
126
|
-
return (
|
|
124
|
+
return (_limitedModePluginKey = (_limitedModePluginKey2 = limitedModePluginKey.getState(editorView.state)) === null || _limitedModePluginKey2 === void 0 ? void 0 : _limitedModePluginKey2.documentSizeBreachesThreshold) !== null && _limitedModePluginKey !== void 0 ? _limitedModePluginKey : false;
|
|
127
125
|
};
|
|
128
126
|
|
|
129
127
|
// Get the NodeIdProvider for a specific EditorView instance.
|
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
24
24
|
* @jsx jsx
|
|
25
25
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "
|
|
27
|
+
var packageVersion = "123.0.1";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -237,7 +237,7 @@ class ExtensionComponentInner extends Component {
|
|
|
237
237
|
references: this.props.references,
|
|
238
238
|
isSelected: isSelected,
|
|
239
239
|
loadingFallback: loadingFallback,
|
|
240
|
-
showUnknownMacroPlaceholder:
|
|
240
|
+
showUnknownMacroPlaceholder: true
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
243
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import Loadable from 'react-loadable';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
4
|
import { getExtensionKeyAndNodeKey, resolveImport } from './manifest-helpers';
|
|
6
5
|
import { messages } from './messages';
|
|
7
6
|
import { resolveImportSync } from './resolveImportSync';
|
|
@@ -69,7 +68,7 @@ function ExtensionLoading(props) {
|
|
|
69
68
|
if (props.error || props.timedOut) {
|
|
70
69
|
// eslint-disable-next-line no-console
|
|
71
70
|
console.error('Error rendering extension', props.error);
|
|
72
|
-
if (props.error && props.showUnknownMacroPlaceholder && extensionNode && isUnknownConfluenceMacroWithBody(extensionNode)
|
|
71
|
+
if (props.error && props.showUnknownMacroPlaceholder && extensionNode && isUnknownConfluenceMacroWithBody(extensionNode)) {
|
|
73
72
|
return /*#__PURE__*/React.createElement(UnknownMacroPlaceholder, {
|
|
74
73
|
extensionNode: extensionNode
|
|
75
74
|
});
|
|
@@ -1,76 +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
|
-
const {
|
|
19
|
-
doc,
|
|
20
|
-
rootListStart,
|
|
21
|
-
rootListEnd,
|
|
22
|
-
selectionFrom,
|
|
23
|
-
selectionTo,
|
|
24
|
-
indentDelta,
|
|
25
|
-
maxDepth
|
|
26
|
-
} = options;
|
|
27
|
-
const {
|
|
28
|
-
isContentNode,
|
|
29
|
-
getSelectionBounds,
|
|
30
|
-
getDepth
|
|
31
|
-
} = predicates;
|
|
32
|
-
const items = [];
|
|
33
|
-
let startIndex = -1;
|
|
34
|
-
let endIndex = -1;
|
|
35
|
-
let exceedsMaxDepth = false;
|
|
36
|
-
const rootDepth = doc.resolve(rootListStart).depth;
|
|
37
|
-
doc.nodesBetween(rootListStart, rootListEnd, (node, pos, parent) => {
|
|
38
|
-
if (!isContentNode(node, parent) || parent == null) {
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
const {
|
|
42
|
-
start,
|
|
43
|
-
end
|
|
44
|
-
} = getSelectionBounds(node, pos);
|
|
45
|
-
const isSelected = selectionFrom === selectionTo ? selectionFrom >= start && selectionFrom <= end : start < selectionTo && end > selectionFrom;
|
|
46
|
-
const resolvedDepth = doc.resolve(pos).depth;
|
|
47
|
-
const depth = getDepth(resolvedDepth, rootDepth) + (isSelected ? indentDelta : 0);
|
|
48
|
-
items.push({
|
|
49
|
-
node,
|
|
50
|
-
pos,
|
|
51
|
-
depth,
|
|
52
|
-
isSelected,
|
|
53
|
-
listType: parent.type.name,
|
|
54
|
-
parentListAttrs: parent.attrs
|
|
55
|
-
});
|
|
56
|
-
if (isSelected) {
|
|
57
|
-
const index = items.length - 1;
|
|
58
|
-
if (startIndex === -1) {
|
|
59
|
-
startIndex = index;
|
|
60
|
-
}
|
|
61
|
-
endIndex = index;
|
|
62
|
-
if (maxDepth != null && depth >= maxDepth) {
|
|
63
|
-
exceedsMaxDepth = true;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return true;
|
|
67
|
-
});
|
|
68
|
-
if (items.length === 0 || startIndex === -1 || exceedsMaxDepth) {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
items,
|
|
73
|
-
startIndex,
|
|
74
|
-
endIndex
|
|
75
|
-
};
|
|
76
|
-
}
|
|
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
|
|
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
|
|
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 const joinSiblingLists = ({
|
|
6
5
|
tr,
|
|
7
6
|
direction,
|
|
@@ -83,82 +82,6 @@ export const joinSiblingLists = ({
|
|
|
83
82
|
return result;
|
|
84
83
|
};
|
|
85
84
|
|
|
86
|
-
/**
|
|
87
|
-
* Returns the prosemirror position for the child at give index inside the parent node.
|
|
88
|
-
* Example: Considering doc structure as below using the function
|
|
89
|
-
* passing parent resolved position for li and index 2
|
|
90
|
-
* would return starting position of taskList
|
|
91
|
-
* DOC STRUCTURE:
|
|
92
|
-
* ol()
|
|
93
|
-
* ( li(
|
|
94
|
-
* p('text'),
|
|
95
|
-
* ul(content),
|
|
96
|
-
* taskList(),
|
|
97
|
-
* )
|
|
98
|
-
* )
|
|
99
|
-
* @param $from Starting resolved position for the parent node of the child we are looking for.
|
|
100
|
-
* @param index Index of the child node we want the position for.
|
|
101
|
-
* @returns
|
|
102
|
-
*/
|
|
103
|
-
const findStartPositionOfChildWithIndex = ($from, index) => {
|
|
104
|
-
const parent = $from.node();
|
|
105
|
-
let currentPos = $from.pos + 1;
|
|
106
|
-
for (let i = 0; i < index; i++) {
|
|
107
|
-
currentPos += parent.child(i).nodeSize;
|
|
108
|
-
}
|
|
109
|
-
return currentPos;
|
|
110
|
-
};
|
|
111
|
-
const findGrandParentResolvedPos = (tr, $from) => {
|
|
112
|
-
return $from.depth > 2 ? tr.doc.resolve($from.start($from.depth - 2)) : null;
|
|
113
|
-
};
|
|
114
|
-
const findNestedTaskListsIndexAtSameLevel = (tr, $from) => {
|
|
115
|
-
/*
|
|
116
|
-
Currently our cursor would be inside a pargraph of a list of type numbered/bullet list,
|
|
117
|
-
we need to find the grandparent of the cursor which is the list at same level of taskList.
|
|
118
|
-
We can get the root list item(inside which various lists are being resolved before outdenting) by going one depth above that list.
|
|
119
|
-
*/
|
|
120
|
-
const nestedListResolvedPos = findGrandParentResolvedPos(tr, $from);
|
|
121
|
-
const rootListItem = nestedListResolvedPos === null || nestedListResolvedPos === void 0 ? void 0 : nestedListResolvedPos.node(nestedListResolvedPos.depth - 1);
|
|
122
|
-
const nestedTaskListsIndexes = [];
|
|
123
|
-
const rootListItemChildCount = (rootListItem === null || rootListItem === void 0 ? void 0 : rootListItem.childCount) || 0;
|
|
124
|
-
// first child of list item is always paragraph (i = 0) so we start from 1
|
|
125
|
-
for (let i = 1; i < rootListItemChildCount; i++) {
|
|
126
|
-
if ((rootListItem === null || rootListItem === void 0 ? void 0 : rootListItem.child(i).type.name) === 'taskList') {
|
|
127
|
-
nestedTaskListsIndexes.push(i);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return nestedTaskListsIndexes;
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
134
|
-
export const processNestedTaskListsInSameLevel = tr => {
|
|
135
|
-
const {
|
|
136
|
-
$from
|
|
137
|
-
} = tr.selection;
|
|
138
|
-
const nestedTaskListIndexes = findNestedTaskListsIndexAtSameLevel(tr, $from);
|
|
139
|
-
if (nestedTaskListIndexes.length === 0) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
const nestedListResolvedPos = findGrandParentResolvedPos(tr, $from);
|
|
143
|
-
const rootListItemStart = nestedListResolvedPos === null || nestedListResolvedPos === void 0 ? void 0 : nestedListResolvedPos.start(nestedListResolvedPos.depth - 1);
|
|
144
|
-
|
|
145
|
-
/* We need not wrap the taskList present above other lists since it doesn't affect the flow. */
|
|
146
|
-
const nestedTaskListIndexesToWrap = nestedTaskListIndexes.filter(index => index > 1);
|
|
147
|
-
|
|
148
|
-
/*
|
|
149
|
-
Wraps the taskLists present at each index mentioned in the nestedTaskListIndexesToWrap to the list above it.
|
|
150
|
-
After each wrap the indexes changes since two lists are being merged into one,
|
|
151
|
-
so we keep track of it and use it to access actual calculated taskList indexes.
|
|
152
|
-
*/
|
|
153
|
-
if (rootListItemStart) {
|
|
154
|
-
let taskListsFixedNested = 0;
|
|
155
|
-
nestedTaskListIndexesToWrap.forEach(index => {
|
|
156
|
-
wrapTaskListIntoListAbove(tr, findStartPositionOfChildWithIndex(tr.doc.resolve(rootListItemStart), index - taskListsFixedNested), findStartPositionOfChildWithIndex(tr.doc.resolve(rootListItemStart), index - 1 - taskListsFixedNested));
|
|
157
|
-
taskListsFixedNested++;
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
return;
|
|
161
|
-
};
|
|
162
85
|
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
163
86
|
export { isListNodeValidContent } from './isListNodeValidContent';
|
|
164
87
|
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
@@ -15,6 +15,4 @@ export const moveTargetIntoList = ({
|
|
|
15
15
|
}
|
|
16
16
|
const step = new ReplaceAroundStep(from, to, gapFrom, gapTo, $target.doc.slice(insertPosition, $target.pos), 0, true);
|
|
17
17
|
return step;
|
|
18
|
-
};
|
|
19
|
-
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
20
|
-
export { wrapTaskListIntoListAbove } from './wrapTaskListIntoListAbove';
|
|
18
|
+
};
|