@atlaskit/editor-plugin-annotation 1.26.11 → 1.26.12

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
+ ## 1.26.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [#103388](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/103388)
8
+ [`ff250d75803dd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ff250d75803dd) -
9
+ Fix memory leak on react 18 concurrent mode with annotation node view.
10
+
3
11
  ## 1.26.11
4
12
 
5
13
  ### Patch Changes
@@ -9,8 +9,10 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _adfSchema = require("@atlaskit/adf-schema");
11
11
  var _hooks = require("@atlaskit/editor-common/hooks");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
13
14
  var _editorCommands = require("./editor-commands");
15
+ var _annotationMark = require("./nodeviews/annotationMark");
14
16
  var _inlineComment = require("./pm-plugins/inline-comment");
15
17
  var _keymap = require("./pm-plugins/keymap");
16
18
  var _toolbar = require("./pm-plugins/toolbar");
@@ -28,7 +30,7 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
28
30
  marks: function marks() {
29
31
  return [{
30
32
  name: 'annotation',
31
- mark: _adfSchema.annotation
33
+ mark: (0, _platformFeatureFlags.fg)('platform_editor_annotation_react_18_mem_leak') ? _annotationMark.annotationWithToDOMFix : _adfSchema.annotation
32
34
  }];
33
35
  },
34
36
  actions: {
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.annotationWithToDOMFix = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _adfSchema = require("@atlaskit/adf-schema");
10
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
+ function buildDataAttributes(_ref) {
13
+ var id = _ref.id,
14
+ annotationType = _ref.annotationType;
15
+ return {
16
+ 'data-mark-type': 'annotation',
17
+ 'data-mark-annotation-type': annotationType,
18
+ 'data-id': id
19
+ };
20
+ }
21
+
22
+ /**
23
+ * Annotation mark lifted from adf-schema with modified `toDOM` to work with
24
+ * existing nodeview
25
+ */
26
+ var annotationWithToDOMFix = exports.annotationWithToDOMFix = _objectSpread(_objectSpread({}, _adfSchema.annotation), {}, {
27
+ toDOM: function toDOM(node) {
28
+ return ['span', _objectSpread({
29
+ // Needs id as a reference point
30
+ id: node.attrs.id
31
+ }, buildDataAttributes({
32
+ id: node.attrs.id,
33
+ annotationType: node.attrs.annotationType
34
+ })), 0];
35
+ }
36
+ });
@@ -17,6 +17,8 @@ var _editorCommands = require("../editor-commands");
17
17
  var _nodeviews = require("../nodeviews");
18
18
  var _pluginFactory = require("./plugin-factory");
19
19
  var _utils = require("./utils");
20
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
21
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
20
22
  var fetchProviderStates = /*#__PURE__*/function () {
21
23
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(provider, annotationIds) {
22
24
  var data, result;
@@ -221,13 +223,14 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
221
223
  }
222
224
  };
223
225
  },
224
- props: {
226
+ props: _objectSpread(_objectSpread({}, !(0, _platformFeatureFlags.fg)('platform_editor_annotation_react_18_mem_leak') && {
225
227
  nodeViews: {
226
228
  annotation: function annotation(node, view, getPos) {
227
229
  return new _nodeviews.AnnotationNodeView(node, view, getPos, portalProviderAPI, eventDispatcher) // resolved
228
230
  .init();
229
231
  }
230
- },
232
+ }
233
+ }), {}, {
231
234
  handleDOMEvents: {
232
235
  mousedown: function mousedown(view) {
233
236
  var pluginState = (0, _utils.getPluginState)(view.state);
@@ -305,6 +308,6 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
305
308
  decorations = decorations.add(state.doc, focusDecorations);
306
309
  return decorations;
307
310
  }
308
- }
311
+ })
309
312
  });
310
313
  };
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import { annotation } from '@atlaskit/adf-schema';
3
3
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
6
  import { setInlineCommentDraftState, showInlineCommentForBlockNode } from './editor-commands';
7
+ import { annotationWithToDOMFix } from './nodeviews/annotationMark';
6
8
  import { inlineCommentPlugin } from './pm-plugins/inline-comment';
7
9
  import { keymapPlugin } from './pm-plugins/keymap';
8
10
  import { buildToolbar } from './pm-plugins/toolbar';
@@ -19,7 +21,7 @@ export const annotationPlugin = ({
19
21
  marks() {
20
22
  return [{
21
23
  name: 'annotation',
22
- mark: annotation
24
+ mark: fg('platform_editor_annotation_react_18_mem_leak') ? annotationWithToDOMFix : annotation
23
25
  }];
24
26
  },
25
27
  actions: {
@@ -0,0 +1,29 @@
1
+ import { annotation } from '@atlaskit/adf-schema';
2
+ function buildDataAttributes({
3
+ id,
4
+ annotationType
5
+ }) {
6
+ return {
7
+ 'data-mark-type': 'annotation',
8
+ 'data-mark-annotation-type': annotationType,
9
+ 'data-id': id
10
+ };
11
+ }
12
+
13
+ /**
14
+ * Annotation mark lifted from adf-schema with modified `toDOM` to work with
15
+ * existing nodeview
16
+ */
17
+ export const annotationWithToDOMFix = {
18
+ ...annotation,
19
+ toDOM: node => {
20
+ return ['span', {
21
+ // Needs id as a reference point
22
+ id: node.attrs.id,
23
+ ...buildDataAttributes({
24
+ id: node.attrs.id,
25
+ annotationType: node.attrs.annotationType
26
+ })
27
+ }, 0];
28
+ }
29
+ };
@@ -157,10 +157,12 @@ export const inlineCommentPlugin = options => {
157
157
  };
158
158
  },
159
159
  props: {
160
- nodeViews: {
161
- annotation: (node, view, getPos) => new AnnotationNodeView(node, view, getPos, portalProviderAPI, eventDispatcher) // resolved
162
- .init()
163
- },
160
+ ...(!fg('platform_editor_annotation_react_18_mem_leak') && {
161
+ nodeViews: {
162
+ annotation: (node, view, getPos) => new AnnotationNodeView(node, view, getPos, portalProviderAPI, eventDispatcher) // resolved
163
+ .init()
164
+ }
165
+ }),
164
166
  handleDOMEvents: {
165
167
  mousedown: view => {
166
168
  const pluginState = getPluginState(view.state);
@@ -4,8 +4,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import React from 'react';
5
5
  import { annotation } from '@atlaskit/adf-schema';
6
6
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
9
  import { setInlineCommentDraftState, showInlineCommentForBlockNode } from './editor-commands';
10
+ import { annotationWithToDOMFix } from './nodeviews/annotationMark';
9
11
  import { inlineCommentPlugin } from './pm-plugins/inline-comment';
10
12
  import { keymapPlugin } from './pm-plugins/keymap';
11
13
  import { buildToolbar } from './pm-plugins/toolbar';
@@ -21,7 +23,7 @@ export var annotationPlugin = function annotationPlugin(_ref) {
21
23
  marks: function marks() {
22
24
  return [{
23
25
  name: 'annotation',
24
- mark: annotation
26
+ mark: fg('platform_editor_annotation_react_18_mem_leak') ? annotationWithToDOMFix : annotation
25
27
  }];
26
28
  },
27
29
  actions: {
@@ -0,0 +1,29 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ import { annotation } from '@atlaskit/adf-schema';
5
+ function buildDataAttributes(_ref) {
6
+ var id = _ref.id,
7
+ annotationType = _ref.annotationType;
8
+ return {
9
+ 'data-mark-type': 'annotation',
10
+ 'data-mark-annotation-type': annotationType,
11
+ 'data-id': id
12
+ };
13
+ }
14
+
15
+ /**
16
+ * Annotation mark lifted from adf-schema with modified `toDOM` to work with
17
+ * existing nodeview
18
+ */
19
+ export var annotationWithToDOMFix = _objectSpread(_objectSpread({}, annotation), {}, {
20
+ toDOM: function toDOM(node) {
21
+ return ['span', _objectSpread({
22
+ // Needs id as a reference point
23
+ id: node.attrs.id
24
+ }, buildDataAttributes({
25
+ id: node.attrs.id,
26
+ annotationType: node.attrs.annotationType
27
+ })), 0];
28
+ }
29
+ });
@@ -1,5 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
6
  import { AnnotationTypes } from '@atlaskit/adf-schema';
5
7
  import { RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
@@ -214,13 +216,14 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
214
216
  }
215
217
  };
216
218
  },
217
- props: {
219
+ props: _objectSpread(_objectSpread({}, !fg('platform_editor_annotation_react_18_mem_leak') && {
218
220
  nodeViews: {
219
221
  annotation: function annotation(node, view, getPos) {
220
222
  return new AnnotationNodeView(node, view, getPos, portalProviderAPI, eventDispatcher) // resolved
221
223
  .init();
222
224
  }
223
- },
225
+ }
226
+ }), {}, {
224
227
  handleDOMEvents: {
225
228
  mousedown: function mousedown(view) {
226
229
  var pluginState = getPluginState(view.state);
@@ -298,6 +301,6 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
298
301
  decorations = decorations.add(state.doc, focusDecorations);
299
302
  return decorations;
300
303
  }
301
- }
304
+ })
302
305
  });
303
306
  };
@@ -13,16 +13,17 @@ type StripNonExistingAnnotations = (slice: Slice, state: EditorState) => boolean
13
13
  type SetInlineCommentDraftState = (drafting: boolean, inputMethod: InlineCommentInputMethod,
14
14
  /** @default 'inline' */
15
15
  targetType?: TargetType, targetNodeId?: string, isOpeningMediaCommentFromToolbar?: boolean) => Command;
16
+ export type AnnotationPluginDependencies = [
17
+ OptionalPlugin<AnalyticsPlugin>,
18
+ OptionalPlugin<EditorViewModeEffectsPlugin>,
19
+ OptionalPlugin<EditorViewModePlugin>,
20
+ OptionalPlugin<FeatureFlagsPlugin>,
21
+ OptionalPlugin<ConnectivityPlugin>
22
+ ];
16
23
  export type AnnotationPlugin = NextEditorPlugin<'annotation', {
17
24
  pluginConfiguration: AnnotationProviders | undefined;
18
25
  sharedState: InlineCommentPluginState | undefined;
19
- dependencies: [
20
- OptionalPlugin<AnalyticsPlugin>,
21
- OptionalPlugin<EditorViewModeEffectsPlugin>,
22
- OptionalPlugin<EditorViewModePlugin>,
23
- OptionalPlugin<FeatureFlagsPlugin>,
24
- OptionalPlugin<ConnectivityPlugin>
25
- ];
26
+ dependencies: AnnotationPluginDependencies;
26
27
  actions: {
27
28
  stripNonExistingAnnotations: StripNonExistingAnnotations;
28
29
  setInlineCommentDraftState: SetInlineCommentDraftState;
@@ -6,106 +6,7 @@ declare const _default: {
6
6
  addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI: import("@atlaskit/editor-common/types").EditorInjectionAPI<"annotation", {
7
7
  pluginConfiguration: import("../types").AnnotationProviders | undefined;
8
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("packages/analytics/analytics-next/dist/types").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<"editorViewModeEffects", {
22
- dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"collabEdit", {
23
- pluginConfiguration: import("packages/editor/editor-plugin-collab-edit/dist/types").PrivateCollabEditOptions;
24
- dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
25
- pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
26
- sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
27
- }, import("@atlaskit/editor-common/types").FeatureFlags>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
28
- pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
29
- sharedState: {
30
- createAnalyticsEvent: import("packages/analytics/analytics-next/dist/types").CreateUIAnalyticsEvent | null;
31
- attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
32
- performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
33
- };
34
- dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
35
- pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
36
- sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
37
- }, import("@atlaskit/editor-common/types").FeatureFlags>>];
38
- actions: EditorAnalyticsAPI;
39
- }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
40
- sharedState: import("packages/editor/editor-plugin-editor-viewmode/dist/types").EditorViewModePluginState | null;
41
- dependencies: [];
42
- pluginConfiguration?: {
43
- mode?: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode | undefined;
44
- } | undefined;
45
- commands: {
46
- updateViewMode: (mode: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
47
- };
48
- }, {
49
- mode?: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode | undefined;
50
- } | undefined>>];
51
- sharedState: import("packages/editor/editor-plugin-collab-edit/dist/types").CollabEditPluginSharedState;
52
- actions: {
53
- getAvatarColor: (str: string) => {
54
- index: number;
55
- backgroundColor: string;
56
- textColor: string;
57
- };
58
- addInlineCommentMark: (props: {
59
- from: number;
60
- to: number;
61
- mark: import("prosemirror-model").Mark;
62
- }) => boolean;
63
- addInlineCommentNodeMark: (props: {
64
- pos: number;
65
- mark: import("prosemirror-model").Mark;
66
- }) => boolean;
67
- isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
68
- getCurrentCollabState: () => {
69
- version: number | undefined;
70
- sendableSteps: import("packages/editor/editor-plugin-collab-edit/dist/types").CollabSendableSteps | null | undefined;
71
- content: import("packages/editor/editor-json-transformer/dist/types").JSONNode | undefined;
72
- };
73
- validatePMJSONDocument: (doc: any) => boolean;
74
- };
75
- }, import("packages/editor/editor-plugin-collab-edit/dist/types").PrivateCollabEditOptions>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
76
- sharedState: import("packages/editor/editor-plugin-editor-viewmode/dist/types").EditorViewModePluginState | null;
77
- dependencies: [];
78
- pluginConfiguration?: {
79
- mode?: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode | undefined;
80
- } | undefined;
81
- commands: {
82
- updateViewMode: (mode: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
83
- };
84
- }, {
85
- mode?: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode | undefined;
86
- } | undefined>];
87
- actions: {
88
- applyViewModeStepAt: (tr: Transaction) => boolean;
89
- };
90
- }, undefined>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
91
- sharedState: import("packages/editor/editor-plugin-editor-viewmode/dist/types").EditorViewModePluginState | null;
92
- dependencies: [];
93
- pluginConfiguration?: {
94
- mode?: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode | undefined;
95
- } | undefined;
96
- commands: {
97
- updateViewMode: (mode: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
98
- };
99
- }, {
100
- mode?: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode | undefined;
101
- } | undefined>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
102
- pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
103
- sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
104
- }, import("@atlaskit/editor-common/types").FeatureFlags>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"connectivity", {
105
- sharedState: {
106
- mode: "offline" | "online";
107
- };
108
- }, undefined>>];
9
+ dependencies: import("../annotationPluginType").AnnotationPluginDependencies;
109
10
  actions: {
110
11
  stripNonExistingAnnotations: (slice: import("prosemirror-model").Slice, state: EditorState) => boolean | undefined;
111
12
  setInlineCommentDraftState: (drafting: boolean, inputMethod: InlineCommentInputMethod, targetType?: import("../types").TargetType | undefined, targetNodeId?: string | undefined, isOpeningMediaCommentFromToolbar?: boolean | undefined) => import("@atlaskit/editor-common/types").Command;
@@ -0,0 +1,6 @@
1
+ import type { MarkSpec } from '@atlaskit/editor-prosemirror/model';
2
+ /**
3
+ * Annotation mark lifted from adf-schema with modified `toDOM` to work with
4
+ * existing nodeview
5
+ */
6
+ export declare const annotationWithToDOMFix: MarkSpec;
@@ -1,8 +1,10 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
3
  import type { Command, ExtractInjectionAPI, FloatingToolbarButton } from '@atlaskit/editor-common/types';
4
+ import type { PopupPosition } from '@atlaskit/editor-common/ui';
4
5
  import type { NodeType } from '@atlaskit/editor-prosemirror/model';
5
6
  import { type EditorState } from '@atlaskit/editor-prosemirror/state';
7
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
8
  import type { AnnotationPlugin } from '../annotationPluginType';
7
9
  interface BuildToolbarOptions {
8
10
  state: EditorState;
@@ -12,10 +14,10 @@ interface BuildToolbarOptions {
12
14
  _supportedNodes?: string[];
13
15
  api?: ExtractInjectionAPI<AnnotationPlugin>;
14
16
  }
15
- export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ state, intl, isToolbarAbove, _supportedNodes, api }: BuildToolbarOptions) => {
17
+ export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ state, intl, isToolbarAbove, _supportedNodes, api, }: BuildToolbarOptions) => {
16
18
  title: string;
17
19
  nodeType: NodeType[];
18
20
  items: FloatingToolbarButton<Command>[];
19
- onPositionCalculated: (editorView: import("prosemirror-view").EditorView, nextPos: import("@atlaskit/editor-common/ui").PopupPosition) => import("@atlaskit/editor-common/ui").PopupPosition;
21
+ onPositionCalculated: (editorView: EditorView, nextPos: PopupPosition) => PopupPosition;
20
22
  } | undefined;
21
23
  export {};
@@ -13,16 +13,17 @@ type StripNonExistingAnnotations = (slice: Slice, state: EditorState) => boolean
13
13
  type SetInlineCommentDraftState = (drafting: boolean, inputMethod: InlineCommentInputMethod,
14
14
  /** @default 'inline' */
15
15
  targetType?: TargetType, targetNodeId?: string, isOpeningMediaCommentFromToolbar?: boolean) => Command;
16
+ export type AnnotationPluginDependencies = [
17
+ OptionalPlugin<AnalyticsPlugin>,
18
+ OptionalPlugin<EditorViewModeEffectsPlugin>,
19
+ OptionalPlugin<EditorViewModePlugin>,
20
+ OptionalPlugin<FeatureFlagsPlugin>,
21
+ OptionalPlugin<ConnectivityPlugin>
22
+ ];
16
23
  export type AnnotationPlugin = NextEditorPlugin<'annotation', {
17
24
  pluginConfiguration: AnnotationProviders | undefined;
18
25
  sharedState: InlineCommentPluginState | undefined;
19
- dependencies: [
20
- OptionalPlugin<AnalyticsPlugin>,
21
- OptionalPlugin<EditorViewModeEffectsPlugin>,
22
- OptionalPlugin<EditorViewModePlugin>,
23
- OptionalPlugin<FeatureFlagsPlugin>,
24
- OptionalPlugin<ConnectivityPlugin>
25
- ];
26
+ dependencies: AnnotationPluginDependencies;
26
27
  actions: {
27
28
  stripNonExistingAnnotations: StripNonExistingAnnotations;
28
29
  setInlineCommentDraftState: SetInlineCommentDraftState;
@@ -6,126 +6,7 @@ declare const _default: {
6
6
  addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI: import("@atlaskit/editor-common/types").EditorInjectionAPI<"annotation", {
7
7
  pluginConfiguration: import("../types").AnnotationProviders | undefined;
8
8
  sharedState: import("..").InlineCommentPluginState | undefined;
9
- dependencies: [
10
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
11
- pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
12
- sharedState: {
13
- createAnalyticsEvent: import("packages/analytics/analytics-next/dist/types").CreateUIAnalyticsEvent | null;
14
- attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
15
- performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
16
- };
17
- dependencies: [
18
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
19
- pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
20
- sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
21
- }, import("@atlaskit/editor-common/types").FeatureFlags>>
22
- ];
23
- actions: EditorAnalyticsAPI;
24
- }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>,
25
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewModeEffects", {
26
- dependencies: [
27
- import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"collabEdit", {
28
- pluginConfiguration: import("packages/editor/editor-plugin-collab-edit/dist/types").PrivateCollabEditOptions;
29
- dependencies: [
30
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
31
- pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
32
- sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
33
- }, import("@atlaskit/editor-common/types").FeatureFlags>>,
34
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
35
- pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
36
- sharedState: {
37
- createAnalyticsEvent: import("packages/analytics/analytics-next/dist/types").CreateUIAnalyticsEvent | null;
38
- attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
39
- performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
40
- };
41
- dependencies: [
42
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
43
- pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
44
- sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
45
- }, import("@atlaskit/editor-common/types").FeatureFlags>>
46
- ];
47
- actions: EditorAnalyticsAPI;
48
- }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>,
49
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
50
- sharedState: import("packages/editor/editor-plugin-editor-viewmode/dist/types").EditorViewModePluginState | null;
51
- dependencies: [
52
- ];
53
- pluginConfiguration?: {
54
- mode?: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode | undefined;
55
- } | undefined;
56
- commands: {
57
- updateViewMode: (mode: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
58
- };
59
- }, {
60
- mode?: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode | undefined;
61
- } | undefined>>
62
- ];
63
- sharedState: import("packages/editor/editor-plugin-collab-edit/dist/types").CollabEditPluginSharedState;
64
- actions: {
65
- getAvatarColor: (str: string) => {
66
- index: number;
67
- backgroundColor: string;
68
- textColor: string;
69
- };
70
- addInlineCommentMark: (props: {
71
- from: number;
72
- to: number;
73
- mark: import("prosemirror-model").Mark;
74
- }) => boolean;
75
- addInlineCommentNodeMark: (props: {
76
- pos: number;
77
- mark: import("prosemirror-model").Mark;
78
- }) => boolean;
79
- isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
80
- getCurrentCollabState: () => {
81
- version: number | undefined;
82
- sendableSteps: import("packages/editor/editor-plugin-collab-edit/dist/types").CollabSendableSteps | null | undefined;
83
- content: import("packages/editor/editor-json-transformer/dist/types").JSONNode | undefined;
84
- };
85
- validatePMJSONDocument: (doc: any) => boolean;
86
- };
87
- }, import("packages/editor/editor-plugin-collab-edit/dist/types").PrivateCollabEditOptions>,
88
- import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
89
- sharedState: import("packages/editor/editor-plugin-editor-viewmode/dist/types").EditorViewModePluginState | null;
90
- dependencies: [
91
- ];
92
- pluginConfiguration?: {
93
- mode?: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode | undefined;
94
- } | undefined;
95
- commands: {
96
- updateViewMode: (mode: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
97
- };
98
- }, {
99
- mode?: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode | undefined;
100
- } | undefined>
101
- ];
102
- actions: {
103
- applyViewModeStepAt: (tr: Transaction) => boolean;
104
- };
105
- }, undefined>>,
106
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
107
- sharedState: import("packages/editor/editor-plugin-editor-viewmode/dist/types").EditorViewModePluginState | null;
108
- dependencies: [
109
- ];
110
- pluginConfiguration?: {
111
- mode?: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode | undefined;
112
- } | undefined;
113
- commands: {
114
- updateViewMode: (mode: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
115
- };
116
- }, {
117
- mode?: import("packages/editor/editor-plugin-editor-viewmode/dist/types").ViewMode | undefined;
118
- } | undefined>>,
119
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
120
- pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
121
- sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
122
- }, import("@atlaskit/editor-common/types").FeatureFlags>>,
123
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"connectivity", {
124
- sharedState: {
125
- mode: "offline" | "online";
126
- };
127
- }, undefined>>
128
- ];
9
+ dependencies: import("../annotationPluginType").AnnotationPluginDependencies;
129
10
  actions: {
130
11
  stripNonExistingAnnotations: (slice: import("prosemirror-model").Slice, state: EditorState) => boolean | undefined;
131
12
  setInlineCommentDraftState: (drafting: boolean, inputMethod: InlineCommentInputMethod, targetType?: import("../types").TargetType | undefined, targetNodeId?: string | undefined, isOpeningMediaCommentFromToolbar?: boolean | undefined) => import("@atlaskit/editor-common/types").Command;
@@ -0,0 +1,6 @@
1
+ import type { MarkSpec } from '@atlaskit/editor-prosemirror/model';
2
+ /**
3
+ * Annotation mark lifted from adf-schema with modified `toDOM` to work with
4
+ * existing nodeview
5
+ */
6
+ export declare const annotationWithToDOMFix: MarkSpec;
@@ -1,8 +1,10 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
3
  import type { Command, ExtractInjectionAPI, FloatingToolbarButton } from '@atlaskit/editor-common/types';
4
+ import type { PopupPosition } from '@atlaskit/editor-common/ui';
4
5
  import type { NodeType } from '@atlaskit/editor-prosemirror/model';
5
6
  import { type EditorState } from '@atlaskit/editor-prosemirror/state';
7
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
8
  import type { AnnotationPlugin } from '../annotationPluginType';
7
9
  interface BuildToolbarOptions {
8
10
  state: EditorState;
@@ -12,10 +14,10 @@ interface BuildToolbarOptions {
12
14
  _supportedNodes?: string[];
13
15
  api?: ExtractInjectionAPI<AnnotationPlugin>;
14
16
  }
15
- export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ state, intl, isToolbarAbove, _supportedNodes, api }: BuildToolbarOptions) => {
17
+ export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ state, intl, isToolbarAbove, _supportedNodes, api, }: BuildToolbarOptions) => {
16
18
  title: string;
17
19
  nodeType: NodeType[];
18
20
  items: FloatingToolbarButton<Command>[];
19
- onPositionCalculated: (editorView: import("prosemirror-view").EditorView, nextPos: import("@atlaskit/editor-common/ui").PopupPosition) => import("@atlaskit/editor-common/ui").PopupPosition;
21
+ onPositionCalculated: (editorView: EditorView, nextPos: PopupPosition) => PopupPosition;
20
22
  } | undefined;
21
23
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "1.26.11",
3
+ "version": "1.26.12",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,16 +32,16 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^46.1.0",
35
- "@atlaskit/editor-common": "^99.0.0",
35
+ "@atlaskit/editor-common": "^99.3.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
37
  "@atlaskit/editor-plugin-connectivity": "^1.1.0",
38
38
  "@atlaskit/editor-plugin-editor-viewmode-effects": "^1.1.0",
39
39
  "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
40
40
  "@atlaskit/editor-prosemirror": "6.2.1",
41
- "@atlaskit/icon": "^23.3.0",
41
+ "@atlaskit/icon": "^23.4.0",
42
42
  "@atlaskit/onboarding": "^12.2.0",
43
43
  "@atlaskit/platform-feature-flags": "^0.3.0",
44
- "@atlaskit/tmp-editor-statsig": "^2.33.0",
44
+ "@atlaskit/tmp-editor-statsig": "^2.37.0",
45
45
  "@babel/runtime": "^7.0.0"
46
46
  },
47
47
  "peerDependencies": {
@@ -97,6 +97,9 @@
97
97
  "editor_inline_comments_on_inline_nodes": {
98
98
  "type": "boolean"
99
99
  },
100
+ "platform_editor_annotation_react_18_mem_leak": {
101
+ "type": "boolean"
102
+ },
100
103
  "platform_inline_node_as_valid_annotation_selection": {
101
104
  "type": "boolean"
102
105
  },