@atlaskit/renderer 139.0.0 → 139.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.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/react/index.js +9 -7
- package/dist/cjs/react/nodes/media/index.js +84 -23
- package/dist/cjs/ui/MediaCard.js +57 -44
- package/dist/cjs/ui/Renderer/RendererStyleContainer.js +7 -1
- package/dist/es2019/react/index.js +8 -7
- package/dist/es2019/react/nodes/media/index.js +59 -7
- package/dist/es2019/ui/MediaCard.js +17 -4
- package/dist/es2019/ui/Renderer/RendererStyleContainer.js +9 -1
- package/dist/esm/react/index.js +9 -7
- package/dist/esm/react/nodes/media/index.js +84 -23
- package/dist/esm/ui/MediaCard.js +57 -44
- package/dist/esm/ui/Renderer/RendererStyleContainer.js +7 -1
- package/dist/types/react/nodes/media/index.d.ts +2 -0
- package/dist/types/types/mediaOptions.d.ts +16 -0
- package/dist/types/ui/MediaCard.d.ts +5 -1
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 139.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`d3a7f9016da28`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d3a7f9016da28) -
|
|
8
|
+
Add media render lifecycle callbacks for Remix-generated media behind
|
|
9
|
+
cc-maui-add-mark-for-remix-generated-images.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`f07b2560158eb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f07b2560158eb) -
|
|
14
|
+
Fix Expand top-margin shifts during streaming SSR hydration behind
|
|
15
|
+
platform_renderer_expand_ssr_margin_fix.
|
|
16
|
+
|
|
3
17
|
## 139.0.0
|
|
4
18
|
|
|
5
19
|
### Major Changes
|
package/dist/cjs/react/index.js
CHANGED
|
@@ -509,7 +509,8 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
|
|
|
509
509
|
_this$media,
|
|
510
510
|
_this$media2,
|
|
511
511
|
_this$media3,
|
|
512
|
-
_this$media4
|
|
512
|
+
_this$media4,
|
|
513
|
+
_this$media5;
|
|
513
514
|
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
514
515
|
var _node$type$schema$mar = node.type.schema.marks,
|
|
515
516
|
annotation = _node$type$schema$mar.annotation,
|
|
@@ -546,6 +547,7 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
|
|
|
546
547
|
enableSyncMediaCard: (_this$media2 = this.media) === null || _this$media2 === void 0 ? void 0 : _this$media2.enableSyncMediaCard,
|
|
547
548
|
mediaViewerExtensions: (_this$media3 = this.media) === null || _this$media3 === void 0 ? void 0 : _this$media3.mediaViewerExtensions,
|
|
548
549
|
fallbackMediaNameFetcher: (_this$media4 = this.media) === null || _this$media4 === void 0 ? void 0 : _this$media4.fallbackMediaNameFetcher,
|
|
550
|
+
onMediaRenderEvent: (_this$media5 = this.media) === null || _this$media5 === void 0 ? void 0 : _this$media5.onMediaRenderEvent,
|
|
549
551
|
nestedUnder: nestedUnder
|
|
550
552
|
});
|
|
551
553
|
}
|
|
@@ -608,22 +610,22 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
|
|
|
608
610
|
}, {
|
|
609
611
|
key: "getMediaGroupProps",
|
|
610
612
|
value: function getMediaGroupProps(node) {
|
|
611
|
-
var _this$
|
|
613
|
+
var _this$media6, _this$media7;
|
|
612
614
|
return _objectSpread(_objectSpread({}, this.getProps(node)), {}, {
|
|
613
615
|
shouldOpenMediaViewer: this.shouldOpenMediaViewer,
|
|
614
616
|
allowAltTextOnImages: this.allowAltTextOnImages,
|
|
615
617
|
featureFlags: this.media && this.media.featureFlags,
|
|
616
|
-
enableDownloadButton: (_this$
|
|
617
|
-
ssr: (_this$
|
|
618
|
+
enableDownloadButton: (_this$media6 = this.media) === null || _this$media6 === void 0 ? void 0 : _this$media6.enableDownloadButton,
|
|
619
|
+
ssr: (_this$media7 = this.media) === null || _this$media7 === void 0 ? void 0 : _this$media7.ssr
|
|
618
620
|
});
|
|
619
621
|
}
|
|
620
622
|
}, {
|
|
621
623
|
key: "getMediaInlineProps",
|
|
622
624
|
value: function getMediaInlineProps(node) {
|
|
623
|
-
var _this$
|
|
625
|
+
var _this$media8, _this$media9;
|
|
624
626
|
return _objectSpread(_objectSpread({}, this.getProps(node)), {}, {
|
|
625
|
-
ssr: (_this$
|
|
626
|
-
fallbackMediaNameFetcher: (_this$
|
|
627
|
+
ssr: (_this$media8 = this.media) === null || _this$media8 === void 0 ? void 0 : _this$media8.ssr,
|
|
628
|
+
fallbackMediaNameFetcher: (_this$media9 = this.media) === null || _this$media9 === void 0 ? void 0 : _this$media9.fallbackMediaNameFetcher
|
|
627
629
|
});
|
|
628
630
|
}
|
|
629
631
|
}, {
|
|
@@ -45,6 +45,15 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
45
45
|
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; }
|
|
46
46
|
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)); }
|
|
47
47
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
48
|
+
var getDataConsumerMark = function getDataConsumerMark(marks) {
|
|
49
|
+
return marks.find(function (mark) {
|
|
50
|
+
var _mark$type;
|
|
51
|
+
return mark.type === 'dataConsumer' || ((_mark$type = mark.type) === null || _mark$type === void 0 ? void 0 : _mark$type.name) === 'dataConsumer';
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
var getRemixDataConsumerMark = function getRemixDataConsumerMark(marks) {
|
|
55
|
+
return (0, _fg.fg)('cc-maui-add-mark-for-remix-generated-images') ? getDataConsumerMark(marks) : undefined;
|
|
56
|
+
};
|
|
48
57
|
var linkStyle = (0, _react2.css)({
|
|
49
58
|
position: 'absolute',
|
|
50
59
|
background: 'transparent',
|
|
@@ -241,32 +250,60 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref5) {
|
|
|
241
250
|
// Ignored via go/ees005
|
|
242
251
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
243
252
|
var Media = /*#__PURE__*/function (_PureComponent) {
|
|
244
|
-
function Media(
|
|
253
|
+
function Media(_props) {
|
|
245
254
|
var _this;
|
|
246
255
|
(0, _classCallCheck2.default)(this, Media);
|
|
247
|
-
_this = _callSuper(this, Media, [
|
|
256
|
+
_this = _callSuper(this, Media, [_props]);
|
|
257
|
+
(0, _defineProperty2.default)(_this, "mediaInstance", {});
|
|
248
258
|
(0, _defineProperty2.default)(_this, "getDataConsumerMark", function () {
|
|
249
|
-
return (
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
259
|
+
return getRemixDataConsumerMark(_this.props.marks);
|
|
260
|
+
});
|
|
261
|
+
(0, _defineProperty2.default)(_this, "getDataConsumerSource", function () {
|
|
262
|
+
var _getDataConsumerMark;
|
|
263
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props;
|
|
264
|
+
return (_getDataConsumerMark = getDataConsumerMark(props.marks)) === null || _getDataConsumerMark === void 0 || (_getDataConsumerMark = _getDataConsumerMark.attrs.sources) === null || _getDataConsumerMark === void 0 ? void 0 : _getDataConsumerMark[0];
|
|
265
|
+
});
|
|
266
|
+
(0, _defineProperty2.default)(_this, "emitMediaRenderEvent", function (event) {
|
|
267
|
+
var _props$onMediaRenderE;
|
|
268
|
+
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _this.props;
|
|
269
|
+
(_props$onMediaRenderE = props.onMediaRenderEvent) === null || _props$onMediaRenderE === void 0 || _props$onMediaRenderE.call(props, _objectSpread(_objectSpread({}, event), {}, {
|
|
270
|
+
dataConsumerSource: _this.getDataConsumerSource(props),
|
|
271
|
+
mediaId: props.id,
|
|
272
|
+
mediaInstance: _this.mediaInstance
|
|
273
|
+
}));
|
|
274
|
+
});
|
|
275
|
+
(0, _defineProperty2.default)(_this, "onPreviewRender", function (renderedMediaId) {
|
|
276
|
+
var _this$props$onPreview, _this$props;
|
|
277
|
+
(_this$props$onPreview = (_this$props = _this.props).onPreviewRender) === null || _this$props$onPreview === void 0 || _this$props$onPreview.call(_this$props, renderedMediaId);
|
|
278
|
+
_this.emitMediaRenderEvent({
|
|
279
|
+
renderedMediaId: renderedMediaId,
|
|
280
|
+
type: 'preview-rendered'
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
(0, _defineProperty2.default)(_this, "onError", function (reason) {
|
|
284
|
+
var _this$props$onError, _this$props2;
|
|
285
|
+
(_this$props$onError = (_this$props2 = _this.props).onError) === null || _this$props$onError === void 0 || _this$props$onError.call(_this$props2, reason);
|
|
286
|
+
_this.emitMediaRenderEvent({
|
|
287
|
+
reason: reason,
|
|
288
|
+
type: 'error'
|
|
289
|
+
});
|
|
253
290
|
});
|
|
254
291
|
(0, _defineProperty2.default)(_this, "renderCard", function () {
|
|
255
292
|
var _dataConsumerMark$att;
|
|
256
293
|
var providers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
257
294
|
var contextIdentifierProvider = providers.contextIdentifierProvider;
|
|
258
|
-
var _this$
|
|
259
|
-
allowAltTextOnImages = _this$
|
|
260
|
-
alt = _this$
|
|
261
|
-
featureFlags = _this$
|
|
262
|
-
allowMediaViewer = _this$
|
|
263
|
-
enableDownloadButton = _this$
|
|
264
|
-
ssr = _this$
|
|
265
|
-
width = _this$
|
|
266
|
-
height = _this$
|
|
267
|
-
mediaSingleElement = _this$
|
|
268
|
-
_this$
|
|
269
|
-
isDrafting = _this$
|
|
295
|
+
var _this$props3 = _this.props,
|
|
296
|
+
allowAltTextOnImages = _this$props3.allowAltTextOnImages,
|
|
297
|
+
alt = _this$props3.alt,
|
|
298
|
+
featureFlags = _this$props3.featureFlags,
|
|
299
|
+
allowMediaViewer = _this$props3.shouldOpenMediaViewer,
|
|
300
|
+
enableDownloadButton = _this$props3.enableDownloadButton,
|
|
301
|
+
ssr = _this$props3.ssr,
|
|
302
|
+
width = _this$props3.width,
|
|
303
|
+
height = _this$props3.height,
|
|
304
|
+
mediaSingleElement = _this$props3.mediaSingleElement,
|
|
305
|
+
_this$props3$isDrafti = _this$props3.isDrafting,
|
|
306
|
+
isDrafting = _this$props3$isDrafti === void 0 ? false : _this$props3$isDrafti;
|
|
270
307
|
var annotationMarks = _this.props.isAnnotationMark ? _this.props.marks.filter(_this.props.isAnnotationMark) : undefined;
|
|
271
308
|
var borderMark = _this.props.marks.find(_this.props.isBorderMark);
|
|
272
309
|
var dataConsumerMark = _this.getDataConsumerMark();
|
|
@@ -318,14 +355,16 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
318
355
|
alt: allowAltTextOnImages ? alt : undefined,
|
|
319
356
|
featureFlags: featureFlags,
|
|
320
357
|
shouldEnableDownloadButton: enableDownloadButton,
|
|
321
|
-
ssr: ssr
|
|
358
|
+
ssr: ssr,
|
|
359
|
+
onError: _this.props.onMediaRenderEvent || _this.props.onError ? _this.onError : undefined,
|
|
360
|
+
onPreviewRender: _this.props.onMediaRenderEvent || _this.props.onPreviewRender ? _this.onPreviewRender : undefined
|
|
322
361
|
}))))));
|
|
323
362
|
});
|
|
324
363
|
(0, _defineProperty2.default)(_this, "handleMediaLinkClick", function (event) {
|
|
325
|
-
var _this$
|
|
326
|
-
fireAnalyticsEvent = _this$
|
|
327
|
-
isLinkMark = _this$
|
|
328
|
-
marks = _this$
|
|
364
|
+
var _this$props4 = _this.props,
|
|
365
|
+
fireAnalyticsEvent = _this$props4.fireAnalyticsEvent,
|
|
366
|
+
isLinkMark = _this$props4.isLinkMark,
|
|
367
|
+
marks = _this$props4.marks;
|
|
329
368
|
if (fireAnalyticsEvent) {
|
|
330
369
|
fireAnalyticsEvent({
|
|
331
370
|
action: _analytics.ACTION.VISITED,
|
|
@@ -354,6 +393,9 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
354
393
|
key: "componentDidMount",
|
|
355
394
|
value: function componentDidMount() {
|
|
356
395
|
var _dataConsumerMark$att2;
|
|
396
|
+
this.emitMediaRenderEvent({
|
|
397
|
+
type: 'mounted'
|
|
398
|
+
});
|
|
357
399
|
var dataConsumerMark = this.getDataConsumerMark();
|
|
358
400
|
var infographicType = dataConsumerMark === null || dataConsumerMark === void 0 || (_dataConsumerMark$att2 = dataConsumerMark.attrs.sources) === null || _dataConsumerMark$att2 === void 0 ? void 0 : _dataConsumerMark$att2[0];
|
|
359
401
|
if (infographicType && this.props.fireAnalyticsEvent) {
|
|
@@ -370,6 +412,25 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
370
412
|
});
|
|
371
413
|
}
|
|
372
414
|
}
|
|
415
|
+
}, {
|
|
416
|
+
key: "componentDidUpdate",
|
|
417
|
+
value: function componentDidUpdate(prevProps) {
|
|
418
|
+
if (prevProps.id !== this.props.id || this.getDataConsumerSource(prevProps) !== this.getDataConsumerSource() || prevProps.onMediaRenderEvent !== this.props.onMediaRenderEvent) {
|
|
419
|
+
this.emitMediaRenderEvent({
|
|
420
|
+
type: 'unmounted'
|
|
421
|
+
}, prevProps);
|
|
422
|
+
this.emitMediaRenderEvent({
|
|
423
|
+
type: 'mounted'
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}, {
|
|
428
|
+
key: "componentWillUnmount",
|
|
429
|
+
value: function componentWillUnmount() {
|
|
430
|
+
this.emitMediaRenderEvent({
|
|
431
|
+
type: 'unmounted'
|
|
432
|
+
});
|
|
433
|
+
}
|
|
373
434
|
}, {
|
|
374
435
|
key: "render",
|
|
375
436
|
value: function render() {
|
package/dist/cjs/ui/MediaCard.js
CHANGED
|
@@ -108,11 +108,12 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
108
108
|
};
|
|
109
109
|
}());
|
|
110
110
|
(0, _defineProperty2.default)(_this, "onError", function (reason) {
|
|
111
|
-
var _this$props$fireAnaly, _this$
|
|
111
|
+
var _this$props$onError, _this$props3, _this$props$fireAnaly, _this$props4;
|
|
112
112
|
var _this$props2 = _this.props,
|
|
113
113
|
nestedUnder = _this$props2.nestedUnder,
|
|
114
114
|
rendererContext = _this$props2.rendererContext;
|
|
115
|
-
(_this$props$
|
|
115
|
+
(_this$props$onError = (_this$props3 = _this.props).onError) === null || _this$props$onError === void 0 || _this$props$onError.call(_this$props3, reason);
|
|
116
|
+
(_this$props$fireAnaly = (_this$props4 = _this.props).fireAnalyticsEvent) === null || _this$props$fireAnaly === void 0 || _this$props$fireAnaly.call(_this$props4, {
|
|
116
117
|
action: _analytics.ACTION.ERRORED,
|
|
117
118
|
actionSubject: _analytics.ACTION_SUBJECT.RENDERER,
|
|
118
119
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.MEDIA,
|
|
@@ -127,6 +128,16 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
127
128
|
} : {})
|
|
128
129
|
});
|
|
129
130
|
});
|
|
131
|
+
(0, _defineProperty2.default)(_this, "onConsumerError", function (reason) {
|
|
132
|
+
var _this$props$onError2, _this$props5;
|
|
133
|
+
(_this$props$onError2 = (_this$props5 = _this.props).onError) === null || _this$props$onError2 === void 0 || _this$props$onError2.call(_this$props5, reason);
|
|
134
|
+
});
|
|
135
|
+
(0, _defineProperty2.default)(_this, "getMediaErrorHandler", function () {
|
|
136
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_media_error_analytics', 'isEnabled', true)) {
|
|
137
|
+
return _this.onError;
|
|
138
|
+
}
|
|
139
|
+
return _this.props.onError ? _this.onConsumerError : undefined;
|
|
140
|
+
});
|
|
130
141
|
(0, _defineProperty2.default)(_this, "renderLoadingCard", function () {
|
|
131
142
|
var cardDimensions = _this.props.cardDimensions;
|
|
132
143
|
return /*#__PURE__*/_react.default.createElement(_mediaCard.CardLoading, {
|
|
@@ -160,11 +171,11 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
160
171
|
key: "componentDidMount",
|
|
161
172
|
value: function () {
|
|
162
173
|
var _componentDidMount = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
163
|
-
var _this$
|
|
174
|
+
var _this$props6, rendererContext, contextIdentifierProvider, id, url, collectionName, nodeIsInCache, _t2, _t3;
|
|
164
175
|
return _regenerator.default.wrap(function (_context2) {
|
|
165
176
|
while (1) switch (_context2.prev = _context2.next) {
|
|
166
177
|
case 0:
|
|
167
|
-
_this$
|
|
178
|
+
_this$props6 = this.props, rendererContext = _this$props6.rendererContext, contextIdentifierProvider = _this$props6.contextIdentifierProvider, id = _this$props6.id, url = _this$props6.url, collectionName = _this$props6.collection;
|
|
168
179
|
if (!contextIdentifierProvider) {
|
|
169
180
|
_context2.next = 2;
|
|
170
181
|
break;
|
|
@@ -215,9 +226,9 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
215
226
|
}, {
|
|
216
227
|
key: "componentWillUnmount",
|
|
217
228
|
value: function componentWillUnmount() {
|
|
218
|
-
var _this$
|
|
219
|
-
id = _this$
|
|
220
|
-
dataURI = _this$
|
|
229
|
+
var _this$props7 = this.props,
|
|
230
|
+
id = _this$props7.id,
|
|
231
|
+
dataURI = _this$props7.url;
|
|
221
232
|
if (id) {
|
|
222
233
|
mediaIdentifierMap.delete(id);
|
|
223
234
|
} else if (dataURI) {
|
|
@@ -227,20 +238,20 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
227
238
|
}, {
|
|
228
239
|
key: "renderExternal",
|
|
229
240
|
value: function renderExternal(shouldOpenMediaViewer) {
|
|
230
|
-
var _this$
|
|
231
|
-
cardDimensions = _this$
|
|
232
|
-
resizeMode = _this$
|
|
233
|
-
appearance = _this$
|
|
234
|
-
url = _this$
|
|
235
|
-
imageStatus = _this$
|
|
236
|
-
disableOverlay = _this$
|
|
237
|
-
alt = _this$
|
|
238
|
-
featureFlags = _this$
|
|
239
|
-
ssr = _this$
|
|
240
|
-
mediaClient = _this$
|
|
241
|
-
dataAttributes = _this$
|
|
242
|
-
enableSyncMediaCard = _this$
|
|
243
|
-
localId = _this$
|
|
241
|
+
var _this$props8 = this.props,
|
|
242
|
+
cardDimensions = _this$props8.cardDimensions,
|
|
243
|
+
resizeMode = _this$props8.resizeMode,
|
|
244
|
+
appearance = _this$props8.appearance,
|
|
245
|
+
url = _this$props8.url,
|
|
246
|
+
imageStatus = _this$props8.imageStatus,
|
|
247
|
+
disableOverlay = _this$props8.disableOverlay,
|
|
248
|
+
alt = _this$props8.alt,
|
|
249
|
+
featureFlags = _this$props8.featureFlags,
|
|
250
|
+
ssr = _this$props8.ssr,
|
|
251
|
+
mediaClient = _this$props8.mediaClient,
|
|
252
|
+
dataAttributes = _this$props8.dataAttributes,
|
|
253
|
+
enableSyncMediaCard = _this$props8.enableSyncMediaCard,
|
|
254
|
+
localId = _this$props8.localId;
|
|
244
255
|
if (imageStatus === 'loading' || !url) {
|
|
245
256
|
return this.renderLoadingCard();
|
|
246
257
|
}
|
|
@@ -278,7 +289,8 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
278
289
|
featureFlags: featureFlags,
|
|
279
290
|
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode,
|
|
280
291
|
shouldHideTooltip: false,
|
|
281
|
-
onError: (
|
|
292
|
+
onError: this.getMediaErrorHandler(),
|
|
293
|
+
onPreviewRender: this.props.onPreviewRender
|
|
282
294
|
}))
|
|
283
295
|
);
|
|
284
296
|
}
|
|
@@ -289,27 +301,27 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
289
301
|
var _this$state = this.state,
|
|
290
302
|
contextIdentifierProvider = _this$state.contextIdentifierProvider,
|
|
291
303
|
fileState = _this$state.fileState;
|
|
292
|
-
var _this$
|
|
293
|
-
id = _this$
|
|
294
|
-
alt = _this$
|
|
295
|
-
type = _this$
|
|
296
|
-
collection = _this$
|
|
297
|
-
occurrenceKey = _this$
|
|
298
|
-
cardDimensions = _this$
|
|
299
|
-
resizeMode = _this$
|
|
300
|
-
disableOverlay = _this$
|
|
301
|
-
useInlinePlayer = _this$
|
|
302
|
-
originalDimensions = _this$
|
|
303
|
-
forceOpenMediaViewer = _this$
|
|
304
|
-
featureFlags = _this$
|
|
305
|
-
shouldEnableDownloadButton = _this$
|
|
306
|
-
ssr = _this$
|
|
307
|
-
mediaClient = _this$
|
|
308
|
-
dataAttributes = _this$
|
|
309
|
-
enableSyncMediaCard = _this$
|
|
310
|
-
localId = _this$
|
|
311
|
-
mediaViewerExtensions = _this$
|
|
312
|
-
fallbackMediaNameFetcher = _this$
|
|
304
|
+
var _this$props9 = this.props,
|
|
305
|
+
id = _this$props9.id,
|
|
306
|
+
alt = _this$props9.alt,
|
|
307
|
+
type = _this$props9.type,
|
|
308
|
+
collection = _this$props9.collection,
|
|
309
|
+
occurrenceKey = _this$props9.occurrenceKey,
|
|
310
|
+
cardDimensions = _this$props9.cardDimensions,
|
|
311
|
+
resizeMode = _this$props9.resizeMode,
|
|
312
|
+
disableOverlay = _this$props9.disableOverlay,
|
|
313
|
+
useInlinePlayer = _this$props9.useInlinePlayer,
|
|
314
|
+
originalDimensions = _this$props9.originalDimensions,
|
|
315
|
+
forceOpenMediaViewer = _this$props9.shouldOpenMediaViewer,
|
|
316
|
+
featureFlags = _this$props9.featureFlags,
|
|
317
|
+
shouldEnableDownloadButton = _this$props9.shouldEnableDownloadButton,
|
|
318
|
+
ssr = _this$props9.ssr,
|
|
319
|
+
mediaClient = _this$props9.mediaClient,
|
|
320
|
+
dataAttributes = _this$props9.dataAttributes,
|
|
321
|
+
enableSyncMediaCard = _this$props9.enableSyncMediaCard,
|
|
322
|
+
localId = _this$props9.localId,
|
|
323
|
+
mediaViewerExtensions = _this$props9.mediaViewerExtensions,
|
|
324
|
+
fallbackMediaNameFetcher = _this$props9.fallbackMediaNameFetcher;
|
|
313
325
|
var isMobile = false;
|
|
314
326
|
var shouldPlayInline = useInlinePlayer !== undefined ? useInlinePlayer : true;
|
|
315
327
|
var isInlinePlayer = isMobile ? false : shouldPlayInline;
|
|
@@ -378,7 +390,8 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
378
390
|
shouldHideTooltip: isMobile,
|
|
379
391
|
mediaViewerExtensions: mediaViewerExtensions,
|
|
380
392
|
fallbackMediaNameFetcher: fallbackMediaNameFetcher,
|
|
381
|
-
onError: (
|
|
393
|
+
onError: this.getMediaErrorHandler(),
|
|
394
|
+
onPreviewRender: this.props.onPreviewRender
|
|
382
395
|
}));
|
|
383
396
|
}
|
|
384
397
|
}]);
|
|
@@ -1078,6 +1078,12 @@ var centerWrapperStyles = (0, _react.css)((0, _defineProperty2.default)({}, ".".
|
|
|
1078
1078
|
flexShrink: 0
|
|
1079
1079
|
}
|
|
1080
1080
|
}));
|
|
1081
|
+
|
|
1082
|
+
// Reset only Expands with no preceding content sibling. Streaming SSR style/script siblings
|
|
1083
|
+
// are ignored so moving them to the head on the client does not change the top margin.
|
|
1084
|
+
var expandSsrMarginStyles = (0, _react.css)((0, _defineProperty2.default)({}, ".".concat(_consts.RendererCssClassName.DOCUMENT, " .").concat(_consts.RendererCssClassName.STICKY_SAFE_BREAKOUT_INNER, " > [data-node-type='expand']:not(:not(style, script) ~ *)"), {
|
|
1085
|
+
marginTop: 0
|
|
1086
|
+
}));
|
|
1081
1087
|
var baseOtherStylesDuplicateAnchor = (0, _react.css)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({
|
|
1082
1088
|
'& .UnknownBlock': {
|
|
1083
1089
|
fontFamily: "var(--ds-font-family-body, \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
@@ -2289,7 +2295,7 @@ var RendererStyleContainer = exports.RendererStyleContainer = function RendererS
|
|
|
2289
2295
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
2290
2296
|
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),
|
|
2291
2297
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
2292
|
-
(0, _fg.fg)('editor_inline_comments_on_inline_nodes') && rendererAnnotationStylesCommentHeightFix, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? baseOtherStyles : baseOtherStylesDuplicateAnchor,
|
|
2298
|
+
(0, _fg.fg)('editor_inline_comments_on_inline_nodes') && rendererAnnotationStylesCommentHeightFix, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? baseOtherStyles : baseOtherStylesDuplicateAnchor, (0, _fg.fg)('platform_renderer_expand_ssr_margin_fix') && expandSsrMarginStyles,
|
|
2293
2299
|
// this should be placed after baseOtherStyles
|
|
2294
2300
|
(0, _expValEquals.expValEquals)('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && ((0, _expValEquals.expValEquals)('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? extensionAsInlineStyle : oldExtensionAsInlineStyle), (0, _fg.fg)('platform_forge_inline_bodied_macro') && [migratedInlineBodiedFlowStyle, forgeInlineBodiedSpacingStyle], inlineExtensionRendererMarginFix, allowNestedHeaderLinks && ((0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle, firstWrappedMediaStyles, tableSharedStyle, (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableOuterBorderOverlayStyles, (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableRemixBlockHighlightStyles, (0, _expValEquals.expValEquals)('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeScopedStyles, (0, _expValEquals.expValEquals)('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_table_fit_to_content_patch_2') && tableContentModeExtensionContainmentStyles, (0, _expValEquals.expValEquals)('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeNestedTableStyles, tableRendererHeaderStylesForTableCellOnly, (0, _fg.fg)('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, firstNodeWithNotMarginTopWithNestedDnD, rendererTableStyles, isStickyScrollbarOn && stickyScrollbarStyles, isStickyScrollbarOn && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_table_css_overflow_shadow') && stickyScrollbarOverflowShadowFixStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_table_menu_updates', 'isEnabled', true) && rendererTableSortableColumnValignStyles, allowColumnSorting && allowNestedHeaderLinks && ((0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max' && ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true))) && responsiveBreakoutWidthFullWidth, (0, _expValEquals.expValEquals)('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? contentMode === 'compact' ? scaledDenseEmojiStyles : scaledEmojiStyles : contentMode === 'compact' ? denseStyles : undefined, contentMode === 'compact' ? scaledDenseUnicodeEmojiStylesNew : scaledUnicodeEmojiStylesNew, syncBlockStyles, centerWrapperStyles, isInsideSyncBlock ? syncBlockRendererStyles : null, isInsideSyncBlock && tableFakeBorderStyles, isInsideSyncBlock && (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? roundedTableFakeBorderOverlayStyles : null, (0, _expValEquals.expValEquals)('platform_editor_hide_extension_renderer_support', 'isEnabled', true) && hideExtensionStyles],
|
|
2295
2301
|
"data-testid": testId
|
|
@@ -464,7 +464,7 @@ export default class ReactSerializer {
|
|
|
464
464
|
};
|
|
465
465
|
}
|
|
466
466
|
getMediaProps(node, path = []) {
|
|
467
|
-
var _this$media, _this$media2, _this$media3, _this$media4;
|
|
467
|
+
var _this$media, _this$media2, _this$media3, _this$media4, _this$media5;
|
|
468
468
|
const {
|
|
469
469
|
marks: {
|
|
470
470
|
annotation,
|
|
@@ -496,6 +496,7 @@ export default class ReactSerializer {
|
|
|
496
496
|
enableSyncMediaCard: (_this$media2 = this.media) === null || _this$media2 === void 0 ? void 0 : _this$media2.enableSyncMediaCard,
|
|
497
497
|
mediaViewerExtensions: (_this$media3 = this.media) === null || _this$media3 === void 0 ? void 0 : _this$media3.mediaViewerExtensions,
|
|
498
498
|
fallbackMediaNameFetcher: (_this$media4 = this.media) === null || _this$media4 === void 0 ? void 0 : _this$media4.fallbackMediaNameFetcher,
|
|
499
|
+
onMediaRenderEvent: (_this$media5 = this.media) === null || _this$media5 === void 0 ? void 0 : _this$media5.onMediaRenderEvent,
|
|
499
500
|
nestedUnder
|
|
500
501
|
};
|
|
501
502
|
}
|
|
@@ -544,22 +545,22 @@ export default class ReactSerializer {
|
|
|
544
545
|
};
|
|
545
546
|
}
|
|
546
547
|
getMediaGroupProps(node) {
|
|
547
|
-
var _this$
|
|
548
|
+
var _this$media6, _this$media7;
|
|
548
549
|
return {
|
|
549
550
|
...this.getProps(node),
|
|
550
551
|
shouldOpenMediaViewer: this.shouldOpenMediaViewer,
|
|
551
552
|
allowAltTextOnImages: this.allowAltTextOnImages,
|
|
552
553
|
featureFlags: this.media && this.media.featureFlags,
|
|
553
|
-
enableDownloadButton: (_this$
|
|
554
|
-
ssr: (_this$
|
|
554
|
+
enableDownloadButton: (_this$media6 = this.media) === null || _this$media6 === void 0 ? void 0 : _this$media6.enableDownloadButton,
|
|
555
|
+
ssr: (_this$media7 = this.media) === null || _this$media7 === void 0 ? void 0 : _this$media7.ssr
|
|
555
556
|
};
|
|
556
557
|
}
|
|
557
558
|
getMediaInlineProps(node) {
|
|
558
|
-
var _this$
|
|
559
|
+
var _this$media8, _this$media9;
|
|
559
560
|
return {
|
|
560
561
|
...this.getProps(node),
|
|
561
|
-
ssr: (_this$
|
|
562
|
-
fallbackMediaNameFetcher: (_this$
|
|
562
|
+
ssr: (_this$media8 = this.media) === null || _this$media8 === void 0 ? void 0 : _this$media8.ssr,
|
|
563
|
+
fallbackMediaNameFetcher: (_this$media9 = this.media) === null || _this$media9 === void 0 ? void 0 : _this$media9.fallbackMediaNameFetcher
|
|
563
564
|
};
|
|
564
565
|
}
|
|
565
566
|
getTaskItemProps(node, path = []) {
|
|
@@ -25,6 +25,11 @@ import { useInlineCommentsFilter } from '../../../ui/annotations/hooks/use-inlin
|
|
|
25
25
|
import { useInlineCommentSubscriberContext } from '../../../ui/annotations/hooks/use-inline-comment-subscriber';
|
|
26
26
|
import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
|
|
27
27
|
import { useAnnotationRangeState } from '../../../ui/annotations/contexts/AnnotationRangeContext';
|
|
28
|
+
const getDataConsumerMark = marks => marks.find(mark => {
|
|
29
|
+
var _mark$type;
|
|
30
|
+
return mark.type === 'dataConsumer' || ((_mark$type = mark.type) === null || _mark$type === void 0 ? void 0 : _mark$type.name) === 'dataConsumer';
|
|
31
|
+
});
|
|
32
|
+
const getRemixDataConsumerMark = marks => fg('cc-maui-add-mark-for-remix-generated-images') ? getDataConsumerMark(marks) : undefined;
|
|
28
33
|
const linkStyle = css({
|
|
29
34
|
position: 'absolute',
|
|
30
35
|
background: 'transparent',
|
|
@@ -212,12 +217,39 @@ const CommentBadgeWrapper = ({
|
|
|
212
217
|
// Ignored via go/ees005
|
|
213
218
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
214
219
|
class Media extends PureComponent {
|
|
215
|
-
constructor(
|
|
216
|
-
super(
|
|
217
|
-
_defineProperty(this, "
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
220
|
+
constructor(_props) {
|
|
221
|
+
super(_props);
|
|
222
|
+
_defineProperty(this, "mediaInstance", {});
|
|
223
|
+
_defineProperty(this, "getDataConsumerMark", () => getRemixDataConsumerMark(this.props.marks));
|
|
224
|
+
_defineProperty(this, "getDataConsumerSource", (props = this.props) => {
|
|
225
|
+
var _getDataConsumerMark, _getDataConsumerMark$;
|
|
226
|
+
return (_getDataConsumerMark = getDataConsumerMark(props.marks)) === null || _getDataConsumerMark === void 0 ? void 0 : (_getDataConsumerMark$ = _getDataConsumerMark.attrs.sources) === null || _getDataConsumerMark$ === void 0 ? void 0 : _getDataConsumerMark$[0];
|
|
227
|
+
});
|
|
228
|
+
_defineProperty(this, "emitMediaRenderEvent", (event, props = this.props) => {
|
|
229
|
+
var _props$onMediaRenderE;
|
|
230
|
+
(_props$onMediaRenderE = props.onMediaRenderEvent) === null || _props$onMediaRenderE === void 0 ? void 0 : _props$onMediaRenderE.call(props, {
|
|
231
|
+
...event,
|
|
232
|
+
dataConsumerSource: this.getDataConsumerSource(props),
|
|
233
|
+
mediaId: props.id,
|
|
234
|
+
mediaInstance: this.mediaInstance
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
_defineProperty(this, "onPreviewRender", renderedMediaId => {
|
|
238
|
+
var _this$props$onPreview, _this$props;
|
|
239
|
+
(_this$props$onPreview = (_this$props = this.props).onPreviewRender) === null || _this$props$onPreview === void 0 ? void 0 : _this$props$onPreview.call(_this$props, renderedMediaId);
|
|
240
|
+
this.emitMediaRenderEvent({
|
|
241
|
+
renderedMediaId,
|
|
242
|
+
type: 'preview-rendered'
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
_defineProperty(this, "onError", reason => {
|
|
246
|
+
var _this$props$onError, _this$props2;
|
|
247
|
+
(_this$props$onError = (_this$props2 = this.props).onError) === null || _this$props$onError === void 0 ? void 0 : _this$props$onError.call(_this$props2, reason);
|
|
248
|
+
this.emitMediaRenderEvent({
|
|
249
|
+
reason,
|
|
250
|
+
type: 'error'
|
|
251
|
+
});
|
|
252
|
+
});
|
|
221
253
|
_defineProperty(this, "renderCard", (providers = {}) => {
|
|
222
254
|
var _dataConsumerMark$att;
|
|
223
255
|
const {
|
|
@@ -287,7 +319,9 @@ class Media extends PureComponent {
|
|
|
287
319
|
alt: allowAltTextOnImages ? alt : undefined,
|
|
288
320
|
featureFlags: featureFlags,
|
|
289
321
|
shouldEnableDownloadButton: enableDownloadButton,
|
|
290
|
-
ssr: ssr
|
|
322
|
+
ssr: ssr,
|
|
323
|
+
onError: this.props.onMediaRenderEvent || this.props.onError ? this.onError : undefined,
|
|
324
|
+
onPreviewRender: this.props.onMediaRenderEvent || this.props.onPreviewRender ? this.onPreviewRender : undefined
|
|
291
325
|
}))))));
|
|
292
326
|
});
|
|
293
327
|
_defineProperty(this, "handleMediaLinkClick", event => {
|
|
@@ -320,6 +354,9 @@ class Media extends PureComponent {
|
|
|
320
354
|
}
|
|
321
355
|
componentDidMount() {
|
|
322
356
|
var _dataConsumerMark$att2;
|
|
357
|
+
this.emitMediaRenderEvent({
|
|
358
|
+
type: 'mounted'
|
|
359
|
+
});
|
|
323
360
|
const dataConsumerMark = this.getDataConsumerMark();
|
|
324
361
|
const infographicType = dataConsumerMark === null || dataConsumerMark === void 0 ? void 0 : (_dataConsumerMark$att2 = dataConsumerMark.attrs.sources) === null || _dataConsumerMark$att2 === void 0 ? void 0 : _dataConsumerMark$att2[0];
|
|
325
362
|
if (infographicType && this.props.fireAnalyticsEvent) {
|
|
@@ -336,6 +373,21 @@ class Media extends PureComponent {
|
|
|
336
373
|
});
|
|
337
374
|
}
|
|
338
375
|
}
|
|
376
|
+
componentDidUpdate(prevProps) {
|
|
377
|
+
if (prevProps.id !== this.props.id || this.getDataConsumerSource(prevProps) !== this.getDataConsumerSource() || prevProps.onMediaRenderEvent !== this.props.onMediaRenderEvent) {
|
|
378
|
+
this.emitMediaRenderEvent({
|
|
379
|
+
type: 'unmounted'
|
|
380
|
+
}, prevProps);
|
|
381
|
+
this.emitMediaRenderEvent({
|
|
382
|
+
type: 'mounted'
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
componentWillUnmount() {
|
|
387
|
+
this.emitMediaRenderEvent({
|
|
388
|
+
type: 'unmounted'
|
|
389
|
+
});
|
|
390
|
+
}
|
|
339
391
|
render() {
|
|
340
392
|
const {
|
|
341
393
|
providers
|
|
@@ -63,12 +63,13 @@ export class MediaCardView extends Component {
|
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
_defineProperty(this, "onError", reason => {
|
|
66
|
-
var _this$props$fireAnaly, _this$
|
|
66
|
+
var _this$props$onError, _this$props, _this$props$fireAnaly, _this$props2;
|
|
67
67
|
const {
|
|
68
68
|
nestedUnder,
|
|
69
69
|
rendererContext
|
|
70
70
|
} = this.props;
|
|
71
|
-
(_this$props$
|
|
71
|
+
(_this$props$onError = (_this$props = this.props).onError) === null || _this$props$onError === void 0 ? void 0 : _this$props$onError.call(_this$props, reason);
|
|
72
|
+
(_this$props$fireAnaly = (_this$props2 = this.props).fireAnalyticsEvent) === null || _this$props$fireAnaly === void 0 ? void 0 : _this$props$fireAnaly.call(_this$props2, {
|
|
72
73
|
action: ACTION.ERRORED,
|
|
73
74
|
actionSubject: ACTION_SUBJECT.RENDERER,
|
|
74
75
|
actionSubjectId: ACTION_SUBJECT_ID.MEDIA,
|
|
@@ -85,6 +86,16 @@ export class MediaCardView extends Component {
|
|
|
85
86
|
}
|
|
86
87
|
});
|
|
87
88
|
});
|
|
89
|
+
_defineProperty(this, "onConsumerError", reason => {
|
|
90
|
+
var _this$props$onError2, _this$props3;
|
|
91
|
+
(_this$props$onError2 = (_this$props3 = this.props).onError) === null || _this$props$onError2 === void 0 ? void 0 : _this$props$onError2.call(_this$props3, reason);
|
|
92
|
+
});
|
|
93
|
+
_defineProperty(this, "getMediaErrorHandler", () => {
|
|
94
|
+
if (expValEquals('platform_editor_media_error_analytics', 'isEnabled', true)) {
|
|
95
|
+
return this.onError;
|
|
96
|
+
}
|
|
97
|
+
return this.props.onError ? this.onConsumerError : undefined;
|
|
98
|
+
});
|
|
88
99
|
_defineProperty(this, "renderLoadingCard", () => {
|
|
89
100
|
const {
|
|
90
101
|
cardDimensions
|
|
@@ -218,7 +229,8 @@ export class MediaCardView extends Component {
|
|
|
218
229
|
featureFlags: featureFlags,
|
|
219
230
|
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode,
|
|
220
231
|
shouldHideTooltip: false,
|
|
221
|
-
onError:
|
|
232
|
+
onError: this.getMediaErrorHandler(),
|
|
233
|
+
onPreviewRender: this.props.onPreviewRender
|
|
222
234
|
}))
|
|
223
235
|
);
|
|
224
236
|
}
|
|
@@ -316,7 +328,8 @@ export class MediaCardView extends Component {
|
|
|
316
328
|
shouldHideTooltip: isMobile,
|
|
317
329
|
mediaViewerExtensions: mediaViewerExtensions,
|
|
318
330
|
fallbackMediaNameFetcher: fallbackMediaNameFetcher,
|
|
319
|
-
onError:
|
|
331
|
+
onError: this.getMediaErrorHandler(),
|
|
332
|
+
onPreviewRender: this.props.onPreviewRender
|
|
320
333
|
}));
|
|
321
334
|
}
|
|
322
335
|
}
|
|
@@ -1278,6 +1278,14 @@ const centerWrapperStyles = css({
|
|
|
1278
1278
|
}
|
|
1279
1279
|
}
|
|
1280
1280
|
});
|
|
1281
|
+
|
|
1282
|
+
// Reset only Expands with no preceding content sibling. Streaming SSR style/script siblings
|
|
1283
|
+
// are ignored so moving them to the head on the client does not change the top margin.
|
|
1284
|
+
const expandSsrMarginStyles = css({
|
|
1285
|
+
[`.${RendererCssClassName.DOCUMENT} .${RendererCssClassName.STICKY_SAFE_BREAKOUT_INNER} > [data-node-type='expand']:not(:not(style, script) ~ *)`]: {
|
|
1286
|
+
marginTop: 0
|
|
1287
|
+
}
|
|
1288
|
+
});
|
|
1281
1289
|
const baseOtherStylesDuplicateAnchor = css({
|
|
1282
1290
|
'& .UnknownBlock': {
|
|
1283
1291
|
fontFamily: "var(--ds-font-family-body, \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
@@ -2919,7 +2927,7 @@ export const RendererStyleContainer = props => {
|
|
|
2919
2927
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
2920
2928
|
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),
|
|
2921
2929
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
2922
|
-
fg('editor_inline_comments_on_inline_nodes') && rendererAnnotationStylesCommentHeightFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? baseOtherStyles : baseOtherStylesDuplicateAnchor,
|
|
2930
|
+
fg('editor_inline_comments_on_inline_nodes') && rendererAnnotationStylesCommentHeightFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? baseOtherStyles : baseOtherStylesDuplicateAnchor, fg('platform_renderer_expand_ssr_margin_fix') && expandSsrMarginStyles,
|
|
2923
2931
|
// this should be placed after baseOtherStyles
|
|
2924
2932
|
expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? extensionAsInlineStyle : oldExtensionAsInlineStyle), fg('platform_forge_inline_bodied_macro') && [migratedInlineBodiedFlowStyle, forgeInlineBodiedSpacingStyle], inlineExtensionRendererMarginFix, allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle, firstWrappedMediaStyles, tableSharedStyle, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableOuterBorderOverlayStyles, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableRemixBlockHighlightStyles, expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeScopedStyles, expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && isExperimentEnabled('platform_editor_table_fit_to_content_patch_2') && tableContentModeExtensionContainmentStyles, expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeNestedTableStyles, tableRendererHeaderStylesForTableCellOnly, fg('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, firstNodeWithNotMarginTopWithNestedDnD, rendererTableStyles, isStickyScrollbarOn && stickyScrollbarStyles, isStickyScrollbarOn && isExperimentEnabled('platform_editor_table_css_overflow_shadow') && stickyScrollbarOverflowShadowFixStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) && rendererTableSortableColumnValignStyles, allowColumnSorting && allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max' && (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true))) && responsiveBreakoutWidthFullWidth, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? contentMode === 'compact' ? scaledDenseEmojiStyles : scaledEmojiStyles : contentMode === 'compact' ? denseStyles : undefined, contentMode === 'compact' ? scaledDenseUnicodeEmojiStylesNew : scaledUnicodeEmojiStylesNew, syncBlockStyles, centerWrapperStyles, isInsideSyncBlock ? syncBlockRendererStyles : null, isInsideSyncBlock && tableFakeBorderStyles, isInsideSyncBlock && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? roundedTableFakeBorderOverlayStyles : null, expValEquals('platform_editor_hide_extension_renderer_support', 'isEnabled', true) && hideExtensionStyles],
|
|
2925
2933
|
"data-testid": testId
|
package/dist/esm/react/index.js
CHANGED
|
@@ -502,7 +502,8 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
502
502
|
_this$media,
|
|
503
503
|
_this$media2,
|
|
504
504
|
_this$media3,
|
|
505
|
-
_this$media4
|
|
505
|
+
_this$media4,
|
|
506
|
+
_this$media5;
|
|
506
507
|
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
507
508
|
var _node$type$schema$mar = node.type.schema.marks,
|
|
508
509
|
annotation = _node$type$schema$mar.annotation,
|
|
@@ -539,6 +540,7 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
539
540
|
enableSyncMediaCard: (_this$media2 = this.media) === null || _this$media2 === void 0 ? void 0 : _this$media2.enableSyncMediaCard,
|
|
540
541
|
mediaViewerExtensions: (_this$media3 = this.media) === null || _this$media3 === void 0 ? void 0 : _this$media3.mediaViewerExtensions,
|
|
541
542
|
fallbackMediaNameFetcher: (_this$media4 = this.media) === null || _this$media4 === void 0 ? void 0 : _this$media4.fallbackMediaNameFetcher,
|
|
543
|
+
onMediaRenderEvent: (_this$media5 = this.media) === null || _this$media5 === void 0 ? void 0 : _this$media5.onMediaRenderEvent,
|
|
542
544
|
nestedUnder: nestedUnder
|
|
543
545
|
});
|
|
544
546
|
}
|
|
@@ -601,22 +603,22 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
601
603
|
}, {
|
|
602
604
|
key: "getMediaGroupProps",
|
|
603
605
|
value: function getMediaGroupProps(node) {
|
|
604
|
-
var _this$
|
|
606
|
+
var _this$media6, _this$media7;
|
|
605
607
|
return _objectSpread(_objectSpread({}, this.getProps(node)), {}, {
|
|
606
608
|
shouldOpenMediaViewer: this.shouldOpenMediaViewer,
|
|
607
609
|
allowAltTextOnImages: this.allowAltTextOnImages,
|
|
608
610
|
featureFlags: this.media && this.media.featureFlags,
|
|
609
|
-
enableDownloadButton: (_this$
|
|
610
|
-
ssr: (_this$
|
|
611
|
+
enableDownloadButton: (_this$media6 = this.media) === null || _this$media6 === void 0 ? void 0 : _this$media6.enableDownloadButton,
|
|
612
|
+
ssr: (_this$media7 = this.media) === null || _this$media7 === void 0 ? void 0 : _this$media7.ssr
|
|
611
613
|
});
|
|
612
614
|
}
|
|
613
615
|
}, {
|
|
614
616
|
key: "getMediaInlineProps",
|
|
615
617
|
value: function getMediaInlineProps(node) {
|
|
616
|
-
var _this$
|
|
618
|
+
var _this$media8, _this$media9;
|
|
617
619
|
return _objectSpread(_objectSpread({}, this.getProps(node)), {}, {
|
|
618
|
-
ssr: (_this$
|
|
619
|
-
fallbackMediaNameFetcher: (_this$
|
|
620
|
+
ssr: (_this$media8 = this.media) === null || _this$media8 === void 0 ? void 0 : _this$media8.ssr,
|
|
621
|
+
fallbackMediaNameFetcher: (_this$media9 = this.media) === null || _this$media9 === void 0 ? void 0 : _this$media9.fallbackMediaNameFetcher
|
|
620
622
|
});
|
|
621
623
|
}
|
|
622
624
|
}, {
|
|
@@ -37,6 +37,15 @@ import { useInlineCommentsFilter } from '../../../ui/annotations/hooks/use-inlin
|
|
|
37
37
|
import { useInlineCommentSubscriberContext } from '../../../ui/annotations/hooks/use-inline-comment-subscriber';
|
|
38
38
|
import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
|
|
39
39
|
import { useAnnotationRangeState } from '../../../ui/annotations/contexts/AnnotationRangeContext';
|
|
40
|
+
var getDataConsumerMark = function getDataConsumerMark(marks) {
|
|
41
|
+
return marks.find(function (mark) {
|
|
42
|
+
var _mark$type;
|
|
43
|
+
return mark.type === 'dataConsumer' || ((_mark$type = mark.type) === null || _mark$type === void 0 ? void 0 : _mark$type.name) === 'dataConsumer';
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
var getRemixDataConsumerMark = function getRemixDataConsumerMark(marks) {
|
|
47
|
+
return fg('cc-maui-add-mark-for-remix-generated-images') ? getDataConsumerMark(marks) : undefined;
|
|
48
|
+
};
|
|
40
49
|
var linkStyle = css({
|
|
41
50
|
position: 'absolute',
|
|
42
51
|
background: 'transparent',
|
|
@@ -233,32 +242,60 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref5) {
|
|
|
233
242
|
// Ignored via go/ees005
|
|
234
243
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
235
244
|
var Media = /*#__PURE__*/function (_PureComponent) {
|
|
236
|
-
function Media(
|
|
245
|
+
function Media(_props) {
|
|
237
246
|
var _this;
|
|
238
247
|
_classCallCheck(this, Media);
|
|
239
|
-
_this = _callSuper(this, Media, [
|
|
248
|
+
_this = _callSuper(this, Media, [_props]);
|
|
249
|
+
_defineProperty(_this, "mediaInstance", {});
|
|
240
250
|
_defineProperty(_this, "getDataConsumerMark", function () {
|
|
241
|
-
return
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
251
|
+
return getRemixDataConsumerMark(_this.props.marks);
|
|
252
|
+
});
|
|
253
|
+
_defineProperty(_this, "getDataConsumerSource", function () {
|
|
254
|
+
var _getDataConsumerMark;
|
|
255
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props;
|
|
256
|
+
return (_getDataConsumerMark = getDataConsumerMark(props.marks)) === null || _getDataConsumerMark === void 0 || (_getDataConsumerMark = _getDataConsumerMark.attrs.sources) === null || _getDataConsumerMark === void 0 ? void 0 : _getDataConsumerMark[0];
|
|
257
|
+
});
|
|
258
|
+
_defineProperty(_this, "emitMediaRenderEvent", function (event) {
|
|
259
|
+
var _props$onMediaRenderE;
|
|
260
|
+
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _this.props;
|
|
261
|
+
(_props$onMediaRenderE = props.onMediaRenderEvent) === null || _props$onMediaRenderE === void 0 || _props$onMediaRenderE.call(props, _objectSpread(_objectSpread({}, event), {}, {
|
|
262
|
+
dataConsumerSource: _this.getDataConsumerSource(props),
|
|
263
|
+
mediaId: props.id,
|
|
264
|
+
mediaInstance: _this.mediaInstance
|
|
265
|
+
}));
|
|
266
|
+
});
|
|
267
|
+
_defineProperty(_this, "onPreviewRender", function (renderedMediaId) {
|
|
268
|
+
var _this$props$onPreview, _this$props;
|
|
269
|
+
(_this$props$onPreview = (_this$props = _this.props).onPreviewRender) === null || _this$props$onPreview === void 0 || _this$props$onPreview.call(_this$props, renderedMediaId);
|
|
270
|
+
_this.emitMediaRenderEvent({
|
|
271
|
+
renderedMediaId: renderedMediaId,
|
|
272
|
+
type: 'preview-rendered'
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
_defineProperty(_this, "onError", function (reason) {
|
|
276
|
+
var _this$props$onError, _this$props2;
|
|
277
|
+
(_this$props$onError = (_this$props2 = _this.props).onError) === null || _this$props$onError === void 0 || _this$props$onError.call(_this$props2, reason);
|
|
278
|
+
_this.emitMediaRenderEvent({
|
|
279
|
+
reason: reason,
|
|
280
|
+
type: 'error'
|
|
281
|
+
});
|
|
245
282
|
});
|
|
246
283
|
_defineProperty(_this, "renderCard", function () {
|
|
247
284
|
var _dataConsumerMark$att;
|
|
248
285
|
var providers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
249
286
|
var contextIdentifierProvider = providers.contextIdentifierProvider;
|
|
250
|
-
var _this$
|
|
251
|
-
allowAltTextOnImages = _this$
|
|
252
|
-
alt = _this$
|
|
253
|
-
featureFlags = _this$
|
|
254
|
-
allowMediaViewer = _this$
|
|
255
|
-
enableDownloadButton = _this$
|
|
256
|
-
ssr = _this$
|
|
257
|
-
width = _this$
|
|
258
|
-
height = _this$
|
|
259
|
-
mediaSingleElement = _this$
|
|
260
|
-
_this$
|
|
261
|
-
isDrafting = _this$
|
|
287
|
+
var _this$props3 = _this.props,
|
|
288
|
+
allowAltTextOnImages = _this$props3.allowAltTextOnImages,
|
|
289
|
+
alt = _this$props3.alt,
|
|
290
|
+
featureFlags = _this$props3.featureFlags,
|
|
291
|
+
allowMediaViewer = _this$props3.shouldOpenMediaViewer,
|
|
292
|
+
enableDownloadButton = _this$props3.enableDownloadButton,
|
|
293
|
+
ssr = _this$props3.ssr,
|
|
294
|
+
width = _this$props3.width,
|
|
295
|
+
height = _this$props3.height,
|
|
296
|
+
mediaSingleElement = _this$props3.mediaSingleElement,
|
|
297
|
+
_this$props3$isDrafti = _this$props3.isDrafting,
|
|
298
|
+
isDrafting = _this$props3$isDrafti === void 0 ? false : _this$props3$isDrafti;
|
|
262
299
|
var annotationMarks = _this.props.isAnnotationMark ? _this.props.marks.filter(_this.props.isAnnotationMark) : undefined;
|
|
263
300
|
var borderMark = _this.props.marks.find(_this.props.isBorderMark);
|
|
264
301
|
var dataConsumerMark = _this.getDataConsumerMark();
|
|
@@ -310,14 +347,16 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
310
347
|
alt: allowAltTextOnImages ? alt : undefined,
|
|
311
348
|
featureFlags: featureFlags,
|
|
312
349
|
shouldEnableDownloadButton: enableDownloadButton,
|
|
313
|
-
ssr: ssr
|
|
350
|
+
ssr: ssr,
|
|
351
|
+
onError: _this.props.onMediaRenderEvent || _this.props.onError ? _this.onError : undefined,
|
|
352
|
+
onPreviewRender: _this.props.onMediaRenderEvent || _this.props.onPreviewRender ? _this.onPreviewRender : undefined
|
|
314
353
|
}))))));
|
|
315
354
|
});
|
|
316
355
|
_defineProperty(_this, "handleMediaLinkClick", function (event) {
|
|
317
|
-
var _this$
|
|
318
|
-
fireAnalyticsEvent = _this$
|
|
319
|
-
isLinkMark = _this$
|
|
320
|
-
marks = _this$
|
|
356
|
+
var _this$props4 = _this.props,
|
|
357
|
+
fireAnalyticsEvent = _this$props4.fireAnalyticsEvent,
|
|
358
|
+
isLinkMark = _this$props4.isLinkMark,
|
|
359
|
+
marks = _this$props4.marks;
|
|
321
360
|
if (fireAnalyticsEvent) {
|
|
322
361
|
fireAnalyticsEvent({
|
|
323
362
|
action: ACTION.VISITED,
|
|
@@ -346,6 +385,9 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
346
385
|
key: "componentDidMount",
|
|
347
386
|
value: function componentDidMount() {
|
|
348
387
|
var _dataConsumerMark$att2;
|
|
388
|
+
this.emitMediaRenderEvent({
|
|
389
|
+
type: 'mounted'
|
|
390
|
+
});
|
|
349
391
|
var dataConsumerMark = this.getDataConsumerMark();
|
|
350
392
|
var infographicType = dataConsumerMark === null || dataConsumerMark === void 0 || (_dataConsumerMark$att2 = dataConsumerMark.attrs.sources) === null || _dataConsumerMark$att2 === void 0 ? void 0 : _dataConsumerMark$att2[0];
|
|
351
393
|
if (infographicType && this.props.fireAnalyticsEvent) {
|
|
@@ -362,6 +404,25 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
362
404
|
});
|
|
363
405
|
}
|
|
364
406
|
}
|
|
407
|
+
}, {
|
|
408
|
+
key: "componentDidUpdate",
|
|
409
|
+
value: function componentDidUpdate(prevProps) {
|
|
410
|
+
if (prevProps.id !== this.props.id || this.getDataConsumerSource(prevProps) !== this.getDataConsumerSource() || prevProps.onMediaRenderEvent !== this.props.onMediaRenderEvent) {
|
|
411
|
+
this.emitMediaRenderEvent({
|
|
412
|
+
type: 'unmounted'
|
|
413
|
+
}, prevProps);
|
|
414
|
+
this.emitMediaRenderEvent({
|
|
415
|
+
type: 'mounted'
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}, {
|
|
420
|
+
key: "componentWillUnmount",
|
|
421
|
+
value: function componentWillUnmount() {
|
|
422
|
+
this.emitMediaRenderEvent({
|
|
423
|
+
type: 'unmounted'
|
|
424
|
+
});
|
|
425
|
+
}
|
|
365
426
|
}, {
|
|
366
427
|
key: "render",
|
|
367
428
|
value: function render() {
|
package/dist/esm/ui/MediaCard.js
CHANGED
|
@@ -99,11 +99,12 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
99
99
|
};
|
|
100
100
|
}());
|
|
101
101
|
_defineProperty(_this, "onError", function (reason) {
|
|
102
|
-
var _this$props$fireAnaly, _this$
|
|
102
|
+
var _this$props$onError, _this$props3, _this$props$fireAnaly, _this$props4;
|
|
103
103
|
var _this$props2 = _this.props,
|
|
104
104
|
nestedUnder = _this$props2.nestedUnder,
|
|
105
105
|
rendererContext = _this$props2.rendererContext;
|
|
106
|
-
(_this$props$
|
|
106
|
+
(_this$props$onError = (_this$props3 = _this.props).onError) === null || _this$props$onError === void 0 || _this$props$onError.call(_this$props3, reason);
|
|
107
|
+
(_this$props$fireAnaly = (_this$props4 = _this.props).fireAnalyticsEvent) === null || _this$props$fireAnaly === void 0 || _this$props$fireAnaly.call(_this$props4, {
|
|
107
108
|
action: ACTION.ERRORED,
|
|
108
109
|
actionSubject: ACTION_SUBJECT.RENDERER,
|
|
109
110
|
actionSubjectId: ACTION_SUBJECT_ID.MEDIA,
|
|
@@ -118,6 +119,16 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
118
119
|
} : {})
|
|
119
120
|
});
|
|
120
121
|
});
|
|
122
|
+
_defineProperty(_this, "onConsumerError", function (reason) {
|
|
123
|
+
var _this$props$onError2, _this$props5;
|
|
124
|
+
(_this$props$onError2 = (_this$props5 = _this.props).onError) === null || _this$props$onError2 === void 0 || _this$props$onError2.call(_this$props5, reason);
|
|
125
|
+
});
|
|
126
|
+
_defineProperty(_this, "getMediaErrorHandler", function () {
|
|
127
|
+
if (expValEquals('platform_editor_media_error_analytics', 'isEnabled', true)) {
|
|
128
|
+
return _this.onError;
|
|
129
|
+
}
|
|
130
|
+
return _this.props.onError ? _this.onConsumerError : undefined;
|
|
131
|
+
});
|
|
121
132
|
_defineProperty(_this, "renderLoadingCard", function () {
|
|
122
133
|
var cardDimensions = _this.props.cardDimensions;
|
|
123
134
|
return /*#__PURE__*/React.createElement(CardLoading, {
|
|
@@ -151,11 +162,11 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
151
162
|
key: "componentDidMount",
|
|
152
163
|
value: function () {
|
|
153
164
|
var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
154
|
-
var _this$
|
|
165
|
+
var _this$props6, rendererContext, contextIdentifierProvider, id, url, collectionName, nodeIsInCache, _t2, _t3;
|
|
155
166
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
156
167
|
while (1) switch (_context2.prev = _context2.next) {
|
|
157
168
|
case 0:
|
|
158
|
-
_this$
|
|
169
|
+
_this$props6 = this.props, rendererContext = _this$props6.rendererContext, contextIdentifierProvider = _this$props6.contextIdentifierProvider, id = _this$props6.id, url = _this$props6.url, collectionName = _this$props6.collection;
|
|
159
170
|
if (!contextIdentifierProvider) {
|
|
160
171
|
_context2.next = 2;
|
|
161
172
|
break;
|
|
@@ -206,9 +217,9 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
206
217
|
}, {
|
|
207
218
|
key: "componentWillUnmount",
|
|
208
219
|
value: function componentWillUnmount() {
|
|
209
|
-
var _this$
|
|
210
|
-
id = _this$
|
|
211
|
-
dataURI = _this$
|
|
220
|
+
var _this$props7 = this.props,
|
|
221
|
+
id = _this$props7.id,
|
|
222
|
+
dataURI = _this$props7.url;
|
|
212
223
|
if (id) {
|
|
213
224
|
mediaIdentifierMap.delete(id);
|
|
214
225
|
} else if (dataURI) {
|
|
@@ -218,20 +229,20 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
218
229
|
}, {
|
|
219
230
|
key: "renderExternal",
|
|
220
231
|
value: function renderExternal(shouldOpenMediaViewer) {
|
|
221
|
-
var _this$
|
|
222
|
-
cardDimensions = _this$
|
|
223
|
-
resizeMode = _this$
|
|
224
|
-
appearance = _this$
|
|
225
|
-
url = _this$
|
|
226
|
-
imageStatus = _this$
|
|
227
|
-
disableOverlay = _this$
|
|
228
|
-
alt = _this$
|
|
229
|
-
featureFlags = _this$
|
|
230
|
-
ssr = _this$
|
|
231
|
-
mediaClient = _this$
|
|
232
|
-
dataAttributes = _this$
|
|
233
|
-
enableSyncMediaCard = _this$
|
|
234
|
-
localId = _this$
|
|
232
|
+
var _this$props8 = this.props,
|
|
233
|
+
cardDimensions = _this$props8.cardDimensions,
|
|
234
|
+
resizeMode = _this$props8.resizeMode,
|
|
235
|
+
appearance = _this$props8.appearance,
|
|
236
|
+
url = _this$props8.url,
|
|
237
|
+
imageStatus = _this$props8.imageStatus,
|
|
238
|
+
disableOverlay = _this$props8.disableOverlay,
|
|
239
|
+
alt = _this$props8.alt,
|
|
240
|
+
featureFlags = _this$props8.featureFlags,
|
|
241
|
+
ssr = _this$props8.ssr,
|
|
242
|
+
mediaClient = _this$props8.mediaClient,
|
|
243
|
+
dataAttributes = _this$props8.dataAttributes,
|
|
244
|
+
enableSyncMediaCard = _this$props8.enableSyncMediaCard,
|
|
245
|
+
localId = _this$props8.localId;
|
|
235
246
|
if (imageStatus === 'loading' || !url) {
|
|
236
247
|
return this.renderLoadingCard();
|
|
237
248
|
}
|
|
@@ -269,7 +280,8 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
269
280
|
featureFlags: featureFlags,
|
|
270
281
|
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode,
|
|
271
282
|
shouldHideTooltip: false,
|
|
272
|
-
onError:
|
|
283
|
+
onError: this.getMediaErrorHandler(),
|
|
284
|
+
onPreviewRender: this.props.onPreviewRender
|
|
273
285
|
}))
|
|
274
286
|
);
|
|
275
287
|
}
|
|
@@ -280,27 +292,27 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
280
292
|
var _this$state = this.state,
|
|
281
293
|
contextIdentifierProvider = _this$state.contextIdentifierProvider,
|
|
282
294
|
fileState = _this$state.fileState;
|
|
283
|
-
var _this$
|
|
284
|
-
id = _this$
|
|
285
|
-
alt = _this$
|
|
286
|
-
type = _this$
|
|
287
|
-
collection = _this$
|
|
288
|
-
occurrenceKey = _this$
|
|
289
|
-
cardDimensions = _this$
|
|
290
|
-
resizeMode = _this$
|
|
291
|
-
disableOverlay = _this$
|
|
292
|
-
useInlinePlayer = _this$
|
|
293
|
-
originalDimensions = _this$
|
|
294
|
-
forceOpenMediaViewer = _this$
|
|
295
|
-
featureFlags = _this$
|
|
296
|
-
shouldEnableDownloadButton = _this$
|
|
297
|
-
ssr = _this$
|
|
298
|
-
mediaClient = _this$
|
|
299
|
-
dataAttributes = _this$
|
|
300
|
-
enableSyncMediaCard = _this$
|
|
301
|
-
localId = _this$
|
|
302
|
-
mediaViewerExtensions = _this$
|
|
303
|
-
fallbackMediaNameFetcher = _this$
|
|
295
|
+
var _this$props9 = this.props,
|
|
296
|
+
id = _this$props9.id,
|
|
297
|
+
alt = _this$props9.alt,
|
|
298
|
+
type = _this$props9.type,
|
|
299
|
+
collection = _this$props9.collection,
|
|
300
|
+
occurrenceKey = _this$props9.occurrenceKey,
|
|
301
|
+
cardDimensions = _this$props9.cardDimensions,
|
|
302
|
+
resizeMode = _this$props9.resizeMode,
|
|
303
|
+
disableOverlay = _this$props9.disableOverlay,
|
|
304
|
+
useInlinePlayer = _this$props9.useInlinePlayer,
|
|
305
|
+
originalDimensions = _this$props9.originalDimensions,
|
|
306
|
+
forceOpenMediaViewer = _this$props9.shouldOpenMediaViewer,
|
|
307
|
+
featureFlags = _this$props9.featureFlags,
|
|
308
|
+
shouldEnableDownloadButton = _this$props9.shouldEnableDownloadButton,
|
|
309
|
+
ssr = _this$props9.ssr,
|
|
310
|
+
mediaClient = _this$props9.mediaClient,
|
|
311
|
+
dataAttributes = _this$props9.dataAttributes,
|
|
312
|
+
enableSyncMediaCard = _this$props9.enableSyncMediaCard,
|
|
313
|
+
localId = _this$props9.localId,
|
|
314
|
+
mediaViewerExtensions = _this$props9.mediaViewerExtensions,
|
|
315
|
+
fallbackMediaNameFetcher = _this$props9.fallbackMediaNameFetcher;
|
|
304
316
|
var isMobile = false;
|
|
305
317
|
var shouldPlayInline = useInlinePlayer !== undefined ? useInlinePlayer : true;
|
|
306
318
|
var isInlinePlayer = isMobile ? false : shouldPlayInline;
|
|
@@ -369,7 +381,8 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
369
381
|
shouldHideTooltip: isMobile,
|
|
370
382
|
mediaViewerExtensions: mediaViewerExtensions,
|
|
371
383
|
fallbackMediaNameFetcher: fallbackMediaNameFetcher,
|
|
372
|
-
onError:
|
|
384
|
+
onError: this.getMediaErrorHandler(),
|
|
385
|
+
onPreviewRender: this.props.onPreviewRender
|
|
373
386
|
}));
|
|
374
387
|
}
|
|
375
388
|
}]);
|
|
@@ -1071,6 +1071,12 @@ var centerWrapperStyles = css(_defineProperty({}, ".".concat(RendererCssClassNam
|
|
|
1071
1071
|
flexShrink: 0
|
|
1072
1072
|
}
|
|
1073
1073
|
}));
|
|
1074
|
+
|
|
1075
|
+
// Reset only Expands with no preceding content sibling. Streaming SSR style/script siblings
|
|
1076
|
+
// are ignored so moving them to the head on the client does not change the top margin.
|
|
1077
|
+
var expandSsrMarginStyles = css(_defineProperty({}, ".".concat(RendererCssClassName.DOCUMENT, " .").concat(RendererCssClassName.STICKY_SAFE_BREAKOUT_INNER, " > [data-node-type='expand']:not(:not(style, script) ~ *)"), {
|
|
1078
|
+
marginTop: 0
|
|
1079
|
+
}));
|
|
1074
1080
|
var baseOtherStylesDuplicateAnchor = css(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
1075
1081
|
'& .UnknownBlock': {
|
|
1076
1082
|
fontFamily: "var(--ds-font-family-body, \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
@@ -2282,7 +2288,7 @@ export var RendererStyleContainer = function RendererStyleContainer(props) {
|
|
|
2282
2288
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
2283
2289
|
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),
|
|
2284
2290
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
2285
|
-
fg('editor_inline_comments_on_inline_nodes') && rendererAnnotationStylesCommentHeightFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? baseOtherStyles : baseOtherStylesDuplicateAnchor,
|
|
2291
|
+
fg('editor_inline_comments_on_inline_nodes') && rendererAnnotationStylesCommentHeightFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? baseOtherStyles : baseOtherStylesDuplicateAnchor, fg('platform_renderer_expand_ssr_margin_fix') && expandSsrMarginStyles,
|
|
2286
2292
|
// this should be placed after baseOtherStyles
|
|
2287
2293
|
expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? extensionAsInlineStyle : oldExtensionAsInlineStyle), fg('platform_forge_inline_bodied_macro') && [migratedInlineBodiedFlowStyle, forgeInlineBodiedSpacingStyle], inlineExtensionRendererMarginFix, allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle, firstWrappedMediaStyles, tableSharedStyle, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableOuterBorderOverlayStyles, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableRemixBlockHighlightStyles, expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeScopedStyles, expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && isExperimentEnabled('platform_editor_table_fit_to_content_patch_2') && tableContentModeExtensionContainmentStyles, expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeNestedTableStyles, tableRendererHeaderStylesForTableCellOnly, fg('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, firstNodeWithNotMarginTopWithNestedDnD, rendererTableStyles, isStickyScrollbarOn && stickyScrollbarStyles, isStickyScrollbarOn && isExperimentEnabled('platform_editor_table_css_overflow_shadow') && stickyScrollbarOverflowShadowFixStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) && rendererTableSortableColumnValignStyles, allowColumnSorting && allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max' && (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true))) && responsiveBreakoutWidthFullWidth, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? contentMode === 'compact' ? scaledDenseEmojiStyles : scaledEmojiStyles : contentMode === 'compact' ? denseStyles : undefined, contentMode === 'compact' ? scaledDenseUnicodeEmojiStylesNew : scaledUnicodeEmojiStylesNew, syncBlockStyles, centerWrapperStyles, isInsideSyncBlock ? syncBlockRendererStyles : null, isInsideSyncBlock && tableFakeBorderStyles, isInsideSyncBlock && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? roundedTableFakeBorderOverlayStyles : null, expValEquals('platform_editor_hide_extension_renderer_support', 'isEnabled', true) && hideExtensionStyles],
|
|
2288
2294
|
"data-testid": testId
|
|
@@ -13,6 +13,7 @@ import type { BorderMarkDefinition } from '@atlaskit/adf-schema/border';
|
|
|
13
13
|
import type { AnnotationMarkDefinition } from '@atlaskit/adf-schema/annotation';
|
|
14
14
|
import type { DataConsumerDefinition } from '@atlaskit/adf-schema/data-consumer';
|
|
15
15
|
import type { MediaFeatureFlags } from '@atlaskit/media-common';
|
|
16
|
+
import type { MediaRenderEvent } from '../../../types/mediaOptions';
|
|
16
17
|
import type { AnalyticsEventPayload } from '../../../analytics/events';
|
|
17
18
|
export type MediaProps = MediaCardProps & {
|
|
18
19
|
allowAltTextOnImages?: boolean;
|
|
@@ -30,6 +31,7 @@ export type MediaProps = MediaCardProps & {
|
|
|
30
31
|
isLinkMark: () => boolean;
|
|
31
32
|
marks: Array<LinkDefinition | BorderMarkDefinition | AnnotationMarkDefinition | DataConsumerDefinition>;
|
|
32
33
|
mediaSingleElement?: HTMLElement | null;
|
|
34
|
+
onMediaRenderEvent?: (event: MediaRenderEvent) => void;
|
|
33
35
|
providers?: ProviderFactory;
|
|
34
36
|
width?: number;
|
|
35
37
|
};
|
|
@@ -13,6 +13,20 @@ export type MediaSSR = {
|
|
|
13
13
|
id?: string;
|
|
14
14
|
}>;
|
|
15
15
|
};
|
|
16
|
+
export type MediaRenderEventPayload = {
|
|
17
|
+
type: 'mounted' | 'unmounted';
|
|
18
|
+
} | {
|
|
19
|
+
renderedMediaId?: string;
|
|
20
|
+
type: 'preview-rendered';
|
|
21
|
+
} | {
|
|
22
|
+
reason: string;
|
|
23
|
+
type: 'error';
|
|
24
|
+
};
|
|
25
|
+
export type MediaRenderEvent = {
|
|
26
|
+
dataConsumerSource?: string;
|
|
27
|
+
mediaId?: string;
|
|
28
|
+
mediaInstance: object;
|
|
29
|
+
} & MediaRenderEventPayload;
|
|
16
30
|
export interface MediaOptions {
|
|
17
31
|
allowCaptions?: boolean;
|
|
18
32
|
allowLinking?: boolean;
|
|
@@ -27,5 +41,7 @@ export interface MediaOptions {
|
|
|
27
41
|
featureFlags?: MediaFeatureFlags;
|
|
28
42
|
/** Extensions for the media viewer header (e.g. comment navigation button). */
|
|
29
43
|
mediaViewerExtensions?: MediaViewerExtensions;
|
|
44
|
+
/** Receives lifecycle events for each rendered media node. */
|
|
45
|
+
onMediaRenderEvent?: (event: MediaRenderEvent) => void;
|
|
30
46
|
ssr?: MediaSSR;
|
|
31
47
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import type { ADFEntity } from '@atlaskit/adf-utils/types';
|
|
3
|
-
import type { CardAppearance, CardDimensions, CardOnClickCallback, NumericalCardDimensions } from '@atlaskit/media-card';
|
|
3
|
+
import type { CardAppearance, CardDimensions, CardOnClickCallback, CardProps as AtlaskitMediaCardProps, NumericalCardDimensions } from '@atlaskit/media-card';
|
|
4
4
|
import type { MediaClientConfig } from '@atlaskit/media-core/auth';
|
|
5
5
|
import type { ImageResizeMode, Identifier, FileState, MediaClient } from '@atlaskit/media-client';
|
|
6
6
|
import type { MediaType } from '@atlaskit/adf-schema/media';
|
|
@@ -46,6 +46,8 @@ export interface MediaCardProps {
|
|
|
46
46
|
*/
|
|
47
47
|
nestedUnder?: string;
|
|
48
48
|
occurrenceKey?: string;
|
|
49
|
+
onError?: AtlaskitMediaCardProps['onError'];
|
|
50
|
+
onPreviewRender?: AtlaskitMediaCardProps['onPreviewRender'];
|
|
49
51
|
originalDimensions?: NumericalCardDimensions;
|
|
50
52
|
rendererAppearance?: RendererAppearance;
|
|
51
53
|
/**
|
|
@@ -77,6 +79,8 @@ export declare class MediaCardView extends Component<MediaCardProps & {
|
|
|
77
79
|
componentWillUnmount(): void;
|
|
78
80
|
saveFileState: (id: string) => Promise<void>;
|
|
79
81
|
private onError;
|
|
82
|
+
private onConsumerError;
|
|
83
|
+
private getMediaErrorHandler;
|
|
80
84
|
private renderLoadingCard;
|
|
81
85
|
private renderExternal;
|
|
82
86
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "139.
|
|
3
|
+
"version": "139.1.0",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@atlaskit/pragmatic-drag-and-drop": "^3.1.0",
|
|
67
67
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
68
68
|
"@atlaskit/react-ufo": "^7.9.0",
|
|
69
|
-
"@atlaskit/smart-card": "^45.
|
|
69
|
+
"@atlaskit/smart-card": "^45.22.0",
|
|
70
70
|
"@atlaskit/status": "^5.9.0",
|
|
71
71
|
"@atlaskit/task-decision": "^21.9.0",
|
|
72
72
|
"@atlaskit/theme": "^28.2.0",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"@af/visual-regression": "workspace:^",
|
|
98
98
|
"@atlaskit/analytics-gas-types": "^6.2.0",
|
|
99
99
|
"@atlaskit/checkbox": "^19.2.0",
|
|
100
|
-
"@atlaskit/editor-plugin-media": "^19.
|
|
100
|
+
"@atlaskit/editor-plugin-media": "^19.2.0",
|
|
101
101
|
"@atlaskit/editor-test-helpers": "workspace:^",
|
|
102
102
|
"@atlaskit/inline-edit": "^16.4.0",
|
|
103
103
|
"@atlaskit/json-ld-types": "^2.0.0",
|
|
@@ -143,6 +143,9 @@
|
|
|
143
143
|
"worker-plugin": "^4.0.2"
|
|
144
144
|
},
|
|
145
145
|
"platform-feature-flags": {
|
|
146
|
+
"platform_renderer_expand_ssr_margin_fix": {
|
|
147
|
+
"type": "boolean"
|
|
148
|
+
},
|
|
146
149
|
"platform_native_embeds_rollout_non_maui_experience": {
|
|
147
150
|
"type": "boolean"
|
|
148
151
|
},
|