@atlaskit/editor-plugin-annotation 0.3.4 → 0.3.5

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
+ ## 0.3.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#69825](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69825) [`e2363da4f6a1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e2363da4f6a1) - [No Issue] Replace View Mode API for annotations
8
+ - [#69825](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69825) [`e2363da4f6a1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e2363da4f6a1) - [No Issue] Replace View Mode API for annotations
9
+ - [#69825](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69825) [`e2363da4f6a1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e2363da4f6a1) - [No Issue] Replace View Mode API for annotations
10
+
3
11
  ## 0.3.4
4
12
 
5
13
  ### Patch Changes
@@ -8,12 +8,11 @@ exports.updateMouseState = exports.updateInlineCommentResolvedState = exports.se
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _adfSchema = require("@atlaskit/adf-schema");
10
10
  var _analytics = require("@atlaskit/editor-common/analytics");
11
- var _transform = require("@atlaskit/editor-prosemirror/transform");
12
11
  var _pluginFactory = require("../pm-plugins/plugin-factory");
13
12
  var _types = require("../pm-plugins/types");
14
13
  var _types2 = require("../types");
15
14
  var _utils = require("../utils");
16
- var _transform2 = _interopRequireDefault(require("./transform"));
15
+ var _transform = _interopRequireDefault(require("./transform"));
17
16
  var updateInlineCommentResolvedState = exports.updateInlineCommentResolvedState = function updateInlineCommentResolvedState(editorAnalyticsAPI) {
18
17
  return function (partialNewState, resolveMethod) {
19
18
  var command = {
@@ -24,7 +23,7 @@ var updateInlineCommentResolvedState = exports.updateInlineCommentResolvedState
24
23
  return state;
25
24
  });
26
25
  if (resolveMethod && allResolved) {
27
- return (0, _pluginFactory.createCommand)(command, _transform2.default.addResolveAnalytics(editorAnalyticsAPI)(resolveMethod));
26
+ return (0, _pluginFactory.createCommand)(command, _transform.default.addResolveAnalytics(editorAnalyticsAPI)(resolveMethod));
28
27
  }
29
28
  return (0, _pluginFactory.createCommand)(command);
30
29
  };
@@ -81,10 +80,10 @@ var setInlineCommentDraftState = exports.setInlineCommentDraftState = function s
81
80
  return function (drafting) {
82
81
  var inputMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _analytics.INPUT_METHOD.TOOLBAR;
83
82
  var commandAction = getDraftCommandAction(drafting);
84
- return (0, _pluginFactory.createCommand)(commandAction, _transform2.default.addOpenCloseAnalytics(editorAnalyticsAPI)(drafting, inputMethod));
83
+ return (0, _pluginFactory.createCommand)(commandAction, _transform.default.addOpenCloseAnalytics(editorAnalyticsAPI)(drafting, inputMethod));
85
84
  };
86
85
  };
87
- var addInlineComment = exports.addInlineComment = function addInlineComment(editorAnalyticsAPI) {
86
+ var addInlineComment = exports.addInlineComment = function addInlineComment(editorAnalyticsAPI, editorAPI) {
88
87
  return function (id) {
89
88
  var commandAction = function commandAction(editorState) {
90
89
  return {
@@ -102,7 +101,7 @@ var addInlineComment = exports.addInlineComment = function addInlineComment(edit
102
101
  }
103
102
  };
104
103
  };
105
- return (0, _pluginFactory.createCommand)(commandAction, _transform2.default.addInlineComment(editorAnalyticsAPI)(id));
104
+ return (0, _pluginFactory.createCommand)(commandAction, _transform.default.addInlineComment(editorAnalyticsAPI, editorAPI)(id));
106
105
  };
107
106
  };
108
107
  var updateMouseState = exports.updateMouseState = function updateMouseState(mouseData) {
@@ -124,42 +123,18 @@ var setSelectedAnnotation = exports.setSelectedAnnotation = function setSelected
124
123
  }
125
124
  });
126
125
  };
127
- var getAddAnnotationMarkStep = function getAddAnnotationMarkStep(id) {
128
- return function (state) {
129
- var inlineCommentState = (0, _utils.getPluginState)(state);
130
- var _getSelectionPosition = (0, _utils.getSelectionPositions)(state, inlineCommentState),
131
- from = _getSelectionPosition.from,
132
- to = _getSelectionPosition.to;
133
- return new _transform.AddMarkStep(Math.min(from, to), Math.max(from, to), state.schema.marks.annotation.create({
134
- id: id,
135
- annotationType: _adfSchema.AnnotationTypes.INLINE_COMMENT
136
- }));
137
- };
138
- };
139
126
  var createAnnotation = exports.createAnnotation = function createAnnotation(editorAnalyticsAPI, editorAPI) {
140
127
  return function (id) {
141
128
  var annotationType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _adfSchema.AnnotationTypes.INLINE_COMMENT;
142
129
  return function (state, dispatch) {
143
- var _editorAPI$editorView;
144
130
  // don't try to add if there are is no temp highlight bookmarked
145
131
  var _ref = (0, _utils.getPluginState)(state) || {},
146
132
  bookmark = _ref.bookmark;
147
133
  if (!bookmark || !dispatch) {
148
134
  return false;
149
135
  }
150
-
151
- // TODO MODES-3951 Refactor this to send new ViewModeStep
152
- // When in view mode, user is not able to add comments through normal way when communicating with NCS.
153
- // Therefore we make an explicit API call to NCS with the appropriate step that adds their new inline comment into the ADF.
154
- if ((editorAPI === null || editorAPI === void 0 || (_editorAPI$editorView = editorAPI.editorViewMode) === null || _editorAPI$editorView === void 0 || (_editorAPI$editorView = _editorAPI$editorView.sharedState) === null || _editorAPI$editorView === void 0 || (_editorAPI$editorView = _editorAPI$editorView.currentState()) === null || _editorAPI$editorView === void 0 ? void 0 : _editorAPI$editorView.mode) === 'view') {
155
- var _provider$api;
156
- var commentMark = getAddAnnotationMarkStep(id)(state);
157
- // @ts-ignore
158
- var provider = state === null || state === void 0 ? void 0 : state.nativeCollabProviderPlugin$;
159
- provider === null || provider === void 0 || (_provider$api = provider.api) === null || _provider$api === void 0 || _provider$api.addComment([commentMark]);
160
- }
161
136
  if (annotationType === _adfSchema.AnnotationTypes.INLINE_COMMENT) {
162
- return addInlineComment(editorAnalyticsAPI)(id)(state, dispatch);
137
+ return addInlineComment(editorAnalyticsAPI, editorAPI)(id)(state, dispatch);
163
138
  }
164
139
  return false;
165
140
  };
@@ -27,10 +27,13 @@ var addAnnotationMark = function addAnnotationMark(id) {
27
27
  return tr;
28
28
  };
29
29
  };
30
- var addInlineComment = function addInlineComment(editorAnalyticsAPI) {
30
+ var addInlineComment = function addInlineComment(editorAnalyticsAPI, editorAPI) {
31
31
  return function (id) {
32
32
  return function (transaction, state) {
33
+ var _editorAPI$editorView;
33
34
  var tr = addAnnotationMark(id)(transaction, state);
35
+ editorAPI === null || editorAPI === void 0 || (_editorAPI$editorView = editorAPI.editorViewMode) === null || _editorAPI$editorView === void 0 || _editorAPI$editorView.actions.applyViewModeStepAt(tr);
36
+
34
37
  // add insert analytics step to transaction
35
38
  tr = addInsertAnalytics(editorAnalyticsAPI)(tr, state);
36
39
  // add close analytics step to transaction
@@ -1,10 +1,9 @@
1
1
  import { AnnotationTypes } from '@atlaskit/adf-schema';
2
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import { AddMarkStep } from '@atlaskit/editor-prosemirror/transform';
4
3
  import { createCommand } from '../pm-plugins/plugin-factory';
5
4
  import { ACTIONS } from '../pm-plugins/types';
6
5
  import { AnnotationSelectionType } from '../types';
7
- import { getPluginState, getSelectionPositions, isSelectionValid } from '../utils';
6
+ import { getPluginState, isSelectionValid } from '../utils';
8
7
  import transform from './transform';
9
8
  export const updateInlineCommentResolvedState = editorAnalyticsAPI => (partialNewState, resolveMethod) => {
10
9
  const command = {
@@ -67,7 +66,7 @@ export const setInlineCommentDraftState = editorAnalyticsAPI => (drafting, input
67
66
  const commandAction = getDraftCommandAction(drafting);
68
67
  return createCommand(commandAction, transform.addOpenCloseAnalytics(editorAnalyticsAPI)(drafting, inputMethod));
69
68
  };
70
- export const addInlineComment = editorAnalyticsAPI => id => {
69
+ export const addInlineComment = (editorAnalyticsAPI, editorAPI) => id => {
71
70
  const commandAction = editorState => ({
72
71
  type: ACTIONS.ADD_INLINE_COMMENT,
73
72
  data: {
@@ -84,7 +83,7 @@ export const addInlineComment = editorAnalyticsAPI => id => {
84
83
  editorState
85
84
  }
86
85
  });
87
- return createCommand(commandAction, transform.addInlineComment(editorAnalyticsAPI)(id));
86
+ return createCommand(commandAction, transform.addInlineComment(editorAnalyticsAPI, editorAPI)(id));
88
87
  };
89
88
  export const updateMouseState = mouseData => createCommand({
90
89
  type: ACTIONS.INLINE_COMMENT_UPDATE_MOUSE_STATE,
@@ -101,19 +100,7 @@ export const setSelectedAnnotation = id => createCommand({
101
100
  }]
102
101
  }
103
102
  });
104
- const getAddAnnotationMarkStep = id => state => {
105
- const inlineCommentState = getPluginState(state);
106
- const {
107
- from,
108
- to
109
- } = getSelectionPositions(state, inlineCommentState);
110
- return new AddMarkStep(Math.min(from, to), Math.max(from, to), state.schema.marks.annotation.create({
111
- id,
112
- annotationType: AnnotationTypes.INLINE_COMMENT
113
- }));
114
- };
115
103
  export const createAnnotation = (editorAnalyticsAPI, editorAPI) => (id, annotationType = AnnotationTypes.INLINE_COMMENT) => (state, dispatch) => {
116
- var _editorAPI$editorView, _editorAPI$editorView2, _editorAPI$editorView3;
117
104
  // don't try to add if there are is no temp highlight bookmarked
118
105
  const {
119
106
  bookmark
@@ -121,19 +108,8 @@ export const createAnnotation = (editorAnalyticsAPI, editorAPI) => (id, annotati
121
108
  if (!bookmark || !dispatch) {
122
109
  return false;
123
110
  }
124
-
125
- // TODO MODES-3951 Refactor this to send new ViewModeStep
126
- // When in view mode, user is not able to add comments through normal way when communicating with NCS.
127
- // Therefore we make an explicit API call to NCS with the appropriate step that adds their new inline comment into the ADF.
128
- if ((editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$editorView = editorAPI.editorViewMode) === null || _editorAPI$editorView === void 0 ? void 0 : (_editorAPI$editorView2 = _editorAPI$editorView.sharedState) === null || _editorAPI$editorView2 === void 0 ? void 0 : (_editorAPI$editorView3 = _editorAPI$editorView2.currentState()) === null || _editorAPI$editorView3 === void 0 ? void 0 : _editorAPI$editorView3.mode) === 'view') {
129
- var _provider$api;
130
- const commentMark = getAddAnnotationMarkStep(id)(state);
131
- // @ts-ignore
132
- const provider = state === null || state === void 0 ? void 0 : state.nativeCollabProviderPlugin$;
133
- provider === null || provider === void 0 ? void 0 : (_provider$api = provider.api) === null || _provider$api === void 0 ? void 0 : _provider$api.addComment([commentMark]);
134
- }
135
111
  if (annotationType === AnnotationTypes.INLINE_COMMENT) {
136
- return addInlineComment(editorAnalyticsAPI)(id)(state, dispatch);
112
+ return addInlineComment(editorAnalyticsAPI, editorAPI)(id)(state, dispatch);
137
113
  }
138
114
  return false;
139
115
  };
@@ -20,8 +20,11 @@ const addAnnotationMark = id => (transaction, state) => {
20
20
  tr.setSelection(TextSelection.create(tr.doc, head));
21
21
  return tr;
22
22
  };
23
- const addInlineComment = editorAnalyticsAPI => id => (transaction, state) => {
23
+ const addInlineComment = (editorAnalyticsAPI, editorAPI) => id => (transaction, state) => {
24
+ var _editorAPI$editorView;
24
25
  let tr = addAnnotationMark(id)(transaction, state);
26
+ editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$editorView = editorAPI.editorViewMode) === null || _editorAPI$editorView === void 0 ? void 0 : _editorAPI$editorView.actions.applyViewModeStepAt(tr);
27
+
25
28
  // add insert analytics step to transaction
26
29
  tr = addInsertAnalytics(editorAnalyticsAPI)(tr, state);
27
30
  // add close analytics step to transaction
@@ -1,11 +1,10 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { AnnotationTypes } from '@atlaskit/adf-schema';
3
3
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { AddMarkStep } from '@atlaskit/editor-prosemirror/transform';
5
4
  import { createCommand } from '../pm-plugins/plugin-factory';
6
5
  import { ACTIONS } from '../pm-plugins/types';
7
6
  import { AnnotationSelectionType } from '../types';
8
- import { getPluginState, getSelectionPositions, isSelectionValid } from '../utils';
7
+ import { getPluginState, isSelectionValid } from '../utils';
9
8
  import transform from './transform';
10
9
  export var updateInlineCommentResolvedState = function updateInlineCommentResolvedState(editorAnalyticsAPI) {
11
10
  return function (partialNewState, resolveMethod) {
@@ -77,7 +76,7 @@ export var setInlineCommentDraftState = function setInlineCommentDraftState(edit
77
76
  return createCommand(commandAction, transform.addOpenCloseAnalytics(editorAnalyticsAPI)(drafting, inputMethod));
78
77
  };
79
78
  };
80
- export var addInlineComment = function addInlineComment(editorAnalyticsAPI) {
79
+ export var addInlineComment = function addInlineComment(editorAnalyticsAPI, editorAPI) {
81
80
  return function (id) {
82
81
  var commandAction = function commandAction(editorState) {
83
82
  return {
@@ -95,7 +94,7 @@ export var addInlineComment = function addInlineComment(editorAnalyticsAPI) {
95
94
  }
96
95
  };
97
96
  };
98
- return createCommand(commandAction, transform.addInlineComment(editorAnalyticsAPI)(id));
97
+ return createCommand(commandAction, transform.addInlineComment(editorAnalyticsAPI, editorAPI)(id));
99
98
  };
100
99
  };
101
100
  export var updateMouseState = function updateMouseState(mouseData) {
@@ -117,42 +116,18 @@ export var setSelectedAnnotation = function setSelectedAnnotation(id) {
117
116
  }
118
117
  });
119
118
  };
120
- var getAddAnnotationMarkStep = function getAddAnnotationMarkStep(id) {
121
- return function (state) {
122
- var inlineCommentState = getPluginState(state);
123
- var _getSelectionPosition = getSelectionPositions(state, inlineCommentState),
124
- from = _getSelectionPosition.from,
125
- to = _getSelectionPosition.to;
126
- return new AddMarkStep(Math.min(from, to), Math.max(from, to), state.schema.marks.annotation.create({
127
- id: id,
128
- annotationType: AnnotationTypes.INLINE_COMMENT
129
- }));
130
- };
131
- };
132
119
  export var createAnnotation = function createAnnotation(editorAnalyticsAPI, editorAPI) {
133
120
  return function (id) {
134
121
  var annotationType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : AnnotationTypes.INLINE_COMMENT;
135
122
  return function (state, dispatch) {
136
- var _editorAPI$editorView;
137
123
  // don't try to add if there are is no temp highlight bookmarked
138
124
  var _ref = getPluginState(state) || {},
139
125
  bookmark = _ref.bookmark;
140
126
  if (!bookmark || !dispatch) {
141
127
  return false;
142
128
  }
143
-
144
- // TODO MODES-3951 Refactor this to send new ViewModeStep
145
- // When in view mode, user is not able to add comments through normal way when communicating with NCS.
146
- // Therefore we make an explicit API call to NCS with the appropriate step that adds their new inline comment into the ADF.
147
- if ((editorAPI === null || editorAPI === void 0 || (_editorAPI$editorView = editorAPI.editorViewMode) === null || _editorAPI$editorView === void 0 || (_editorAPI$editorView = _editorAPI$editorView.sharedState) === null || _editorAPI$editorView === void 0 || (_editorAPI$editorView = _editorAPI$editorView.currentState()) === null || _editorAPI$editorView === void 0 ? void 0 : _editorAPI$editorView.mode) === 'view') {
148
- var _provider$api;
149
- var commentMark = getAddAnnotationMarkStep(id)(state);
150
- // @ts-ignore
151
- var provider = state === null || state === void 0 ? void 0 : state.nativeCollabProviderPlugin$;
152
- provider === null || provider === void 0 || (_provider$api = provider.api) === null || _provider$api === void 0 || _provider$api.addComment([commentMark]);
153
- }
154
129
  if (annotationType === AnnotationTypes.INLINE_COMMENT) {
155
- return addInlineComment(editorAnalyticsAPI)(id)(state, dispatch);
130
+ return addInlineComment(editorAnalyticsAPI, editorAPI)(id)(state, dispatch);
156
131
  }
157
132
  return false;
158
133
  };
@@ -21,10 +21,13 @@ var addAnnotationMark = function addAnnotationMark(id) {
21
21
  return tr;
22
22
  };
23
23
  };
24
- var addInlineComment = function addInlineComment(editorAnalyticsAPI) {
24
+ var addInlineComment = function addInlineComment(editorAnalyticsAPI, editorAPI) {
25
25
  return function (id) {
26
26
  return function (transaction, state) {
27
+ var _editorAPI$editorView;
27
28
  var tr = addAnnotationMark(id)(transaction, state);
29
+ editorAPI === null || editorAPI === void 0 || (_editorAPI$editorView = editorAPI.editorViewMode) === null || _editorAPI$editorView === void 0 || _editorAPI$editorView.actions.applyViewModeStepAt(tr);
30
+
28
31
  // add insert analytics step to transaction
29
32
  tr = addInsertAnalytics(editorAnalyticsAPI)(tr, state);
30
33
  // add close analytics step to transaction
@@ -9,7 +9,7 @@ export declare const closeComponent: () => Command;
9
9
  export declare const clearDirtyMark: () => Command;
10
10
  export declare const removeInlineCommentNearSelection: (id: string) => Command;
11
11
  export declare const setInlineCommentDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => Command;
12
- export declare const addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string) => Command;
12
+ export declare const addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI?: ExtractInjectionAPI<AnnotationPlugin> | undefined) => (id: string) => Command;
13
13
  export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
14
14
  export declare const setSelectedAnnotation: (id: string) => Command;
15
15
  export declare const createAnnotation: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI?: ExtractInjectionAPI<AnnotationPlugin> | undefined) => (id: string, annotationType?: AnnotationTypes) => Command;
@@ -3,7 +3,126 @@ import type { EditorAnalyticsAPI, RESOLVE_METHOD } from '@atlaskit/editor-common
3
3
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  declare const _default: {
5
5
  addAnnotationMark: (id: string) => (transaction: Transaction, state: EditorState) => Transaction;
6
- addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string) => (transaction: Transaction, state: EditorState) => Transaction;
6
+ addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI: import("@atlaskit/editor-common/types").PublicPluginAPI<[import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"annotation", {
7
+ pluginConfiguration: import("../types").AnnotationProviders | undefined;
8
+ sharedState: import("..").InlineCommentPluginState | undefined;
9
+ dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
10
+ pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
11
+ sharedState: {
12
+ createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
13
+ attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
14
+ performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
15
+ };
16
+ dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
17
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
18
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
19
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>];
20
+ actions: EditorAnalyticsAPI;
21
+ }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
22
+ sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
23
+ dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"collabEdit", {
24
+ pluginConfiguration: import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions;
25
+ dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
26
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
27
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
28
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
29
+ pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
30
+ sharedState: {
31
+ createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
32
+ attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
33
+ performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
34
+ };
35
+ dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
36
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
37
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
38
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>];
39
+ actions: EditorAnalyticsAPI;
40
+ }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>];
41
+ sharedState: import("@atlaskit/editor-plugin-collab-edit").CollabEditPluginSharedState;
42
+ actions: {
43
+ getAvatarColor: (str: string) => {
44
+ index: number;
45
+ color: import("@atlaskit/editor-common/collab").Color;
46
+ };
47
+ addInlineCommentMark: (props: {
48
+ from: number;
49
+ to: number;
50
+ mark: import("prosemirror-model").Mark;
51
+ }) => boolean;
52
+ };
53
+ }, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
54
+ pluginConfiguration?: {
55
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
56
+ } | undefined;
57
+ commands: {
58
+ updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
59
+ };
60
+ actions: {
61
+ applyViewModeStepAt: (tr: Transaction) => boolean;
62
+ };
63
+ }, {
64
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
65
+ } | undefined>>];
66
+ actions: {
67
+ stripNonExistingAnnotations: (slice: import("prosemirror-model").Slice, state: EditorState) => boolean | undefined;
68
+ };
69
+ }, import("../types").AnnotationProviders | undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
70
+ pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
71
+ sharedState: {
72
+ createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
73
+ attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
74
+ performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
75
+ };
76
+ dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
77
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
78
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
79
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>];
80
+ actions: EditorAnalyticsAPI;
81
+ }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
82
+ sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
83
+ dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"collabEdit", {
84
+ pluginConfiguration: import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions;
85
+ dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
86
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
87
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
88
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
89
+ pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
90
+ sharedState: {
91
+ createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
92
+ attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
93
+ performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
94
+ };
95
+ dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
96
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
97
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
98
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>];
99
+ actions: EditorAnalyticsAPI;
100
+ }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>];
101
+ sharedState: import("@atlaskit/editor-plugin-collab-edit").CollabEditPluginSharedState;
102
+ actions: {
103
+ getAvatarColor: (str: string) => {
104
+ index: number;
105
+ color: import("@atlaskit/editor-common/collab").Color;
106
+ };
107
+ addInlineCommentMark: (props: {
108
+ from: number;
109
+ to: number;
110
+ mark: import("prosemirror-model").Mark;
111
+ }) => boolean;
112
+ };
113
+ }, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
114
+ pluginConfiguration?: {
115
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
116
+ } | undefined;
117
+ commands: {
118
+ updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
119
+ };
120
+ actions: {
121
+ applyViewModeStepAt: (tr: Transaction) => boolean;
122
+ };
123
+ }, {
124
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
125
+ } | undefined>>]> | undefined) => (id: string) => (transaction: Transaction, state: EditorState) => Transaction;
7
126
  addOpenCloseAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, method?: INPUT_METHOD.SHORTCUT | INPUT_METHOD.TOOLBAR) => (transaction: Transaction, state: EditorState) => Transaction;
8
127
  addInsertAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
9
128
  addResolveAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (method?: RESOLVE_METHOD | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
@@ -9,7 +9,7 @@ export declare const closeComponent: () => Command;
9
9
  export declare const clearDirtyMark: () => Command;
10
10
  export declare const removeInlineCommentNearSelection: (id: string) => Command;
11
11
  export declare const setInlineCommentDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => Command;
12
- export declare const addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string) => Command;
12
+ export declare const addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI?: ExtractInjectionAPI<AnnotationPlugin> | undefined) => (id: string) => Command;
13
13
  export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
14
14
  export declare const setSelectedAnnotation: (id: string) => Command;
15
15
  export declare const createAnnotation: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI?: ExtractInjectionAPI<AnnotationPlugin> | undefined) => (id: string, annotationType?: AnnotationTypes) => Command;
@@ -3,7 +3,151 @@ import type { EditorAnalyticsAPI, RESOLVE_METHOD } from '@atlaskit/editor-common
3
3
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  declare const _default: {
5
5
  addAnnotationMark: (id: string) => (transaction: Transaction, state: EditorState) => Transaction;
6
- addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string) => (transaction: Transaction, state: EditorState) => Transaction;
6
+ addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI: import("@atlaskit/editor-common/types").PublicPluginAPI<[
7
+ import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"annotation", {
8
+ pluginConfiguration: import("../types").AnnotationProviders | undefined;
9
+ sharedState: import("..").InlineCommentPluginState | undefined;
10
+ dependencies: [
11
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
12
+ pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
13
+ sharedState: {
14
+ createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
15
+ attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
16
+ performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
17
+ };
18
+ dependencies: [
19
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
20
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
21
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
22
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>
23
+ ];
24
+ actions: EditorAnalyticsAPI;
25
+ }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>,
26
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
27
+ sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
28
+ dependencies: [
29
+ import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"collabEdit", {
30
+ pluginConfiguration: import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions;
31
+ dependencies: [
32
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
33
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
34
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
35
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>,
36
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
37
+ pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
38
+ sharedState: {
39
+ createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
40
+ attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
41
+ performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
42
+ };
43
+ dependencies: [
44
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
45
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
46
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
47
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>
48
+ ];
49
+ actions: EditorAnalyticsAPI;
50
+ }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>
51
+ ];
52
+ sharedState: import("@atlaskit/editor-plugin-collab-edit").CollabEditPluginSharedState;
53
+ actions: {
54
+ getAvatarColor: (str: string) => {
55
+ index: number;
56
+ color: import("@atlaskit/editor-common/collab").Color;
57
+ };
58
+ addInlineCommentMark: (props: {
59
+ from: number;
60
+ to: number;
61
+ mark: import("prosemirror-model").Mark;
62
+ }) => boolean;
63
+ };
64
+ }, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>
65
+ ];
66
+ pluginConfiguration?: {
67
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
68
+ } | undefined;
69
+ commands: {
70
+ updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
71
+ };
72
+ actions: {
73
+ applyViewModeStepAt: (tr: Transaction) => boolean;
74
+ };
75
+ }, {
76
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
77
+ } | undefined>>
78
+ ];
79
+ actions: {
80
+ stripNonExistingAnnotations: (slice: import("prosemirror-model").Slice, state: EditorState) => boolean | undefined;
81
+ };
82
+ }, import("../types").AnnotationProviders | undefined>,
83
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
84
+ pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
85
+ sharedState: {
86
+ createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
87
+ attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
88
+ performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
89
+ };
90
+ dependencies: [
91
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
92
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
93
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
94
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>
95
+ ];
96
+ actions: EditorAnalyticsAPI;
97
+ }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>,
98
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
99
+ sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
100
+ dependencies: [
101
+ import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"collabEdit", {
102
+ pluginConfiguration: import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions;
103
+ dependencies: [
104
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
105
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
106
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
107
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>,
108
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
109
+ pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
110
+ sharedState: {
111
+ createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
112
+ attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
113
+ performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
114
+ };
115
+ dependencies: [
116
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
117
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
118
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
119
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>
120
+ ];
121
+ actions: EditorAnalyticsAPI;
122
+ }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>
123
+ ];
124
+ sharedState: import("@atlaskit/editor-plugin-collab-edit").CollabEditPluginSharedState;
125
+ actions: {
126
+ getAvatarColor: (str: string) => {
127
+ index: number;
128
+ color: import("@atlaskit/editor-common/collab").Color;
129
+ };
130
+ addInlineCommentMark: (props: {
131
+ from: number;
132
+ to: number;
133
+ mark: import("prosemirror-model").Mark;
134
+ }) => boolean;
135
+ };
136
+ }, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>
137
+ ];
138
+ pluginConfiguration?: {
139
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
140
+ } | undefined;
141
+ commands: {
142
+ updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
143
+ };
144
+ actions: {
145
+ applyViewModeStepAt: (tr: Transaction) => boolean;
146
+ };
147
+ }, {
148
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
149
+ } | undefined>>
150
+ ]> | undefined) => (id: string) => (transaction: Transaction, state: EditorState) => Transaction;
7
151
  addOpenCloseAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, method?: INPUT_METHOD.SHORTCUT | INPUT_METHOD.TOOLBAR) => (transaction: Transaction, state: EditorState) => Transaction;
8
152
  addInsertAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
9
153
  addResolveAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (method?: RESOLVE_METHOD | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-schema": "^35.5.1",
36
- "@atlaskit/editor-common": "^77.3.0",
36
+ "@atlaskit/editor-common": "^77.4.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^0.4.0",
38
38
  "@atlaskit/editor-plugin-editor-viewmode": "^0.1.0",
39
39
  "@atlaskit/editor-prosemirror": "3.0.0",