@atlaskit/editor-plugin-collab-edit 2.2.0 → 2.4.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 +20 -0
- package/dist/cjs/pm-plugins/actions.js +2 -8
- package/dist/cjs/pm-plugins/analytics.js +1 -4
- package/dist/cjs/pm-plugins/events/handlers.js +1 -4
- package/dist/cjs/pm-plugins/events/initialize.js +1 -4
- package/dist/cjs/pm-plugins/events/send-transaction.js +7 -2
- package/dist/cjs/pm-plugins/main/index.js +1 -6
- package/dist/cjs/pm-plugins/main/plugin-state.js +0 -2
- package/dist/cjs/pm-plugins/utils.js +5 -14
- package/dist/es2019/pm-plugins/actions.js +2 -8
- package/dist/es2019/pm-plugins/analytics.js +1 -4
- package/dist/es2019/pm-plugins/events/handlers.js +1 -4
- package/dist/es2019/pm-plugins/events/initialize.js +1 -4
- package/dist/es2019/pm-plugins/events/send-transaction.js +7 -2
- package/dist/es2019/pm-plugins/main/index.js +1 -6
- package/dist/es2019/pm-plugins/main/plugin-state.js +0 -3
- package/dist/es2019/pm-plugins/utils.js +3 -12
- package/dist/esm/pm-plugins/actions.js +2 -8
- package/dist/esm/pm-plugins/analytics.js +1 -4
- package/dist/esm/pm-plugins/events/handlers.js +1 -4
- package/dist/esm/pm-plugins/events/initialize.js +1 -4
- package/dist/esm/pm-plugins/events/send-transaction.js +7 -2
- package/dist/esm/pm-plugins/main/index.js +1 -6
- package/dist/esm/pm-plugins/main/plugin-state.js +0 -2
- package/dist/esm/pm-plugins/utils.js +6 -14
- package/package.json +13 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-collab-edit
|
|
2
2
|
|
|
3
|
+
## 2.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#106350](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/106350)
|
|
8
|
+
[`ab9819f908779`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ab9819f908779) -
|
|
9
|
+
Migrated onEditorViewStateUpdatedCallbacks calls to createEditorStateNotificationPlugin
|
|
10
|
+
|
|
11
|
+
## 2.3.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#109060](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/109060)
|
|
16
|
+
[`4660ec858a305`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4660ec858a305) -
|
|
17
|
+
Update `React` from v16 to v18
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 2.2.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
|
@@ -26,10 +26,7 @@ var registerAllCustomSteps = exports.registerAllCustomSteps = function registerA
|
|
|
26
26
|
Object.entries(allAtlaskitCustomSteps).forEach(function () {});
|
|
27
27
|
Object.entries(allAdfSchemaSteps).forEach(function () {});
|
|
28
28
|
};
|
|
29
|
-
var handleInit = exports.handleInit = function handleInit(initData, view, options, editorAnalyticsApi
|
|
30
|
-
// Ignored via go/ees005
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
32
|
-
) {
|
|
29
|
+
var handleInit = exports.handleInit = function handleInit(initData, view, options, editorAnalyticsApi) {
|
|
33
30
|
var doc = initData.doc,
|
|
34
31
|
json = initData.json,
|
|
35
32
|
version = initData.version,
|
|
@@ -84,10 +81,7 @@ var applyRemoteData = exports.applyRemoteData = function applyRemoteData(remoteD
|
|
|
84
81
|
applyRemoteSteps(json, view, userIds, options);
|
|
85
82
|
}
|
|
86
83
|
};
|
|
87
|
-
var applyRemoteSteps = exports.applyRemoteSteps = function applyRemoteSteps(json, view, userIds, options
|
|
88
|
-
// Ignored via go/ees005
|
|
89
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
90
|
-
) {
|
|
84
|
+
var applyRemoteSteps = exports.applyRemoteSteps = function applyRemoteSteps(json, view, userIds, options) {
|
|
91
85
|
if (!json || !json.length) {
|
|
92
86
|
return;
|
|
93
87
|
}
|
|
@@ -7,10 +7,7 @@ exports.addSynchronyErrorAnalytics = exports.addSynchronyEntityAnalytics = void
|
|
|
7
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
8
|
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
9
9
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
10
|
-
var addSynchronyErrorAnalytics = exports.addSynchronyErrorAnalytics = function addSynchronyErrorAnalytics(state, tr, featureFlags, editorAnalyticsApi
|
|
11
|
-
// Ignored via go/ees005
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
13
|
-
) {
|
|
10
|
+
var addSynchronyErrorAnalytics = exports.addSynchronyErrorAnalytics = function addSynchronyErrorAnalytics(state, tr, featureFlags, editorAnalyticsApi) {
|
|
14
11
|
return function (error) {
|
|
15
12
|
var browserExtensions = (0, _utils.sniffUserBrowserExtensions)({
|
|
16
13
|
extensions: ['grammarly']
|
|
@@ -29,10 +29,7 @@ var effect = function effect(fn, eq) {
|
|
|
29
29
|
return cleanup;
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
var subscribe = exports.subscribe = effect(
|
|
33
|
-
// Ignored via go/ees005
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
35
|
-
function (view, provider, options, featureFlags, _providerFactory, editorAnalyticsApi) {
|
|
32
|
+
var subscribe = exports.subscribe = effect(function (view, provider, options, featureFlags, _providerFactory, editorAnalyticsApi) {
|
|
36
33
|
var entityRef;
|
|
37
34
|
var entityHandlers = {
|
|
38
35
|
disconnectedHandler: function disconnectedHandler() {
|
|
@@ -18,10 +18,7 @@ var initCollab = function initCollab(collabEditProvider, view) {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
var initNewCollab = function initNewCollab(collabEditProvider, view, editorApi, onSyncUpError
|
|
22
|
-
// Ignored via go/ees005
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
24
|
-
) {
|
|
21
|
+
var initNewCollab = function initNewCollab(collabEditProvider, view, editorApi, onSyncUpError) {
|
|
25
22
|
collabEditProvider.setup({
|
|
26
23
|
getState: function getState() {
|
|
27
24
|
return view.state;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.sendTransaction = void 0;
|
|
7
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
7
8
|
var _actions = require("../actions");
|
|
8
9
|
var _pluginKey = require("../main/plugin-key");
|
|
9
10
|
var sendTransaction = exports.sendTransaction = function sendTransaction(_ref) {
|
|
@@ -14,7 +15,7 @@ var sendTransaction = exports.sendTransaction = function sendTransaction(_ref) {
|
|
|
14
15
|
useNativePlugin = _ref.useNativePlugin,
|
|
15
16
|
viewMode = _ref.viewMode;
|
|
16
17
|
return function (provider) {
|
|
17
|
-
var docChangedTransaction = transactions.find(function (tr) {
|
|
18
|
+
var docChangedTransaction = (0, _platformFeatureFlags.fg)('platform_editor_migrate_state_updates') ? originalTransaction.docChanged : transactions.find(function (tr) {
|
|
18
19
|
return tr.docChanged;
|
|
19
20
|
});
|
|
20
21
|
var currentPluginState = _pluginKey.pluginKey.getState(newEditorState);
|
|
@@ -27,7 +28,11 @@ var sendTransaction = exports.sendTransaction = function sendTransaction(_ref) {
|
|
|
27
28
|
// This metadata is coming from the scaleTable command in table-resizing plugin
|
|
28
29
|
!originalTransaction.getMeta('scaleTable') && docChangedTransaction;
|
|
29
30
|
if (useNativePlugin || shouldSendStepForSynchronyCollabProvider) {
|
|
30
|
-
|
|
31
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_migrate_state_updates')) {
|
|
32
|
+
provider.send(originalTransaction, oldEditorState, newEditorState);
|
|
33
|
+
} else {
|
|
34
|
+
provider.send(docChangedTransaction, oldEditorState, newEditorState);
|
|
35
|
+
}
|
|
31
36
|
}
|
|
32
37
|
var prevPluginState = _pluginKey.pluginKey.getState(oldEditorState);
|
|
33
38
|
var _ref2 = prevPluginState || {},
|
|
@@ -54,10 +54,7 @@ var enforceCustomStepRegisters = function enforceCustomStepRegisters() {
|
|
|
54
54
|
// @ts-expect-error
|
|
55
55
|
tryToRegisterStep(adfCustomSteps);
|
|
56
56
|
};
|
|
57
|
-
var createPlugin = exports.createPlugin = function createPlugin(dispatch, providerFactory, providerResolver, collabProviderCallback, options, featureFlags, pluginInjectionApi
|
|
58
|
-
// Ignored via go/ees005
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
60
|
-
) {
|
|
57
|
+
var createPlugin = exports.createPlugin = function createPlugin(dispatch, providerFactory, providerResolver, collabProviderCallback, options, featureFlags, pluginInjectionApi) {
|
|
61
58
|
enforceCustomStepRegisters();
|
|
62
59
|
return new _safePlugin.SafePlugin({
|
|
63
60
|
key: _pluginKey.pluginKey,
|
|
@@ -67,8 +64,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
|
|
|
67
64
|
init: function init(config) {
|
|
68
65
|
return _pluginState.PluginState.init(config);
|
|
69
66
|
},
|
|
70
|
-
// Ignored via go/ees005
|
|
71
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
72
67
|
apply: function apply(transaction, prevPluginState, _oldEditorState, _newEditorState) {
|
|
73
68
|
var pluginState = prevPluginState.apply(transaction);
|
|
74
69
|
dispatch(_pluginKey.pluginKey, pluginState);
|
|
@@ -30,8 +30,6 @@ var getValidPos = exports.getValidPos = function getValidPos(tr, pos) {
|
|
|
30
30
|
return endOfDocPos;
|
|
31
31
|
};
|
|
32
32
|
var PluginState = exports.PluginState = /*#__PURE__*/function () {
|
|
33
|
-
// Ignored via go/ees005
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
35
33
|
function PluginState(decorations, participants, sessionId) {
|
|
36
34
|
var collabInitalised = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
37
35
|
var onError = arguments.length > 4 ? arguments[4] : undefined;
|
|
@@ -37,10 +37,7 @@ function getAvatarColor(str) {
|
|
|
37
37
|
textColor: participantColor.color.textColor
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
var createTelepointers = exports.createTelepointers = function createTelepointers(from, to, sessionId, isSelection, initial, presenceId
|
|
41
|
-
// Ignored via go/ees005
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
43
|
-
) {
|
|
40
|
+
var createTelepointers = exports.createTelepointers = function createTelepointers(from, to, sessionId, isSelection, initial, presenceId) {
|
|
44
41
|
var decorations = [];
|
|
45
42
|
var avatarColor = getAvatarColor(presenceId);
|
|
46
43
|
var color = avatarColor.index.toString();
|
|
@@ -99,10 +96,7 @@ var createTelepointers = exports.createTelepointers = function createTelepointer
|
|
|
99
96
|
key: "telepointer-".concat(sessionId, "-zero")
|
|
100
97
|
}));
|
|
101
98
|
};
|
|
102
|
-
var replaceDocument = exports.replaceDocument = function replaceDocument(doc, state, version, options, reserveCursor, editorAnalyticsAPI
|
|
103
|
-
// Ignored via go/ees005
|
|
104
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
105
|
-
) {
|
|
99
|
+
var replaceDocument = exports.replaceDocument = function replaceDocument(doc, state, version, options, reserveCursor, editorAnalyticsAPI) {
|
|
106
100
|
var schema = state.schema,
|
|
107
101
|
tr = state.tr;
|
|
108
102
|
var hasContent;
|
|
@@ -148,10 +142,7 @@ var replaceDocument = exports.replaceDocument = function replaceDocument(doc, st
|
|
|
148
142
|
}
|
|
149
143
|
return tr;
|
|
150
144
|
};
|
|
151
|
-
var scrollToCollabCursor = exports.scrollToCollabCursor = function scrollToCollabCursor(editorView, participants, sessionId, index, editorAnalyticsAPI
|
|
152
|
-
// Ignored via go/ees005
|
|
153
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
154
|
-
) {
|
|
145
|
+
var scrollToCollabCursor = exports.scrollToCollabCursor = function scrollToCollabCursor(editorView, participants, sessionId, index, editorAnalyticsAPI) {
|
|
155
146
|
var selectedUser = participants[index];
|
|
156
147
|
if (selectedUser && selectedUser.cursorPos !== undefined && selectedUser.sessionId !== sessionId) {
|
|
157
148
|
var state = editorView.state;
|
|
@@ -184,14 +175,14 @@ var getPositionOfTelepointer = exports.getPositionOfTelepointer = function getPo
|
|
|
184
175
|
var isReplaceStep = exports.isReplaceStep = function isReplaceStep(step) {
|
|
185
176
|
return step instanceof _transform.ReplaceStep;
|
|
186
177
|
};
|
|
187
|
-
var
|
|
178
|
+
var _originalTransactionHasMeta = exports.originalTransactionHasMeta = function originalTransactionHasMeta(transaction, metaTag) {
|
|
188
179
|
var hasMetaTag = Boolean(transaction.getMeta(metaTag));
|
|
189
180
|
if (hasMetaTag) {
|
|
190
181
|
return true;
|
|
191
182
|
}
|
|
192
183
|
var appendedTransaction = transaction.getMeta('appendedTransaction');
|
|
193
184
|
if (appendedTransaction instanceof _state.Transaction) {
|
|
194
|
-
return
|
|
185
|
+
return _originalTransactionHasMeta(appendedTransaction, metaTag);
|
|
195
186
|
}
|
|
196
187
|
return false;
|
|
197
188
|
};
|
|
@@ -16,10 +16,7 @@ export const registerAllCustomSteps = () => {
|
|
|
16
16
|
Object.entries(allAtlaskitCustomSteps).forEach(() => {});
|
|
17
17
|
Object.entries(allAdfSchemaSteps).forEach(() => {});
|
|
18
18
|
};
|
|
19
|
-
export const handleInit = (initData, view, options, editorAnalyticsApi
|
|
20
|
-
// Ignored via go/ees005
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
22
|
-
) => {
|
|
19
|
+
export const handleInit = (initData, view, options, editorAnalyticsApi) => {
|
|
23
20
|
const {
|
|
24
21
|
doc,
|
|
25
22
|
json,
|
|
@@ -87,10 +84,7 @@ export const applyRemoteData = (remoteData, view, options) => {
|
|
|
87
84
|
applyRemoteSteps(json, view, userIds, options);
|
|
88
85
|
}
|
|
89
86
|
};
|
|
90
|
-
export const applyRemoteSteps = (json, view, userIds, options
|
|
91
|
-
// Ignored via go/ees005
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
93
|
-
) => {
|
|
87
|
+
export const applyRemoteSteps = (json, view, userIds, options) => {
|
|
94
88
|
if (!json || !json.length) {
|
|
95
89
|
return;
|
|
96
90
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { getDocStructure } from '@atlaskit/editor-common/core-utils';
|
|
3
3
|
import { sniffUserBrowserExtensions } from '@atlaskit/editor-common/utils';
|
|
4
|
-
export const addSynchronyErrorAnalytics = (state, tr, featureFlags, editorAnalyticsApi
|
|
5
|
-
// Ignored via go/ees005
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
7
|
-
) => {
|
|
4
|
+
export const addSynchronyErrorAnalytics = (state, tr, featureFlags, editorAnalyticsApi) => {
|
|
8
5
|
return error => {
|
|
9
6
|
const browserExtensions = sniffUserBrowserExtensions({
|
|
10
7
|
extensions: ['grammarly']
|
|
@@ -21,10 +21,7 @@ const effect = (fn, eq) => {
|
|
|
21
21
|
return cleanup;
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
export const subscribe = effect(
|
|
25
|
-
// Ignored via go/ees005
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
27
|
-
(view, provider, options, featureFlags, _providerFactory, editorAnalyticsApi) => {
|
|
24
|
+
export const subscribe = effect((view, provider, options, featureFlags, _providerFactory, editorAnalyticsApi) => {
|
|
28
25
|
let entityRef;
|
|
29
26
|
const entityHandlers = {
|
|
30
27
|
disconnectedHandler: () => {
|
|
@@ -7,10 +7,7 @@ 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, editorApi, onSyncUpError
|
|
11
|
-
// Ignored via go/ees005
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
13
|
-
) => {
|
|
10
|
+
const initNewCollab = (collabEditProvider, view, editorApi, onSyncUpError) => {
|
|
14
11
|
collabEditProvider.setup({
|
|
15
12
|
getState: () => view.state,
|
|
16
13
|
editorApi,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { getSendableSelection } from '../actions';
|
|
2
3
|
import { pluginKey } from '../main/plugin-key';
|
|
3
4
|
export const sendTransaction = ({
|
|
@@ -8,7 +9,7 @@ export const sendTransaction = ({
|
|
|
8
9
|
useNativePlugin,
|
|
9
10
|
viewMode
|
|
10
11
|
}) => provider => {
|
|
11
|
-
const docChangedTransaction = transactions.find(tr => tr.docChanged);
|
|
12
|
+
const docChangedTransaction = fg('platform_editor_migrate_state_updates') ? originalTransaction.docChanged : transactions.find(tr => tr.docChanged);
|
|
12
13
|
const currentPluginState = pluginKey.getState(newEditorState);
|
|
13
14
|
if (!(currentPluginState !== null && currentPluginState !== void 0 && currentPluginState.isReady)) {
|
|
14
15
|
return;
|
|
@@ -19,7 +20,11 @@ export const sendTransaction = ({
|
|
|
19
20
|
// This metadata is coming from the scaleTable command in table-resizing plugin
|
|
20
21
|
!originalTransaction.getMeta('scaleTable') && docChangedTransaction;
|
|
21
22
|
if (useNativePlugin || shouldSendStepForSynchronyCollabProvider) {
|
|
22
|
-
|
|
23
|
+
if (fg('platform_editor_migrate_state_updates')) {
|
|
24
|
+
provider.send(originalTransaction, oldEditorState, newEditorState);
|
|
25
|
+
} else {
|
|
26
|
+
provider.send(docChangedTransaction, oldEditorState, newEditorState);
|
|
27
|
+
}
|
|
23
28
|
}
|
|
24
29
|
const prevPluginState = pluginKey.getState(oldEditorState);
|
|
25
30
|
const {
|
|
@@ -42,10 +42,7 @@ const enforceCustomStepRegisters = () => {
|
|
|
42
42
|
// @ts-expect-error
|
|
43
43
|
tryToRegisterStep(adfCustomSteps);
|
|
44
44
|
};
|
|
45
|
-
export const createPlugin = (dispatch, providerFactory, providerResolver, collabProviderCallback, options, featureFlags, pluginInjectionApi
|
|
46
|
-
// Ignored via go/ees005
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
48
|
-
) => {
|
|
45
|
+
export const createPlugin = (dispatch, providerFactory, providerResolver, collabProviderCallback, options, featureFlags, pluginInjectionApi) => {
|
|
49
46
|
enforceCustomStepRegisters();
|
|
50
47
|
return new SafePlugin({
|
|
51
48
|
key: pluginKey,
|
|
@@ -55,8 +52,6 @@ export const createPlugin = (dispatch, providerFactory, providerResolver, collab
|
|
|
55
52
|
init(config) {
|
|
56
53
|
return PluginState.init(config);
|
|
57
54
|
},
|
|
58
|
-
// Ignored via go/ees005
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
60
55
|
apply(transaction, prevPluginState, _oldEditorState, _newEditorState) {
|
|
61
56
|
const pluginState = prevPluginState.apply(transaction);
|
|
62
57
|
dispatch(pluginKey, pluginState);
|
|
@@ -31,9 +31,6 @@ export class PluginState {
|
|
|
31
31
|
get sessionId() {
|
|
32
32
|
return this.sid;
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
// Ignored via go/ees005
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
37
34
|
constructor(decorations, participants, sessionId, collabInitalised = false, onError) {
|
|
38
35
|
// eslint-disable-next-line no-console
|
|
39
36
|
_defineProperty(this, "onError", error => console.error(error));
|
|
@@ -23,10 +23,7 @@ export function getAvatarColor(str) {
|
|
|
23
23
|
textColor: participantColor.color.textColor
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
export const createTelepointers = (from, to, sessionId, isSelection, initial, presenceId
|
|
27
|
-
// Ignored via go/ees005
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
29
|
-
) => {
|
|
26
|
+
export const createTelepointers = (from, to, sessionId, isSelection, initial, presenceId) => {
|
|
30
27
|
const decorations = [];
|
|
31
28
|
const avatarColor = getAvatarColor(presenceId);
|
|
32
29
|
const color = avatarColor.index.toString();
|
|
@@ -85,10 +82,7 @@ export const createTelepointers = (from, to, sessionId, isSelection, initial, pr
|
|
|
85
82
|
key: `telepointer-${sessionId}-zero`
|
|
86
83
|
}));
|
|
87
84
|
};
|
|
88
|
-
export const replaceDocument = (doc, state, version, options, reserveCursor, editorAnalyticsAPI
|
|
89
|
-
// Ignored via go/ees005
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
91
|
-
) => {
|
|
85
|
+
export const replaceDocument = (doc, state, version, options, reserveCursor, editorAnalyticsAPI) => {
|
|
92
86
|
const {
|
|
93
87
|
schema,
|
|
94
88
|
tr
|
|
@@ -134,10 +128,7 @@ export const replaceDocument = (doc, state, version, options, reserveCursor, edi
|
|
|
134
128
|
}
|
|
135
129
|
return tr;
|
|
136
130
|
};
|
|
137
|
-
export const scrollToCollabCursor = (editorView, participants, sessionId, index, editorAnalyticsAPI
|
|
138
|
-
// Ignored via go/ees005
|
|
139
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
140
|
-
) => {
|
|
131
|
+
export const scrollToCollabCursor = (editorView, participants, sessionId, index, editorAnalyticsAPI) => {
|
|
141
132
|
const selectedUser = participants[index];
|
|
142
133
|
if (selectedUser && selectedUser.cursorPos !== undefined && selectedUser.sessionId !== sessionId) {
|
|
143
134
|
const {
|
|
@@ -16,10 +16,7 @@ export var registerAllCustomSteps = function registerAllCustomSteps() {
|
|
|
16
16
|
Object.entries(allAtlaskitCustomSteps).forEach(function () {});
|
|
17
17
|
Object.entries(allAdfSchemaSteps).forEach(function () {});
|
|
18
18
|
};
|
|
19
|
-
export var handleInit = function handleInit(initData, view, options, editorAnalyticsApi
|
|
20
|
-
// Ignored via go/ees005
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
22
|
-
) {
|
|
19
|
+
export var handleInit = function handleInit(initData, view, options, editorAnalyticsApi) {
|
|
23
20
|
var doc = initData.doc,
|
|
24
21
|
json = initData.json,
|
|
25
22
|
version = initData.version,
|
|
@@ -74,10 +71,7 @@ export var applyRemoteData = function applyRemoteData(remoteData, view, options)
|
|
|
74
71
|
applyRemoteSteps(json, view, userIds, options);
|
|
75
72
|
}
|
|
76
73
|
};
|
|
77
|
-
export var applyRemoteSteps = function applyRemoteSteps(json, view, userIds, options
|
|
78
|
-
// Ignored via go/ees005
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
80
|
-
) {
|
|
74
|
+
export var applyRemoteSteps = function applyRemoteSteps(json, view, userIds, options) {
|
|
81
75
|
if (!json || !json.length) {
|
|
82
76
|
return;
|
|
83
77
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { getDocStructure } from '@atlaskit/editor-common/core-utils';
|
|
3
3
|
import { sniffUserBrowserExtensions } from '@atlaskit/editor-common/utils';
|
|
4
|
-
export var addSynchronyErrorAnalytics = function addSynchronyErrorAnalytics(state, tr, featureFlags, editorAnalyticsApi
|
|
5
|
-
// Ignored via go/ees005
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
7
|
-
) {
|
|
4
|
+
export var addSynchronyErrorAnalytics = function addSynchronyErrorAnalytics(state, tr, featureFlags, editorAnalyticsApi) {
|
|
8
5
|
return function (error) {
|
|
9
6
|
var browserExtensions = sniffUserBrowserExtensions({
|
|
10
7
|
extensions: ['grammarly']
|
|
@@ -24,10 +24,7 @@ var effect = function effect(fn, eq) {
|
|
|
24
24
|
return cleanup;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
-
export var subscribe = effect(
|
|
28
|
-
// Ignored via go/ees005
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
30
|
-
function (view, provider, options, featureFlags, _providerFactory, editorAnalyticsApi) {
|
|
27
|
+
export var subscribe = effect(function (view, provider, options, featureFlags, _providerFactory, editorAnalyticsApi) {
|
|
31
28
|
var entityRef;
|
|
32
29
|
var entityHandlers = {
|
|
33
30
|
disconnectedHandler: function disconnectedHandler() {
|
|
@@ -11,10 +11,7 @@ var initCollab = function initCollab(collabEditProvider, view) {
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
-
var initNewCollab = function initNewCollab(collabEditProvider, view, editorApi, onSyncUpError
|
|
15
|
-
// Ignored via go/ees005
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
17
|
-
) {
|
|
14
|
+
var initNewCollab = function initNewCollab(collabEditProvider, view, editorApi, onSyncUpError) {
|
|
18
15
|
collabEditProvider.setup({
|
|
19
16
|
getState: function getState() {
|
|
20
17
|
return view.state;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { getSendableSelection } from '../actions';
|
|
2
3
|
import { pluginKey } from '../main/plugin-key';
|
|
3
4
|
export var sendTransaction = function sendTransaction(_ref) {
|
|
@@ -8,7 +9,7 @@ export var sendTransaction = function sendTransaction(_ref) {
|
|
|
8
9
|
useNativePlugin = _ref.useNativePlugin,
|
|
9
10
|
viewMode = _ref.viewMode;
|
|
10
11
|
return function (provider) {
|
|
11
|
-
var docChangedTransaction = transactions.find(function (tr) {
|
|
12
|
+
var docChangedTransaction = fg('platform_editor_migrate_state_updates') ? originalTransaction.docChanged : transactions.find(function (tr) {
|
|
12
13
|
return tr.docChanged;
|
|
13
14
|
});
|
|
14
15
|
var currentPluginState = pluginKey.getState(newEditorState);
|
|
@@ -21,7 +22,11 @@ export var sendTransaction = function sendTransaction(_ref) {
|
|
|
21
22
|
// This metadata is coming from the scaleTable command in table-resizing plugin
|
|
22
23
|
!originalTransaction.getMeta('scaleTable') && docChangedTransaction;
|
|
23
24
|
if (useNativePlugin || shouldSendStepForSynchronyCollabProvider) {
|
|
24
|
-
|
|
25
|
+
if (fg('platform_editor_migrate_state_updates')) {
|
|
26
|
+
provider.send(originalTransaction, oldEditorState, newEditorState);
|
|
27
|
+
} else {
|
|
28
|
+
provider.send(docChangedTransaction, oldEditorState, newEditorState);
|
|
29
|
+
}
|
|
25
30
|
}
|
|
26
31
|
var prevPluginState = pluginKey.getState(oldEditorState);
|
|
27
32
|
var _ref2 = prevPluginState || {},
|
|
@@ -43,10 +43,7 @@ var enforceCustomStepRegisters = function enforceCustomStepRegisters() {
|
|
|
43
43
|
// @ts-expect-error
|
|
44
44
|
tryToRegisterStep(adfCustomSteps);
|
|
45
45
|
};
|
|
46
|
-
export var createPlugin = function createPlugin(dispatch, providerFactory, providerResolver, collabProviderCallback, options, featureFlags, pluginInjectionApi
|
|
47
|
-
// Ignored via go/ees005
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
49
|
-
) {
|
|
46
|
+
export var createPlugin = function createPlugin(dispatch, providerFactory, providerResolver, collabProviderCallback, options, featureFlags, pluginInjectionApi) {
|
|
50
47
|
enforceCustomStepRegisters();
|
|
51
48
|
return new SafePlugin({
|
|
52
49
|
key: pluginKey,
|
|
@@ -56,8 +53,6 @@ export var createPlugin = function createPlugin(dispatch, providerFactory, provi
|
|
|
56
53
|
init: function init(config) {
|
|
57
54
|
return PluginState.init(config);
|
|
58
55
|
},
|
|
59
|
-
// Ignored via go/ees005
|
|
60
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
61
56
|
apply: function apply(transaction, prevPluginState, _oldEditorState, _newEditorState) {
|
|
62
57
|
var pluginState = prevPluginState.apply(transaction);
|
|
63
58
|
dispatch(pluginKey, pluginState);
|
|
@@ -24,8 +24,6 @@ export var getValidPos = function getValidPos(tr, pos) {
|
|
|
24
24
|
return endOfDocPos;
|
|
25
25
|
};
|
|
26
26
|
export var PluginState = /*#__PURE__*/function () {
|
|
27
|
-
// Ignored via go/ees005
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
29
27
|
function PluginState(decorations, participants, sessionId) {
|
|
30
28
|
var collabInitalised = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
31
29
|
var onError = arguments.length > 4 ? arguments[4] : undefined;
|
|
@@ -28,10 +28,7 @@ export function getAvatarColor(str) {
|
|
|
28
28
|
textColor: participantColor.color.textColor
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
export var createTelepointers = function createTelepointers(from, to, sessionId, isSelection, initial, presenceId
|
|
32
|
-
// Ignored via go/ees005
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
34
|
-
) {
|
|
31
|
+
export var createTelepointers = function createTelepointers(from, to, sessionId, isSelection, initial, presenceId) {
|
|
35
32
|
var decorations = [];
|
|
36
33
|
var avatarColor = getAvatarColor(presenceId);
|
|
37
34
|
var color = avatarColor.index.toString();
|
|
@@ -90,10 +87,7 @@ export var createTelepointers = function createTelepointers(from, to, sessionId,
|
|
|
90
87
|
key: "telepointer-".concat(sessionId, "-zero")
|
|
91
88
|
}));
|
|
92
89
|
};
|
|
93
|
-
export var replaceDocument = function replaceDocument(doc, state, version, options, reserveCursor, editorAnalyticsAPI
|
|
94
|
-
// Ignored via go/ees005
|
|
95
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
96
|
-
) {
|
|
90
|
+
export var replaceDocument = function replaceDocument(doc, state, version, options, reserveCursor, editorAnalyticsAPI) {
|
|
97
91
|
var schema = state.schema,
|
|
98
92
|
tr = state.tr;
|
|
99
93
|
var hasContent;
|
|
@@ -139,10 +133,7 @@ export var replaceDocument = function replaceDocument(doc, state, version, optio
|
|
|
139
133
|
}
|
|
140
134
|
return tr;
|
|
141
135
|
};
|
|
142
|
-
export var scrollToCollabCursor = function scrollToCollabCursor(editorView, participants, sessionId, index, editorAnalyticsAPI
|
|
143
|
-
// Ignored via go/ees005
|
|
144
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
145
|
-
) {
|
|
136
|
+
export var scrollToCollabCursor = function scrollToCollabCursor(editorView, participants, sessionId, index, editorAnalyticsAPI) {
|
|
146
137
|
var selectedUser = participants[index];
|
|
147
138
|
if (selectedUser && selectedUser.cursorPos !== undefined && selectedUser.sessionId !== sessionId) {
|
|
148
139
|
var state = editorView.state;
|
|
@@ -175,14 +166,14 @@ export var getPositionOfTelepointer = function getPositionOfTelepointer(sessionI
|
|
|
175
166
|
export var isReplaceStep = function isReplaceStep(step) {
|
|
176
167
|
return step instanceof ReplaceStep;
|
|
177
168
|
};
|
|
178
|
-
|
|
169
|
+
var _originalTransactionHasMeta = function originalTransactionHasMeta(transaction, metaTag) {
|
|
179
170
|
var hasMetaTag = Boolean(transaction.getMeta(metaTag));
|
|
180
171
|
if (hasMetaTag) {
|
|
181
172
|
return true;
|
|
182
173
|
}
|
|
183
174
|
var appendedTransaction = transaction.getMeta('appendedTransaction');
|
|
184
175
|
if (appendedTransaction instanceof Transaction) {
|
|
185
|
-
return
|
|
176
|
+
return _originalTransactionHasMeta(appendedTransaction, metaTag);
|
|
186
177
|
}
|
|
187
178
|
return false;
|
|
188
179
|
};
|
|
@@ -197,6 +188,7 @@ export var originalTransactionHasMeta = function originalTransactionHasMeta(tran
|
|
|
197
188
|
*
|
|
198
189
|
* Steps analycs dashboard: https://atlassian-discover.cloud.databricks.com/dashboardsv3/01ef4d3c8aa916c8b0cb5332a9f37caf/published?o=4482001201517624
|
|
199
190
|
*/
|
|
191
|
+
export { _originalTransactionHasMeta as originalTransactionHasMeta };
|
|
200
192
|
var blockedAttrsList = ['__contextId', 'localId', '__autoSize', 'attr_colwidth', 'originalHeight', 'originalWidth'];
|
|
201
193
|
|
|
202
194
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-collab-edit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Collab Edit plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
35
35
|
"@atlaskit/custom-steps": "^0.9.0",
|
|
36
|
-
"@atlaskit/editor-common": "^99.
|
|
37
|
-
"@atlaskit/editor-json-transformer": "^8.
|
|
36
|
+
"@atlaskit/editor-common": "^99.7.0",
|
|
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",
|
|
40
40
|
"@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
|
|
@@ -53,16 +53,16 @@
|
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@af/integration-testing": "*",
|
|
55
55
|
"@af/visual-regression": "*",
|
|
56
|
-
"@atlaskit/editor-plugin-mentions": "^2.
|
|
57
|
-
"@atlaskit/editor-plugin-text-formatting": "^1.
|
|
58
|
-
"@atlaskit/editor-plugin-type-ahead": "^1.
|
|
59
|
-
"@atlaskit/editor-plugin-unsupported-content": "^1.
|
|
60
|
-
"@atlaskit/editor-test-helpers": "^21.
|
|
56
|
+
"@atlaskit/editor-plugin-mentions": "^2.14.0",
|
|
57
|
+
"@atlaskit/editor-plugin-text-formatting": "^1.17.0",
|
|
58
|
+
"@atlaskit/editor-plugin-type-ahead": "^1.12.0",
|
|
59
|
+
"@atlaskit/editor-plugin-unsupported-content": "^1.10.0",
|
|
60
|
+
"@atlaskit/editor-test-helpers": "^21.2.0",
|
|
61
61
|
"@atlaskit/ssr": "*",
|
|
62
62
|
"@atlaskit/synchrony-test-helpers": "^3.0.0",
|
|
63
|
-
"@atlaskit/util-data-test": "^
|
|
63
|
+
"@atlaskit/util-data-test": "^18.0.0",
|
|
64
64
|
"@atlaskit/visual-regression": "*",
|
|
65
|
-
"@testing-library/react": "^
|
|
65
|
+
"@testing-library/react": "^13.4.0",
|
|
66
66
|
"typescript": "~5.4.2",
|
|
67
67
|
"wait-for-expect": "^1.2.0"
|
|
68
68
|
},
|
|
@@ -111,6 +111,9 @@
|
|
|
111
111
|
},
|
|
112
112
|
"platform_editor_selection_without_left_shift": {
|
|
113
113
|
"type": "boolean"
|
|
114
|
+
},
|
|
115
|
+
"platform_editor_migrate_state_updates": {
|
|
116
|
+
"type": "boolean"
|
|
114
117
|
}
|
|
115
118
|
}
|
|
116
119
|
}
|