@atlaskit/editor-common 111.11.7 → 111.11.8
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 +7 -0
- package/dist/cjs/analytics/types/enums.js +8 -0
- package/dist/cjs/block-menu/block-link.js +27 -13
- package/dist/cjs/block-menu/index.js +44 -1
- package/dist/cjs/block-menu/scroll-to-block-utils.js +330 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/analytics/types/enums.js +8 -0
- package/dist/es2019/block-menu/block-link.js +27 -13
- package/dist/es2019/block-menu/index.js +2 -1
- package/dist/es2019/block-menu/scroll-to-block-utils.js +306 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/analytics/types/enums.js +8 -0
- package/dist/esm/block-menu/block-link.js +27 -13
- package/dist/esm/block-menu/index.js +2 -1
- package/dist/esm/block-menu/scroll-to-block-utils.js +322 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/analytics/types/enums.d.ts +8 -0
- package/dist/types/analytics/types/sync-block-events.d.ts +12 -2
- package/dist/types/block-menu/block-link.d.ts +22 -10
- package/dist/types/block-menu/index.d.ts +2 -0
- package/dist/types/block-menu/scroll-to-block-utils.d.ts +94 -0
- package/dist/types-ts4.5/analytics/types/enums.d.ts +8 -0
- package/dist/types-ts4.5/analytics/types/sync-block-events.d.ts +12 -2
- package/dist/types-ts4.5/block-menu/block-link.d.ts +22 -10
- package/dist/types-ts4.5/block-menu/index.d.ts +2 -0
- package/dist/types-ts4.5/block-menu/scroll-to-block-utils.d.ts +94 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 111.11.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`011b84236ffaa`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/011b84236ffaa) -
|
|
8
|
+
EDITOR-4175 add analytics events for the synced block toolbar buttons
|
|
9
|
+
|
|
3
10
|
## 111.11.7
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -111,6 +111,8 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
111
111
|
ACTION["REACT_NODEVIEW_RENDERED"] = "reactNodeViewRendered";
|
|
112
112
|
ACTION["REFERENCE_SYNCED_BLOCK_DELETE"] = "referenceSyncedBlockDelete";
|
|
113
113
|
ACTION["REFERENCE_SYNCED_BLOCK_UPDATE"] = "referenceSyncedBlockUpdate";
|
|
114
|
+
ACTION["REFERENCE_SYNCED_BLOCK_UNSYNC"] = "referenceSyncedBlockUnsync";
|
|
115
|
+
ACTION["REFERENCE_SYNCED_BLOCK_COPY"] = "referenceSyncedBlockCopy";
|
|
114
116
|
ACTION["REPLACED_ALL"] = "replacedAll";
|
|
115
117
|
ACTION["REPLACED_ONE"] = "replacedOne";
|
|
116
118
|
ACTION["RESOLVED"] = "resolved";
|
|
@@ -128,6 +130,9 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
128
130
|
ACTION["SYNCED_BLOCK_FETCH_REFERENCES"] = "syncedBlockFetchReferences";
|
|
129
131
|
ACTION["SYNCED_BLOCK_DELETE"] = "syncedBlockDelete";
|
|
130
132
|
ACTION["SYNCED_BLOCK_GET_SOURCE_INFO"] = "syncedBlockGetSourceInfo";
|
|
133
|
+
ACTION["SYNCED_BLOCK_UNSYNC"] = "syncedBlockUnsync";
|
|
134
|
+
ACTION["SYNCED_BLOCK_EDIT_SOURCE"] = "syncedBlockEditSource";
|
|
135
|
+
ACTION["SYNCED_BLOCK_VIEW_SYNCED_LOCATIONS"] = "syncedBlockViewSyncedLocations";
|
|
131
136
|
ACTION["SYNCHRONY_DISCONNECTED"] = "synchronyDisconnected";
|
|
132
137
|
ACTION["SYNCHRONY_ENTITY_ERROR"] = "synchronyEntityError";
|
|
133
138
|
ACTION["SYNCHRONY_ERROR"] = "synchronyError";
|
|
@@ -255,6 +260,7 @@ var INPUT_METHOD = exports.INPUT_METHOD = /*#__PURE__*/function (INPUT_METHOD) {
|
|
|
255
260
|
INPUT_METHOD["DOUBLE_CLICK"] = "doubleClick";
|
|
256
261
|
INPUT_METHOD["META_CLICK"] = "metaClick";
|
|
257
262
|
INPUT_METHOD["INLINE_SUGGESTION_FLOATING_TB"] = "inlineSuggestionFloatingToolbar";
|
|
263
|
+
INPUT_METHOD["SYNCED_BLOCK_TB"] = "syncedBlockToolbar";
|
|
258
264
|
INPUT_METHOD["BLOCK_MENU"] = "blockMenu";
|
|
259
265
|
INPUT_METHOD["SMART_LINK"] = "smartLink";
|
|
260
266
|
return INPUT_METHOD;
|
|
@@ -541,6 +547,7 @@ var ACTION_SUBJECT_ID = exports.ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTIO
|
|
|
541
547
|
ACTION_SUBJECT_ID["EDITOR_PLUGIN_SELECTION_EXTENSION_COMPONENT"] = "editorPluginSelectionExtensionComponent";
|
|
542
548
|
ACTION_SUBJECT_ID["TRANSFORM"] = "transform";
|
|
543
549
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_TOOLBAR"] = "syncedBlockToolbar";
|
|
550
|
+
ACTION_SUBJECT_ID["SYNCED_BLOCK_COPY"] = "syncedBlockCopy";
|
|
544
551
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_SOURCE_URL"] = "syncedBlockSourceUrl";
|
|
545
552
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_UPDATE_CACHE"] = "syncedBlockUpdateCache";
|
|
546
553
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_UPDATE"] = "syncedBlockUpdate";
|
|
@@ -552,6 +559,7 @@ var ACTION_SUBJECT_ID = exports.ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTIO
|
|
|
552
559
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_GET_SOURCE_INFO"] = "syncedBlockGetSourceInfo";
|
|
553
560
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_FETCH"] = "syncedBlockFetch";
|
|
554
561
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_FETCH_REFERENCES"] = "syncedBlockFetchReferences";
|
|
562
|
+
ACTION_SUBJECT_ID["SYNCED_BLOCK_CLICK_SYNCED_LOCATION"] = "syncedBlockClickSyncedLocation";
|
|
555
563
|
ACTION_SUBJECT_ID["TABLE_STICKY_HEADER"] = "tableStickyHeader";
|
|
556
564
|
return ACTION_SUBJECT_ID;
|
|
557
565
|
}({});
|
|
@@ -7,34 +7,48 @@ exports.isBlockLinkHash = exports.extractBlockIdFromLinkHash = exports.createBlo
|
|
|
7
7
|
var DEFAULT_BLOCK_LINK_HASH_PREFIX = exports.DEFAULT_BLOCK_LINK_HASH_PREFIX = 'block-';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Matches hashes that start with the block link prefix followed by
|
|
10
|
+
* Matches hashes that start with the block link prefix followed by either:
|
|
11
|
+
* - A UUID (e.g., '123e4567-e89b-12d3-a456-426614174000')
|
|
12
|
+
* - A short hex ID (e.g., 'ab2366c43b52')
|
|
11
13
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* Short hex IDs are 12-character hexadecimal strings without dashes, used in some contexts
|
|
15
|
+
* as a compact alternative to full UUIDs. Both formats are valid block identifiers.
|
|
16
|
+
*
|
|
17
|
+
* Note: The short ID pattern matches exactly 12 hex characters. While this could theoretically
|
|
18
|
+
* match heading IDs or other anchors, block links are typically generated programmatically
|
|
19
|
+
* with known ID formats, minimizing collision risk.
|
|
20
|
+
*
|
|
21
|
+
* @param hash - The hash string to check (e.g., '#block-123e4567-e89b-12d3-a456-426614174000', '#block-ab2366c43b52', or without '#').
|
|
22
|
+
* @param prefix - The prefix to look for (default is 'block-').
|
|
23
|
+
* @returns True if the hash matches the block link pattern, false otherwise.
|
|
15
24
|
*/
|
|
16
25
|
var isBlockLinkHash = exports.isBlockLinkHash = function isBlockLinkHash(hash) {
|
|
17
26
|
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_BLOCK_LINK_HASH_PREFIX;
|
|
18
27
|
if (!hash || !prefix) {
|
|
19
28
|
return false;
|
|
20
29
|
}
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
// Match either UUID format (8-4-4-4-12) or short hex ID format (exactly 12 hex chars without dashes).
|
|
31
|
+
var uuidRegex = new RegExp("^#?".concat(prefix, "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"), 'iu');
|
|
32
|
+
var shortIdRegex = new RegExp("^#?".concat(prefix, "[0-9a-f]{12}$"), 'iu');
|
|
33
|
+
return uuidRegex.test(hash) || shortIdRegex.test(hash);
|
|
23
34
|
};
|
|
24
35
|
|
|
25
36
|
/**
|
|
26
37
|
* Extracts the block ID from a block link hash.
|
|
27
38
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
39
|
+
* Supports both UUID format (e.g., '123e4567-e89b-12d3-a456-426614174000') and
|
|
40
|
+
* short hex ID format (e.g., 'ab2366c43b52').
|
|
41
|
+
*
|
|
42
|
+
* @param hash - The hash string to extract the block ID from (e.g., '#block-123e4567-e89b-12d3-a456-426614174000', '#block-ab2366c43b52', or without '#').
|
|
43
|
+
* @param prefix - The prefix to look for (default is 'block-').
|
|
44
|
+
* @returns The extracted block ID if the hash is valid, null otherwise.
|
|
31
45
|
*/
|
|
32
46
|
var extractBlockIdFromLinkHash = exports.extractBlockIdFromLinkHash = function extractBlockIdFromLinkHash(hash) {
|
|
33
47
|
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_BLOCK_LINK_HASH_PREFIX;
|
|
34
48
|
if (!isBlockLinkHash(hash, prefix)) {
|
|
35
49
|
return null;
|
|
36
50
|
}
|
|
37
|
-
// Remove leading # if present, then remove the prefix
|
|
51
|
+
// Remove leading # if present, then remove the prefix.
|
|
38
52
|
var normalized = hash.startsWith('#') ? hash.slice(1) : hash;
|
|
39
53
|
return normalized.slice(prefix.length);
|
|
40
54
|
};
|
|
@@ -42,9 +56,9 @@ var extractBlockIdFromLinkHash = exports.extractBlockIdFromLinkHash = function e
|
|
|
42
56
|
/**
|
|
43
57
|
* Creates a block link hash from a given block ID.
|
|
44
58
|
*
|
|
45
|
-
* @param blockId The block ID to create the hash from (e.g., '123e4567-e89b-12d3-a456-426614174000')
|
|
46
|
-
* @param prefix The prefix to use (default is 'block-')
|
|
47
|
-
* @returns The constructed block link hash value (e.g., 'block-123e4567-e89b-12d3-a456-426614174000')
|
|
59
|
+
* @param blockId - The block ID to create the hash from (e.g., '123e4567-e89b-12d3-a456-426614174000').
|
|
60
|
+
* @param prefix - The prefix to use (default is 'block-').
|
|
61
|
+
* @returns The constructed block link hash value (e.g., 'block-123e4567-e89b-12d3-a456-426614174000').
|
|
48
62
|
*/
|
|
49
63
|
var createBlockLinkHashValue = exports.createBlockLinkHashValue = function createBlockLinkHashValue(blockId) {
|
|
50
64
|
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_BLOCK_LINK_HASH_PREFIX;
|
|
@@ -303,6 +303,12 @@ Object.defineProperty(exports, "PRIMARY_MENU_SECTION_RANK", {
|
|
|
303
303
|
return _rankDeprecated.PRIMARY_MENU_SECTION_RANK;
|
|
304
304
|
}
|
|
305
305
|
});
|
|
306
|
+
Object.defineProperty(exports, "SCROLL_TO_BLOCK_TIMING", {
|
|
307
|
+
enumerable: true,
|
|
308
|
+
get: function get() {
|
|
309
|
+
return _scrollToBlockUtils.SCROLL_TO_BLOCK_TIMING;
|
|
310
|
+
}
|
|
311
|
+
});
|
|
306
312
|
Object.defineProperty(exports, "TRANSFORM_CLEAR_MENU_ITEM", {
|
|
307
313
|
enumerable: true,
|
|
308
314
|
get: function get() {
|
|
@@ -507,18 +513,54 @@ Object.defineProperty(exports, "createBlockLinkHashValue", {
|
|
|
507
513
|
return _blockLink.createBlockLinkHashValue;
|
|
508
514
|
}
|
|
509
515
|
});
|
|
516
|
+
Object.defineProperty(exports, "expandAllParentsThenScroll", {
|
|
517
|
+
enumerable: true,
|
|
518
|
+
get: function get() {
|
|
519
|
+
return _scrollToBlockUtils.expandAllParentsThenScroll;
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
Object.defineProperty(exports, "expandElement", {
|
|
523
|
+
enumerable: true,
|
|
524
|
+
get: function get() {
|
|
525
|
+
return _scrollToBlockUtils.expandElement;
|
|
526
|
+
}
|
|
527
|
+
});
|
|
510
528
|
Object.defineProperty(exports, "extractBlockIdFromLinkHash", {
|
|
511
529
|
enumerable: true,
|
|
512
530
|
get: function get() {
|
|
513
531
|
return _blockLink.extractBlockIdFromLinkHash;
|
|
514
532
|
}
|
|
515
533
|
});
|
|
534
|
+
Object.defineProperty(exports, "findNodeWithExpandParents", {
|
|
535
|
+
enumerable: true,
|
|
536
|
+
get: function get() {
|
|
537
|
+
return _scrollToBlockUtils.findNodeWithExpandParents;
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
Object.defineProperty(exports, "findParentExpands", {
|
|
541
|
+
enumerable: true,
|
|
542
|
+
get: function get() {
|
|
543
|
+
return _scrollToBlockUtils.findParentExpands;
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
Object.defineProperty(exports, "getLocalIdSelector", {
|
|
547
|
+
enumerable: true,
|
|
548
|
+
get: function get() {
|
|
549
|
+
return _scrollToBlockUtils.getLocalIdSelector;
|
|
550
|
+
}
|
|
551
|
+
});
|
|
516
552
|
Object.defineProperty(exports, "isBlockLinkHash", {
|
|
517
553
|
enumerable: true,
|
|
518
554
|
get: function get() {
|
|
519
555
|
return _blockLink.isBlockLinkHash;
|
|
520
556
|
}
|
|
521
557
|
});
|
|
558
|
+
Object.defineProperty(exports, "isExpandCollapsed", {
|
|
559
|
+
enumerable: true,
|
|
560
|
+
get: function get() {
|
|
561
|
+
return _scrollToBlockUtils.isExpandCollapsed;
|
|
562
|
+
}
|
|
563
|
+
});
|
|
522
564
|
Object.defineProperty(exports, "messages", {
|
|
523
565
|
enumerable: true,
|
|
524
566
|
get: function get() {
|
|
@@ -530,4 +572,5 @@ var _key = require("./key");
|
|
|
530
572
|
var _keyDeprecated = require("./key-deprecated");
|
|
531
573
|
var _rank = require("./rank");
|
|
532
574
|
var _rankDeprecated = require("./rank-deprecated");
|
|
533
|
-
var _blockLink = require("./block-link");
|
|
575
|
+
var _blockLink = require("./block-link");
|
|
576
|
+
var _scrollToBlockUtils = require("./scroll-to-block-utils");
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.expandElement = exports.expandAllParentsThenScroll = exports.SCROLL_TO_BLOCK_TIMING = void 0;
|
|
8
|
+
exports.findNodeWithExpandParents = findNodeWithExpandParents;
|
|
9
|
+
exports.isExpandCollapsed = exports.getLocalIdSelector = exports.findParentExpands = void 0;
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
+
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
|
+
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
|
+
/**
|
|
15
|
+
* Shared utilities for scrolling to block elements with expand node support.
|
|
16
|
+
* Used by both Confluence's useScrollOnUrlChange and platform renderer's useScrollToBlock.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Timing constants for expand animation and DOM update delays.
|
|
21
|
+
* These values are tuned for the expand component's behavior and React's update cycle.
|
|
22
|
+
*/
|
|
23
|
+
var SCROLL_TO_BLOCK_TIMING = exports.SCROLL_TO_BLOCK_TIMING = {
|
|
24
|
+
/** Minimal delay for DOM/React updates after expanding (no animation in expand component). */
|
|
25
|
+
DOM_UPDATE_DELAY: 50,
|
|
26
|
+
/** Delay when expand operation fails and needs retry. */
|
|
27
|
+
RETRY_DELAY: 100,
|
|
28
|
+
/** Maximum number of retry attempts before giving up and scrolling anyway. */
|
|
29
|
+
MAX_ATTEMPTS: 5,
|
|
30
|
+
/** Maximum depth of nested expands to search (prevents infinite loops). */
|
|
31
|
+
MAX_EXPAND_DEPTH: 2
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Find a node by its localId in an ADF document and determine if it has expand or nestedExpand parents.
|
|
35
|
+
* This is used to identify nodes that may be hidden inside collapsed expands.
|
|
36
|
+
*
|
|
37
|
+
* @param adfDoc - The ADF document to search
|
|
38
|
+
* @param targetLocalId - The localId to search for
|
|
39
|
+
* @returns NodeWithExpandParents if found, undefined otherwise
|
|
40
|
+
*/
|
|
41
|
+
function findNodeWithExpandParents(adfDoc, targetLocalId) {
|
|
42
|
+
var result;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Recursive helper to traverse the ADF document and track expand ancestors.
|
|
46
|
+
* We use recursion to properly maintain the expand ancestor stack.
|
|
47
|
+
*/
|
|
48
|
+
var _traverse = function traverse(node, expandAncestors) {
|
|
49
|
+
var _node$attrs, _node$attrs2;
|
|
50
|
+
// If we already found the target, stop traversing
|
|
51
|
+
if (result) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Check if this is the target node by localId
|
|
56
|
+
if ((node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) === targetLocalId) {
|
|
57
|
+
result = {
|
|
58
|
+
expandParentLocalIds: (0, _toConsumableArray2.default)(expandAncestors) // Copy the array
|
|
59
|
+
};
|
|
60
|
+
return false; // Stop traversing
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Check if this node is an expand or nestedExpand
|
|
64
|
+
var isExpand = (node === null || node === void 0 ? void 0 : node.type) === 'expand' || (node === null || node === void 0 ? void 0 : node.type) === 'nestedExpand';
|
|
65
|
+
var newExpandAncestors = isExpand && node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.localId ? [].concat((0, _toConsumableArray2.default)(expandAncestors), [node.attrs.localId]) : expandAncestors;
|
|
66
|
+
|
|
67
|
+
// Traverse children if they exist
|
|
68
|
+
if (node !== null && node !== void 0 && node.content && Array.isArray(node.content)) {
|
|
69
|
+
var _iterator = _createForOfIteratorHelper(node.content),
|
|
70
|
+
_step;
|
|
71
|
+
try {
|
|
72
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
73
|
+
var child = _step.value;
|
|
74
|
+
if (result || !child) {
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
_traverse(child, newExpandAncestors);
|
|
78
|
+
}
|
|
79
|
+
} catch (err) {
|
|
80
|
+
_iterator.e(err);
|
|
81
|
+
} finally {
|
|
82
|
+
_iterator.f();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return !result; // Continue if we haven't found it yet
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// Start traversal from the root
|
|
89
|
+
_traverse(adfDoc, []);
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Find all parent expand elements that contain the target element.
|
|
95
|
+
* Searches up the DOM tree to find expand or nestedExpand containers.
|
|
96
|
+
*
|
|
97
|
+
* This function limits the search depth to prevent infinite loops and performance issues.
|
|
98
|
+
* The default maxDepth of 2 is chosen because:
|
|
99
|
+
* - Most use cases have 0-2 levels of nesting
|
|
100
|
+
* - Searching deeper can impact performance
|
|
101
|
+
* - Users rarely nest expands more than 2 levels deep
|
|
102
|
+
*
|
|
103
|
+
* @param element - The target element to find parents for.
|
|
104
|
+
* @param maxDepth - Maximum depth to search (default: 2). This is the maximum number of
|
|
105
|
+
* expand ancestors to find, starting from the target element.
|
|
106
|
+
* @returns Array of expand containers ordered from outermost to innermost.
|
|
107
|
+
* For example, if element is inside expand B which is inside expand A,
|
|
108
|
+
* this returns [expandA, expandB].
|
|
109
|
+
*/
|
|
110
|
+
var findParentExpands = exports.findParentExpands = function findParentExpands(element) {
|
|
111
|
+
var maxDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SCROLL_TO_BLOCK_TIMING.MAX_EXPAND_DEPTH;
|
|
112
|
+
var expands = [];
|
|
113
|
+
var currentElement = element;
|
|
114
|
+
var depth = 0;
|
|
115
|
+
while (currentElement && depth < maxDepth) {
|
|
116
|
+
// Look for expand container - handles both "expand" and "nestedExpand" types
|
|
117
|
+
var expandContainer = currentElement.closest('[data-node-type="expand"], [data-node-type="nestedExpand"]');
|
|
118
|
+
if (!expandContainer || expands.includes(expandContainer)) {
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
expands.push(expandContainer);
|
|
122
|
+
currentElement = expandContainer.parentElement;
|
|
123
|
+
depth++;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Return in reverse order so we expand from outermost to innermost
|
|
127
|
+
return expands.reverse();
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Check if an expand node is currently collapsed.
|
|
132
|
+
*
|
|
133
|
+
* Uses two methods to determine collapse state:
|
|
134
|
+
* 1. First checks aria-expanded attribute on the toggle button (most reliable).
|
|
135
|
+
* 2. Falls back to checking content div visibility via computed styles.
|
|
136
|
+
*
|
|
137
|
+
* @param expandContainer - The expand container element.
|
|
138
|
+
* @returns True if the expand is collapsed, false if expanded or state cannot be determined.
|
|
139
|
+
*/
|
|
140
|
+
var isExpandCollapsed = exports.isExpandCollapsed = function isExpandCollapsed(expandContainer) {
|
|
141
|
+
// Check for aria-expanded attribute on the toggle button
|
|
142
|
+
var toggleButton = expandContainer.querySelector('[aria-expanded]');
|
|
143
|
+
if (toggleButton && toggleButton instanceof HTMLElement) {
|
|
144
|
+
return toggleButton.getAttribute('aria-expanded') === 'false';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Fallback: check if content div is hidden using the actual class name
|
|
148
|
+
var contentDiv = expandContainer.querySelector('.ak-editor-expand__content');
|
|
149
|
+
if (contentDiv && contentDiv instanceof HTMLElement) {
|
|
150
|
+
var computedStyle = window.getComputedStyle(contentDiv);
|
|
151
|
+
return computedStyle.display === 'none' || computedStyle.visibility === 'hidden' || contentDiv.hidden;
|
|
152
|
+
}
|
|
153
|
+
return false;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Expand a collapsed expand node by clicking its toggle button.
|
|
158
|
+
*
|
|
159
|
+
* This function finds the toggle button with aria-expanded="false" and programmatically
|
|
160
|
+
* clicks it to expand the node. It does not wait for the expansion to complete.
|
|
161
|
+
*
|
|
162
|
+
* @param expandContainer - The expand container element.
|
|
163
|
+
* @returns True if the toggle button was found and clicked, false otherwise.
|
|
164
|
+
*/
|
|
165
|
+
var expandElement = exports.expandElement = function expandElement(expandContainer) {
|
|
166
|
+
// Find and click the toggle button
|
|
167
|
+
var toggleButton = expandContainer.querySelector('[aria-expanded="false"]');
|
|
168
|
+
if (toggleButton && toggleButton instanceof HTMLElement) {
|
|
169
|
+
toggleButton.click();
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
return false;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Expand all parent expands then scroll to the element.
|
|
177
|
+
*
|
|
178
|
+
* This is the main entry point for scrolling to elements that may be hidden inside collapsed expands.
|
|
179
|
+
* It handles nested expands by expanding them one at a time from outermost to innermost,
|
|
180
|
+
* waiting for DOM updates between each expansion.
|
|
181
|
+
*
|
|
182
|
+
* The function uses a recursive approach with retry logic to handle:
|
|
183
|
+
* - Nested expands that need sequential expansion
|
|
184
|
+
* - DOM updates that may take time to reflect
|
|
185
|
+
* - Failed expand operations (e.g., if toggle button is temporarily unavailable)
|
|
186
|
+
* - Disconnected elements (removed from DOM)
|
|
187
|
+
*
|
|
188
|
+
* After all parent expands are open (or max attempts reached), scrolls the element into view
|
|
189
|
+
* with smooth behavior and centered in the viewport.
|
|
190
|
+
*
|
|
191
|
+
* @param element - The target element to scroll to.
|
|
192
|
+
* @param attempt - Current attempt number (used internally for retry logic, starts at 0).
|
|
193
|
+
* @returns A cleanup function that cancels any pending timeouts. Call this when the operation
|
|
194
|
+
* should be aborted (e.g., component unmount, navigation, or new scroll request).
|
|
195
|
+
*/
|
|
196
|
+
var _expandAllParentsThenScroll = exports.expandAllParentsThenScroll = function expandAllParentsThenScroll(element) {
|
|
197
|
+
var attempt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
198
|
+
var MAX_EXPAND_DEPTH = SCROLL_TO_BLOCK_TIMING.MAX_EXPAND_DEPTH,
|
|
199
|
+
MAX_ATTEMPTS = SCROLL_TO_BLOCK_TIMING.MAX_ATTEMPTS,
|
|
200
|
+
DOM_UPDATE_DELAY = SCROLL_TO_BLOCK_TIMING.DOM_UPDATE_DELAY,
|
|
201
|
+
RETRY_DELAY = SCROLL_TO_BLOCK_TIMING.RETRY_DELAY;
|
|
202
|
+
|
|
203
|
+
// Store timeout ID and nested cleanup function so they can be cancelled.
|
|
204
|
+
var timeoutId = null;
|
|
205
|
+
var nestedCleanup = null;
|
|
206
|
+
|
|
207
|
+
// Cleanup function that cancels pending timeout and any nested operations.
|
|
208
|
+
var cleanup = function cleanup() {
|
|
209
|
+
if (timeoutId !== null) {
|
|
210
|
+
clearTimeout(timeoutId);
|
|
211
|
+
timeoutId = null;
|
|
212
|
+
}
|
|
213
|
+
if (nestedCleanup) {
|
|
214
|
+
nestedCleanup();
|
|
215
|
+
nestedCleanup = null;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
// Guard against element being disconnected from DOM or exceeding max attempts.
|
|
220
|
+
if (attempt >= MAX_ATTEMPTS || !element.isConnected) {
|
|
221
|
+
// Max attempts reached or element disconnected, scroll anyway.
|
|
222
|
+
if (element.isConnected) {
|
|
223
|
+
element.scrollIntoView({
|
|
224
|
+
behavior: 'smooth',
|
|
225
|
+
block: 'center'
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
return cleanup;
|
|
229
|
+
}
|
|
230
|
+
try {
|
|
231
|
+
// Step 1: Find all parent expands (outermost to innermost).
|
|
232
|
+
var parentExpands = findParentExpands(element, MAX_EXPAND_DEPTH);
|
|
233
|
+
|
|
234
|
+
// Step 2: Find any collapsed expands (filter out disconnected elements).
|
|
235
|
+
var collapsedExpands = parentExpands.filter(function (expandContainer) {
|
|
236
|
+
return expandContainer.isConnected && isExpandCollapsed(expandContainer);
|
|
237
|
+
});
|
|
238
|
+
if (collapsedExpands.length === 0) {
|
|
239
|
+
// All expands are open (or there are no expands), scroll to element.
|
|
240
|
+
element.scrollIntoView({
|
|
241
|
+
behavior: 'smooth',
|
|
242
|
+
block: 'center'
|
|
243
|
+
});
|
|
244
|
+
return cleanup;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Step 3: Expand ONLY the outermost collapsed expand first.
|
|
248
|
+
// This is critical for nested expands - we must expand parent before child.
|
|
249
|
+
var outermostCollapsed = collapsedExpands[0];
|
|
250
|
+
try {
|
|
251
|
+
var expanded = expandElement(outermostCollapsed);
|
|
252
|
+
if (expanded) {
|
|
253
|
+
// Successfully expanded, wait briefly for DOM update then recurse to handle any nested expands.
|
|
254
|
+
// Note: There's no animation, but we need a minimal delay for DOM/React updates.
|
|
255
|
+
timeoutId = setTimeout(function () {
|
|
256
|
+
try {
|
|
257
|
+
// Verify element is still connected before proceeding.
|
|
258
|
+
if (!element.isConnected) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// Recurse to handle any nested collapsed expands or retry if still collapsed.
|
|
263
|
+
nestedCleanup = _expandAllParentsThenScroll(element, attempt + 1);
|
|
264
|
+
} catch (_unused) {
|
|
265
|
+
// Fallback to simple scroll on error.
|
|
266
|
+
if (element.isConnected) {
|
|
267
|
+
element.scrollIntoView({
|
|
268
|
+
behavior: 'smooth',
|
|
269
|
+
block: 'center'
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}, DOM_UPDATE_DELAY);
|
|
274
|
+
} else {
|
|
275
|
+
// Failed to expand, retry with longer delay.
|
|
276
|
+
timeoutId = setTimeout(function () {
|
|
277
|
+
if (element.isConnected) {
|
|
278
|
+
nestedCleanup = _expandAllParentsThenScroll(element, attempt + 1);
|
|
279
|
+
}
|
|
280
|
+
}, RETRY_DELAY);
|
|
281
|
+
}
|
|
282
|
+
} catch (_unused2) {
|
|
283
|
+
// Retry on error.
|
|
284
|
+
timeoutId = setTimeout(function () {
|
|
285
|
+
if (element.isConnected) {
|
|
286
|
+
nestedCleanup = _expandAllParentsThenScroll(element, attempt + 1);
|
|
287
|
+
}
|
|
288
|
+
}, RETRY_DELAY);
|
|
289
|
+
}
|
|
290
|
+
} catch (_unused3) {
|
|
291
|
+
// Fallback to simple scroll on error.
|
|
292
|
+
if (element.isConnected) {
|
|
293
|
+
element.scrollIntoView({
|
|
294
|
+
behavior: 'smooth',
|
|
295
|
+
block: 'center'
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return cleanup;
|
|
300
|
+
};
|
|
301
|
+
var getLocalIdSelector = exports.getLocalIdSelector = function getLocalIdSelector(localId, container) {
|
|
302
|
+
// Check if the element with data-local-id exists
|
|
303
|
+
var element = container.querySelector("[data-local-id=\"".concat(localId, "\"]"));
|
|
304
|
+
if (element) {
|
|
305
|
+
return element;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// Special case for decision lists and task lists which already have localId
|
|
309
|
+
element = container.querySelector("[data-decision-list-local-id=\"".concat(localId, "\"]"));
|
|
310
|
+
if (element) {
|
|
311
|
+
return element;
|
|
312
|
+
}
|
|
313
|
+
element = container.querySelector("[data-task-list-local-id=\"".concat(localId, "\"]"));
|
|
314
|
+
if (element) {
|
|
315
|
+
return element;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// Special case for tables which use data-table-local-id
|
|
319
|
+
element = container.querySelector("[data-table-local-id=\"".concat(localId, "\"]"));
|
|
320
|
+
if (element) {
|
|
321
|
+
return element;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// Special case for extension, smart cards and media which use lowercase localid
|
|
325
|
+
element = container.querySelector("[localid=\"".concat(localId, "\"]"));
|
|
326
|
+
if (element) {
|
|
327
|
+
return element;
|
|
328
|
+
}
|
|
329
|
+
return null;
|
|
330
|
+
};
|
|
@@ -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 = "
|
|
22
|
+
var packageVersion = "111.11.7";
|
|
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 = "
|
|
27
|
+
var packageVersion = "111.11.7";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -105,6 +105,8 @@ export let ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
105
105
|
ACTION["REACT_NODEVIEW_RENDERED"] = "reactNodeViewRendered";
|
|
106
106
|
ACTION["REFERENCE_SYNCED_BLOCK_DELETE"] = "referenceSyncedBlockDelete";
|
|
107
107
|
ACTION["REFERENCE_SYNCED_BLOCK_UPDATE"] = "referenceSyncedBlockUpdate";
|
|
108
|
+
ACTION["REFERENCE_SYNCED_BLOCK_UNSYNC"] = "referenceSyncedBlockUnsync";
|
|
109
|
+
ACTION["REFERENCE_SYNCED_BLOCK_COPY"] = "referenceSyncedBlockCopy";
|
|
108
110
|
ACTION["REPLACED_ALL"] = "replacedAll";
|
|
109
111
|
ACTION["REPLACED_ONE"] = "replacedOne";
|
|
110
112
|
ACTION["RESOLVED"] = "resolved";
|
|
@@ -122,6 +124,9 @@ export let ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
122
124
|
ACTION["SYNCED_BLOCK_FETCH_REFERENCES"] = "syncedBlockFetchReferences";
|
|
123
125
|
ACTION["SYNCED_BLOCK_DELETE"] = "syncedBlockDelete";
|
|
124
126
|
ACTION["SYNCED_BLOCK_GET_SOURCE_INFO"] = "syncedBlockGetSourceInfo";
|
|
127
|
+
ACTION["SYNCED_BLOCK_UNSYNC"] = "syncedBlockUnsync";
|
|
128
|
+
ACTION["SYNCED_BLOCK_EDIT_SOURCE"] = "syncedBlockEditSource";
|
|
129
|
+
ACTION["SYNCED_BLOCK_VIEW_SYNCED_LOCATIONS"] = "syncedBlockViewSyncedLocations";
|
|
125
130
|
ACTION["SYNCHRONY_DISCONNECTED"] = "synchronyDisconnected";
|
|
126
131
|
ACTION["SYNCHRONY_ENTITY_ERROR"] = "synchronyEntityError";
|
|
127
132
|
ACTION["SYNCHRONY_ERROR"] = "synchronyError";
|
|
@@ -249,6 +254,7 @@ export let INPUT_METHOD = /*#__PURE__*/function (INPUT_METHOD) {
|
|
|
249
254
|
INPUT_METHOD["DOUBLE_CLICK"] = "doubleClick";
|
|
250
255
|
INPUT_METHOD["META_CLICK"] = "metaClick";
|
|
251
256
|
INPUT_METHOD["INLINE_SUGGESTION_FLOATING_TB"] = "inlineSuggestionFloatingToolbar";
|
|
257
|
+
INPUT_METHOD["SYNCED_BLOCK_TB"] = "syncedBlockToolbar";
|
|
252
258
|
INPUT_METHOD["BLOCK_MENU"] = "blockMenu";
|
|
253
259
|
INPUT_METHOD["SMART_LINK"] = "smartLink";
|
|
254
260
|
return INPUT_METHOD;
|
|
@@ -535,6 +541,7 @@ export let ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
|
|
|
535
541
|
ACTION_SUBJECT_ID["EDITOR_PLUGIN_SELECTION_EXTENSION_COMPONENT"] = "editorPluginSelectionExtensionComponent";
|
|
536
542
|
ACTION_SUBJECT_ID["TRANSFORM"] = "transform";
|
|
537
543
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_TOOLBAR"] = "syncedBlockToolbar";
|
|
544
|
+
ACTION_SUBJECT_ID["SYNCED_BLOCK_COPY"] = "syncedBlockCopy";
|
|
538
545
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_SOURCE_URL"] = "syncedBlockSourceUrl";
|
|
539
546
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_UPDATE_CACHE"] = "syncedBlockUpdateCache";
|
|
540
547
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_UPDATE"] = "syncedBlockUpdate";
|
|
@@ -546,6 +553,7 @@ export let ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
|
|
|
546
553
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_GET_SOURCE_INFO"] = "syncedBlockGetSourceInfo";
|
|
547
554
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_FETCH"] = "syncedBlockFetch";
|
|
548
555
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_FETCH_REFERENCES"] = "syncedBlockFetchReferences";
|
|
556
|
+
ACTION_SUBJECT_ID["SYNCED_BLOCK_CLICK_SYNCED_LOCATION"] = "syncedBlockClickSyncedLocation";
|
|
549
557
|
ACTION_SUBJECT_ID["TABLE_STICKY_HEADER"] = "tableStickyHeader";
|
|
550
558
|
return ACTION_SUBJECT_ID;
|
|
551
559
|
}({});
|