@atlaskit/renderer 123.1.1 → 123.2.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 +16 -0
- package/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/react/nodes/blockCard.js +5 -2
- package/dist/cjs/react/nodes/bodiedExtension.js +4 -3
- package/dist/cjs/react/nodes/multiBodiedExtension.js +2 -1
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/annotations/hooks/use-events.js +0 -4
- package/dist/cjs/ui/annotations/hover/mounter.js +12 -15
- package/dist/cjs/ui/annotations/selection/mounter.js +12 -14
- package/dist/cjs/ui/hooks/useScrollToLocalId.js +78 -7
- package/dist/es2019/react/nodes/blockCard.js +5 -2
- package/dist/es2019/react/nodes/bodiedExtension.js +4 -3
- package/dist/es2019/react/nodes/multiBodiedExtension.js +2 -1
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/annotations/hooks/use-events.js +0 -4
- package/dist/es2019/ui/annotations/hover/mounter.js +12 -15
- package/dist/es2019/ui/annotations/selection/mounter.js +12 -14
- package/dist/es2019/ui/hooks/useScrollToLocalId.js +78 -7
- package/dist/esm/react/nodes/blockCard.js +5 -2
- package/dist/esm/react/nodes/bodiedExtension.js +4 -3
- package/dist/esm/react/nodes/multiBodiedExtension.js +2 -1
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/annotations/hooks/use-events.js +0 -4
- package/dist/esm/ui/annotations/hover/mounter.js +12 -15
- package/dist/esm/ui/annotations/selection/mounter.js +12 -14
- package/dist/esm/ui/hooks/useScrollToLocalId.js +78 -7
- package/dist/types/react/nodes/blockCard.d.ts +1 -0
- package/dist/types/react/nodes/index.d.ts +1 -0
- package/dist/types-ts4.5/react/nodes/blockCard.d.ts +1 -0
- package/dist/types-ts4.5/react/nodes/index.d.ts +1 -0
- package/package.json +6 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 123.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`10f7cde204c1e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/10f7cde204c1e) -
|
|
8
|
+
Increase heading 1 ranking in block menu and add date-local-id on bodiedExtension and blockCard in
|
|
9
|
+
renderer
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 123.2.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [`7d5ceec8d7064`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7d5ceec8d7064) -
|
|
17
|
+
Removed feature gates for cleanup
|
|
18
|
+
|
|
3
19
|
## 123.1.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -39,7 +39,8 @@ function BlockCard(props) {
|
|
|
39
39
|
data = props.data,
|
|
40
40
|
eventHandlers = props.eventHandlers,
|
|
41
41
|
smartLinks = props.smartLinks,
|
|
42
|
-
isNodeNested = props.isNodeNested
|
|
42
|
+
isNodeNested = props.isNodeNested,
|
|
43
|
+
localId = props.localId;
|
|
43
44
|
var portal = (0, _PortalContext.usePortal)(props);
|
|
44
45
|
var _ref = smartLinks || {},
|
|
45
46
|
actionOptions = _ref.actionOptions;
|
|
@@ -107,6 +108,7 @@ function BlockCard(props) {
|
|
|
107
108
|
return (0, _react.jsx)("div", {
|
|
108
109
|
css: datasourceContainerStyle,
|
|
109
110
|
"data-testid": "renderer-datasource-table",
|
|
111
|
+
"data-local-id": localId,
|
|
110
112
|
style: {
|
|
111
113
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
112
114
|
width: isNodeNested ? '100%' : (0, _utils.calcBreakoutWidth)(layout, width)
|
|
@@ -155,7 +157,8 @@ function BlockCard(props) {
|
|
|
155
157
|
className: "blockCardView-content-wrap",
|
|
156
158
|
"data-block-card": true,
|
|
157
159
|
"data-card-data": data ? JSON.stringify(data) : undefined,
|
|
158
|
-
"data-card-url": url
|
|
160
|
+
"data-card-url": url,
|
|
161
|
+
"data-local-id": localId
|
|
159
162
|
}, (0, _react.jsx)(_fallback.CardErrorBoundary, (0, _extends2.default)({
|
|
160
163
|
unsupportedComponent: _ui.UnsupportedBlock
|
|
161
164
|
// Ignored via go/ees005
|
|
@@ -45,7 +45,8 @@ var BodiedExtension = function BodiedExtension(props) {
|
|
|
45
45
|
extensionKey = props.extensionKey,
|
|
46
46
|
extensionType = props.extensionType,
|
|
47
47
|
parameters = props.parameters,
|
|
48
|
-
extensionViewportSizes = props.extensionViewportSizes
|
|
48
|
+
extensionViewportSizes = props.extensionViewportSizes,
|
|
49
|
+
localId = props.localId;
|
|
49
50
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
50
51
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
51
52
|
var removeOverflow = _react.default.Children.toArray(children)
|
|
@@ -75,7 +76,7 @@ var BodiedExtension = function BodiedExtension(props) {
|
|
|
75
76
|
// Return the content directly if it's a valid JSX.Element
|
|
76
77
|
return (0, _extension.renderExtension)(result, layout, {
|
|
77
78
|
isTopLevel: path.length < 1
|
|
78
|
-
}, removeOverflow, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes);
|
|
79
|
+
}, removeOverflow, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes, undefined, localId);
|
|
79
80
|
}
|
|
80
81
|
} catch (e) {
|
|
81
82
|
/** We don't want this error to block renderer */
|
|
@@ -85,7 +86,7 @@ var BodiedExtension = function BodiedExtension(props) {
|
|
|
85
86
|
// Always return default content if anything goes wrong
|
|
86
87
|
return (0, _extension.renderExtension)(children, layout, {
|
|
87
88
|
isTopLevel: path.length < 1
|
|
88
|
-
}, removeOverflow, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes);
|
|
89
|
+
}, removeOverflow, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes, undefined, localId);
|
|
89
90
|
}))));
|
|
90
91
|
};
|
|
91
92
|
var _default = exports.default = BodiedExtension;
|
|
@@ -135,7 +135,8 @@ var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
|
135
135
|
"data-testid": "multiBodiedExtension--container",
|
|
136
136
|
"data-multiBodiedExtension-container": true,
|
|
137
137
|
"data-active-child-index": activeChildIndex,
|
|
138
|
-
"data-layout": layout
|
|
138
|
+
"data-layout": layout,
|
|
139
|
+
"data-local-id": localId
|
|
139
140
|
}, (0, _react.jsx)(_ui.WidthConsumer, null, function (_ref4) {
|
|
140
141
|
var width = _ref4.width;
|
|
141
142
|
return (0, _react.jsx)(MultiBodiedExtensionWrapper, {
|
|
@@ -63,7 +63,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
63
63
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
64
64
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
65
65
|
var packageName = "@atlaskit/renderer";
|
|
66
|
-
var packageVersion = "
|
|
66
|
+
var packageVersion = "0.0.0-development";
|
|
67
67
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
68
68
|
containerName: 'ak-renderer-wrapper',
|
|
69
69
|
containerType: 'inline-size'
|
|
@@ -12,7 +12,6 @@ var _types = require("@atlaskit/editor-common/types");
|
|
|
12
12
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
13
13
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
14
14
|
var _types2 = require("@atlaskit/analytics-listeners/types");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
var _AnnotationManagerContext = require("../contexts/AnnotationManagerContext");
|
|
17
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -97,9 +96,6 @@ var useHasFocusEvent = exports.useHasFocusEvent = function useHasFocusEvent(_ref
|
|
|
97
96
|
};
|
|
98
97
|
var removeHoverEffect = function removeHoverEffect() {
|
|
99
98
|
setIsHovered(false);
|
|
100
|
-
if (document.activeElement instanceof HTMLElement && !(0, _platformFeatureFlags.fg)('confluence_frontend_comments_panel_editor_focus')) {
|
|
101
|
-
document.activeElement.blur();
|
|
102
|
-
}
|
|
103
99
|
};
|
|
104
100
|
if (!isAnnotationManagerEnabled) {
|
|
105
101
|
updateSubscriber.on(_types.AnnotationUpdateEvent.SET_ANNOTATION_FOCUS, cb);
|
|
@@ -12,7 +12,6 @@ var _types = require("@atlaskit/analytics-listeners/types");
|
|
|
12
12
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
13
|
var _RendererActionsContext = require("../../RendererActionsContext");
|
|
14
14
|
var _AnnotationRangeContext = require("../contexts/AnnotationRangeContext");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
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); }
|
|
17
16
|
var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props) {
|
|
18
17
|
var Component = props.component,
|
|
@@ -102,20 +101,18 @@ var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props
|
|
|
102
101
|
});
|
|
103
102
|
var positionToAnnotate = hoverDraftDocumentPosition || documentPosition;
|
|
104
103
|
if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}).fire(_types.FabricChannel.editor);
|
|
118
|
-
}
|
|
104
|
+
if (createAnalyticsEvent) {
|
|
105
|
+
createAnalyticsEvent({
|
|
106
|
+
action: _analytics.ACTION.CREATE_NOT_ALLOWED,
|
|
107
|
+
actionSubject: _analytics.ACTION_SUBJECT.ANNOTATION,
|
|
108
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
109
|
+
attributes: {
|
|
110
|
+
positionToAnnotate: positionToAnnotate,
|
|
111
|
+
applyAnnotationMissing: !applyAnnotation,
|
|
112
|
+
annotationId: options.annotationId
|
|
113
|
+
},
|
|
114
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
115
|
+
}).fire(_types.FabricChannel.editor);
|
|
119
116
|
}
|
|
120
117
|
return false;
|
|
121
118
|
}
|
|
@@ -153,20 +153,18 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
153
153
|
// use platform_editor_comments_api_manager here so we can clear the code path when the flag is removed
|
|
154
154
|
var positionToAnnotate = (0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager') ? documentPosition : selectionDraftDocumentPosition || documentPosition;
|
|
155
155
|
if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
|
|
156
|
-
if (
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}).fire(_types.FabricChannel.editor);
|
|
169
|
-
}
|
|
156
|
+
if (createAnalyticsEvent) {
|
|
157
|
+
createAnalyticsEvent({
|
|
158
|
+
action: _analytics.ACTION.CREATE_NOT_ALLOWED,
|
|
159
|
+
actionSubject: _analytics.ACTION_SUBJECT.ANNOTATION,
|
|
160
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
161
|
+
attributes: {
|
|
162
|
+
positionToAnnotate: positionToAnnotate,
|
|
163
|
+
applyAnnotationMissing: !applyAnnotation,
|
|
164
|
+
annotationId: options.annotationId
|
|
165
|
+
},
|
|
166
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
167
|
+
}).fire(_types.FabricChannel.editor);
|
|
170
168
|
}
|
|
171
169
|
return false;
|
|
172
170
|
}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useScrollToLocalId = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
+
var _browserApis = require("@atlaskit/browser-apis");
|
|
8
9
|
// Find editor node dom with localId - similar to confluence useScrollOnUrlChange.ts
|
|
9
10
|
var getLocalIdSelector = function getLocalIdSelector(localId, container) {
|
|
10
11
|
// Check if the element with data-local-id exists
|
|
@@ -38,6 +39,7 @@ var getLocalIdSelector = function getLocalIdSelector(localId, container) {
|
|
|
38
39
|
};
|
|
39
40
|
var useScrollToLocalId = exports.useScrollToLocalId = function useScrollToLocalId(containerRef, shouldScrollToLocalId) {
|
|
40
41
|
(0, _react.useEffect)(function () {
|
|
42
|
+
var _getDocument;
|
|
41
43
|
// Only run in browser environment
|
|
42
44
|
if (typeof window === 'undefined' || !(containerRef !== null && containerRef !== void 0 && containerRef.current) || !shouldScrollToLocalId) {
|
|
43
45
|
return;
|
|
@@ -46,14 +48,83 @@ var useScrollToLocalId = exports.useScrollToLocalId = function useScrollToLocalI
|
|
|
46
48
|
// Parse URL parameters for block ID
|
|
47
49
|
var urlParams = new URLSearchParams(window.location.search);
|
|
48
50
|
var blockId = urlParams.get('block');
|
|
49
|
-
if (blockId) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
if (!blockId) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
var retryCount = 0;
|
|
55
|
+
// 5 second timeout based on dashboard showing ~4.96s TTI load time
|
|
56
|
+
var maxRetries = 20; // Maximum 20 retries (5 seconds at 250ms intervals)
|
|
57
|
+
var retryInterval = 250; // Check every 250ms
|
|
58
|
+
var intervalId = null;
|
|
59
|
+
var scrollToElement = function scrollToElement() {
|
|
60
|
+
if (containerRef !== null && containerRef !== void 0 && containerRef.current) {
|
|
61
|
+
var element = getLocalIdSelector(blockId, containerRef.current);
|
|
62
|
+
if (element) {
|
|
63
|
+
element.scrollIntoView({
|
|
64
|
+
behavior: 'smooth'
|
|
65
|
+
});
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
};
|
|
71
|
+
var attemptScroll = function attemptScroll() {
|
|
72
|
+
retryCount++;
|
|
73
|
+
|
|
74
|
+
// Try to scroll to element
|
|
75
|
+
if (scrollToElement()) {
|
|
76
|
+
if (intervalId) {
|
|
77
|
+
clearInterval(intervalId);
|
|
78
|
+
intervalId = null;
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Stop retrying if we've exceeded max retries
|
|
84
|
+
if (retryCount >= maxRetries) {
|
|
85
|
+
if (intervalId) {
|
|
86
|
+
clearInterval(intervalId);
|
|
87
|
+
intervalId = null;
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
56
90
|
}
|
|
91
|
+
return false;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// Try to scroll immediately
|
|
95
|
+
if (attemptScroll()) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (((_getDocument = (0, _browserApis.getDocument)()) === null || _getDocument === void 0 ? void 0 : _getDocument.readyState) === 'complete') {
|
|
99
|
+
// Document is already ready, try a few more times with delays
|
|
100
|
+
// This handles cases where elements are added after document ready
|
|
101
|
+
intervalId = setInterval(function () {
|
|
102
|
+
attemptScroll();
|
|
103
|
+
}, retryInterval);
|
|
104
|
+
} else {
|
|
105
|
+
// Document not ready yet, wait for it and then retry
|
|
106
|
+
intervalId = setInterval(function () {
|
|
107
|
+
var _getDocument2;
|
|
108
|
+
if (((_getDocument2 = (0, _browserApis.getDocument)()) === null || _getDocument2 === void 0 ? void 0 : _getDocument2.readyState) === 'complete') {
|
|
109
|
+
attemptScroll();
|
|
110
|
+
} else if (retryCount >= maxRetries) {
|
|
111
|
+
// Stop retrying even if document isn't ready
|
|
112
|
+
if (intervalId) {
|
|
113
|
+
clearInterval(intervalId);
|
|
114
|
+
intervalId = null;
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
retryCount++;
|
|
118
|
+
}
|
|
119
|
+
}, retryInterval);
|
|
57
120
|
}
|
|
121
|
+
|
|
122
|
+
// Cleanup function
|
|
123
|
+
return function () {
|
|
124
|
+
if (intervalId) {
|
|
125
|
+
clearInterval(intervalId);
|
|
126
|
+
intervalId = null;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
58
129
|
}, [containerRef, shouldScrollToLocalId]);
|
|
59
130
|
};
|
|
@@ -32,7 +32,8 @@ export default function BlockCard(props) {
|
|
|
32
32
|
data,
|
|
33
33
|
eventHandlers,
|
|
34
34
|
smartLinks,
|
|
35
|
-
isNodeNested
|
|
35
|
+
isNodeNested,
|
|
36
|
+
localId
|
|
36
37
|
} = props;
|
|
37
38
|
const portal = usePortal(props);
|
|
38
39
|
const {
|
|
@@ -95,6 +96,7 @@ export default function BlockCard(props) {
|
|
|
95
96
|
}) => jsx("div", {
|
|
96
97
|
css: datasourceContainerStyle,
|
|
97
98
|
"data-testid": "renderer-datasource-table",
|
|
99
|
+
"data-local-id": localId,
|
|
98
100
|
style: {
|
|
99
101
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
100
102
|
width: isNodeNested ? '100%' : calcBreakoutWidth(layout, width)
|
|
@@ -142,7 +144,8 @@ export default function BlockCard(props) {
|
|
|
142
144
|
className: "blockCardView-content-wrap",
|
|
143
145
|
"data-block-card": true,
|
|
144
146
|
"data-card-data": data ? JSON.stringify(data) : undefined,
|
|
145
|
-
"data-card-url": url
|
|
147
|
+
"data-card-url": url,
|
|
148
|
+
"data-local-id": localId
|
|
146
149
|
}, jsx(CardErrorBoundary, _extends({
|
|
147
150
|
unsupportedComponent: UnsupportedBlock
|
|
148
151
|
// Ignored via go/ees005
|
|
@@ -34,7 +34,8 @@ const BodiedExtension = props => {
|
|
|
34
34
|
extensionKey,
|
|
35
35
|
extensionType,
|
|
36
36
|
parameters,
|
|
37
|
-
extensionViewportSizes
|
|
37
|
+
extensionViewportSizes,
|
|
38
|
+
localId
|
|
38
39
|
} = props;
|
|
39
40
|
const {
|
|
40
41
|
createAnalyticsEvent
|
|
@@ -65,7 +66,7 @@ const BodiedExtension = props => {
|
|
|
65
66
|
// Return the content directly if it's a valid JSX.Element
|
|
66
67
|
return renderExtension(result, layout, {
|
|
67
68
|
isTopLevel: path.length < 1
|
|
68
|
-
}, removeOverflow, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes);
|
|
69
|
+
}, removeOverflow, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes, undefined, localId);
|
|
69
70
|
}
|
|
70
71
|
} catch (e) {
|
|
71
72
|
/** We don't want this error to block renderer */
|
|
@@ -75,7 +76,7 @@ const BodiedExtension = props => {
|
|
|
75
76
|
// Always return default content if anything goes wrong
|
|
76
77
|
return renderExtension(children, layout, {
|
|
77
78
|
isTopLevel: path.length < 1
|
|
78
|
-
}, removeOverflow, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes);
|
|
79
|
+
}, removeOverflow, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes, undefined, localId);
|
|
79
80
|
}))));
|
|
80
81
|
};
|
|
81
82
|
export default BodiedExtension;
|
|
@@ -129,7 +129,8 @@ const MultiBodiedExtension = props => {
|
|
|
129
129
|
"data-testid": "multiBodiedExtension--container",
|
|
130
130
|
"data-multiBodiedExtension-container": true,
|
|
131
131
|
"data-active-child-index": activeChildIndex,
|
|
132
|
-
"data-layout": layout
|
|
132
|
+
"data-layout": layout,
|
|
133
|
+
"data-local-id": localId
|
|
133
134
|
}, jsx(WidthConsumer, null, ({
|
|
134
135
|
width
|
|
135
136
|
}) => jsx(MultiBodiedExtensionWrapper, {
|
|
@@ -49,7 +49,7 @@ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equ
|
|
|
49
49
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
50
50
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
51
51
|
const packageName = "@atlaskit/renderer";
|
|
52
|
-
const packageVersion = "
|
|
52
|
+
const packageVersion = "0.0.0-development";
|
|
53
53
|
const setAsQueryContainerStyles = css({
|
|
54
54
|
containerName: 'ak-renderer-wrapper',
|
|
55
55
|
containerType: 'inline-size'
|
|
@@ -3,7 +3,6 @@ import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
|
|
|
3
3
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { FabricChannel } from '@atlaskit/analytics-listeners/types';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { useAnnotationManagerDispatch, useAnnotationManagerState } from '../contexts/AnnotationManagerContext';
|
|
8
7
|
export const useAnnotationStateByTypeEvent = ({
|
|
9
8
|
type,
|
|
@@ -92,9 +91,6 @@ export const useHasFocusEvent = ({
|
|
|
92
91
|
};
|
|
93
92
|
const removeHoverEffect = () => {
|
|
94
93
|
setIsHovered(false);
|
|
95
|
-
if (document.activeElement instanceof HTMLElement && !fg('confluence_frontend_comments_panel_editor_focus')) {
|
|
96
|
-
document.activeElement.blur();
|
|
97
|
-
}
|
|
98
94
|
};
|
|
99
95
|
if (!isAnnotationManagerEnabled) {
|
|
100
96
|
updateSubscriber.on(AnnotationUpdateEvent.SET_ANNOTATION_FOCUS, cb);
|
|
@@ -5,7 +5,6 @@ import { FabricChannel } from '@atlaskit/analytics-listeners/types';
|
|
|
5
5
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { RendererContext as ActionsContext } from '../../RendererActionsContext';
|
|
7
7
|
import { useAnnotationRangeDispatch, useAnnotationRangeState } from '../contexts/AnnotationRangeContext';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
export const Mounter = /*#__PURE__*/React.memo(props => {
|
|
10
9
|
const {
|
|
11
10
|
component: Component,
|
|
@@ -98,20 +97,18 @@ export const Mounter = /*#__PURE__*/React.memo(props => {
|
|
|
98
97
|
});
|
|
99
98
|
const positionToAnnotate = hoverDraftDocumentPosition || documentPosition;
|
|
100
99
|
if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}).fire(FabricChannel.editor);
|
|
114
|
-
}
|
|
100
|
+
if (createAnalyticsEvent) {
|
|
101
|
+
createAnalyticsEvent({
|
|
102
|
+
action: ACTION.CREATE_NOT_ALLOWED,
|
|
103
|
+
actionSubject: ACTION_SUBJECT.ANNOTATION,
|
|
104
|
+
actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
105
|
+
attributes: {
|
|
106
|
+
positionToAnnotate,
|
|
107
|
+
applyAnnotationMissing: !applyAnnotation,
|
|
108
|
+
annotationId: options.annotationId
|
|
109
|
+
},
|
|
110
|
+
eventType: EVENT_TYPE.TRACK
|
|
111
|
+
}).fire(FabricChannel.editor);
|
|
115
112
|
}
|
|
116
113
|
return false;
|
|
117
114
|
}
|
|
@@ -150,20 +150,18 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
150
150
|
// use platform_editor_comments_api_manager here so we can clear the code path when the flag is removed
|
|
151
151
|
const positionToAnnotate = fg('platform_editor_comments_api_manager') ? documentPosition : selectionDraftDocumentPosition || documentPosition;
|
|
152
152
|
if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}).fire(FabricChannel.editor);
|
|
166
|
-
}
|
|
153
|
+
if (createAnalyticsEvent) {
|
|
154
|
+
createAnalyticsEvent({
|
|
155
|
+
action: ACTION.CREATE_NOT_ALLOWED,
|
|
156
|
+
actionSubject: ACTION_SUBJECT.ANNOTATION,
|
|
157
|
+
actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
158
|
+
attributes: {
|
|
159
|
+
positionToAnnotate,
|
|
160
|
+
applyAnnotationMissing: !applyAnnotation,
|
|
161
|
+
annotationId: options.annotationId
|
|
162
|
+
},
|
|
163
|
+
eventType: EVENT_TYPE.TRACK
|
|
164
|
+
}).fire(FabricChannel.editor);
|
|
167
165
|
}
|
|
168
166
|
return false;
|
|
169
167
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
+
import { getDocument } from '@atlaskit/browser-apis';
|
|
2
3
|
|
|
3
4
|
// Find editor node dom with localId - similar to confluence useScrollOnUrlChange.ts
|
|
4
5
|
const getLocalIdSelector = (localId, container) => {
|
|
@@ -33,6 +34,7 @@ const getLocalIdSelector = (localId, container) => {
|
|
|
33
34
|
};
|
|
34
35
|
export const useScrollToLocalId = (containerRef, shouldScrollToLocalId) => {
|
|
35
36
|
useEffect(() => {
|
|
37
|
+
var _getDocument;
|
|
36
38
|
// Only run in browser environment
|
|
37
39
|
if (typeof window === 'undefined' || !(containerRef !== null && containerRef !== void 0 && containerRef.current) || !shouldScrollToLocalId) {
|
|
38
40
|
return;
|
|
@@ -41,14 +43,83 @@ export const useScrollToLocalId = (containerRef, shouldScrollToLocalId) => {
|
|
|
41
43
|
// Parse URL parameters for block ID
|
|
42
44
|
const urlParams = new URLSearchParams(window.location.search);
|
|
43
45
|
const blockId = urlParams.get('block');
|
|
44
|
-
if (blockId) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
if (!blockId) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
let retryCount = 0;
|
|
50
|
+
// 5 second timeout based on dashboard showing ~4.96s TTI load time
|
|
51
|
+
const maxRetries = 20; // Maximum 20 retries (5 seconds at 250ms intervals)
|
|
52
|
+
const retryInterval = 250; // Check every 250ms
|
|
53
|
+
let intervalId = null;
|
|
54
|
+
const scrollToElement = () => {
|
|
55
|
+
if (containerRef !== null && containerRef !== void 0 && containerRef.current) {
|
|
56
|
+
const element = getLocalIdSelector(blockId, containerRef.current);
|
|
57
|
+
if (element) {
|
|
58
|
+
element.scrollIntoView({
|
|
59
|
+
behavior: 'smooth'
|
|
60
|
+
});
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
};
|
|
66
|
+
const attemptScroll = () => {
|
|
67
|
+
retryCount++;
|
|
68
|
+
|
|
69
|
+
// Try to scroll to element
|
|
70
|
+
if (scrollToElement()) {
|
|
71
|
+
if (intervalId) {
|
|
72
|
+
clearInterval(intervalId);
|
|
73
|
+
intervalId = null;
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Stop retrying if we've exceeded max retries
|
|
79
|
+
if (retryCount >= maxRetries) {
|
|
80
|
+
if (intervalId) {
|
|
81
|
+
clearInterval(intervalId);
|
|
82
|
+
intervalId = null;
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
51
85
|
}
|
|
86
|
+
return false;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// Try to scroll immediately
|
|
90
|
+
if (attemptScroll()) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (((_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : _getDocument.readyState) === 'complete') {
|
|
94
|
+
// Document is already ready, try a few more times with delays
|
|
95
|
+
// This handles cases where elements are added after document ready
|
|
96
|
+
intervalId = setInterval(() => {
|
|
97
|
+
attemptScroll();
|
|
98
|
+
}, retryInterval);
|
|
99
|
+
} else {
|
|
100
|
+
// Document not ready yet, wait for it and then retry
|
|
101
|
+
intervalId = setInterval(() => {
|
|
102
|
+
var _getDocument2;
|
|
103
|
+
if (((_getDocument2 = getDocument()) === null || _getDocument2 === void 0 ? void 0 : _getDocument2.readyState) === 'complete') {
|
|
104
|
+
attemptScroll();
|
|
105
|
+
} else if (retryCount >= maxRetries) {
|
|
106
|
+
// Stop retrying even if document isn't ready
|
|
107
|
+
if (intervalId) {
|
|
108
|
+
clearInterval(intervalId);
|
|
109
|
+
intervalId = null;
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
retryCount++;
|
|
113
|
+
}
|
|
114
|
+
}, retryInterval);
|
|
52
115
|
}
|
|
116
|
+
|
|
117
|
+
// Cleanup function
|
|
118
|
+
return () => {
|
|
119
|
+
if (intervalId) {
|
|
120
|
+
clearInterval(intervalId);
|
|
121
|
+
intervalId = null;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
53
124
|
}, [containerRef, shouldScrollToLocalId]);
|
|
54
125
|
};
|
|
@@ -31,7 +31,8 @@ export default function BlockCard(props) {
|
|
|
31
31
|
data = props.data,
|
|
32
32
|
eventHandlers = props.eventHandlers,
|
|
33
33
|
smartLinks = props.smartLinks,
|
|
34
|
-
isNodeNested = props.isNodeNested
|
|
34
|
+
isNodeNested = props.isNodeNested,
|
|
35
|
+
localId = props.localId;
|
|
35
36
|
var portal = usePortal(props);
|
|
36
37
|
var _ref = smartLinks || {},
|
|
37
38
|
actionOptions = _ref.actionOptions;
|
|
@@ -99,6 +100,7 @@ export default function BlockCard(props) {
|
|
|
99
100
|
return jsx("div", {
|
|
100
101
|
css: datasourceContainerStyle,
|
|
101
102
|
"data-testid": "renderer-datasource-table",
|
|
103
|
+
"data-local-id": localId,
|
|
102
104
|
style: {
|
|
103
105
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
104
106
|
width: isNodeNested ? '100%' : calcBreakoutWidth(layout, width)
|
|
@@ -147,7 +149,8 @@ export default function BlockCard(props) {
|
|
|
147
149
|
className: "blockCardView-content-wrap",
|
|
148
150
|
"data-block-card": true,
|
|
149
151
|
"data-card-data": data ? JSON.stringify(data) : undefined,
|
|
150
|
-
"data-card-url": url
|
|
152
|
+
"data-card-url": url,
|
|
153
|
+
"data-local-id": localId
|
|
151
154
|
}, jsx(CardErrorBoundary, _extends({
|
|
152
155
|
unsupportedComponent: UnsupportedBlock
|
|
153
156
|
// Ignored via go/ees005
|
|
@@ -36,7 +36,8 @@ var BodiedExtension = function BodiedExtension(props) {
|
|
|
36
36
|
extensionKey = props.extensionKey,
|
|
37
37
|
extensionType = props.extensionType,
|
|
38
38
|
parameters = props.parameters,
|
|
39
|
-
extensionViewportSizes = props.extensionViewportSizes
|
|
39
|
+
extensionViewportSizes = props.extensionViewportSizes,
|
|
40
|
+
localId = props.localId;
|
|
40
41
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
41
42
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
42
43
|
var removeOverflow = React.Children.toArray(children)
|
|
@@ -66,7 +67,7 @@ var BodiedExtension = function BodiedExtension(props) {
|
|
|
66
67
|
// Return the content directly if it's a valid JSX.Element
|
|
67
68
|
return renderExtension(result, layout, {
|
|
68
69
|
isTopLevel: path.length < 1
|
|
69
|
-
}, removeOverflow, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes);
|
|
70
|
+
}, removeOverflow, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes, undefined, localId);
|
|
70
71
|
}
|
|
71
72
|
} catch (e) {
|
|
72
73
|
/** We don't want this error to block renderer */
|
|
@@ -76,7 +77,7 @@ var BodiedExtension = function BodiedExtension(props) {
|
|
|
76
77
|
// Always return default content if anything goes wrong
|
|
77
78
|
return renderExtension(children, layout, {
|
|
78
79
|
isTopLevel: path.length < 1
|
|
79
|
-
}, removeOverflow, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes);
|
|
80
|
+
}, removeOverflow, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes, undefined, localId);
|
|
80
81
|
}))));
|
|
81
82
|
};
|
|
82
83
|
export default BodiedExtension;
|
|
@@ -127,7 +127,8 @@ var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
|
127
127
|
"data-testid": "multiBodiedExtension--container",
|
|
128
128
|
"data-multiBodiedExtension-container": true,
|
|
129
129
|
"data-active-child-index": activeChildIndex,
|
|
130
|
-
"data-layout": layout
|
|
130
|
+
"data-layout": layout,
|
|
131
|
+
"data-local-id": localId
|
|
131
132
|
}, jsx(WidthConsumer, null, function (_ref4) {
|
|
132
133
|
var width = _ref4.width;
|
|
133
134
|
return jsx(MultiBodiedExtensionWrapper, {
|
|
@@ -54,7 +54,7 @@ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equ
|
|
|
54
54
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
55
55
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
56
56
|
var packageName = "@atlaskit/renderer";
|
|
57
|
-
var packageVersion = "
|
|
57
|
+
var packageVersion = "0.0.0-development";
|
|
58
58
|
var setAsQueryContainerStyles = css({
|
|
59
59
|
containerName: 'ak-renderer-wrapper',
|
|
60
60
|
containerType: 'inline-size'
|
|
@@ -7,7 +7,6 @@ import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
|
|
|
7
7
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
8
8
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
9
9
|
import { FabricChannel } from '@atlaskit/analytics-listeners/types';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { useAnnotationManagerDispatch, useAnnotationManagerState } from '../contexts/AnnotationManagerContext';
|
|
12
11
|
export var useAnnotationStateByTypeEvent = function useAnnotationStateByTypeEvent(_ref) {
|
|
13
12
|
var type = _ref.type,
|
|
@@ -90,9 +89,6 @@ export var useHasFocusEvent = function useHasFocusEvent(_ref2) {
|
|
|
90
89
|
};
|
|
91
90
|
var removeHoverEffect = function removeHoverEffect() {
|
|
92
91
|
setIsHovered(false);
|
|
93
|
-
if (document.activeElement instanceof HTMLElement && !fg('confluence_frontend_comments_panel_editor_focus')) {
|
|
94
|
-
document.activeElement.blur();
|
|
95
|
-
}
|
|
96
92
|
};
|
|
97
93
|
if (!isAnnotationManagerEnabled) {
|
|
98
94
|
updateSubscriber.on(AnnotationUpdateEvent.SET_ANNOTATION_FOCUS, cb);
|
|
@@ -5,7 +5,6 @@ import { FabricChannel } from '@atlaskit/analytics-listeners/types';
|
|
|
5
5
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { RendererContext as ActionsContext } from '../../RendererActionsContext';
|
|
7
7
|
import { useAnnotationRangeDispatch, useAnnotationRangeState } from '../contexts/AnnotationRangeContext';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
export var Mounter = /*#__PURE__*/React.memo(function (props) {
|
|
10
9
|
var Component = props.component,
|
|
11
10
|
range = props.range,
|
|
@@ -94,20 +93,18 @@ export var Mounter = /*#__PURE__*/React.memo(function (props) {
|
|
|
94
93
|
});
|
|
95
94
|
var positionToAnnotate = hoverDraftDocumentPosition || documentPosition;
|
|
96
95
|
if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}).fire(FabricChannel.editor);
|
|
110
|
-
}
|
|
96
|
+
if (createAnalyticsEvent) {
|
|
97
|
+
createAnalyticsEvent({
|
|
98
|
+
action: ACTION.CREATE_NOT_ALLOWED,
|
|
99
|
+
actionSubject: ACTION_SUBJECT.ANNOTATION,
|
|
100
|
+
actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
101
|
+
attributes: {
|
|
102
|
+
positionToAnnotate: positionToAnnotate,
|
|
103
|
+
applyAnnotationMissing: !applyAnnotation,
|
|
104
|
+
annotationId: options.annotationId
|
|
105
|
+
},
|
|
106
|
+
eventType: EVENT_TYPE.TRACK
|
|
107
|
+
}).fire(FabricChannel.editor);
|
|
111
108
|
}
|
|
112
109
|
return false;
|
|
113
110
|
}
|
|
@@ -144,20 +144,18 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
144
144
|
// use platform_editor_comments_api_manager here so we can clear the code path when the flag is removed
|
|
145
145
|
var positionToAnnotate = fg('platform_editor_comments_api_manager') ? documentPosition : selectionDraftDocumentPosition || documentPosition;
|
|
146
146
|
if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}).fire(FabricChannel.editor);
|
|
160
|
-
}
|
|
147
|
+
if (createAnalyticsEvent) {
|
|
148
|
+
createAnalyticsEvent({
|
|
149
|
+
action: ACTION.CREATE_NOT_ALLOWED,
|
|
150
|
+
actionSubject: ACTION_SUBJECT.ANNOTATION,
|
|
151
|
+
actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
152
|
+
attributes: {
|
|
153
|
+
positionToAnnotate: positionToAnnotate,
|
|
154
|
+
applyAnnotationMissing: !applyAnnotation,
|
|
155
|
+
annotationId: options.annotationId
|
|
156
|
+
},
|
|
157
|
+
eventType: EVENT_TYPE.TRACK
|
|
158
|
+
}).fire(FabricChannel.editor);
|
|
161
159
|
}
|
|
162
160
|
return false;
|
|
163
161
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
+
import { getDocument } from '@atlaskit/browser-apis';
|
|
2
3
|
|
|
3
4
|
// Find editor node dom with localId - similar to confluence useScrollOnUrlChange.ts
|
|
4
5
|
var getLocalIdSelector = function getLocalIdSelector(localId, container) {
|
|
@@ -33,6 +34,7 @@ var getLocalIdSelector = function getLocalIdSelector(localId, container) {
|
|
|
33
34
|
};
|
|
34
35
|
export var useScrollToLocalId = function useScrollToLocalId(containerRef, shouldScrollToLocalId) {
|
|
35
36
|
useEffect(function () {
|
|
37
|
+
var _getDocument;
|
|
36
38
|
// Only run in browser environment
|
|
37
39
|
if (typeof window === 'undefined' || !(containerRef !== null && containerRef !== void 0 && containerRef.current) || !shouldScrollToLocalId) {
|
|
38
40
|
return;
|
|
@@ -41,14 +43,83 @@ export var useScrollToLocalId = function useScrollToLocalId(containerRef, should
|
|
|
41
43
|
// Parse URL parameters for block ID
|
|
42
44
|
var urlParams = new URLSearchParams(window.location.search);
|
|
43
45
|
var blockId = urlParams.get('block');
|
|
44
|
-
if (blockId) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
if (!blockId) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
var retryCount = 0;
|
|
50
|
+
// 5 second timeout based on dashboard showing ~4.96s TTI load time
|
|
51
|
+
var maxRetries = 20; // Maximum 20 retries (5 seconds at 250ms intervals)
|
|
52
|
+
var retryInterval = 250; // Check every 250ms
|
|
53
|
+
var intervalId = null;
|
|
54
|
+
var scrollToElement = function scrollToElement() {
|
|
55
|
+
if (containerRef !== null && containerRef !== void 0 && containerRef.current) {
|
|
56
|
+
var element = getLocalIdSelector(blockId, containerRef.current);
|
|
57
|
+
if (element) {
|
|
58
|
+
element.scrollIntoView({
|
|
59
|
+
behavior: 'smooth'
|
|
60
|
+
});
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
};
|
|
66
|
+
var attemptScroll = function attemptScroll() {
|
|
67
|
+
retryCount++;
|
|
68
|
+
|
|
69
|
+
// Try to scroll to element
|
|
70
|
+
if (scrollToElement()) {
|
|
71
|
+
if (intervalId) {
|
|
72
|
+
clearInterval(intervalId);
|
|
73
|
+
intervalId = null;
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Stop retrying if we've exceeded max retries
|
|
79
|
+
if (retryCount >= maxRetries) {
|
|
80
|
+
if (intervalId) {
|
|
81
|
+
clearInterval(intervalId);
|
|
82
|
+
intervalId = null;
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
51
85
|
}
|
|
86
|
+
return false;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// Try to scroll immediately
|
|
90
|
+
if (attemptScroll()) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (((_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : _getDocument.readyState) === 'complete') {
|
|
94
|
+
// Document is already ready, try a few more times with delays
|
|
95
|
+
// This handles cases where elements are added after document ready
|
|
96
|
+
intervalId = setInterval(function () {
|
|
97
|
+
attemptScroll();
|
|
98
|
+
}, retryInterval);
|
|
99
|
+
} else {
|
|
100
|
+
// Document not ready yet, wait for it and then retry
|
|
101
|
+
intervalId = setInterval(function () {
|
|
102
|
+
var _getDocument2;
|
|
103
|
+
if (((_getDocument2 = getDocument()) === null || _getDocument2 === void 0 ? void 0 : _getDocument2.readyState) === 'complete') {
|
|
104
|
+
attemptScroll();
|
|
105
|
+
} else if (retryCount >= maxRetries) {
|
|
106
|
+
// Stop retrying even if document isn't ready
|
|
107
|
+
if (intervalId) {
|
|
108
|
+
clearInterval(intervalId);
|
|
109
|
+
intervalId = null;
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
retryCount++;
|
|
113
|
+
}
|
|
114
|
+
}, retryInterval);
|
|
52
115
|
}
|
|
116
|
+
|
|
117
|
+
// Cleanup function
|
|
118
|
+
return function () {
|
|
119
|
+
if (intervalId) {
|
|
120
|
+
clearInterval(intervalId);
|
|
121
|
+
intervalId = null;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
53
124
|
}, [containerRef, shouldScrollToLocalId]);
|
|
54
125
|
};
|
|
@@ -55,6 +55,7 @@ declare const BlockCard: React.ComponentType<{
|
|
|
55
55
|
eventHandlers?: import("@atlaskit/editor-common/ui").EventHandlers;
|
|
56
56
|
isNodeNested?: boolean;
|
|
57
57
|
layout?: string;
|
|
58
|
+
localId?: string;
|
|
58
59
|
portal?: HTMLElement;
|
|
59
60
|
rendererAppearance?: import("../../ui/Renderer/types").RendererAppearance;
|
|
60
61
|
smartLinks?: import("../../types/smartLinksOptions").SmartLinksOptions;
|
|
@@ -55,6 +55,7 @@ declare const BlockCard: React.ComponentType<{
|
|
|
55
55
|
eventHandlers?: import("@atlaskit/editor-common/ui").EventHandlers;
|
|
56
56
|
isNodeNested?: boolean;
|
|
57
57
|
layout?: string;
|
|
58
|
+
localId?: string;
|
|
58
59
|
portal?: HTMLElement;
|
|
59
60
|
rendererAppearance?: import("../../ui/Renderer/types").RendererAppearance;
|
|
60
61
|
smartLinks?: import("../../types/smartLinksOptions").SmartLinksOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "123.
|
|
3
|
+
"version": "123.2.1",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"@atlaskit/analytics-listeners": "^9.0.0",
|
|
29
29
|
"@atlaskit/analytics-namespaced-context": "^7.0.0",
|
|
30
30
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
31
|
+
"@atlaskit/browser-apis": "^0.0.1",
|
|
31
32
|
"@atlaskit/button": "^23.4.0",
|
|
32
33
|
"@atlaskit/code": "^17.2.0",
|
|
33
34
|
"@atlaskit/editor-json-transformer": "^8.29.0",
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
38
39
|
"@atlaskit/emoji": "^69.5.0",
|
|
39
40
|
"@atlaskit/feature-gate-js-client": "^5.5.0",
|
|
40
|
-
"@atlaskit/icon": "^28.
|
|
41
|
+
"@atlaskit/icon": "^28.2.0",
|
|
41
42
|
"@atlaskit/link": "^3.2.0",
|
|
42
43
|
"@atlaskit/link-datasource": "^4.23.0",
|
|
43
44
|
"@atlaskit/media-card": "^79.5.0",
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
"@atlaskit/status": "^3.0.0",
|
|
55
56
|
"@atlaskit/task-decision": "^19.2.0",
|
|
56
57
|
"@atlaskit/theme": "^21.0.0",
|
|
57
|
-
"@atlaskit/tmp-editor-statsig": "^12.
|
|
58
|
+
"@atlaskit/tmp-editor-statsig": "^12.22.0",
|
|
58
59
|
"@atlaskit/tokens": "^6.3.0",
|
|
59
60
|
"@atlaskit/tooltip": "^20.4.0",
|
|
60
61
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
"uuid": "^3.1.0"
|
|
69
70
|
},
|
|
70
71
|
"peerDependencies": {
|
|
71
|
-
"@atlaskit/editor-common": "^109.
|
|
72
|
+
"@atlaskit/editor-common": "^109.7.0",
|
|
72
73
|
"@atlaskit/link-provider": "^4.0.0",
|
|
73
74
|
"@atlaskit/media-core": "^37.0.0",
|
|
74
75
|
"react": "^18.2.0",
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
"@atlaskit/css-reset": "^7.3.0",
|
|
83
84
|
"@atlaskit/link-provider": "^4.0.0",
|
|
84
85
|
"@atlaskit/link-test-helpers": "^8.3.0",
|
|
85
|
-
"@atlaskit/linking-common": "^9.
|
|
86
|
+
"@atlaskit/linking-common": "^9.6.0",
|
|
86
87
|
"@atlaskit/media-core": "^37.0.0",
|
|
87
88
|
"@atlaskit/media-integration-test-helpers": "workspace:^",
|
|
88
89
|
"@atlaskit/media-test-helpers": "^39.0.0",
|
|
@@ -125,9 +126,6 @@
|
|
|
125
126
|
"confluence_frontend_table_scrollbar_ttvc_fix": {
|
|
126
127
|
"type": "boolean"
|
|
127
128
|
},
|
|
128
|
-
"cc_comments_improve_apply_draft_errors": {
|
|
129
|
-
"type": "boolean"
|
|
130
|
-
},
|
|
131
129
|
"cc_comments_create_inline_experience_entry_point": {
|
|
132
130
|
"type": "boolean"
|
|
133
131
|
},
|
|
@@ -242,9 +240,6 @@
|
|
|
242
240
|
"issue_table_single_line_row_height_fast_follows": {
|
|
243
241
|
"type": "boolean"
|
|
244
242
|
},
|
|
245
|
-
"confluence_frontend_comments_panel_editor_focus": {
|
|
246
|
-
"type": "boolean"
|
|
247
|
-
},
|
|
248
243
|
"platform_custom_number_column": {
|
|
249
244
|
"type": "boolean"
|
|
250
245
|
},
|