@atlaskit/editor-common 112.12.0 → 112.13.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.
- package/CHANGELOG.md +19 -0
- package/dist/cjs/block-menu/scroll-to-block-utils.js +19 -22
- package/dist/cjs/lists/block-mark.js +73 -0
- package/dist/cjs/lists/index.js +31 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/block-menu/scroll-to-block-utils.js +17 -20
- package/dist/es2019/lists/block-mark.js +67 -0
- package/dist/es2019/lists/index.js +1 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/block-menu/scroll-to-block-utils.js +19 -19
- package/dist/esm/lists/block-mark.js +67 -0
- package/dist/esm/lists/index.js +1 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/block-menu/scroll-to-block-utils.d.ts +1 -1
- package/dist/types/lists/block-mark.d.ts +9 -0
- package/dist/types/lists/index.d.ts +1 -0
- package/dist/types-ts4.5/block-menu/scroll-to-block-utils.d.ts +1 -1
- package/dist/types-ts4.5/lists/block-mark.d.ts +9 -0
- package/dist/types-ts4.5/lists/index.d.ts +1 -0
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 112.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`b749ce678d575`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b749ce678d575) -
|
|
8
|
+
Preserve small text formatting across list and task list edits
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 112.12.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`13ec7df78a017`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/13ec7df78a017) -
|
|
19
|
+
Editor-5664: Fix scroll position for block links
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 112.12.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
|
@@ -8,14 +8,13 @@ exports.expandElement = exports.expandAllParentsThenScroll = exports.SCROLL_TO_B
|
|
|
8
8
|
exports.findNodeWithExpandParents = findNodeWithExpandParents;
|
|
9
9
|
exports.isExpandCollapsed = exports.getLocalIdSelector = exports.findParentExpands = void 0;
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
12
13
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
-
/**
|
|
14
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } /**
|
|
15
15
|
* Shared utilities for scrolling to block elements with expand node support.
|
|
16
16
|
* Used by both Confluence's useScrollOnUrlChange and platform renderer's useScrollToBlock.
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
18
|
/**
|
|
20
19
|
* Timing constants for expand animation and DOM update delays.
|
|
21
20
|
* These values are tuned for the expand component's behavior and React's update cycle.
|
|
@@ -195,10 +194,17 @@ var expandElement = exports.expandElement = function expandElement(expandContain
|
|
|
195
194
|
*/
|
|
196
195
|
var _expandAllParentsThenScroll = exports.expandAllParentsThenScroll = function expandAllParentsThenScroll(element) {
|
|
197
196
|
var attempt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
197
|
+
var scrollFn = arguments.length > 2 ? arguments[2] : undefined;
|
|
198
198
|
var MAX_EXPAND_DEPTH = SCROLL_TO_BLOCK_TIMING.MAX_EXPAND_DEPTH,
|
|
199
199
|
MAX_ATTEMPTS = SCROLL_TO_BLOCK_TIMING.MAX_ATTEMPTS,
|
|
200
200
|
DOM_UPDATE_DELAY = SCROLL_TO_BLOCK_TIMING.DOM_UPDATE_DELAY,
|
|
201
201
|
RETRY_DELAY = SCROLL_TO_BLOCK_TIMING.RETRY_DELAY;
|
|
202
|
+
var doScroll = scrollFn !== null && scrollFn !== void 0 ? scrollFn : function (el) {
|
|
203
|
+
return el.scrollIntoView({
|
|
204
|
+
behavior: 'smooth',
|
|
205
|
+
block: 'center'
|
|
206
|
+
});
|
|
207
|
+
};
|
|
202
208
|
|
|
203
209
|
// Store timeout ID and nested cleanup function so they can be cancelled.
|
|
204
210
|
var timeoutId = null;
|
|
@@ -220,10 +226,7 @@ var _expandAllParentsThenScroll = exports.expandAllParentsThenScroll = function
|
|
|
220
226
|
if (attempt >= MAX_ATTEMPTS || !element.isConnected) {
|
|
221
227
|
// Max attempts reached or element disconnected, scroll anyway.
|
|
222
228
|
if (element.isConnected) {
|
|
223
|
-
element
|
|
224
|
-
behavior: 'smooth',
|
|
225
|
-
block: 'center'
|
|
226
|
-
});
|
|
229
|
+
doScroll(element);
|
|
227
230
|
}
|
|
228
231
|
return cleanup;
|
|
229
232
|
}
|
|
@@ -237,10 +240,7 @@ var _expandAllParentsThenScroll = exports.expandAllParentsThenScroll = function
|
|
|
237
240
|
});
|
|
238
241
|
if (collapsedExpands.length === 0) {
|
|
239
242
|
// All expands are open (or there are no expands), scroll to element.
|
|
240
|
-
element
|
|
241
|
-
behavior: 'smooth',
|
|
242
|
-
block: 'center'
|
|
243
|
-
});
|
|
243
|
+
doScroll(element);
|
|
244
244
|
return cleanup;
|
|
245
245
|
}
|
|
246
246
|
|
|
@@ -260,14 +260,11 @@ var _expandAllParentsThenScroll = exports.expandAllParentsThenScroll = function
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
// Recurse to handle any nested collapsed expands or retry if still collapsed.
|
|
263
|
-
nestedCleanup = _expandAllParentsThenScroll(element, attempt + 1);
|
|
263
|
+
nestedCleanup = _expandAllParentsThenScroll(element, attempt + 1, scrollFn);
|
|
264
264
|
} catch (_unused) {
|
|
265
265
|
// Fallback to simple scroll on error.
|
|
266
266
|
if (element.isConnected) {
|
|
267
|
-
element
|
|
268
|
-
behavior: 'smooth',
|
|
269
|
-
block: 'center'
|
|
270
|
-
});
|
|
267
|
+
doScroll(element);
|
|
271
268
|
}
|
|
272
269
|
}
|
|
273
270
|
}, DOM_UPDATE_DELAY);
|
|
@@ -275,7 +272,7 @@ var _expandAllParentsThenScroll = exports.expandAllParentsThenScroll = function
|
|
|
275
272
|
// Failed to expand, retry with longer delay.
|
|
276
273
|
timeoutId = setTimeout(function () {
|
|
277
274
|
if (element.isConnected) {
|
|
278
|
-
nestedCleanup = _expandAllParentsThenScroll(element, attempt + 1);
|
|
275
|
+
nestedCleanup = _expandAllParentsThenScroll(element, attempt + 1, scrollFn);
|
|
279
276
|
}
|
|
280
277
|
}, RETRY_DELAY);
|
|
281
278
|
}
|
|
@@ -283,17 +280,14 @@ var _expandAllParentsThenScroll = exports.expandAllParentsThenScroll = function
|
|
|
283
280
|
// Retry on error.
|
|
284
281
|
timeoutId = setTimeout(function () {
|
|
285
282
|
if (element.isConnected) {
|
|
286
|
-
nestedCleanup = _expandAllParentsThenScroll(element, attempt + 1);
|
|
283
|
+
nestedCleanup = _expandAllParentsThenScroll(element, attempt + 1, scrollFn);
|
|
287
284
|
}
|
|
288
285
|
}, RETRY_DELAY);
|
|
289
286
|
}
|
|
290
287
|
} catch (_unused3) {
|
|
291
288
|
// Fallback to simple scroll on error.
|
|
292
289
|
if (element.isConnected) {
|
|
293
|
-
element
|
|
294
|
-
behavior: 'smooth',
|
|
295
|
-
block: 'center'
|
|
296
|
-
});
|
|
290
|
+
doScroll(element);
|
|
297
291
|
}
|
|
298
292
|
}
|
|
299
293
|
return cleanup;
|
|
@@ -318,6 +312,9 @@ var getLocalIdSelector = exports.getLocalIdSelector = function getLocalIdSelecto
|
|
|
318
312
|
// Special case for tables which use data-table-local-id
|
|
319
313
|
element = container.querySelector("[data-table-local-id=\"".concat(localId, "\"]"));
|
|
320
314
|
if (element) {
|
|
315
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_block_menu_v2_patch_4')) {
|
|
316
|
+
return element.parentElement; // return table wrapper instead of table div, so the height calculation is correct
|
|
317
|
+
}
|
|
321
318
|
return element;
|
|
322
319
|
}
|
|
323
320
|
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.reconcileBlockMarkInRange = exports.reconcileBlockMarkForParagraphAtPos = exports.reconcileBlockMarkForContainerAtPos = exports.getFirstParagraphBlockMarkAttrs = exports.getBlockMarkAttrs = void 0;
|
|
7
|
+
var _commands = require("../commands");
|
|
8
|
+
var getDefaultBlockNodeTypes = function getDefaultBlockNodeTypes(tr) {
|
|
9
|
+
var paragraph = tr.doc.type.schema.nodes.paragraph;
|
|
10
|
+
return paragraph ? [paragraph] : [];
|
|
11
|
+
};
|
|
12
|
+
var getBlockMarkAttrs = exports.getBlockMarkAttrs = function getBlockMarkAttrs(node, markType) {
|
|
13
|
+
if (!node || !markType) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
var blockMark = node.marks.find(function (mark) {
|
|
17
|
+
return mark.type === markType;
|
|
18
|
+
});
|
|
19
|
+
return blockMark ? blockMark.attrs : false;
|
|
20
|
+
};
|
|
21
|
+
var getFirstParagraphBlockMarkAttrs = exports.getFirstParagraphBlockMarkAttrs = function getFirstParagraphBlockMarkAttrs(node, markType) {
|
|
22
|
+
if (!node || !markType) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
var paragraph = node.type.schema.nodes.paragraph;
|
|
26
|
+
if (!paragraph) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
var _findFirstParagraphBlockMarkAttrs = function findFirstParagraphBlockMarkAttrs(currentNode) {
|
|
30
|
+
if (currentNode.type === paragraph) {
|
|
31
|
+
return getBlockMarkAttrs(currentNode, markType);
|
|
32
|
+
}
|
|
33
|
+
for (var index = 0; index < currentNode.childCount; index++) {
|
|
34
|
+
var childResult = _findFirstParagraphBlockMarkAttrs(currentNode.child(index));
|
|
35
|
+
if (childResult !== false) {
|
|
36
|
+
return childResult;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
};
|
|
41
|
+
return _findFirstParagraphBlockMarkAttrs(node);
|
|
42
|
+
};
|
|
43
|
+
var reconcileBlockMarkInRange = exports.reconcileBlockMarkInRange = function reconcileBlockMarkInRange(tr, from, to, markType, markAttrs) {
|
|
44
|
+
var blockNodeTypes = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : getDefaultBlockNodeTypes(tr);
|
|
45
|
+
if (!markType || blockNodeTypes.length === 0) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
return (0, _commands.createToggleBlockMarkOnRangeNext)(markType, function () {
|
|
49
|
+
return markAttrs;
|
|
50
|
+
}, blockNodeTypes)(from, to, tr);
|
|
51
|
+
};
|
|
52
|
+
var reconcileBlockMarkForContainerAtPos = exports.reconcileBlockMarkForContainerAtPos = function reconcileBlockMarkForContainerAtPos(tr, containerPos, markType, markAttrs) {
|
|
53
|
+
var blockNodeTypes = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : getDefaultBlockNodeTypes(tr);
|
|
54
|
+
var containerNode = tr.doc.nodeAt(containerPos);
|
|
55
|
+
if (!containerNode) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
return reconcileBlockMarkInRange(tr, containerPos, containerPos + containerNode.nodeSize, markType, markAttrs, blockNodeTypes);
|
|
59
|
+
};
|
|
60
|
+
var reconcileBlockMarkForParagraphAtPos = exports.reconcileBlockMarkForParagraphAtPos = function reconcileBlockMarkForParagraphAtPos(tr, pos, markType, markAttrs) {
|
|
61
|
+
var paragraph = tr.doc.type.schema.nodes.paragraph;
|
|
62
|
+
if (!paragraph) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
var resolvedPos = tr.doc.resolve(Math.max(0, Math.min(pos, tr.doc.content.size)));
|
|
66
|
+
for (var depth = resolvedPos.depth; depth > 0; depth--) {
|
|
67
|
+
var node = resolvedPos.node(depth);
|
|
68
|
+
if (node.type === paragraph) {
|
|
69
|
+
return reconcileBlockMarkInRange(tr, resolvedPos.before(depth), resolvedPos.before(depth) + node.nodeSize, markType, markAttrs, [paragraph]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return false;
|
|
73
|
+
};
|
package/dist/cjs/lists/index.js
CHANGED
|
@@ -33,12 +33,24 @@ Object.defineProperty(exports, "flattenList", {
|
|
|
33
33
|
return _flattenList.flattenList;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "getBlockMarkAttrs", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _blockMark.getBlockMarkAttrs;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
36
42
|
Object.defineProperty(exports, "getCommonListAnalyticsAttributes", {
|
|
37
43
|
enumerable: true,
|
|
38
44
|
get: function get() {
|
|
39
45
|
return _analytics.getCommonListAnalyticsAttributes;
|
|
40
46
|
}
|
|
41
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "getFirstParagraphBlockMarkAttrs", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _blockMark.getFirstParagraphBlockMarkAttrs;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
42
54
|
Object.defineProperty(exports, "getListItemAttributes", {
|
|
43
55
|
enumerable: true,
|
|
44
56
|
get: function get() {
|
|
@@ -117,6 +129,24 @@ Object.defineProperty(exports, "processNestedTaskListsInSameLevel", {
|
|
|
117
129
|
return _node.processNestedTaskListsInSameLevel;
|
|
118
130
|
}
|
|
119
131
|
});
|
|
132
|
+
Object.defineProperty(exports, "reconcileBlockMarkForContainerAtPos", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function get() {
|
|
135
|
+
return _blockMark.reconcileBlockMarkForContainerAtPos;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, "reconcileBlockMarkForParagraphAtPos", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function get() {
|
|
141
|
+
return _blockMark.reconcileBlockMarkForParagraphAtPos;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(exports, "reconcileBlockMarkInRange", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function get() {
|
|
147
|
+
return _blockMark.reconcileBlockMarkInRange;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
120
150
|
Object.defineProperty(exports, "restoreSelection", {
|
|
121
151
|
enumerable: true,
|
|
122
152
|
get: function get() {
|
|
@@ -132,5 +162,6 @@ var _restoreSelection = require("./restore-selection");
|
|
|
132
162
|
var _buildReplacementFragment = require("./build-replacement-fragment");
|
|
133
163
|
var _narrowReplacementRange = require("./narrow-replacement-range");
|
|
134
164
|
var _flattenList = require("./flatten-list");
|
|
165
|
+
var _blockMark = require("./block-mark");
|
|
135
166
|
var _utils = require("../utils");
|
|
136
167
|
var _messages = require("./messages");
|
|
@@ -19,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
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 = "112.
|
|
22
|
+
var packageVersion = "112.13.0";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|
|
@@ -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 = "112.
|
|
27
|
+
var packageVersion = "112.13.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* Used by both Confluence's useScrollOnUrlChange and platform renderer's useScrollToBlock.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* Timing constants for expand animation and DOM update delays.
|
|
8
10
|
* These values are tuned for the expand component's behavior and React's update cycle.
|
|
@@ -170,13 +172,17 @@ export const expandElement = expandContainer => {
|
|
|
170
172
|
* @returns A cleanup function that cancels any pending timeouts. Call this when the operation
|
|
171
173
|
* should be aborted (e.g., component unmount, navigation, or new scroll request).
|
|
172
174
|
*/
|
|
173
|
-
export const expandAllParentsThenScroll = (element, attempt = 0) => {
|
|
175
|
+
export const expandAllParentsThenScroll = (element, attempt = 0, scrollFn) => {
|
|
174
176
|
const {
|
|
175
177
|
MAX_EXPAND_DEPTH,
|
|
176
178
|
MAX_ATTEMPTS,
|
|
177
179
|
DOM_UPDATE_DELAY,
|
|
178
180
|
RETRY_DELAY
|
|
179
181
|
} = SCROLL_TO_BLOCK_TIMING;
|
|
182
|
+
const doScroll = scrollFn !== null && scrollFn !== void 0 ? scrollFn : el => el.scrollIntoView({
|
|
183
|
+
behavior: 'smooth',
|
|
184
|
+
block: 'center'
|
|
185
|
+
});
|
|
180
186
|
|
|
181
187
|
// Store timeout ID and nested cleanup function so they can be cancelled.
|
|
182
188
|
let timeoutId = null;
|
|
@@ -198,10 +204,7 @@ export const expandAllParentsThenScroll = (element, attempt = 0) => {
|
|
|
198
204
|
if (attempt >= MAX_ATTEMPTS || !element.isConnected) {
|
|
199
205
|
// Max attempts reached or element disconnected, scroll anyway.
|
|
200
206
|
if (element.isConnected) {
|
|
201
|
-
element
|
|
202
|
-
behavior: 'smooth',
|
|
203
|
-
block: 'center'
|
|
204
|
-
});
|
|
207
|
+
doScroll(element);
|
|
205
208
|
}
|
|
206
209
|
return cleanup;
|
|
207
210
|
}
|
|
@@ -213,10 +216,7 @@ export const expandAllParentsThenScroll = (element, attempt = 0) => {
|
|
|
213
216
|
const collapsedExpands = parentExpands.filter(expandContainer => expandContainer.isConnected && isExpandCollapsed(expandContainer));
|
|
214
217
|
if (collapsedExpands.length === 0) {
|
|
215
218
|
// All expands are open (or there are no expands), scroll to element.
|
|
216
|
-
element
|
|
217
|
-
behavior: 'smooth',
|
|
218
|
-
block: 'center'
|
|
219
|
-
});
|
|
219
|
+
doScroll(element);
|
|
220
220
|
return cleanup;
|
|
221
221
|
}
|
|
222
222
|
|
|
@@ -236,14 +236,11 @@ export const expandAllParentsThenScroll = (element, attempt = 0) => {
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
// Recurse to handle any nested collapsed expands or retry if still collapsed.
|
|
239
|
-
nestedCleanup = expandAllParentsThenScroll(element, attempt + 1);
|
|
239
|
+
nestedCleanup = expandAllParentsThenScroll(element, attempt + 1, scrollFn);
|
|
240
240
|
} catch {
|
|
241
241
|
// Fallback to simple scroll on error.
|
|
242
242
|
if (element.isConnected) {
|
|
243
|
-
element
|
|
244
|
-
behavior: 'smooth',
|
|
245
|
-
block: 'center'
|
|
246
|
-
});
|
|
243
|
+
doScroll(element);
|
|
247
244
|
}
|
|
248
245
|
}
|
|
249
246
|
}, DOM_UPDATE_DELAY);
|
|
@@ -251,7 +248,7 @@ export const expandAllParentsThenScroll = (element, attempt = 0) => {
|
|
|
251
248
|
// Failed to expand, retry with longer delay.
|
|
252
249
|
timeoutId = setTimeout(() => {
|
|
253
250
|
if (element.isConnected) {
|
|
254
|
-
nestedCleanup = expandAllParentsThenScroll(element, attempt + 1);
|
|
251
|
+
nestedCleanup = expandAllParentsThenScroll(element, attempt + 1, scrollFn);
|
|
255
252
|
}
|
|
256
253
|
}, RETRY_DELAY);
|
|
257
254
|
}
|
|
@@ -259,17 +256,14 @@ export const expandAllParentsThenScroll = (element, attempt = 0) => {
|
|
|
259
256
|
// Retry on error.
|
|
260
257
|
timeoutId = setTimeout(() => {
|
|
261
258
|
if (element.isConnected) {
|
|
262
|
-
nestedCleanup = expandAllParentsThenScroll(element, attempt + 1);
|
|
259
|
+
nestedCleanup = expandAllParentsThenScroll(element, attempt + 1, scrollFn);
|
|
263
260
|
}
|
|
264
261
|
}, RETRY_DELAY);
|
|
265
262
|
}
|
|
266
263
|
} catch {
|
|
267
264
|
// Fallback to simple scroll on error.
|
|
268
265
|
if (element.isConnected) {
|
|
269
|
-
element
|
|
270
|
-
behavior: 'smooth',
|
|
271
|
-
block: 'center'
|
|
272
|
-
});
|
|
266
|
+
doScroll(element);
|
|
273
267
|
}
|
|
274
268
|
}
|
|
275
269
|
return cleanup;
|
|
@@ -294,6 +288,9 @@ export const getLocalIdSelector = (localId, container) => {
|
|
|
294
288
|
// Special case for tables which use data-table-local-id
|
|
295
289
|
element = container.querySelector(`[data-table-local-id="${localId}"]`);
|
|
296
290
|
if (element) {
|
|
291
|
+
if (fg('platform_editor_block_menu_v2_patch_4')) {
|
|
292
|
+
return element.parentElement; // return table wrapper instead of table div, so the height calculation is correct
|
|
293
|
+
}
|
|
297
294
|
return element;
|
|
298
295
|
}
|
|
299
296
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { createToggleBlockMarkOnRangeNext } from '../commands';
|
|
2
|
+
const getDefaultBlockNodeTypes = tr => {
|
|
3
|
+
const {
|
|
4
|
+
paragraph
|
|
5
|
+
} = tr.doc.type.schema.nodes;
|
|
6
|
+
return paragraph ? [paragraph] : [];
|
|
7
|
+
};
|
|
8
|
+
export const getBlockMarkAttrs = (node, markType) => {
|
|
9
|
+
if (!node || !markType) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const blockMark = node.marks.find(mark => mark.type === markType);
|
|
13
|
+
return blockMark ? blockMark.attrs : false;
|
|
14
|
+
};
|
|
15
|
+
export const getFirstParagraphBlockMarkAttrs = (node, markType) => {
|
|
16
|
+
if (!node || !markType) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
const {
|
|
20
|
+
paragraph
|
|
21
|
+
} = node.type.schema.nodes;
|
|
22
|
+
if (!paragraph) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
const findFirstParagraphBlockMarkAttrs = currentNode => {
|
|
26
|
+
if (currentNode.type === paragraph) {
|
|
27
|
+
return getBlockMarkAttrs(currentNode, markType);
|
|
28
|
+
}
|
|
29
|
+
for (let index = 0; index < currentNode.childCount; index++) {
|
|
30
|
+
const childResult = findFirstParagraphBlockMarkAttrs(currentNode.child(index));
|
|
31
|
+
if (childResult !== false) {
|
|
32
|
+
return childResult;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
};
|
|
37
|
+
return findFirstParagraphBlockMarkAttrs(node);
|
|
38
|
+
};
|
|
39
|
+
export const reconcileBlockMarkInRange = (tr, from, to, markType, markAttrs, blockNodeTypes = getDefaultBlockNodeTypes(tr)) => {
|
|
40
|
+
if (!markType || blockNodeTypes.length === 0) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return createToggleBlockMarkOnRangeNext(markType, () => markAttrs, blockNodeTypes)(from, to, tr);
|
|
44
|
+
};
|
|
45
|
+
export const reconcileBlockMarkForContainerAtPos = (tr, containerPos, markType, markAttrs, blockNodeTypes = getDefaultBlockNodeTypes(tr)) => {
|
|
46
|
+
const containerNode = tr.doc.nodeAt(containerPos);
|
|
47
|
+
if (!containerNode) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
return reconcileBlockMarkInRange(tr, containerPos, containerPos + containerNode.nodeSize, markType, markAttrs, blockNodeTypes);
|
|
51
|
+
};
|
|
52
|
+
export const reconcileBlockMarkForParagraphAtPos = (tr, pos, markType, markAttrs) => {
|
|
53
|
+
const {
|
|
54
|
+
paragraph
|
|
55
|
+
} = tr.doc.type.schema.nodes;
|
|
56
|
+
if (!paragraph) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const resolvedPos = tr.doc.resolve(Math.max(0, Math.min(pos, tr.doc.content.size)));
|
|
60
|
+
for (let depth = resolvedPos.depth; depth > 0; depth--) {
|
|
61
|
+
const node = resolvedPos.node(depth);
|
|
62
|
+
if (node.type === paragraph) {
|
|
63
|
+
return reconcileBlockMarkInRange(tr, resolvedPos.before(depth), resolvedPos.before(depth) + node.nodeSize, markType, markAttrs, [paragraph]);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
};
|
|
@@ -10,5 +10,6 @@ export { restoreSelection, computeSelectionOffsets } from './restore-selection';
|
|
|
10
10
|
export { buildReplacementFragment } from './build-replacement-fragment';
|
|
11
11
|
export { narrowReplacementRange } from './narrow-replacement-range';
|
|
12
12
|
export { flattenList } from './flatten-list';
|
|
13
|
+
export { getBlockMarkAttrs, getFirstParagraphBlockMarkAttrs, reconcileBlockMarkForContainerAtPos, reconcileBlockMarkForParagraphAtPos, reconcileBlockMarkInRange } from './block-mark';
|
|
13
14
|
export { isListNode, isListItemNode, isBulletList, isParagraphNode } from '../utils';
|
|
14
15
|
export { messages } from './messages';
|
|
@@ -4,7 +4,7 @@ import { isFedRamp } from './environment';
|
|
|
4
4
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
5
5
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
6
6
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
7
|
-
const packageVersion = "112.
|
|
7
|
+
const packageVersion = "112.13.0";
|
|
8
8
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
9
9
|
// Remove URL as it has UGC
|
|
10
10
|
// Ignored via go/ees007
|
|
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import Layer from '../Layer';
|
|
16
16
|
const packageName = "@atlaskit/editor-common";
|
|
17
|
-
const packageVersion = "112.
|
|
17
|
+
const packageVersion = "112.13.0";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|
|
@@ -7,6 +7,8 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
7
7
|
* Used by both Confluence's useScrollOnUrlChange and platform renderer's useScrollToBlock.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
+
|
|
10
12
|
/**
|
|
11
13
|
* Timing constants for expand animation and DOM update delays.
|
|
12
14
|
* These values are tuned for the expand component's behavior and React's update cycle.
|
|
@@ -186,10 +188,17 @@ export var expandElement = function expandElement(expandContainer) {
|
|
|
186
188
|
*/
|
|
187
189
|
var _expandAllParentsThenScroll = function expandAllParentsThenScroll(element) {
|
|
188
190
|
var attempt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
191
|
+
var scrollFn = arguments.length > 2 ? arguments[2] : undefined;
|
|
189
192
|
var MAX_EXPAND_DEPTH = SCROLL_TO_BLOCK_TIMING.MAX_EXPAND_DEPTH,
|
|
190
193
|
MAX_ATTEMPTS = SCROLL_TO_BLOCK_TIMING.MAX_ATTEMPTS,
|
|
191
194
|
DOM_UPDATE_DELAY = SCROLL_TO_BLOCK_TIMING.DOM_UPDATE_DELAY,
|
|
192
195
|
RETRY_DELAY = SCROLL_TO_BLOCK_TIMING.RETRY_DELAY;
|
|
196
|
+
var doScroll = scrollFn !== null && scrollFn !== void 0 ? scrollFn : function (el) {
|
|
197
|
+
return el.scrollIntoView({
|
|
198
|
+
behavior: 'smooth',
|
|
199
|
+
block: 'center'
|
|
200
|
+
});
|
|
201
|
+
};
|
|
193
202
|
|
|
194
203
|
// Store timeout ID and nested cleanup function so they can be cancelled.
|
|
195
204
|
var timeoutId = null;
|
|
@@ -211,10 +220,7 @@ var _expandAllParentsThenScroll = function expandAllParentsThenScroll(element) {
|
|
|
211
220
|
if (attempt >= MAX_ATTEMPTS || !element.isConnected) {
|
|
212
221
|
// Max attempts reached or element disconnected, scroll anyway.
|
|
213
222
|
if (element.isConnected) {
|
|
214
|
-
element
|
|
215
|
-
behavior: 'smooth',
|
|
216
|
-
block: 'center'
|
|
217
|
-
});
|
|
223
|
+
doScroll(element);
|
|
218
224
|
}
|
|
219
225
|
return cleanup;
|
|
220
226
|
}
|
|
@@ -228,10 +234,7 @@ var _expandAllParentsThenScroll = function expandAllParentsThenScroll(element) {
|
|
|
228
234
|
});
|
|
229
235
|
if (collapsedExpands.length === 0) {
|
|
230
236
|
// All expands are open (or there are no expands), scroll to element.
|
|
231
|
-
element
|
|
232
|
-
behavior: 'smooth',
|
|
233
|
-
block: 'center'
|
|
234
|
-
});
|
|
237
|
+
doScroll(element);
|
|
235
238
|
return cleanup;
|
|
236
239
|
}
|
|
237
240
|
|
|
@@ -251,14 +254,11 @@ var _expandAllParentsThenScroll = function expandAllParentsThenScroll(element) {
|
|
|
251
254
|
}
|
|
252
255
|
|
|
253
256
|
// Recurse to handle any nested collapsed expands or retry if still collapsed.
|
|
254
|
-
nestedCleanup = _expandAllParentsThenScroll(element, attempt + 1);
|
|
257
|
+
nestedCleanup = _expandAllParentsThenScroll(element, attempt + 1, scrollFn);
|
|
255
258
|
} catch (_unused) {
|
|
256
259
|
// Fallback to simple scroll on error.
|
|
257
260
|
if (element.isConnected) {
|
|
258
|
-
element
|
|
259
|
-
behavior: 'smooth',
|
|
260
|
-
block: 'center'
|
|
261
|
-
});
|
|
261
|
+
doScroll(element);
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
}, DOM_UPDATE_DELAY);
|
|
@@ -266,7 +266,7 @@ var _expandAllParentsThenScroll = function expandAllParentsThenScroll(element) {
|
|
|
266
266
|
// Failed to expand, retry with longer delay.
|
|
267
267
|
timeoutId = setTimeout(function () {
|
|
268
268
|
if (element.isConnected) {
|
|
269
|
-
nestedCleanup = _expandAllParentsThenScroll(element, attempt + 1);
|
|
269
|
+
nestedCleanup = _expandAllParentsThenScroll(element, attempt + 1, scrollFn);
|
|
270
270
|
}
|
|
271
271
|
}, RETRY_DELAY);
|
|
272
272
|
}
|
|
@@ -274,17 +274,14 @@ var _expandAllParentsThenScroll = function expandAllParentsThenScroll(element) {
|
|
|
274
274
|
// Retry on error.
|
|
275
275
|
timeoutId = setTimeout(function () {
|
|
276
276
|
if (element.isConnected) {
|
|
277
|
-
nestedCleanup = _expandAllParentsThenScroll(element, attempt + 1);
|
|
277
|
+
nestedCleanup = _expandAllParentsThenScroll(element, attempt + 1, scrollFn);
|
|
278
278
|
}
|
|
279
279
|
}, RETRY_DELAY);
|
|
280
280
|
}
|
|
281
281
|
} catch (_unused3) {
|
|
282
282
|
// Fallback to simple scroll on error.
|
|
283
283
|
if (element.isConnected) {
|
|
284
|
-
element
|
|
285
|
-
behavior: 'smooth',
|
|
286
|
-
block: 'center'
|
|
287
|
-
});
|
|
284
|
+
doScroll(element);
|
|
288
285
|
}
|
|
289
286
|
}
|
|
290
287
|
return cleanup;
|
|
@@ -310,6 +307,9 @@ export var getLocalIdSelector = function getLocalIdSelector(localId, container)
|
|
|
310
307
|
// Special case for tables which use data-table-local-id
|
|
311
308
|
element = container.querySelector("[data-table-local-id=\"".concat(localId, "\"]"));
|
|
312
309
|
if (element) {
|
|
310
|
+
if (fg('platform_editor_block_menu_v2_patch_4')) {
|
|
311
|
+
return element.parentElement; // return table wrapper instead of table div, so the height calculation is correct
|
|
312
|
+
}
|
|
313
313
|
return element;
|
|
314
314
|
}
|
|
315
315
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { createToggleBlockMarkOnRangeNext } from '../commands';
|
|
2
|
+
var getDefaultBlockNodeTypes = function getDefaultBlockNodeTypes(tr) {
|
|
3
|
+
var paragraph = tr.doc.type.schema.nodes.paragraph;
|
|
4
|
+
return paragraph ? [paragraph] : [];
|
|
5
|
+
};
|
|
6
|
+
export var getBlockMarkAttrs = function getBlockMarkAttrs(node, markType) {
|
|
7
|
+
if (!node || !markType) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
var blockMark = node.marks.find(function (mark) {
|
|
11
|
+
return mark.type === markType;
|
|
12
|
+
});
|
|
13
|
+
return blockMark ? blockMark.attrs : false;
|
|
14
|
+
};
|
|
15
|
+
export var getFirstParagraphBlockMarkAttrs = function getFirstParagraphBlockMarkAttrs(node, markType) {
|
|
16
|
+
if (!node || !markType) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
var paragraph = node.type.schema.nodes.paragraph;
|
|
20
|
+
if (!paragraph) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
var _findFirstParagraphBlockMarkAttrs = function findFirstParagraphBlockMarkAttrs(currentNode) {
|
|
24
|
+
if (currentNode.type === paragraph) {
|
|
25
|
+
return getBlockMarkAttrs(currentNode, markType);
|
|
26
|
+
}
|
|
27
|
+
for (var index = 0; index < currentNode.childCount; index++) {
|
|
28
|
+
var childResult = _findFirstParagraphBlockMarkAttrs(currentNode.child(index));
|
|
29
|
+
if (childResult !== false) {
|
|
30
|
+
return childResult;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
};
|
|
35
|
+
return _findFirstParagraphBlockMarkAttrs(node);
|
|
36
|
+
};
|
|
37
|
+
export var reconcileBlockMarkInRange = function reconcileBlockMarkInRange(tr, from, to, markType, markAttrs) {
|
|
38
|
+
var blockNodeTypes = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : getDefaultBlockNodeTypes(tr);
|
|
39
|
+
if (!markType || blockNodeTypes.length === 0) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return createToggleBlockMarkOnRangeNext(markType, function () {
|
|
43
|
+
return markAttrs;
|
|
44
|
+
}, blockNodeTypes)(from, to, tr);
|
|
45
|
+
};
|
|
46
|
+
export var reconcileBlockMarkForContainerAtPos = function reconcileBlockMarkForContainerAtPos(tr, containerPos, markType, markAttrs) {
|
|
47
|
+
var blockNodeTypes = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : getDefaultBlockNodeTypes(tr);
|
|
48
|
+
var containerNode = tr.doc.nodeAt(containerPos);
|
|
49
|
+
if (!containerNode) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return reconcileBlockMarkInRange(tr, containerPos, containerPos + containerNode.nodeSize, markType, markAttrs, blockNodeTypes);
|
|
53
|
+
};
|
|
54
|
+
export var reconcileBlockMarkForParagraphAtPos = function reconcileBlockMarkForParagraphAtPos(tr, pos, markType, markAttrs) {
|
|
55
|
+
var paragraph = tr.doc.type.schema.nodes.paragraph;
|
|
56
|
+
if (!paragraph) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
var resolvedPos = tr.doc.resolve(Math.max(0, Math.min(pos, tr.doc.content.size)));
|
|
60
|
+
for (var depth = resolvedPos.depth; depth > 0; depth--) {
|
|
61
|
+
var node = resolvedPos.node(depth);
|
|
62
|
+
if (node.type === paragraph) {
|
|
63
|
+
return reconcileBlockMarkInRange(tr, resolvedPos.before(depth), resolvedPos.before(depth) + node.nodeSize, markType, markAttrs, [paragraph]);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
};
|
package/dist/esm/lists/index.js
CHANGED
|
@@ -10,5 +10,6 @@ export { restoreSelection, computeSelectionOffsets } from './restore-selection';
|
|
|
10
10
|
export { buildReplacementFragment } from './build-replacement-fragment';
|
|
11
11
|
export { narrowReplacementRange } from './narrow-replacement-range';
|
|
12
12
|
export { flattenList } from './flatten-list';
|
|
13
|
+
export { getBlockMarkAttrs, getFirstParagraphBlockMarkAttrs, reconcileBlockMarkForContainerAtPos, reconcileBlockMarkForParagraphAtPos, reconcileBlockMarkInRange } from './block-mark';
|
|
13
14
|
export { isListNode, isListItemNode, isBulletList, isParagraphNode } from '../utils';
|
|
14
15
|
export { messages } from './messages';
|
|
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
|
|
|
10
10
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
11
11
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
12
12
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
13
|
-
var packageVersion = "112.
|
|
13
|
+
var packageVersion = "112.13.0";
|
|
14
14
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
15
15
|
// Remove URL as it has UGC
|
|
16
16
|
// Ignored via go/ees007
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "112.
|
|
24
|
+
var packageVersion = "112.13.0";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -90,5 +90,5 @@ export declare const expandElement: (expandContainer: HTMLElement) => boolean;
|
|
|
90
90
|
* @returns A cleanup function that cancels any pending timeouts. Call this when the operation
|
|
91
91
|
* should be aborted (e.g., component unmount, navigation, or new scroll request).
|
|
92
92
|
*/
|
|
93
|
-
export declare const expandAllParentsThenScroll: (element: HTMLElement, attempt?: number) => (() => void);
|
|
93
|
+
export declare const expandAllParentsThenScroll: (element: HTMLElement, attempt?: number, scrollFn?: (element: HTMLElement) => void) => (() => void);
|
|
94
94
|
export declare const getLocalIdSelector: (localId: string, container: HTMLElement) => HTMLElement | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MarkType, Node as PMNode, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
type BlockMarkAttrs = Record<string, unknown>;
|
|
4
|
+
export declare const getBlockMarkAttrs: <T extends BlockMarkAttrs = BlockMarkAttrs>(node: PMNode | null | undefined, markType?: MarkType) => T | false;
|
|
5
|
+
export declare const getFirstParagraphBlockMarkAttrs: <T extends BlockMarkAttrs = BlockMarkAttrs>(node: PMNode | null | undefined, markType?: MarkType) => T | false;
|
|
6
|
+
export declare const reconcileBlockMarkInRange: <T extends BlockMarkAttrs = BlockMarkAttrs>(tr: Transaction, from: number, to: number, markType: MarkType | undefined, markAttrs: T | false, blockNodeTypes?: NodeType[]) => boolean;
|
|
7
|
+
export declare const reconcileBlockMarkForContainerAtPos: <T extends BlockMarkAttrs = BlockMarkAttrs>(tr: Transaction, containerPos: number, markType: MarkType | undefined, markAttrs: T | false, blockNodeTypes?: NodeType[]) => boolean;
|
|
8
|
+
export declare const reconcileBlockMarkForParagraphAtPos: <T extends BlockMarkAttrs = BlockMarkAttrs>(tr: Transaction, pos: number, markType: MarkType | undefined, markAttrs: T | false) => boolean;
|
|
9
|
+
export {};
|
|
@@ -11,5 +11,6 @@ export type { NarrowedReplacement } from './narrow-replacement-range';
|
|
|
11
11
|
export type { FlattenedItem } from './flatten-list';
|
|
12
12
|
export { flattenList } from './flatten-list';
|
|
13
13
|
export type { FlattenListOptions, FlattenListResult } from './flatten-list';
|
|
14
|
+
export { getBlockMarkAttrs, getFirstParagraphBlockMarkAttrs, reconcileBlockMarkForContainerAtPos, reconcileBlockMarkForParagraphAtPos, reconcileBlockMarkInRange, } from './block-mark';
|
|
14
15
|
export { isListNode, isListItemNode, isBulletList, isParagraphNode } from '../utils';
|
|
15
16
|
export { messages } from './messages';
|
|
@@ -90,5 +90,5 @@ export declare const expandElement: (expandContainer: HTMLElement) => boolean;
|
|
|
90
90
|
* @returns A cleanup function that cancels any pending timeouts. Call this when the operation
|
|
91
91
|
* should be aborted (e.g., component unmount, navigation, or new scroll request).
|
|
92
92
|
*/
|
|
93
|
-
export declare const expandAllParentsThenScroll: (element: HTMLElement, attempt?: number) => (() => void);
|
|
93
|
+
export declare const expandAllParentsThenScroll: (element: HTMLElement, attempt?: number, scrollFn?: (element: HTMLElement) => void) => (() => void);
|
|
94
94
|
export declare const getLocalIdSelector: (localId: string, container: HTMLElement) => HTMLElement | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MarkType, Node as PMNode, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
type BlockMarkAttrs = Record<string, unknown>;
|
|
4
|
+
export declare const getBlockMarkAttrs: <T extends BlockMarkAttrs = BlockMarkAttrs>(node: PMNode | null | undefined, markType?: MarkType) => T | false;
|
|
5
|
+
export declare const getFirstParagraphBlockMarkAttrs: <T extends BlockMarkAttrs = BlockMarkAttrs>(node: PMNode | null | undefined, markType?: MarkType) => T | false;
|
|
6
|
+
export declare const reconcileBlockMarkInRange: <T extends BlockMarkAttrs = BlockMarkAttrs>(tr: Transaction, from: number, to: number, markType: MarkType | undefined, markAttrs: T | false, blockNodeTypes?: NodeType[]) => boolean;
|
|
7
|
+
export declare const reconcileBlockMarkForContainerAtPos: <T extends BlockMarkAttrs = BlockMarkAttrs>(tr: Transaction, containerPos: number, markType: MarkType | undefined, markAttrs: T | false, blockNodeTypes?: NodeType[]) => boolean;
|
|
8
|
+
export declare const reconcileBlockMarkForParagraphAtPos: <T extends BlockMarkAttrs = BlockMarkAttrs>(tr: Transaction, pos: number, markType: MarkType | undefined, markAttrs: T | false) => boolean;
|
|
9
|
+
export {};
|
|
@@ -11,5 +11,6 @@ export type { NarrowedReplacement } from './narrow-replacement-range';
|
|
|
11
11
|
export type { FlattenedItem } from './flatten-list';
|
|
12
12
|
export { flattenList } from './flatten-list';
|
|
13
13
|
export type { FlattenListOptions, FlattenListResult } from './flatten-list';
|
|
14
|
+
export { getBlockMarkAttrs, getFirstParagraphBlockMarkAttrs, reconcileBlockMarkForContainerAtPos, reconcileBlockMarkForParagraphAtPos, reconcileBlockMarkInRange, } from './block-mark';
|
|
14
15
|
export { isListNode, isListItemNode, isBulletList, isParagraphNode } from '../utils';
|
|
15
16
|
export { messages } from './messages';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "112.
|
|
3
|
+
"version": "112.13.0",
|
|
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/"
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"@atlaskit/primitives": "^18.1.0",
|
|
74
74
|
"@atlaskit/profilecard": "^24.45.0",
|
|
75
75
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
76
|
-
"@atlaskit/react-ufo": "^5.
|
|
76
|
+
"@atlaskit/react-ufo": "^5.7.0",
|
|
77
77
|
"@atlaskit/section-message": "^8.12.0",
|
|
78
78
|
"@atlaskit/smart-card": "^43.28.0",
|
|
79
79
|
"@atlaskit/smart-user-picker": "^9.2.0",
|
|
80
80
|
"@atlaskit/spinner": "^19.0.0",
|
|
81
|
-
"@atlaskit/status": "^3.
|
|
81
|
+
"@atlaskit/status": "^3.2.0",
|
|
82
82
|
"@atlaskit/task-decision": "^19.3.0",
|
|
83
83
|
"@atlaskit/textfield": "^8.2.0",
|
|
84
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
84
|
+
"@atlaskit/tmp-editor-statsig": "^49.0.0",
|
|
85
85
|
"@atlaskit/tokens": "^11.4.0",
|
|
86
86
|
"@atlaskit/tooltip": "^21.0.0",
|
|
87
87
|
"@atlaskit/width-detector": "^5.0.0",
|
|
@@ -267,6 +267,9 @@
|
|
|
267
267
|
"platform_editor_toolbar_aifc_placement_overridden": {
|
|
268
268
|
"type": "boolean"
|
|
269
269
|
},
|
|
270
|
+
"platform_editor_block_menu_v2_patch_4": {
|
|
271
|
+
"type": "boolean"
|
|
272
|
+
},
|
|
270
273
|
"jim-lower-ranking-in-jira-macro-search": {
|
|
271
274
|
"type": "boolean"
|
|
272
275
|
},
|