@atlaskit/editor-plugin-annotation 24.0.4 → 25.0.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 CHANGED
@@ -1,5 +1,33 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 25.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 24.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`950fcabdaee51`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/950fcabdaee51) -
14
+ Show comment markers for eligible Remix extension nodes in the editor behind
15
+ `cc_maui_annotations_on_extensions`. Highlight an open draft or selected unresolved thread, open
16
+ existing comments from the marker, and preserve the embedded iframe and unsaved drafts when
17
+ switching threads.
18
+
19
+ Render each badge from its extension node view, using its node and current position instead of
20
+ scanning the document. Both standard and referentiality extension node views render the shared
21
+ badge directly, using annotation state and logic-only actions. Expose the reusable badge container
22
+ as BlockNodeBadges, retaining MediaBadges as a compatibility wrapper for existing media consumers.
23
+
24
+ Preserve the existing Emotion styling for the shared badge container; defer its Compiled migration
25
+ with a file-scoped ratcheting exception.
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies
30
+
3
31
  ## 24.0.4
4
32
 
5
33
  ### Patch Changes
@@ -12,6 +12,7 @@ var _react = _interopRequireDefault(require("react"));
12
12
  var _annotation = require("@atlaskit/adf-schema/annotation");
13
13
  var _coreUtils = require("@atlaskit/editor-common/core-utils");
14
14
  var _hooks = require("@atlaskit/editor-common/hooks");
15
+ var _fg = require("@atlaskit/platform-feature-flags/fg");
15
16
  var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
16
17
  var _editorCommands = require("./editor-commands");
17
18
  var _annotationMark = require("./nodeviews/annotationMark");
@@ -92,6 +93,10 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
92
93
  }];
93
94
  },
94
95
  actions: {
96
+ isBlockNodeSupported: function isBlockNodeSupported(node) {
97
+ var _annotationProviders$, _annotationProviders$2;
98
+ return (0, _fg.fg)('cc_maui_annotations_on_extensions') && (annotationProviders === null || annotationProviders === void 0 || (_annotationProviders$ = (_annotationProviders$2 = annotationProviders.inlineComment).isBlockNodeSupported) === null || _annotationProviders$ === void 0 ? void 0 : _annotationProviders$.call(_annotationProviders$2, node)) === true;
99
+ },
95
100
  hasAnyUnResolvedAnnotationInPage: _utils.hasAnyUnResolvedAnnotationInPage,
96
101
  requestCloseInlineComment: requestCloseInlineComment,
97
102
  stripNonExistingAnnotations: _utils.stripNonExistingAnnotations,
@@ -100,8 +105,8 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
100
105
  return (0, _editorCommands.createAnnotation)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)(annotationId, _annotation.AnnotationTypes.INLINE_COMMENT, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported);
101
106
  },
102
107
  removeInlineCommentAnnotation: function removeInlineCommentAnnotation(annotationId) {
103
- var _api$analytics2, _annotationProviders$;
104
- return (0, _editorCommands.removeInlineCommentFromDoc)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(annotationId, (_annotationProviders$ = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes) !== null && _annotationProviders$ !== void 0 ? _annotationProviders$ : [], annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported);
108
+ var _api$analytics2, _annotationProviders$3;
109
+ return (0, _editorCommands.removeInlineCommentFromDoc)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(annotationId, (_annotationProviders$3 = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes) !== null && _annotationProviders$3 !== void 0 ? _annotationProviders$3 : [], annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported);
105
110
  },
106
111
  setInlineCommentDraftState: (0, _editorCommands.setInlineCommentDraftState)(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, undefined, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported),
107
112
  showCommentForBlockNode: (0, _editorCommands.showInlineCommentForBlockNode)(annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported),
@@ -168,11 +173,11 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
168
173
  var pluginState = (0, _utils.getPluginState)(state);
169
174
  if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
170
175
  var _api$analytics5;
171
- var _annotationProviders$2 = annotationProviders.inlineComment,
172
- isToolbarAbove = _annotationProviders$2.isToolbarAbove,
173
- onCommentButtonMount = _annotationProviders$2.onCommentButtonMount,
174
- getCanAddComments = _annotationProviders$2.getCanAddComments,
175
- contentType = _annotationProviders$2.contentType;
176
+ var _annotationProviders$4 = annotationProviders.inlineComment,
177
+ isToolbarAbove = _annotationProviders$4.isToolbarAbove,
178
+ onCommentButtonMount = _annotationProviders$4.onCommentButtonMount,
179
+ getCanAddComments = _annotationProviders$4.getCanAddComments,
180
+ contentType = _annotationProviders$4.contentType;
176
181
  var toolbarConfig = (0, _toolbar.buildToolbar)(api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions)({
177
182
  state: state,
178
183
  intl: intl,
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { AnnotationTypes } from '@atlaskit/adf-schema/annotation';
3
3
  import { isSSR } from '@atlaskit/editor-common/core-utils';
4
4
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
5
6
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
6
7
  import { createAnnotation, removeInlineCommentFromDoc, setInlineCommentDraftState, setSelectedAnnotation, setPendingSelectedAnnotation, showInlineCommentForBlockNode } from './editor-commands';
7
8
  import { annotationWithToDOMFix } from './nodeviews/annotationMark';
@@ -60,6 +61,10 @@ export const annotationPlugin = ({
60
61
  }];
61
62
  },
62
63
  actions: {
64
+ isBlockNodeSupported: node => {
65
+ var _annotationProviders$, _annotationProviders$2;
66
+ return fg('cc_maui_annotations_on_extensions') && (annotationProviders === null || annotationProviders === void 0 ? void 0 : (_annotationProviders$ = (_annotationProviders$2 = annotationProviders.inlineComment).isBlockNodeSupported) === null || _annotationProviders$ === void 0 ? void 0 : _annotationProviders$.call(_annotationProviders$2, node)) === true;
67
+ },
63
68
  hasAnyUnResolvedAnnotationInPage,
64
69
  requestCloseInlineComment,
65
70
  stripNonExistingAnnotations,
@@ -68,8 +73,8 @@ export const annotationPlugin = ({
68
73
  return createAnnotation(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)(annotationId, AnnotationTypes.INLINE_COMMENT, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported);
69
74
  },
70
75
  removeInlineCommentAnnotation: annotationId => {
71
- var _api$analytics2, _annotationProviders$;
72
- return removeInlineCommentFromDoc(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(annotationId, (_annotationProviders$ = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes) !== null && _annotationProviders$ !== void 0 ? _annotationProviders$ : [], annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported);
76
+ var _api$analytics2, _annotationProviders$3;
77
+ return removeInlineCommentFromDoc(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(annotationId, (_annotationProviders$3 = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes) !== null && _annotationProviders$3 !== void 0 ? _annotationProviders$3 : [], annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported);
73
78
  },
74
79
  setInlineCommentDraftState: setInlineCommentDraftState(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, undefined, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported),
75
80
  showCommentForBlockNode: showInlineCommentForBlockNode(annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported),
@@ -7,6 +7,7 @@ import React from 'react';
7
7
  import { AnnotationTypes } from '@atlaskit/adf-schema/annotation';
8
8
  import { isSSR } from '@atlaskit/editor-common/core-utils';
9
9
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
10
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
10
11
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
11
12
  import { createAnnotation, removeInlineCommentFromDoc, setInlineCommentDraftState, setSelectedAnnotation, setPendingSelectedAnnotation, showInlineCommentForBlockNode } from './editor-commands';
12
13
  import { annotationWithToDOMFix } from './nodeviews/annotationMark';
@@ -85,6 +86,10 @@ export var annotationPlugin = function annotationPlugin(_ref) {
85
86
  }];
86
87
  },
87
88
  actions: {
89
+ isBlockNodeSupported: function isBlockNodeSupported(node) {
90
+ var _annotationProviders$, _annotationProviders$2;
91
+ return fg('cc_maui_annotations_on_extensions') && (annotationProviders === null || annotationProviders === void 0 || (_annotationProviders$ = (_annotationProviders$2 = annotationProviders.inlineComment).isBlockNodeSupported) === null || _annotationProviders$ === void 0 ? void 0 : _annotationProviders$.call(_annotationProviders$2, node)) === true;
92
+ },
88
93
  hasAnyUnResolvedAnnotationInPage: hasAnyUnResolvedAnnotationInPage,
89
94
  requestCloseInlineComment: requestCloseInlineComment,
90
95
  stripNonExistingAnnotations: stripNonExistingAnnotations,
@@ -93,8 +98,8 @@ export var annotationPlugin = function annotationPlugin(_ref) {
93
98
  return createAnnotation(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)(annotationId, AnnotationTypes.INLINE_COMMENT, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported);
94
99
  },
95
100
  removeInlineCommentAnnotation: function removeInlineCommentAnnotation(annotationId) {
96
- var _api$analytics2, _annotationProviders$;
97
- return removeInlineCommentFromDoc(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(annotationId, (_annotationProviders$ = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes) !== null && _annotationProviders$ !== void 0 ? _annotationProviders$ : [], annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported);
101
+ var _api$analytics2, _annotationProviders$3;
102
+ return removeInlineCommentFromDoc(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(annotationId, (_annotationProviders$3 = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes) !== null && _annotationProviders$3 !== void 0 ? _annotationProviders$3 : [], annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported);
98
103
  },
99
104
  setInlineCommentDraftState: setInlineCommentDraftState(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, undefined, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported),
100
105
  showCommentForBlockNode: showInlineCommentForBlockNode(annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported),
@@ -161,11 +166,11 @@ export var annotationPlugin = function annotationPlugin(_ref) {
161
166
  var pluginState = getPluginState(state);
162
167
  if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
163
168
  var _api$analytics5;
164
- var _annotationProviders$2 = annotationProviders.inlineComment,
165
- isToolbarAbove = _annotationProviders$2.isToolbarAbove,
166
- onCommentButtonMount = _annotationProviders$2.onCommentButtonMount,
167
- getCanAddComments = _annotationProviders$2.getCanAddComments,
168
- contentType = _annotationProviders$2.contentType;
169
+ var _annotationProviders$4 = annotationProviders.inlineComment,
170
+ isToolbarAbove = _annotationProviders$4.isToolbarAbove,
171
+ onCommentButtonMount = _annotationProviders$4.onCommentButtonMount,
172
+ getCanAddComments = _annotationProviders$4.getCanAddComments,
173
+ contentType = _annotationProviders$4.contentType;
169
174
  var toolbarConfig = buildToolbar(api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions)({
170
175
  state: state,
171
176
  intl: intl,
@@ -6,7 +6,7 @@ import type { EditorViewModeEffectsPlugin } from '@atlaskit/editor-plugin-editor
6
6
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
7
7
  import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
8
8
  import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
9
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
9
+ import type { Node, Slice } from '@atlaskit/editor-prosemirror/model';
10
10
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
11
11
  import type { showInlineCommentForBlockNode } from './editor-commands';
12
12
  import type { InlineCommentPluginState } from './pm-plugins/types';
@@ -35,6 +35,8 @@ export type AnnotationPlugin = NextEditorPlugin<'annotation', {
35
35
  */
36
36
  applyInlineCommentDraft: (annotationId: string) => Command;
37
37
  hasAnyUnResolvedAnnotationInPage: (state: EditorState) => boolean;
38
+ /** Whether the configured provider supports block comments on this node. */
39
+ isBlockNodeSupported: (node: Node) => boolean;
38
40
  /**
39
41
  * Removes an inline-comment annotation mark from the document by id.
40
42
  * @returns A command that returns true when the remove transaction is dispatched.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "24.0.4",
3
+ "version": "25.0.0",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -19,13 +19,13 @@
19
19
  "sideEffects": false,
20
20
  "atlaskit:src": "src/index.ts",
21
21
  "dependencies": {
22
- "@atlaskit/adf-schema": "^57.6.0",
23
- "@atlaskit/editor-plugin-analytics": "^24.0.0",
24
- "@atlaskit/editor-plugin-connectivity": "^24.0.0",
25
- "@atlaskit/editor-plugin-editor-viewmode-effects": "^24.0.0",
26
- "@atlaskit/editor-plugin-feature-flags": "^23.0.0",
27
- "@atlaskit/editor-plugin-toolbar": "^21.0.0",
28
- "@atlaskit/editor-plugin-user-intent": "^22.0.0",
22
+ "@atlaskit/adf-schema": "^57.7.0",
23
+ "@atlaskit/editor-plugin-analytics": "^25.0.0",
24
+ "@atlaskit/editor-plugin-connectivity": "^25.0.0",
25
+ "@atlaskit/editor-plugin-editor-viewmode-effects": "^25.0.0",
26
+ "@atlaskit/editor-plugin-feature-flags": "^24.0.0",
27
+ "@atlaskit/editor-plugin-toolbar": "^22.0.0",
28
+ "@atlaskit/editor-plugin-user-intent": "^23.0.0",
29
29
  "@atlaskit/editor-prosemirror": "^9.0.0",
30
30
  "@atlaskit/editor-toolbar": "^2.8.0",
31
31
  "@atlaskit/editor-toolbar-model": "^1.2.0",
@@ -35,7 +35,7 @@
35
35
  "@babel/runtime": "^7.0.0"
36
36
  },
37
37
  "peerDependencies": {
38
- "@atlaskit/editor-common": "^128.3.0",
38
+ "@atlaskit/editor-common": "^129.0.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"