@atlaskit/renderer 111.0.0 → 111.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/actions/index.js +4 -7
  3. package/dist/cjs/react/nodes/media/index.js +2 -4
  4. package/dist/cjs/ui/Renderer/index.js +1 -1
  5. package/dist/cjs/ui/annotations/hooks/use-load-annotations.js +11 -2
  6. package/dist/cjs/ui/annotations/hover/mounter.js +4 -7
  7. package/dist/cjs/ui/annotations/index.js +8 -4
  8. package/dist/cjs/ui/annotations/selection/mounter.js +4 -7
  9. package/dist/es2019/actions/index.js +5 -8
  10. package/dist/es2019/react/nodes/media/index.js +4 -6
  11. package/dist/es2019/ui/Renderer/index.js +1 -1
  12. package/dist/es2019/ui/annotations/hooks/use-load-annotations.js +9 -2
  13. package/dist/es2019/ui/annotations/hover/mounter.js +4 -7
  14. package/dist/es2019/ui/annotations/index.js +8 -4
  15. package/dist/es2019/ui/annotations/selection/mounter.js +4 -7
  16. package/dist/esm/actions/index.js +4 -7
  17. package/dist/esm/react/nodes/media/index.js +4 -6
  18. package/dist/esm/ui/Renderer/index.js +1 -1
  19. package/dist/esm/ui/annotations/hooks/use-load-annotations.js +11 -2
  20. package/dist/esm/ui/annotations/hover/mounter.js +4 -7
  21. package/dist/esm/ui/annotations/index.js +8 -4
  22. package/dist/esm/ui/annotations/selection/mounter.js +4 -7
  23. package/dist/types/actions/index.d.ts +2 -2
  24. package/dist/types/ui/annotations/hooks/use-load-annotations.d.ts +4 -1
  25. package/dist/types/ui/annotations/types.d.ts +3 -0
  26. package/dist/types-ts4.5/actions/index.d.ts +2 -2
  27. package/dist/types-ts4.5/ui/annotations/hooks/use-load-annotations.d.ts +4 -1
  28. package/dist/types-ts4.5/ui/annotations/types.d.ts +3 -0
  29. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 111.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#147547](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/147547)
8
+ [`46defc30fb9dd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/46defc30fb9dd) -
9
+ Cleanup of a FF for comments on media bug fix
10
+ - Updated dependencies
11
+
12
+ ## 111.0.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [#147384](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/147384)
17
+ [`dd88ce6ba197e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dd88ce6ba197e) -
18
+ Adds a onLoadComplete callback for useLoadAnnotations annotations hook
19
+
3
20
  ## 111.0.0
4
21
 
5
22
  ### Major Changes
@@ -281,7 +281,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
281
281
  }
282
282
  }, {
283
283
  key: "applyAnnotation",
284
- value: function applyAnnotation(pos, annotation, isCommentsOnMediaBugFixEnabled) {
284
+ value: function applyAnnotation(pos, annotation) {
285
285
  if (!this.doc || !pos || !this.schema) {
286
286
  return false;
287
287
  }
@@ -291,13 +291,10 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
291
291
  annotationType = annotation.annotationType;
292
292
  var step;
293
293
  var targetNodeType;
294
- var beforeNodePos = isCommentsOnMediaBugFixEnabled ?
294
+
295
295
  // As part of fix for RAP, `from` points to the position right before media node
296
296
  // hence, -1 is not needed
297
- from :
298
- // If from points to a node position,
299
- // we need to 1 position before it for nodeAt to return the node itself
300
- Math.max(from - 1, 0);
297
+ var beforeNodePos = from;
301
298
  var possibleNode = this.doc.nodeAt(beforeNodePos);
302
299
  if ((possibleNode === null || possibleNode === void 0 ? void 0 : possibleNode.type.name) === 'media') {
303
300
  targetNodeType = 'media';
@@ -340,7 +337,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
340
337
  numMatches: numMatches,
341
338
  matchIndex: matchIndex,
342
339
  pos: blockNodePos
343
- }, isCommentsOnMediaBugFixEnabled && {
340
+ }, {
344
341
  targetNodeType: targetNodeType
345
342
  });
346
343
  }
@@ -407,8 +407,6 @@ var Media = /*#__PURE__*/function (_PureComponent) {
407
407
  }(_react.PureComponent);
408
408
  var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
409
409
  var draftPosition = _react.default.useContext(_context.AnnotationsDraftContext);
410
- var providers = (0, _react.useContext)(_context.ProvidersContext);
411
- var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
412
410
  var dataAttributes = props.dataAttributes;
413
411
  var pos = dataAttributes && dataAttributes['data-renderer-start-pos'];
414
412
  var _useState9 = (0, _react.useState)(),
@@ -424,7 +422,7 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
424
422
  if (pos === undefined) {
425
423
  return;
426
424
  }
427
- var posToCheck = isCommentsOnMediaBugFixEnabled ? ((_draftPosition$from = draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from) !== null && _draftPosition$from !== void 0 ? _draftPosition$from : 0) + 1 : draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from;
425
+ var posToCheck = ((_draftPosition$from = draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from) !== null && _draftPosition$from !== void 0 ? _draftPosition$from : 0) + 1;
428
426
  if (draftPosition !== null && posToCheck === pos) {
429
427
  setShouldApplyDraftAnnotation(true);
430
428
  setPosition(posToCheck);
@@ -432,7 +430,7 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
432
430
  setShouldApplyDraftAnnotation(false);
433
431
  setPosition(undefined);
434
432
  }
435
- }, [draftPosition, pos, shouldApplyDraftAnnotation, isCommentsOnMediaBugFixEnabled]);
433
+ }, [draftPosition, pos, shouldApplyDraftAnnotation]);
436
434
  var applyDraftAnnotation = props.allowAnnotationsDraftMode && shouldApplyDraftAnnotation && position !== undefined;
437
435
  var dataAttributesWithDraftAnnotation = (0, _react.useMemo)(function () {
438
436
  return applyDraftAnnotation ? _objectSpread(_objectSpread({}, dataAttributes), {}, {
@@ -63,7 +63,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
63
63
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
64
64
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
65
65
  var packageName = "@atlaskit/renderer";
66
- var packageVersion = "111.0.0";
66
+ var packageVersion = "111.0.2";
67
67
  var defaultNodeComponents = exports.defaultNodeComponents = _nodes.nodeToReact;
68
68
  var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
69
69
  (0, _inherits2.default)(Renderer, _PureComponent);
@@ -14,7 +14,8 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
14
14
  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; }
15
15
  var useLoadAnnotations = exports.useLoadAnnotations = function useLoadAnnotations(_ref) {
16
16
  var adfDocument = _ref.adfDocument,
17
- isNestedRender = _ref.isNestedRender;
17
+ isNestedRender = _ref.isNestedRender,
18
+ onLoadComplete = _ref.onLoadComplete;
18
19
  var actions = (0, _react.useContext)(_RendererActionsContext.RendererContext);
19
20
  var providers = (0, _react.useContext)(_context.ProvidersContext);
20
21
  (0, _react.useEffect)(function () {
@@ -27,6 +28,9 @@ var useLoadAnnotations = exports.useLoadAnnotations = function useLoadAnnotation
27
28
  var annotations = actions.getAnnotationMarks();
28
29
  // we don't want to request integrators for state with an empty list of ids.
29
30
  if (!annotations.length) {
31
+ onLoadComplete && onLoadComplete({
32
+ numberOfUnresolvedInlineComments: 0
33
+ });
30
34
  return;
31
35
  }
32
36
  var ids = annotations.map(function (mark) {
@@ -40,7 +44,12 @@ var useLoadAnnotations = exports.useLoadAnnotations = function useLoadAnnotation
40
44
  return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, value.id, value));
41
45
  }, {});
42
46
  updateSubscriberInlineComment.emit(_types.AnnotationUpdateEvent.SET_ANNOTATION_STATE, payload);
47
+ onLoadComplete && onLoadComplete({
48
+ numberOfUnresolvedInlineComments: data.filter(function (data) {
49
+ return data.state === 'active';
50
+ }).length
51
+ });
43
52
  };
44
53
  inlineCommentGetState(ids, isNestedRender).then(cb);
45
- }, [actions, providers, adfDocument, isNestedRender]);
54
+ }, [actions, providers, adfDocument, isNestedRender, onLoadComplete]);
46
55
  };
@@ -13,7 +13,6 @@ var _draft = require("../draft");
13
13
  var _types = require("@atlaskit/analytics-listeners/types");
14
14
  var _analytics = require("@atlaskit/editor-common/analytics");
15
15
  var _RendererActionsContext = require("../../RendererActionsContext");
16
- var _context = require("../context");
17
16
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
18
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
19
18
  var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props) {
@@ -34,8 +33,6 @@ var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props
34
33
  draftDocumentPosition = _useState2[0],
35
34
  setDraftDocumentPosition = _useState2[1];
36
35
  var actions = (0, _react.useContext)(_RendererActionsContext.RendererContext);
37
- var providers = (0, _react.useContext)(_context.ProvidersContext);
38
- var isCommentsOnMediaBugFixEnabled = Boolean(providers === null || providers === void 0 ? void 0 : providers.inlineComment.isCommentsOnMediaBugFixEnabled);
39
36
  var onCreateCallback = (0, _react.useCallback)(function (annotationId) {
40
37
  if (!isAnnotationAllowed || !documentPosition || !applyAnnotation) {
41
38
  return false;
@@ -53,8 +50,8 @@ var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props
53
50
  eventType: _analytics.EVENT_TYPE.TRACK
54
51
  }).fire(_types.FabricChannel.editor);
55
52
  }
56
- return applyAnnotation(draftDocumentPosition || documentPosition, annotation, isCommentsOnMediaBugFixEnabled);
57
- }, [isAnnotationAllowed, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent, isCommentsOnMediaBugFixEnabled]);
53
+ return applyAnnotation(draftDocumentPosition || documentPosition, annotation);
54
+ }, [isAnnotationAllowed, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent]);
58
55
  var createIndexCallback = (0, _react.useCallback)(function () {
59
56
  if (!documentPosition || !generateIndexMatch) {
60
57
  return false;
@@ -110,8 +107,8 @@ var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props
110
107
  annotationId: options.annotationId,
111
108
  annotationType: _adfSchema.AnnotationTypes.INLINE_COMMENT
112
109
  };
113
- return applyAnnotation(positionToAnnotate, annotation, isCommentsOnMediaBugFixEnabled);
114
- }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, isCommentsOnMediaBugFixEnabled, actions, range]);
110
+ return applyAnnotation(positionToAnnotate, annotation);
111
+ }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, actions, range]);
115
112
  var removeDraftModeCallback = (0, _react.useCallback)(function () {
116
113
  clearAnnotationDraft();
117
114
  setDraftDocumentPosition(null);
@@ -31,10 +31,12 @@ var _draft = require("./draft");
31
31
  var _element = require("./element");
32
32
  var LoadAnnotations = /*#__PURE__*/_react.default.memo(function (_ref) {
33
33
  var adfDocument = _ref.adfDocument,
34
- isNestedRender = _ref.isNestedRender;
34
+ isNestedRender = _ref.isNestedRender,
35
+ onLoadComplete = _ref.onLoadComplete;
35
36
  (0, _useLoadAnnotations.useLoadAnnotations)({
36
37
  adfDocument: adfDocument,
37
- isNestedRender: isNestedRender
38
+ isNestedRender: isNestedRender,
39
+ onLoadComplete: onLoadComplete
38
40
  });
39
41
  return null;
40
42
  });
@@ -44,7 +46,8 @@ var AnnotationsWrapper = exports.AnnotationsWrapper = function AnnotationsWrappe
44
46
  annotationProvider = props.annotationProvider,
45
47
  rendererRef = props.rendererRef,
46
48
  adfDocument = props.adfDocument,
47
- isNestedRender = props.isNestedRender;
49
+ isNestedRender = props.isNestedRender,
50
+ onLoadComplete = props.onLoadComplete;
48
51
  var updateSubscriber = annotationProvider && annotationProvider.inlineComment && annotationProvider.inlineComment.updateSubscriber;
49
52
  var inlineCommentAnnotationsState = (0, _useEvents.useAnnotationStateByTypeEvent)({
50
53
  type: _adfSchema.AnnotationTypes.INLINE_COMMENT,
@@ -63,7 +66,8 @@ var AnnotationsWrapper = exports.AnnotationsWrapper = function AnnotationsWrappe
63
66
  rendererRef: rendererRef
64
67
  }, /*#__PURE__*/_react.default.createElement(LoadAnnotations, {
65
68
  adfDocument: adfDocument,
66
- isNestedRender: isNestedRender
69
+ isNestedRender: isNestedRender,
70
+ onLoadComplete: onLoadComplete
67
71
  }), /*#__PURE__*/_react.default.createElement(_view.AnnotationView, {
68
72
  createAnalyticsEvent: createAnalyticsEvent
69
73
  }), children)))));
@@ -15,7 +15,6 @@ var _types = require("@atlaskit/analytics-listeners/types");
15
15
  var _analytics = require("@atlaskit/editor-common/analytics");
16
16
  var _getRendererRangeInlineNodeNames = require("../../../actions/get-renderer-range-inline-node-names");
17
17
  var _RendererActionsContext = require("../../RendererActionsContext");
18
- var _context = require("../context");
19
18
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
19
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
20
  var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#__PURE__*/_react.default.memo(function (props) {
@@ -36,8 +35,6 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
36
35
  draftDocumentPosition = _useState2[0],
37
36
  setDraftDocumentPosition = _useState2[1];
38
37
  var actions = (0, _react.useContext)(_RendererActionsContext.RendererContext);
39
- var providers = (0, _react.useContext)(_context.ProvidersContext);
40
- var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
41
38
  var inlineNodeTypes = (0, _react.useMemo)(function () {
42
39
  if ((0, _platformFeatureFlags.fg)('annotations_defensive_node_name_calculations')) {
43
40
  if (!actions.isRangeAnnotatable(range)) {
@@ -89,8 +86,8 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
89
86
  eventType: _analytics.EVENT_TYPE.TRACK
90
87
  }).fire(_types.FabricChannel.editor);
91
88
  }
92
- return applyAnnotation(positionToAnnotate, annotation, isCommentsOnMediaBugFixEnabled);
93
- }, [actions, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent, isCommentsOnMediaBugFixEnabled, inlineNodeTypes]);
89
+ return applyAnnotation(positionToAnnotate, annotation);
90
+ }, [actions, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent, inlineNodeTypes]);
94
91
  var createIndexCallback = (0, _react.useCallback)(function () {
95
92
  if (!documentPosition || !generateIndexMatch) {
96
93
  return false;
@@ -149,8 +146,8 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
149
146
  annotationId: options.annotationId,
150
147
  annotationType: _adfSchema.AnnotationTypes.INLINE_COMMENT
151
148
  };
152
- return applyAnnotation(positionToAnnotate, annotation, isCommentsOnMediaBugFixEnabled);
153
- }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, isCommentsOnMediaBugFixEnabled, actions, range, inlineNodeTypes]);
149
+ return applyAnnotation(positionToAnnotate, annotation);
150
+ }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, actions, range, inlineNodeTypes]);
154
151
  var removeDraftModeCallback = (0, _react.useCallback)(function () {
155
152
  clearAnnotationDraft();
156
153
  setDraftDocumentPosition(null);
@@ -253,7 +253,7 @@ export default class RendererActions {
253
253
  }
254
254
  return getAnnotationIdsFromRange(pos, this.doc, this.schema);
255
255
  }
256
- applyAnnotation(pos, annotation, isCommentsOnMediaBugFixEnabled) {
256
+ applyAnnotation(pos, annotation) {
257
257
  if (!this.doc || !pos || !this.schema) {
258
258
  return false;
259
259
  }
@@ -267,13 +267,10 @@ export default class RendererActions {
267
267
  } = annotation;
268
268
  let step;
269
269
  let targetNodeType;
270
- const beforeNodePos = isCommentsOnMediaBugFixEnabled ?
270
+
271
271
  // As part of fix for RAP, `from` points to the position right before media node
272
272
  // hence, -1 is not needed
273
- from :
274
- // If from points to a node position,
275
- // we need to 1 position before it for nodeAt to return the node itself
276
- Math.max(from - 1, 0);
273
+ const beforeNodePos = from;
277
274
  const possibleNode = this.doc.nodeAt(beforeNodePos);
278
275
  if ((possibleNode === null || possibleNode === void 0 ? void 0 : possibleNode.type.name) === 'media') {
279
276
  targetNodeType = 'media';
@@ -318,9 +315,9 @@ export default class RendererActions {
318
315
  numMatches,
319
316
  matchIndex,
320
317
  pos: blockNodePos,
321
- ...(isCommentsOnMediaBugFixEnabled && {
318
+ ...{
322
319
  targetNodeType
323
- })
320
+ }
324
321
  };
325
322
  }
326
323
  generateAnnotationIndexMatch(pos) {
@@ -6,7 +6,7 @@ import _extends from "@babel/runtime/helpers/extends";
6
6
  * @jsxFrag
7
7
  */
8
8
 
9
- import React, { PureComponent, Fragment, useEffect, useState, useMemo, useContext } from 'react';
9
+ import React, { PureComponent, Fragment, useEffect, useState, useMemo } from 'react';
10
10
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
11
11
  import { jsx, css } from '@emotion/react';
12
12
  import { AnalyticsContext } from '@atlaskit/analytics-next';
@@ -20,7 +20,7 @@ import { getEventHandler } from '../../../utils';
20
20
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, VIEW_METHOD } from '@atlaskit/editor-common/analytics';
21
21
  import { MODE, PLATFORM } from '../../../analytics/events';
22
22
  import AnnotationComponent from '../../marks/annotation';
23
- import { AnnotationsDraftContext, ProvidersContext } from '../../../ui/annotations/context';
23
+ import { AnnotationsDraftContext } from '../../../ui/annotations/context';
24
24
  import { CommentBadge as CommentBadgeComponent, CommentBadgeNext, ExternalImageBadge, MediaBadges } from '@atlaskit/editor-common/media-single';
25
25
  import { injectIntl } from 'react-intl-next';
26
26
  import { useInlineCommentSubscriberContext, useInlineCommentsFilter } from '../../../ui/annotations/hooks';
@@ -371,8 +371,6 @@ class Media extends PureComponent {
371
371
  }
372
372
  const MediaWithDraftAnnotation = props => {
373
373
  const draftPosition = React.useContext(AnnotationsDraftContext);
374
- const providers = useContext(ProvidersContext);
375
- const isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
376
374
  const {
377
375
  dataAttributes
378
376
  } = props;
@@ -384,7 +382,7 @@ const MediaWithDraftAnnotation = props => {
384
382
  if (pos === undefined) {
385
383
  return;
386
384
  }
387
- const posToCheck = isCommentsOnMediaBugFixEnabled ? ((_draftPosition$from = draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from) !== null && _draftPosition$from !== void 0 ? _draftPosition$from : 0) + 1 : draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from;
385
+ const posToCheck = ((_draftPosition$from = draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from) !== null && _draftPosition$from !== void 0 ? _draftPosition$from : 0) + 1;
388
386
  if (draftPosition !== null && posToCheck === pos) {
389
387
  setShouldApplyDraftAnnotation(true);
390
388
  setPosition(posToCheck);
@@ -392,7 +390,7 @@ const MediaWithDraftAnnotation = props => {
392
390
  setShouldApplyDraftAnnotation(false);
393
391
  setPosition(undefined);
394
392
  }
395
- }, [draftPosition, pos, shouldApplyDraftAnnotation, isCommentsOnMediaBugFixEnabled]);
393
+ }, [draftPosition, pos, shouldApplyDraftAnnotation]);
396
394
  const applyDraftAnnotation = props.allowAnnotationsDraftMode && shouldApplyDraftAnnotation && position !== undefined;
397
395
  const dataAttributesWithDraftAnnotation = useMemo(() => applyDraftAnnotation ? {
398
396
  ...dataAttributes,
@@ -45,7 +45,7 @@ import { nodeToReact } from '../../react/nodes';
45
45
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
46
46
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
47
47
  const packageName = "@atlaskit/renderer";
48
- const packageVersion = "111.0.0";
48
+ const packageVersion = "111.0.2";
49
49
  export const defaultNodeComponents = nodeToReact;
50
50
  export class Renderer extends PureComponent {
51
51
  constructor(props) {
@@ -4,7 +4,8 @@ import { ProvidersContext } from '../context';
4
4
  import { RendererContext as ActionsContext } from '../../RendererActionsContext';
5
5
  export const useLoadAnnotations = ({
6
6
  adfDocument,
7
- isNestedRender
7
+ isNestedRender,
8
+ onLoadComplete
8
9
  }) => {
9
10
  const actions = useContext(ActionsContext);
10
11
  const providers = useContext(ProvidersContext);
@@ -21,6 +22,9 @@ export const useLoadAnnotations = ({
21
22
  const annotations = actions.getAnnotationMarks();
22
23
  // we don't want to request integrators for state with an empty list of ids.
23
24
  if (!annotations.length) {
25
+ onLoadComplete && onLoadComplete({
26
+ numberOfUnresolvedInlineComments: 0
27
+ });
24
28
  return;
25
29
  }
26
30
  const ids = annotations.map(mark => mark.attrs.id);
@@ -33,7 +37,10 @@ export const useLoadAnnotations = ({
33
37
  [value.id]: value
34
38
  }), {});
35
39
  updateSubscriberInlineComment.emit(AnnotationUpdateEvent.SET_ANNOTATION_STATE, payload);
40
+ onLoadComplete && onLoadComplete({
41
+ numberOfUnresolvedInlineComments: data.filter(data => data.state === 'active').length
42
+ });
36
43
  };
37
44
  inlineCommentGetState(ids, isNestedRender).then(cb);
38
- }, [actions, providers, adfDocument, isNestedRender]);
45
+ }, [actions, providers, adfDocument, isNestedRender, onLoadComplete]);
39
46
  };
@@ -4,7 +4,6 @@ import { updateWindowSelectionAroundDraft } from '../draft';
4
4
  import { FabricChannel } from '@atlaskit/analytics-listeners/types';
5
5
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
6
6
  import { RendererContext as ActionsContext } from '../../RendererActionsContext';
7
- import { ProvidersContext } from '../context';
8
7
  export const Mounter = /*#__PURE__*/React.memo(props => {
9
8
  const {
10
9
  component: Component,
@@ -22,8 +21,6 @@ export const Mounter = /*#__PURE__*/React.memo(props => {
22
21
  } = props;
23
22
  const [draftDocumentPosition, setDraftDocumentPosition] = useState();
24
23
  const actions = useContext(ActionsContext);
25
- const providers = useContext(ProvidersContext);
26
- const isCommentsOnMediaBugFixEnabled = Boolean(providers === null || providers === void 0 ? void 0 : providers.inlineComment.isCommentsOnMediaBugFixEnabled);
27
24
  const onCreateCallback = useCallback(annotationId => {
28
25
  if (!isAnnotationAllowed || !documentPosition || !applyAnnotation) {
29
26
  return false;
@@ -41,8 +38,8 @@ export const Mounter = /*#__PURE__*/React.memo(props => {
41
38
  eventType: EVENT_TYPE.TRACK
42
39
  }).fire(FabricChannel.editor);
43
40
  }
44
- return applyAnnotation(draftDocumentPosition || documentPosition, annotation, isCommentsOnMediaBugFixEnabled);
45
- }, [isAnnotationAllowed, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent, isCommentsOnMediaBugFixEnabled]);
41
+ return applyAnnotation(draftDocumentPosition || documentPosition, annotation);
42
+ }, [isAnnotationAllowed, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent]);
46
43
  const createIndexCallback = useCallback(() => {
47
44
  if (!documentPosition || !generateIndexMatch) {
48
45
  return false;
@@ -98,8 +95,8 @@ export const Mounter = /*#__PURE__*/React.memo(props => {
98
95
  annotationId: options.annotationId,
99
96
  annotationType: AnnotationTypes.INLINE_COMMENT
100
97
  };
101
- return applyAnnotation(positionToAnnotate, annotation, isCommentsOnMediaBugFixEnabled);
102
- }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, isCommentsOnMediaBugFixEnabled, actions, range]);
98
+ return applyAnnotation(positionToAnnotate, annotation);
99
+ }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, actions, range]);
103
100
  const removeDraftModeCallback = useCallback(() => {
104
101
  clearAnnotationDraft();
105
102
  setDraftDocumentPosition(null);
@@ -10,11 +10,13 @@ import { AnnotationRangeProvider } from './contexts/AnnotationRangeContext';
10
10
  import { AnnotationHoverContext } from './contexts/AnnotationHoverContext';
11
11
  const LoadAnnotations = /*#__PURE__*/React.memo(({
12
12
  adfDocument,
13
- isNestedRender
13
+ isNestedRender,
14
+ onLoadComplete
14
15
  }) => {
15
16
  useLoadAnnotations({
16
17
  adfDocument,
17
- isNestedRender
18
+ isNestedRender,
19
+ onLoadComplete
18
20
  });
19
21
  return null;
20
22
  });
@@ -25,7 +27,8 @@ export const AnnotationsWrapper = props => {
25
27
  annotationProvider,
26
28
  rendererRef,
27
29
  adfDocument,
28
- isNestedRender
30
+ isNestedRender,
31
+ onLoadComplete
29
32
  } = props;
30
33
  const updateSubscriber = annotationProvider && annotationProvider.inlineComment && annotationProvider.inlineComment.updateSubscriber;
31
34
  const inlineCommentAnnotationsState = useAnnotationStateByTypeEvent({
@@ -46,7 +49,8 @@ export const AnnotationsWrapper = props => {
46
49
  rendererRef: rendererRef
47
50
  }, /*#__PURE__*/React.createElement(LoadAnnotations, {
48
51
  adfDocument: adfDocument,
49
- isNestedRender: isNestedRender
52
+ isNestedRender: isNestedRender,
53
+ onLoadComplete: onLoadComplete
50
54
  }), /*#__PURE__*/React.createElement(AnnotationView, {
51
55
  createAnalyticsEvent: createAnalyticsEvent
52
56
  }), children)))));
@@ -6,7 +6,6 @@ import { FabricChannel } from '@atlaskit/analytics-listeners/types';
6
6
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
7
7
  import { getRendererRangeInlineNodeNames } from '../../../actions/get-renderer-range-inline-node-names';
8
8
  import { RendererContext as ActionsContext } from '../../RendererActionsContext';
9
- import { ProvidersContext } from '../context';
10
9
  export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
11
10
  const {
12
11
  component: Component,
@@ -24,8 +23,6 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
24
23
  } = props;
25
24
  const [draftDocumentPosition, setDraftDocumentPosition] = useState();
26
25
  const actions = useContext(ActionsContext);
27
- const providers = useContext(ProvidersContext);
28
- const isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
29
26
  const inlineNodeTypes = useMemo(() => {
30
27
  if (fg('annotations_defensive_node_name_calculations')) {
31
28
  if (!actions.isRangeAnnotatable(range)) {
@@ -77,8 +74,8 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
77
74
  eventType: EVENT_TYPE.TRACK
78
75
  }).fire(FabricChannel.editor);
79
76
  }
80
- return applyAnnotation(positionToAnnotate, annotation, isCommentsOnMediaBugFixEnabled);
81
- }, [actions, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent, isCommentsOnMediaBugFixEnabled, inlineNodeTypes]);
77
+ return applyAnnotation(positionToAnnotate, annotation);
78
+ }, [actions, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent, inlineNodeTypes]);
82
79
  const createIndexCallback = useCallback(() => {
83
80
  if (!documentPosition || !generateIndexMatch) {
84
81
  return false;
@@ -137,8 +134,8 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
137
134
  annotationId: options.annotationId,
138
135
  annotationType: AnnotationTypes.INLINE_COMMENT
139
136
  };
140
- return applyAnnotation(positionToAnnotate, annotation, isCommentsOnMediaBugFixEnabled);
141
- }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, isCommentsOnMediaBugFixEnabled, actions, range, inlineNodeTypes]);
137
+ return applyAnnotation(positionToAnnotate, annotation);
138
+ }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, actions, range, inlineNodeTypes]);
142
139
  const removeDraftModeCallback = useCallback(() => {
143
140
  clearAnnotationDraft();
144
141
  setDraftDocumentPosition(null);
@@ -274,7 +274,7 @@ var RendererActions = /*#__PURE__*/function () {
274
274
  }
275
275
  }, {
276
276
  key: "applyAnnotation",
277
- value: function applyAnnotation(pos, annotation, isCommentsOnMediaBugFixEnabled) {
277
+ value: function applyAnnotation(pos, annotation) {
278
278
  if (!this.doc || !pos || !this.schema) {
279
279
  return false;
280
280
  }
@@ -284,13 +284,10 @@ var RendererActions = /*#__PURE__*/function () {
284
284
  annotationType = annotation.annotationType;
285
285
  var step;
286
286
  var targetNodeType;
287
- var beforeNodePos = isCommentsOnMediaBugFixEnabled ?
287
+
288
288
  // As part of fix for RAP, `from` points to the position right before media node
289
289
  // hence, -1 is not needed
290
- from :
291
- // If from points to a node position,
292
- // we need to 1 position before it for nodeAt to return the node itself
293
- Math.max(from - 1, 0);
290
+ var beforeNodePos = from;
294
291
  var possibleNode = this.doc.nodeAt(beforeNodePos);
295
292
  if ((possibleNode === null || possibleNode === void 0 ? void 0 : possibleNode.type.name) === 'media') {
296
293
  targetNodeType = 'media';
@@ -333,7 +330,7 @@ var RendererActions = /*#__PURE__*/function () {
333
330
  numMatches: numMatches,
334
331
  matchIndex: matchIndex,
335
332
  pos: blockNodePos
336
- }, isCommentsOnMediaBugFixEnabled && {
333
+ }, {
337
334
  targetNodeType: targetNodeType
338
335
  });
339
336
  }
@@ -22,7 +22,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
22
22
  * @jsxFrag
23
23
  */
24
24
 
25
- import React, { PureComponent, Fragment, useEffect, useState, useMemo, useContext } from 'react';
25
+ import React, { PureComponent, Fragment, useEffect, useState, useMemo } from 'react';
26
26
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
27
27
  import { jsx, css } from '@emotion/react';
28
28
  import { AnalyticsContext } from '@atlaskit/analytics-next';
@@ -36,7 +36,7 @@ import { getEventHandler } from '../../../utils';
36
36
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, VIEW_METHOD } from '@atlaskit/editor-common/analytics';
37
37
  import { MODE, PLATFORM } from '../../../analytics/events';
38
38
  import AnnotationComponent from '../../marks/annotation';
39
- import { AnnotationsDraftContext, ProvidersContext } from '../../../ui/annotations/context';
39
+ import { AnnotationsDraftContext } from '../../../ui/annotations/context';
40
40
  import { CommentBadge as CommentBadgeComponent, CommentBadgeNext, ExternalImageBadge, MediaBadges } from '@atlaskit/editor-common/media-single';
41
41
  import { injectIntl } from 'react-intl-next';
42
42
  import { useInlineCommentSubscriberContext, useInlineCommentsFilter } from '../../../ui/annotations/hooks';
@@ -398,8 +398,6 @@ var Media = /*#__PURE__*/function (_PureComponent) {
398
398
  }(PureComponent);
399
399
  var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
400
400
  var draftPosition = React.useContext(AnnotationsDraftContext);
401
- var providers = useContext(ProvidersContext);
402
- var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
403
401
  var dataAttributes = props.dataAttributes;
404
402
  var pos = dataAttributes && dataAttributes['data-renderer-start-pos'];
405
403
  var _useState9 = useState(),
@@ -415,7 +413,7 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
415
413
  if (pos === undefined) {
416
414
  return;
417
415
  }
418
- var posToCheck = isCommentsOnMediaBugFixEnabled ? ((_draftPosition$from = draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from) !== null && _draftPosition$from !== void 0 ? _draftPosition$from : 0) + 1 : draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from;
416
+ var posToCheck = ((_draftPosition$from = draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from) !== null && _draftPosition$from !== void 0 ? _draftPosition$from : 0) + 1;
419
417
  if (draftPosition !== null && posToCheck === pos) {
420
418
  setShouldApplyDraftAnnotation(true);
421
419
  setPosition(posToCheck);
@@ -423,7 +421,7 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
423
421
  setShouldApplyDraftAnnotation(false);
424
422
  setPosition(undefined);
425
423
  }
426
- }, [draftPosition, pos, shouldApplyDraftAnnotation, isCommentsOnMediaBugFixEnabled]);
424
+ }, [draftPosition, pos, shouldApplyDraftAnnotation]);
427
425
  var applyDraftAnnotation = props.allowAnnotationsDraftMode && shouldApplyDraftAnnotation && position !== undefined;
428
426
  var dataAttributesWithDraftAnnotation = useMemo(function () {
429
427
  return applyDraftAnnotation ? _objectSpread(_objectSpread({}, dataAttributes), {}, {
@@ -55,7 +55,7 @@ import { nodeToReact } from '../../react/nodes';
55
55
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
56
56
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
57
57
  var packageName = "@atlaskit/renderer";
58
- var packageVersion = "111.0.0";
58
+ var packageVersion = "111.0.2";
59
59
  export var defaultNodeComponents = nodeToReact;
60
60
  export var Renderer = /*#__PURE__*/function (_PureComponent) {
61
61
  _inherits(Renderer, _PureComponent);
@@ -7,7 +7,8 @@ import { ProvidersContext } from '../context';
7
7
  import { RendererContext as ActionsContext } from '../../RendererActionsContext';
8
8
  export var useLoadAnnotations = function useLoadAnnotations(_ref) {
9
9
  var adfDocument = _ref.adfDocument,
10
- isNestedRender = _ref.isNestedRender;
10
+ isNestedRender = _ref.isNestedRender,
11
+ onLoadComplete = _ref.onLoadComplete;
11
12
  var actions = useContext(ActionsContext);
12
13
  var providers = useContext(ProvidersContext);
13
14
  useEffect(function () {
@@ -20,6 +21,9 @@ export var useLoadAnnotations = function useLoadAnnotations(_ref) {
20
21
  var annotations = actions.getAnnotationMarks();
21
22
  // we don't want to request integrators for state with an empty list of ids.
22
23
  if (!annotations.length) {
24
+ onLoadComplete && onLoadComplete({
25
+ numberOfUnresolvedInlineComments: 0
26
+ });
23
27
  return;
24
28
  }
25
29
  var ids = annotations.map(function (mark) {
@@ -33,7 +37,12 @@ export var useLoadAnnotations = function useLoadAnnotations(_ref) {
33
37
  return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, value.id, value));
34
38
  }, {});
35
39
  updateSubscriberInlineComment.emit(AnnotationUpdateEvent.SET_ANNOTATION_STATE, payload);
40
+ onLoadComplete && onLoadComplete({
41
+ numberOfUnresolvedInlineComments: data.filter(function (data) {
42
+ return data.state === 'active';
43
+ }).length
44
+ });
36
45
  };
37
46
  inlineCommentGetState(ids, isNestedRender).then(cb);
38
- }, [actions, providers, adfDocument, isNestedRender]);
47
+ }, [actions, providers, adfDocument, isNestedRender, onLoadComplete]);
39
48
  };
@@ -5,7 +5,6 @@ import { updateWindowSelectionAroundDraft } from '../draft';
5
5
  import { FabricChannel } from '@atlaskit/analytics-listeners/types';
6
6
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
7
7
  import { RendererContext as ActionsContext } from '../../RendererActionsContext';
8
- import { ProvidersContext } from '../context';
9
8
  export var Mounter = /*#__PURE__*/React.memo(function (props) {
10
9
  var Component = props.component,
11
10
  range = props.range,
@@ -24,8 +23,6 @@ export var Mounter = /*#__PURE__*/React.memo(function (props) {
24
23
  draftDocumentPosition = _useState2[0],
25
24
  setDraftDocumentPosition = _useState2[1];
26
25
  var actions = useContext(ActionsContext);
27
- var providers = useContext(ProvidersContext);
28
- var isCommentsOnMediaBugFixEnabled = Boolean(providers === null || providers === void 0 ? void 0 : providers.inlineComment.isCommentsOnMediaBugFixEnabled);
29
26
  var onCreateCallback = useCallback(function (annotationId) {
30
27
  if (!isAnnotationAllowed || !documentPosition || !applyAnnotation) {
31
28
  return false;
@@ -43,8 +40,8 @@ export var Mounter = /*#__PURE__*/React.memo(function (props) {
43
40
  eventType: EVENT_TYPE.TRACK
44
41
  }).fire(FabricChannel.editor);
45
42
  }
46
- return applyAnnotation(draftDocumentPosition || documentPosition, annotation, isCommentsOnMediaBugFixEnabled);
47
- }, [isAnnotationAllowed, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent, isCommentsOnMediaBugFixEnabled]);
43
+ return applyAnnotation(draftDocumentPosition || documentPosition, annotation);
44
+ }, [isAnnotationAllowed, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent]);
48
45
  var createIndexCallback = useCallback(function () {
49
46
  if (!documentPosition || !generateIndexMatch) {
50
47
  return false;
@@ -100,8 +97,8 @@ export var Mounter = /*#__PURE__*/React.memo(function (props) {
100
97
  annotationId: options.annotationId,
101
98
  annotationType: AnnotationTypes.INLINE_COMMENT
102
99
  };
103
- return applyAnnotation(positionToAnnotate, annotation, isCommentsOnMediaBugFixEnabled);
104
- }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, isCommentsOnMediaBugFixEnabled, actions, range]);
100
+ return applyAnnotation(positionToAnnotate, annotation);
101
+ }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, actions, range]);
105
102
  var removeDraftModeCallback = useCallback(function () {
106
103
  clearAnnotationDraft();
107
104
  setDraftDocumentPosition(null);
@@ -10,10 +10,12 @@ import { AnnotationRangeProvider } from './contexts/AnnotationRangeContext';
10
10
  import { AnnotationHoverContext } from './contexts/AnnotationHoverContext';
11
11
  var LoadAnnotations = /*#__PURE__*/React.memo(function (_ref) {
12
12
  var adfDocument = _ref.adfDocument,
13
- isNestedRender = _ref.isNestedRender;
13
+ isNestedRender = _ref.isNestedRender,
14
+ onLoadComplete = _ref.onLoadComplete;
14
15
  useLoadAnnotations({
15
16
  adfDocument: adfDocument,
16
- isNestedRender: isNestedRender
17
+ isNestedRender: isNestedRender,
18
+ onLoadComplete: onLoadComplete
17
19
  });
18
20
  return null;
19
21
  });
@@ -23,7 +25,8 @@ export var AnnotationsWrapper = function AnnotationsWrapper(props) {
23
25
  annotationProvider = props.annotationProvider,
24
26
  rendererRef = props.rendererRef,
25
27
  adfDocument = props.adfDocument,
26
- isNestedRender = props.isNestedRender;
28
+ isNestedRender = props.isNestedRender,
29
+ onLoadComplete = props.onLoadComplete;
27
30
  var updateSubscriber = annotationProvider && annotationProvider.inlineComment && annotationProvider.inlineComment.updateSubscriber;
28
31
  var inlineCommentAnnotationsState = useAnnotationStateByTypeEvent({
29
32
  type: AnnotationTypes.INLINE_COMMENT,
@@ -42,7 +45,8 @@ export var AnnotationsWrapper = function AnnotationsWrapper(props) {
42
45
  rendererRef: rendererRef
43
46
  }, /*#__PURE__*/React.createElement(LoadAnnotations, {
44
47
  adfDocument: adfDocument,
45
- isNestedRender: isNestedRender
48
+ isNestedRender: isNestedRender,
49
+ onLoadComplete: onLoadComplete
46
50
  }), /*#__PURE__*/React.createElement(AnnotationView, {
47
51
  createAnalyticsEvent: createAnalyticsEvent
48
52
  }), children)))));
@@ -7,7 +7,6 @@ import { FabricChannel } from '@atlaskit/analytics-listeners/types';
7
7
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
8
8
  import { getRendererRangeInlineNodeNames } from '../../../actions/get-renderer-range-inline-node-names';
9
9
  import { RendererContext as ActionsContext } from '../../RendererActionsContext';
10
- import { ProvidersContext } from '../context';
11
10
  export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (props) {
12
11
  var Component = props.component,
13
12
  range = props.range,
@@ -26,8 +25,6 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
26
25
  draftDocumentPosition = _useState2[0],
27
26
  setDraftDocumentPosition = _useState2[1];
28
27
  var actions = useContext(ActionsContext);
29
- var providers = useContext(ProvidersContext);
30
- var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
31
28
  var inlineNodeTypes = useMemo(function () {
32
29
  if (fg('annotations_defensive_node_name_calculations')) {
33
30
  if (!actions.isRangeAnnotatable(range)) {
@@ -79,8 +76,8 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
79
76
  eventType: EVENT_TYPE.TRACK
80
77
  }).fire(FabricChannel.editor);
81
78
  }
82
- return applyAnnotation(positionToAnnotate, annotation, isCommentsOnMediaBugFixEnabled);
83
- }, [actions, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent, isCommentsOnMediaBugFixEnabled, inlineNodeTypes]);
79
+ return applyAnnotation(positionToAnnotate, annotation);
80
+ }, [actions, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent, inlineNodeTypes]);
84
81
  var createIndexCallback = useCallback(function () {
85
82
  if (!documentPosition || !generateIndexMatch) {
86
83
  return false;
@@ -139,8 +136,8 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
139
136
  annotationId: options.annotationId,
140
137
  annotationType: AnnotationTypes.INLINE_COMMENT
141
138
  };
142
- return applyAnnotation(positionToAnnotate, annotation, isCommentsOnMediaBugFixEnabled);
143
- }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, isCommentsOnMediaBugFixEnabled, actions, range, inlineNodeTypes]);
139
+ return applyAnnotation(positionToAnnotate, annotation);
140
+ }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, actions, range, inlineNodeTypes]);
144
141
  var removeDraftModeCallback = useCallback(function () {
145
142
  clearAnnotationDraft();
146
143
  setDraftDocumentPosition(null);
@@ -22,7 +22,7 @@ interface RendererActionsOptions {
22
22
  deleteAnnotation: (annotationId: string, annotationType: 'inlineComment') => ActionResult;
23
23
  isValidAnnotationRange: (range: Range) => boolean;
24
24
  }
25
- export type ApplyAnnotation = (pos: Position, annotation: Annotation, isCommentsOnMediaBugFixEnabled?: boolean) => AnnotationActionResult;
25
+ export type ApplyAnnotation = (pos: Position, annotation: Annotation) => AnnotationActionResult;
26
26
  interface AnnotationsRendererActionsOptions {
27
27
  isValidAnnotationPosition: (pos: Position) => boolean;
28
28
  applyAnnotation: ApplyAnnotation;
@@ -65,7 +65,7 @@ export default class RendererActions implements RendererActionsOptions, Annotati
65
65
  getPositionFromRange(range: Range | null): Position | false;
66
66
  getAnnotationMarks(): Mark[];
67
67
  getAnnotationsByPosition(range: Range): string[];
68
- applyAnnotation(pos: Position, annotation: Annotation, isCommentsOnMediaBugFixEnabled?: boolean): AnnotationActionResult;
68
+ applyAnnotation(pos: Position, annotation: Annotation): AnnotationActionResult;
69
69
  generateAnnotationIndexMatch(pos: Position): AnnotationByMatches | false;
70
70
  getInlineNodeTypes(annotationId: string): string[] | undefined;
71
71
  }
@@ -2,6 +2,9 @@ import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
2
2
  type Props = {
3
3
  adfDocument: JSONDocNode;
4
4
  isNestedRender: boolean;
5
+ onLoadComplete?: ({ numberOfUnresolvedInlineComments, }: {
6
+ numberOfUnresolvedInlineComments: number;
7
+ }) => void;
5
8
  };
6
- export declare const useLoadAnnotations: ({ adfDocument, isNestedRender }: Props) => void;
9
+ export declare const useLoadAnnotations: ({ adfDocument, isNestedRender, onLoadComplete }: Props) => void;
7
10
  export {};
@@ -16,6 +16,9 @@ export type AnnotationsWrapperProps = React.PropsWithChildren<{
16
16
  annotationProvider: AnnotationProviders | null | undefined;
17
17
  rendererRef: React.RefObject<HTMLDivElement>;
18
18
  isNestedRender: boolean;
19
+ onLoadComplete?: ({ numberOfUnresolvedInlineComments, }: {
20
+ numberOfUnresolvedInlineComments: number;
21
+ }) => void;
19
22
  }>;
20
23
  export type TextPosition = {
21
24
  start: number;
@@ -22,7 +22,7 @@ interface RendererActionsOptions {
22
22
  deleteAnnotation: (annotationId: string, annotationType: 'inlineComment') => ActionResult;
23
23
  isValidAnnotationRange: (range: Range) => boolean;
24
24
  }
25
- export type ApplyAnnotation = (pos: Position, annotation: Annotation, isCommentsOnMediaBugFixEnabled?: boolean) => AnnotationActionResult;
25
+ export type ApplyAnnotation = (pos: Position, annotation: Annotation) => AnnotationActionResult;
26
26
  interface AnnotationsRendererActionsOptions {
27
27
  isValidAnnotationPosition: (pos: Position) => boolean;
28
28
  applyAnnotation: ApplyAnnotation;
@@ -65,7 +65,7 @@ export default class RendererActions implements RendererActionsOptions, Annotati
65
65
  getPositionFromRange(range: Range | null): Position | false;
66
66
  getAnnotationMarks(): Mark[];
67
67
  getAnnotationsByPosition(range: Range): string[];
68
- applyAnnotation(pos: Position, annotation: Annotation, isCommentsOnMediaBugFixEnabled?: boolean): AnnotationActionResult;
68
+ applyAnnotation(pos: Position, annotation: Annotation): AnnotationActionResult;
69
69
  generateAnnotationIndexMatch(pos: Position): AnnotationByMatches | false;
70
70
  getInlineNodeTypes(annotationId: string): string[] | undefined;
71
71
  }
@@ -2,6 +2,9 @@ import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
2
2
  type Props = {
3
3
  adfDocument: JSONDocNode;
4
4
  isNestedRender: boolean;
5
+ onLoadComplete?: ({ numberOfUnresolvedInlineComments, }: {
6
+ numberOfUnresolvedInlineComments: number;
7
+ }) => void;
5
8
  };
6
- export declare const useLoadAnnotations: ({ adfDocument, isNestedRender }: Props) => void;
9
+ export declare const useLoadAnnotations: ({ adfDocument, isNestedRender, onLoadComplete }: Props) => void;
7
10
  export {};
@@ -16,6 +16,9 @@ export type AnnotationsWrapperProps = React.PropsWithChildren<{
16
16
  annotationProvider: AnnotationProviders | null | undefined;
17
17
  rendererRef: React.RefObject<HTMLDivElement>;
18
18
  isNestedRender: boolean;
19
+ onLoadComplete?: ({ numberOfUnresolvedInlineComments, }: {
20
+ numberOfUnresolvedInlineComments: number;
21
+ }) => void;
19
22
  }>;
20
23
  export type TextPosition = {
21
24
  start: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "111.0.0",
3
+ "version": "111.0.2",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,15 +29,15 @@
29
29
  "@atlaskit/analytics-next": "^10.1.0",
30
30
  "@atlaskit/button": "^20.2.0",
31
31
  "@atlaskit/code": "^15.6.0",
32
- "@atlaskit/editor-common": "^92.0.0",
32
+ "@atlaskit/editor-common": "^92.1.0",
33
33
  "@atlaskit/editor-json-transformer": "^8.18.0",
34
34
  "@atlaskit/editor-palette": "1.6.1",
35
35
  "@atlaskit/editor-prosemirror": "6.0.0",
36
36
  "@atlaskit/editor-shared-styles": "^3.0.0",
37
37
  "@atlaskit/emoji": "^67.8.0",
38
38
  "@atlaskit/feature-gate-js-client": "^4.19.0",
39
- "@atlaskit/icon": "^22.19.0",
40
- "@atlaskit/link-datasource": "^3.1.0",
39
+ "@atlaskit/icon": "^22.20.0",
40
+ "@atlaskit/link-datasource": "^3.2.0",
41
41
  "@atlaskit/media-card": "^78.5.0",
42
42
  "@atlaskit/media-client": "^28.0.0",
43
43
  "@atlaskit/media-client-react": "^2.2.0",