@atlaskit/renderer 109.28.2 → 109.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/react/index.js +6 -0
- package/dist/cjs/react/marks/annotation.js +11 -2
- package/dist/cjs/react/nodes/media/index.js +12 -4
- package/dist/cjs/ui/Renderer/index.js +3 -2
- package/dist/es2019/react/index.js +7 -0
- package/dist/es2019/react/marks/annotation.js +11 -2
- package/dist/es2019/react/nodes/media/index.js +12 -4
- package/dist/es2019/ui/Renderer/index.js +3 -2
- package/dist/esm/react/index.js +6 -0
- package/dist/esm/react/marks/annotation.js +11 -2
- package/dist/esm/react/nodes/media/index.js +12 -4
- package/dist/esm/ui/Renderer/index.js +3 -2
- package/dist/types/react/index.d.ts +2 -0
- package/dist/types/react/marks/annotation.d.ts +1 -1
- package/dist/types/react/nodes/media/index.d.ts +1 -0
- package/dist/types/react/types.d.ts +1 -0
- package/dist/types-ts4.5/react/index.d.ts +2 -0
- package/dist/types-ts4.5/react/marks/annotation.d.ts +1 -1
- package/dist/types-ts4.5/react/nodes/media/index.d.ts +1 -0
- package/dist/types-ts4.5/react/types.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 109.29.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#97803](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/97803)
|
|
8
|
+
[`4c1023ffb3d8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4c1023ffb3d8) -
|
|
9
|
+
[ED-23094] Ignore annotations on mediaInline node, including highlight styling,
|
|
10
|
+
event(onMouseEnter, onClick) listeners, update active annotations when the node is selected or
|
|
11
|
+
the cursor is right after the node
|
|
12
|
+
|
|
13
|
+
## 109.29.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [#99230](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99230)
|
|
18
|
+
[`8b5008e65c2c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8b5008e65c2c) -
|
|
19
|
+
[ux] Feature Flag with fix for include page on media
|
|
20
|
+
|
|
3
21
|
## 109.28.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/cjs/react/index.js
CHANGED
|
@@ -100,6 +100,11 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
|
|
|
100
100
|
isMediaLink: true
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
+
if (_this.isCommentsOnMediaMediaInlineBugFixEnabled && node.type.name === 'mediaInline' && mark.type.name === 'annotation') {
|
|
104
|
+
return _objectSpread(_objectSpread({}, defaultProps), {}, {
|
|
105
|
+
isMediaInline: true
|
|
106
|
+
});
|
|
107
|
+
}
|
|
103
108
|
return defaultProps;
|
|
104
109
|
});
|
|
105
110
|
(0, _defineProperty2.default)(this, "getUnsupportedContentProps", function (node) {
|
|
@@ -185,6 +190,7 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
|
|
|
185
190
|
this.allowWindowedCodeBlock = init.allowWindowedCodeBlock;
|
|
186
191
|
this.isInsideOfInlineExtension = init.isInsideOfInlineExtension;
|
|
187
192
|
this.textHighlighter = init.textHighlighter;
|
|
193
|
+
this.isCommentsOnMediaMediaInlineBugFixEnabled = init.isCommentsOnMediaMediaInlineBugFixEnabled;
|
|
188
194
|
}
|
|
189
195
|
(0, _createClass2.default)(ReactSerializer, [{
|
|
190
196
|
key: "resetState",
|
|
@@ -23,13 +23,22 @@ var AnnotationComponent = function AnnotationComponent(_ref) {
|
|
|
23
23
|
_ref$annotationParent = _ref.annotationParentIds,
|
|
24
24
|
annotationParentIds = _ref$annotationParent === void 0 ? [] : _ref$annotationParent,
|
|
25
25
|
allowAnnotations = _ref.allowAnnotations,
|
|
26
|
-
useBlockLevel = _ref.useBlockLevel
|
|
26
|
+
useBlockLevel = _ref.useBlockLevel,
|
|
27
|
+
isMediaInline = _ref.isMediaInline;
|
|
27
28
|
var data = _objectSpread(_objectSpread({}, dataAttributes), (0, _adfSchema.buildAnnotationMarkDataAttributes)({
|
|
28
29
|
id: id,
|
|
29
30
|
annotationType: annotationType
|
|
30
31
|
}));
|
|
31
32
|
if (allowAnnotations) {
|
|
32
|
-
return
|
|
33
|
+
return isMediaInline ?
|
|
34
|
+
/*#__PURE__*/
|
|
35
|
+
// Inline comment on mediaInline is not supported as part of comments on media project,
|
|
36
|
+
// hence skip any styling/event handling for annotations on mediaInline.
|
|
37
|
+
// `id` is still needed so that comment view component can be correct positioned
|
|
38
|
+
// when using comment navigation to access comments on mediaInline
|
|
39
|
+
_react.default.createElement("span", {
|
|
40
|
+
id: id
|
|
41
|
+
}, children) : /*#__PURE__*/_react.default.createElement(_annotations.AnnotationMark, {
|
|
33
42
|
id: id,
|
|
34
43
|
dataAttributes: data,
|
|
35
44
|
annotationParentIds: annotationParentIds,
|
|
@@ -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.1";
|
|
60
60
|
var defaultNodeComponents = exports.defaultNodeComponents = _nodes.nodeToReact;
|
|
61
61
|
var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
62
62
|
(0, _inherits2.default)(Renderer, _PureComponent);
|
|
@@ -284,7 +284,8 @@ var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
284
284
|
// does not currently support SSR, should not be enabled in environments where Renderer is SSR-ed
|
|
285
285
|
allowWindowedCodeBlock: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.allowWindowedCodeBlock,
|
|
286
286
|
isInsideOfInlineExtension: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.inline_extension.extended_lcqdn') && props.isInsideOfInlineExtension,
|
|
287
|
-
textHighlighter: props.UNSTABLE_textHighlighter
|
|
287
|
+
textHighlighter: props.UNSTABLE_textHighlighter,
|
|
288
|
+
isCommentsOnMediaMediaInlineBugFixEnabled: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.commentsOnMediaMediaInlineBugFix
|
|
288
289
|
};
|
|
289
290
|
}
|
|
290
291
|
}, {
|
|
@@ -82,6 +82,12 @@ export default class ReactSerializer {
|
|
|
82
82
|
isMediaLink: true
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
+
if (this.isCommentsOnMediaMediaInlineBugFixEnabled && node.type.name === 'mediaInline' && mark.type.name === 'annotation') {
|
|
86
|
+
return {
|
|
87
|
+
...defaultProps,
|
|
88
|
+
isMediaInline: true
|
|
89
|
+
};
|
|
90
|
+
}
|
|
85
91
|
return defaultProps;
|
|
86
92
|
});
|
|
87
93
|
_defineProperty(this, "getUnsupportedContentProps", node => {
|
|
@@ -170,6 +176,7 @@ export default class ReactSerializer {
|
|
|
170
176
|
this.allowWindowedCodeBlock = init.allowWindowedCodeBlock;
|
|
171
177
|
this.isInsideOfInlineExtension = init.isInsideOfInlineExtension;
|
|
172
178
|
this.textHighlighter = init.textHighlighter;
|
|
179
|
+
this.isCommentsOnMediaMediaInlineBugFixEnabled = init.isCommentsOnMediaMediaInlineBugFixEnabled;
|
|
173
180
|
}
|
|
174
181
|
resetState() {
|
|
175
182
|
this.headingIds = [];
|
|
@@ -12,7 +12,8 @@ const AnnotationComponent = ({
|
|
|
12
12
|
dataAttributes,
|
|
13
13
|
annotationParentIds = [],
|
|
14
14
|
allowAnnotations,
|
|
15
|
-
useBlockLevel
|
|
15
|
+
useBlockLevel,
|
|
16
|
+
isMediaInline
|
|
16
17
|
}) => {
|
|
17
18
|
const data = {
|
|
18
19
|
...dataAttributes,
|
|
@@ -22,7 +23,15 @@ const AnnotationComponent = ({
|
|
|
22
23
|
})
|
|
23
24
|
};
|
|
24
25
|
if (allowAnnotations) {
|
|
25
|
-
return
|
|
26
|
+
return isMediaInline ?
|
|
27
|
+
/*#__PURE__*/
|
|
28
|
+
// Inline comment on mediaInline is not supported as part of comments on media project,
|
|
29
|
+
// hence skip any styling/event handling for annotations on mediaInline.
|
|
30
|
+
// `id` is still needed so that comment view component can be correct positioned
|
|
31
|
+
// when using comment navigation to access comments on mediaInline
|
|
32
|
+
React.createElement("span", {
|
|
33
|
+
id: id
|
|
34
|
+
}, children) : /*#__PURE__*/React.createElement(AnnotationMark, {
|
|
26
35
|
id: id,
|
|
27
36
|
dataAttributes: data,
|
|
28
37
|
annotationParentIds: annotationParentIds,
|
|
@@ -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.1";
|
|
41
41
|
export const defaultNodeComponents = nodeToReact;
|
|
42
42
|
export class Renderer extends PureComponent {
|
|
43
43
|
constructor(props) {
|
|
@@ -263,7 +263,8 @@ export class Renderer extends PureComponent {
|
|
|
263
263
|
// does not currently support SSR, should not be enabled in environments where Renderer is SSR-ed
|
|
264
264
|
allowWindowedCodeBlock: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.allowWindowedCodeBlock,
|
|
265
265
|
isInsideOfInlineExtension: getBooleanFF('platform.editor.inline_extension.extended_lcqdn') && props.isInsideOfInlineExtension,
|
|
266
|
-
textHighlighter: props.UNSTABLE_textHighlighter
|
|
266
|
+
textHighlighter: props.UNSTABLE_textHighlighter,
|
|
267
|
+
isCommentsOnMediaMediaInlineBugFixEnabled: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.commentsOnMediaMediaInlineBugFix
|
|
267
268
|
};
|
|
268
269
|
}
|
|
269
270
|
render() {
|
package/dist/esm/react/index.js
CHANGED
|
@@ -93,6 +93,11 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
93
93
|
isMediaLink: true
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
+
if (_this.isCommentsOnMediaMediaInlineBugFixEnabled && node.type.name === 'mediaInline' && mark.type.name === 'annotation') {
|
|
97
|
+
return _objectSpread(_objectSpread({}, defaultProps), {}, {
|
|
98
|
+
isMediaInline: true
|
|
99
|
+
});
|
|
100
|
+
}
|
|
96
101
|
return defaultProps;
|
|
97
102
|
});
|
|
98
103
|
_defineProperty(this, "getUnsupportedContentProps", function (node) {
|
|
@@ -178,6 +183,7 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
178
183
|
this.allowWindowedCodeBlock = init.allowWindowedCodeBlock;
|
|
179
184
|
this.isInsideOfInlineExtension = init.isInsideOfInlineExtension;
|
|
180
185
|
this.textHighlighter = init.textHighlighter;
|
|
186
|
+
this.isCommentsOnMediaMediaInlineBugFixEnabled = init.isCommentsOnMediaMediaInlineBugFixEnabled;
|
|
181
187
|
}
|
|
182
188
|
_createClass(ReactSerializer, [{
|
|
183
189
|
key: "resetState",
|
|
@@ -16,13 +16,22 @@ var AnnotationComponent = function AnnotationComponent(_ref) {
|
|
|
16
16
|
_ref$annotationParent = _ref.annotationParentIds,
|
|
17
17
|
annotationParentIds = _ref$annotationParent === void 0 ? [] : _ref$annotationParent,
|
|
18
18
|
allowAnnotations = _ref.allowAnnotations,
|
|
19
|
-
useBlockLevel = _ref.useBlockLevel
|
|
19
|
+
useBlockLevel = _ref.useBlockLevel,
|
|
20
|
+
isMediaInline = _ref.isMediaInline;
|
|
20
21
|
var data = _objectSpread(_objectSpread({}, dataAttributes), buildAnnotationMarkDataAttributes({
|
|
21
22
|
id: id,
|
|
22
23
|
annotationType: annotationType
|
|
23
24
|
}));
|
|
24
25
|
if (allowAnnotations) {
|
|
25
|
-
return
|
|
26
|
+
return isMediaInline ?
|
|
27
|
+
/*#__PURE__*/
|
|
28
|
+
// Inline comment on mediaInline is not supported as part of comments on media project,
|
|
29
|
+
// hence skip any styling/event handling for annotations on mediaInline.
|
|
30
|
+
// `id` is still needed so that comment view component can be correct positioned
|
|
31
|
+
// when using comment navigation to access comments on mediaInline
|
|
32
|
+
React.createElement("span", {
|
|
33
|
+
id: id
|
|
34
|
+
}, children) : /*#__PURE__*/React.createElement(AnnotationMark, {
|
|
26
35
|
id: id,
|
|
27
36
|
dataAttributes: data,
|
|
28
37
|
annotationParentIds: annotationParentIds,
|
|
@@ -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.1";
|
|
51
51
|
export var defaultNodeComponents = nodeToReact;
|
|
52
52
|
export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
53
53
|
_inherits(Renderer, _PureComponent);
|
|
@@ -275,7 +275,8 @@ export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
275
275
|
// does not currently support SSR, should not be enabled in environments where Renderer is SSR-ed
|
|
276
276
|
allowWindowedCodeBlock: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.allowWindowedCodeBlock,
|
|
277
277
|
isInsideOfInlineExtension: getBooleanFF('platform.editor.inline_extension.extended_lcqdn') && props.isInsideOfInlineExtension,
|
|
278
|
-
textHighlighter: props.UNSTABLE_textHighlighter
|
|
278
|
+
textHighlighter: props.UNSTABLE_textHighlighter,
|
|
279
|
+
isCommentsOnMediaMediaInlineBugFixEnabled: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.commentsOnMediaMediaInlineBugFix
|
|
279
280
|
};
|
|
280
281
|
}
|
|
281
282
|
}, {
|
|
@@ -41,6 +41,7 @@ export interface ReactSerializerInit {
|
|
|
41
41
|
allowWindowedCodeBlock?: boolean;
|
|
42
42
|
isInsideOfInlineExtension?: boolean;
|
|
43
43
|
textHighlighter?: TextHighlighter;
|
|
44
|
+
isCommentsOnMediaMediaInlineBugFixEnabled?: boolean;
|
|
44
45
|
}
|
|
45
46
|
interface ParentInfo {
|
|
46
47
|
parentIsIncompleteTask: boolean;
|
|
@@ -87,6 +88,7 @@ export default class ReactSerializer implements Serializer<JSX.Element> {
|
|
|
87
88
|
private nodeComponents?;
|
|
88
89
|
private allowWindowedCodeBlock?;
|
|
89
90
|
private isInsideOfInlineExtension?;
|
|
91
|
+
private isCommentsOnMediaMediaInlineBugFixEnabled?;
|
|
90
92
|
private textHighlighter?;
|
|
91
93
|
constructor(init: ReactSerializerInit);
|
|
92
94
|
private resetState;
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
import type { MarkProps, AnnotationMarkMeta } from '../types';
|
|
3
3
|
import type { Mark } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
export declare const isAnnotationMark: (mark: Mark) => boolean;
|
|
5
|
-
declare const AnnotationComponent: ({ id, annotationType, children, dataAttributes, annotationParentIds, allowAnnotations, useBlockLevel, }: MarkProps<AnnotationMarkMeta>) => JSX.Element;
|
|
5
|
+
declare const AnnotationComponent: ({ id, annotationType, children, dataAttributes, annotationParentIds, allowAnnotations, useBlockLevel, isMediaInline, }: MarkProps<AnnotationMarkMeta>) => JSX.Element;
|
|
6
6
|
export default AnnotationComponent;
|
|
@@ -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;
|
|
@@ -55,6 +55,7 @@ export interface AnnotationMarkMeta extends MarkMeta {
|
|
|
55
55
|
annotationParentIds: string[];
|
|
56
56
|
allowAnnotations: boolean;
|
|
57
57
|
useBlockLevel?: boolean;
|
|
58
|
+
isMediaInline?: boolean;
|
|
58
59
|
}
|
|
59
60
|
export type NodeProps<NodeAttrs = {}> = NodeAttrs & PropsWithChildren<NodeMeta>;
|
|
60
61
|
export type MarkProps<MarkAttrs = {}> = MarkAttrs & PropsWithChildren<MarkMeta>;
|
|
@@ -41,6 +41,7 @@ export interface ReactSerializerInit {
|
|
|
41
41
|
allowWindowedCodeBlock?: boolean;
|
|
42
42
|
isInsideOfInlineExtension?: boolean;
|
|
43
43
|
textHighlighter?: TextHighlighter;
|
|
44
|
+
isCommentsOnMediaMediaInlineBugFixEnabled?: boolean;
|
|
44
45
|
}
|
|
45
46
|
interface ParentInfo {
|
|
46
47
|
parentIsIncompleteTask: boolean;
|
|
@@ -87,6 +88,7 @@ export default class ReactSerializer implements Serializer<JSX.Element> {
|
|
|
87
88
|
private nodeComponents?;
|
|
88
89
|
private allowWindowedCodeBlock?;
|
|
89
90
|
private isInsideOfInlineExtension?;
|
|
91
|
+
private isCommentsOnMediaMediaInlineBugFixEnabled?;
|
|
90
92
|
private textHighlighter?;
|
|
91
93
|
constructor(init: ReactSerializerInit);
|
|
92
94
|
private resetState;
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
import type { MarkProps, AnnotationMarkMeta } from '../types';
|
|
3
3
|
import type { Mark } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
export declare const isAnnotationMark: (mark: Mark) => boolean;
|
|
5
|
-
declare const AnnotationComponent: ({ id, annotationType, children, dataAttributes, annotationParentIds, allowAnnotations, useBlockLevel, }: MarkProps<AnnotationMarkMeta>) => JSX.Element;
|
|
5
|
+
declare const AnnotationComponent: ({ id, annotationType, children, dataAttributes, annotationParentIds, allowAnnotations, useBlockLevel, isMediaInline, }: MarkProps<AnnotationMarkMeta>) => JSX.Element;
|
|
6
6
|
export default AnnotationComponent;
|
|
@@ -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;
|
|
@@ -55,6 +55,7 @@ export interface AnnotationMarkMeta extends MarkMeta {
|
|
|
55
55
|
annotationParentIds: string[];
|
|
56
56
|
allowAnnotations: boolean;
|
|
57
57
|
useBlockLevel?: boolean;
|
|
58
|
+
isMediaInline?: boolean;
|
|
58
59
|
}
|
|
59
60
|
export type NodeProps<NodeAttrs = {}> = NodeAttrs & PropsWithChildren<NodeMeta>;
|
|
60
61
|
export type MarkProps<MarkAttrs = {}> = MarkAttrs & PropsWithChildren<MarkMeta>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "109.
|
|
3
|
+
"version": "109.29.1",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/editor-shared-styles": "^2.11.0",
|
|
39
39
|
"@atlaskit/emoji": "^67.6.0",
|
|
40
40
|
"@atlaskit/icon": "^22.2.0",
|
|
41
|
-
"@atlaskit/link-datasource": "^2.
|
|
41
|
+
"@atlaskit/link-datasource": "^2.3.0",
|
|
42
42
|
"@atlaskit/media-card": "^77.11.0",
|
|
43
43
|
"@atlaskit/media-client": "^27.0.0",
|
|
44
44
|
"@atlaskit/media-client-react": "^2.0.0",
|