@atlaskit/renderer 142.0.0 → 142.1.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/actions/index.js +47 -0
  3. package/dist/cjs/react/nodes/heading-anchor-button.compiled.css +16 -0
  4. package/dist/cjs/react/nodes/heading-anchor-button.js +24 -0
  5. package/dist/cjs/react/nodes/heading-anchor.js +37 -0
  6. package/dist/cjs/react/nodes/media/index.js +4 -2
  7. package/dist/cjs/ui/MediaCard.js +54 -13
  8. package/dist/cjs/ui/Renderer/RendererStyleContainer.js +15 -5
  9. package/dist/cjs/ui/Renderer/index.js +1 -1
  10. package/dist/es2019/actions/index.js +37 -0
  11. package/dist/es2019/react/nodes/heading-anchor-button.compiled.css +16 -0
  12. package/dist/es2019/react/nodes/heading-anchor-button.js +15 -0
  13. package/dist/es2019/react/nodes/heading-anchor.js +37 -0
  14. package/dist/es2019/react/nodes/media/index.js +4 -2
  15. package/dist/es2019/ui/MediaCard.js +27 -1
  16. package/dist/es2019/ui/Renderer/RendererStyleContainer.js +12 -1
  17. package/dist/es2019/ui/Renderer/index.js +1 -1
  18. package/dist/esm/actions/index.js +47 -0
  19. package/dist/esm/react/nodes/heading-anchor-button.compiled.css +16 -0
  20. package/dist/esm/react/nodes/heading-anchor-button.js +15 -0
  21. package/dist/esm/react/nodes/heading-anchor.js +37 -0
  22. package/dist/esm/react/nodes/media/index.js +4 -2
  23. package/dist/esm/ui/MediaCard.js +54 -13
  24. package/dist/esm/ui/Renderer/RendererStyleContainer.js +15 -5
  25. package/dist/esm/ui/Renderer/index.js +1 -1
  26. package/dist/types/actions/index.d.ts +20 -0
  27. package/dist/types/react/nodes/heading-anchor-button.d.ts +7 -0
  28. package/dist/types/react/nodes/media/index.d.ts +3 -0
  29. package/dist/types/types/mediaOptions.d.ts +3 -1
  30. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 142.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`1c57152f89627`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1c57152f89627) -
8
+ Add `RendererActions.getMediaNodeContext`, which resolves a media file id and optional occurrence
9
+ key to the matching file media node in the rendered document, returning its inline-comment
10
+ annotation ids, document position, display text and occurrence key. Also threads the existing
11
+ `mediaViewerExtensions` media option through the media node to the media card, and — behind the
12
+ `cc_comments_media_viewer_sidebar` experiment — keeps the media identifier map in document order
13
+ so the Media Viewer's previous/next list stays stable when a media card remounts.
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
19
+ ## 142.0.1
20
+
21
+ ### Patch Changes
22
+
23
+ - [`da64bde78a78c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/da64bde78a78c) -
24
+ Increase heading link targets to at least 24 by 24 pixels when
25
+ platform_editor_heading_link_target_size is enabled.
26
+
3
27
  ## 142.0.0
4
28
 
5
29
  ### Major Changes
@@ -286,6 +286,53 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
286
286
  });
287
287
  return Array.from(uniqueMarks.values());
288
288
  }
289
+ }, {
290
+ key: "getMediaNodeContext",
291
+ value: function getMediaNodeContext(identifier) {
292
+ if (!this.doc) {
293
+ return {
294
+ status: 'missing'
295
+ };
296
+ }
297
+ var candidates = [];
298
+ this.doc.descendants(function (node, position) {
299
+ if (node.type.name !== 'media' || node.attrs.type !== 'file' || node.attrs.id !== identifier.id) {
300
+ return true;
301
+ }
302
+ candidates.push({
303
+ fileId: identifier.id,
304
+ annotationIds: node.marks.filter(function (mark) {
305
+ return mark.type.name === 'annotation' && mark.attrs.annotationType === _annotation.AnnotationTypes.INLINE_COMMENT;
306
+ }).map(function (mark) {
307
+ return mark.attrs.id;
308
+ }).filter(function (id) {
309
+ return typeof id === 'string';
310
+ }),
311
+ position: position,
312
+ displayText: node.attrs.alt || node.attrs.__fileName || node.attrs.fileName || node.attrs.name,
313
+ occurrenceKey: typeof node.attrs.occurrenceKey === 'string' ? node.attrs.occurrenceKey : undefined
314
+ });
315
+ return false;
316
+ });
317
+ var exactMatches = identifier.occurrenceKey ? candidates.filter(function (candidate) {
318
+ return candidate.occurrenceKey === identifier.occurrenceKey;
319
+ }) : [];
320
+ var matches = exactMatches.length > 0 ? exactMatches : candidates;
321
+ if (matches.length === 0) {
322
+ return {
323
+ status: 'missing'
324
+ };
325
+ }
326
+ if (matches.length > 1) {
327
+ return {
328
+ status: 'ambiguous'
329
+ };
330
+ }
331
+ return {
332
+ status: 'resolved',
333
+ context: matches[0]
334
+ };
335
+ }
289
336
  }, {
290
337
  key: "getAnnotationsByPosition",
291
338
  value: function getAnnotationsByPosition(range) {
@@ -0,0 +1,16 @@
1
+ ._1dqoglyw{border-style:none}._12ji1r31{outline-color:currentColor}
2
+ ._12y31o36{outline-width:medium}
3
+ ._19bvidpf{padding-left:0}
4
+ ._1bah1h6o{justify-content:center}
5
+ ._1bsb1tcg{width:24px}
6
+ ._1e0c116y{display:inline-flex}
7
+ ._1qu2glyw{outline-style:none}
8
+ ._4cvr1h6o{align-items:center}
9
+ ._4t3i1tcg{height:24px}
10
+ ._80omtlke{cursor:pointer}
11
+ ._bfhk1j28{background-color:transparent}
12
+ ._ca0qidpf{padding-top:0}
13
+ ._n3tdidpf{padding-bottom:0}
14
+ ._s7n4nkob{vertical-align:middle}
15
+ ._u5f3idpf{padding-right:0}
16
+ ._vchhusvi{box-sizing:border-box}
@@ -0,0 +1,24 @@
1
+ /* heading-anchor-button.tsx generated by @compiled/babel-plugin v3.0.2 */
2
+ "use strict";
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.default = HeadingAnchorButton;
10
+ require("./heading-anchor-button.compiled.css");
11
+ var React = _interopRequireWildcard(require("react"));
12
+ var _runtime = require("@compiled/react/runtime");
13
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
14
+ 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); }
15
+ var buttonStyles = null;
16
+
17
+ /** Heading link button with a minimum 24px pointer target. */
18
+ function HeadingAnchorButton(props) {
19
+ // eslint-disable-next-line react/jsx-props-no-spreading -- Forward the existing heading anchor's accessibility and event props.
20
+ return /*#__PURE__*/React.createElement("button", (0, _extends2.default)({}, props, {
21
+ type: "button",
22
+ className: (0, _runtime.ax)(["_12ji1r31 _1qu2glyw _12y31o36 _1dqoglyw _1e0c116y _vchhusvi _4cvr1h6o _1bah1h6o _1bsb1tcg _4t3i1tcg _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _s7n4nkob _bfhk1j28 _80omtlke"])
23
+ }));
24
+ }
@@ -23,6 +23,7 @@ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-ex
23
23
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
24
24
  var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
25
25
  var _messages = require("../../messages");
26
+ var _headingAnchorButton = _interopRequireDefault(require("./heading-anchor-button"));
26
27
  var _excluded = ["children"];
27
28
  /**
28
29
  * @jsxRuntime classic
@@ -32,12 +33,22 @@ var _excluded = ["children"];
32
33
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
33
34
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
34
35
  var HeadingAnchorWrapperClassName = exports.HeadingAnchorWrapperClassName = 'heading-anchor-wrapper';
36
+ var headingAnchorWrapperTargetSizeStyles = (0, _react2.css)({
37
+ display: 'inline-flex',
38
+ boxSizing: 'border-box',
39
+ alignItems: 'center',
40
+ justifyContent: 'center',
41
+ width: '24px',
42
+ height: '24px',
43
+ verticalAlign: 'middle'
44
+ });
35
45
  var CopyAnchorWrapperWithRef = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
36
46
  var children = props.children,
37
47
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
38
48
  return (0, _react2.jsx)("span", (0, _extends2.default)({}, rest, {
39
49
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
40
50
  className: HeadingAnchorWrapperClassName,
51
+ css: (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_heading_link_target_size') ? headingAnchorWrapperTargetSizeStyles : undefined,
41
52
  ref: ref
42
53
  }), children);
43
54
  });
@@ -50,6 +61,11 @@ var copyAnchorButtonStyles = (0, _react2.css)({
50
61
  cursor: 'pointer',
51
62
  right: 0
52
63
  });
64
+ var scaledLinkIconStyles = (0, _react2.css)({
65
+ display: 'inline-flex',
66
+ transform: 'scale(1.5)',
67
+ transformOrigin: 'center'
68
+ });
53
69
  // Ignored via go/ees005
54
70
  // eslint-disable-next-line @repo/internal/react/no-class-components
55
71
  var HeadingAnchor = /*#__PURE__*/function (_React$PureComponent) {
@@ -128,6 +144,27 @@ var HeadingAnchor = /*#__PURE__*/function (_React$PureComponent) {
128
144
  heading: headingId
129
145
  }) : headingId;
130
146
  var tabIndex = (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? 0 : hideFromScreenReader ? undefined : -1;
147
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_heading_link_target_size')) {
148
+ return (0, _react2.jsx)(_headingAnchorButton.default, {
149
+ "data-testid": "anchor-button",
150
+ id: _this.copyLinkId,
151
+ onMouseLeave: _this.resetMessage,
152
+ onBlur: _this.resetMessage,
153
+ onClick: _this.copyToClipboard,
154
+ "aria-hidden": hideFromScreenReader,
155
+ tabIndex: tabIndex,
156
+ "aria-label": hideFromScreenReader ? undefined : _this.state.tooltipMessage,
157
+ "aria-labelledby": hideFromScreenReader ? undefined : labelledBy,
158
+ type: "button"
159
+ }, (0, _react2.jsx)("span", {
160
+ css: scaledLinkIconStyles,
161
+ "data-testid": "scaled-link-icon"
162
+ }, (0, _react2.jsx)(_link.default, {
163
+ label: _this.getCopyAriaLabel(),
164
+ size: "medium",
165
+ color: _this.state.isClicked ? "var(--ds-icon-selected, #1868DB)" : "var(--ds-icon-subtle, #505258)"
166
+ })));
167
+ }
131
168
  return (0, _react2.jsx)("button", {
132
169
  "data-testid": "anchor-button",
133
170
  id: _this.copyLinkId,
@@ -298,7 +298,8 @@ var Media = /*#__PURE__*/function (_PureComponent) {
298
298
  height = _this$props3.height,
299
299
  mediaSingleElement = _this$props3.mediaSingleElement,
300
300
  _this$props3$isDrafti = _this$props3.isDrafting,
301
- isDrafting = _this$props3$isDrafti === void 0 ? false : _this$props3$isDrafti;
301
+ isDrafting = _this$props3$isDrafti === void 0 ? false : _this$props3$isDrafti,
302
+ mediaViewerExtensions = _this$props3.mediaViewerExtensions;
302
303
  var annotationMarks = _this.props.isAnnotationMark ? _this.props.marks.filter(_this.props.isAnnotationMark) : undefined;
303
304
  var borderMark = _this.props.marks.find(_this.props.isBorderMark);
304
305
  var dataConsumerMark = _this.getDataConsumerMark();
@@ -352,7 +353,8 @@ var Media = /*#__PURE__*/function (_PureComponent) {
352
353
  shouldEnableDownloadButton: enableDownloadButton,
353
354
  ssr: ssr,
354
355
  onError: _this.props.onMediaRenderEvent || _this.props.onError ? _this.onError : undefined,
355
- onPreviewRender: _this.props.onMediaRenderEvent || _this.props.onPreviewRender ? _this.onPreviewRender : undefined
356
+ onPreviewRender: _this.props.onMediaRenderEvent || _this.props.onPreviewRender ? _this.onPreviewRender : undefined,
357
+ mediaViewerExtensions: mediaViewerExtensions
356
358
  }))))));
357
359
  });
358
360
  (0, _defineProperty2.default)(_this, "handleMediaLinkClick", function (event) {
@@ -15,6 +15,8 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
15
15
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
16
16
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
17
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
18
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
19
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
18
20
  var _react = _interopRequireWildcard(require("react"));
19
21
  var _traverse = require("@atlaskit/adf-utils/traverse");
20
22
  var _analytics = require("@atlaskit/editor-common/analytics");
@@ -24,6 +26,7 @@ var _cardLoader = _interopRequireDefault(require("@atlaskit/media-card/cardLoade
24
26
  var _cardLoading = require("@atlaskit/media-card/cardLoading");
25
27
  var _cardSync = _interopRequireDefault(require("@atlaskit/media-card/cardSync"));
26
28
  var _mediaClientProvider = require("@atlaskit/media-client-react/media-client-provider");
29
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
27
30
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
28
31
  var _analyticsContext = _interopRequireDefault(require("../analytics/analyticsContext"));
29
32
  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 _t4 in e) "default" !== _t4 && {}.hasOwnProperty.call(e, _t4) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t4)) && (i.get || i.set) ? o(f, _t4, i) : f[_t4] = e[_t4]); return f; })(e, t); }
@@ -61,6 +64,38 @@ var getListOfIdentifiersFromDoc = exports.getListOfIdentifiersFromDoc = function
61
64
  }, []);
62
65
  };
63
66
 
67
+ /**
68
+ * `mediaIdentifierMap` is the Media Viewer's nav list, but a `Map` can only append —
69
+ * a card that unmounts and re-registers lands last, scrambling nav order. Rebuild it
70
+ * in document order; entries from other renderers on the page keep their old order.
71
+ */
72
+ var restoreDocumentOrder = function restoreDocumentOrder(docIdentifiers) {
73
+ var documentKeys = new Set(docIdentifiers.map(function (identifier) {
74
+ return identifier.mediaItemType === 'file' ? identifier.id : identifier.dataURI;
75
+ }).filter(function (key) {
76
+ return mediaIdentifierMap.has(key);
77
+ }));
78
+ var currentKeys = Array.from(mediaIdentifierMap.keys());
79
+ var orderedKeys = [].concat((0, _toConsumableArray2.default)(documentKeys), (0, _toConsumableArray2.default)(currentKeys.filter(function (key) {
80
+ return !documentKeys.has(key);
81
+ })));
82
+ if (orderedKeys.every(function (key, index) {
83
+ return key === currentKeys[index];
84
+ })) {
85
+ return;
86
+ }
87
+ var orderedEntries = orderedKeys.map(function (key) {
88
+ return [key, mediaIdentifierMap.get(key)];
89
+ });
90
+ mediaIdentifierMap.clear();
91
+ orderedEntries.forEach(function (_ref) {
92
+ var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
93
+ key = _ref2[0],
94
+ identifier = _ref2[1];
95
+ mediaIdentifierMap.set(key, identifier);
96
+ });
97
+ };
98
+
64
99
  // Ignored via go/ees005
65
100
  // eslint-disable-next-line @repo/internal/react/no-class-components
66
101
  var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
@@ -73,7 +108,7 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
73
108
  _this = _callSuper(this, MediaCardView, [].concat(args));
74
109
  (0, _defineProperty2.default)(_this, "state", {});
75
110
  (0, _defineProperty2.default)(_this, "saveFileState", /*#__PURE__*/function () {
76
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(id) {
111
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(id) {
77
112
  var _this$props, collectionName, mediaClient, options, fileState, _t;
78
113
  return _regenerator.default.wrap(function (_context) {
79
114
  while (1) switch (_context.prev = _context.next) {
@@ -107,7 +142,7 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
107
142
  }, _callee, null, [[1, 4]]);
108
143
  }));
109
144
  return function (_x) {
110
- return _ref.apply(this, arguments);
145
+ return _ref3.apply(this, arguments);
111
146
  };
112
147
  }());
113
148
  (0, _defineProperty2.default)(_this, "onError", function (reason) {
@@ -174,7 +209,7 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
174
209
  key: "componentDidMount",
175
210
  value: function () {
176
211
  var _componentDidMount = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
177
- var _this$props6, rendererContext, contextIdentifierProvider, id, url, collectionName, nodeIsInCache, _t2, _t3;
212
+ var _this$props6, rendererContext, contextIdentifierProvider, id, url, collectionName, nodeIsInCache, docIdentifiers, _t2, _t3;
178
213
  return _regenerator.default.wrap(function (_context2) {
179
214
  while (1) switch (_context2.prev = _context2.next) {
180
215
  case 0:
@@ -194,7 +229,8 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
194
229
  case 2:
195
230
  nodeIsInCache = id && mediaIdentifierMap.has(id) || url && mediaIdentifierMap.has(url);
196
231
  if (rendererContext && rendererContext.adDoc && !nodeIsInCache) {
197
- getListOfIdentifiersFromDoc(rendererContext.adDoc).forEach(function (identifier) {
232
+ docIdentifiers = getListOfIdentifiersFromDoc(rendererContext.adDoc);
233
+ docIdentifiers.forEach(function (identifier) {
198
234
  if (identifier.mediaItemType === 'file' && identifier.id === id) {
199
235
  mediaIdentifierMap.set(identifier.id, _objectSpread(_objectSpread({}, identifier), {}, {
200
236
  collectionName: collectionName
@@ -203,6 +239,11 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
203
239
  mediaIdentifierMap.set(identifier.dataURI, identifier);
204
240
  }
205
241
  });
242
+ // Reordering affects prev/next nav in every overlay viewer on the page, so gate it
243
+ // to the media-comments sidebar experiment that needs it; otherwise keep legacy order.
244
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('cc_comments_media_viewer_sidebar')) {
245
+ restoreDocumentOrder(docIdentifiers);
246
+ }
206
247
  }
207
248
  if (id) {
208
249
  this.saveFileState(id);
@@ -400,13 +441,13 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
400
441
  }]);
401
442
  }(_react.Component);
402
443
  // Needed for copy & paste
403
- var getClipboardAttrs = exports.getClipboardAttrs = function getClipboardAttrs(_ref2) {
404
- var id = _ref2.id,
405
- alt = _ref2.alt,
406
- collection = _ref2.collection,
407
- contextIdentifierProvider = _ref2.contextIdentifierProvider,
408
- originalDimensions = _ref2.originalDimensions,
409
- fileState = _ref2.fileState;
444
+ var getClipboardAttrs = exports.getClipboardAttrs = function getClipboardAttrs(_ref4) {
445
+ var id = _ref4.id,
446
+ alt = _ref4.alt,
447
+ collection = _ref4.collection,
448
+ contextIdentifierProvider = _ref4.contextIdentifierProvider,
449
+ originalDimensions = _ref4.originalDimensions,
450
+ fileState = _ref4.fileState;
410
451
  var contextId = contextIdentifierProvider && contextIdentifierProvider.objectId;
411
452
  var width = originalDimensions && originalDimensions.width;
412
453
  var height = originalDimensions && originalDimensions.height;
@@ -434,8 +475,8 @@ var getClipboardAttrs = exports.getClipboardAttrs = function getClipboardAttrs(_
434
475
  };
435
476
  var MediaCardInternal = exports.MediaCardInternal = function MediaCardInternal(props) {
436
477
  var mediaClient = (0, _react.useContext)(_mediaClientProvider.MediaClientContext);
437
- return /*#__PURE__*/_react.default.createElement(_analyticsContext.default.Consumer, null, function (_ref3) {
438
- var fireAnalyticsEvent = _ref3.fireAnalyticsEvent;
478
+ return /*#__PURE__*/_react.default.createElement(_analyticsContext.default.Consumer, null, function (_ref5) {
479
+ var fireAnalyticsEvent = _ref5.fireAnalyticsEvent;
439
480
  return /*#__PURE__*/_react.default.createElement(MediaCardView
440
481
  // Ignored via go/ees005
441
482
  // eslint-disable-next-line react/jsx-props-no-spreading
@@ -30,7 +30,7 @@ var _table2 = require("../../react/nodes/table");
30
30
  var _collapsibleHeadingsDom = require("../collapsible-headings-dom");
31
31
  var _getBaseFontSize = require("./get-base-font-size");
32
32
  var _style = require("./style");
33
- var _css9, _$concat3, _$concat5;
33
+ var _css0, _$concat3, _$concat5;
34
34
  /* eslint-disable @atlaskit/ui-styling-standard/no-important-styles, @atlaskit/ui-styling-standard/no-unsafe-selectors */
35
35
  /* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */
36
36
  /* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values */
@@ -554,6 +554,16 @@ var headingWrapperInlineFlowStyles = (0, _react.css)((0, _defineProperty2.defaul
554
554
  // eslint-disable-next-line @atlaskit/design-system/use-tokens-space
555
555
  marginTop: '1.59091em'
556
556
  }));
557
+ var headingAnchorWrapperTargetSizeStyles = (0, _react.css)((0, _defineProperty2.default)({
558
+ '& .renderer-heading-wrapper > h1, & .renderer-heading-wrapper > h2, & .renderer-heading-wrapper > h3, & .renderer-heading-wrapper > h4, & .renderer-heading-wrapper > h5, & .renderer-heading-wrapper > h6': {
559
+ verticalAlign: 'middle'
560
+ }
561
+ }, "& .renderer-heading-wrapper > .".concat(_headingAnchor.HeadingAnchorWrapperClassName), {
562
+ display: 'inline-flex',
563
+ alignItems: 'center',
564
+ justifyContent: 'center',
565
+ verticalAlign: 'middle'
566
+ }));
557
567
  var headingWithAlignmentStylesDuplicateAnchor = (0, _react.css)({
558
568
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors
559
569
  '.fabric-editor-block-mark.fabric-editor-alignment:not(:first-child)': {
@@ -644,13 +654,13 @@ var paragraphStylesUGCScaledMargin = (0, _react.css)({
644
654
  marginBottom: 0
645
655
  }
646
656
  });
647
- var listsSharedStyles = (0, _react.css)((_css9 = {
657
+ var listsSharedStyles = (0, _react.css)((_css0 = {
648
658
  /* =============== INDENTATION SPACING ========= */
649
659
  'ul, ol': {
650
660
  boxSizing: 'border-box',
651
661
  paddingLeft: "var(--ed--list--item-counter--padding, ".concat(_styles.listItemCounterPadding, "px)")
652
662
  }
653
- }, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_css9, "".concat(_orderedList.orderedListSelector, ", ").concat(_bulletList.bulletListSelector), {
663
+ }, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_css0, "".concat(_orderedList.orderedListSelector, ", ").concat(_bulletList.bulletListSelector), {
654
664
  /*
655
665
  Ensures list item content adheres to the list's margin instead
656
666
  of filling the entire block row. This is important to allow
@@ -682,7 +692,7 @@ var listsSharedStyles = (0, _react.css)((_css9 = {
682
692
  listStyleType: 'lower-alpha'
683
693
  }), 'ol[data-indent-level="3"], ol[data-indent-level="6"]', {
684
694
  listStyleType: 'lower-roman'
685
- }), (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_css9, 'ul[data-indent-level="1"], ul[data-indent-level="4"]', {
695
+ }), (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_css0, 'ul[data-indent-level="1"], ul[data-indent-level="4"]', {
686
696
  listStyleType: 'disc'
687
697
  }), 'ul[data-indent-level="2"], ul[data-indent-level="5"]', {
688
698
  listStyleType: 'circle'
@@ -2313,7 +2323,7 @@ var RendererStyleContainer = exports.RendererStyleContainer = function RendererS
2313
2323
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- CSS custom properties for UGC font tokens
2314
2324
  '--ak-renderer-editor-font-small-text': _ugcTokens.editorUGCTokensRefreshed['editor.font.body.small']
2315
2325
  },
2316
- css: [(0, _expValEquals.expValEquals)('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && ((0, _expValEquals.expValEquals)('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !(0, _table2.isTableResizingEnabled)(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && ((0, _expValEquals.expValEquals)('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !(0, _expValEquals.expValEquals)('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
2326
+ css: [(0, _expValEquals.expValEquals)('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && ((0, _expValEquals.expValEquals)('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !(0, _table2.isTableResizingEnabled)(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && ((0, _expValEquals.expValEquals)('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_heading_link_target_size') && headingAnchorWrapperTargetSizeStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !(0, _expValEquals.expValEquals)('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
2317
2327
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
2318
2328
  textHighlightPaddingStyles, tasksAndDecisionsStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingPanelStyles, smartCardStyles, smartCardStylesAvatarFix, headerSmartCardStyles, smartCardStylesAvatarMarginFix, smartCardStylesAvatarListZeroMarginTop, (0, _fg.fg)('editor_inline_comments_on_inline_nodes') && ((0, _expValEquals.expValEquals)('confluence_fe_renderer_inline_node_mark_color_fix', 'isEnabled', true) ? rendererAnnotationStyles : rendererAnnotationStylesOld),
2319
2329
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
@@ -71,7 +71,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
71
71
  var TABLE_INFO_TIMEOUT = 10000;
72
72
  var RENDER_EVENT_SAMPLE_RATE = 0.1;
73
73
  var packageName = "@atlaskit/renderer";
74
- var packageVersion = "141.0.7";
74
+ var packageVersion = "142.0.1";
75
75
  var setAsQueryContainerStyles = (0, _react2.css)({
76
76
  containerName: 'ak-renderer-wrapper',
77
77
  containerType: 'inline-size'
@@ -262,6 +262,43 @@ export default class RendererActions {
262
262
  });
263
263
  return Array.from(uniqueMarks.values());
264
264
  }
265
+ getMediaNodeContext(identifier) {
266
+ if (!this.doc) {
267
+ return {
268
+ status: 'missing'
269
+ };
270
+ }
271
+ const candidates = [];
272
+ this.doc.descendants((node, position) => {
273
+ if (node.type.name !== 'media' || node.attrs.type !== 'file' || node.attrs.id !== identifier.id) {
274
+ return true;
275
+ }
276
+ candidates.push({
277
+ fileId: identifier.id,
278
+ annotationIds: node.marks.filter(mark => mark.type.name === 'annotation' && mark.attrs.annotationType === AnnotationTypes.INLINE_COMMENT).map(mark => mark.attrs.id).filter(id => typeof id === 'string'),
279
+ position,
280
+ displayText: node.attrs.alt || node.attrs.__fileName || node.attrs.fileName || node.attrs.name,
281
+ occurrenceKey: typeof node.attrs.occurrenceKey === 'string' ? node.attrs.occurrenceKey : undefined
282
+ });
283
+ return false;
284
+ });
285
+ const exactMatches = identifier.occurrenceKey ? candidates.filter(candidate => candidate.occurrenceKey === identifier.occurrenceKey) : [];
286
+ const matches = exactMatches.length > 0 ? exactMatches : candidates;
287
+ if (matches.length === 0) {
288
+ return {
289
+ status: 'missing'
290
+ };
291
+ }
292
+ if (matches.length > 1) {
293
+ return {
294
+ status: 'ambiguous'
295
+ };
296
+ }
297
+ return {
298
+ status: 'resolved',
299
+ context: matches[0]
300
+ };
301
+ }
265
302
  getAnnotationsByPosition(range) {
266
303
  if (!this.doc || !this.schema) {
267
304
  return [];
@@ -0,0 +1,16 @@
1
+ ._1dqoglyw{border-style:none}._12ji1r31{outline-color:currentColor}
2
+ ._12y31o36{outline-width:medium}
3
+ ._19bvidpf{padding-left:0}
4
+ ._1bah1h6o{justify-content:center}
5
+ ._1bsb1tcg{width:24px}
6
+ ._1e0c116y{display:inline-flex}
7
+ ._1qu2glyw{outline-style:none}
8
+ ._4cvr1h6o{align-items:center}
9
+ ._4t3i1tcg{height:24px}
10
+ ._80omtlke{cursor:pointer}
11
+ ._bfhk1j28{background-color:transparent}
12
+ ._ca0qidpf{padding-top:0}
13
+ ._n3tdidpf{padding-bottom:0}
14
+ ._s7n4nkob{vertical-align:middle}
15
+ ._u5f3idpf{padding-right:0}
16
+ ._vchhusvi{box-sizing:border-box}
@@ -0,0 +1,15 @@
1
+ /* heading-anchor-button.tsx generated by @compiled/babel-plugin v3.0.2 */
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import "./heading-anchor-button.compiled.css";
4
+ import * as React from 'react';
5
+ import { ax, ix } from "@compiled/react/runtime";
6
+ const buttonStyles = null;
7
+
8
+ /** Heading link button with a minimum 24px pointer target. */
9
+ export default function HeadingAnchorButton(props) {
10
+ // eslint-disable-next-line react/jsx-props-no-spreading -- Forward the existing heading anchor's accessibility and event props.
11
+ return /*#__PURE__*/React.createElement("button", _extends({}, props, {
12
+ type: "button",
13
+ className: ax(["_12ji1r31 _1qu2glyw _12y31o36 _1dqoglyw _1e0c116y _vchhusvi _4cvr1h6o _1bah1h6o _1bsb1tcg _4t3i1tcg _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _s7n4nkob _bfhk1j28 _80omtlke"])
14
+ }));
15
+ }
@@ -15,7 +15,17 @@ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-e
15
15
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
16
16
  import Tooltip from '@atlaskit/tooltip/Tooltip';
17
17
  import { headingAnchorLinkMessages } from '../../messages';
18
+ import HeadingAnchorButton from './heading-anchor-button';
18
19
  export const HeadingAnchorWrapperClassName = 'heading-anchor-wrapper';
20
+ const headingAnchorWrapperTargetSizeStyles = css({
21
+ display: 'inline-flex',
22
+ boxSizing: 'border-box',
23
+ alignItems: 'center',
24
+ justifyContent: 'center',
25
+ width: '24px',
26
+ height: '24px',
27
+ verticalAlign: 'middle'
28
+ });
19
29
  const CopyAnchorWrapperWithRef = /*#__PURE__*/React.forwardRef((props, ref) => {
20
30
  const {
21
31
  children,
@@ -24,6 +34,7 @@ const CopyAnchorWrapperWithRef = /*#__PURE__*/React.forwardRef((props, ref) => {
24
34
  return jsx("span", _extends({}, rest, {
25
35
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
26
36
  className: HeadingAnchorWrapperClassName,
37
+ css: isExperimentEnabled('platform_editor_heading_link_target_size') ? headingAnchorWrapperTargetSizeStyles : undefined,
27
38
  ref: ref
28
39
  }), children);
29
40
  });
@@ -36,6 +47,11 @@ const copyAnchorButtonStyles = css({
36
47
  cursor: 'pointer',
37
48
  right: 0
38
49
  });
50
+ const scaledLinkIconStyles = css({
51
+ display: 'inline-flex',
52
+ transform: 'scale(1.5)',
53
+ transformOrigin: 'center'
54
+ });
39
55
  // Ignored via go/ees005
40
56
  // eslint-disable-next-line @repo/internal/react/no-class-components
41
57
  class HeadingAnchor extends React.PureComponent {
@@ -98,6 +114,27 @@ class HeadingAnchor extends React.PureComponent {
98
114
  heading: headingId
99
115
  }) : headingId;
100
116
  const tabIndex = expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? 0 : hideFromScreenReader ? undefined : -1;
117
+ if (isExperimentEnabled('platform_editor_heading_link_target_size')) {
118
+ return jsx(HeadingAnchorButton, {
119
+ "data-testid": "anchor-button",
120
+ id: this.copyLinkId,
121
+ onMouseLeave: this.resetMessage,
122
+ onBlur: this.resetMessage,
123
+ onClick: this.copyToClipboard,
124
+ "aria-hidden": hideFromScreenReader,
125
+ tabIndex: tabIndex,
126
+ "aria-label": hideFromScreenReader ? undefined : this.state.tooltipMessage,
127
+ "aria-labelledby": hideFromScreenReader ? undefined : labelledBy,
128
+ type: "button"
129
+ }, jsx("span", {
130
+ css: scaledLinkIconStyles,
131
+ "data-testid": "scaled-link-icon"
132
+ }, jsx(LinkIcon, {
133
+ label: this.getCopyAriaLabel(),
134
+ size: "medium",
135
+ color: this.state.isClicked ? "var(--ds-icon-selected, #1868DB)" : "var(--ds-icon-subtle, #505258)"
136
+ })));
137
+ }
101
138
  return jsx("button", {
102
139
  "data-testid": "anchor-button",
103
140
  id: this.copyLinkId,
@@ -261,7 +261,8 @@ class Media extends PureComponent {
261
261
  width,
262
262
  height,
263
263
  mediaSingleElement,
264
- isDrafting = false
264
+ isDrafting = false,
265
+ mediaViewerExtensions
265
266
  } = this.props;
266
267
  const annotationMarks = this.props.isAnnotationMark ? this.props.marks.filter(this.props.isAnnotationMark) : undefined;
267
268
  const borderMark = this.props.marks.find(this.props.isBorderMark);
@@ -317,7 +318,8 @@ class Media extends PureComponent {
317
318
  shouldEnableDownloadButton: enableDownloadButton,
318
319
  ssr: ssr,
319
320
  onError: this.props.onMediaRenderEvent || this.props.onError ? this.onError : undefined,
320
- onPreviewRender: this.props.onMediaRenderEvent || this.props.onPreviewRender ? this.onPreviewRender : undefined
321
+ onPreviewRender: this.props.onMediaRenderEvent || this.props.onPreviewRender ? this.onPreviewRender : undefined,
322
+ mediaViewerExtensions: mediaViewerExtensions
321
323
  }))))));
322
324
  });
323
325
  _defineProperty(this, "handleMediaLinkClick", event => {
@@ -9,6 +9,7 @@ import CardAsync from '@atlaskit/media-card/cardLoader';
9
9
  import { CardLoading } from '@atlaskit/media-card/cardLoading';
10
10
  import CardSync from '@atlaskit/media-card/cardSync';
11
11
  import { MediaClientContext } from '@atlaskit/media-client-react/media-client-provider';
12
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
12
13
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
14
  import AnalyticsContext from '../analytics/analyticsContext';
14
15
  export const mediaIdentifierMap = new Map();
@@ -40,6 +41,25 @@ export const getListOfIdentifiersFromDoc = doc => {
40
41
  }, []);
41
42
  };
42
43
 
44
+ /**
45
+ * `mediaIdentifierMap` is the Media Viewer's nav list, but a `Map` can only append —
46
+ * a card that unmounts and re-registers lands last, scrambling nav order. Rebuild it
47
+ * in document order; entries from other renderers on the page keep their old order.
48
+ */
49
+ const restoreDocumentOrder = docIdentifiers => {
50
+ const documentKeys = new Set(docIdentifiers.map(identifier => identifier.mediaItemType === 'file' ? identifier.id : identifier.dataURI).filter(key => mediaIdentifierMap.has(key)));
51
+ const currentKeys = Array.from(mediaIdentifierMap.keys());
52
+ const orderedKeys = [...documentKeys, ...currentKeys.filter(key => !documentKeys.has(key))];
53
+ if (orderedKeys.every((key, index) => key === currentKeys[index])) {
54
+ return;
55
+ }
56
+ const orderedEntries = orderedKeys.map(key => [key, mediaIdentifierMap.get(key)]);
57
+ mediaIdentifierMap.clear();
58
+ orderedEntries.forEach(([key, identifier]) => {
59
+ mediaIdentifierMap.set(key, identifier);
60
+ });
61
+ };
62
+
43
63
  // Ignored via go/ees005
44
64
  // eslint-disable-next-line @repo/internal/react/no-class-components
45
65
  export class MediaCardView extends Component {
@@ -145,7 +165,8 @@ export class MediaCardView extends Component {
145
165
  }
146
166
  const nodeIsInCache = id && mediaIdentifierMap.has(id) || url && mediaIdentifierMap.has(url);
147
167
  if (rendererContext && rendererContext.adDoc && !nodeIsInCache) {
148
- getListOfIdentifiersFromDoc(rendererContext.adDoc).forEach(identifier => {
168
+ const docIdentifiers = getListOfIdentifiersFromDoc(rendererContext.adDoc);
169
+ docIdentifiers.forEach(identifier => {
149
170
  if (identifier.mediaItemType === 'file' && identifier.id === id) {
150
171
  mediaIdentifierMap.set(identifier.id, {
151
172
  ...identifier,
@@ -155,6 +176,11 @@ export class MediaCardView extends Component {
155
176
  mediaIdentifierMap.set(identifier.dataURI, identifier);
156
177
  }
157
178
  });
179
+ // Reordering affects prev/next nav in every overlay viewer on the page, so gate it
180
+ // to the media-comments sidebar experiment that needs it; otherwise keep legacy order.
181
+ if (isExperimentEnabled('cc_comments_media_viewer_sidebar')) {
182
+ restoreDocumentOrder(docIdentifiers);
183
+ }
158
184
  }
159
185
  if (id) {
160
186
  this.saveFileState(id);
@@ -661,6 +661,17 @@ const headingWrapperInlineFlowStyles = css({
661
661
  marginTop: '1.59091em'
662
662
  }
663
663
  });
664
+ const headingAnchorWrapperTargetSizeStyles = css({
665
+ '& .renderer-heading-wrapper > h1, & .renderer-heading-wrapper > h2, & .renderer-heading-wrapper > h3, & .renderer-heading-wrapper > h4, & .renderer-heading-wrapper > h5, & .renderer-heading-wrapper > h6': {
666
+ verticalAlign: 'middle'
667
+ },
668
+ [`& .renderer-heading-wrapper > .${HeadingAnchorWrapperClassName}`]: {
669
+ display: 'inline-flex',
670
+ alignItems: 'center',
671
+ justifyContent: 'center',
672
+ verticalAlign: 'middle'
673
+ }
674
+ });
664
675
  const headingWithAlignmentStylesDuplicateAnchor = css({
665
676
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors
666
677
  '.fabric-editor-block-mark.fabric-editor-alignment:not(:first-child)': {
@@ -2948,7 +2959,7 @@ export const RendererStyleContainer = props => {
2948
2959
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- CSS custom properties for UGC font tokens
2949
2960
  '--ak-renderer-editor-font-small-text': editorUGCTokensRefreshed['editor.font.body.small']
2950
2961
  },
2951
- css: [expValEquals('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !isTableResizingEnabled(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
2962
+ css: [expValEquals('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !isTableResizingEnabled(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, isExperimentEnabled('platform_editor_heading_link_target_size') && headingAnchorWrapperTargetSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
2952
2963
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
2953
2964
  textHighlightPaddingStyles, tasksAndDecisionsStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingPanelStyles, smartCardStyles, smartCardStylesAvatarFix, headerSmartCardStyles, smartCardStylesAvatarMarginFix, smartCardStylesAvatarListZeroMarginTop, fg('editor_inline_comments_on_inline_nodes') && (expValEquals('confluence_fe_renderer_inline_node_mark_color_fix', 'isEnabled', true) ? rendererAnnotationStyles : rendererAnnotationStylesOld),
2954
2965
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
@@ -56,7 +56,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
56
56
  const TABLE_INFO_TIMEOUT = 10000;
57
57
  const RENDER_EVENT_SAMPLE_RATE = 0.1;
58
58
  const packageName = "@atlaskit/renderer";
59
- const packageVersion = "141.0.7";
59
+ const packageVersion = "142.0.1";
60
60
  const setAsQueryContainerStyles = css({
61
61
  containerName: 'ak-renderer-wrapper',
62
62
  containerType: 'inline-size'
@@ -279,6 +279,53 @@ var RendererActions = /*#__PURE__*/function () {
279
279
  });
280
280
  return Array.from(uniqueMarks.values());
281
281
  }
282
+ }, {
283
+ key: "getMediaNodeContext",
284
+ value: function getMediaNodeContext(identifier) {
285
+ if (!this.doc) {
286
+ return {
287
+ status: 'missing'
288
+ };
289
+ }
290
+ var candidates = [];
291
+ this.doc.descendants(function (node, position) {
292
+ if (node.type.name !== 'media' || node.attrs.type !== 'file' || node.attrs.id !== identifier.id) {
293
+ return true;
294
+ }
295
+ candidates.push({
296
+ fileId: identifier.id,
297
+ annotationIds: node.marks.filter(function (mark) {
298
+ return mark.type.name === 'annotation' && mark.attrs.annotationType === AnnotationTypes.INLINE_COMMENT;
299
+ }).map(function (mark) {
300
+ return mark.attrs.id;
301
+ }).filter(function (id) {
302
+ return typeof id === 'string';
303
+ }),
304
+ position: position,
305
+ displayText: node.attrs.alt || node.attrs.__fileName || node.attrs.fileName || node.attrs.name,
306
+ occurrenceKey: typeof node.attrs.occurrenceKey === 'string' ? node.attrs.occurrenceKey : undefined
307
+ });
308
+ return false;
309
+ });
310
+ var exactMatches = identifier.occurrenceKey ? candidates.filter(function (candidate) {
311
+ return candidate.occurrenceKey === identifier.occurrenceKey;
312
+ }) : [];
313
+ var matches = exactMatches.length > 0 ? exactMatches : candidates;
314
+ if (matches.length === 0) {
315
+ return {
316
+ status: 'missing'
317
+ };
318
+ }
319
+ if (matches.length > 1) {
320
+ return {
321
+ status: 'ambiguous'
322
+ };
323
+ }
324
+ return {
325
+ status: 'resolved',
326
+ context: matches[0]
327
+ };
328
+ }
282
329
  }, {
283
330
  key: "getAnnotationsByPosition",
284
331
  value: function getAnnotationsByPosition(range) {
@@ -0,0 +1,16 @@
1
+ ._1dqoglyw{border-style:none}._12ji1r31{outline-color:currentColor}
2
+ ._12y31o36{outline-width:medium}
3
+ ._19bvidpf{padding-left:0}
4
+ ._1bah1h6o{justify-content:center}
5
+ ._1bsb1tcg{width:24px}
6
+ ._1e0c116y{display:inline-flex}
7
+ ._1qu2glyw{outline-style:none}
8
+ ._4cvr1h6o{align-items:center}
9
+ ._4t3i1tcg{height:24px}
10
+ ._80omtlke{cursor:pointer}
11
+ ._bfhk1j28{background-color:transparent}
12
+ ._ca0qidpf{padding-top:0}
13
+ ._n3tdidpf{padding-bottom:0}
14
+ ._s7n4nkob{vertical-align:middle}
15
+ ._u5f3idpf{padding-right:0}
16
+ ._vchhusvi{box-sizing:border-box}
@@ -0,0 +1,15 @@
1
+ /* heading-anchor-button.tsx generated by @compiled/babel-plugin v3.0.2 */
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import "./heading-anchor-button.compiled.css";
4
+ import * as React from 'react';
5
+ import { ax, ix } from "@compiled/react/runtime";
6
+ var buttonStyles = null;
7
+
8
+ /** Heading link button with a minimum 24px pointer target. */
9
+ export default function HeadingAnchorButton(props) {
10
+ // eslint-disable-next-line react/jsx-props-no-spreading -- Forward the existing heading anchor's accessibility and event props.
11
+ return /*#__PURE__*/React.createElement("button", _extends({}, props, {
12
+ type: "button",
13
+ className: ax(["_12ji1r31 _1qu2glyw _12y31o36 _1dqoglyw _1e0c116y _vchhusvi _4cvr1h6o _1bah1h6o _1bsb1tcg _4t3i1tcg _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _s7n4nkob _bfhk1j28 _80omtlke"])
14
+ }));
15
+ }
@@ -26,13 +26,24 @@ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-e
26
26
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
27
27
  import Tooltip from '@atlaskit/tooltip/Tooltip';
28
28
  import { headingAnchorLinkMessages } from '../../messages';
29
+ import HeadingAnchorButton from './heading-anchor-button';
29
30
  export var HeadingAnchorWrapperClassName = 'heading-anchor-wrapper';
31
+ var headingAnchorWrapperTargetSizeStyles = css({
32
+ display: 'inline-flex',
33
+ boxSizing: 'border-box',
34
+ alignItems: 'center',
35
+ justifyContent: 'center',
36
+ width: '24px',
37
+ height: '24px',
38
+ verticalAlign: 'middle'
39
+ });
30
40
  var CopyAnchorWrapperWithRef = /*#__PURE__*/React.forwardRef(function (props, ref) {
31
41
  var children = props.children,
32
42
  rest = _objectWithoutProperties(props, _excluded);
33
43
  return jsx("span", _extends({}, rest, {
34
44
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
35
45
  className: HeadingAnchorWrapperClassName,
46
+ css: isExperimentEnabled('platform_editor_heading_link_target_size') ? headingAnchorWrapperTargetSizeStyles : undefined,
36
47
  ref: ref
37
48
  }), children);
38
49
  });
@@ -45,6 +56,11 @@ var copyAnchorButtonStyles = css({
45
56
  cursor: 'pointer',
46
57
  right: 0
47
58
  });
59
+ var scaledLinkIconStyles = css({
60
+ display: 'inline-flex',
61
+ transform: 'scale(1.5)',
62
+ transformOrigin: 'center'
63
+ });
48
64
  // Ignored via go/ees005
49
65
  // eslint-disable-next-line @repo/internal/react/no-class-components
50
66
  var HeadingAnchor = /*#__PURE__*/function (_React$PureComponent) {
@@ -123,6 +139,27 @@ var HeadingAnchor = /*#__PURE__*/function (_React$PureComponent) {
123
139
  heading: headingId
124
140
  }) : headingId;
125
141
  var tabIndex = expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? 0 : hideFromScreenReader ? undefined : -1;
142
+ if (isExperimentEnabled('platform_editor_heading_link_target_size')) {
143
+ return jsx(HeadingAnchorButton, {
144
+ "data-testid": "anchor-button",
145
+ id: _this.copyLinkId,
146
+ onMouseLeave: _this.resetMessage,
147
+ onBlur: _this.resetMessage,
148
+ onClick: _this.copyToClipboard,
149
+ "aria-hidden": hideFromScreenReader,
150
+ tabIndex: tabIndex,
151
+ "aria-label": hideFromScreenReader ? undefined : _this.state.tooltipMessage,
152
+ "aria-labelledby": hideFromScreenReader ? undefined : labelledBy,
153
+ type: "button"
154
+ }, jsx("span", {
155
+ css: scaledLinkIconStyles,
156
+ "data-testid": "scaled-link-icon"
157
+ }, jsx(LinkIcon, {
158
+ label: _this.getCopyAriaLabel(),
159
+ size: "medium",
160
+ color: _this.state.isClicked ? "var(--ds-icon-selected, #1868DB)" : "var(--ds-icon-subtle, #505258)"
161
+ })));
162
+ }
126
163
  return jsx("button", {
127
164
  "data-testid": "anchor-button",
128
165
  id: _this.copyLinkId,
@@ -291,7 +291,8 @@ var Media = /*#__PURE__*/function (_PureComponent) {
291
291
  height = _this$props3.height,
292
292
  mediaSingleElement = _this$props3.mediaSingleElement,
293
293
  _this$props3$isDrafti = _this$props3.isDrafting,
294
- isDrafting = _this$props3$isDrafti === void 0 ? false : _this$props3$isDrafti;
294
+ isDrafting = _this$props3$isDrafti === void 0 ? false : _this$props3$isDrafti,
295
+ mediaViewerExtensions = _this$props3.mediaViewerExtensions;
295
296
  var annotationMarks = _this.props.isAnnotationMark ? _this.props.marks.filter(_this.props.isAnnotationMark) : undefined;
296
297
  var borderMark = _this.props.marks.find(_this.props.isBorderMark);
297
298
  var dataConsumerMark = _this.getDataConsumerMark();
@@ -345,7 +346,8 @@ var Media = /*#__PURE__*/function (_PureComponent) {
345
346
  shouldEnableDownloadButton: enableDownloadButton,
346
347
  ssr: ssr,
347
348
  onError: _this.props.onMediaRenderEvent || _this.props.onError ? _this.onError : undefined,
348
- onPreviewRender: _this.props.onMediaRenderEvent || _this.props.onPreviewRender ? _this.onPreviewRender : undefined
349
+ onPreviewRender: _this.props.onMediaRenderEvent || _this.props.onPreviewRender ? _this.onPreviewRender : undefined,
350
+ mediaViewerExtensions: mediaViewerExtensions
349
351
  }))))));
350
352
  });
351
353
  _defineProperty(_this, "handleMediaLinkClick", function (event) {
@@ -6,6 +6,8 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _inherits from "@babel/runtime/helpers/inherits";
8
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
10
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
9
11
  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; }
10
12
  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) { _defineProperty(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; }
11
13
  import _regeneratorRuntime from "@babel/runtime/regenerator";
@@ -20,6 +22,7 @@ import CardAsync from '@atlaskit/media-card/cardLoader';
20
22
  import { CardLoading } from '@atlaskit/media-card/cardLoading';
21
23
  import CardSync from '@atlaskit/media-card/cardSync';
22
24
  import { MediaClientContext } from '@atlaskit/media-client-react/media-client-provider';
25
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
23
26
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
24
27
  import AnalyticsContext from '../analytics/analyticsContext';
25
28
  export var mediaIdentifierMap = new Map();
@@ -52,6 +55,38 @@ export var getListOfIdentifiersFromDoc = function getListOfIdentifiersFromDoc(do
52
55
  }, []);
53
56
  };
54
57
 
58
+ /**
59
+ * `mediaIdentifierMap` is the Media Viewer's nav list, but a `Map` can only append —
60
+ * a card that unmounts and re-registers lands last, scrambling nav order. Rebuild it
61
+ * in document order; entries from other renderers on the page keep their old order.
62
+ */
63
+ var restoreDocumentOrder = function restoreDocumentOrder(docIdentifiers) {
64
+ var documentKeys = new Set(docIdentifiers.map(function (identifier) {
65
+ return identifier.mediaItemType === 'file' ? identifier.id : identifier.dataURI;
66
+ }).filter(function (key) {
67
+ return mediaIdentifierMap.has(key);
68
+ }));
69
+ var currentKeys = Array.from(mediaIdentifierMap.keys());
70
+ var orderedKeys = [].concat(_toConsumableArray(documentKeys), _toConsumableArray(currentKeys.filter(function (key) {
71
+ return !documentKeys.has(key);
72
+ })));
73
+ if (orderedKeys.every(function (key, index) {
74
+ return key === currentKeys[index];
75
+ })) {
76
+ return;
77
+ }
78
+ var orderedEntries = orderedKeys.map(function (key) {
79
+ return [key, mediaIdentifierMap.get(key)];
80
+ });
81
+ mediaIdentifierMap.clear();
82
+ orderedEntries.forEach(function (_ref) {
83
+ var _ref2 = _slicedToArray(_ref, 2),
84
+ key = _ref2[0],
85
+ identifier = _ref2[1];
86
+ mediaIdentifierMap.set(key, identifier);
87
+ });
88
+ };
89
+
55
90
  // Ignored via go/ees005
56
91
  // eslint-disable-next-line @repo/internal/react/no-class-components
57
92
  export var MediaCardView = /*#__PURE__*/function (_Component) {
@@ -64,7 +99,7 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
64
99
  _this = _callSuper(this, MediaCardView, [].concat(args));
65
100
  _defineProperty(_this, "state", {});
66
101
  _defineProperty(_this, "saveFileState", /*#__PURE__*/function () {
67
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id) {
102
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id) {
68
103
  var _this$props, collectionName, mediaClient, options, fileState, _t;
69
104
  return _regeneratorRuntime.wrap(function (_context) {
70
105
  while (1) switch (_context.prev = _context.next) {
@@ -98,7 +133,7 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
98
133
  }, _callee, null, [[1, 4]]);
99
134
  }));
100
135
  return function (_x) {
101
- return _ref.apply(this, arguments);
136
+ return _ref3.apply(this, arguments);
102
137
  };
103
138
  }());
104
139
  _defineProperty(_this, "onError", function (reason) {
@@ -165,7 +200,7 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
165
200
  key: "componentDidMount",
166
201
  value: function () {
167
202
  var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
168
- var _this$props6, rendererContext, contextIdentifierProvider, id, url, collectionName, nodeIsInCache, _t2, _t3;
203
+ var _this$props6, rendererContext, contextIdentifierProvider, id, url, collectionName, nodeIsInCache, docIdentifiers, _t2, _t3;
169
204
  return _regeneratorRuntime.wrap(function (_context2) {
170
205
  while (1) switch (_context2.prev = _context2.next) {
171
206
  case 0:
@@ -185,7 +220,8 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
185
220
  case 2:
186
221
  nodeIsInCache = id && mediaIdentifierMap.has(id) || url && mediaIdentifierMap.has(url);
187
222
  if (rendererContext && rendererContext.adDoc && !nodeIsInCache) {
188
- getListOfIdentifiersFromDoc(rendererContext.adDoc).forEach(function (identifier) {
223
+ docIdentifiers = getListOfIdentifiersFromDoc(rendererContext.adDoc);
224
+ docIdentifiers.forEach(function (identifier) {
189
225
  if (identifier.mediaItemType === 'file' && identifier.id === id) {
190
226
  mediaIdentifierMap.set(identifier.id, _objectSpread(_objectSpread({}, identifier), {}, {
191
227
  collectionName: collectionName
@@ -194,6 +230,11 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
194
230
  mediaIdentifierMap.set(identifier.dataURI, identifier);
195
231
  }
196
232
  });
233
+ // Reordering affects prev/next nav in every overlay viewer on the page, so gate it
234
+ // to the media-comments sidebar experiment that needs it; otherwise keep legacy order.
235
+ if (isExperimentEnabled('cc_comments_media_viewer_sidebar')) {
236
+ restoreDocumentOrder(docIdentifiers);
237
+ }
197
238
  }
198
239
  if (id) {
199
240
  this.saveFileState(id);
@@ -391,13 +432,13 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
391
432
  }]);
392
433
  }(Component);
393
434
  // Needed for copy & paste
394
- export var getClipboardAttrs = function getClipboardAttrs(_ref2) {
395
- var id = _ref2.id,
396
- alt = _ref2.alt,
397
- collection = _ref2.collection,
398
- contextIdentifierProvider = _ref2.contextIdentifierProvider,
399
- originalDimensions = _ref2.originalDimensions,
400
- fileState = _ref2.fileState;
435
+ export var getClipboardAttrs = function getClipboardAttrs(_ref4) {
436
+ var id = _ref4.id,
437
+ alt = _ref4.alt,
438
+ collection = _ref4.collection,
439
+ contextIdentifierProvider = _ref4.contextIdentifierProvider,
440
+ originalDimensions = _ref4.originalDimensions,
441
+ fileState = _ref4.fileState;
401
442
  var contextId = contextIdentifierProvider && contextIdentifierProvider.objectId;
402
443
  var width = originalDimensions && originalDimensions.width;
403
444
  var height = originalDimensions && originalDimensions.height;
@@ -425,8 +466,8 @@ export var getClipboardAttrs = function getClipboardAttrs(_ref2) {
425
466
  };
426
467
  export var MediaCardInternal = function MediaCardInternal(props) {
427
468
  var mediaClient = useContext(MediaClientContext);
428
- return /*#__PURE__*/React.createElement(AnalyticsContext.Consumer, null, function (_ref3) {
429
- var fireAnalyticsEvent = _ref3.fireAnalyticsEvent;
469
+ return /*#__PURE__*/React.createElement(AnalyticsContext.Consumer, null, function (_ref5) {
470
+ var fireAnalyticsEvent = _ref5.fireAnalyticsEvent;
430
471
  return /*#__PURE__*/React.createElement(MediaCardView
431
472
  // Ignored via go/ees005
432
473
  // eslint-disable-next-line react/jsx-props-no-spreading
@@ -1,5 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- var _css9, _$concat3, _$concat5;
2
+ var _css0, _$concat3, _$concat5;
3
3
  /* eslint-disable @atlaskit/ui-styling-standard/no-important-styles, @atlaskit/ui-styling-standard/no-unsafe-selectors */
4
4
  /* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */
5
5
  /* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values */
@@ -547,6 +547,16 @@ var headingWrapperInlineFlowStyles = css(_defineProperty(_defineProperty(_define
547
547
  // eslint-disable-next-line @atlaskit/design-system/use-tokens-space
548
548
  marginTop: '1.59091em'
549
549
  }));
550
+ var headingAnchorWrapperTargetSizeStyles = css(_defineProperty({
551
+ '& .renderer-heading-wrapper > h1, & .renderer-heading-wrapper > h2, & .renderer-heading-wrapper > h3, & .renderer-heading-wrapper > h4, & .renderer-heading-wrapper > h5, & .renderer-heading-wrapper > h6': {
552
+ verticalAlign: 'middle'
553
+ }
554
+ }, "& .renderer-heading-wrapper > .".concat(HeadingAnchorWrapperClassName), {
555
+ display: 'inline-flex',
556
+ alignItems: 'center',
557
+ justifyContent: 'center',
558
+ verticalAlign: 'middle'
559
+ }));
550
560
  var headingWithAlignmentStylesDuplicateAnchor = css({
551
561
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors
552
562
  '.fabric-editor-block-mark.fabric-editor-alignment:not(:first-child)': {
@@ -637,13 +647,13 @@ var paragraphStylesUGCScaledMargin = css({
637
647
  marginBottom: 0
638
648
  }
639
649
  });
640
- var listsSharedStyles = css((_css9 = {
650
+ var listsSharedStyles = css((_css0 = {
641
651
  /* =============== INDENTATION SPACING ========= */
642
652
  'ul, ol': {
643
653
  boxSizing: 'border-box',
644
654
  paddingLeft: "var(--ed--list--item-counter--padding, ".concat(listItemCounterPadding, "px)")
645
655
  }
646
- }, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_css9, "".concat(orderedListSelector, ", ").concat(bulletListSelector), {
656
+ }, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_css0, "".concat(orderedListSelector, ", ").concat(bulletListSelector), {
647
657
  /*
648
658
  Ensures list item content adheres to the list's margin instead
649
659
  of filling the entire block row. This is important to allow
@@ -675,7 +685,7 @@ var listsSharedStyles = css((_css9 = {
675
685
  listStyleType: 'lower-alpha'
676
686
  }), 'ol[data-indent-level="3"], ol[data-indent-level="6"]', {
677
687
  listStyleType: 'lower-roman'
678
- }), _defineProperty(_defineProperty(_defineProperty(_css9, 'ul[data-indent-level="1"], ul[data-indent-level="4"]', {
688
+ }), _defineProperty(_defineProperty(_defineProperty(_css0, 'ul[data-indent-level="1"], ul[data-indent-level="4"]', {
679
689
  listStyleType: 'disc'
680
690
  }), 'ul[data-indent-level="2"], ul[data-indent-level="5"]', {
681
691
  listStyleType: 'circle'
@@ -2306,7 +2316,7 @@ export var RendererStyleContainer = function RendererStyleContainer(props) {
2306
2316
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- CSS custom properties for UGC font tokens
2307
2317
  '--ak-renderer-editor-font-small-text': editorUGCTokensRefreshed['editor.font.body.small']
2308
2318
  },
2309
- css: [expValEquals('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !isTableResizingEnabled(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
2319
+ css: [expValEquals('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !isTableResizingEnabled(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, isExperimentEnabled('platform_editor_heading_link_target_size') && headingAnchorWrapperTargetSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
2310
2320
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
2311
2321
  textHighlightPaddingStyles, tasksAndDecisionsStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingPanelStyles, smartCardStyles, smartCardStylesAvatarFix, headerSmartCardStyles, smartCardStylesAvatarMarginFix, smartCardStylesAvatarListZeroMarginTop, fg('editor_inline_comments_on_inline_nodes') && (expValEquals('confluence_fe_renderer_inline_node_mark_color_fix', 'isEnabled', true) ? rendererAnnotationStyles : rendererAnnotationStylesOld),
2312
2322
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
@@ -61,7 +61,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
61
61
  var TABLE_INFO_TIMEOUT = 10000;
62
62
  var RENDER_EVENT_SAMPLE_RATE = 0.1;
63
63
  var packageName = "@atlaskit/renderer";
64
- var packageVersion = "141.0.7";
64
+ var packageVersion = "142.0.1";
65
65
  var setAsQueryContainerStyles = css({
66
66
  containerName: 'ak-renderer-wrapper',
67
67
  containerType: 'inline-size'
@@ -1,3 +1,4 @@
1
+ import type { AnnotationId } from '@atlaskit/adf-schema/annotation';
1
2
  import { AnnotationTypes } from '@atlaskit/adf-schema/annotation';
2
3
  import type { AnnotationActionResult, AnnotationByMatches, SelectionContext } from '@atlaskit/editor-common/types';
3
4
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer/types';
@@ -17,6 +18,21 @@ type Annotation = {
17
18
  annotationId: string;
18
19
  annotationType: AnnotationTypes;
19
20
  };
21
+ export type MediaNodeContext = {
22
+ annotationIds: AnnotationId[];
23
+ displayText?: string;
24
+ fileId: string;
25
+ occurrenceKey?: string;
26
+ position: number;
27
+ };
28
+ export type MediaNodeContextResult = {
29
+ context: MediaNodeContext;
30
+ status: 'resolved';
31
+ } | {
32
+ status: 'missing';
33
+ } | {
34
+ status: 'ambiguous';
35
+ };
20
36
  interface RendererActionsOptions {
21
37
  annotate: (range: Range, annotationId: string, annotationType: 'inlineComment') => ActionResult;
22
38
  deleteAnnotation: (annotationId: string, annotationType: 'inlineComment') => ActionResult;
@@ -68,6 +84,10 @@ export default class RendererActions implements RendererActionsOptions, Annotati
68
84
  getPositionFromRange(range: Range | null): Position | false;
69
85
  getSelectionContext(): SelectionContext | null;
70
86
  getAnnotationMarks(): Mark[];
87
+ getMediaNodeContext(identifier: {
88
+ id: string;
89
+ occurrenceKey?: string;
90
+ }): MediaNodeContextResult;
71
91
  getAnnotationsByPosition(range: Range): string[];
72
92
  applyAnnotation(pos: Position, annotation: Annotation): AnnotationActionResult;
73
93
  generateAnnotationIndexMatch(pos: Position): AnnotationByMatches | false;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import type { ButtonHTMLAttributes, JSX } from 'react';
6
+ /** Heading link button with a minimum 24px pointer target. */
7
+ export default function HeadingAnchorButton(props: ButtonHTMLAttributes<HTMLButtonElement>): JSX.Element;
@@ -12,6 +12,7 @@ import type { LinkDefinition } from '@atlaskit/adf-schema/link';
12
12
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
13
13
  import type { EventHandlers } from '@atlaskit/editor-common/ui';
14
14
  import type { MediaFeatureFlags } from '@atlaskit/media-common';
15
+ import type { MediaViewerExtensions } from '@atlaskit/media-viewer/types';
15
16
  import type { AnalyticsEventPayload } from '../../../analytics/events';
16
17
  import type { MediaRenderEvent } from '../../../types/mediaOptions';
17
18
  import type { MediaCardProps } from '../../../ui/MediaCard';
@@ -31,6 +32,8 @@ export type MediaProps = MediaCardProps & {
31
32
  isLinkMark: () => boolean;
32
33
  marks: Array<LinkDefinition | BorderMarkDefinition | AnnotationMarkDefinition | DataConsumerDefinition>;
33
34
  mediaSingleElement?: HTMLElement | null;
35
+ /** Extensions for the media viewer (e.g. sidebar with comment indicator). */
36
+ mediaViewerExtensions?: MediaViewerExtensions;
34
37
  onMediaRenderEvent?: (event: MediaRenderEvent) => void;
35
38
  providers?: ProviderFactory;
36
39
  width?: number;
@@ -39,7 +39,9 @@ export interface MediaOptions {
39
39
  */
40
40
  fallbackMediaNameFetcher?: (id: string) => Promise<string>;
41
41
  featureFlags?: MediaFeatureFlags;
42
- /** Extensions for the media viewer header (e.g. comment navigation button). */
42
+ /** Extensions for the media viewer (e.g. header action buttons, sidebar with comment indicator).
43
+ * When provided, the media viewer will use these extensions for all media items.
44
+ * Use headerActions.isVisible to control per-item header action visibility. */
43
45
  mediaViewerExtensions?: MediaViewerExtensions;
44
46
  /** Receives lifecycle events for each rendered media node. */
45
47
  onMediaRenderEvent?: (event: MediaRenderEvent) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "142.0.0",
3
+ "version": "142.1.0",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/feature-gate-js-client": "^6.0.0",
54
54
  "@atlaskit/icon": "^37.7.0",
55
55
  "@atlaskit/link": "^5.1.0",
56
- "@atlaskit/link-datasource": "^6.13.0",
56
+ "@atlaskit/link-datasource": "^6.14.0",
57
57
  "@atlaskit/link-extractors": "^4.2.0",
58
58
  "@atlaskit/linking-common": "^12.3.0",
59
59
  "@atlaskit/media-card": "^81.12.0",
@@ -69,12 +69,12 @@
69
69
  "@atlaskit/pragmatic-drag-and-drop": "^3.1.0",
70
70
  "@atlaskit/react-compiler-gating": "^0.2.0",
71
71
  "@atlaskit/react-ufo": "^7.13.0",
72
- "@atlaskit/smart-card": "^45.25.0",
72
+ "@atlaskit/smart-card": "^45.28.0",
73
73
  "@atlaskit/status": "^5.12.0",
74
74
  "@atlaskit/task-decision": "^21.10.0",
75
75
  "@atlaskit/theme": "^28.2.0",
76
76
  "@atlaskit/tmp-editor-statsig": "^202.0.0",
77
- "@atlaskit/tokens": "^18.2.0",
77
+ "@atlaskit/tokens": "^18.3.0",
78
78
  "@atlaskit/tooltip": "^24.3.0",
79
79
  "@atlaskit/visually-hidden": "^4.4.0",
80
80
  "@babel/runtime": "^7.0.0",
@@ -88,7 +88,7 @@
88
88
  "uuid": "^11.1.1"
89
89
  },
90
90
  "peerDependencies": {
91
- "@atlaskit/editor-common": "^123.6.0",
91
+ "@atlaskit/editor-common": "^123.7.0",
92
92
  "@atlaskit/link-provider": "^5.7.0",
93
93
  "@atlaskit/media-core": "^38.2.0",
94
94
  "react": "^18.2.0 || ^19.2.0",