@atlaskit/editor-plugin-collab-edit 1.4.4 → 1.5.1
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/events/send-transaction.js +4 -2
- package/dist/cjs/plugin.js +30 -13
- package/dist/es2019/events/send-transaction.js +4 -2
- package/dist/es2019/plugin.js +19 -3
- package/dist/esm/events/send-transaction.js +4 -2
- package/dist/esm/plugin.js +31 -14
- package/dist/types/events/send-transaction.d.ts +2 -1
- package/dist/types/types.d.ts +10 -1
- package/dist/types-ts4.5/events/send-transaction.d.ts +2 -1
- package/dist/types-ts4.5/types.d.ts +7 -1
- package/package.json +106 -99
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-collab-edit
|
|
2
2
|
|
|
3
|
+
## 1.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#105724](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/105724)
|
|
8
|
+
[`d31b1d6bce097`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d31b1d6bce097) -
|
|
9
|
+
[ux] [ED-23466] Don't show view-mode telepointers to other live-mode users
|
|
10
|
+
|
|
11
|
+
## 1.5.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#106594](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/106594)
|
|
16
|
+
[`554be969a7b69`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/554be969a7b69) -
|
|
17
|
+
Support comments on media in Live View mode
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 1.4.4
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -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("../pm-plugins/main/plugin-key");
|
|
9
10
|
var sendTransaction = exports.sendTransaction = function sendTransaction(_ref) {
|
|
@@ -11,7 +12,8 @@ var sendTransaction = exports.sendTransaction = function sendTransaction(_ref) {
|
|
|
11
12
|
transactions = _ref.transactions,
|
|
12
13
|
oldEditorState = _ref.oldEditorState,
|
|
13
14
|
newEditorState = _ref.newEditorState,
|
|
14
|
-
useNativePlugin = _ref.useNativePlugin
|
|
15
|
+
useNativePlugin = _ref.useNativePlugin,
|
|
16
|
+
viewMode = _ref.viewMode;
|
|
15
17
|
return function (provider) {
|
|
16
18
|
var docChangedTransaction = transactions.find(function (tr) {
|
|
17
19
|
return tr.docChanged;
|
|
@@ -35,7 +37,7 @@ var sendTransaction = exports.sendTransaction = function sendTransaction(_ref) {
|
|
|
35
37
|
sessionId = currentPluginState.sessionId;
|
|
36
38
|
var selectionChanged = !oldEditorState.selection.eq(newEditorState.selection);
|
|
37
39
|
var participantsChanged = prevActiveParticipants && !prevActiveParticipants.eq(activeParticipants);
|
|
38
|
-
if (sessionId && selectionChanged && !docChangedTransaction || sessionId && participantsChanged) {
|
|
40
|
+
if (sessionId && ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.no-telecursors-for-viewmode-users_hok8o') ? viewMode === 'edit' && (selectionChanged && !docChangedTransaction || participantsChanged) : sessionId && selectionChanged && !docChangedTransaction || sessionId && participantsChanged)) {
|
|
39
41
|
var selection = (0, _actions.getSendableSelection)(newEditorState.selection);
|
|
40
42
|
var message = {
|
|
41
43
|
type: 'telepointer',
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -72,10 +72,24 @@ var createAddInlineCommentMark = function createAddInlineCommentMark(providerPro
|
|
|
72
72
|
return false;
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
|
-
var
|
|
75
|
+
var createAddInlineCommentNodeMark = function createAddInlineCommentNodeMark(providerPromise) {
|
|
76
|
+
return function (_ref3) {
|
|
77
|
+
var pos = _ref3.pos,
|
|
78
|
+
mark = _ref3.mark;
|
|
79
|
+
providerPromise.then(function (provider) {
|
|
80
|
+
var _provider$api2;
|
|
81
|
+
var commentMark = new _transform.AddNodeMarkStep(pos, mark);
|
|
82
|
+
|
|
83
|
+
// @ts-expect-error 2339: Property 'api' does not exist on type 'CollabEditProvider<CollabEvents>'.
|
|
84
|
+
(_provider$api2 = provider.api) === null || _provider$api2 === void 0 || _provider$api2.addComment([commentMark]);
|
|
85
|
+
});
|
|
86
|
+
return false;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref4) {
|
|
76
90
|
var _api$featureFlags;
|
|
77
|
-
var options =
|
|
78
|
-
api =
|
|
91
|
+
var options = _ref4.config,
|
|
92
|
+
api = _ref4.api;
|
|
79
93
|
var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
80
94
|
var providerResolver = function providerResolver() {};
|
|
81
95
|
var collabEditProviderPromise = new Promise(function (_providerResolver) {
|
|
@@ -111,16 +125,17 @@ var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref
|
|
|
111
125
|
actions: {
|
|
112
126
|
getAvatarColor: _utils.getAvatarColor,
|
|
113
127
|
addInlineCommentMark: createAddInlineCommentMark(collabEditProviderPromise),
|
|
128
|
+
addInlineCommentNodeMark: createAddInlineCommentNodeMark(collabEditProviderPromise),
|
|
114
129
|
isRemoteReplaceDocumentTransaction: function isRemoteReplaceDocumentTransaction(tr) {
|
|
115
130
|
return tr.getMeta('isRemote') && tr.getMeta('replaceDocument');
|
|
116
131
|
}
|
|
117
132
|
},
|
|
118
133
|
pmPlugins: function pmPlugins() {
|
|
119
|
-
var
|
|
120
|
-
|
|
121
|
-
useNativePlugin =
|
|
122
|
-
|
|
123
|
-
userId =
|
|
134
|
+
var _ref5 = options || {},
|
|
135
|
+
_ref5$useNativePlugin = _ref5.useNativePlugin,
|
|
136
|
+
useNativePlugin = _ref5$useNativePlugin === void 0 ? false : _ref5$useNativePlugin,
|
|
137
|
+
_ref5$userId = _ref5.userId,
|
|
138
|
+
userId = _ref5$userId === void 0 ? null : _ref5$userId;
|
|
124
139
|
return [].concat((0, _toConsumableArray2.default)(useNativePlugin ? [{
|
|
125
140
|
name: 'pmCollab',
|
|
126
141
|
plugin: function plugin() {
|
|
@@ -137,9 +152,9 @@ var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref
|
|
|
137
152
|
}
|
|
138
153
|
}] : []), [{
|
|
139
154
|
name: 'collab',
|
|
140
|
-
plugin: function plugin(
|
|
141
|
-
var dispatch =
|
|
142
|
-
providerFactory =
|
|
155
|
+
plugin: function plugin(_ref6) {
|
|
156
|
+
var dispatch = _ref6.dispatch,
|
|
157
|
+
providerFactory = _ref6.providerFactory;
|
|
143
158
|
return (0, _main.createPlugin)(dispatch, providerFactory, providerResolver, executeProviderCode, options, featureFlags, api);
|
|
144
159
|
}
|
|
145
160
|
}, {
|
|
@@ -148,14 +163,16 @@ var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref
|
|
|
148
163
|
}]);
|
|
149
164
|
},
|
|
150
165
|
onEditorViewStateUpdated: function onEditorViewStateUpdated(props) {
|
|
151
|
-
var _api$analytics, _options$useNativePlu;
|
|
166
|
+
var _api$analytics, _api$editorViewMode, _options$useNativePlu;
|
|
152
167
|
var addErrorAnalytics = (0, _analytics.addSynchronyErrorAnalytics)(props.newEditorState, props.newEditorState.tr, featureFlags, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
168
|
+
var viewMode = api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode;
|
|
153
169
|
executeProviderCode((0, _sendTransaction.sendTransaction)({
|
|
154
170
|
originalTransaction: props.originalTransaction,
|
|
155
171
|
transactions: props.transactions,
|
|
156
172
|
oldEditorState: props.oldEditorState,
|
|
157
173
|
newEditorState: props.newEditorState,
|
|
158
|
-
useNativePlugin: (_options$useNativePlu = options === null || options === void 0 ? void 0 : options.useNativePlugin) !== null && _options$useNativePlu !== void 0 ? _options$useNativePlu : false
|
|
174
|
+
useNativePlugin: (_options$useNativePlu = options === null || options === void 0 ? void 0 : options.useNativePlugin) !== null && _options$useNativePlu !== void 0 ? _options$useNativePlu : false,
|
|
175
|
+
viewMode: viewMode
|
|
159
176
|
}), addErrorAnalytics);
|
|
160
177
|
}
|
|
161
178
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { getSendableSelection } from '../actions';
|
|
2
3
|
import { pluginKey } from '../pm-plugins/main/plugin-key';
|
|
3
4
|
export const sendTransaction = ({
|
|
@@ -5,7 +6,8 @@ export const sendTransaction = ({
|
|
|
5
6
|
transactions,
|
|
6
7
|
oldEditorState,
|
|
7
8
|
newEditorState,
|
|
8
|
-
useNativePlugin
|
|
9
|
+
useNativePlugin,
|
|
10
|
+
viewMode
|
|
9
11
|
}) => provider => {
|
|
10
12
|
const docChangedTransaction = transactions.find(tr => tr.docChanged);
|
|
11
13
|
const currentPluginState = pluginKey.getState(newEditorState);
|
|
@@ -30,7 +32,7 @@ export const sendTransaction = ({
|
|
|
30
32
|
} = currentPluginState;
|
|
31
33
|
const selectionChanged = !oldEditorState.selection.eq(newEditorState.selection);
|
|
32
34
|
const participantsChanged = prevActiveParticipants && !prevActiveParticipants.eq(activeParticipants);
|
|
33
|
-
if (sessionId && selectionChanged && !docChangedTransaction || sessionId && participantsChanged) {
|
|
35
|
+
if (sessionId && (getBooleanFF('platform.editor.no-telecursors-for-viewmode-users_hok8o') ? viewMode === 'edit' && (selectionChanged && !docChangedTransaction || participantsChanged) : sessionId && selectionChanged && !docChangedTransaction || sessionId && participantsChanged)) {
|
|
34
36
|
const selection = getSendableSelection(newEditorState.selection);
|
|
35
37
|
const message = {
|
|
36
38
|
type: 'telepointer',
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddMarkStep } from '@atlaskit/editor-prosemirror/transform';
|
|
1
|
+
import { AddMarkStep, AddNodeMarkStep } from '@atlaskit/editor-prosemirror/transform';
|
|
2
2
|
import { collab } from '@atlaskit/prosemirror-collab';
|
|
3
3
|
import { addSynchronyErrorAnalytics } from './analytics';
|
|
4
4
|
import { sendTransaction } from './events/send-transaction';
|
|
@@ -36,6 +36,19 @@ const createAddInlineCommentMark = providerPromise => ({
|
|
|
36
36
|
});
|
|
37
37
|
return false;
|
|
38
38
|
};
|
|
39
|
+
const createAddInlineCommentNodeMark = providerPromise => ({
|
|
40
|
+
pos,
|
|
41
|
+
mark
|
|
42
|
+
}) => {
|
|
43
|
+
providerPromise.then(provider => {
|
|
44
|
+
var _provider$api2;
|
|
45
|
+
const commentMark = new AddNodeMarkStep(pos, mark);
|
|
46
|
+
|
|
47
|
+
// @ts-expect-error 2339: Property 'api' does not exist on type 'CollabEditProvider<CollabEvents>'.
|
|
48
|
+
(_provider$api2 = provider.api) === null || _provider$api2 === void 0 ? void 0 : _provider$api2.addComment([commentMark]);
|
|
49
|
+
});
|
|
50
|
+
return false;
|
|
51
|
+
};
|
|
39
52
|
export const collabEditPlugin = ({
|
|
40
53
|
config: options,
|
|
41
54
|
api
|
|
@@ -76,6 +89,7 @@ export const collabEditPlugin = ({
|
|
|
76
89
|
actions: {
|
|
77
90
|
getAvatarColor,
|
|
78
91
|
addInlineCommentMark: createAddInlineCommentMark(collabEditProviderPromise),
|
|
92
|
+
addInlineCommentNodeMark: createAddInlineCommentNodeMark(collabEditProviderPromise),
|
|
79
93
|
isRemoteReplaceDocumentTransaction: tr => tr.getMeta('isRemote') && tr.getMeta('replaceDocument')
|
|
80
94
|
},
|
|
81
95
|
pmPlugins() {
|
|
@@ -107,14 +121,16 @@ export const collabEditPlugin = ({
|
|
|
107
121
|
}];
|
|
108
122
|
},
|
|
109
123
|
onEditorViewStateUpdated(props) {
|
|
110
|
-
var _api$analytics, _options$useNativePlu;
|
|
124
|
+
var _api$analytics, _api$editorViewMode, _api$editorViewMode$s, _options$useNativePlu;
|
|
111
125
|
const addErrorAnalytics = addSynchronyErrorAnalytics(props.newEditorState, props.newEditorState.tr, featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
126
|
+
const viewMode = api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode;
|
|
112
127
|
executeProviderCode(sendTransaction({
|
|
113
128
|
originalTransaction: props.originalTransaction,
|
|
114
129
|
transactions: props.transactions,
|
|
115
130
|
oldEditorState: props.oldEditorState,
|
|
116
131
|
newEditorState: props.newEditorState,
|
|
117
|
-
useNativePlugin: (_options$useNativePlu = options === null || options === void 0 ? void 0 : options.useNativePlugin) !== null && _options$useNativePlu !== void 0 ? _options$useNativePlu : false
|
|
132
|
+
useNativePlugin: (_options$useNativePlu = options === null || options === void 0 ? void 0 : options.useNativePlugin) !== null && _options$useNativePlu !== void 0 ? _options$useNativePlu : false,
|
|
133
|
+
viewMode
|
|
118
134
|
}), addErrorAnalytics);
|
|
119
135
|
}
|
|
120
136
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { getSendableSelection } from '../actions';
|
|
2
3
|
import { pluginKey } from '../pm-plugins/main/plugin-key';
|
|
3
4
|
export var sendTransaction = function sendTransaction(_ref) {
|
|
@@ -5,7 +6,8 @@ export var sendTransaction = function sendTransaction(_ref) {
|
|
|
5
6
|
transactions = _ref.transactions,
|
|
6
7
|
oldEditorState = _ref.oldEditorState,
|
|
7
8
|
newEditorState = _ref.newEditorState,
|
|
8
|
-
useNativePlugin = _ref.useNativePlugin
|
|
9
|
+
useNativePlugin = _ref.useNativePlugin,
|
|
10
|
+
viewMode = _ref.viewMode;
|
|
9
11
|
return function (provider) {
|
|
10
12
|
var docChangedTransaction = transactions.find(function (tr) {
|
|
11
13
|
return tr.docChanged;
|
|
@@ -29,7 +31,7 @@ export var sendTransaction = function sendTransaction(_ref) {
|
|
|
29
31
|
sessionId = currentPluginState.sessionId;
|
|
30
32
|
var selectionChanged = !oldEditorState.selection.eq(newEditorState.selection);
|
|
31
33
|
var participantsChanged = prevActiveParticipants && !prevActiveParticipants.eq(activeParticipants);
|
|
32
|
-
if (sessionId && selectionChanged && !docChangedTransaction || sessionId && participantsChanged) {
|
|
34
|
+
if (sessionId && (getBooleanFF('platform.editor.no-telecursors-for-viewmode-users_hok8o') ? viewMode === 'edit' && (selectionChanged && !docChangedTransaction || participantsChanged) : sessionId && selectionChanged && !docChangedTransaction || sessionId && participantsChanged)) {
|
|
33
35
|
var selection = getSendableSelection(newEditorState.selection);
|
|
34
36
|
var message = {
|
|
35
37
|
type: 'telepointer',
|
package/dist/esm/plugin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
-
import { AddMarkStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
|
+
import { AddMarkStep, AddNodeMarkStep } from '@atlaskit/editor-prosemirror/transform';
|
|
5
5
|
import { collab } from '@atlaskit/prosemirror-collab';
|
|
6
6
|
import { addSynchronyErrorAnalytics } from './analytics';
|
|
7
7
|
import { sendTransaction } from './events/send-transaction';
|
|
@@ -65,10 +65,24 @@ var createAddInlineCommentMark = function createAddInlineCommentMark(providerPro
|
|
|
65
65
|
return false;
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
|
-
|
|
68
|
+
var createAddInlineCommentNodeMark = function createAddInlineCommentNodeMark(providerPromise) {
|
|
69
|
+
return function (_ref3) {
|
|
70
|
+
var pos = _ref3.pos,
|
|
71
|
+
mark = _ref3.mark;
|
|
72
|
+
providerPromise.then(function (provider) {
|
|
73
|
+
var _provider$api2;
|
|
74
|
+
var commentMark = new AddNodeMarkStep(pos, mark);
|
|
75
|
+
|
|
76
|
+
// @ts-expect-error 2339: Property 'api' does not exist on type 'CollabEditProvider<CollabEvents>'.
|
|
77
|
+
(_provider$api2 = provider.api) === null || _provider$api2 === void 0 || _provider$api2.addComment([commentMark]);
|
|
78
|
+
});
|
|
79
|
+
return false;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
export var collabEditPlugin = function collabEditPlugin(_ref4) {
|
|
69
83
|
var _api$featureFlags;
|
|
70
|
-
var options =
|
|
71
|
-
api =
|
|
84
|
+
var options = _ref4.config,
|
|
85
|
+
api = _ref4.api;
|
|
72
86
|
var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
73
87
|
var providerResolver = function providerResolver() {};
|
|
74
88
|
var collabEditProviderPromise = new Promise(function (_providerResolver) {
|
|
@@ -104,16 +118,17 @@ export var collabEditPlugin = function collabEditPlugin(_ref3) {
|
|
|
104
118
|
actions: {
|
|
105
119
|
getAvatarColor: getAvatarColor,
|
|
106
120
|
addInlineCommentMark: createAddInlineCommentMark(collabEditProviderPromise),
|
|
121
|
+
addInlineCommentNodeMark: createAddInlineCommentNodeMark(collabEditProviderPromise),
|
|
107
122
|
isRemoteReplaceDocumentTransaction: function isRemoteReplaceDocumentTransaction(tr) {
|
|
108
123
|
return tr.getMeta('isRemote') && tr.getMeta('replaceDocument');
|
|
109
124
|
}
|
|
110
125
|
},
|
|
111
126
|
pmPlugins: function pmPlugins() {
|
|
112
|
-
var
|
|
113
|
-
|
|
114
|
-
useNativePlugin =
|
|
115
|
-
|
|
116
|
-
userId =
|
|
127
|
+
var _ref5 = options || {},
|
|
128
|
+
_ref5$useNativePlugin = _ref5.useNativePlugin,
|
|
129
|
+
useNativePlugin = _ref5$useNativePlugin === void 0 ? false : _ref5$useNativePlugin,
|
|
130
|
+
_ref5$userId = _ref5.userId,
|
|
131
|
+
userId = _ref5$userId === void 0 ? null : _ref5$userId;
|
|
117
132
|
return [].concat(_toConsumableArray(useNativePlugin ? [{
|
|
118
133
|
name: 'pmCollab',
|
|
119
134
|
plugin: function plugin() {
|
|
@@ -130,9 +145,9 @@ export var collabEditPlugin = function collabEditPlugin(_ref3) {
|
|
|
130
145
|
}
|
|
131
146
|
}] : []), [{
|
|
132
147
|
name: 'collab',
|
|
133
|
-
plugin: function plugin(
|
|
134
|
-
var dispatch =
|
|
135
|
-
providerFactory =
|
|
148
|
+
plugin: function plugin(_ref6) {
|
|
149
|
+
var dispatch = _ref6.dispatch,
|
|
150
|
+
providerFactory = _ref6.providerFactory;
|
|
136
151
|
return createPlugin(dispatch, providerFactory, providerResolver, executeProviderCode, options, featureFlags, api);
|
|
137
152
|
}
|
|
138
153
|
}, {
|
|
@@ -141,14 +156,16 @@ export var collabEditPlugin = function collabEditPlugin(_ref3) {
|
|
|
141
156
|
}]);
|
|
142
157
|
},
|
|
143
158
|
onEditorViewStateUpdated: function onEditorViewStateUpdated(props) {
|
|
144
|
-
var _api$analytics, _options$useNativePlu;
|
|
159
|
+
var _api$analytics, _api$editorViewMode, _options$useNativePlu;
|
|
145
160
|
var addErrorAnalytics = addSynchronyErrorAnalytics(props.newEditorState, props.newEditorState.tr, featureFlags, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
161
|
+
var viewMode = api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode;
|
|
146
162
|
executeProviderCode(sendTransaction({
|
|
147
163
|
originalTransaction: props.originalTransaction,
|
|
148
164
|
transactions: props.transactions,
|
|
149
165
|
oldEditorState: props.oldEditorState,
|
|
150
166
|
newEditorState: props.newEditorState,
|
|
151
|
-
useNativePlugin: (_options$useNativePlu = options === null || options === void 0 ? void 0 : options.useNativePlugin) !== null && _options$useNativePlu !== void 0 ? _options$useNativePlu : false
|
|
167
|
+
useNativePlugin: (_options$useNativePlu = options === null || options === void 0 ? void 0 : options.useNativePlugin) !== null && _options$useNativePlu !== void 0 ? _options$useNativePlu : false,
|
|
168
|
+
viewMode: viewMode
|
|
152
169
|
}), addErrorAnalytics);
|
|
153
170
|
}
|
|
154
171
|
};
|
|
@@ -6,6 +6,7 @@ type Props = {
|
|
|
6
6
|
oldEditorState: EditorState;
|
|
7
7
|
newEditorState: EditorState;
|
|
8
8
|
useNativePlugin: boolean;
|
|
9
|
+
viewMode?: 'view' | 'edit';
|
|
9
10
|
};
|
|
10
|
-
export declare const sendTransaction: ({ originalTransaction, transactions, oldEditorState, newEditorState, useNativePlugin }: Props) => (provider: CollabEditProvider) => void;
|
|
11
|
+
export declare const sendTransaction: ({ originalTransaction, transactions, oldEditorState, newEditorState, useNativePlugin, viewMode, }: Props) => (provider: CollabEditProvider) => void;
|
|
11
12
|
export {};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CollabEditOptions, CollabEditProvider, CollabParticipant, Color, SyncUpErrorFunction } from '@atlaskit/editor-common/collab';
|
|
2
2
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
|
+
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
4
5
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
5
6
|
import type { Mark } from '@atlaskit/editor-prosemirror/model';
|
|
6
7
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -28,7 +29,11 @@ export type CollabEditPluginSharedState = {
|
|
|
28
29
|
};
|
|
29
30
|
export type CollabEditPlugin = NextEditorPlugin<'collabEdit', {
|
|
30
31
|
pluginConfiguration: PrivateCollabEditOptions;
|
|
31
|
-
dependencies: [
|
|
32
|
+
dependencies: [
|
|
33
|
+
OptionalPlugin<FeatureFlagsPlugin>,
|
|
34
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
35
|
+
OptionalPlugin<EditorViewModePlugin>
|
|
36
|
+
];
|
|
32
37
|
sharedState: CollabEditPluginSharedState;
|
|
33
38
|
actions: {
|
|
34
39
|
getAvatarColor: (str: string) => {
|
|
@@ -40,6 +45,10 @@ export type CollabEditPlugin = NextEditorPlugin<'collabEdit', {
|
|
|
40
45
|
to: number;
|
|
41
46
|
mark: Mark;
|
|
42
47
|
}) => boolean;
|
|
48
|
+
addInlineCommentNodeMark: (props: {
|
|
49
|
+
pos: number;
|
|
50
|
+
mark: Mark;
|
|
51
|
+
}) => boolean;
|
|
43
52
|
isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
|
|
44
53
|
};
|
|
45
54
|
}>;
|
|
@@ -6,6 +6,7 @@ type Props = {
|
|
|
6
6
|
oldEditorState: EditorState;
|
|
7
7
|
newEditorState: EditorState;
|
|
8
8
|
useNativePlugin: boolean;
|
|
9
|
+
viewMode?: 'view' | 'edit';
|
|
9
10
|
};
|
|
10
|
-
export declare const sendTransaction: ({ originalTransaction, transactions, oldEditorState, newEditorState, useNativePlugin }: Props) => (provider: CollabEditProvider) => void;
|
|
11
|
+
export declare const sendTransaction: ({ originalTransaction, transactions, oldEditorState, newEditorState, useNativePlugin, viewMode, }: Props) => (provider: CollabEditProvider) => void;
|
|
11
12
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CollabEditOptions, CollabEditProvider, CollabParticipant, Color, SyncUpErrorFunction } from '@atlaskit/editor-common/collab';
|
|
2
2
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
|
+
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
4
5
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
5
6
|
import type { Mark } from '@atlaskit/editor-prosemirror/model';
|
|
6
7
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -30,7 +31,8 @@ export type CollabEditPlugin = NextEditorPlugin<'collabEdit', {
|
|
|
30
31
|
pluginConfiguration: PrivateCollabEditOptions;
|
|
31
32
|
dependencies: [
|
|
32
33
|
OptionalPlugin<FeatureFlagsPlugin>,
|
|
33
|
-
OptionalPlugin<AnalyticsPlugin
|
|
34
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
35
|
+
OptionalPlugin<EditorViewModePlugin>
|
|
34
36
|
];
|
|
35
37
|
sharedState: CollabEditPluginSharedState;
|
|
36
38
|
actions: {
|
|
@@ -43,6 +45,10 @@ export type CollabEditPlugin = NextEditorPlugin<'collabEdit', {
|
|
|
43
45
|
to: number;
|
|
44
46
|
mark: Mark;
|
|
45
47
|
}) => boolean;
|
|
48
|
+
addInlineCommentNodeMark: (props: {
|
|
49
|
+
pos: number;
|
|
50
|
+
mark: Mark;
|
|
51
|
+
}) => boolean;
|
|
46
52
|
isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
|
|
47
53
|
};
|
|
48
54
|
}>;
|
package/package.json
CHANGED
|
@@ -1,100 +1,107 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
2
|
+
"name": "@atlaskit/editor-plugin-collab-edit",
|
|
3
|
+
"version": "1.5.1",
|
|
4
|
+
"description": "Collab Edit plugin for @atlaskit/editor-core",
|
|
5
|
+
"author": "Atlassian Pty Ltd",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"registry": "https://registry.npmjs.org/"
|
|
9
|
+
},
|
|
10
|
+
"atlassian": {
|
|
11
|
+
"team": "Editor: Collaboration",
|
|
12
|
+
"singleton": true,
|
|
13
|
+
"inPublicMirror": false,
|
|
14
|
+
"releaseModel": "continuous"
|
|
15
|
+
},
|
|
16
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
17
|
+
"main": "dist/cjs/index.js",
|
|
18
|
+
"module": "dist/esm/index.js",
|
|
19
|
+
"module:es2019": "dist/es2019/index.js",
|
|
20
|
+
"types": "dist/types/index.d.ts",
|
|
21
|
+
"typesVersions": {
|
|
22
|
+
">=4.5 <4.9": {
|
|
23
|
+
"*": [
|
|
24
|
+
"dist/types-ts4.5/*",
|
|
25
|
+
"dist/types-ts4.5/index.d.ts"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"atlaskit:src": "src/index.ts",
|
|
31
|
+
"af:exports": {
|
|
32
|
+
".": "./src/index.ts"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@atlaskit/adf-schema": "^36.10.7",
|
|
36
|
+
"@atlaskit/custom-steps": "^0.2.0",
|
|
37
|
+
"@atlaskit/editor-common": "^82.10.0",
|
|
38
|
+
"@atlaskit/editor-plugin-analytics": "1.2.3",
|
|
39
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^2.0.0",
|
|
40
|
+
"@atlaskit/editor-plugin-feature-flags": "^1.1.0",
|
|
41
|
+
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
42
|
+
"@atlaskit/editor-shared-styles": "^2.12.0",
|
|
43
|
+
"@atlaskit/platform-feature-flags": "^0.2.5",
|
|
44
|
+
"@atlaskit/prosemirror-collab": "^0.4.0",
|
|
45
|
+
"@babel/runtime": "^7.0.0",
|
|
46
|
+
"memoize-one": "^6.0.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"react": "^16.8.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@af/integration-testing": "*",
|
|
53
|
+
"@af/visual-regression": "*",
|
|
54
|
+
"@atlaskit/editor-plugin-mentions": "^1.6.0",
|
|
55
|
+
"@atlaskit/editor-plugin-text-formatting": "^1.7.0",
|
|
56
|
+
"@atlaskit/editor-plugin-type-ahead": "^1.2.0",
|
|
57
|
+
"@atlaskit/editor-plugin-unsupported-content": "^1.2.0",
|
|
58
|
+
"@atlaskit/editor-test-helpers": "^18.23.0",
|
|
59
|
+
"@atlaskit/ssr": "*",
|
|
60
|
+
"@atlaskit/synchrony-test-helpers": "^2.4.0",
|
|
61
|
+
"@atlaskit/util-data-test": "^17.9.0",
|
|
62
|
+
"@atlaskit/visual-regression": "*",
|
|
63
|
+
"@atlaskit/webdriver-runner": "*",
|
|
64
|
+
"@testing-library/react": "^12.1.5",
|
|
65
|
+
"react-dom": "^16.8.0",
|
|
66
|
+
"typescript": "~5.4.2",
|
|
67
|
+
"wait-for-expect": "^1.2.0"
|
|
68
|
+
},
|
|
69
|
+
"techstack": {
|
|
70
|
+
"@atlassian/frontend": {
|
|
71
|
+
"import-structure": [
|
|
72
|
+
"atlassian-conventions"
|
|
73
|
+
],
|
|
74
|
+
"circular-dependencies": [
|
|
75
|
+
"file-and-folder-level"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"@repo/internal": {
|
|
79
|
+
"dom-events": "use-bind-event-listener",
|
|
80
|
+
"analytics": [
|
|
81
|
+
"analytics-next"
|
|
82
|
+
],
|
|
83
|
+
"design-tokens": [
|
|
84
|
+
"color"
|
|
85
|
+
],
|
|
86
|
+
"theming": [
|
|
87
|
+
"react-context"
|
|
88
|
+
],
|
|
89
|
+
"ui-components": [
|
|
90
|
+
"lite-mode"
|
|
91
|
+
],
|
|
92
|
+
"deprecation": "no-deprecated-imports",
|
|
93
|
+
"styling": [
|
|
94
|
+
"emotion",
|
|
95
|
+
"emotion"
|
|
96
|
+
],
|
|
97
|
+
"imports": [
|
|
98
|
+
"import-no-extraneous-disable-for-examples-and-docs"
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"platform-feature-flags": {
|
|
103
|
+
"platform.editor.no-telecursors-for-viewmode-users_hok8o": {
|
|
104
|
+
"type": "boolean"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|