@atlaskit/editor-plugin-annotation 2.2.2 → 2.4.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,26 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 2.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#137860](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/137860)
8
+ [`04e753d1ba0f4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/04e753d1ba0f4) -
9
+ Created a new Annotation manager implementation and interface and updated CCFE to create and share
10
+ this instance around
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 2.3.0
17
+
18
+ ### Minor Changes
19
+
20
+ - [#138416](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/138416)
21
+ [`8cfce6829f775`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8cfce6829f775) -
22
+ Fix to have focussedCommentId render the standalone inlinecomment
23
+
3
24
  ## 2.2.2
4
25
 
5
26
  ### Patch Changes
@@ -178,10 +178,23 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
178
178
  };
179
179
  var setSelectedAnnotationFn = function setSelectedAnnotationFn(annotationId) {
180
180
  var pluginState = (0, _utils.getPluginState)(editorView.state);
181
- if (!annotationId || pluginState !== null && pluginState !== void 0 && pluginState.isInlineCommentViewClosed && (0, _platformFeatureFlags.fg)('platform_editor_listen_for_annotation_clicks')) {
182
- (0, _editorCommands.closeComponent)()(editorView.state, editorView.dispatch);
181
+ if ((0, _platformFeatureFlags.fg)('platform_editor_listen_for_focussed_query_param')) {
182
+ // When feature flag is true, only close if no annotationId
183
+ if (!annotationId) {
184
+ (0, _editorCommands.closeComponent)()(editorView.state, editorView.dispatch);
185
+ } else {
186
+ (0, _editorCommands.setSelectedAnnotation)(annotationId)(editorView.state, editorView.dispatch);
187
+ }
183
188
  } else {
184
- (0, _editorCommands.setSelectedAnnotation)(annotationId)(editorView.state, editorView.dispatch);
189
+ // When feature flag is false, close if:
190
+ // 1. No annotationId OR
191
+ // 2. View is closed and annotation clicks are enabled
192
+ var shouldClose = !annotationId || (pluginState === null || pluginState === void 0 ? void 0 : pluginState.isInlineCommentViewClosed) && (0, _platformFeatureFlags.fg)('platform_editor_listen_for_annotation_clicks');
193
+ if (shouldClose) {
194
+ (0, _editorCommands.closeComponent)()(editorView.state, editorView.dispatch);
195
+ } else {
196
+ (0, _editorCommands.setSelectedAnnotation)(annotationId)(editorView.state, editorView.dispatch);
197
+ }
185
198
  }
186
199
  };
187
200
  var setHoveredAnnotationFn = function setHoveredAnnotationFn(annotationId) {
@@ -110,10 +110,23 @@ export const inlineCommentPlugin = options => {
110
110
  const setVisibility = isVisible => onSetVisibility(editorView)(isVisible);
111
111
  const setSelectedAnnotationFn = annotationId => {
112
112
  const pluginState = getPluginState(editorView.state);
113
- if (!annotationId || pluginState !== null && pluginState !== void 0 && pluginState.isInlineCommentViewClosed && fg('platform_editor_listen_for_annotation_clicks')) {
114
- closeComponent()(editorView.state, editorView.dispatch);
113
+ if (fg('platform_editor_listen_for_focussed_query_param')) {
114
+ // When feature flag is true, only close if no annotationId
115
+ if (!annotationId) {
116
+ closeComponent()(editorView.state, editorView.dispatch);
117
+ } else {
118
+ setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
119
+ }
115
120
  } else {
116
- setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
121
+ // When feature flag is false, close if:
122
+ // 1. No annotationId OR
123
+ // 2. View is closed and annotation clicks are enabled
124
+ const shouldClose = !annotationId || (pluginState === null || pluginState === void 0 ? void 0 : pluginState.isInlineCommentViewClosed) && fg('platform_editor_listen_for_annotation_clicks');
125
+ if (shouldClose) {
126
+ closeComponent()(editorView.state, editorView.dispatch);
127
+ } else {
128
+ setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
129
+ }
117
130
  }
118
131
  };
119
132
  const setHoveredAnnotationFn = annotationId => {
@@ -171,10 +171,23 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
171
171
  };
172
172
  var setSelectedAnnotationFn = function setSelectedAnnotationFn(annotationId) {
173
173
  var pluginState = getPluginState(editorView.state);
174
- if (!annotationId || pluginState !== null && pluginState !== void 0 && pluginState.isInlineCommentViewClosed && fg('platform_editor_listen_for_annotation_clicks')) {
175
- closeComponent()(editorView.state, editorView.dispatch);
174
+ if (fg('platform_editor_listen_for_focussed_query_param')) {
175
+ // When feature flag is true, only close if no annotationId
176
+ if (!annotationId) {
177
+ closeComponent()(editorView.state, editorView.dispatch);
178
+ } else {
179
+ setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
180
+ }
176
181
  } else {
177
- setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
182
+ // When feature flag is false, close if:
183
+ // 1. No annotationId OR
184
+ // 2. View is closed and annotation clicks are enabled
185
+ var shouldClose = !annotationId || (pluginState === null || pluginState === void 0 ? void 0 : pluginState.isInlineCommentViewClosed) && fg('platform_editor_listen_for_annotation_clicks');
186
+ if (shouldClose) {
187
+ closeComponent()(editorView.state, editorView.dispatch);
188
+ } else {
189
+ setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
190
+ }
178
191
  }
179
192
  };
180
193
  var setHoveredAnnotationFn = function setHoveredAnnotationFn(annotationId) {
@@ -1,7 +1,7 @@
1
1
  import type React from 'react';
2
2
  import type { AnnotationTypes } from '@atlaskit/adf-schema';
3
3
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import type { AnnotationUpdateEmitter } from '@atlaskit/editor-common/annotation';
4
+ import type { AnnotationUpdateEmitter, AnnotationManager } from '@atlaskit/editor-common/annotation';
5
5
  /**
6
6
  * type of target that annotation apply to.
7
7
  * This is used to apply correct decoration to a draft comment
@@ -121,6 +121,7 @@ export interface AnnotationProviders {
121
121
  start: () => void;
122
122
  };
123
123
  };
124
+ annotationManager?: AnnotationManager;
124
125
  }
125
126
  export declare enum AnnotationSelectionType {
126
127
  INVALID = "invalid",// Annotation should not be created, toolbar should not be shown
@@ -1,7 +1,7 @@
1
1
  import type React from 'react';
2
2
  import type { AnnotationTypes } from '@atlaskit/adf-schema';
3
3
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import type { AnnotationUpdateEmitter } from '@atlaskit/editor-common/annotation';
4
+ import type { AnnotationUpdateEmitter, AnnotationManager } from '@atlaskit/editor-common/annotation';
5
5
  /**
6
6
  * type of target that annotation apply to.
7
7
  * This is used to apply correct decoration to a draft comment
@@ -121,6 +121,7 @@ export interface AnnotationProviders {
121
121
  start: () => void;
122
122
  };
123
123
  };
124
+ annotationManager?: AnnotationManager;
124
125
  }
125
126
  export declare enum AnnotationSelectionType {
126
127
  INVALID = "invalid",// Annotation should not be created, toolbar should not be shown
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "2.2.2",
3
+ "version": "2.4.0",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^47.6.0",
35
- "@atlaskit/editor-common": "^103.1.0",
35
+ "@atlaskit/editor-common": "^103.3.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
37
37
  "@atlaskit/editor-plugin-connectivity": "^2.0.0",
38
38
  "@atlaskit/editor-plugin-editor-viewmode-effects": "^2.0.0",
@@ -110,6 +110,9 @@
110
110
  },
111
111
  "platform_editor_annotation_selected_annotation": {
112
112
  "type": "boolean"
113
+ },
114
+ "platform_editor_listen_for_focussed_query_param": {
115
+ "type": "boolean"
113
116
  }
114
117
  }
115
118
  }