@atlaskit/editor-plugin-annotation 1.10.3 → 1.11.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,55 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 1.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#112275](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/112275)
8
+ [`6f3058e0347a3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6f3058e0347a3) -
9
+ ED-23734 - add `getInlineNodeTypes` function to `InlineCommentViewComponentProps`
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 1.10.4
16
+
17
+ ### Patch Changes
18
+
19
+ - [#108237](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/108237)
20
+ [`ea7dd8ebb249e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ea7dd8ebb249e) -
21
+ Split out side-effects from viewmode plugin to seperate plugin to reduce cyclical dependency risk
22
+
23
+ # WHAT
24
+
25
+ - Remove `createFilterStepsPlugin` from the editorViewMode Plugin and is implemented in
26
+ editorViewModeEffects instead.
27
+ - Remove `appendTransaction` from the editorViewMode plugin and add as a new PMPlugin in
28
+ editorViewModeEffects
29
+ - `applyViewModeStepAt` is moved to editorViewModeEffects. This is currently only used in
30
+ Annotation plugin which now consumes the new plugin instead and has a minor bump.
31
+
32
+ # WHY
33
+
34
+ ViewMode information is needed for upstream work in the CollabEdit plugin (see ED-23466).
35
+ Currently the viewMode plugin already depends on CollabEdit and as such implementing new work
36
+ causes a cylical dependency problem. ViewMode is likely to be required in an increasing number of
37
+ plugins and ideally should be as pure as possible with no dependencies. A larger rethink of how
38
+ these plugins fit together may be required but that is outside the scope of this change.
39
+
40
+ # HOW
41
+
42
+ All incompatibilities should be addressed within this changeset, however for the sake of
43
+ completeness:
44
+
45
+ - `editor-plugin-editor-viewmode-effects` must be added to any preset that relies on the viewmode
46
+ filter steps plugin for viewmode annotations. Currently this seems to only be the confluence
47
+ editor itself.
48
+ - `applyViewModeStepAt` should now be called from the `editorViewModeEffects` plugin. This will
49
+ need to be added to your plugin types independently (all uses covered by this change)
50
+
51
+ - Updated dependencies
52
+
3
53
  ## 1.10.3
4
54
 
5
55
  ### Patch Changes
@@ -44,7 +44,7 @@ var addInlineComment = function addInlineComment(editorAnalyticsAPI, editorAPI)
44
44
  return function (transaction, state) {
45
45
  var _editorAPI$editorView, _pluginState$featureF;
46
46
  var tr = addAnnotationMark(id, supportedBlockNodes)(transaction, state);
47
- editorAPI === null || editorAPI === void 0 || (_editorAPI$editorView = editorAPI.editorViewMode) === null || _editorAPI$editorView === void 0 || _editorAPI$editorView.actions.applyViewModeStepAt(tr);
47
+ editorAPI === null || editorAPI === void 0 || (_editorAPI$editorView = editorAPI.editorViewModeEffects) === null || _editorAPI$editorView === void 0 || _editorAPI$editorView.actions.applyViewModeStepAt(tr);
48
48
 
49
49
  // add insert analytics step to transaction
50
50
  tr = addInsertAnalytics(editorAnalyticsAPI)(tr, state);
@@ -79,16 +79,16 @@ function InlineCommentView(_ref) {
79
79
  if (!dom) {
80
80
  return null;
81
81
  }
82
- var inlineNodeTypes = (0, _utils.getRangeInlineNodeNames)({
83
- doc: state.doc,
84
- pos: selection
85
- });
86
82
 
87
83
  // Create Component
88
84
  if (bookmark) {
89
85
  if (!CreateComponent) {
90
86
  return null;
91
87
  }
88
+ var inlineNodeTypes = (0, _utils.getRangeInlineNodeNames)({
89
+ doc: state.doc,
90
+ pos: selection
91
+ });
92
92
 
93
93
  //getting all text between bookmarked positions
94
94
  var textSelection = state.doc.textBetween(selection.from, selection.to);
@@ -145,6 +145,13 @@ function InlineCommentView(_ref) {
145
145
  if (isInlineCommentViewClosed || !selectedAnnotations) {
146
146
  return null;
147
147
  }
148
+
149
+ // For view mode, the finding of inline node types is a bit more complex,
150
+ // that's why we will not provide it as a `inlineNodeTypes` props to the view component,
151
+ // to speed up the rendering process.
152
+ var getInlineNodeTypes = function getInlineNodeTypes(annotationId) {
153
+ return (0, _utils.getAnnotationInlineNodeTypes)(editorView.state, annotationId);
154
+ };
148
155
  return /*#__PURE__*/_react.default.createElement(_AnnotationViewWrapper.AnnotationViewWrapper, {
149
156
  "data-editor-popup": "true",
150
157
  "data-testid": _types.AnnotationTestIds.floatingComponent,
@@ -153,7 +160,7 @@ function InlineCommentView(_ref) {
153
160
  }, /*#__PURE__*/_react.default.createElement(ViewComponent, {
154
161
  annotationsList: annotationsList,
155
162
  annotations: activeAnnotations,
156
- inlineNodeTypes: inlineNodeTypes,
163
+ getInlineNodeTypes: getInlineNodeTypes,
157
164
  dom: dom,
158
165
  onDelete: function onDelete(id) {
159
166
  return (0, _commands.removeInlineCommentNearSelection)(id, inlineCommentProvider.supportedBlockNodes)(state, dispatch);
@@ -36,7 +36,7 @@ const addAnnotationMark = (id, supportedBlockNodes) => (transaction, state) => {
36
36
  const addInlineComment = (editorAnalyticsAPI, editorAPI) => (id, supportedBlockNodes) => (transaction, state) => {
37
37
  var _editorAPI$editorView, _pluginState$featureF;
38
38
  let tr = addAnnotationMark(id, supportedBlockNodes)(transaction, state);
39
- editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$editorView = editorAPI.editorViewMode) === null || _editorAPI$editorView === void 0 ? void 0 : _editorAPI$editorView.actions.applyViewModeStepAt(tr);
39
+ editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$editorView = editorAPI.editorViewModeEffects) === null || _editorAPI$editorView === void 0 ? void 0 : _editorAPI$editorView.actions.applyViewModeStepAt(tr);
40
40
 
41
41
  // add insert analytics step to transaction
42
42
  tr = addInsertAnalytics(editorAnalyticsAPI)(tr, state);
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { AnnotationTypes } from '@atlaskit/adf-schema';
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, CONTENT_COMPONENT, EVENT_TYPE, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { getRangeInlineNodeNames } from '@atlaskit/editor-common/utils';
4
+ import { getAnnotationInlineNodeTypes, getRangeInlineNodeNames } from '@atlaskit/editor-common/utils';
5
5
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
6
6
  import { closeComponent, createAnnotation, removeInlineCommentNearSelection, setInlineCommentDraftState, updateInlineCommentResolvedState } from '../commands';
7
7
  import { AnnotationTestIds } from '../types';
@@ -77,16 +77,16 @@ export function InlineCommentView({
77
77
  if (!dom) {
78
78
  return null;
79
79
  }
80
- const inlineNodeTypes = getRangeInlineNodeNames({
81
- doc: state.doc,
82
- pos: selection
83
- });
84
80
 
85
81
  // Create Component
86
82
  if (bookmark) {
87
83
  if (!CreateComponent) {
88
84
  return null;
89
85
  }
86
+ const inlineNodeTypes = getRangeInlineNodeNames({
87
+ doc: state.doc,
88
+ pos: selection
89
+ });
90
90
 
91
91
  //getting all text between bookmarked positions
92
92
  const textSelection = state.doc.textBetween(selection.from, selection.to);
@@ -143,6 +143,11 @@ export function InlineCommentView({
143
143
  if (isInlineCommentViewClosed || !selectedAnnotations) {
144
144
  return null;
145
145
  }
146
+
147
+ // For view mode, the finding of inline node types is a bit more complex,
148
+ // that's why we will not provide it as a `inlineNodeTypes` props to the view component,
149
+ // to speed up the rendering process.
150
+ const getInlineNodeTypes = annotationId => getAnnotationInlineNodeTypes(editorView.state, annotationId);
146
151
  return /*#__PURE__*/React.createElement(AnnotationViewWrapper, {
147
152
  "data-editor-popup": "true",
148
153
  "data-testid": AnnotationTestIds.floatingComponent,
@@ -151,7 +156,7 @@ export function InlineCommentView({
151
156
  }, /*#__PURE__*/React.createElement(ViewComponent, {
152
157
  annotationsList: annotationsList,
153
158
  annotations: activeAnnotations,
154
- inlineNodeTypes: inlineNodeTypes,
159
+ getInlineNodeTypes: getInlineNodeTypes,
155
160
  dom: dom,
156
161
  onDelete: id => removeInlineCommentNearSelection(id, inlineCommentProvider.supportedBlockNodes)(state, dispatch),
157
162
  onResolve: id => updateInlineCommentResolvedState(editorAnalyticsAPI)({
@@ -38,7 +38,7 @@ var addInlineComment = function addInlineComment(editorAnalyticsAPI, editorAPI)
38
38
  return function (transaction, state) {
39
39
  var _editorAPI$editorView, _pluginState$featureF;
40
40
  var tr = addAnnotationMark(id, supportedBlockNodes)(transaction, state);
41
- editorAPI === null || editorAPI === void 0 || (_editorAPI$editorView = editorAPI.editorViewMode) === null || _editorAPI$editorView === void 0 || _editorAPI$editorView.actions.applyViewModeStepAt(tr);
41
+ editorAPI === null || editorAPI === void 0 || (_editorAPI$editorView = editorAPI.editorViewModeEffects) === null || _editorAPI$editorView === void 0 || _editorAPI$editorView.actions.applyViewModeStepAt(tr);
42
42
 
43
43
  // add insert analytics step to transaction
44
44
  tr = addInsertAnalytics(editorAnalyticsAPI)(tr, state);
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import React from 'react';
5
5
  import { AnnotationTypes } from '@atlaskit/adf-schema';
6
6
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, CONTENT_COMPONENT, EVENT_TYPE, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
7
- import { getRangeInlineNodeNames } from '@atlaskit/editor-common/utils';
7
+ import { getAnnotationInlineNodeTypes, getRangeInlineNodeNames } from '@atlaskit/editor-common/utils';
8
8
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
9
9
  import { closeComponent, createAnnotation, removeInlineCommentNearSelection, setInlineCommentDraftState, updateInlineCommentResolvedState } from '../commands';
10
10
  import { AnnotationTestIds } from '../types';
@@ -72,16 +72,16 @@ export function InlineCommentView(_ref) {
72
72
  if (!dom) {
73
73
  return null;
74
74
  }
75
- var inlineNodeTypes = getRangeInlineNodeNames({
76
- doc: state.doc,
77
- pos: selection
78
- });
79
75
 
80
76
  // Create Component
81
77
  if (bookmark) {
82
78
  if (!CreateComponent) {
83
79
  return null;
84
80
  }
81
+ var inlineNodeTypes = getRangeInlineNodeNames({
82
+ doc: state.doc,
83
+ pos: selection
84
+ });
85
85
 
86
86
  //getting all text between bookmarked positions
87
87
  var textSelection = state.doc.textBetween(selection.from, selection.to);
@@ -138,6 +138,13 @@ export function InlineCommentView(_ref) {
138
138
  if (isInlineCommentViewClosed || !selectedAnnotations) {
139
139
  return null;
140
140
  }
141
+
142
+ // For view mode, the finding of inline node types is a bit more complex,
143
+ // that's why we will not provide it as a `inlineNodeTypes` props to the view component,
144
+ // to speed up the rendering process.
145
+ var getInlineNodeTypes = function getInlineNodeTypes(annotationId) {
146
+ return getAnnotationInlineNodeTypes(editorView.state, annotationId);
147
+ };
141
148
  return /*#__PURE__*/React.createElement(AnnotationViewWrapper, {
142
149
  "data-editor-popup": "true",
143
150
  "data-testid": AnnotationTestIds.floatingComponent,
@@ -146,7 +153,7 @@ export function InlineCommentView(_ref) {
146
153
  }, /*#__PURE__*/React.createElement(ViewComponent, {
147
154
  annotationsList: annotationsList,
148
155
  annotations: activeAnnotations,
149
- inlineNodeTypes: inlineNodeTypes,
156
+ getInlineNodeTypes: getInlineNodeTypes,
150
157
  dom: dom,
151
158
  onDelete: function onDelete(id) {
152
159
  return removeInlineCommentNearSelection(id, inlineCommentProvider.supportedBlockNodes)(state, dispatch);
@@ -18,8 +18,7 @@ declare const _default: {
18
18
  sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
19
19
  }, import("@atlaskit/editor-common/types").FeatureFlags>>];
20
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;
21
+ }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewModeEffects", {
23
22
  dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"collabEdit", {
24
23
  pluginConfiguration: import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions;
25
24
  dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
@@ -37,7 +36,18 @@ declare const _default: {
37
36
  sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
38
37
  }, import("@atlaskit/editor-common/types").FeatureFlags>>];
39
38
  actions: EditorAnalyticsAPI;
40
- }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>];
39
+ }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
40
+ sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
41
+ dependencies: [];
42
+ pluginConfiguration?: {
43
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
44
+ } | undefined;
45
+ commands: {
46
+ updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
47
+ };
48
+ }, {
49
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
50
+ } | undefined>>];
41
51
  sharedState: import("@atlaskit/editor-plugin-collab-edit").CollabEditPluginSharedState;
42
52
  actions: {
43
53
  getAvatarColor: (str: string) => {
@@ -55,19 +65,22 @@ declare const _default: {
55
65
  }) => boolean;
56
66
  isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
57
67
  };
58
- }, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
59
- pluginConfiguration?: {
68
+ }, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
69
+ sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
70
+ dependencies: [];
71
+ pluginConfiguration?: {
72
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
73
+ } | undefined;
74
+ commands: {
75
+ updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
76
+ };
77
+ }, {
60
78
  mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
61
- } | undefined;
62
- commands: {
63
- updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
64
- };
79
+ } | undefined>];
65
80
  actions: {
66
81
  applyViewModeStepAt: (tr: Transaction) => boolean;
67
82
  };
68
- }, {
69
- mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
70
- } | undefined>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
83
+ }, undefined>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
71
84
  pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
72
85
  sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
73
86
  }, import("@atlaskit/editor-common/types").FeatureFlags>>];
@@ -88,8 +101,7 @@ declare const _default: {
88
101
  sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
89
102
  }, import("@atlaskit/editor-common/types").FeatureFlags>>];
90
103
  actions: EditorAnalyticsAPI;
91
- }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
92
- sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
104
+ }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewModeEffects", {
93
105
  dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"collabEdit", {
94
106
  pluginConfiguration: import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions;
95
107
  dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
@@ -107,7 +119,18 @@ declare const _default: {
107
119
  sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
108
120
  }, import("@atlaskit/editor-common/types").FeatureFlags>>];
109
121
  actions: EditorAnalyticsAPI;
110
- }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>];
122
+ }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
123
+ sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
124
+ dependencies: [];
125
+ pluginConfiguration?: {
126
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
127
+ } | undefined;
128
+ commands: {
129
+ updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
130
+ };
131
+ }, {
132
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
133
+ } | undefined>>];
111
134
  sharedState: import("@atlaskit/editor-plugin-collab-edit").CollabEditPluginSharedState;
112
135
  actions: {
113
136
  getAvatarColor: (str: string) => {
@@ -125,19 +148,22 @@ declare const _default: {
125
148
  }) => boolean;
126
149
  isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
127
150
  };
128
- }, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
129
- pluginConfiguration?: {
151
+ }, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
152
+ sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
153
+ dependencies: [];
154
+ pluginConfiguration?: {
155
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
156
+ } | undefined;
157
+ commands: {
158
+ updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
159
+ };
160
+ }, {
130
161
  mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
131
- } | undefined;
132
- commands: {
133
- updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
134
- };
162
+ } | undefined>];
135
163
  actions: {
136
164
  applyViewModeStepAt: (tr: Transaction) => boolean;
137
165
  };
138
- }, {
139
- mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
140
- } | undefined>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
166
+ }, undefined>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
141
167
  pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
142
168
  sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
143
169
  }, import("@atlaskit/editor-common/types").FeatureFlags>>]> | undefined) => (id: string, supportedBlockNodes?: string[] | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
@@ -4,7 +4,7 @@ import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import type { AnnotationUpdateEmitter } from '@atlaskit/editor-common/annotation';
5
5
  import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
6
6
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
7
- import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
7
+ import type { EditorViewModeEffectsPlugin } from '@atlaskit/editor-plugin-editor-viewmode-effects';
8
8
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
9
9
  import type { Slice } from '@atlaskit/editor-prosemirror/model';
10
10
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
@@ -30,7 +30,7 @@ export type AnnotationPlugin = NextEditorPlugin<'annotation', {
30
30
  sharedState: InlineCommentPluginState | undefined;
31
31
  dependencies: [
32
32
  OptionalPlugin<AnalyticsPlugin>,
33
- OptionalPlugin<EditorViewModePlugin>,
33
+ OptionalPlugin<EditorViewModeEffectsPlugin>,
34
34
  OptionalPlugin<FeatureFlagsPlugin>
35
35
  ];
36
36
  actions: {
@@ -61,14 +61,14 @@ type AnnotationComponentProps = {
61
61
  * Indicates that a draft comment was discarded/cancelled
62
62
  */
63
63
  onClose?: () => void;
64
- /** List of inline node types, which are wrapped by the annotation. */
65
- inlineNodeTypes: string[] | undefined;
66
64
  };
67
65
  export type InlineCommentCreateComponentProps = AnnotationComponentProps & {
68
66
  /**
69
67
  * Creates an annotation mark in the document with the given id.
70
68
  */
71
69
  onCreate: (id: string) => void;
70
+ /** List of inline node types, which are wrapped by the annotation. */
71
+ inlineNodeTypes: string[] | undefined;
72
72
  };
73
73
  export type InlineCommentViewComponentProps = AnnotationComponentProps & {
74
74
  /**
@@ -88,6 +88,16 @@ export type InlineCommentViewComponentProps = AnnotationComponentProps & {
88
88
  * Ordered list of annotation ids as shown in the document
89
89
  */
90
90
  annotationsList?: string[];
91
+ /**
92
+ * Return a list of inline node types, which are wrapped by the annotation,
93
+ * for annotation with given ID.
94
+ *
95
+ * The `undefined` will be returned if `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is off.
96
+ *
97
+ * @todo: Do not forget to remove `undefined` when the
98
+ * `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is removed.
99
+ */
100
+ getInlineNodeTypes: (annotationId: string) => string[] | undefined;
91
101
  };
92
102
  export interface AnnotationState<Type, State> {
93
103
  annotationType: Type;
@@ -23,8 +23,7 @@ declare const _default: {
23
23
  ];
24
24
  actions: EditorAnalyticsAPI;
25
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;
26
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewModeEffects", {
28
27
  dependencies: [
29
28
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"collabEdit", {
30
29
  pluginConfiguration: import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions;
@@ -47,7 +46,20 @@ declare const _default: {
47
46
  }, import("@atlaskit/editor-common/types").FeatureFlags>>
48
47
  ];
49
48
  actions: EditorAnalyticsAPI;
50
- }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>
49
+ }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>,
50
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
51
+ sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
52
+ dependencies: [
53
+ ];
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
+ }, {
61
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
62
+ } | undefined>>
51
63
  ];
52
64
  sharedState: import("@atlaskit/editor-plugin-collab-edit").CollabEditPluginSharedState;
53
65
  actions: {
@@ -66,20 +78,25 @@ declare const _default: {
66
78
  }) => boolean;
67
79
  isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
68
80
  };
69
- }, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>
81
+ }, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>,
82
+ import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
83
+ sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
84
+ dependencies: [
85
+ ];
86
+ pluginConfiguration?: {
87
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
88
+ } | undefined;
89
+ commands: {
90
+ updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
91
+ };
92
+ }, {
93
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
94
+ } | undefined>
70
95
  ];
71
- pluginConfiguration?: {
72
- mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
73
- } | undefined;
74
- commands: {
75
- updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
76
- };
77
96
  actions: {
78
97
  applyViewModeStepAt: (tr: Transaction) => boolean;
79
98
  };
80
- }, {
81
- mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
82
- } | undefined>>,
99
+ }, undefined>>,
83
100
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
84
101
  pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
85
102
  sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
@@ -106,8 +123,7 @@ declare const _default: {
106
123
  ];
107
124
  actions: EditorAnalyticsAPI;
108
125
  }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>,
109
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
110
- sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
126
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewModeEffects", {
111
127
  dependencies: [
112
128
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"collabEdit", {
113
129
  pluginConfiguration: import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions;
@@ -130,7 +146,20 @@ declare const _default: {
130
146
  }, import("@atlaskit/editor-common/types").FeatureFlags>>
131
147
  ];
132
148
  actions: EditorAnalyticsAPI;
133
- }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>
149
+ }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>,
150
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
151
+ sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
152
+ dependencies: [
153
+ ];
154
+ pluginConfiguration?: {
155
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
156
+ } | undefined;
157
+ commands: {
158
+ updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
159
+ };
160
+ }, {
161
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
162
+ } | undefined>>
134
163
  ];
135
164
  sharedState: import("@atlaskit/editor-plugin-collab-edit").CollabEditPluginSharedState;
136
165
  actions: {
@@ -149,20 +178,25 @@ declare const _default: {
149
178
  }) => boolean;
150
179
  isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
151
180
  };
152
- }, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>
181
+ }, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>,
182
+ import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
183
+ sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
184
+ dependencies: [
185
+ ];
186
+ pluginConfiguration?: {
187
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
188
+ } | undefined;
189
+ commands: {
190
+ updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
191
+ };
192
+ }, {
193
+ mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
194
+ } | undefined>
153
195
  ];
154
- pluginConfiguration?: {
155
- mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
156
- } | undefined;
157
- commands: {
158
- updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
159
- };
160
196
  actions: {
161
197
  applyViewModeStepAt: (tr: Transaction) => boolean;
162
198
  };
163
- }, {
164
- mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
165
- } | undefined>>,
199
+ }, undefined>>,
166
200
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
167
201
  pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
168
202
  sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
@@ -4,7 +4,7 @@ import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import type { AnnotationUpdateEmitter } from '@atlaskit/editor-common/annotation';
5
5
  import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
6
6
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
7
- import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
7
+ import type { EditorViewModeEffectsPlugin } from '@atlaskit/editor-plugin-editor-viewmode-effects';
8
8
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
9
9
  import type { Slice } from '@atlaskit/editor-prosemirror/model';
10
10
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
@@ -30,7 +30,7 @@ export type AnnotationPlugin = NextEditorPlugin<'annotation', {
30
30
  sharedState: InlineCommentPluginState | undefined;
31
31
  dependencies: [
32
32
  OptionalPlugin<AnalyticsPlugin>,
33
- OptionalPlugin<EditorViewModePlugin>,
33
+ OptionalPlugin<EditorViewModeEffectsPlugin>,
34
34
  OptionalPlugin<FeatureFlagsPlugin>
35
35
  ];
36
36
  actions: {
@@ -61,14 +61,14 @@ type AnnotationComponentProps = {
61
61
  * Indicates that a draft comment was discarded/cancelled
62
62
  */
63
63
  onClose?: () => void;
64
- /** List of inline node types, which are wrapped by the annotation. */
65
- inlineNodeTypes: string[] | undefined;
66
64
  };
67
65
  export type InlineCommentCreateComponentProps = AnnotationComponentProps & {
68
66
  /**
69
67
  * Creates an annotation mark in the document with the given id.
70
68
  */
71
69
  onCreate: (id: string) => void;
70
+ /** List of inline node types, which are wrapped by the annotation. */
71
+ inlineNodeTypes: string[] | undefined;
72
72
  };
73
73
  export type InlineCommentViewComponentProps = AnnotationComponentProps & {
74
74
  /**
@@ -88,6 +88,16 @@ export type InlineCommentViewComponentProps = AnnotationComponentProps & {
88
88
  * Ordered list of annotation ids as shown in the document
89
89
  */
90
90
  annotationsList?: string[];
91
+ /**
92
+ * Return a list of inline node types, which are wrapped by the annotation,
93
+ * for annotation with given ID.
94
+ *
95
+ * The `undefined` will be returned if `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is off.
96
+ *
97
+ * @todo: Do not forget to remove `undefined` when the
98
+ * `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is removed.
99
+ */
100
+ getInlineNodeTypes: (annotationId: string) => string[] | undefined;
91
101
  };
92
102
  export interface AnnotationState<Type, State> {
93
103
  annotationType: Type;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "1.10.3",
3
+ "version": "1.11.0",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,9 +33,9 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-schema": "^36.10.7",
36
- "@atlaskit/editor-common": "^82.9.0",
36
+ "@atlaskit/editor-common": "^82.11.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.2.0",
38
- "@atlaskit/editor-plugin-editor-viewmode": "^1.2.0",
38
+ "@atlaskit/editor-plugin-editor-viewmode-effects": "^1.0.0",
39
39
  "@atlaskit/editor-plugin-feature-flags": "^1.1.0",
40
40
  "@atlaskit/editor-prosemirror": "4.0.1",
41
41
  "@atlaskit/icon": "^22.4.0",