@atlaskit/editor-plugin-annotation 2.1.8 → 2.1.9

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
+ ## 2.1.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#131690](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/131690)
8
+ [`4ef6e6cdd0cec`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4ef6e6cdd0cec) -
9
+ Fix deleting inline comment view component if it is moved
10
+
3
11
  ## 2.1.8
4
12
 
5
13
  ### Patch Changes
@@ -86,7 +86,8 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
86
86
  state: state,
87
87
  intl: intl,
88
88
  isToolbarAbove: isToolbarAbove,
89
- api: api
89
+ api: api,
90
+ createCommentExperience: annotationProviders.createCommentExperience
90
91
  });
91
92
  if (!toolbarConfig) {
92
93
  return undefined;
@@ -26,7 +26,8 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(editorAnalyticsA
26
26
  isToolbarAbove = _ref$isToolbarAbove === void 0 ? false : _ref$isToolbarAbove,
27
27
  _ref$_supportedNodes = _ref._supportedNodes,
28
28
  _supportedNodes = _ref$_supportedNodes === void 0 ? [] : _ref$_supportedNodes,
29
- api = _ref.api;
29
+ api = _ref.api,
30
+ createCommentExperience = _ref.createCommentExperience;
30
31
  var schema = state.schema;
31
32
  var selectionValid = (0, _utils2.isSelectionValid)(state);
32
33
  var isMediaSelected = (0, _mediaSingle.currentMediaNodeWithPos)(state);
@@ -88,6 +89,15 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(editorAnalyticsA
88
89
  }
89
90
  });
90
91
  }
92
+ if ((0, _platformFeatureFlags.fg)('confluence_comments_create_comment_experience')) {
93
+ createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.start({
94
+ attributes: {
95
+ pageClass: 'editor',
96
+ commentType: 'inline'
97
+ }
98
+ });
99
+ createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.initExperience.start();
100
+ }
91
101
  return (0, _editorCommands.setInlineCommentDraftState)(editorAnalyticsAPI)(true)(state, dispatch);
92
102
  },
93
103
  supportsViewMode: true // TODO: MODES-3950 - Clean up this floating toolbar view mode logic,
@@ -162,7 +162,7 @@ function InlineCommentView(_ref) {
162
162
  getInlineNodeTypes: getInlineNodeTypes,
163
163
  dom: dom,
164
164
  onDelete: function onDelete(id) {
165
- return (0, _editorCommands.removeInlineCommentNearSelection)(id, inlineCommentProvider.supportedBlockNodes)(state, dispatch);
165
+ return (0, _editorCommands.removeInlineCommentNearSelection)(id, inlineCommentProvider.supportedBlockNodes)(editorView.state, dispatch);
166
166
  },
167
167
  onResolve: function onResolve(id) {
168
168
  return (0, _editorCommands.updateInlineCommentResolvedState)(editorAnalyticsAPI)((0, _defineProperty2.default)({}, id, true), _analytics.RESOLVE_METHOD.COMPONENT)(editorView.state, editorView.dispatch);
@@ -78,7 +78,8 @@ export const annotationPlugin = ({
78
78
  state,
79
79
  intl,
80
80
  isToolbarAbove,
81
- api
81
+ api,
82
+ createCommentExperience: annotationProviders.createCommentExperience
82
83
  });
83
84
  if (!toolbarConfig) {
84
85
  return undefined;
@@ -15,7 +15,8 @@ export const buildToolbar = editorAnalyticsAPI => ({
15
15
  intl,
16
16
  isToolbarAbove = false,
17
17
  _supportedNodes = [],
18
- api
18
+ api,
19
+ createCommentExperience
19
20
  }) => {
20
21
  var _api$connectivity, _api$connectivity$sha, _api$connectivity$sha2;
21
22
  const {
@@ -79,6 +80,15 @@ export const buildToolbar = editorAnalyticsAPI => ({
79
80
  }
80
81
  });
81
82
  }
83
+ if (fg('confluence_comments_create_comment_experience')) {
84
+ createCommentExperience === null || createCommentExperience === void 0 ? void 0 : createCommentExperience.start({
85
+ attributes: {
86
+ pageClass: 'editor',
87
+ commentType: 'inline'
88
+ }
89
+ });
90
+ createCommentExperience === null || createCommentExperience === void 0 ? void 0 : createCommentExperience.initExperience.start();
91
+ }
82
92
  return setInlineCommentDraftState(editorAnalyticsAPI)(true)(state, dispatch);
83
93
  },
84
94
  supportsViewMode: true // TODO: MODES-3950 - Clean up this floating toolbar view mode logic,
@@ -158,7 +158,7 @@ export function InlineCommentView({
158
158
  annotations: activeAnnotations,
159
159
  getInlineNodeTypes: getInlineNodeTypes,
160
160
  dom: dom,
161
- onDelete: id => removeInlineCommentNearSelection(id, inlineCommentProvider.supportedBlockNodes)(state, dispatch),
161
+ onDelete: id => removeInlineCommentNearSelection(id, inlineCommentProvider.supportedBlockNodes)(editorView.state, dispatch),
162
162
  onResolve: id => updateInlineCommentResolvedState(editorAnalyticsAPI)({
163
163
  [id]: true
164
164
  }, RESOLVE_METHOD.COMPONENT)(editorView.state, editorView.dispatch),
@@ -79,7 +79,8 @@ export var annotationPlugin = function annotationPlugin(_ref) {
79
79
  state: state,
80
80
  intl: intl,
81
81
  isToolbarAbove: isToolbarAbove,
82
- api: api
82
+ api: api,
83
+ createCommentExperience: annotationProviders.createCommentExperience
83
84
  });
84
85
  if (!toolbarConfig) {
85
86
  return undefined;
@@ -19,7 +19,8 @@ export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
19
19
  isToolbarAbove = _ref$isToolbarAbove === void 0 ? false : _ref$isToolbarAbove,
20
20
  _ref$_supportedNodes = _ref._supportedNodes,
21
21
  _supportedNodes = _ref$_supportedNodes === void 0 ? [] : _ref$_supportedNodes,
22
- api = _ref.api;
22
+ api = _ref.api,
23
+ createCommentExperience = _ref.createCommentExperience;
23
24
  var schema = state.schema;
24
25
  var selectionValid = isSelectionValid(state);
25
26
  var isMediaSelected = currentMediaNodeWithPos(state);
@@ -81,6 +82,15 @@ export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
81
82
  }
82
83
  });
83
84
  }
85
+ if (fg('confluence_comments_create_comment_experience')) {
86
+ createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.start({
87
+ attributes: {
88
+ pageClass: 'editor',
89
+ commentType: 'inline'
90
+ }
91
+ });
92
+ createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.initExperience.start();
93
+ }
84
94
  return setInlineCommentDraftState(editorAnalyticsAPI)(true)(state, dispatch);
85
95
  },
86
96
  supportsViewMode: true // TODO: MODES-3950 - Clean up this floating toolbar view mode logic,
@@ -155,7 +155,7 @@ export function InlineCommentView(_ref) {
155
155
  getInlineNodeTypes: getInlineNodeTypes,
156
156
  dom: dom,
157
157
  onDelete: function onDelete(id) {
158
- return removeInlineCommentNearSelection(id, inlineCommentProvider.supportedBlockNodes)(state, dispatch);
158
+ return removeInlineCommentNearSelection(id, inlineCommentProvider.supportedBlockNodes)(editorView.state, dispatch);
159
159
  },
160
160
  onResolve: function onResolve(id) {
161
161
  return updateInlineCommentResolvedState(editorAnalyticsAPI)(_defineProperty({}, id, true), RESOLVE_METHOD.COMPONENT)(editorView.state, editorView.dispatch);
@@ -6,6 +6,7 @@ import type { NodeType } from '@atlaskit/editor-prosemirror/model';
6
6
  import { type EditorState } from '@atlaskit/editor-prosemirror/state';
7
7
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
8
  import type { AnnotationPlugin } from '../annotationPluginType';
9
+ import { AnnotationProviders } from '../types';
9
10
  interface BuildToolbarOptions {
10
11
  state: EditorState;
11
12
  intl: IntlShape;
@@ -13,8 +14,9 @@ interface BuildToolbarOptions {
13
14
  isCommentOnMediaOn?: boolean;
14
15
  _supportedNodes?: string[];
15
16
  api?: ExtractInjectionAPI<AnnotationPlugin>;
17
+ createCommentExperience?: AnnotationProviders['createCommentExperience'];
16
18
  }
17
- export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ state, intl, isToolbarAbove, _supportedNodes, api, }: BuildToolbarOptions) => {
19
+ export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ state, intl, isToolbarAbove, _supportedNodes, api, createCommentExperience, }: BuildToolbarOptions) => {
18
20
  title: string;
19
21
  nodeType: NodeType[];
20
22
  items: FloatingToolbarButton<Command>[];
@@ -104,6 +104,23 @@ export type InlineCommentAnnotationProvider = AnnotationTypeProvider<AnnotationT
104
104
  };
105
105
  export interface AnnotationProviders {
106
106
  inlineComment: InlineCommentAnnotationProvider;
107
+ createCommentExperience?: {
108
+ start: (_: {
109
+ attributes: {
110
+ pageClass: 'editor';
111
+ commentType: 'inline';
112
+ annotationId?: undefined;
113
+ } | {
114
+ pageClass: 'editor';
115
+ commentType: 'block';
116
+ blockType: 'media';
117
+ annotationId?: undefined;
118
+ };
119
+ }) => void;
120
+ initExperience: {
121
+ start: () => void;
122
+ };
123
+ };
107
124
  }
108
125
  export declare enum AnnotationSelectionType {
109
126
  INVALID = "invalid",// Annotation should not be created, toolbar should not be shown
@@ -6,6 +6,7 @@ import type { NodeType } from '@atlaskit/editor-prosemirror/model';
6
6
  import { type EditorState } from '@atlaskit/editor-prosemirror/state';
7
7
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
8
  import type { AnnotationPlugin } from '../annotationPluginType';
9
+ import { AnnotationProviders } from '../types';
9
10
  interface BuildToolbarOptions {
10
11
  state: EditorState;
11
12
  intl: IntlShape;
@@ -13,8 +14,9 @@ interface BuildToolbarOptions {
13
14
  isCommentOnMediaOn?: boolean;
14
15
  _supportedNodes?: string[];
15
16
  api?: ExtractInjectionAPI<AnnotationPlugin>;
17
+ createCommentExperience?: AnnotationProviders['createCommentExperience'];
16
18
  }
17
- export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ state, intl, isToolbarAbove, _supportedNodes, api, }: BuildToolbarOptions) => {
19
+ export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ state, intl, isToolbarAbove, _supportedNodes, api, createCommentExperience, }: BuildToolbarOptions) => {
18
20
  title: string;
19
21
  nodeType: NodeType[];
20
22
  items: FloatingToolbarButton<Command>[];
@@ -104,6 +104,23 @@ export type InlineCommentAnnotationProvider = AnnotationTypeProvider<AnnotationT
104
104
  };
105
105
  export interface AnnotationProviders {
106
106
  inlineComment: InlineCommentAnnotationProvider;
107
+ createCommentExperience?: {
108
+ start: (_: {
109
+ attributes: {
110
+ pageClass: 'editor';
111
+ commentType: 'inline';
112
+ annotationId?: undefined;
113
+ } | {
114
+ pageClass: 'editor';
115
+ commentType: 'block';
116
+ blockType: 'media';
117
+ annotationId?: undefined;
118
+ };
119
+ }) => void;
120
+ initExperience: {
121
+ start: () => void;
122
+ };
123
+ };
107
124
  }
108
125
  export declare enum AnnotationSelectionType {
109
126
  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.1.8",
3
+ "version": "2.1.9",
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": "^102.11.0",
35
+ "@atlaskit/editor-common": "^102.13.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",
@@ -41,7 +41,7 @@
41
41
  "@atlaskit/icon": "^25.0.0",
42
42
  "@atlaskit/onboarding": "^13.0.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
- "@atlaskit/tmp-editor-statsig": "^4.1.0",
44
+ "@atlaskit/tmp-editor-statsig": "^4.4.0",
45
45
  "@babel/runtime": "^7.0.0"
46
46
  },
47
47
  "peerDependencies": {
@@ -104,6 +104,9 @@
104
104
  },
105
105
  "use_comments_data_annotation_updater": {
106
106
  "type": "boolean"
107
+ },
108
+ "confluence_comments_create_comment_experience": {
109
+ "type": "boolean"
107
110
  }
108
111
  }
109
112
  }