@atlaskit/editor-plugin-annotation 26.0.1 → 26.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 26.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`0b815dd6718ea`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0b815dd6718ea) -
8
+ When cc_maui_annotations_on_extensions is off, prevent saved Remix chart comments from showing
9
+ yellow text highlights or opening automatically when editor selection moves beside the chart. Keep
10
+ annotation marks in the document and preserve explicit comment navigation. Creation-experiment
11
+ behavior, media comments, and other extensions are unchanged.
12
+ - Updated dependencies
13
+
3
14
  ## 26.0.1
4
15
 
5
16
  ### Patch Changes
@@ -467,6 +467,10 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
467
467
  // everytime we need to update the decorations. This handler will be called alot. We should be caching
468
468
  // the decorations in plugin state and only updating them when required.
469
469
  state.doc.descendants(function (node, pos) {
470
+ // Do not render saved chart marks as text highlights when annotation support is off.
471
+ if ((0, _utils3.shouldHideRemixAnnotation)(node)) {
472
+ return false;
473
+ }
470
474
  // Inline comment on mediaInline is not supported as part of comments on media project
471
475
  // Thus, we skip the decoration for mediaInline node
472
476
  if (node.type.name === 'mediaInline') {
@@ -12,7 +12,7 @@ exports.hasInvalidNodes = exports.hasAnyUnResolvedAnnotationInPage = void 0;
12
12
  exports.hasInvalidWhitespaceNode = hasInvalidWhitespaceNode;
13
13
  exports.isBlockNodeAnnotationsSelected = exports.inlineCommentPluginKey = void 0;
14
14
  exports.isSelectedAnnotationsChanged = isSelectedAnnotationsChanged;
15
- exports.resolveDraftBookmark = exports.isSupportedBlockNode = exports.isSelectionValid = void 0;
15
+ exports.shouldHideRemixAnnotation = exports.resolveDraftBookmark = exports.isSupportedBlockNode = exports.isSelectionValid = void 0;
16
16
  exports.stripNonExistingAnnotations = stripNonExistingAnnotations;
17
17
  exports.surroundingMarks = void 0;
18
18
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
@@ -145,6 +145,11 @@ var getAnnotationViewKey = exports.getAnnotationViewKey = function getAnnotation
145
145
  }).join('_');
146
146
  return "view-annotation-wrapper_".concat(keys);
147
147
  };
148
+
149
+ // During rollback, hide chart highlights and automatic comment opening, not saved marks.
150
+ var shouldHideRemixAnnotation = exports.shouldHideRemixAnnotation = function shouldHideRemixAnnotation(node) {
151
+ return node.type.name === 'extension' && node.attrs.extensionKey === 'native-embed:maui' && !(0, _fg.fg)('cc_maui_annotations_on_extensions');
152
+ };
148
153
  var findAnnotationsInSelection = exports.findAnnotationsInSelection = function findAnnotationsInSelection(selection, doc) {
149
154
  var empty = selection.empty,
150
155
  $anchor = selection.$anchor,
@@ -175,12 +180,12 @@ var findAnnotationsInSelection = exports.findAnnotationsInSelection = function f
175
180
  return [];
176
181
  }
177
182
  var annotationMark = doc.type.schema.marks.annotation;
178
- var anchorAnnotationMarks = (node === null || node === void 0 ? void 0 : node.marks) || [];
183
+ var anchorAnnotationMarks = node && !shouldHideRemixAnnotation(node) ? node.marks : [];
179
184
  var marks = [];
180
185
  if (annotationMark.isInSet(anchorAnnotationMarks)) {
181
186
  marks = anchorAnnotationMarks;
182
187
  }
183
- if (nodeBefore && annotationMark.isInSet(nodeBefore.marks)) {
188
+ if (nodeBefore && !shouldHideRemixAnnotation(nodeBefore) && annotationMark.isInSet(nodeBefore.marks)) {
184
189
  var _marks;
185
190
  var existingMarkIds = marks.map(function (m) {
186
191
  return m.attrs.id;
@@ -478,6 +483,9 @@ function isSelectedAnnotationsChanged(oldSelectedAnnotations, newSelectedAnnotat
478
483
  var isBlockNodeAnnotationsSelected = exports.isBlockNodeAnnotationsSelected = function isBlockNodeAnnotationsSelected(selection) {
479
484
  var selectedAnnotations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
480
485
  if (selectedAnnotations.length && selection instanceof _state.NodeSelection) {
486
+ if (shouldHideRemixAnnotation(selection.node)) {
487
+ return false;
488
+ }
481
489
  var node = selection.node.type.name === 'mediaSingle' ? selection.node.firstChild : selection.node;
482
490
  var annotationMarks = (node === null || node === void 0 ? void 0 : node.marks.filter(function (mark) {
483
491
  return mark.type.name === 'annotation';
@@ -10,7 +10,7 @@ import { getAnnotationViewClassname, getBlockAnnotationViewClassname } from '../
10
10
  import { allowAnnotation, applyDraft, clearDraft, clearAnnotation, getDraft, setIsAnnotationHovered, setIsAnnotationSelected, startDraft } from './annotation-manager-hooks';
11
11
  import { createPluginState } from './plugin-factory';
12
12
  import { shouldSuppressFloatingToolbar } from './toolbar';
13
- import { decorationKey, getAllAnnotations, getPluginState, inlineCommentPluginKey, isSupportedBlockNode } from './utils';
13
+ import { decorationKey, getAllAnnotations, getPluginState, inlineCommentPluginKey, isSupportedBlockNode, shouldHideRemixAnnotation } from './utils';
14
14
  const fetchProviderStates = async (provider, annotationIds) => {
15
15
  if (!provider || !provider.getState) {
16
16
  return {};
@@ -409,6 +409,10 @@ export const inlineCommentPlugin = options => {
409
409
  // everytime we need to update the decorations. This handler will be called alot. We should be caching
410
410
  // the decorations in plugin state and only updating them when required.
411
411
  state.doc.descendants((node, pos) => {
412
+ // Do not render saved chart marks as text highlights when annotation support is off.
413
+ if (shouldHideRemixAnnotation(node)) {
414
+ return false;
415
+ }
412
416
  // Inline comment on mediaInline is not supported as part of comments on media project
413
417
  // Thus, we skip the decoration for mediaInline node
414
418
  if (node.type.name === 'mediaInline') {
@@ -113,6 +113,9 @@ export const getAnnotationViewKey = annotations => {
113
113
  const keys = annotations.map(mark => mark.id).join('_');
114
114
  return `view-annotation-wrapper_${keys}`;
115
115
  };
116
+
117
+ // During rollback, hide chart highlights and automatic comment opening, not saved marks.
118
+ export const shouldHideRemixAnnotation = node => node.type.name === 'extension' && node.attrs.extensionKey === 'native-embed:maui' && !fg('cc_maui_annotations_on_extensions');
116
119
  export const findAnnotationsInSelection = (selection, doc) => {
117
120
  const {
118
121
  empty,
@@ -143,12 +146,12 @@ export const findAnnotationsInSelection = (selection, doc) => {
143
146
  return [];
144
147
  }
145
148
  const annotationMark = doc.type.schema.marks.annotation;
146
- const anchorAnnotationMarks = (node === null || node === void 0 ? void 0 : node.marks) || [];
149
+ const anchorAnnotationMarks = node && !shouldHideRemixAnnotation(node) ? node.marks : [];
147
150
  let marks = [];
148
151
  if (annotationMark.isInSet(anchorAnnotationMarks)) {
149
152
  marks = anchorAnnotationMarks;
150
153
  }
151
- if (nodeBefore && annotationMark.isInSet(nodeBefore.marks)) {
154
+ if (nodeBefore && !shouldHideRemixAnnotation(nodeBefore) && annotationMark.isInSet(nodeBefore.marks)) {
152
155
  const existingMarkIds = marks.map(m => m.attrs.id);
153
156
  marks = marks.concat(...nodeBefore.marks.filter(m => !existingMarkIds.includes(m.attrs.id)));
154
157
  }
@@ -437,6 +440,9 @@ export function isSelectedAnnotationsChanged(oldSelectedAnnotations, newSelected
437
440
  */
438
441
  export const isBlockNodeAnnotationsSelected = (selection, selectedAnnotations = []) => {
439
442
  if (selectedAnnotations.length && selection instanceof NodeSelection) {
443
+ if (shouldHideRemixAnnotation(selection.node)) {
444
+ return false;
445
+ }
440
446
  const node = selection.node.type.name === 'mediaSingle' ? selection.node.firstChild : selection.node;
441
447
  const annotationMarks = (node === null || node === void 0 ? void 0 : node.marks.filter(mark => mark.type.name === 'annotation').map(mark => ({
442
448
  id: mark.attrs.id,
@@ -13,7 +13,7 @@ import { getAnnotationViewClassname, getBlockAnnotationViewClassname } from '../
13
13
  import { allowAnnotation, applyDraft, clearDraft, clearAnnotation, getDraft, setIsAnnotationHovered, setIsAnnotationSelected, startDraft } from './annotation-manager-hooks';
14
14
  import { createPluginState } from './plugin-factory';
15
15
  import { shouldSuppressFloatingToolbar } from './toolbar';
16
- import { decorationKey, getAllAnnotations, getPluginState, inlineCommentPluginKey, isSupportedBlockNode } from './utils';
16
+ import { decorationKey, getAllAnnotations, getPluginState, inlineCommentPluginKey, isSupportedBlockNode, shouldHideRemixAnnotation } from './utils';
17
17
  var fetchProviderStates = /*#__PURE__*/function () {
18
18
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(provider, annotationIds) {
19
19
  var data, result;
@@ -460,6 +460,10 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
460
460
  // everytime we need to update the decorations. This handler will be called alot. We should be caching
461
461
  // the decorations in plugin state and only updating them when required.
462
462
  state.doc.descendants(function (node, pos) {
463
+ // Do not render saved chart marks as text highlights when annotation support is off.
464
+ if (shouldHideRemixAnnotation(node)) {
465
+ return false;
466
+ }
463
467
  // Inline comment on mediaInline is not supported as part of comments on media project
464
468
  // Thus, we skip the decoration for mediaInline node
465
469
  if (node.type.name === 'mediaInline') {
@@ -128,6 +128,11 @@ export var getAnnotationViewKey = function getAnnotationViewKey(annotations) {
128
128
  }).join('_');
129
129
  return "view-annotation-wrapper_".concat(keys);
130
130
  };
131
+
132
+ // During rollback, hide chart highlights and automatic comment opening, not saved marks.
133
+ export var shouldHideRemixAnnotation = function shouldHideRemixAnnotation(node) {
134
+ return node.type.name === 'extension' && node.attrs.extensionKey === 'native-embed:maui' && !fg('cc_maui_annotations_on_extensions');
135
+ };
131
136
  export var findAnnotationsInSelection = function findAnnotationsInSelection(selection, doc) {
132
137
  var empty = selection.empty,
133
138
  $anchor = selection.$anchor,
@@ -158,12 +163,12 @@ export var findAnnotationsInSelection = function findAnnotationsInSelection(sele
158
163
  return [];
159
164
  }
160
165
  var annotationMark = doc.type.schema.marks.annotation;
161
- var anchorAnnotationMarks = (node === null || node === void 0 ? void 0 : node.marks) || [];
166
+ var anchorAnnotationMarks = node && !shouldHideRemixAnnotation(node) ? node.marks : [];
162
167
  var marks = [];
163
168
  if (annotationMark.isInSet(anchorAnnotationMarks)) {
164
169
  marks = anchorAnnotationMarks;
165
170
  }
166
- if (nodeBefore && annotationMark.isInSet(nodeBefore.marks)) {
171
+ if (nodeBefore && !shouldHideRemixAnnotation(nodeBefore) && annotationMark.isInSet(nodeBefore.marks)) {
167
172
  var _marks;
168
173
  var existingMarkIds = marks.map(function (m) {
169
174
  return m.attrs.id;
@@ -461,6 +466,9 @@ export function isSelectedAnnotationsChanged(oldSelectedAnnotations, newSelected
461
466
  export var isBlockNodeAnnotationsSelected = function isBlockNodeAnnotationsSelected(selection) {
462
467
  var selectedAnnotations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
463
468
  if (selectedAnnotations.length && selection instanceof NodeSelection) {
469
+ if (shouldHideRemixAnnotation(selection.node)) {
470
+ return false;
471
+ }
464
472
  var node = selection.node.type.name === 'mediaSingle' ? selection.node.firstChild : selection.node;
465
473
  var annotationMarks = (node === null || node === void 0 ? void 0 : node.marks.filter(function (mark) {
466
474
  return mark.type.name === 'annotation';
@@ -18,6 +18,7 @@ export declare const decorationKey: {
18
18
  };
19
19
  export declare const addDraftDecoration: (start: number, end: number, targetType?: TargetType) => Decoration;
20
20
  export declare const getAnnotationViewKey: (annotations: AnnotationInfo[]) => string;
21
+ export declare const shouldHideRemixAnnotation: (node: Node) => boolean;
21
22
  export declare const findAnnotationsInSelection: (selection: Selection, doc: Node) => AnnotationInfo[];
22
23
  export declare const resolveDraftBookmark: (editorState: EditorState, bookmark?: SelectionBookmark, supportedBlockNodes?: string[], isBlockNodeSupported?: InlineCommentAnnotationProvider['isBlockNodeSupported']) => DraftBookmark;
23
24
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "26.0.1",
3
+ "version": "26.0.2",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,11 +31,11 @@
31
31
  "@atlaskit/editor-toolbar-model": "^1.2.0",
32
32
  "@atlaskit/icon": "^38.0.0",
33
33
  "@atlaskit/platform-feature-flags": "^2.2.0",
34
- "@atlaskit/tmp-editor-statsig": "^228.0.0",
34
+ "@atlaskit/tmp-editor-statsig": "^229.0.0",
35
35
  "@babel/runtime": "^7.0.0"
36
36
  },
37
37
  "peerDependencies": {
38
- "@atlaskit/editor-common": "^130.1.0",
38
+ "@atlaskit/editor-common": "^130.3.0",
39
39
  "react": "^18.2.0 || ^19.2.0",
40
40
  "react-dom": "^18.2.0 || ^19.2.0",
41
41
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"