@atlaskit/renderer 109.28.2 → 109.29.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 +8 -0
- package/dist/cjs/react/nodes/media/index.js +12 -4
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/es2019/react/nodes/media/index.js +12 -4
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/esm/react/nodes/media/index.js +12 -4
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/types/react/nodes/media/index.d.ts +1 -0
- package/dist/types-ts4.5/react/nodes/media/index.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 109.29.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#99230](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99230)
|
|
8
|
+
[`8b5008e65c2c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8b5008e65c2c) -
|
|
9
|
+
[ux] Feature Flag with fix for include page on media
|
|
10
|
+
|
|
3
11
|
## 109.28.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -215,13 +215,15 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
215
215
|
height = _this$props.height,
|
|
216
216
|
mediaSingleElement = _this$props.mediaSingleElement,
|
|
217
217
|
_this$props$isDraftin = _this$props.isDrafting,
|
|
218
|
-
isDrafting = _this$props$isDraftin === void 0 ? false : _this$props$isDraftin
|
|
218
|
+
isDrafting = _this$props$isDraftin === void 0 ? false : _this$props$isDraftin,
|
|
219
|
+
isInPageInclude = _this$props.isInPageInclude;
|
|
219
220
|
var annotationMarks = _this.props.isAnnotationMark ? _this.props.marks.filter(_this.props.isAnnotationMark) : undefined;
|
|
220
221
|
var borderMark = _this.props.marks.find(_this.props.isBorderMark);
|
|
221
222
|
var linkMark = _this.props.marks.find(_this.props.isLinkMark);
|
|
222
223
|
var linkHref = linkMark === null || linkMark === void 0 ? void 0 : linkMark.attrs.href;
|
|
223
224
|
var eventHandlers = linkHref ? undefined : _this.props.eventHandlers;
|
|
224
225
|
var shouldOpenMediaViewer = !linkHref && allowMediaViewer;
|
|
226
|
+
var showCommentBadge = !!annotationMarks && (featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.commentsOnMedia) && (!(featureFlags !== null && featureFlags !== void 0 && featureFlags.commentsOnMediaIncludePage) || !isInPageInclude);
|
|
225
227
|
return (0, _react2.jsx)(MediaLink, {
|
|
226
228
|
mark: linkMark,
|
|
227
229
|
onClick: _this.handleMediaLinkClickFn
|
|
@@ -233,7 +235,7 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
233
235
|
data: (0, _defineProperty2.default)({}, _analyticsNamespacedContext.MEDIA_CONTEXT, {
|
|
234
236
|
border: !!borderMark
|
|
235
237
|
})
|
|
236
|
-
},
|
|
238
|
+
}, showCommentBadge && (0, _react2.jsx)(CommentBadgeWrapper, {
|
|
237
239
|
marks: annotationMarks,
|
|
238
240
|
mediaElement: mediaSingleElement,
|
|
239
241
|
width: width,
|
|
@@ -300,6 +302,11 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
300
302
|
var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
301
303
|
var dataAttributes = props.dataAttributes;
|
|
302
304
|
var pos = dataAttributes && dataAttributes['data-renderer-start-pos'];
|
|
305
|
+
var parentElementClosest;
|
|
306
|
+
if (typeof document !== "undefined") {
|
|
307
|
+
var elementAtPos = pos && document.querySelector("[data-renderer-start-pos=\"".concat(pos, "\"]"));
|
|
308
|
+
parentElementClosest = elementAtPos instanceof Element ? elementAtPos.closest('[data-node-type="include"]') : null;
|
|
309
|
+
}
|
|
303
310
|
var _useState5 = (0, _react.useState)(),
|
|
304
311
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
305
312
|
position = _useState6[0],
|
|
@@ -321,7 +328,7 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
321
328
|
setShouldApplyDraftAnnotation(false);
|
|
322
329
|
setPosition(undefined);
|
|
323
330
|
}
|
|
324
|
-
}, [draftPosition, pos, shouldApplyDraftAnnotation, isCommentsOnMediaBugFixEnabled]);
|
|
331
|
+
}, [draftPosition, parentElementClosest, pos, shouldApplyDraftAnnotation, isCommentsOnMediaBugFixEnabled]);
|
|
325
332
|
var applyDraftAnnotation = props.allowAnnotationsDraftMode && shouldApplyDraftAnnotation && position !== undefined;
|
|
326
333
|
var dataAttributesWithDraftAnnotation = (0, _react.useMemo)(function () {
|
|
327
334
|
return applyDraftAnnotation ? _objectSpread(_objectSpread({}, dataAttributes), {}, {
|
|
@@ -331,7 +338,8 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
331
338
|
}, [applyDraftAnnotation, dataAttributes]);
|
|
332
339
|
return (0, _react2.jsx)(Media, (0, _extends2.default)({}, props, {
|
|
333
340
|
dataAttributes: dataAttributesWithDraftAnnotation,
|
|
334
|
-
isDrafting: shouldApplyDraftAnnotation
|
|
341
|
+
isDrafting: shouldApplyDraftAnnotation,
|
|
342
|
+
isInPageInclude: !!parentElementClosest
|
|
335
343
|
}));
|
|
336
344
|
};
|
|
337
345
|
var _default = exports.default = MediaWithDraftAnnotation;
|
|
@@ -56,7 +56,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
56
56
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
57
57
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
58
58
|
var packageName = "@atlaskit/renderer";
|
|
59
|
-
var packageVersion = "109.
|
|
59
|
+
var packageVersion = "109.29.0";
|
|
60
60
|
var defaultNodeComponents = exports.defaultNodeComponents = _nodes.nodeToReact;
|
|
61
61
|
var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
62
62
|
(0, _inherits2.default)(Renderer, _PureComponent);
|
|
@@ -192,7 +192,8 @@ class Media extends PureComponent {
|
|
|
192
192
|
width,
|
|
193
193
|
height,
|
|
194
194
|
mediaSingleElement,
|
|
195
|
-
isDrafting = false
|
|
195
|
+
isDrafting = false,
|
|
196
|
+
isInPageInclude
|
|
196
197
|
} = this.props;
|
|
197
198
|
const annotationMarks = this.props.isAnnotationMark ? this.props.marks.filter(this.props.isAnnotationMark) : undefined;
|
|
198
199
|
const borderMark = this.props.marks.find(this.props.isBorderMark);
|
|
@@ -200,6 +201,7 @@ class Media extends PureComponent {
|
|
|
200
201
|
const linkHref = linkMark === null || linkMark === void 0 ? void 0 : linkMark.attrs.href;
|
|
201
202
|
const eventHandlers = linkHref ? undefined : this.props.eventHandlers;
|
|
202
203
|
const shouldOpenMediaViewer = !linkHref && allowMediaViewer;
|
|
204
|
+
const showCommentBadge = !!annotationMarks && (featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.commentsOnMedia) && (!(featureFlags !== null && featureFlags !== void 0 && featureFlags.commentsOnMediaIncludePage) || !isInPageInclude);
|
|
203
205
|
return jsx(MediaLink, {
|
|
204
206
|
mark: linkMark,
|
|
205
207
|
onClick: this.handleMediaLinkClickFn
|
|
@@ -213,7 +215,7 @@ class Media extends PureComponent {
|
|
|
213
215
|
border: !!borderMark
|
|
214
216
|
}
|
|
215
217
|
}
|
|
216
|
-
},
|
|
218
|
+
}, showCommentBadge && jsx(CommentBadgeWrapper, {
|
|
217
219
|
marks: annotationMarks,
|
|
218
220
|
mediaElement: mediaSingleElement,
|
|
219
221
|
width: width,
|
|
@@ -280,6 +282,11 @@ const MediaWithDraftAnnotation = props => {
|
|
|
280
282
|
dataAttributes
|
|
281
283
|
} = props;
|
|
282
284
|
const pos = dataAttributes && dataAttributes['data-renderer-start-pos'];
|
|
285
|
+
let parentElementClosest;
|
|
286
|
+
if (typeof document !== "undefined") {
|
|
287
|
+
const elementAtPos = pos && document.querySelector(`[data-renderer-start-pos="${pos}"]`);
|
|
288
|
+
parentElementClosest = elementAtPos instanceof Element ? elementAtPos.closest('[data-node-type="include"]') : null;
|
|
289
|
+
}
|
|
283
290
|
const [position, setPosition] = useState();
|
|
284
291
|
const [shouldApplyDraftAnnotation, setShouldApplyDraftAnnotation] = useState(false);
|
|
285
292
|
useEffect(() => {
|
|
@@ -295,7 +302,7 @@ const MediaWithDraftAnnotation = props => {
|
|
|
295
302
|
setShouldApplyDraftAnnotation(false);
|
|
296
303
|
setPosition(undefined);
|
|
297
304
|
}
|
|
298
|
-
}, [draftPosition, pos, shouldApplyDraftAnnotation, isCommentsOnMediaBugFixEnabled]);
|
|
305
|
+
}, [draftPosition, parentElementClosest, pos, shouldApplyDraftAnnotation, isCommentsOnMediaBugFixEnabled]);
|
|
299
306
|
const applyDraftAnnotation = props.allowAnnotationsDraftMode && shouldApplyDraftAnnotation && position !== undefined;
|
|
300
307
|
const dataAttributesWithDraftAnnotation = useMemo(() => applyDraftAnnotation ? {
|
|
301
308
|
...dataAttributes,
|
|
@@ -304,7 +311,8 @@ const MediaWithDraftAnnotation = props => {
|
|
|
304
311
|
} : dataAttributes, [applyDraftAnnotation, dataAttributes]);
|
|
305
312
|
return jsx(Media, _extends({}, props, {
|
|
306
313
|
dataAttributes: dataAttributesWithDraftAnnotation,
|
|
307
|
-
isDrafting: shouldApplyDraftAnnotation
|
|
314
|
+
isDrafting: shouldApplyDraftAnnotation,
|
|
315
|
+
isInPageInclude: !!parentElementClosest
|
|
308
316
|
}));
|
|
309
317
|
};
|
|
310
318
|
export default MediaWithDraftAnnotation;
|
|
@@ -37,7 +37,7 @@ import { nodeToReact } from '../../react/nodes';
|
|
|
37
37
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
38
38
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
39
39
|
const packageName = "@atlaskit/renderer";
|
|
40
|
-
const packageVersion = "109.
|
|
40
|
+
const packageVersion = "109.29.0";
|
|
41
41
|
export const defaultNodeComponents = nodeToReact;
|
|
42
42
|
export class Renderer extends PureComponent {
|
|
43
43
|
constructor(props) {
|
|
@@ -206,13 +206,15 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
206
206
|
height = _this$props.height,
|
|
207
207
|
mediaSingleElement = _this$props.mediaSingleElement,
|
|
208
208
|
_this$props$isDraftin = _this$props.isDrafting,
|
|
209
|
-
isDrafting = _this$props$isDraftin === void 0 ? false : _this$props$isDraftin
|
|
209
|
+
isDrafting = _this$props$isDraftin === void 0 ? false : _this$props$isDraftin,
|
|
210
|
+
isInPageInclude = _this$props.isInPageInclude;
|
|
210
211
|
var annotationMarks = _this.props.isAnnotationMark ? _this.props.marks.filter(_this.props.isAnnotationMark) : undefined;
|
|
211
212
|
var borderMark = _this.props.marks.find(_this.props.isBorderMark);
|
|
212
213
|
var linkMark = _this.props.marks.find(_this.props.isLinkMark);
|
|
213
214
|
var linkHref = linkMark === null || linkMark === void 0 ? void 0 : linkMark.attrs.href;
|
|
214
215
|
var eventHandlers = linkHref ? undefined : _this.props.eventHandlers;
|
|
215
216
|
var shouldOpenMediaViewer = !linkHref && allowMediaViewer;
|
|
217
|
+
var showCommentBadge = !!annotationMarks && (featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.commentsOnMedia) && (!(featureFlags !== null && featureFlags !== void 0 && featureFlags.commentsOnMediaIncludePage) || !isInPageInclude);
|
|
216
218
|
return jsx(MediaLink, {
|
|
217
219
|
mark: linkMark,
|
|
218
220
|
onClick: _this.handleMediaLinkClickFn
|
|
@@ -224,7 +226,7 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
224
226
|
data: _defineProperty({}, MEDIA_CONTEXT, {
|
|
225
227
|
border: !!borderMark
|
|
226
228
|
})
|
|
227
|
-
},
|
|
229
|
+
}, showCommentBadge && jsx(CommentBadgeWrapper, {
|
|
228
230
|
marks: annotationMarks,
|
|
229
231
|
mediaElement: mediaSingleElement,
|
|
230
232
|
width: width,
|
|
@@ -291,6 +293,11 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
291
293
|
var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
292
294
|
var dataAttributes = props.dataAttributes;
|
|
293
295
|
var pos = dataAttributes && dataAttributes['data-renderer-start-pos'];
|
|
296
|
+
var parentElementClosest;
|
|
297
|
+
if (typeof document !== "undefined") {
|
|
298
|
+
var elementAtPos = pos && document.querySelector("[data-renderer-start-pos=\"".concat(pos, "\"]"));
|
|
299
|
+
parentElementClosest = elementAtPos instanceof Element ? elementAtPos.closest('[data-node-type="include"]') : null;
|
|
300
|
+
}
|
|
294
301
|
var _useState5 = useState(),
|
|
295
302
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
296
303
|
position = _useState6[0],
|
|
@@ -312,7 +319,7 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
312
319
|
setShouldApplyDraftAnnotation(false);
|
|
313
320
|
setPosition(undefined);
|
|
314
321
|
}
|
|
315
|
-
}, [draftPosition, pos, shouldApplyDraftAnnotation, isCommentsOnMediaBugFixEnabled]);
|
|
322
|
+
}, [draftPosition, parentElementClosest, pos, shouldApplyDraftAnnotation, isCommentsOnMediaBugFixEnabled]);
|
|
316
323
|
var applyDraftAnnotation = props.allowAnnotationsDraftMode && shouldApplyDraftAnnotation && position !== undefined;
|
|
317
324
|
var dataAttributesWithDraftAnnotation = useMemo(function () {
|
|
318
325
|
return applyDraftAnnotation ? _objectSpread(_objectSpread({}, dataAttributes), {}, {
|
|
@@ -322,7 +329,8 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
322
329
|
}, [applyDraftAnnotation, dataAttributes]);
|
|
323
330
|
return jsx(Media, _extends({}, props, {
|
|
324
331
|
dataAttributes: dataAttributesWithDraftAnnotation,
|
|
325
|
-
isDrafting: shouldApplyDraftAnnotation
|
|
332
|
+
isDrafting: shouldApplyDraftAnnotation,
|
|
333
|
+
isInPageInclude: !!parentElementClosest
|
|
326
334
|
}));
|
|
327
335
|
};
|
|
328
336
|
export default MediaWithDraftAnnotation;
|
|
@@ -47,7 +47,7 @@ import { nodeToReact } from '../../react/nodes';
|
|
|
47
47
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
48
48
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
49
49
|
var packageName = "@atlaskit/renderer";
|
|
50
|
-
var packageVersion = "109.
|
|
50
|
+
var packageVersion = "109.29.0";
|
|
51
51
|
export var defaultNodeComponents = nodeToReact;
|
|
52
52
|
export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
53
53
|
_inherits(Renderer, _PureComponent);
|
|
@@ -26,6 +26,7 @@ export type MediaProps = MediaCardProps & {
|
|
|
26
26
|
width?: number;
|
|
27
27
|
height?: number;
|
|
28
28
|
isDrafting: boolean;
|
|
29
|
+
isInPageInclude?: boolean;
|
|
29
30
|
};
|
|
30
31
|
export declare const linkStyle: import("@emotion/react").SerializedStyles;
|
|
31
32
|
export declare const borderStyle: (color: string, width: number) => import("@emotion/react").SerializedStyles;
|
|
@@ -26,6 +26,7 @@ export type MediaProps = MediaCardProps & {
|
|
|
26
26
|
width?: number;
|
|
27
27
|
height?: number;
|
|
28
28
|
isDrafting: boolean;
|
|
29
|
+
isInPageInclude?: boolean;
|
|
29
30
|
};
|
|
30
31
|
export declare const linkStyle: import("@emotion/react").SerializedStyles;
|
|
31
32
|
export declare const borderStyle: (color: string, width: number) => import("@emotion/react").SerializedStyles;
|