@atlaskit/editor-plugin-collab-edit 1.5.0 → 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 +8 -0
- package/dist/cjs/events/send-transaction.js +4 -2
- package/dist/cjs/plugin.js +4 -2
- package/dist/es2019/events/send-transaction.js +4 -2
- package/dist/es2019/plugin.js +4 -2
- package/dist/esm/events/send-transaction.js +4 -2
- package/dist/esm/plugin.js +4 -2
- package/dist/types/events/send-transaction.d.ts +2 -1
- package/dist/types/types.d.ts +6 -1
- package/dist/types-ts4.5/events/send-transaction.d.ts +2 -1
- package/dist/types-ts4.5/types.d.ts +3 -1
- package/package.json +38 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
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
|
+
|
|
3
11
|
## 1.5.0
|
|
4
12
|
|
|
5
13
|
### Minor 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
|
@@ -163,14 +163,16 @@ var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref
|
|
|
163
163
|
}]);
|
|
164
164
|
},
|
|
165
165
|
onEditorViewStateUpdated: function onEditorViewStateUpdated(props) {
|
|
166
|
-
var _api$analytics, _options$useNativePlu;
|
|
166
|
+
var _api$analytics, _api$editorViewMode, _options$useNativePlu;
|
|
167
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;
|
|
168
169
|
executeProviderCode((0, _sendTransaction.sendTransaction)({
|
|
169
170
|
originalTransaction: props.originalTransaction,
|
|
170
171
|
transactions: props.transactions,
|
|
171
172
|
oldEditorState: props.oldEditorState,
|
|
172
173
|
newEditorState: props.newEditorState,
|
|
173
|
-
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
|
|
174
176
|
}), addErrorAnalytics);
|
|
175
177
|
}
|
|
176
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
|
@@ -121,14 +121,16 @@ export const collabEditPlugin = ({
|
|
|
121
121
|
}];
|
|
122
122
|
},
|
|
123
123
|
onEditorViewStateUpdated(props) {
|
|
124
|
-
var _api$analytics, _options$useNativePlu;
|
|
124
|
+
var _api$analytics, _api$editorViewMode, _api$editorViewMode$s, _options$useNativePlu;
|
|
125
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;
|
|
126
127
|
executeProviderCode(sendTransaction({
|
|
127
128
|
originalTransaction: props.originalTransaction,
|
|
128
129
|
transactions: props.transactions,
|
|
129
130
|
oldEditorState: props.oldEditorState,
|
|
130
131
|
newEditorState: props.newEditorState,
|
|
131
|
-
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
|
|
132
134
|
}), addErrorAnalytics);
|
|
133
135
|
}
|
|
134
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
|
@@ -156,14 +156,16 @@ export var collabEditPlugin = function collabEditPlugin(_ref4) {
|
|
|
156
156
|
}]);
|
|
157
157
|
},
|
|
158
158
|
onEditorViewStateUpdated: function onEditorViewStateUpdated(props) {
|
|
159
|
-
var _api$analytics, _options$useNativePlu;
|
|
159
|
+
var _api$analytics, _api$editorViewMode, _options$useNativePlu;
|
|
160
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;
|
|
161
162
|
executeProviderCode(sendTransaction({
|
|
162
163
|
originalTransaction: props.originalTransaction,
|
|
163
164
|
transactions: props.transactions,
|
|
164
165
|
oldEditorState: props.oldEditorState,
|
|
165
166
|
newEditorState: props.newEditorState,
|
|
166
|
-
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
|
|
167
169
|
}), addErrorAnalytics);
|
|
168
170
|
}
|
|
169
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) => {
|
|
@@ -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: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-collab-edit",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Collab Edit plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -20,7 +20,10 @@
|
|
|
20
20
|
"types": "dist/types/index.d.ts",
|
|
21
21
|
"typesVersions": {
|
|
22
22
|
">=4.5 <4.9": {
|
|
23
|
-
"*": [
|
|
23
|
+
"*": [
|
|
24
|
+
"dist/types-ts4.5/*",
|
|
25
|
+
"dist/types-ts4.5/index.d.ts"
|
|
26
|
+
]
|
|
24
27
|
}
|
|
25
28
|
},
|
|
26
29
|
"sideEffects": false,
|
|
@@ -31,11 +34,13 @@
|
|
|
31
34
|
"dependencies": {
|
|
32
35
|
"@atlaskit/adf-schema": "^36.10.7",
|
|
33
36
|
"@atlaskit/custom-steps": "^0.2.0",
|
|
34
|
-
"@atlaskit/editor-common": "^82.
|
|
37
|
+
"@atlaskit/editor-common": "^82.10.0",
|
|
35
38
|
"@atlaskit/editor-plugin-analytics": "1.2.3",
|
|
39
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^2.0.0",
|
|
36
40
|
"@atlaskit/editor-plugin-feature-flags": "^1.1.0",
|
|
37
41
|
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
38
42
|
"@atlaskit/editor-shared-styles": "^2.12.0",
|
|
43
|
+
"@atlaskit/platform-feature-flags": "^0.2.5",
|
|
39
44
|
"@atlaskit/prosemirror-collab": "^0.4.0",
|
|
40
45
|
"@babel/runtime": "^7.0.0",
|
|
41
46
|
"memoize-one": "^6.0.0"
|
|
@@ -63,18 +68,40 @@
|
|
|
63
68
|
},
|
|
64
69
|
"techstack": {
|
|
65
70
|
"@atlassian/frontend": {
|
|
66
|
-
"import-structure": [
|
|
67
|
-
|
|
71
|
+
"import-structure": [
|
|
72
|
+
"atlassian-conventions"
|
|
73
|
+
],
|
|
74
|
+
"circular-dependencies": [
|
|
75
|
+
"file-and-folder-level"
|
|
76
|
+
]
|
|
68
77
|
},
|
|
69
78
|
"@repo/internal": {
|
|
70
79
|
"dom-events": "use-bind-event-listener",
|
|
71
|
-
"analytics": [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"
|
|
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
|
+
],
|
|
75
92
|
"deprecation": "no-deprecated-imports",
|
|
76
|
-
"styling": [
|
|
77
|
-
|
|
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"
|
|
78
105
|
}
|
|
79
106
|
}
|
|
80
107
|
}
|