@atlaskit/renderer 109.28.1 → 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 +18 -0
- package/dist/cjs/react/nodes/media/index.js +16 -5
- package/dist/cjs/react/nodes/mention.js +3 -1
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/annotations/hooks/use-events.js +11 -5
- package/dist/cjs/ui/annotations/view/index.js +3 -1
- package/dist/es2019/react/nodes/media/index.js +17 -6
- package/dist/es2019/react/nodes/mention.js +3 -1
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/annotations/hooks/use-events.js +11 -4
- package/dist/es2019/ui/annotations/view/index.js +3 -1
- package/dist/esm/react/nodes/media/index.js +17 -6
- package/dist/esm/react/nodes/mention.js +3 -1
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/annotations/hooks/use-events.js +11 -5
- package/dist/esm/ui/annotations/view/index.js +3 -1
- package/dist/types/react/nodes/media/index.d.ts +1 -0
- package/dist/types/react/nodes/mention.d.ts +2 -1
- package/dist/types/ui/annotations/hooks/use-events.d.ts +3 -1
- package/dist/types/ui/annotations/view/index.d.ts +1 -1
- package/dist/types-ts4.5/react/nodes/media/index.d.ts +1 -0
- package/dist/types-ts4.5/react/nodes/mention.d.ts +2 -1
- package/dist/types-ts4.5/ui/annotations/hooks/use-events.d.ts +3 -1
- package/dist/types-ts4.5/ui/annotations/view/index.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
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
|
+
|
|
11
|
+
## 109.28.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#100662](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100662)
|
|
16
|
+
[`3d61cd8f2afe`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3d61cd8f2afe) -
|
|
17
|
+
[ED-23355] Update annotation viewed event to with attributes nodeType and method to capture
|
|
18
|
+
usage for comments on media
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 109.28.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -176,7 +176,10 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref5) {
|
|
|
176
176
|
if (updateSubscriber) {
|
|
177
177
|
updateSubscriber.emit(_types.AnnotationUpdateEvent.ON_ANNOTATION_CLICK, {
|
|
178
178
|
annotationIds: activeParentIds,
|
|
179
|
-
eventTarget: e.target
|
|
179
|
+
eventTarget: e.target,
|
|
180
|
+
// use mediaSingle here to align with annotation viewed event dispatched in editor
|
|
181
|
+
eventTargetType: 'mediaSingle',
|
|
182
|
+
viewMethod: _analytics.VIEW_METHOD.BADGE
|
|
180
183
|
});
|
|
181
184
|
}
|
|
182
185
|
};
|
|
@@ -212,13 +215,15 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
212
215
|
height = _this$props.height,
|
|
213
216
|
mediaSingleElement = _this$props.mediaSingleElement,
|
|
214
217
|
_this$props$isDraftin = _this$props.isDrafting,
|
|
215
|
-
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;
|
|
216
220
|
var annotationMarks = _this.props.isAnnotationMark ? _this.props.marks.filter(_this.props.isAnnotationMark) : undefined;
|
|
217
221
|
var borderMark = _this.props.marks.find(_this.props.isBorderMark);
|
|
218
222
|
var linkMark = _this.props.marks.find(_this.props.isLinkMark);
|
|
219
223
|
var linkHref = linkMark === null || linkMark === void 0 ? void 0 : linkMark.attrs.href;
|
|
220
224
|
var eventHandlers = linkHref ? undefined : _this.props.eventHandlers;
|
|
221
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);
|
|
222
227
|
return (0, _react2.jsx)(MediaLink, {
|
|
223
228
|
mark: linkMark,
|
|
224
229
|
onClick: _this.handleMediaLinkClickFn
|
|
@@ -230,7 +235,7 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
230
235
|
data: (0, _defineProperty2.default)({}, _analyticsNamespacedContext.MEDIA_CONTEXT, {
|
|
231
236
|
border: !!borderMark
|
|
232
237
|
})
|
|
233
|
-
},
|
|
238
|
+
}, showCommentBadge && (0, _react2.jsx)(CommentBadgeWrapper, {
|
|
234
239
|
marks: annotationMarks,
|
|
235
240
|
mediaElement: mediaSingleElement,
|
|
236
241
|
width: width,
|
|
@@ -297,6 +302,11 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
297
302
|
var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
298
303
|
var dataAttributes = props.dataAttributes;
|
|
299
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
|
+
}
|
|
300
310
|
var _useState5 = (0, _react.useState)(),
|
|
301
311
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
302
312
|
position = _useState6[0],
|
|
@@ -318,7 +328,7 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
318
328
|
setShouldApplyDraftAnnotation(false);
|
|
319
329
|
setPosition(undefined);
|
|
320
330
|
}
|
|
321
|
-
}, [draftPosition, pos, shouldApplyDraftAnnotation, isCommentsOnMediaBugFixEnabled]);
|
|
331
|
+
}, [draftPosition, parentElementClosest, pos, shouldApplyDraftAnnotation, isCommentsOnMediaBugFixEnabled]);
|
|
322
332
|
var applyDraftAnnotation = props.allowAnnotationsDraftMode && shouldApplyDraftAnnotation && position !== undefined;
|
|
323
333
|
var dataAttributesWithDraftAnnotation = (0, _react.useMemo)(function () {
|
|
324
334
|
return applyDraftAnnotation ? _objectSpread(_objectSpread({}, dataAttributes), {}, {
|
|
@@ -328,7 +338,8 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
328
338
|
}, [applyDraftAnnotation, dataAttributes]);
|
|
329
339
|
return (0, _react2.jsx)(Media, (0, _extends2.default)({}, props, {
|
|
330
340
|
dataAttributes: dataAttributesWithDraftAnnotation,
|
|
331
|
-
isDrafting: shouldApplyDraftAnnotation
|
|
341
|
+
isDrafting: shouldApplyDraftAnnotation,
|
|
342
|
+
isInPageInclude: !!parentElementClosest
|
|
332
343
|
}));
|
|
333
344
|
};
|
|
334
345
|
var _default = exports.default = MediaWithDraftAnnotation;
|
|
@@ -32,12 +32,14 @@ var MentionItem = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
32
32
|
id = _this$props.id,
|
|
33
33
|
providers = _this$props.providers,
|
|
34
34
|
text = _this$props.text,
|
|
35
|
-
accessLevel = _this$props.accessLevel
|
|
35
|
+
accessLevel = _this$props.accessLevel,
|
|
36
|
+
localId = _this$props.localId;
|
|
36
37
|
return /*#__PURE__*/_react.default.createElement(_mention.Mention, {
|
|
37
38
|
id: id,
|
|
38
39
|
text: text,
|
|
39
40
|
accessLevel: accessLevel,
|
|
40
41
|
providers: providers,
|
|
42
|
+
localId: localId,
|
|
41
43
|
eventHandlers: eventHandlers && eventHandlers.mention
|
|
42
44
|
});
|
|
43
45
|
}
|
|
@@ -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);
|
|
@@ -78,14 +78,17 @@ var useAnnotationClickEvent = exports.useAnnotationClickEvent = function useAnno
|
|
|
78
78
|
annotationClickEvent = _useState6[0],
|
|
79
79
|
setAnnotationClickEvent = _useState6[1];
|
|
80
80
|
var updateSubscriber = props.updateSubscriber,
|
|
81
|
-
createAnalyticsEvent = props.createAnalyticsEvent
|
|
81
|
+
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
82
|
+
isCommentsOnMediaAnalyticsEnabled = props.isCommentsOnMediaAnalyticsEnabled;
|
|
82
83
|
(0, _react.useLayoutEffect)(function () {
|
|
83
84
|
if (!updateSubscriber) {
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
87
|
var clickCb = function clickCb(_ref3) {
|
|
87
88
|
var annotationIds = _ref3.annotationIds,
|
|
88
|
-
eventTarget = _ref3.eventTarget
|
|
89
|
+
eventTarget = _ref3.eventTarget,
|
|
90
|
+
eventTargetType = _ref3.eventTargetType,
|
|
91
|
+
viewMethod = _ref3.viewMethod;
|
|
89
92
|
var annotationsByType = annotationIds.filter(function (id) {
|
|
90
93
|
return !!id;
|
|
91
94
|
}).map(function (id) {
|
|
@@ -100,9 +103,12 @@ var useAnnotationClickEvent = exports.useAnnotationClickEvent = function useAnno
|
|
|
100
103
|
actionSubject: _analytics.ACTION_SUBJECT.ANNOTATION,
|
|
101
104
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
102
105
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
103
|
-
attributes: {
|
|
106
|
+
attributes: _objectSpread({
|
|
104
107
|
overlap: annotationsByType.length || 0
|
|
105
|
-
}
|
|
108
|
+
}, isCommentsOnMediaAnalyticsEnabled && {
|
|
109
|
+
targetNodeType: eventTargetType,
|
|
110
|
+
method: viewMethod
|
|
111
|
+
})
|
|
106
112
|
}).fire(_analyticsListeners.FabricChannel.editor);
|
|
107
113
|
}
|
|
108
114
|
setAnnotationClickEvent({
|
|
@@ -122,6 +128,6 @@ var useAnnotationClickEvent = exports.useAnnotationClickEvent = function useAnno
|
|
|
122
128
|
updateSubscriber.off(_types.AnnotationUpdateEvent.ON_ANNOTATION_CLICK, clickCb);
|
|
123
129
|
updateSubscriber.off(_types.AnnotationUpdateEvent.DESELECT_ANNOTATIONS, deselectCb);
|
|
124
130
|
};
|
|
125
|
-
}, [updateSubscriber, createAnalyticsEvent]);
|
|
131
|
+
}, [updateSubscriber, createAnalyticsEvent, isCommentsOnMediaAnalyticsEnabled]);
|
|
126
132
|
return annotationClickEvent;
|
|
127
133
|
};
|
|
@@ -16,9 +16,11 @@ var AnnotationView = exports.AnnotationView = function AnnotationView(props) {
|
|
|
16
16
|
var actionContext = (0, _react.useContext)(_RendererActionsContext.RendererContext);
|
|
17
17
|
var inlineCommentProvider = providers && providers.inlineComment;
|
|
18
18
|
var updateSubscriber = inlineCommentProvider && inlineCommentProvider.updateSubscriber || null;
|
|
19
|
+
var isCommentsOnMediaAnalyticsEnabled = inlineCommentProvider === null || inlineCommentProvider === void 0 ? void 0 : inlineCommentProvider.isCommentsOnMediaAnalyticsEnabled;
|
|
19
20
|
var viewComponentProps = (0, _hooks.useAnnotationClickEvent)({
|
|
20
21
|
updateSubscriber: updateSubscriber,
|
|
21
|
-
createAnalyticsEvent: props.createAnalyticsEvent
|
|
22
|
+
createAnalyticsEvent: props.createAnalyticsEvent,
|
|
23
|
+
isCommentsOnMediaAnalyticsEnabled: isCommentsOnMediaAnalyticsEnabled
|
|
22
24
|
});
|
|
23
25
|
var ViewComponent = inlineCommentProvider && inlineCommentProvider.viewComponent;
|
|
24
26
|
var deleteAnnotation = (0, _react.useMemo)(function () {
|
|
@@ -12,7 +12,7 @@ import { MediaCard } from '../../../ui/MediaCard';
|
|
|
12
12
|
import { AnnotationMarkStates } from '@atlaskit/adf-schema';
|
|
13
13
|
import { hexToEditorBorderPaletteColor } from '@atlaskit/editor-palette';
|
|
14
14
|
import { getEventHandler } from '../../../utils';
|
|
15
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
15
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, VIEW_METHOD } from '@atlaskit/editor-common/analytics';
|
|
16
16
|
import { MODE, PLATFORM } from '../../../analytics/events';
|
|
17
17
|
import AnnotationComponent from '../../marks/annotation';
|
|
18
18
|
import { AnnotationsDraftContext, ProvidersContext } from '../../../ui/annotations/context';
|
|
@@ -161,7 +161,10 @@ const CommentBadgeWrapper = ({
|
|
|
161
161
|
if (updateSubscriber) {
|
|
162
162
|
updateSubscriber.emit(AnnotationUpdateEvent.ON_ANNOTATION_CLICK, {
|
|
163
163
|
annotationIds: activeParentIds,
|
|
164
|
-
eventTarget: e.target
|
|
164
|
+
eventTarget: e.target,
|
|
165
|
+
// use mediaSingle here to align with annotation viewed event dispatched in editor
|
|
166
|
+
eventTargetType: 'mediaSingle',
|
|
167
|
+
viewMethod: VIEW_METHOD.BADGE
|
|
165
168
|
});
|
|
166
169
|
}
|
|
167
170
|
};
|
|
@@ -189,7 +192,8 @@ class Media extends PureComponent {
|
|
|
189
192
|
width,
|
|
190
193
|
height,
|
|
191
194
|
mediaSingleElement,
|
|
192
|
-
isDrafting = false
|
|
195
|
+
isDrafting = false,
|
|
196
|
+
isInPageInclude
|
|
193
197
|
} = this.props;
|
|
194
198
|
const annotationMarks = this.props.isAnnotationMark ? this.props.marks.filter(this.props.isAnnotationMark) : undefined;
|
|
195
199
|
const borderMark = this.props.marks.find(this.props.isBorderMark);
|
|
@@ -197,6 +201,7 @@ class Media extends PureComponent {
|
|
|
197
201
|
const linkHref = linkMark === null || linkMark === void 0 ? void 0 : linkMark.attrs.href;
|
|
198
202
|
const eventHandlers = linkHref ? undefined : this.props.eventHandlers;
|
|
199
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);
|
|
200
205
|
return jsx(MediaLink, {
|
|
201
206
|
mark: linkMark,
|
|
202
207
|
onClick: this.handleMediaLinkClickFn
|
|
@@ -210,7 +215,7 @@ class Media extends PureComponent {
|
|
|
210
215
|
border: !!borderMark
|
|
211
216
|
}
|
|
212
217
|
}
|
|
213
|
-
},
|
|
218
|
+
}, showCommentBadge && jsx(CommentBadgeWrapper, {
|
|
214
219
|
marks: annotationMarks,
|
|
215
220
|
mediaElement: mediaSingleElement,
|
|
216
221
|
width: width,
|
|
@@ -277,6 +282,11 @@ const MediaWithDraftAnnotation = props => {
|
|
|
277
282
|
dataAttributes
|
|
278
283
|
} = props;
|
|
279
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
|
+
}
|
|
280
290
|
const [position, setPosition] = useState();
|
|
281
291
|
const [shouldApplyDraftAnnotation, setShouldApplyDraftAnnotation] = useState(false);
|
|
282
292
|
useEffect(() => {
|
|
@@ -292,7 +302,7 @@ const MediaWithDraftAnnotation = props => {
|
|
|
292
302
|
setShouldApplyDraftAnnotation(false);
|
|
293
303
|
setPosition(undefined);
|
|
294
304
|
}
|
|
295
|
-
}, [draftPosition, pos, shouldApplyDraftAnnotation, isCommentsOnMediaBugFixEnabled]);
|
|
305
|
+
}, [draftPosition, parentElementClosest, pos, shouldApplyDraftAnnotation, isCommentsOnMediaBugFixEnabled]);
|
|
296
306
|
const applyDraftAnnotation = props.allowAnnotationsDraftMode && shouldApplyDraftAnnotation && position !== undefined;
|
|
297
307
|
const dataAttributesWithDraftAnnotation = useMemo(() => applyDraftAnnotation ? {
|
|
298
308
|
...dataAttributes,
|
|
@@ -301,7 +311,8 @@ const MediaWithDraftAnnotation = props => {
|
|
|
301
311
|
} : dataAttributes, [applyDraftAnnotation, dataAttributes]);
|
|
302
312
|
return jsx(Media, _extends({}, props, {
|
|
303
313
|
dataAttributes: dataAttributesWithDraftAnnotation,
|
|
304
|
-
isDrafting: shouldApplyDraftAnnotation
|
|
314
|
+
isDrafting: shouldApplyDraftAnnotation,
|
|
315
|
+
isInPageInclude: !!parentElementClosest
|
|
305
316
|
}));
|
|
306
317
|
};
|
|
307
318
|
export default MediaWithDraftAnnotation;
|
|
@@ -8,13 +8,15 @@ export default class MentionItem extends PureComponent {
|
|
|
8
8
|
id,
|
|
9
9
|
providers,
|
|
10
10
|
text,
|
|
11
|
-
accessLevel
|
|
11
|
+
accessLevel,
|
|
12
|
+
localId
|
|
12
13
|
} = this.props;
|
|
13
14
|
return /*#__PURE__*/React.createElement(Mention, {
|
|
14
15
|
id: id,
|
|
15
16
|
text: text,
|
|
16
17
|
accessLevel: accessLevel,
|
|
17
18
|
providers: providers,
|
|
19
|
+
localId: localId,
|
|
18
20
|
eventHandlers: eventHandlers && eventHandlers.mention
|
|
19
21
|
});
|
|
20
22
|
}
|
|
@@ -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) {
|
|
@@ -67,7 +67,8 @@ export const useAnnotationClickEvent = props => {
|
|
|
67
67
|
const [annotationClickEvent, setAnnotationClickEvent] = useState(null);
|
|
68
68
|
const {
|
|
69
69
|
updateSubscriber,
|
|
70
|
-
createAnalyticsEvent
|
|
70
|
+
createAnalyticsEvent,
|
|
71
|
+
isCommentsOnMediaAnalyticsEnabled
|
|
71
72
|
} = props;
|
|
72
73
|
useLayoutEffect(() => {
|
|
73
74
|
if (!updateSubscriber) {
|
|
@@ -75,7 +76,9 @@ export const useAnnotationClickEvent = props => {
|
|
|
75
76
|
}
|
|
76
77
|
const clickCb = ({
|
|
77
78
|
annotationIds,
|
|
78
|
-
eventTarget
|
|
79
|
+
eventTarget,
|
|
80
|
+
eventTargetType,
|
|
81
|
+
viewMethod
|
|
79
82
|
}) => {
|
|
80
83
|
const annotationsByType = annotationIds.filter(id => !!id).map(id => ({
|
|
81
84
|
id,
|
|
@@ -88,7 +91,11 @@ export const useAnnotationClickEvent = props => {
|
|
|
88
91
|
actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
89
92
|
eventType: EVENT_TYPE.TRACK,
|
|
90
93
|
attributes: {
|
|
91
|
-
overlap: annotationsByType.length || 0
|
|
94
|
+
overlap: annotationsByType.length || 0,
|
|
95
|
+
...(isCommentsOnMediaAnalyticsEnabled && {
|
|
96
|
+
targetNodeType: eventTargetType,
|
|
97
|
+
method: viewMethod
|
|
98
|
+
})
|
|
92
99
|
}
|
|
93
100
|
}).fire(FabricChannel.editor);
|
|
94
101
|
}
|
|
@@ -109,6 +116,6 @@ export const useAnnotationClickEvent = props => {
|
|
|
109
116
|
updateSubscriber.off(AnnotationUpdateEvent.ON_ANNOTATION_CLICK, clickCb);
|
|
110
117
|
updateSubscriber.off(AnnotationUpdateEvent.DESELECT_ANNOTATIONS, deselectCb);
|
|
111
118
|
};
|
|
112
|
-
}, [updateSubscriber, createAnalyticsEvent]);
|
|
119
|
+
}, [updateSubscriber, createAnalyticsEvent, isCommentsOnMediaAnalyticsEnabled]);
|
|
113
120
|
return annotationClickEvent;
|
|
114
121
|
};
|
|
@@ -7,9 +7,11 @@ const AnnotationView = props => {
|
|
|
7
7
|
const actionContext = useContext(RendererContext);
|
|
8
8
|
const inlineCommentProvider = providers && providers.inlineComment;
|
|
9
9
|
const updateSubscriber = inlineCommentProvider && inlineCommentProvider.updateSubscriber || null;
|
|
10
|
+
const isCommentsOnMediaAnalyticsEnabled = inlineCommentProvider === null || inlineCommentProvider === void 0 ? void 0 : inlineCommentProvider.isCommentsOnMediaAnalyticsEnabled;
|
|
10
11
|
const viewComponentProps = useAnnotationClickEvent({
|
|
11
12
|
updateSubscriber,
|
|
12
|
-
createAnalyticsEvent: props.createAnalyticsEvent
|
|
13
|
+
createAnalyticsEvent: props.createAnalyticsEvent,
|
|
14
|
+
isCommentsOnMediaAnalyticsEnabled
|
|
13
15
|
});
|
|
14
16
|
const ViewComponent = inlineCommentProvider && inlineCommentProvider.viewComponent;
|
|
15
17
|
const deleteAnnotation = useMemo(() => annotationInfo => actionContext.deleteAnnotation(annotationInfo.id, annotationInfo.type), [actionContext]);
|
|
@@ -27,7 +27,7 @@ import { MediaCard } from '../../../ui/MediaCard';
|
|
|
27
27
|
import { AnnotationMarkStates } from '@atlaskit/adf-schema';
|
|
28
28
|
import { hexToEditorBorderPaletteColor } from '@atlaskit/editor-palette';
|
|
29
29
|
import { getEventHandler } from '../../../utils';
|
|
30
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
30
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, VIEW_METHOD } from '@atlaskit/editor-common/analytics';
|
|
31
31
|
import { MODE, PLATFORM } from '../../../analytics/events';
|
|
32
32
|
import AnnotationComponent from '../../marks/annotation';
|
|
33
33
|
import { AnnotationsDraftContext, ProvidersContext } from '../../../ui/annotations/context';
|
|
@@ -167,7 +167,10 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref5) {
|
|
|
167
167
|
if (updateSubscriber) {
|
|
168
168
|
updateSubscriber.emit(AnnotationUpdateEvent.ON_ANNOTATION_CLICK, {
|
|
169
169
|
annotationIds: activeParentIds,
|
|
170
|
-
eventTarget: e.target
|
|
170
|
+
eventTarget: e.target,
|
|
171
|
+
// use mediaSingle here to align with annotation viewed event dispatched in editor
|
|
172
|
+
eventTargetType: 'mediaSingle',
|
|
173
|
+
viewMethod: VIEW_METHOD.BADGE
|
|
171
174
|
});
|
|
172
175
|
}
|
|
173
176
|
};
|
|
@@ -203,13 +206,15 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
203
206
|
height = _this$props.height,
|
|
204
207
|
mediaSingleElement = _this$props.mediaSingleElement,
|
|
205
208
|
_this$props$isDraftin = _this$props.isDrafting,
|
|
206
|
-
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;
|
|
207
211
|
var annotationMarks = _this.props.isAnnotationMark ? _this.props.marks.filter(_this.props.isAnnotationMark) : undefined;
|
|
208
212
|
var borderMark = _this.props.marks.find(_this.props.isBorderMark);
|
|
209
213
|
var linkMark = _this.props.marks.find(_this.props.isLinkMark);
|
|
210
214
|
var linkHref = linkMark === null || linkMark === void 0 ? void 0 : linkMark.attrs.href;
|
|
211
215
|
var eventHandlers = linkHref ? undefined : _this.props.eventHandlers;
|
|
212
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);
|
|
213
218
|
return jsx(MediaLink, {
|
|
214
219
|
mark: linkMark,
|
|
215
220
|
onClick: _this.handleMediaLinkClickFn
|
|
@@ -221,7 +226,7 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
221
226
|
data: _defineProperty({}, MEDIA_CONTEXT, {
|
|
222
227
|
border: !!borderMark
|
|
223
228
|
})
|
|
224
|
-
},
|
|
229
|
+
}, showCommentBadge && jsx(CommentBadgeWrapper, {
|
|
225
230
|
marks: annotationMarks,
|
|
226
231
|
mediaElement: mediaSingleElement,
|
|
227
232
|
width: width,
|
|
@@ -288,6 +293,11 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
288
293
|
var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
289
294
|
var dataAttributes = props.dataAttributes;
|
|
290
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
|
+
}
|
|
291
301
|
var _useState5 = useState(),
|
|
292
302
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
293
303
|
position = _useState6[0],
|
|
@@ -309,7 +319,7 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
309
319
|
setShouldApplyDraftAnnotation(false);
|
|
310
320
|
setPosition(undefined);
|
|
311
321
|
}
|
|
312
|
-
}, [draftPosition, pos, shouldApplyDraftAnnotation, isCommentsOnMediaBugFixEnabled]);
|
|
322
|
+
}, [draftPosition, parentElementClosest, pos, shouldApplyDraftAnnotation, isCommentsOnMediaBugFixEnabled]);
|
|
313
323
|
var applyDraftAnnotation = props.allowAnnotationsDraftMode && shouldApplyDraftAnnotation && position !== undefined;
|
|
314
324
|
var dataAttributesWithDraftAnnotation = useMemo(function () {
|
|
315
325
|
return applyDraftAnnotation ? _objectSpread(_objectSpread({}, dataAttributes), {}, {
|
|
@@ -319,7 +329,8 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
319
329
|
}, [applyDraftAnnotation, dataAttributes]);
|
|
320
330
|
return jsx(Media, _extends({}, props, {
|
|
321
331
|
dataAttributes: dataAttributesWithDraftAnnotation,
|
|
322
|
-
isDrafting: shouldApplyDraftAnnotation
|
|
332
|
+
isDrafting: shouldApplyDraftAnnotation,
|
|
333
|
+
isInPageInclude: !!parentElementClosest
|
|
323
334
|
}));
|
|
324
335
|
};
|
|
325
336
|
export default MediaWithDraftAnnotation;
|
|
@@ -23,12 +23,14 @@ var MentionItem = /*#__PURE__*/function (_PureComponent) {
|
|
|
23
23
|
id = _this$props.id,
|
|
24
24
|
providers = _this$props.providers,
|
|
25
25
|
text = _this$props.text,
|
|
26
|
-
accessLevel = _this$props.accessLevel
|
|
26
|
+
accessLevel = _this$props.accessLevel,
|
|
27
|
+
localId = _this$props.localId;
|
|
27
28
|
return /*#__PURE__*/React.createElement(Mention, {
|
|
28
29
|
id: id,
|
|
29
30
|
text: text,
|
|
30
31
|
accessLevel: accessLevel,
|
|
31
32
|
providers: providers,
|
|
33
|
+
localId: localId,
|
|
32
34
|
eventHandlers: eventHandlers && eventHandlers.mention
|
|
33
35
|
});
|
|
34
36
|
}
|
|
@@ -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);
|
|
@@ -71,14 +71,17 @@ export var useAnnotationClickEvent = function useAnnotationClickEvent(props) {
|
|
|
71
71
|
annotationClickEvent = _useState6[0],
|
|
72
72
|
setAnnotationClickEvent = _useState6[1];
|
|
73
73
|
var updateSubscriber = props.updateSubscriber,
|
|
74
|
-
createAnalyticsEvent = props.createAnalyticsEvent
|
|
74
|
+
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
75
|
+
isCommentsOnMediaAnalyticsEnabled = props.isCommentsOnMediaAnalyticsEnabled;
|
|
75
76
|
useLayoutEffect(function () {
|
|
76
77
|
if (!updateSubscriber) {
|
|
77
78
|
return;
|
|
78
79
|
}
|
|
79
80
|
var clickCb = function clickCb(_ref3) {
|
|
80
81
|
var annotationIds = _ref3.annotationIds,
|
|
81
|
-
eventTarget = _ref3.eventTarget
|
|
82
|
+
eventTarget = _ref3.eventTarget,
|
|
83
|
+
eventTargetType = _ref3.eventTargetType,
|
|
84
|
+
viewMethod = _ref3.viewMethod;
|
|
82
85
|
var annotationsByType = annotationIds.filter(function (id) {
|
|
83
86
|
return !!id;
|
|
84
87
|
}).map(function (id) {
|
|
@@ -93,9 +96,12 @@ export var useAnnotationClickEvent = function useAnnotationClickEvent(props) {
|
|
|
93
96
|
actionSubject: ACTION_SUBJECT.ANNOTATION,
|
|
94
97
|
actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
95
98
|
eventType: EVENT_TYPE.TRACK,
|
|
96
|
-
attributes: {
|
|
99
|
+
attributes: _objectSpread({
|
|
97
100
|
overlap: annotationsByType.length || 0
|
|
98
|
-
}
|
|
101
|
+
}, isCommentsOnMediaAnalyticsEnabled && {
|
|
102
|
+
targetNodeType: eventTargetType,
|
|
103
|
+
method: viewMethod
|
|
104
|
+
})
|
|
99
105
|
}).fire(FabricChannel.editor);
|
|
100
106
|
}
|
|
101
107
|
setAnnotationClickEvent({
|
|
@@ -115,6 +121,6 @@ export var useAnnotationClickEvent = function useAnnotationClickEvent(props) {
|
|
|
115
121
|
updateSubscriber.off(AnnotationUpdateEvent.ON_ANNOTATION_CLICK, clickCb);
|
|
116
122
|
updateSubscriber.off(AnnotationUpdateEvent.DESELECT_ANNOTATIONS, deselectCb);
|
|
117
123
|
};
|
|
118
|
-
}, [updateSubscriber, createAnalyticsEvent]);
|
|
124
|
+
}, [updateSubscriber, createAnalyticsEvent, isCommentsOnMediaAnalyticsEnabled]);
|
|
119
125
|
return annotationClickEvent;
|
|
120
126
|
};
|
|
@@ -7,9 +7,11 @@ var AnnotationView = function AnnotationView(props) {
|
|
|
7
7
|
var actionContext = useContext(RendererContext);
|
|
8
8
|
var inlineCommentProvider = providers && providers.inlineComment;
|
|
9
9
|
var updateSubscriber = inlineCommentProvider && inlineCommentProvider.updateSubscriber || null;
|
|
10
|
+
var isCommentsOnMediaAnalyticsEnabled = inlineCommentProvider === null || inlineCommentProvider === void 0 ? void 0 : inlineCommentProvider.isCommentsOnMediaAnalyticsEnabled;
|
|
10
11
|
var viewComponentProps = useAnnotationClickEvent({
|
|
11
12
|
updateSubscriber: updateSubscriber,
|
|
12
|
-
createAnalyticsEvent: props.createAnalyticsEvent
|
|
13
|
+
createAnalyticsEvent: props.createAnalyticsEvent,
|
|
14
|
+
isCommentsOnMediaAnalyticsEnabled: isCommentsOnMediaAnalyticsEnabled
|
|
13
15
|
});
|
|
14
16
|
var ViewComponent = inlineCommentProvider && inlineCommentProvider.viewComponent;
|
|
15
17
|
var deleteAnnotation = useMemo(function () {
|
|
@@ -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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PureComponent } from 'react';
|
|
2
|
-
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
3
|
import type { EventHandlers } from '@atlaskit/editor-common/ui';
|
|
4
4
|
export interface Props {
|
|
5
5
|
id: string;
|
|
@@ -7,6 +7,7 @@ export interface Props {
|
|
|
7
7
|
eventHandlers?: EventHandlers;
|
|
8
8
|
text: string;
|
|
9
9
|
accessLevel?: string;
|
|
10
|
+
localId?: string;
|
|
10
11
|
}
|
|
11
12
|
export default class MentionItem extends PureComponent<Props, {}> {
|
|
12
13
|
render(): JSX.Element;
|
|
@@ -14,5 +14,7 @@ type UseAnnotationUpdateSatteByEventProps = {
|
|
|
14
14
|
export declare const useAnnotationStateByTypeEvent: ({ type, updateSubscriber, }: UseAnnotationUpdateSatteByEventProps) => Record<string, AnnotationMarkStates | null>;
|
|
15
15
|
export declare const useHasFocusEvent: ({ id, updateSubscriber, }: ListenEventProps) => boolean;
|
|
16
16
|
type AnnotationsWithClickTarget = Pick<InlineCommentViewComponentProps, 'annotations' | 'clickElementTarget'> | null;
|
|
17
|
-
export declare const useAnnotationClickEvent: (props: Pick<ListenEventProps,
|
|
17
|
+
export declare const useAnnotationClickEvent: (props: Pick<ListenEventProps, "createAnalyticsEvent" | "updateSubscriber"> & {
|
|
18
|
+
isCommentsOnMediaAnalyticsEnabled?: boolean | undefined;
|
|
19
|
+
}) => AnnotationsWithClickTarget;
|
|
18
20
|
export {};
|
|
@@ -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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PureComponent } from 'react';
|
|
2
|
-
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
3
|
import type { EventHandlers } from '@atlaskit/editor-common/ui';
|
|
4
4
|
export interface Props {
|
|
5
5
|
id: string;
|
|
@@ -7,6 +7,7 @@ export interface Props {
|
|
|
7
7
|
eventHandlers?: EventHandlers;
|
|
8
8
|
text: string;
|
|
9
9
|
accessLevel?: string;
|
|
10
|
+
localId?: string;
|
|
10
11
|
}
|
|
11
12
|
export default class MentionItem extends PureComponent<Props, {}> {
|
|
12
13
|
render(): JSX.Element;
|
|
@@ -14,5 +14,7 @@ type UseAnnotationUpdateSatteByEventProps = {
|
|
|
14
14
|
export declare const useAnnotationStateByTypeEvent: ({ type, updateSubscriber, }: UseAnnotationUpdateSatteByEventProps) => Record<string, AnnotationMarkStates | null>;
|
|
15
15
|
export declare const useHasFocusEvent: ({ id, updateSubscriber, }: ListenEventProps) => boolean;
|
|
16
16
|
type AnnotationsWithClickTarget = Pick<InlineCommentViewComponentProps, 'annotations' | 'clickElementTarget'> | null;
|
|
17
|
-
export declare const useAnnotationClickEvent: (props: Pick<ListenEventProps,
|
|
17
|
+
export declare const useAnnotationClickEvent: (props: Pick<ListenEventProps, "createAnalyticsEvent" | "updateSubscriber"> & {
|
|
18
|
+
isCommentsOnMediaAnalyticsEnabled?: boolean | undefined;
|
|
19
|
+
}) => AnnotationsWithClickTarget;
|
|
18
20
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "109.
|
|
3
|
+
"version": "109.29.0",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/analytics-next": "^9.3.0",
|
|
32
32
|
"@atlaskit/button": "^17.14.0",
|
|
33
33
|
"@atlaskit/code": "^15.2.0",
|
|
34
|
-
"@atlaskit/editor-common": "^80.
|
|
34
|
+
"@atlaskit/editor-common": "^80.4.0",
|
|
35
35
|
"@atlaskit/editor-json-transformer": "^8.13.0",
|
|
36
36
|
"@atlaskit/editor-palette": "1.6.0",
|
|
37
37
|
"@atlaskit/editor-prosemirror": "4.0.1",
|