@atlaskit/editor-plugin-collab-edit 2.1.6 → 2.3.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 +26 -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/main/index.js +1 -6
- package/dist/cjs/pm-plugins/main/plugin-state.js +6 -3
- package/dist/cjs/pm-plugins/utils.js +3 -12
- 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/main/index.js +1 -6
- package/dist/es2019/pm-plugins/main/plugin-state.js +6 -4
- 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/main/index.js +1 -6
- package/dist/esm/pm-plugins/main/plugin-state.js +6 -3
- package/dist/esm/pm-plugins/utils.js +3 -12
- package/package.json +13 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-collab-edit
|
|
2
2
|
|
|
3
|
+
## 2.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#109060](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/109060)
|
|
8
|
+
[`4660ec858a305`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4660ec858a305) -
|
|
9
|
+
Update `React` from v16 to v18
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 2.2.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#104960](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/104960)
|
|
20
|
+
[`9ef5570fb870f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9ef5570fb870f) -
|
|
21
|
+
Adding fg platform_editor_selection_without_left_shift to fix the editor selection issue
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [#104870](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/104870)
|
|
26
|
+
[`79e0bedfbaf1f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/79e0bedfbaf1f) -
|
|
27
|
+
EDF-2202 copy ai-proactive from editor-plugin-ai to editor-plugin-ai-proactive
|
|
28
|
+
|
|
3
29
|
## 2.1.6
|
|
4
30
|
|
|
5
31
|
### Patch 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;
|
|
@@ -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);
|
|
@@ -12,6 +12,7 @@ var _browser = require("@atlaskit/editor-common/browser");
|
|
|
12
12
|
var _collab = require("@atlaskit/editor-common/collab");
|
|
13
13
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
14
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
16
|
var _participants = require("../participants");
|
|
16
17
|
var _utils = require("../utils");
|
|
17
18
|
/**
|
|
@@ -29,8 +30,6 @@ var getValidPos = exports.getValidPos = function getValidPos(tr, pos) {
|
|
|
29
30
|
return endOfDocPos;
|
|
30
31
|
};
|
|
31
32
|
var PluginState = exports.PluginState = /*#__PURE__*/function () {
|
|
32
|
-
// Ignored via go/ees005
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
34
33
|
function PluginState(decorations, participants, sessionId) {
|
|
35
34
|
var collabInitalised = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
36
35
|
var onError = arguments.length > 4 ? arguments[4] : undefined;
|
|
@@ -134,7 +133,11 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
|
|
|
134
133
|
var from = 1;
|
|
135
134
|
var to = 1;
|
|
136
135
|
try {
|
|
137
|
-
|
|
136
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_selection_without_left_shift')) {
|
|
137
|
+
from = getValidPos(tr, isSelection ? Math.max(rawFrom, 0) : rawFrom);
|
|
138
|
+
} else {
|
|
139
|
+
from = getValidPos(tr, isSelection ? Math.max(rawFrom - 1, 0) : rawFrom);
|
|
140
|
+
}
|
|
138
141
|
to = isSelection ? getValidPos(tr, rawTo) : from;
|
|
139
142
|
} catch (err) {
|
|
140
143
|
this.onError(err);
|
|
@@ -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;
|
|
@@ -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,
|
|
@@ -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);
|
|
@@ -3,6 +3,7 @@ import { browser } from '@atlaskit/editor-common/browser';
|
|
|
3
3
|
import { TELEPOINTER_DIM_CLASS } from '@atlaskit/editor-common/collab';
|
|
4
4
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { Participants } from '../participants';
|
|
7
8
|
import { createTelepointers, findPointers, getPositionOfTelepointer, isReplaceStep } from '../utils';
|
|
8
9
|
|
|
@@ -30,9 +31,6 @@ export class PluginState {
|
|
|
30
31
|
get sessionId() {
|
|
31
32
|
return this.sid;
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
-
// Ignored via go/ees005
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
36
34
|
constructor(decorations, participants, sessionId, collabInitalised = false, onError) {
|
|
37
35
|
// eslint-disable-next-line no-console
|
|
38
36
|
_defineProperty(this, "onError", error => console.error(error));
|
|
@@ -111,7 +109,11 @@ export class PluginState {
|
|
|
111
109
|
let from = 1;
|
|
112
110
|
let to = 1;
|
|
113
111
|
try {
|
|
114
|
-
|
|
112
|
+
if (fg('platform_editor_selection_without_left_shift')) {
|
|
113
|
+
from = getValidPos(tr, isSelection ? Math.max(rawFrom, 0) : rawFrom);
|
|
114
|
+
} else {
|
|
115
|
+
from = getValidPos(tr, isSelection ? Math.max(rawFrom - 1, 0) : rawFrom);
|
|
116
|
+
}
|
|
115
117
|
to = isSelection ? getValidPos(tr, rawTo) : from;
|
|
116
118
|
} catch (err) {
|
|
117
119
|
this.onError(err);
|
|
@@ -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;
|
|
@@ -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);
|
|
@@ -5,6 +5,7 @@ import { browser } from '@atlaskit/editor-common/browser';
|
|
|
5
5
|
import { TELEPOINTER_DIM_CLASS } from '@atlaskit/editor-common/collab';
|
|
6
6
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { Participants } from '../participants';
|
|
9
10
|
import { createTelepointers, findPointers, getPositionOfTelepointer, isReplaceStep } from '../utils';
|
|
10
11
|
|
|
@@ -23,8 +24,6 @@ export var getValidPos = function getValidPos(tr, pos) {
|
|
|
23
24
|
return endOfDocPos;
|
|
24
25
|
};
|
|
25
26
|
export var PluginState = /*#__PURE__*/function () {
|
|
26
|
-
// Ignored via go/ees005
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
28
27
|
function PluginState(decorations, participants, sessionId) {
|
|
29
28
|
var collabInitalised = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
30
29
|
var onError = arguments.length > 4 ? arguments[4] : undefined;
|
|
@@ -128,7 +127,11 @@ export var PluginState = /*#__PURE__*/function () {
|
|
|
128
127
|
var from = 1;
|
|
129
128
|
var to = 1;
|
|
130
129
|
try {
|
|
131
|
-
|
|
130
|
+
if (fg('platform_editor_selection_without_left_shift')) {
|
|
131
|
+
from = getValidPos(tr, isSelection ? Math.max(rawFrom, 0) : rawFrom);
|
|
132
|
+
} else {
|
|
133
|
+
from = getValidPos(tr, isSelection ? Math.max(rawFrom - 1, 0) : rawFrom);
|
|
134
|
+
}
|
|
132
135
|
to = isSelection ? getValidPos(tr, rawTo) : from;
|
|
133
136
|
} catch (err) {
|
|
134
137
|
this.onError(err);
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-collab-edit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.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.6.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
|
},
|
|
@@ -108,6 +108,9 @@
|
|
|
108
108
|
},
|
|
109
109
|
"platform_editor_merge_unconfirmed_steps": {
|
|
110
110
|
"type": "boolean"
|
|
111
|
+
},
|
|
112
|
+
"platform_editor_selection_without_left_shift": {
|
|
113
|
+
"type": "boolean"
|
|
111
114
|
}
|
|
112
115
|
}
|
|
113
116
|
}
|