@atlaskit/editor-plugin-annotation 0.1.3 → 0.3.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,23 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#69617](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69617) [`93f297b73c6f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/93f297b73c6f) - [ux] When in editor view mode, creating new comment with annotations plugin will send step to NCS provider
8
+
9
+ ## 0.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#68790](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68790) [`c6d8affc52d1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c6d8affc52d1) - Support maybeAdd plugins in usePreset. Add typing support for universal preset.
14
+
15
+ Now when using the editor API with the universal preset
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 0.1.3
4
22
 
5
23
  ### Patch Changes
@@ -8,11 +8,12 @@ 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");
11
12
  var _pluginFactory = require("../pm-plugins/plugin-factory");
12
13
  var _types = require("../pm-plugins/types");
13
14
  var _types2 = require("../types");
14
15
  var _utils = require("../utils");
15
- var _transform = _interopRequireDefault(require("./transform"));
16
+ var _transform2 = _interopRequireDefault(require("./transform"));
16
17
  var updateInlineCommentResolvedState = exports.updateInlineCommentResolvedState = function updateInlineCommentResolvedState(editorAnalyticsAPI) {
17
18
  return function (partialNewState, resolveMethod) {
18
19
  var command = {
@@ -23,7 +24,7 @@ var updateInlineCommentResolvedState = exports.updateInlineCommentResolvedState
23
24
  return state;
24
25
  });
25
26
  if (resolveMethod && allResolved) {
26
- return (0, _pluginFactory.createCommand)(command, _transform.default.addResolveAnalytics(editorAnalyticsAPI)(resolveMethod));
27
+ return (0, _pluginFactory.createCommand)(command, _transform2.default.addResolveAnalytics(editorAnalyticsAPI)(resolveMethod));
27
28
  }
28
29
  return (0, _pluginFactory.createCommand)(command);
29
30
  };
@@ -80,7 +81,7 @@ var setInlineCommentDraftState = exports.setInlineCommentDraftState = function s
80
81
  return function (drafting) {
81
82
  var inputMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _analytics.INPUT_METHOD.TOOLBAR;
82
83
  var commandAction = getDraftCommandAction(drafting);
83
- return (0, _pluginFactory.createCommand)(commandAction, _transform.default.addOpenCloseAnalytics(editorAnalyticsAPI)(drafting, inputMethod));
84
+ return (0, _pluginFactory.createCommand)(commandAction, _transform2.default.addOpenCloseAnalytics(editorAnalyticsAPI)(drafting, inputMethod));
84
85
  };
85
86
  };
86
87
  var addInlineComment = exports.addInlineComment = function addInlineComment(editorAnalyticsAPI) {
@@ -101,7 +102,7 @@ var addInlineComment = exports.addInlineComment = function addInlineComment(edit
101
102
  }
102
103
  };
103
104
  };
104
- return (0, _pluginFactory.createCommand)(commandAction, _transform.default.addInlineComment(editorAnalyticsAPI)(id));
105
+ return (0, _pluginFactory.createCommand)(commandAction, _transform2.default.addInlineComment(editorAnalyticsAPI)(id));
105
106
  };
106
107
  };
107
108
  var updateMouseState = exports.updateMouseState = function updateMouseState(mouseData) {
@@ -123,16 +124,40 @@ var setSelectedAnnotation = exports.setSelectedAnnotation = function setSelected
123
124
  }
124
125
  });
125
126
  };
126
- var createAnnotation = exports.createAnnotation = function createAnnotation(editorAnalyticsAPI) {
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
+ var createAnnotation = exports.createAnnotation = function createAnnotation(editorAnalyticsAPI, editorAPI) {
127
140
  return function (id) {
128
141
  var annotationType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _adfSchema.AnnotationTypes.INLINE_COMMENT;
129
142
  return function (state, dispatch) {
143
+ var _editorAPI$editorView;
130
144
  // don't try to add if there are is no temp highlight bookmarked
131
145
  var _ref = (0, _utils.getPluginState)(state) || {},
132
146
  bookmark = _ref.bookmark;
133
147
  if (!bookmark || !dispatch) {
134
148
  return false;
135
149
  }
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
+ }
136
161
  if (annotationType === _adfSchema.AnnotationTypes.INLINE_COMMENT) {
137
162
  return addInlineComment(editorAnalyticsAPI)(id)(state, dispatch);
138
163
  }
@@ -127,6 +127,7 @@ function AnnotationContentComponent(_ref4) {
127
127
  providers: annotationProviders,
128
128
  editorView: editorView,
129
129
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
130
- editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions
130
+ editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions,
131
+ editorAPI: api
131
132
  }));
132
133
  }
@@ -36,8 +36,10 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(editorAnalyticsA
36
36
  title: createCommentMessage,
37
37
  onClick: function onClick(state, dispatch) {
38
38
  return (0, _commands.setInlineCommentDraftState)(editorAnalyticsAPI)(true)(state, dispatch);
39
- }
39
+ },
40
+ supportsViewMode: true // TODO: MODES-3950 Clean up this floating toolbar view mode logic
40
41
  };
42
+
41
43
  var annotation = schema.marks.annotation;
42
44
  var validNodes = Object.keys(schema.nodes).reduce(function (acc, current) {
43
45
  var type = schema.nodes[current];
@@ -34,6 +34,7 @@ function InlineCommentView(_ref) {
34
34
  var providers = _ref.providers,
35
35
  editorView = _ref.editorView,
36
36
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
37
+ editorAPI = _ref.editorAPI,
37
38
  dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
38
39
  // As inlineComment is the only annotation present, this function is not generic
39
40
  var inlineCommentProvider = providers.inlineComment;
@@ -91,7 +92,7 @@ function InlineCommentView(_ref) {
91
92
  dom: dom,
92
93
  textSelection: textSelection,
93
94
  onCreate: function onCreate(id) {
94
- (0, _commands.createAnnotation)(editorAnalyticsAPI)(id)(editorView.state, editorView.dispatch);
95
+ (0, _commands.createAnnotation)(editorAnalyticsAPI, editorAPI)(id)(editorView.state, editorView.dispatch);
95
96
  !editorView.hasFocus() && editorView.focus();
96
97
  },
97
98
  onClose: function onClose() {
@@ -1,9 +1,10 @@
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';
3
4
  import { createCommand } from '../pm-plugins/plugin-factory';
4
5
  import { ACTIONS } from '../pm-plugins/types';
5
6
  import { AnnotationSelectionType } from '../types';
6
- import { getPluginState, isSelectionValid } from '../utils';
7
+ import { getPluginState, getSelectionPositions, isSelectionValid } from '../utils';
7
8
  import transform from './transform';
8
9
  export const updateInlineCommentResolvedState = editorAnalyticsAPI => (partialNewState, resolveMethod) => {
9
10
  const command = {
@@ -100,7 +101,19 @@ export const setSelectedAnnotation = id => createCommand({
100
101
  }]
101
102
  }
102
103
  });
103
- export const createAnnotation = editorAnalyticsAPI => (id, annotationType = AnnotationTypes.INLINE_COMMENT) => (state, dispatch) => {
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
+ export const createAnnotation = (editorAnalyticsAPI, editorAPI) => (id, annotationType = AnnotationTypes.INLINE_COMMENT) => (state, dispatch) => {
116
+ var _editorAPI$editorView, _editorAPI$editorView2, _editorAPI$editorView3;
104
117
  // don't try to add if there are is no temp highlight bookmarked
105
118
  const {
106
119
  bookmark
@@ -108,6 +121,17 @@ export const createAnnotation = editorAnalyticsAPI => (id, annotationType = Anno
108
121
  if (!bookmark || !dispatch) {
109
122
  return false;
110
123
  }
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
+ }
111
135
  if (annotationType === AnnotationTypes.INLINE_COMMENT) {
112
136
  return addInlineComment(editorAnalyticsAPI)(id)(state, dispatch);
113
137
  }
@@ -121,7 +121,8 @@ function AnnotationContentComponent({
121
121
  providers: annotationProviders,
122
122
  editorView: editorView,
123
123
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
124
- editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions
124
+ editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions,
125
+ editorAPI: api
125
126
  }));
126
127
  }
127
128
  export { AnnotationUpdateEmitter };
@@ -29,8 +29,10 @@ export const buildToolbar = editorAnalyticsAPI => (state, intl, isToolbarAbove =
29
29
  title: createCommentMessage,
30
30
  onClick: (state, dispatch) => {
31
31
  return setInlineCommentDraftState(editorAnalyticsAPI)(true)(state, dispatch);
32
- }
32
+ },
33
+ supportsViewMode: true // TODO: MODES-3950 Clean up this floating toolbar view mode logic
33
34
  };
35
+
34
36
  const {
35
37
  annotation
36
38
  } = schema.marks;
@@ -26,6 +26,7 @@ export function InlineCommentView({
26
26
  providers,
27
27
  editorView,
28
28
  editorAnalyticsAPI,
29
+ editorAPI,
29
30
  dispatchAnalyticsEvent
30
31
  }) {
31
32
  // As inlineComment is the only annotation present, this function is not generic
@@ -91,7 +92,7 @@ export function InlineCommentView({
91
92
  dom: dom,
92
93
  textSelection: textSelection,
93
94
  onCreate: id => {
94
- createAnnotation(editorAnalyticsAPI)(id)(editorView.state, editorView.dispatch);
95
+ createAnnotation(editorAnalyticsAPI, editorAPI)(id)(editorView.state, editorView.dispatch);
95
96
  !editorView.hasFocus() && editorView.focus();
96
97
  },
97
98
  onClose: () => {
@@ -1,10 +1,11 @@
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';
4
5
  import { createCommand } from '../pm-plugins/plugin-factory';
5
6
  import { ACTIONS } from '../pm-plugins/types';
6
7
  import { AnnotationSelectionType } from '../types';
7
- import { getPluginState, isSelectionValid } from '../utils';
8
+ import { getPluginState, getSelectionPositions, isSelectionValid } from '../utils';
8
9
  import transform from './transform';
9
10
  export var updateInlineCommentResolvedState = function updateInlineCommentResolvedState(editorAnalyticsAPI) {
10
11
  return function (partialNewState, resolveMethod) {
@@ -116,16 +117,40 @@ export var setSelectedAnnotation = function setSelectedAnnotation(id) {
116
117
  }
117
118
  });
118
119
  };
119
- export var createAnnotation = function createAnnotation(editorAnalyticsAPI) {
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
+ export var createAnnotation = function createAnnotation(editorAnalyticsAPI, editorAPI) {
120
133
  return function (id) {
121
134
  var annotationType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : AnnotationTypes.INLINE_COMMENT;
122
135
  return function (state, dispatch) {
136
+ var _editorAPI$editorView;
123
137
  // don't try to add if there are is no temp highlight bookmarked
124
138
  var _ref = getPluginState(state) || {},
125
139
  bookmark = _ref.bookmark;
126
140
  if (!bookmark || !dispatch) {
127
141
  return false;
128
142
  }
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
+ }
129
154
  if (annotationType === AnnotationTypes.INLINE_COMMENT) {
130
155
  return addInlineComment(editorAnalyticsAPI)(id)(state, dispatch);
131
156
  }
@@ -114,7 +114,8 @@ function AnnotationContentComponent(_ref4) {
114
114
  providers: annotationProviders,
115
115
  editorView: editorView,
116
116
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
117
- editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions
117
+ editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions,
118
+ editorAPI: api
118
119
  }));
119
120
  }
120
121
  export { AnnotationUpdateEmitter };
@@ -29,8 +29,10 @@ export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
29
29
  title: createCommentMessage,
30
30
  onClick: function onClick(state, dispatch) {
31
31
  return setInlineCommentDraftState(editorAnalyticsAPI)(true)(state, dispatch);
32
- }
32
+ },
33
+ supportsViewMode: true // TODO: MODES-3950 Clean up this floating toolbar view mode logic
33
34
  };
35
+
34
36
  var annotation = schema.marks.annotation;
35
37
  var validNodes = Object.keys(schema.nodes).reduce(function (acc, current) {
36
38
  var type = schema.nodes[current];
@@ -27,6 +27,7 @@ export function InlineCommentView(_ref) {
27
27
  var providers = _ref.providers,
28
28
  editorView = _ref.editorView,
29
29
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
30
+ editorAPI = _ref.editorAPI,
30
31
  dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
31
32
  // As inlineComment is the only annotation present, this function is not generic
32
33
  var inlineCommentProvider = providers.inlineComment;
@@ -84,7 +85,7 @@ export function InlineCommentView(_ref) {
84
85
  dom: dom,
85
86
  textSelection: textSelection,
86
87
  onCreate: function onCreate(id) {
87
- createAnnotation(editorAnalyticsAPI)(id)(editorView.state, editorView.dispatch);
88
+ createAnnotation(editorAnalyticsAPI, editorAPI)(id)(editorView.state, editorView.dispatch);
88
89
  !editorView.hasFocus() && editorView.focus();
89
90
  },
90
91
  onClose: function onClose() {
@@ -1,8 +1,9 @@
1
1
  import { AnnotationTypes } from '@atlaskit/adf-schema';
2
2
  import type { EditorAnalyticsAPI, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import type { Command } from '@atlaskit/editor-common/types';
4
+ import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
5
  import type { InlineCommentMap, InlineCommentMouseData } from '../pm-plugins/types';
6
+ import type { AnnotationPlugin } from '../types';
6
7
  export declare const updateInlineCommentResolvedState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (partialNewState: InlineCommentMap, resolveMethod?: RESOLVE_METHOD) => Command;
7
8
  export declare const closeComponent: () => Command;
8
9
  export declare const clearDirtyMark: () => Command;
@@ -11,5 +12,5 @@ export declare const setInlineCommentDraftState: (editorAnalyticsAPI: EditorAnal
11
12
  export declare const addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string) => Command;
12
13
  export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
13
14
  export declare const setSelectedAnnotation: (id: string) => Command;
14
- export declare const createAnnotation: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string, annotationType?: AnnotationTypes) => Command;
15
+ export declare const createAnnotation: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI?: ExtractInjectionAPI<AnnotationPlugin> | undefined) => (id: string, annotationType?: AnnotationTypes) => Command;
15
16
  export declare const setInlineCommentsVisibility: (isVisible: boolean) => Command;
@@ -3,6 +3,7 @@ import type { AnnotationTypes } from '@atlaskit/adf-schema';
3
3
  import type { AnnotationUpdateEmitter } from '@atlaskit/editor-common/annotation';
4
4
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
5
5
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
6
+ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
6
7
  import type { Slice } from '@atlaskit/editor-prosemirror/model';
7
8
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
8
9
  import type { InlineCommentPluginState } from './pm-plugins/types';
@@ -10,7 +11,10 @@ type StripNonExistingAnnotations = (slice: Slice, state: EditorState) => boolean
10
11
  export type AnnotationPlugin = NextEditorPlugin<'annotation', {
11
12
  pluginConfiguration: AnnotationProviders | undefined;
12
13
  sharedState: InlineCommentPluginState | undefined;
13
- dependencies: [OptionalPlugin<AnalyticsPlugin>];
14
+ dependencies: [
15
+ OptionalPlugin<AnalyticsPlugin>,
16
+ OptionalPlugin<EditorViewModePlugin>
17
+ ];
14
18
  actions: {
15
19
  stripNonExistingAnnotations: StripNonExistingAnnotations;
16
20
  };
@@ -1,12 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import type { AnnotationProviders } from '../types';
5
+ import type { AnnotationPlugin, AnnotationProviders } from '../types';
5
6
  interface InlineCommentViewProps {
6
7
  providers: AnnotationProviders;
7
8
  editorView: EditorView;
8
9
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
10
+ editorAPI: ExtractInjectionAPI<AnnotationPlugin> | undefined;
9
11
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
10
12
  }
11
- export declare function InlineCommentView({ providers, editorView, editorAnalyticsAPI, dispatchAnalyticsEvent, }: InlineCommentViewProps): JSX.Element | null;
13
+ export declare function InlineCommentView({ providers, editorView, editorAnalyticsAPI, editorAPI, dispatchAnalyticsEvent, }: InlineCommentViewProps): JSX.Element | null;
12
14
  export {};
@@ -1,8 +1,9 @@
1
1
  import { AnnotationTypes } from '@atlaskit/adf-schema';
2
2
  import type { EditorAnalyticsAPI, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import type { Command } from '@atlaskit/editor-common/types';
4
+ import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
5
  import type { InlineCommentMap, InlineCommentMouseData } from '../pm-plugins/types';
6
+ import type { AnnotationPlugin } from '../types';
6
7
  export declare const updateInlineCommentResolvedState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (partialNewState: InlineCommentMap, resolveMethod?: RESOLVE_METHOD) => Command;
7
8
  export declare const closeComponent: () => Command;
8
9
  export declare const clearDirtyMark: () => Command;
@@ -11,5 +12,5 @@ export declare const setInlineCommentDraftState: (editorAnalyticsAPI: EditorAnal
11
12
  export declare const addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string) => Command;
12
13
  export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
13
14
  export declare const setSelectedAnnotation: (id: string) => Command;
14
- export declare const createAnnotation: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string, annotationType?: AnnotationTypes) => Command;
15
+ export declare const createAnnotation: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI?: ExtractInjectionAPI<AnnotationPlugin> | undefined) => (id: string, annotationType?: AnnotationTypes) => Command;
15
16
  export declare const setInlineCommentsVisibility: (isVisible: boolean) => Command;
@@ -3,6 +3,7 @@ import type { AnnotationTypes } from '@atlaskit/adf-schema';
3
3
  import type { AnnotationUpdateEmitter } from '@atlaskit/editor-common/annotation';
4
4
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
5
5
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
6
+ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
6
7
  import type { Slice } from '@atlaskit/editor-prosemirror/model';
7
8
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
8
9
  import type { InlineCommentPluginState } from './pm-plugins/types';
@@ -11,7 +12,8 @@ export type AnnotationPlugin = NextEditorPlugin<'annotation', {
11
12
  pluginConfiguration: AnnotationProviders | undefined;
12
13
  sharedState: InlineCommentPluginState | undefined;
13
14
  dependencies: [
14
- OptionalPlugin<AnalyticsPlugin>
15
+ OptionalPlugin<AnalyticsPlugin>,
16
+ OptionalPlugin<EditorViewModePlugin>
15
17
  ];
16
18
  actions: {
17
19
  stripNonExistingAnnotations: StripNonExistingAnnotations;
@@ -1,12 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import type { AnnotationProviders } from '../types';
5
+ import type { AnnotationPlugin, AnnotationProviders } from '../types';
5
6
  interface InlineCommentViewProps {
6
7
  providers: AnnotationProviders;
7
8
  editorView: EditorView;
8
9
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
10
+ editorAPI: ExtractInjectionAPI<AnnotationPlugin> | undefined;
9
11
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
10
12
  }
11
- export declare function InlineCommentView({ providers, editorView, editorAnalyticsAPI, dispatchAnalyticsEvent, }: InlineCommentViewProps): JSX.Element | null;
13
+ export declare function InlineCommentView({ providers, editorView, editorAnalyticsAPI, editorAPI, dispatchAnalyticsEvent, }: InlineCommentViewProps): JSX.Element | null;
12
14
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "0.1.3",
3
+ "version": "0.3.0",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,8 +33,9 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-schema": "^35.3.0",
36
- "@atlaskit/editor-common": "^77.0.0",
36
+ "@atlaskit/editor-common": "^77.1.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^0.4.0",
38
+ "@atlaskit/editor-plugin-editor-viewmode": "^0.1.0",
38
39
  "@atlaskit/editor-prosemirror": "1.1.0",
39
40
  "@atlaskit/icon": "^22.0.0",
40
41
  "@atlaskit/platform-feature-flags": "^0.2.0",