@atlaskit/editor-plugin-collab-edit 2.4.1 → 2.5.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 +13 -0
- package/dist/cjs/collabEditPlugin.js +12 -2
- package/dist/cjs/pm-plugins/events/handlers.js +6 -2
- package/dist/cjs/pm-plugins/track-reconnection-conflict.js +26 -0
- package/dist/es2019/collabEditPlugin.js +12 -2
- package/dist/es2019/pm-plugins/events/handlers.js +6 -2
- package/dist/es2019/pm-plugins/track-reconnection-conflict.js +20 -0
- package/dist/esm/collabEditPlugin.js +12 -2
- package/dist/esm/pm-plugins/events/handlers.js +6 -2
- package/dist/esm/pm-plugins/track-reconnection-conflict.js +20 -0
- package/dist/types/pm-plugins/events/handlers.d.ts +2 -1
- package/dist/types/pm-plugins/track-reconnection-conflict.d.ts +5 -0
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/events/handlers.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/track-reconnection-conflict.d.ts +5 -0
- package/dist/types-ts4.5/types/index.d.ts +2 -1
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-collab-edit
|
|
2
2
|
|
|
3
|
+
## 2.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#109636](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/109636)
|
|
8
|
+
[`2eadf04054ac2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2eadf04054ac2) -
|
|
9
|
+
[ux] Introduces way to retrieve the document from offline if there is a possible conflict event on
|
|
10
|
+
reconnection.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 2.4.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -23,6 +23,7 @@ var _nativeCollabProviderPlugin = require("./pm-plugins/native-collab-provider-p
|
|
|
23
23
|
var _trackAndFilterSpammingSteps = require("./pm-plugins/track-and-filter-spamming-steps");
|
|
24
24
|
var _trackLastOrganicChange = require("./pm-plugins/track-last-organic-change");
|
|
25
25
|
var _trackNcsInitialization = require("./pm-plugins/track-ncs-initialization");
|
|
26
|
+
var _trackReconnectionConflict = require("./pm-plugins/track-reconnection-conflict");
|
|
26
27
|
var _trackSteps = require("./pm-plugins/track-steps");
|
|
27
28
|
var _utils = require("./pm-plugins/utils");
|
|
28
29
|
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; }
|
|
@@ -124,12 +125,14 @@ var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref
|
|
|
124
125
|
lastRemoteOrganicBodyChangeAt: null
|
|
125
126
|
},
|
|
126
127
|
activeParticipants: undefined,
|
|
127
|
-
sessionId: undefined
|
|
128
|
+
sessionId: undefined,
|
|
129
|
+
lastReconnectionConflictMetadata: undefined
|
|
128
130
|
};
|
|
129
131
|
}
|
|
130
132
|
var collabPluginState = _pluginKey.pluginKey.getState(state);
|
|
131
133
|
var metadata = _trackNcsInitialization.trackNCSInitializationPluginKey.getState(state);
|
|
132
134
|
var lastOrganicChangeState = _trackLastOrganicChange.trackLastOrganicChangePluginKey.getState(state);
|
|
135
|
+
var lastRemoteConflict = _trackReconnectionConflict.trackLastRemoteConflictPluginKey.getState(state);
|
|
133
136
|
return {
|
|
134
137
|
activeParticipants: collabPluginState === null || collabPluginState === void 0 ? void 0 : collabPluginState.activeParticipants,
|
|
135
138
|
sessionId: collabPluginState === null || collabPluginState === void 0 ? void 0 : collabPluginState.sessionId,
|
|
@@ -141,7 +144,8 @@ var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref
|
|
|
141
144
|
lastRemoteOrganicChangeAt: (lastOrganicChangeState === null || lastOrganicChangeState === void 0 ? void 0 : lastOrganicChangeState.lastRemoteOrganicChangeAt) || null,
|
|
142
145
|
lastLocalOrganicBodyChangeAt: (lastOrganicChangeState === null || lastOrganicChangeState === void 0 ? void 0 : lastOrganicChangeState.lastLocalOrganicBodyChangeAt) || null,
|
|
143
146
|
lastRemoteOrganicBodyChangeAt: (lastOrganicChangeState === null || lastOrganicChangeState === void 0 ? void 0 : lastOrganicChangeState.lastRemoteOrganicBodyChangeAt) || null
|
|
144
|
-
}
|
|
147
|
+
},
|
|
148
|
+
lastReconnectionConflictMetadata: lastRemoteConflict
|
|
145
149
|
};
|
|
146
150
|
},
|
|
147
151
|
actions: {
|
|
@@ -247,6 +251,12 @@ var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref
|
|
|
247
251
|
name: 'collabTrackLastOrganicChangePlugin',
|
|
248
252
|
plugin: _trackLastOrganicChange.createPlugin
|
|
249
253
|
});
|
|
254
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_offline_conflict_resolution')) {
|
|
255
|
+
plugins.push({
|
|
256
|
+
name: 'trackLastRemoteConflictPlugin',
|
|
257
|
+
plugin: _trackReconnectionConflict.createPlugin
|
|
258
|
+
});
|
|
259
|
+
}
|
|
250
260
|
return plugins;
|
|
251
261
|
},
|
|
252
262
|
onEditorViewStateUpdated: function onEditorViewStateUpdated(props) {
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.subscribe = void 0;
|
|
7
7
|
var _actions = require("../actions");
|
|
8
8
|
var _analytics = require("../analytics");
|
|
9
|
+
var _trackReconnectionConflict = require("../track-reconnection-conflict");
|
|
9
10
|
// Ignored via go/ees005
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
12
|
|
|
@@ -88,12 +89,15 @@ var subscribe = exports.subscribe = effect(function (view, provider, options, fe
|
|
|
88
89
|
entity.on('error', entityHandlers.errorHandler);
|
|
89
90
|
entityRef = entity;
|
|
90
91
|
}
|
|
92
|
+
},
|
|
93
|
+
dataConflictHandler: function dataConflictHandler(data) {
|
|
94
|
+
view.dispatch(view.state.tr.setMeta(_trackReconnectionConflict.trackLastRemoteConflictPluginKey, data));
|
|
91
95
|
}
|
|
92
96
|
};
|
|
93
|
-
provider.on('init', handlers.initHandler).on('connected', handlers.connectedHandler).on('data', handlers.dataHandler).on('presence', handlers.presenceHandler).on('activity:ack', handlers.activityAckHandler).on('activity:join', handlers.activityJoinHandler).on('telepointer', handlers.telepointerHandler).on('local-steps', handlers.localStepsHandler).on('error', handlers.errorHandler).on('entity', handlers.entityHandler);
|
|
97
|
+
provider.on('init', handlers.initHandler).on('connected', handlers.connectedHandler).on('data', handlers.dataHandler).on('presence', handlers.presenceHandler).on('activity:ack', handlers.activityAckHandler).on('activity:join', handlers.activityJoinHandler).on('telepointer', handlers.telepointerHandler).on('local-steps', handlers.localStepsHandler).on('error', handlers.errorHandler).on('entity', handlers.entityHandler).on('data:conflict', handlers.dataConflictHandler);
|
|
94
98
|
return function () {
|
|
95
99
|
unsubscribeSynchronyEntity();
|
|
96
|
-
provider.off('init', handlers.initHandler).off('connected', handlers.connectedHandler).off('data', handlers.dataHandler).off('presence', handlers.presenceHandler).off('activity:ack', handlers.activityAckHandler).off('activity:join', handlers.activityJoinHandler).off('telepointer', handlers.telepointerHandler).off('local-steps', handlers.localStepsHandler).off('error', handlers.errorHandler).off('entity', handlers.entityHandler);
|
|
100
|
+
provider.off('init', handlers.initHandler).off('connected', handlers.connectedHandler).off('data', handlers.dataHandler).off('presence', handlers.presenceHandler).off('activity:ack', handlers.activityAckHandler).off('activity:join', handlers.activityJoinHandler).off('telepointer', handlers.telepointerHandler).off('local-steps', handlers.localStepsHandler).off('error', handlers.errorHandler).off('entity', handlers.entityHandler).off('data:conflict', handlers.dataConflictHandler);
|
|
97
101
|
};
|
|
98
102
|
}, function (previousDeps, currentDeps) {
|
|
99
103
|
return currentDeps && currentDeps.every(function (dep, i) {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.trackLastRemoteConflictPluginKey = exports.createPlugin = void 0;
|
|
7
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
+
var trackLastRemoteConflictPluginKey = exports.trackLastRemoteConflictPluginKey = new _state.PluginKey('trackLastRemoteConflict');
|
|
10
|
+
var createPlugin = exports.createPlugin = function createPlugin() {
|
|
11
|
+
return new _safePlugin.SafePlugin({
|
|
12
|
+
key: trackLastRemoteConflictPluginKey,
|
|
13
|
+
state: {
|
|
14
|
+
init: function init() {
|
|
15
|
+
return undefined;
|
|
16
|
+
},
|
|
17
|
+
apply: function apply(transaction, prevPluginState) {
|
|
18
|
+
var metadata = transaction.getMeta(trackLastRemoteConflictPluginKey);
|
|
19
|
+
if (metadata) {
|
|
20
|
+
return metadata;
|
|
21
|
+
}
|
|
22
|
+
return prevPluginState;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
};
|
|
@@ -12,6 +12,7 @@ import { nativeCollabProviderPlugin } from './pm-plugins/native-collab-provider-
|
|
|
12
12
|
import { sanitizeFilteredStep, createPlugin as trackSpammingStepsPlugin } from './pm-plugins/track-and-filter-spamming-steps';
|
|
13
13
|
import { createPlugin as createLastOrganicChangePlugin, trackLastOrganicChangePluginKey } from './pm-plugins/track-last-organic-change';
|
|
14
14
|
import { createPlugin as createTrackNCSInitializationPlugin, trackNCSInitializationPluginKey } from './pm-plugins/track-ncs-initialization';
|
|
15
|
+
import { createPlugin as createTrackReconnectionConflictPlugin, trackLastRemoteConflictPluginKey } from './pm-plugins/track-reconnection-conflict';
|
|
15
16
|
import { track } from './pm-plugins/track-steps';
|
|
16
17
|
import { getAvatarColor } from './pm-plugins/utils';
|
|
17
18
|
const providerBuilder = collabEditProviderPromise => async (codeToExecute, onError) => {
|
|
@@ -85,12 +86,14 @@ export const collabEditPlugin = ({
|
|
|
85
86
|
lastRemoteOrganicBodyChangeAt: null
|
|
86
87
|
},
|
|
87
88
|
activeParticipants: undefined,
|
|
88
|
-
sessionId: undefined
|
|
89
|
+
sessionId: undefined,
|
|
90
|
+
lastReconnectionConflictMetadata: undefined
|
|
89
91
|
};
|
|
90
92
|
}
|
|
91
93
|
const collabPluginState = mainPluginKey.getState(state);
|
|
92
94
|
const metadata = trackNCSInitializationPluginKey.getState(state);
|
|
93
95
|
const lastOrganicChangeState = trackLastOrganicChangePluginKey.getState(state);
|
|
96
|
+
const lastRemoteConflict = trackLastRemoteConflictPluginKey.getState(state);
|
|
94
97
|
return {
|
|
95
98
|
activeParticipants: collabPluginState === null || collabPluginState === void 0 ? void 0 : collabPluginState.activeParticipants,
|
|
96
99
|
sessionId: collabPluginState === null || collabPluginState === void 0 ? void 0 : collabPluginState.sessionId,
|
|
@@ -102,7 +105,8 @@ export const collabEditPlugin = ({
|
|
|
102
105
|
lastRemoteOrganicChangeAt: (lastOrganicChangeState === null || lastOrganicChangeState === void 0 ? void 0 : lastOrganicChangeState.lastRemoteOrganicChangeAt) || null,
|
|
103
106
|
lastLocalOrganicBodyChangeAt: (lastOrganicChangeState === null || lastOrganicChangeState === void 0 ? void 0 : lastOrganicChangeState.lastLocalOrganicBodyChangeAt) || null,
|
|
104
107
|
lastRemoteOrganicBodyChangeAt: (lastOrganicChangeState === null || lastOrganicChangeState === void 0 ? void 0 : lastOrganicChangeState.lastRemoteOrganicBodyChangeAt) || null
|
|
105
|
-
}
|
|
108
|
+
},
|
|
109
|
+
lastReconnectionConflictMetadata: lastRemoteConflict
|
|
106
110
|
};
|
|
107
111
|
},
|
|
108
112
|
actions: {
|
|
@@ -193,6 +197,12 @@ export const collabEditPlugin = ({
|
|
|
193
197
|
name: 'collabTrackLastOrganicChangePlugin',
|
|
194
198
|
plugin: createLastOrganicChangePlugin
|
|
195
199
|
});
|
|
200
|
+
if (fg('platform_editor_offline_conflict_resolution')) {
|
|
201
|
+
plugins.push({
|
|
202
|
+
name: 'trackLastRemoteConflictPlugin',
|
|
203
|
+
plugin: createTrackReconnectionConflictPlugin
|
|
204
|
+
});
|
|
205
|
+
}
|
|
196
206
|
return plugins;
|
|
197
207
|
},
|
|
198
208
|
onEditorViewStateUpdated(props) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { applyRemoteData, handleActivityAck, handleActivityJoin, handleConnection, handleInit, handlePresence, handleTelePointer } from '../actions';
|
|
2
2
|
import { addSynchronyEntityAnalytics, addSynchronyErrorAnalytics } from '../analytics';
|
|
3
|
+
import { trackLastRemoteConflictPluginKey } from '../track-reconnection-conflict';
|
|
3
4
|
|
|
4
5
|
// Ignored via go/ees005
|
|
5
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -73,11 +74,14 @@ export const subscribe = effect((view, provider, options, featureFlags, _provide
|
|
|
73
74
|
entity.on('error', entityHandlers.errorHandler);
|
|
74
75
|
entityRef = entity;
|
|
75
76
|
}
|
|
77
|
+
},
|
|
78
|
+
dataConflictHandler: data => {
|
|
79
|
+
view.dispatch(view.state.tr.setMeta(trackLastRemoteConflictPluginKey, data));
|
|
76
80
|
}
|
|
77
81
|
};
|
|
78
|
-
provider.on('init', handlers.initHandler).on('connected', handlers.connectedHandler).on('data', handlers.dataHandler).on('presence', handlers.presenceHandler).on('activity:ack', handlers.activityAckHandler).on('activity:join', handlers.activityJoinHandler).on('telepointer', handlers.telepointerHandler).on('local-steps', handlers.localStepsHandler).on('error', handlers.errorHandler).on('entity', handlers.entityHandler);
|
|
82
|
+
provider.on('init', handlers.initHandler).on('connected', handlers.connectedHandler).on('data', handlers.dataHandler).on('presence', handlers.presenceHandler).on('activity:ack', handlers.activityAckHandler).on('activity:join', handlers.activityJoinHandler).on('telepointer', handlers.telepointerHandler).on('local-steps', handlers.localStepsHandler).on('error', handlers.errorHandler).on('entity', handlers.entityHandler).on('data:conflict', handlers.dataConflictHandler);
|
|
79
83
|
return () => {
|
|
80
84
|
unsubscribeSynchronyEntity();
|
|
81
|
-
provider.off('init', handlers.initHandler).off('connected', handlers.connectedHandler).off('data', handlers.dataHandler).off('presence', handlers.presenceHandler).off('activity:ack', handlers.activityAckHandler).off('activity:join', handlers.activityJoinHandler).off('telepointer', handlers.telepointerHandler).off('local-steps', handlers.localStepsHandler).off('error', handlers.errorHandler).off('entity', handlers.entityHandler);
|
|
85
|
+
provider.off('init', handlers.initHandler).off('connected', handlers.connectedHandler).off('data', handlers.dataHandler).off('presence', handlers.presenceHandler).off('activity:ack', handlers.activityAckHandler).off('activity:join', handlers.activityJoinHandler).off('telepointer', handlers.telepointerHandler).off('local-steps', handlers.localStepsHandler).off('error', handlers.errorHandler).off('entity', handlers.entityHandler).off('data:conflict', handlers.dataConflictHandler);
|
|
82
86
|
};
|
|
83
87
|
}, (previousDeps, currentDeps) => currentDeps && currentDeps.every((dep, i) => dep === previousDeps[i]));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export const trackLastRemoteConflictPluginKey = new PluginKey('trackLastRemoteConflict');
|
|
4
|
+
export const createPlugin = () => {
|
|
5
|
+
return new SafePlugin({
|
|
6
|
+
key: trackLastRemoteConflictPluginKey,
|
|
7
|
+
state: {
|
|
8
|
+
init() {
|
|
9
|
+
return undefined;
|
|
10
|
+
},
|
|
11
|
+
apply(transaction, prevPluginState) {
|
|
12
|
+
const metadata = transaction.getMeta(trackLastRemoteConflictPluginKey);
|
|
13
|
+
if (metadata) {
|
|
14
|
+
return metadata;
|
|
15
|
+
}
|
|
16
|
+
return prevPluginState;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -18,6 +18,7 @@ import { nativeCollabProviderPlugin } from './pm-plugins/native-collab-provider-
|
|
|
18
18
|
import { sanitizeFilteredStep, createPlugin as trackSpammingStepsPlugin } from './pm-plugins/track-and-filter-spamming-steps';
|
|
19
19
|
import { createPlugin as createLastOrganicChangePlugin, trackLastOrganicChangePluginKey } from './pm-plugins/track-last-organic-change';
|
|
20
20
|
import { createPlugin as createTrackNCSInitializationPlugin, trackNCSInitializationPluginKey } from './pm-plugins/track-ncs-initialization';
|
|
21
|
+
import { createPlugin as createTrackReconnectionConflictPlugin, trackLastRemoteConflictPluginKey } from './pm-plugins/track-reconnection-conflict';
|
|
21
22
|
import { track } from './pm-plugins/track-steps';
|
|
22
23
|
import { getAvatarColor } from './pm-plugins/utils';
|
|
23
24
|
var providerBuilder = function providerBuilder(collabEditProviderPromise) {
|
|
@@ -117,12 +118,14 @@ export var collabEditPlugin = function collabEditPlugin(_ref4) {
|
|
|
117
118
|
lastRemoteOrganicBodyChangeAt: null
|
|
118
119
|
},
|
|
119
120
|
activeParticipants: undefined,
|
|
120
|
-
sessionId: undefined
|
|
121
|
+
sessionId: undefined,
|
|
122
|
+
lastReconnectionConflictMetadata: undefined
|
|
121
123
|
};
|
|
122
124
|
}
|
|
123
125
|
var collabPluginState = mainPluginKey.getState(state);
|
|
124
126
|
var metadata = trackNCSInitializationPluginKey.getState(state);
|
|
125
127
|
var lastOrganicChangeState = trackLastOrganicChangePluginKey.getState(state);
|
|
128
|
+
var lastRemoteConflict = trackLastRemoteConflictPluginKey.getState(state);
|
|
126
129
|
return {
|
|
127
130
|
activeParticipants: collabPluginState === null || collabPluginState === void 0 ? void 0 : collabPluginState.activeParticipants,
|
|
128
131
|
sessionId: collabPluginState === null || collabPluginState === void 0 ? void 0 : collabPluginState.sessionId,
|
|
@@ -134,7 +137,8 @@ export var collabEditPlugin = function collabEditPlugin(_ref4) {
|
|
|
134
137
|
lastRemoteOrganicChangeAt: (lastOrganicChangeState === null || lastOrganicChangeState === void 0 ? void 0 : lastOrganicChangeState.lastRemoteOrganicChangeAt) || null,
|
|
135
138
|
lastLocalOrganicBodyChangeAt: (lastOrganicChangeState === null || lastOrganicChangeState === void 0 ? void 0 : lastOrganicChangeState.lastLocalOrganicBodyChangeAt) || null,
|
|
136
139
|
lastRemoteOrganicBodyChangeAt: (lastOrganicChangeState === null || lastOrganicChangeState === void 0 ? void 0 : lastOrganicChangeState.lastRemoteOrganicBodyChangeAt) || null
|
|
137
|
-
}
|
|
140
|
+
},
|
|
141
|
+
lastReconnectionConflictMetadata: lastRemoteConflict
|
|
138
142
|
};
|
|
139
143
|
},
|
|
140
144
|
actions: {
|
|
@@ -240,6 +244,12 @@ export var collabEditPlugin = function collabEditPlugin(_ref4) {
|
|
|
240
244
|
name: 'collabTrackLastOrganicChangePlugin',
|
|
241
245
|
plugin: createLastOrganicChangePlugin
|
|
242
246
|
});
|
|
247
|
+
if (fg('platform_editor_offline_conflict_resolution')) {
|
|
248
|
+
plugins.push({
|
|
249
|
+
name: 'trackLastRemoteConflictPlugin',
|
|
250
|
+
plugin: createTrackReconnectionConflictPlugin
|
|
251
|
+
});
|
|
252
|
+
}
|
|
243
253
|
return plugins;
|
|
244
254
|
},
|
|
245
255
|
onEditorViewStateUpdated: function onEditorViewStateUpdated(props) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { applyRemoteData, handleActivityAck, handleActivityJoin, handleConnection, handleInit, handlePresence, handleTelePointer } from '../actions';
|
|
2
2
|
import { addSynchronyEntityAnalytics, addSynchronyErrorAnalytics } from '../analytics';
|
|
3
|
+
import { trackLastRemoteConflictPluginKey } from '../track-reconnection-conflict';
|
|
3
4
|
|
|
4
5
|
// Ignored via go/ees005
|
|
5
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -83,12 +84,15 @@ export var subscribe = effect(function (view, provider, options, featureFlags, _
|
|
|
83
84
|
entity.on('error', entityHandlers.errorHandler);
|
|
84
85
|
entityRef = entity;
|
|
85
86
|
}
|
|
87
|
+
},
|
|
88
|
+
dataConflictHandler: function dataConflictHandler(data) {
|
|
89
|
+
view.dispatch(view.state.tr.setMeta(trackLastRemoteConflictPluginKey, data));
|
|
86
90
|
}
|
|
87
91
|
};
|
|
88
|
-
provider.on('init', handlers.initHandler).on('connected', handlers.connectedHandler).on('data', handlers.dataHandler).on('presence', handlers.presenceHandler).on('activity:ack', handlers.activityAckHandler).on('activity:join', handlers.activityJoinHandler).on('telepointer', handlers.telepointerHandler).on('local-steps', handlers.localStepsHandler).on('error', handlers.errorHandler).on('entity', handlers.entityHandler);
|
|
92
|
+
provider.on('init', handlers.initHandler).on('connected', handlers.connectedHandler).on('data', handlers.dataHandler).on('presence', handlers.presenceHandler).on('activity:ack', handlers.activityAckHandler).on('activity:join', handlers.activityJoinHandler).on('telepointer', handlers.telepointerHandler).on('local-steps', handlers.localStepsHandler).on('error', handlers.errorHandler).on('entity', handlers.entityHandler).on('data:conflict', handlers.dataConflictHandler);
|
|
89
93
|
return function () {
|
|
90
94
|
unsubscribeSynchronyEntity();
|
|
91
|
-
provider.off('init', handlers.initHandler).off('connected', handlers.connectedHandler).off('data', handlers.dataHandler).off('presence', handlers.presenceHandler).off('activity:ack', handlers.activityAckHandler).off('activity:join', handlers.activityJoinHandler).off('telepointer', handlers.telepointerHandler).off('local-steps', handlers.localStepsHandler).off('error', handlers.errorHandler).off('entity', handlers.entityHandler);
|
|
95
|
+
provider.off('init', handlers.initHandler).off('connected', handlers.connectedHandler).off('data', handlers.dataHandler).off('presence', handlers.presenceHandler).off('activity:ack', handlers.activityAckHandler).off('activity:join', handlers.activityJoinHandler).off('telepointer', handlers.telepointerHandler).off('local-steps', handlers.localStepsHandler).off('error', handlers.errorHandler).off('entity', handlers.entityHandler).off('data:conflict', handlers.dataConflictHandler);
|
|
92
96
|
};
|
|
93
97
|
}, function (previousDeps, currentDeps) {
|
|
94
98
|
return currentDeps && currentDeps.every(function (dep, i) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export var trackLastRemoteConflictPluginKey = new PluginKey('trackLastRemoteConflict');
|
|
4
|
+
export var createPlugin = function createPlugin() {
|
|
5
|
+
return new SafePlugin({
|
|
6
|
+
key: trackLastRemoteConflictPluginKey,
|
|
7
|
+
state: {
|
|
8
|
+
init: function init() {
|
|
9
|
+
return undefined;
|
|
10
|
+
},
|
|
11
|
+
apply: function apply(transaction, prevPluginState) {
|
|
12
|
+
var metadata = transaction.getMeta(trackLastRemoteConflictPluginKey);
|
|
13
|
+
if (metadata) {
|
|
14
|
+
return metadata;
|
|
15
|
+
}
|
|
16
|
+
return prevPluginState;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { CollabEditProvider, CollabEventConnectionData, CollabEventInitData, CollabEventLocalStepData, CollabEventPresenceData, CollabEventRemoteData, CollabTelepointerPayload } from '@atlaskit/editor-common/collab';
|
|
2
|
+
import type { CollabEditProvider, CollabEventConflictPayload, CollabEventConnectionData, CollabEventInitData, CollabEventLocalStepData, CollabEventPresenceData, CollabEventRemoteData, CollabTelepointerPayload } from '@atlaskit/editor-common/collab';
|
|
3
3
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
4
4
|
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -21,6 +21,7 @@ export interface CollabHandlers {
|
|
|
21
21
|
entityHandler: ({ entity }: {
|
|
22
22
|
entity: SynchronyEntity;
|
|
23
23
|
}) => void;
|
|
24
|
+
dataConflictHandler: (data: CollabEventConflictPayload) => void;
|
|
24
25
|
}
|
|
25
26
|
export type Cleanup = () => void;
|
|
26
27
|
export declare const subscribe: (currentDeps_0: EditorView, currentDeps_1: CollabEditProvider<import("@atlaskit/editor-common/collab").CollabEvents>, currentDeps_2: PrivateCollabEditOptions, currentDeps_3: FeatureFlags, currentDeps_4?: ProviderFactory | undefined, currentDeps_5?: EditorAnalyticsAPI | undefined) => Cleanup;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CollabEventConflictPayload } from '@atlaskit/editor-common/collab';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
export declare const trackLastRemoteConflictPluginKey: PluginKey<CollabEventConflictPayload>;
|
|
5
|
+
export declare const createPlugin: () => SafePlugin<CollabEventConflictPayload | undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CollabEditOptions, CollabEditProvider, CollabParticipant, SyncUpErrorFunction } from '@atlaskit/editor-common/collab';
|
|
1
|
+
import type { CollabEditOptions, CollabEditProvider, CollabEventConflictPayload, CollabParticipant, SyncUpErrorFunction } from '@atlaskit/editor-common/collab';
|
|
2
2
|
import { type Step } from '@atlaskit/editor-prosemirror/dist/types/transform';
|
|
3
3
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
export type PrivateCollabEditOptions = CollabEditOptions & {
|
|
@@ -39,4 +39,5 @@ export type CollabEditPluginSharedState = {
|
|
|
39
39
|
initialised: CollabInitializedMetadata & LastOrganicChangeMetadata;
|
|
40
40
|
activeParticipants: ReadOnlyParticipants | undefined;
|
|
41
41
|
sessionId: string | undefined;
|
|
42
|
+
lastReconnectionConflictMetadata: CollabEventConflictPayload | undefined;
|
|
42
43
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { CollabEditProvider, CollabEventConnectionData, CollabEventInitData, CollabEventLocalStepData, CollabEventPresenceData, CollabEventRemoteData, CollabTelepointerPayload } from '@atlaskit/editor-common/collab';
|
|
2
|
+
import type { CollabEditProvider, CollabEventConflictPayload, CollabEventConnectionData, CollabEventInitData, CollabEventLocalStepData, CollabEventPresenceData, CollabEventRemoteData, CollabTelepointerPayload } from '@atlaskit/editor-common/collab';
|
|
3
3
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
4
4
|
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -21,6 +21,7 @@ export interface CollabHandlers {
|
|
|
21
21
|
entityHandler: ({ entity }: {
|
|
22
22
|
entity: SynchronyEntity;
|
|
23
23
|
}) => void;
|
|
24
|
+
dataConflictHandler: (data: CollabEventConflictPayload) => void;
|
|
24
25
|
}
|
|
25
26
|
export type Cleanup = () => void;
|
|
26
27
|
export declare const subscribe: (currentDeps_0: EditorView, currentDeps_1: CollabEditProvider<import("@atlaskit/editor-common/collab").CollabEvents>, currentDeps_2: PrivateCollabEditOptions, currentDeps_3: FeatureFlags, currentDeps_4?: ProviderFactory | undefined, currentDeps_5?: EditorAnalyticsAPI | undefined) => Cleanup;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CollabEventConflictPayload } from '@atlaskit/editor-common/collab';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
export declare const trackLastRemoteConflictPluginKey: PluginKey<CollabEventConflictPayload>;
|
|
5
|
+
export declare const createPlugin: () => SafePlugin<CollabEventConflictPayload | undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CollabEditOptions, CollabEditProvider, CollabParticipant, SyncUpErrorFunction } from '@atlaskit/editor-common/collab';
|
|
1
|
+
import type { CollabEditOptions, CollabEditProvider, CollabEventConflictPayload, CollabParticipant, SyncUpErrorFunction } from '@atlaskit/editor-common/collab';
|
|
2
2
|
import { type Step } from '@atlaskit/editor-prosemirror/dist/types/transform';
|
|
3
3
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
export type PrivateCollabEditOptions = CollabEditOptions & {
|
|
@@ -39,4 +39,5 @@ export type CollabEditPluginSharedState = {
|
|
|
39
39
|
initialised: CollabInitializedMetadata & LastOrganicChangeMetadata;
|
|
40
40
|
activeParticipants: ReadOnlyParticipants | undefined;
|
|
41
41
|
sessionId: string | undefined;
|
|
42
|
+
lastReconnectionConflictMetadata: CollabEventConflictPayload | undefined;
|
|
42
43
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-collab-edit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Collab Edit plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
35
35
|
"@atlaskit/custom-steps": "^0.9.0",
|
|
36
|
-
"@atlaskit/editor-common": "^99.
|
|
36
|
+
"@atlaskit/editor-common": "^99.8.0",
|
|
37
37
|
"@atlaskit/editor-json-transformer": "^8.22.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "1.11.0",
|
|
39
39
|
"@atlaskit/editor-plugin-connectivity": "^1.1.0",
|
|
@@ -109,6 +109,9 @@
|
|
|
109
109
|
"platform_editor_merge_unconfirmed_steps": {
|
|
110
110
|
"type": "boolean"
|
|
111
111
|
},
|
|
112
|
+
"platform_editor_offline_conflict_resolution": {
|
|
113
|
+
"type": "boolean"
|
|
114
|
+
},
|
|
112
115
|
"platform_editor_selection_without_left_shift": {
|
|
113
116
|
"type": "boolean"
|
|
114
117
|
},
|