@atlaskit/editor-plugin-collab-edit 1.22.2 → 1.22.4

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,22 @@
1
1
  # @atlaskit/editor-plugin-collab-edit
2
2
 
3
+ ## 1.22.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#154186](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154186)
8
+ [`5c316170d29dd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5c316170d29dd) -
9
+ Bump @atlaskit/adf-schema to 42.3.1
10
+ - Updated dependencies
11
+
12
+ ## 1.22.3
13
+
14
+ ### Patch Changes
15
+
16
+ - [#153986](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/153986)
17
+ [`ce61c835c3b6a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ce61c835c3b6a) -
18
+ allow editorApi to be used to update state in collab plugin
19
+
3
20
  ## 1.22.2
4
21
 
5
22
  ### Patch Changes
@@ -18,11 +18,12 @@ var initCollab = function initCollab(collabEditProvider, view) {
18
18
  });
19
19
  }
20
20
  };
21
- var initNewCollab = function initNewCollab(collabEditProvider, view, onSyncUpError) {
21
+ var initNewCollab = function initNewCollab(collabEditProvider, view, editorApi, onSyncUpError) {
22
22
  collabEditProvider.setup({
23
23
  getState: function getState() {
24
24
  return view.state;
25
25
  },
26
+ editorApi: editorApi,
26
27
  onSyncUpError: onSyncUpError
27
28
  });
28
29
  };
@@ -32,7 +33,8 @@ var initialize = exports.initialize = function initialize(_ref) {
32
33
  providerFactory = _ref.providerFactory,
33
34
  view = _ref.view,
34
35
  featureFlags = _ref.featureFlags,
35
- editorAnalyticsApi = _ref.editorAnalyticsApi;
36
+ editorAnalyticsApi = _ref.editorAnalyticsApi,
37
+ pluginInjectionApi = _ref.pluginInjectionApi;
36
38
  return function (provider) {
37
39
  var cleanup;
38
40
  var pluginState = _pluginKey.pluginKey.getState(view.state);
@@ -45,7 +47,7 @@ var initialize = exports.initialize = function initialize(_ref) {
45
47
  if (options.useNativePlugin) {
46
48
  // ED-13912 For NCS we don't want to use memoizeOne because it causes
47
49
  // infinite text while changing page-width
48
- initNewCollab(provider, view, options.onSyncUpError);
50
+ initNewCollab(provider, view, pluginInjectionApi, options.onSyncUpError);
49
51
  } else {
50
52
  /**
51
53
  * We only want to initialise once, if we reload/reconfigure this plugin
@@ -10,6 +10,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
10
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
12
  var _analytics = require("@atlaskit/editor-common/analytics");
13
+ var _editorJsonTransformer = require("@atlaskit/editor-json-transformer");
13
14
  var _transform = require("@atlaskit/editor-prosemirror/transform");
14
15
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
16
  var _prosemirrorCollab = require("@atlaskit/prosemirror-collab");
@@ -100,6 +101,9 @@ var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref
100
101
  api = _ref4.api;
101
102
  var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
102
103
  var providerResolver = function providerResolver() {};
104
+ var editorViewRef = {
105
+ current: null
106
+ };
103
107
  var collabEditProviderPromise = new Promise(function (_providerResolver) {
104
108
  providerResolver = _providerResolver;
105
109
  });
@@ -145,6 +149,28 @@ var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref
145
149
  addInlineCommentNodeMark: createAddInlineCommentNodeMark(collabEditProviderPromise),
146
150
  isRemoteReplaceDocumentTransaction: function isRemoteReplaceDocumentTransaction(tr) {
147
151
  return tr.getMeta('isRemote') && tr.getMeta('replaceDocument');
152
+ },
153
+ getCurrentCollabState: function getCurrentCollabState() {
154
+ var _getCollabState;
155
+ var adfDocument = new _editorJsonTransformer.JSONTransformer().encode(editorViewRef.current.state.doc);
156
+ return {
157
+ content: adfDocument,
158
+ version: ((_getCollabState = (0, _prosemirrorCollab.getCollabState)(editorViewRef.current.state)) === null || _getCollabState === void 0 ? void 0 : _getCollabState.version) || 0,
159
+ sendableSteps: (0, _prosemirrorCollab.sendableSteps)(editorViewRef.current.state)
160
+ };
161
+ },
162
+ validatePMJSONDocument: function validatePMJSONDocument(doc) {
163
+ var content = (doc.content || []).map(function (child) {
164
+ return editorViewRef.current.state.schema.nodeFromJSON(child);
165
+ });
166
+ return content.every(function (node) {
167
+ try {
168
+ node.check(); // this will throw an error if the node is invalid
169
+ } catch (error) {
170
+ return false;
171
+ }
172
+ return true;
173
+ });
148
174
  }
149
175
  },
150
176
  pmPlugins: function pmPlugins() {
@@ -104,6 +104,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
104
104
  options: options,
105
105
  providerFactory: providerFactory,
106
106
  featureFlags: featureFlags,
107
+ pluginInjectionApi: pluginInjectionApi,
107
108
  editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions
108
109
  }), addErrorAnalytics);
109
110
  providerFactory && providerFactory.subscribe('collabEditProvider', function (_name, providerPromise) {
@@ -7,9 +7,10 @@ const initCollab = (collabEditProvider, view) => {
7
7
  collabEditProvider.initialize(() => view.state, json => Step.fromJSON(view.state.schema, json));
8
8
  }
9
9
  };
10
- const initNewCollab = (collabEditProvider, view, onSyncUpError) => {
10
+ const initNewCollab = (collabEditProvider, view, editorApi, onSyncUpError) => {
11
11
  collabEditProvider.setup({
12
12
  getState: () => view.state,
13
+ editorApi,
13
14
  onSyncUpError
14
15
  });
15
16
  };
@@ -19,7 +20,8 @@ export const initialize = ({
19
20
  providerFactory,
20
21
  view,
21
22
  featureFlags,
22
- editorAnalyticsApi
23
+ editorAnalyticsApi,
24
+ pluginInjectionApi
23
25
  }) => provider => {
24
26
  let cleanup;
25
27
  const pluginState = pluginKey.getState(view.state);
@@ -32,7 +34,7 @@ export const initialize = ({
32
34
  if (options.useNativePlugin) {
33
35
  // ED-13912 For NCS we don't want to use memoizeOne because it causes
34
36
  // infinite text while changing page-width
35
- initNewCollab(provider, view, options.onSyncUpError);
37
+ initNewCollab(provider, view, pluginInjectionApi, options.onSyncUpError);
36
38
  } else {
37
39
  /**
38
40
  * We only want to initialise once, if we reload/reconfigure this plugin
@@ -1,7 +1,8 @@
1
1
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
2
+ import { JSONTransformer } from '@atlaskit/editor-json-transformer';
2
3
  import { AddMarkStep, AddNodeMarkStep } from '@atlaskit/editor-prosemirror/transform';
3
4
  import { fg } from '@atlaskit/platform-feature-flags';
4
- import { collab } from '@atlaskit/prosemirror-collab';
5
+ import { collab, getCollabState, sendableSteps } from '@atlaskit/prosemirror-collab';
5
6
  import { addSynchronyErrorAnalytics } from './analytics';
6
7
  import { sendTransaction } from './events/send-transaction';
7
8
  import { createPlugin } from './pm-plugins/main';
@@ -61,6 +62,9 @@ export const collabEditPlugin = ({
61
62
  var _api$featureFlags;
62
63
  const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
63
64
  let providerResolver = () => {};
65
+ const editorViewRef = {
66
+ current: null
67
+ };
64
68
  const collabEditProviderPromise = new Promise(_providerResolver => {
65
69
  providerResolver = _providerResolver;
66
70
  });
@@ -104,7 +108,27 @@ export const collabEditPlugin = ({
104
108
  getAvatarColor,
105
109
  addInlineCommentMark: createAddInlineCommentMark(collabEditProviderPromise),
106
110
  addInlineCommentNodeMark: createAddInlineCommentNodeMark(collabEditProviderPromise),
107
- isRemoteReplaceDocumentTransaction: tr => tr.getMeta('isRemote') && tr.getMeta('replaceDocument')
111
+ isRemoteReplaceDocumentTransaction: tr => tr.getMeta('isRemote') && tr.getMeta('replaceDocument'),
112
+ getCurrentCollabState: () => {
113
+ var _getCollabState;
114
+ const adfDocument = new JSONTransformer().encode(editorViewRef.current.state.doc);
115
+ return {
116
+ content: adfDocument,
117
+ version: ((_getCollabState = getCollabState(editorViewRef.current.state)) === null || _getCollabState === void 0 ? void 0 : _getCollabState.version) || 0,
118
+ sendableSteps: sendableSteps(editorViewRef.current.state)
119
+ };
120
+ },
121
+ validatePMJSONDocument: doc => {
122
+ const content = (doc.content || []).map(child => editorViewRef.current.state.schema.nodeFromJSON(child));
123
+ return content.every(node => {
124
+ try {
125
+ node.check(); // this will throw an error if the node is invalid
126
+ } catch (error) {
127
+ return false;
128
+ }
129
+ return true;
130
+ });
131
+ }
108
132
  },
109
133
  pmPlugins() {
110
134
  const {
@@ -92,6 +92,7 @@ export const createPlugin = (dispatch, providerFactory, providerResolver, collab
92
92
  options,
93
93
  providerFactory,
94
94
  featureFlags,
95
+ pluginInjectionApi,
95
96
  editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions
96
97
  }), addErrorAnalytics);
97
98
  providerFactory && providerFactory.subscribe('collabEditProvider', (_name, providerPromise) => {
@@ -11,11 +11,12 @@ var initCollab = function initCollab(collabEditProvider, view) {
11
11
  });
12
12
  }
13
13
  };
14
- var initNewCollab = function initNewCollab(collabEditProvider, view, onSyncUpError) {
14
+ var initNewCollab = function initNewCollab(collabEditProvider, view, editorApi, onSyncUpError) {
15
15
  collabEditProvider.setup({
16
16
  getState: function getState() {
17
17
  return view.state;
18
18
  },
19
+ editorApi: editorApi,
19
20
  onSyncUpError: onSyncUpError
20
21
  });
21
22
  };
@@ -25,7 +26,8 @@ export var initialize = function initialize(_ref) {
25
26
  providerFactory = _ref.providerFactory,
26
27
  view = _ref.view,
27
28
  featureFlags = _ref.featureFlags,
28
- editorAnalyticsApi = _ref.editorAnalyticsApi;
29
+ editorAnalyticsApi = _ref.editorAnalyticsApi,
30
+ pluginInjectionApi = _ref.pluginInjectionApi;
29
31
  return function (provider) {
30
32
  var cleanup;
31
33
  var pluginState = pluginKey.getState(view.state);
@@ -38,7 +40,7 @@ export var initialize = function initialize(_ref) {
38
40
  if (options.useNativePlugin) {
39
41
  // ED-13912 For NCS we don't want to use memoizeOne because it causes
40
42
  // infinite text while changing page-width
41
- initNewCollab(provider, view, options.onSyncUpError);
43
+ initNewCollab(provider, view, pluginInjectionApi, options.onSyncUpError);
42
44
  } else {
43
45
  /**
44
46
  * We only want to initialise once, if we reload/reconfigure this plugin
@@ -5,9 +5,10 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
5
5
  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; }
6
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
7
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
8
+ import { JSONTransformer } from '@atlaskit/editor-json-transformer';
8
9
  import { AddMarkStep, AddNodeMarkStep } from '@atlaskit/editor-prosemirror/transform';
9
10
  import { fg } from '@atlaskit/platform-feature-flags';
10
- import { collab } from '@atlaskit/prosemirror-collab';
11
+ import { collab, getCollabState, sendableSteps } from '@atlaskit/prosemirror-collab';
11
12
  import { addSynchronyErrorAnalytics } from './analytics';
12
13
  import { sendTransaction } from './events/send-transaction';
13
14
  import { createPlugin } from './pm-plugins/main';
@@ -93,6 +94,9 @@ export var collabEditPlugin = function collabEditPlugin(_ref4) {
93
94
  api = _ref4.api;
94
95
  var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
95
96
  var providerResolver = function providerResolver() {};
97
+ var editorViewRef = {
98
+ current: null
99
+ };
96
100
  var collabEditProviderPromise = new Promise(function (_providerResolver) {
97
101
  providerResolver = _providerResolver;
98
102
  });
@@ -138,6 +142,28 @@ export var collabEditPlugin = function collabEditPlugin(_ref4) {
138
142
  addInlineCommentNodeMark: createAddInlineCommentNodeMark(collabEditProviderPromise),
139
143
  isRemoteReplaceDocumentTransaction: function isRemoteReplaceDocumentTransaction(tr) {
140
144
  return tr.getMeta('isRemote') && tr.getMeta('replaceDocument');
145
+ },
146
+ getCurrentCollabState: function getCurrentCollabState() {
147
+ var _getCollabState;
148
+ var adfDocument = new JSONTransformer().encode(editorViewRef.current.state.doc);
149
+ return {
150
+ content: adfDocument,
151
+ version: ((_getCollabState = getCollabState(editorViewRef.current.state)) === null || _getCollabState === void 0 ? void 0 : _getCollabState.version) || 0,
152
+ sendableSteps: sendableSteps(editorViewRef.current.state)
153
+ };
154
+ },
155
+ validatePMJSONDocument: function validatePMJSONDocument(doc) {
156
+ var content = (doc.content || []).map(function (child) {
157
+ return editorViewRef.current.state.schema.nodeFromJSON(child);
158
+ });
159
+ return content.every(function (node) {
160
+ try {
161
+ node.check(); // this will throw an error if the node is invalid
162
+ } catch (error) {
163
+ return false;
164
+ }
165
+ return true;
166
+ });
141
167
  }
142
168
  },
143
169
  pmPlugins: function pmPlugins() {
@@ -93,6 +93,7 @@ export var createPlugin = function createPlugin(dispatch, providerFactory, provi
93
93
  options: options,
94
94
  providerFactory: providerFactory,
95
95
  featureFlags: featureFlags,
96
+ pluginInjectionApi: pluginInjectionApi,
96
97
  editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions
97
98
  }), addErrorAnalytics);
98
99
  providerFactory && providerFactory.subscribe('collabEditProvider', function (_name, providerPromise) {
@@ -1,9 +1,9 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { CollabEditProvider } from '@atlaskit/editor-common/collab';
3
3
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
4
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
4
+ import type { ExtractInjectionAPI, FeatureFlags } from '@atlaskit/editor-common/types';
5
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
- import type { PrivateCollabEditOptions } from '../types';
6
+ import type { CollabEditPlugin, PrivateCollabEditOptions } from '../types';
7
7
  import type { Cleanup } from './handlers';
8
8
  type Props = {
9
9
  view: EditorView;
@@ -11,6 +11,7 @@ type Props = {
11
11
  providerFactory: ProviderFactory;
12
12
  featureFlags: FeatureFlags;
13
13
  editorAnalyticsApi: EditorAnalyticsAPI | undefined;
14
+ pluginInjectionApi?: ExtractInjectionAPI<CollabEditPlugin> | undefined;
14
15
  };
15
- export declare const initialize: ({ options, providerFactory, view, featureFlags, editorAnalyticsApi }: Props) => (provider: CollabEditProvider) => Cleanup;
16
+ export declare const initialize: ({ options, providerFactory, view, featureFlags, editorAnalyticsApi, pluginInjectionApi, }: Props) => (provider: CollabEditProvider) => Cleanup;
16
17
  export {};
@@ -1,2 +1,2 @@
1
1
  export { collabEditPlugin } from './plugin';
2
- export type { CollabInitializedMetadata, CollabEditPluginSharedState, CollabEditPlugin, ReadOnlyParticipants, PrivateCollabEditOptions, CollabInviteToEditProps, } from './types';
2
+ export type { CollabInitializedMetadata, CollabEditPluginSharedState, CollabEditPlugin, ReadOnlyParticipants, PrivateCollabEditOptions, CollabInviteToEditProps, CollabSendableSteps, } from './types';
@@ -3,7 +3,6 @@ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import type { ExtractInjectionAPI, FeatureFlags } from '@atlaskit/editor-common/types';
6
- import type { PrivateCollabEditOptions, ProviderCallback } from '../../types';
7
- import type { CollabEditPlugin } from '../../types';
6
+ import type { CollabEditPlugin, PrivateCollabEditOptions, ProviderCallback } from '../../types';
8
7
  import { PluginState } from './plugin-state';
9
8
  export declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, providerResolver: (value: CollabEditProvider) => void, collabProviderCallback: ProviderCallback, options: PrivateCollabEditOptions, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<CollabEditPlugin> | undefined) => SafePlugin<PluginState>;
@@ -1,5 +1,6 @@
1
1
  import type { CollabEditOptions, CollabEditProvider, CollabParticipant, Color, SyncUpErrorFunction } from '@atlaskit/editor-common/collab';
2
2
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
+ import type { JSONNode } from '@atlaskit/editor-json-transformer';
3
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
5
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
5
6
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
@@ -35,6 +36,12 @@ export type TrackSpammingStepsMetadata = {
35
36
  steps: Step[];
36
37
  }>;
37
38
  };
39
+ export type CollabSendableSteps = {
40
+ version: number;
41
+ steps: readonly Step[];
42
+ clientID: number | string;
43
+ origins: readonly Transaction[];
44
+ };
38
45
  export type CollabEditPluginSharedState = {
39
46
  initialised: CollabInitializedMetadata & LastOrganicChangeMetadata;
40
47
  activeParticipants: ReadOnlyParticipants | undefined;
@@ -63,5 +70,11 @@ export type CollabEditPlugin = NextEditorPlugin<'collabEdit', {
63
70
  mark: Mark;
64
71
  }) => boolean;
65
72
  isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
73
+ getCurrentCollabState: () => {
74
+ version: number | undefined;
75
+ sendableSteps: CollabSendableSteps | undefined | null;
76
+ content: JSONNode | undefined;
77
+ };
78
+ validatePMJSONDocument: (doc: any) => boolean;
66
79
  };
67
80
  }>;
@@ -1,9 +1,9 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { CollabEditProvider } from '@atlaskit/editor-common/collab';
3
3
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
4
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
4
+ import type { ExtractInjectionAPI, FeatureFlags } from '@atlaskit/editor-common/types';
5
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
- import type { PrivateCollabEditOptions } from '../types';
6
+ import type { CollabEditPlugin, PrivateCollabEditOptions } from '../types';
7
7
  import type { Cleanup } from './handlers';
8
8
  type Props = {
9
9
  view: EditorView;
@@ -11,6 +11,7 @@ type Props = {
11
11
  providerFactory: ProviderFactory;
12
12
  featureFlags: FeatureFlags;
13
13
  editorAnalyticsApi: EditorAnalyticsAPI | undefined;
14
+ pluginInjectionApi?: ExtractInjectionAPI<CollabEditPlugin> | undefined;
14
15
  };
15
- export declare const initialize: ({ options, providerFactory, view, featureFlags, editorAnalyticsApi }: Props) => (provider: CollabEditProvider) => Cleanup;
16
+ export declare const initialize: ({ options, providerFactory, view, featureFlags, editorAnalyticsApi, pluginInjectionApi, }: Props) => (provider: CollabEditProvider) => Cleanup;
16
17
  export {};
@@ -1,2 +1,2 @@
1
1
  export { collabEditPlugin } from './plugin';
2
- export type { CollabInitializedMetadata, CollabEditPluginSharedState, CollabEditPlugin, ReadOnlyParticipants, PrivateCollabEditOptions, CollabInviteToEditProps, } from './types';
2
+ export type { CollabInitializedMetadata, CollabEditPluginSharedState, CollabEditPlugin, ReadOnlyParticipants, PrivateCollabEditOptions, CollabInviteToEditProps, CollabSendableSteps, } from './types';
@@ -3,7 +3,6 @@ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import type { ExtractInjectionAPI, FeatureFlags } from '@atlaskit/editor-common/types';
6
- import type { PrivateCollabEditOptions, ProviderCallback } from '../../types';
7
- import type { CollabEditPlugin } from '../../types';
6
+ import type { CollabEditPlugin, PrivateCollabEditOptions, ProviderCallback } from '../../types';
8
7
  import { PluginState } from './plugin-state';
9
8
  export declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, providerResolver: (value: CollabEditProvider) => void, collabProviderCallback: ProviderCallback, options: PrivateCollabEditOptions, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<CollabEditPlugin> | undefined) => SafePlugin<PluginState>;
@@ -1,5 +1,6 @@
1
1
  import type { CollabEditOptions, CollabEditProvider, CollabParticipant, Color, SyncUpErrorFunction } from '@atlaskit/editor-common/collab';
2
2
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
+ import type { JSONNode } from '@atlaskit/editor-json-transformer';
3
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
5
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
5
6
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
@@ -35,6 +36,12 @@ export type TrackSpammingStepsMetadata = {
35
36
  steps: Step[];
36
37
  }>;
37
38
  };
39
+ export type CollabSendableSteps = {
40
+ version: number;
41
+ steps: readonly Step[];
42
+ clientID: number | string;
43
+ origins: readonly Transaction[];
44
+ };
38
45
  export type CollabEditPluginSharedState = {
39
46
  initialised: CollabInitializedMetadata & LastOrganicChangeMetadata;
40
47
  activeParticipants: ReadOnlyParticipants | undefined;
@@ -63,5 +70,11 @@ export type CollabEditPlugin = NextEditorPlugin<'collabEdit', {
63
70
  mark: Mark;
64
71
  }) => boolean;
65
72
  isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
73
+ getCurrentCollabState: () => {
74
+ version: number | undefined;
75
+ sendableSteps: CollabSendableSteps | undefined | null;
76
+ content: JSONNode | undefined;
77
+ };
78
+ validatePMJSONDocument: (doc: any) => boolean;
66
79
  };
67
80
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-collab-edit",
3
- "version": "1.22.2",
3
+ "version": "1.22.4",
4
4
  "description": "Collab Edit plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,10 +31,11 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/adf-schema": "^42.0.2",
34
+ "@atlaskit/adf-schema": "^42.3.1",
35
35
  "@atlaskit/custom-steps": "^0.8.0",
36
- "@atlaskit/editor-common": "^93.5.0",
37
- "@atlaskit/editor-plugin-analytics": "1.10.1",
36
+ "@atlaskit/editor-common": "^94.0.0",
37
+ "@atlaskit/editor-json-transformer": "^8.18.2",
38
+ "@atlaskit/editor-plugin-analytics": "1.10.2",
38
39
  "@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
39
40
  "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
40
41
  "@atlaskit/editor-prosemirror": "6.0.0",
@@ -50,14 +51,14 @@
50
51
  "devDependencies": {
51
52
  "@af/integration-testing": "*",
52
53
  "@af/visual-regression": "*",
53
- "@atlaskit/editor-plugin-mentions": "^2.9.0",
54
+ "@atlaskit/editor-plugin-mentions": "^2.10.0",
54
55
  "@atlaskit/editor-plugin-text-formatting": "^1.15.0",
55
56
  "@atlaskit/editor-plugin-type-ahead": "^1.10.0",
56
57
  "@atlaskit/editor-plugin-unsupported-content": "^1.9.0",
57
58
  "@atlaskit/editor-test-helpers": "^19.1.0",
58
59
  "@atlaskit/ssr": "*",
59
60
  "@atlaskit/synchrony-test-helpers": "^2.5.0",
60
- "@atlaskit/util-data-test": "^17.9.0",
61
+ "@atlaskit/util-data-test": "^17.11.0",
61
62
  "@atlaskit/visual-regression": "*",
62
63
  "@testing-library/react": "^12.1.5",
63
64
  "react-dom": "^16.8.0",