@atlaskit/editor-plugin-collab-edit 4.0.1 → 4.0.3
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 +17 -0
- package/dist/cjs/pm-plugins/events/send-transaction.js +28 -8
- package/dist/cjs/pm-plugins/main/plugin-state.js +19 -18
- package/dist/cjs/pm-plugins/utils.js +10 -24
- package/dist/es2019/pm-plugins/events/send-transaction.js +28 -8
- package/dist/es2019/pm-plugins/main/plugin-state.js +20 -19
- package/dist/es2019/pm-plugins/utils.js +10 -24
- package/dist/esm/pm-plugins/events/send-transaction.js +28 -8
- package/dist/esm/pm-plugins/main/plugin-state.js +19 -18
- package/dist/esm/pm-plugins/utils.js +10 -24
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-collab-edit
|
|
2
2
|
|
|
3
|
+
## 4.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#187144](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/187144)
|
|
8
|
+
[`a16147d8fbdfe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a16147d8fbdfe) -
|
|
9
|
+
Bump @atlaskit/adf-schema to v49.0.5
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 4.0.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#183342](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/183342)
|
|
17
|
+
[`2929809030e36`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2929809030e36) -
|
|
18
|
+
Ensures telepointer selection will continue to show while using AI.
|
|
19
|
+
|
|
3
20
|
## 4.0.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.sendTransaction = void 0;
|
|
7
7
|
var _steps = require("@atlaskit/adf-schema/steps");
|
|
8
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
9
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
9
10
|
var _actions = require("../actions");
|
|
10
11
|
var _pluginKey = require("../main/plugin-key");
|
|
@@ -47,14 +48,33 @@ var sendTransaction = exports.sendTransaction = function sendTransaction(_ref) {
|
|
|
47
48
|
sessionId = currentPluginState.sessionId;
|
|
48
49
|
var selectionChanged = !oldEditorState.selection.eq(newEditorState.selection);
|
|
49
50
|
var participantsChanged = prevActiveParticipants && !prevActiveParticipants.eq(activeParticipants);
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_ai_in_document_streaming')) {
|
|
52
|
+
// uiEvent is standard metdata (docs: https://prosemirror.net/docs/ref/#state.Transaction)
|
|
53
|
+
var isPaste = (docChangedTransaction === null || docChangedTransaction === void 0 ? void 0 : docChangedTransaction.getMeta('uiEvent')) === 'paste';
|
|
54
|
+
if (sessionId && viewMode === 'edit' && (
|
|
55
|
+
// Broadcast the position if the selection has changed, and the doc hasn't changed (it is mapped
|
|
56
|
+
// by the receiver).
|
|
57
|
+
// If we're pasting content though make an exception (as doc has changed)
|
|
58
|
+
// as on a ranged selection it results in not clearing the ranged selection after the paste
|
|
59
|
+
selectionChanged && (!docChangedTransaction || isPaste) || participantsChanged && !hideTelecursorOnLoad)) {
|
|
60
|
+
var selection = (0, _actions.getSendableSelection)(newEditorState.selection);
|
|
61
|
+
var message = {
|
|
62
|
+
type: 'telepointer',
|
|
63
|
+
selection: selection,
|
|
64
|
+
sessionId: sessionId
|
|
65
|
+
};
|
|
66
|
+
provider.sendMessage(message);
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
if (sessionId && viewMode === 'edit' && (selectionChanged && !docChangedTransaction || participantsChanged && !hideTelecursorOnLoad)) {
|
|
70
|
+
var _selection = (0, _actions.getSendableSelection)(newEditorState.selection);
|
|
71
|
+
var _message = {
|
|
72
|
+
type: 'telepointer',
|
|
73
|
+
selection: _selection,
|
|
74
|
+
sessionId: sessionId
|
|
75
|
+
};
|
|
76
|
+
provider.sendMessage(_message);
|
|
77
|
+
}
|
|
58
78
|
}
|
|
59
79
|
};
|
|
60
80
|
};
|
|
@@ -183,25 +183,26 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
|
|
|
183
183
|
} catch (err) {
|
|
184
184
|
this.onError(err);
|
|
185
185
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
186
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_ai_in_document_streaming')) {
|
|
187
|
+
// Remove any selection decoration within the change range,
|
|
188
|
+
// takes care of the issue when after pasting we end up with a dead selection
|
|
189
|
+
tr.steps.filter(_utils.isReplaceStep).forEach(function (s) {
|
|
190
|
+
// Ignored via go/ees005
|
|
191
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
192
|
+
var _ref2 = s,
|
|
193
|
+
from = _ref2.from,
|
|
194
|
+
to = _ref2.to;
|
|
195
|
+
// Ignored via go/ees005
|
|
196
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
197
|
+
_this.decorationSet.find(from, to).forEach(function (deco) {
|
|
198
|
+
// `type` is private, `from` and `to` are public in latest version
|
|
199
|
+
// `from` != `to` means it's a selection
|
|
200
|
+
if (deco.from !== deco.to) {
|
|
201
|
+
remove.push(deco);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
203
204
|
});
|
|
204
|
-
}
|
|
205
|
+
}
|
|
205
206
|
}
|
|
206
207
|
var selection = tr.selection;
|
|
207
208
|
// Ignored via go/ees005
|
|
@@ -19,18 +19,12 @@ var _view = require("@atlaskit/editor-prosemirror/view");
|
|
|
19
19
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
20
20
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
21
|
var _findPointers = exports._findPointers = function _findPointers(id, decorations) {
|
|
22
|
-
return decorations.find()
|
|
23
|
-
// Ignored via go/ees005
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
-
.reduce(function (arr, deco) {
|
|
22
|
+
return decorations.find().reduce(function (arr, deco) {
|
|
26
23
|
return deco.spec.pointer.sessionId === id ? arr.concat(deco) : arr;
|
|
27
24
|
}, []);
|
|
28
25
|
};
|
|
29
26
|
var findPointers = exports.findPointers = function findPointers(id, decorations) {
|
|
30
|
-
return decorations.find().reduce(
|
|
31
|
-
// Ignored via go/ees005
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
-
function (arr, deco) {
|
|
27
|
+
return decorations.find().reduce(function (arr, deco) {
|
|
34
28
|
return deco.spec.pointer.presenceId === id ? arr.concat(deco) : arr;
|
|
35
29
|
}, []);
|
|
36
30
|
};
|
|
@@ -52,10 +46,7 @@ var createTelepointers = exports.createTelepointers = function createTelepointer
|
|
|
52
46
|
var color = avatarColor.index.toString();
|
|
53
47
|
if (isSelection) {
|
|
54
48
|
var className = "telepointer color-".concat(color, " telepointer-selection");
|
|
55
|
-
decorations.push(
|
|
56
|
-
// Ignored via go/ees005
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
|
-
_view.Decoration.inline(from, to, {
|
|
49
|
+
decorations.push(_view.Decoration.inline(from, to, {
|
|
59
50
|
class: className,
|
|
60
51
|
'data-initial': initial
|
|
61
52
|
}, {
|
|
@@ -76,6 +67,8 @@ var createTelepointers = exports.createTelepointers = function createTelepointer
|
|
|
76
67
|
color: avatarColor.backgroundColor
|
|
77
68
|
}), ";");
|
|
78
69
|
cursor.setAttribute('data-initial', initial);
|
|
70
|
+
cursor.setAttribute('aria-label', "".concat(fullName, " cursor position"));
|
|
71
|
+
cursor.setAttribute('role', 'button');
|
|
79
72
|
if ((0, _platformFeatureFlags.fg)('confluence_team_presence_scroll_to_pointer')) {
|
|
80
73
|
cursor.setAttribute(_collab.TELEPOINTER_DATA_SESSION_ID_ATTR, sessionId);
|
|
81
74
|
// If there is an ongoing expand animation, we'll keep the telepointer expanded
|
|
@@ -88,35 +81,28 @@ var createTelepointers = exports.createTelepointers = function createTelepointer
|
|
|
88
81
|
fullNameEl.textContent = fullName;
|
|
89
82
|
fullNameEl.className = 'telepointer-fullname';
|
|
90
83
|
fullNameEl.style.backgroundColor = avatarColor.backgroundColor;
|
|
84
|
+
fullNameEl.setAttribute('aria-hidden', 'true');
|
|
91
85
|
cursor.appendChild(fullNameEl);
|
|
92
86
|
var initialEl = document.createElement('span');
|
|
93
87
|
initialEl.textContent = initial;
|
|
94
88
|
initialEl.className = 'telepointer-initial';
|
|
95
89
|
initialEl.style.backgroundColor = avatarColor.backgroundColor;
|
|
90
|
+
initialEl.setAttribute('aria-hidden', 'true');
|
|
96
91
|
cursor.appendChild(initialEl);
|
|
97
92
|
}
|
|
98
|
-
return decorations.concat(
|
|
99
|
-
// Ignored via go/ees005
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
101
|
-
_view.Decoration.widget(to, spaceJoinerAfter, {
|
|
93
|
+
return decorations.concat(_view.Decoration.widget(to, spaceJoinerAfter, {
|
|
102
94
|
pointer: {
|
|
103
95
|
sessionId: sessionId,
|
|
104
96
|
presenceId: presenceId
|
|
105
97
|
},
|
|
106
98
|
key: "telepointer-".concat(sessionId, "-zero")
|
|
107
|
-
})).concat(
|
|
108
|
-
// Ignored via go/ees005
|
|
109
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
|
-
_view.Decoration.widget(to, cursor, {
|
|
99
|
+
})).concat(_view.Decoration.widget(to, cursor, {
|
|
111
100
|
pointer: {
|
|
112
101
|
sessionId: sessionId,
|
|
113
102
|
presenceId: presenceId
|
|
114
103
|
},
|
|
115
104
|
key: "telepointer-".concat(sessionId)
|
|
116
|
-
})).concat(
|
|
117
|
-
// Ignored via go/ees005
|
|
118
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
119
|
-
_view.Decoration.widget(to, spaceJoinerBefore, {
|
|
105
|
+
})).concat(_view.Decoration.widget(to, spaceJoinerBefore, {
|
|
120
106
|
pointer: {
|
|
121
107
|
sessionId: sessionId,
|
|
122
108
|
presenceId: presenceId
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AnalyticsStep } from '@atlaskit/adf-schema/steps';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
4
|
import { getSendableSelection } from '../actions';
|
|
4
5
|
import { pluginKey } from '../main/plugin-key';
|
|
@@ -42,13 +43,32 @@ export const sendTransaction = ({
|
|
|
42
43
|
} = currentPluginState;
|
|
43
44
|
const selectionChanged = !oldEditorState.selection.eq(newEditorState.selection);
|
|
44
45
|
const participantsChanged = prevActiveParticipants && !prevActiveParticipants.eq(activeParticipants);
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
if (fg('platform_editor_ai_in_document_streaming')) {
|
|
47
|
+
// uiEvent is standard metdata (docs: https://prosemirror.net/docs/ref/#state.Transaction)
|
|
48
|
+
const isPaste = (docChangedTransaction === null || docChangedTransaction === void 0 ? void 0 : docChangedTransaction.getMeta('uiEvent')) === 'paste';
|
|
49
|
+
if (sessionId && viewMode === 'edit' && (
|
|
50
|
+
// Broadcast the position if the selection has changed, and the doc hasn't changed (it is mapped
|
|
51
|
+
// by the receiver).
|
|
52
|
+
// If we're pasting content though make an exception (as doc has changed)
|
|
53
|
+
// as on a ranged selection it results in not clearing the ranged selection after the paste
|
|
54
|
+
selectionChanged && (!docChangedTransaction || isPaste) || participantsChanged && !hideTelecursorOnLoad)) {
|
|
55
|
+
const selection = getSendableSelection(newEditorState.selection);
|
|
56
|
+
const message = {
|
|
57
|
+
type: 'telepointer',
|
|
58
|
+
selection,
|
|
59
|
+
sessionId
|
|
60
|
+
};
|
|
61
|
+
provider.sendMessage(message);
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
if (sessionId && viewMode === 'edit' && (selectionChanged && !docChangedTransaction || participantsChanged && !hideTelecursorOnLoad)) {
|
|
65
|
+
const selection = getSendableSelection(newEditorState.selection);
|
|
66
|
+
const message = {
|
|
67
|
+
type: 'telepointer',
|
|
68
|
+
selection,
|
|
69
|
+
sessionId
|
|
70
|
+
};
|
|
71
|
+
provider.sendMessage(message);
|
|
72
|
+
}
|
|
53
73
|
}
|
|
54
74
|
};
|
|
@@ -164,26 +164,27 @@ export class PluginState {
|
|
|
164
164
|
} catch (err) {
|
|
165
165
|
this.onError(err);
|
|
166
166
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
167
|
+
if (!fg('platform_editor_ai_in_document_streaming')) {
|
|
168
|
+
// Remove any selection decoration within the change range,
|
|
169
|
+
// takes care of the issue when after pasting we end up with a dead selection
|
|
170
|
+
tr.steps.filter(isReplaceStep).forEach(s => {
|
|
171
|
+
// Ignored via go/ees005
|
|
172
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
173
|
+
const {
|
|
174
|
+
from,
|
|
175
|
+
to
|
|
176
|
+
} = s;
|
|
177
|
+
// Ignored via go/ees005
|
|
178
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
179
|
+
this.decorationSet.find(from, to).forEach(deco => {
|
|
180
|
+
// `type` is private, `from` and `to` are public in latest version
|
|
181
|
+
// `from` != `to` means it's a selection
|
|
182
|
+
if (deco.from !== deco.to) {
|
|
183
|
+
remove.push(deco);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
185
186
|
});
|
|
186
|
-
}
|
|
187
|
+
}
|
|
187
188
|
}
|
|
188
189
|
const {
|
|
189
190
|
selection
|
|
@@ -8,14 +8,8 @@ import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
|
8
8
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
9
9
|
import { getParticipantColor } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
-
export const _findPointers = (id, decorations) => decorations.find()
|
|
12
|
-
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
-
.reduce((arr, deco) => deco.spec.pointer.sessionId === id ? arr.concat(deco) : arr, []);
|
|
15
|
-
export const findPointers = (id, decorations) => decorations.find().reduce(
|
|
16
|
-
// Ignored via go/ees005
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
-
(arr, deco) => deco.spec.pointer.presenceId === id ? arr.concat(deco) : arr, []);
|
|
11
|
+
export const _findPointers = (id, decorations) => decorations.find().reduce((arr, deco) => deco.spec.pointer.sessionId === id ? arr.concat(deco) : arr, []);
|
|
12
|
+
export const findPointers = (id, decorations) => decorations.find().reduce((arr, deco) => deco.spec.pointer.presenceId === id ? arr.concat(deco) : arr, []);
|
|
19
13
|
function style(options) {
|
|
20
14
|
const color = options && options.color || 'black';
|
|
21
15
|
return `border-right: 2px solid ${color}; margin-right: -2px; z-index: 1`;
|
|
@@ -34,10 +28,7 @@ export const createTelepointers = (from, to, sessionId, isSelection, initial, pr
|
|
|
34
28
|
const color = avatarColor.index.toString();
|
|
35
29
|
if (isSelection) {
|
|
36
30
|
const className = `telepointer color-${color} telepointer-selection`;
|
|
37
|
-
decorations.push(
|
|
38
|
-
// Ignored via go/ees005
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
-
Decoration.inline(from, to, {
|
|
31
|
+
decorations.push(Decoration.inline(from, to, {
|
|
41
32
|
class: className,
|
|
42
33
|
'data-initial': initial
|
|
43
34
|
}, {
|
|
@@ -58,6 +49,8 @@ export const createTelepointers = (from, to, sessionId, isSelection, initial, pr
|
|
|
58
49
|
color: avatarColor.backgroundColor
|
|
59
50
|
})};`;
|
|
60
51
|
cursor.setAttribute('data-initial', initial);
|
|
52
|
+
cursor.setAttribute('aria-label', `${fullName} cursor position`);
|
|
53
|
+
cursor.setAttribute('role', 'button');
|
|
61
54
|
if (fg('confluence_team_presence_scroll_to_pointer')) {
|
|
62
55
|
cursor.setAttribute(TELEPOINTER_DATA_SESSION_ID_ATTR, sessionId);
|
|
63
56
|
// If there is an ongoing expand animation, we'll keep the telepointer expanded
|
|
@@ -70,35 +63,28 @@ export const createTelepointers = (from, to, sessionId, isSelection, initial, pr
|
|
|
70
63
|
fullNameEl.textContent = fullName;
|
|
71
64
|
fullNameEl.className = 'telepointer-fullname';
|
|
72
65
|
fullNameEl.style.backgroundColor = avatarColor.backgroundColor;
|
|
66
|
+
fullNameEl.setAttribute('aria-hidden', 'true');
|
|
73
67
|
cursor.appendChild(fullNameEl);
|
|
74
68
|
const initialEl = document.createElement('span');
|
|
75
69
|
initialEl.textContent = initial;
|
|
76
70
|
initialEl.className = 'telepointer-initial';
|
|
77
71
|
initialEl.style.backgroundColor = avatarColor.backgroundColor;
|
|
72
|
+
initialEl.setAttribute('aria-hidden', 'true');
|
|
78
73
|
cursor.appendChild(initialEl);
|
|
79
74
|
}
|
|
80
|
-
return decorations.concat(
|
|
81
|
-
// Ignored via go/ees005
|
|
82
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
83
|
-
Decoration.widget(to, spaceJoinerAfter, {
|
|
75
|
+
return decorations.concat(Decoration.widget(to, spaceJoinerAfter, {
|
|
84
76
|
pointer: {
|
|
85
77
|
sessionId,
|
|
86
78
|
presenceId
|
|
87
79
|
},
|
|
88
80
|
key: `telepointer-${sessionId}-zero`
|
|
89
|
-
})).concat(
|
|
90
|
-
// Ignored via go/ees005
|
|
91
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
|
-
Decoration.widget(to, cursor, {
|
|
81
|
+
})).concat(Decoration.widget(to, cursor, {
|
|
93
82
|
pointer: {
|
|
94
83
|
sessionId,
|
|
95
84
|
presenceId
|
|
96
85
|
},
|
|
97
86
|
key: `telepointer-${sessionId}`
|
|
98
|
-
})).concat(
|
|
99
|
-
// Ignored via go/ees005
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
101
|
-
Decoration.widget(to, spaceJoinerBefore, {
|
|
87
|
+
})).concat(Decoration.widget(to, spaceJoinerBefore, {
|
|
102
88
|
pointer: {
|
|
103
89
|
sessionId,
|
|
104
90
|
presenceId
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AnalyticsStep } from '@atlaskit/adf-schema/steps';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
4
|
import { getSendableSelection } from '../actions';
|
|
4
5
|
import { pluginKey } from '../main/plugin-key';
|
|
@@ -41,14 +42,33 @@ export var sendTransaction = function sendTransaction(_ref) {
|
|
|
41
42
|
sessionId = currentPluginState.sessionId;
|
|
42
43
|
var selectionChanged = !oldEditorState.selection.eq(newEditorState.selection);
|
|
43
44
|
var participantsChanged = prevActiveParticipants && !prevActiveParticipants.eq(activeParticipants);
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
if (fg('platform_editor_ai_in_document_streaming')) {
|
|
46
|
+
// uiEvent is standard metdata (docs: https://prosemirror.net/docs/ref/#state.Transaction)
|
|
47
|
+
var isPaste = (docChangedTransaction === null || docChangedTransaction === void 0 ? void 0 : docChangedTransaction.getMeta('uiEvent')) === 'paste';
|
|
48
|
+
if (sessionId && viewMode === 'edit' && (
|
|
49
|
+
// Broadcast the position if the selection has changed, and the doc hasn't changed (it is mapped
|
|
50
|
+
// by the receiver).
|
|
51
|
+
// If we're pasting content though make an exception (as doc has changed)
|
|
52
|
+
// as on a ranged selection it results in not clearing the ranged selection after the paste
|
|
53
|
+
selectionChanged && (!docChangedTransaction || isPaste) || participantsChanged && !hideTelecursorOnLoad)) {
|
|
54
|
+
var selection = getSendableSelection(newEditorState.selection);
|
|
55
|
+
var message = {
|
|
56
|
+
type: 'telepointer',
|
|
57
|
+
selection: selection,
|
|
58
|
+
sessionId: sessionId
|
|
59
|
+
};
|
|
60
|
+
provider.sendMessage(message);
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
if (sessionId && viewMode === 'edit' && (selectionChanged && !docChangedTransaction || participantsChanged && !hideTelecursorOnLoad)) {
|
|
64
|
+
var _selection = getSendableSelection(newEditorState.selection);
|
|
65
|
+
var _message = {
|
|
66
|
+
type: 'telepointer',
|
|
67
|
+
selection: _selection,
|
|
68
|
+
sessionId: sessionId
|
|
69
|
+
};
|
|
70
|
+
provider.sendMessage(_message);
|
|
71
|
+
}
|
|
52
72
|
}
|
|
53
73
|
};
|
|
54
74
|
};
|
|
@@ -177,25 +177,26 @@ export var PluginState = /*#__PURE__*/function () {
|
|
|
177
177
|
} catch (err) {
|
|
178
178
|
this.onError(err);
|
|
179
179
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
180
|
+
if (!fg('platform_editor_ai_in_document_streaming')) {
|
|
181
|
+
// Remove any selection decoration within the change range,
|
|
182
|
+
// takes care of the issue when after pasting we end up with a dead selection
|
|
183
|
+
tr.steps.filter(isReplaceStep).forEach(function (s) {
|
|
184
|
+
// Ignored via go/ees005
|
|
185
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
186
|
+
var _ref2 = s,
|
|
187
|
+
from = _ref2.from,
|
|
188
|
+
to = _ref2.to;
|
|
189
|
+
// Ignored via go/ees005
|
|
190
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
191
|
+
_this.decorationSet.find(from, to).forEach(function (deco) {
|
|
192
|
+
// `type` is private, `from` and `to` are public in latest version
|
|
193
|
+
// `from` != `to` means it's a selection
|
|
194
|
+
if (deco.from !== deco.to) {
|
|
195
|
+
remove.push(deco);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
197
198
|
});
|
|
198
|
-
}
|
|
199
|
+
}
|
|
199
200
|
}
|
|
200
201
|
var selection = tr.selection;
|
|
201
202
|
// Ignored via go/ees005
|
|
@@ -10,18 +10,12 @@ import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
|
10
10
|
import { getParticipantColor } from '@atlaskit/editor-shared-styles';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
export var _findPointers = function _findPointers(id, decorations) {
|
|
13
|
-
return decorations.find()
|
|
14
|
-
// Ignored via go/ees005
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
-
.reduce(function (arr, deco) {
|
|
13
|
+
return decorations.find().reduce(function (arr, deco) {
|
|
17
14
|
return deco.spec.pointer.sessionId === id ? arr.concat(deco) : arr;
|
|
18
15
|
}, []);
|
|
19
16
|
};
|
|
20
17
|
export var findPointers = function findPointers(id, decorations) {
|
|
21
|
-
return decorations.find().reduce(
|
|
22
|
-
// Ignored via go/ees005
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
-
function (arr, deco) {
|
|
18
|
+
return decorations.find().reduce(function (arr, deco) {
|
|
25
19
|
return deco.spec.pointer.presenceId === id ? arr.concat(deco) : arr;
|
|
26
20
|
}, []);
|
|
27
21
|
};
|
|
@@ -43,10 +37,7 @@ export var createTelepointers = function createTelepointers(from, to, sessionId,
|
|
|
43
37
|
var color = avatarColor.index.toString();
|
|
44
38
|
if (isSelection) {
|
|
45
39
|
var className = "telepointer color-".concat(color, " telepointer-selection");
|
|
46
|
-
decorations.push(
|
|
47
|
-
// Ignored via go/ees005
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
-
Decoration.inline(from, to, {
|
|
40
|
+
decorations.push(Decoration.inline(from, to, {
|
|
50
41
|
class: className,
|
|
51
42
|
'data-initial': initial
|
|
52
43
|
}, {
|
|
@@ -67,6 +58,8 @@ export var createTelepointers = function createTelepointers(from, to, sessionId,
|
|
|
67
58
|
color: avatarColor.backgroundColor
|
|
68
59
|
}), ";");
|
|
69
60
|
cursor.setAttribute('data-initial', initial);
|
|
61
|
+
cursor.setAttribute('aria-label', "".concat(fullName, " cursor position"));
|
|
62
|
+
cursor.setAttribute('role', 'button');
|
|
70
63
|
if (fg('confluence_team_presence_scroll_to_pointer')) {
|
|
71
64
|
cursor.setAttribute(TELEPOINTER_DATA_SESSION_ID_ATTR, sessionId);
|
|
72
65
|
// If there is an ongoing expand animation, we'll keep the telepointer expanded
|
|
@@ -79,35 +72,28 @@ export var createTelepointers = function createTelepointers(from, to, sessionId,
|
|
|
79
72
|
fullNameEl.textContent = fullName;
|
|
80
73
|
fullNameEl.className = 'telepointer-fullname';
|
|
81
74
|
fullNameEl.style.backgroundColor = avatarColor.backgroundColor;
|
|
75
|
+
fullNameEl.setAttribute('aria-hidden', 'true');
|
|
82
76
|
cursor.appendChild(fullNameEl);
|
|
83
77
|
var initialEl = document.createElement('span');
|
|
84
78
|
initialEl.textContent = initial;
|
|
85
79
|
initialEl.className = 'telepointer-initial';
|
|
86
80
|
initialEl.style.backgroundColor = avatarColor.backgroundColor;
|
|
81
|
+
initialEl.setAttribute('aria-hidden', 'true');
|
|
87
82
|
cursor.appendChild(initialEl);
|
|
88
83
|
}
|
|
89
|
-
return decorations.concat(
|
|
90
|
-
// Ignored via go/ees005
|
|
91
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
|
-
Decoration.widget(to, spaceJoinerAfter, {
|
|
84
|
+
return decorations.concat(Decoration.widget(to, spaceJoinerAfter, {
|
|
93
85
|
pointer: {
|
|
94
86
|
sessionId: sessionId,
|
|
95
87
|
presenceId: presenceId
|
|
96
88
|
},
|
|
97
89
|
key: "telepointer-".concat(sessionId, "-zero")
|
|
98
|
-
})).concat(
|
|
99
|
-
// Ignored via go/ees005
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
101
|
-
Decoration.widget(to, cursor, {
|
|
90
|
+
})).concat(Decoration.widget(to, cursor, {
|
|
102
91
|
pointer: {
|
|
103
92
|
sessionId: sessionId,
|
|
104
93
|
presenceId: presenceId
|
|
105
94
|
},
|
|
106
95
|
key: "telepointer-".concat(sessionId)
|
|
107
|
-
})).concat(
|
|
108
|
-
// Ignored via go/ees005
|
|
109
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
|
-
Decoration.widget(to, spaceJoinerBefore, {
|
|
96
|
+
})).concat(Decoration.widget(to, spaceJoinerBefore, {
|
|
111
97
|
pointer: {
|
|
112
98
|
sessionId: sessionId,
|
|
113
99
|
presenceId: presenceId
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-collab-edit",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Collab Edit plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
".": "./src/index.ts"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@atlaskit/adf-schema": "^
|
|
33
|
+
"@atlaskit/adf-schema": "^49.0.6",
|
|
34
34
|
"@atlaskit/custom-steps": "^0.11.0",
|
|
35
35
|
"@atlaskit/editor-json-transformer": "^8.24.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^3.0.0",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"@atlaskit/frontend-utilities": "^3.1.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
44
|
"@atlaskit/prosemirror-collab": "^0.17.0",
|
|
45
|
-
"@atlaskit/tmp-editor-statsig": "^9.
|
|
45
|
+
"@atlaskit/tmp-editor-statsig": "^9.7.0",
|
|
46
46
|
"@babel/runtime": "^7.0.0",
|
|
47
47
|
"memoize-one": "^6.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@atlaskit/editor-common": "^107.
|
|
50
|
+
"@atlaskit/editor-common": "^107.8.0",
|
|
51
51
|
"react": "^18.2.0",
|
|
52
52
|
"react-dom": "^18.2.0"
|
|
53
53
|
},
|
|
@@ -107,6 +107,9 @@
|
|
|
107
107
|
"confluence_team_presence_scroll_to_pointer": {
|
|
108
108
|
"type": "boolean"
|
|
109
109
|
},
|
|
110
|
+
"platform_editor_ai_in_document_streaming": {
|
|
111
|
+
"type": "boolean"
|
|
112
|
+
},
|
|
110
113
|
"platform_enable_ncs_step_metrics": {
|
|
111
114
|
"type": "boolean"
|
|
112
115
|
}
|