@atlaskit/editor-plugin-annotation 1.26.9 → 1.26.10

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 1.26.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#99608](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99608)
8
+ [`18ad3efa3ef3a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/18ad3efa3ef3a) -
9
+ [ux] Updating the annotation ID list to empty when the page has no annotations
10
+
3
11
  ## 1.26.9
4
12
 
5
13
  ### Patch Changes
@@ -23,9 +23,15 @@ var fetchProviderStates = /*#__PURE__*/function () {
23
23
  return _regenerator.default.wrap(function _callee$(_context) {
24
24
  while (1) switch (_context.prev = _context.next) {
25
25
  case 0:
26
- _context.next = 2;
27
- return provider.getState(annotationIds);
26
+ if (!((!provider || !provider.getState) && (0, _platformFeatureFlags.fg)('use_comments_data_annotation_updater'))) {
27
+ _context.next = 2;
28
+ break;
29
+ }
30
+ return _context.abrupt("return", {});
28
31
  case 2:
32
+ _context.next = 4;
33
+ return provider.getState(annotationIds);
34
+ case 4:
29
35
  data = _context.sent;
30
36
  result = {};
31
37
  data.forEach(function (annotation) {
@@ -34,7 +40,7 @@ var fetchProviderStates = /*#__PURE__*/function () {
34
40
  }
35
41
  });
36
42
  return _context.abrupt("return", result);
37
- case 6:
43
+ case 8:
38
44
  case "end":
39
45
  return _context.stop();
40
46
  }
@@ -53,7 +59,7 @@ var fetchState = /*#__PURE__*/function () {
53
59
  return _regenerator.default.wrap(function _callee2$(_context2) {
54
60
  while (1) switch (_context2.prev = _context2.next) {
55
61
  case 0:
56
- if (!(!annotationIds || !annotationIds.length)) {
62
+ if (!((!annotationIds || !annotationIds.length) && !(0, _platformFeatureFlags.fg)('use_comments_data_annotation_updater'))) {
57
63
  _context2.next = 2;
58
64
  break;
59
65
  }
@@ -63,10 +69,16 @@ var fetchState = /*#__PURE__*/function () {
63
69
  return fetchProviderStates(provider, annotationIds);
64
70
  case 4:
65
71
  inlineCommentStates = _context2.sent;
72
+ if (!(Object.keys(inlineCommentStates).length === 0 && (0, _platformFeatureFlags.fg)('use_comments_data_annotation_updater'))) {
73
+ _context2.next = 7;
74
+ break;
75
+ }
76
+ return _context2.abrupt("return");
77
+ case 7:
66
78
  if (editorView.dispatch) {
67
79
  (0, _editorCommands.updateInlineCommentResolvedState)(editorAnalyticsAPI)(inlineCommentStates)(editorView.state, editorView.dispatch);
68
80
  }
69
- case 6:
81
+ case 8:
70
82
  case "end":
71
83
  return _context2.stop();
72
84
  }
@@ -8,6 +8,9 @@ import { AnnotationNodeView, getAnnotationViewClassname, getBlockAnnotationViewC
8
8
  import { createPluginState } from './plugin-factory';
9
9
  import { decorationKey, getAllAnnotations, getPluginState, inlineCommentPluginKey } from './utils';
10
10
  const fetchProviderStates = async (provider, annotationIds) => {
11
+ if ((!provider || !provider.getState) && fg('use_comments_data_annotation_updater')) {
12
+ return {};
13
+ }
11
14
  const data = await provider.getState(annotationIds);
12
15
  const result = {};
13
16
  data.forEach(annotation => {
@@ -21,10 +24,13 @@ const fetchProviderStates = async (provider, annotationIds) => {
21
24
  // fetchState is unable to return a command as it's runs async and may dispatch at a later time
22
25
  // Requires `editorView` instead of the decomposition as the async means state may end up stale
23
26
  const fetchState = async (provider, annotationIds, editorView, editorAnalyticsAPI) => {
24
- if (!annotationIds || !annotationIds.length) {
27
+ if ((!annotationIds || !annotationIds.length) && !fg('use_comments_data_annotation_updater')) {
25
28
  return;
26
29
  }
27
30
  const inlineCommentStates = await fetchProviderStates(provider, annotationIds);
31
+ if (Object.keys(inlineCommentStates).length === 0 && fg('use_comments_data_annotation_updater')) {
32
+ return;
33
+ }
28
34
  if (editorView.dispatch) {
29
35
  updateInlineCommentResolvedState(editorAnalyticsAPI)(inlineCommentStates)(editorView.state, editorView.dispatch);
30
36
  }
@@ -16,9 +16,15 @@ var fetchProviderStates = /*#__PURE__*/function () {
16
16
  return _regeneratorRuntime.wrap(function _callee$(_context) {
17
17
  while (1) switch (_context.prev = _context.next) {
18
18
  case 0:
19
- _context.next = 2;
20
- return provider.getState(annotationIds);
19
+ if (!((!provider || !provider.getState) && fg('use_comments_data_annotation_updater'))) {
20
+ _context.next = 2;
21
+ break;
22
+ }
23
+ return _context.abrupt("return", {});
21
24
  case 2:
25
+ _context.next = 4;
26
+ return provider.getState(annotationIds);
27
+ case 4:
22
28
  data = _context.sent;
23
29
  result = {};
24
30
  data.forEach(function (annotation) {
@@ -27,7 +33,7 @@ var fetchProviderStates = /*#__PURE__*/function () {
27
33
  }
28
34
  });
29
35
  return _context.abrupt("return", result);
30
- case 6:
36
+ case 8:
31
37
  case "end":
32
38
  return _context.stop();
33
39
  }
@@ -46,7 +52,7 @@ var fetchState = /*#__PURE__*/function () {
46
52
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
47
53
  while (1) switch (_context2.prev = _context2.next) {
48
54
  case 0:
49
- if (!(!annotationIds || !annotationIds.length)) {
55
+ if (!((!annotationIds || !annotationIds.length) && !fg('use_comments_data_annotation_updater'))) {
50
56
  _context2.next = 2;
51
57
  break;
52
58
  }
@@ -56,10 +62,16 @@ var fetchState = /*#__PURE__*/function () {
56
62
  return fetchProviderStates(provider, annotationIds);
57
63
  case 4:
58
64
  inlineCommentStates = _context2.sent;
65
+ if (!(Object.keys(inlineCommentStates).length === 0 && fg('use_comments_data_annotation_updater'))) {
66
+ _context2.next = 7;
67
+ break;
68
+ }
69
+ return _context2.abrupt("return");
70
+ case 7:
59
71
  if (editorView.dispatch) {
60
72
  updateInlineCommentResolvedState(editorAnalyticsAPI)(inlineCommentStates)(editorView.state, editorView.dispatch);
61
73
  }
62
- case 6:
74
+ case 8:
63
75
  case "end":
64
76
  return _context2.stop();
65
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "1.26.9",
3
+ "version": "1.26.10",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -99,6 +99,9 @@
99
99
  },
100
100
  "platform_inline_node_as_valid_annotation_selection": {
101
101
  "type": "boolean"
102
+ },
103
+ "use_comments_data_annotation_updater": {
104
+ "type": "boolean"
102
105
  }
103
106
  }
104
107
  }