@atlaskit/editor-plugin-collab-edit 3.4.1 → 3.5.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 +13 -0
- package/dist/cjs/pm-plugins/main/plugin-state.js +9 -4
- package/dist/cjs/pm-plugins/utils.js +13 -1
- package/dist/es2019/pm-plugins/main/plugin-state.js +7 -4
- package/dist/es2019/pm-plugins/utils.js +13 -1
- package/dist/esm/pm-plugins/main/plugin-state.js +9 -4
- package/dist/esm/pm-plugins/utils.js +13 -1
- package/dist/types/pm-plugins/main/plugin-state.d.ts +1 -0
- package/dist/types/pm-plugins/utils.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/main/plugin-state.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/utils.d.ts +1 -1
- package/package.json +14 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-collab-edit
|
|
2
2
|
|
|
3
|
+
## 3.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#147951](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/147951)
|
|
8
|
+
[`ec2f90f672938`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ec2f90f672938) -
|
|
9
|
+
[ux] getFullName has been added to PluginState. User's initial and full name are now in their
|
|
10
|
+
separate elements under telepointer.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 3.4.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -59,11 +59,16 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
|
|
|
59
59
|
get: function get() {
|
|
60
60
|
return this.sid;
|
|
61
61
|
}
|
|
62
|
+
}, {
|
|
63
|
+
key: "getFullName",
|
|
64
|
+
value: function getFullName(sessionId) {
|
|
65
|
+
var participant = this.participants.get(sessionId);
|
|
66
|
+
return participant ? participant.name : 'X';
|
|
67
|
+
}
|
|
62
68
|
}, {
|
|
63
69
|
key: "getInitial",
|
|
64
70
|
value: function getInitial(sessionId) {
|
|
65
|
-
|
|
66
|
-
return participant ? participant.name.substring(0, 1).toUpperCase() : 'X';
|
|
71
|
+
return this.getFullName(sessionId).substring(0, 1).toUpperCase();
|
|
67
72
|
}
|
|
68
73
|
}, {
|
|
69
74
|
key: "getPresenceId",
|
|
@@ -142,7 +147,7 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
|
|
|
142
147
|
} catch (err) {
|
|
143
148
|
this.onError(err);
|
|
144
149
|
}
|
|
145
|
-
add = add.concat((0, _utils.createTelepointers)(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId)));
|
|
150
|
+
add = add.concat((0, _utils.createTelepointers)(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId), this.getFullName(sessionId)));
|
|
146
151
|
}
|
|
147
152
|
}
|
|
148
153
|
if (tr.docChanged) {
|
|
@@ -161,7 +166,7 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
|
|
|
161
166
|
size = _ref.slice.content.size,
|
|
162
167
|
_from = _ref.from;
|
|
163
168
|
var pos = getValidPos(tr, size ? Math.min(_from + size, tr.doc.nodeSize - 3) : Math.max(_from, 1));
|
|
164
|
-
add = add.concat((0, _utils.createTelepointers)(pos, pos, _sessionId, false, _this.getInitial(_sessionId), presenceId));
|
|
169
|
+
add = add.concat((0, _utils.createTelepointers)(pos, pos, _sessionId, false, _this.getInitial(_sessionId), presenceId, _this.getFullName(_sessionId)));
|
|
165
170
|
}
|
|
166
171
|
}
|
|
167
172
|
}
|
|
@@ -37,7 +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) {
|
|
40
|
+
var createTelepointers = exports.createTelepointers = function createTelepointers(from, to, sessionId, isSelection, initial, presenceId, fullName) {
|
|
41
41
|
var decorations = [];
|
|
42
42
|
var avatarColor = getAvatarColor(presenceId);
|
|
43
43
|
var color = avatarColor.index.toString();
|
|
@@ -67,6 +67,18 @@ var createTelepointers = exports.createTelepointers = function createTelepointer
|
|
|
67
67
|
color: avatarColor.backgroundColor
|
|
68
68
|
}), ";");
|
|
69
69
|
cursor.setAttribute('data-initial', initial);
|
|
70
|
+
if ((0, _platformFeatureFlags.fg)('confluence_team_presence_scroll_to_pointer')) {
|
|
71
|
+
var fullNameEl = document.createElement('span');
|
|
72
|
+
fullNameEl.textContent = fullName;
|
|
73
|
+
fullNameEl.className = 'telepointer-fullname';
|
|
74
|
+
fullNameEl.style.backgroundColor = avatarColor.backgroundColor;
|
|
75
|
+
cursor.appendChild(fullNameEl);
|
|
76
|
+
var initialEl = document.createElement('span');
|
|
77
|
+
initialEl.textContent = initial;
|
|
78
|
+
initialEl.className = 'telepointer-initial';
|
|
79
|
+
initialEl.style.backgroundColor = avatarColor.backgroundColor;
|
|
80
|
+
cursor.appendChild(initialEl);
|
|
81
|
+
}
|
|
70
82
|
return decorations.concat(
|
|
71
83
|
// Ignored via go/ees005
|
|
72
84
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -40,9 +40,12 @@ export class PluginState {
|
|
|
40
40
|
this.isReady = collabInitalised;
|
|
41
41
|
this.onError = onError || this.onError;
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
getFullName(sessionId) {
|
|
44
44
|
const participant = this.participants.get(sessionId);
|
|
45
|
-
return participant ? participant.name
|
|
45
|
+
return participant ? participant.name : 'X';
|
|
46
|
+
}
|
|
47
|
+
getInitial(sessionId) {
|
|
48
|
+
return this.getFullName(sessionId).substring(0, 1).toUpperCase();
|
|
46
49
|
}
|
|
47
50
|
getPresenceId(sessionId) {
|
|
48
51
|
var _participant$presence;
|
|
@@ -118,7 +121,7 @@ export class PluginState {
|
|
|
118
121
|
} catch (err) {
|
|
119
122
|
this.onError(err);
|
|
120
123
|
}
|
|
121
|
-
add = add.concat(createTelepointers(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId)));
|
|
124
|
+
add = add.concat(createTelepointers(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId), this.getFullName(sessionId)));
|
|
122
125
|
}
|
|
123
126
|
}
|
|
124
127
|
if (tr.docChanged) {
|
|
@@ -145,7 +148,7 @@ export class PluginState {
|
|
|
145
148
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
146
149
|
} = step;
|
|
147
150
|
const pos = getValidPos(tr, size ? Math.min(from + size, tr.doc.nodeSize - 3) : Math.max(from, 1));
|
|
148
|
-
add = add.concat(createTelepointers(pos, pos, sessionId, false, this.getInitial(sessionId), presenceId));
|
|
151
|
+
add = add.concat(createTelepointers(pos, pos, sessionId, false, this.getInitial(sessionId), presenceId, this.getFullName(sessionId)));
|
|
149
152
|
}
|
|
150
153
|
}
|
|
151
154
|
}
|
|
@@ -23,7 +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) => {
|
|
26
|
+
export const createTelepointers = (from, to, sessionId, isSelection, initial, presenceId, fullName) => {
|
|
27
27
|
const decorations = [];
|
|
28
28
|
const avatarColor = getAvatarColor(presenceId);
|
|
29
29
|
const color = avatarColor.index.toString();
|
|
@@ -53,6 +53,18 @@ export const createTelepointers = (from, to, sessionId, isSelection, initial, pr
|
|
|
53
53
|
color: avatarColor.backgroundColor
|
|
54
54
|
})};`;
|
|
55
55
|
cursor.setAttribute('data-initial', initial);
|
|
56
|
+
if (fg('confluence_team_presence_scroll_to_pointer')) {
|
|
57
|
+
const fullNameEl = document.createElement('span');
|
|
58
|
+
fullNameEl.textContent = fullName;
|
|
59
|
+
fullNameEl.className = 'telepointer-fullname';
|
|
60
|
+
fullNameEl.style.backgroundColor = avatarColor.backgroundColor;
|
|
61
|
+
cursor.appendChild(fullNameEl);
|
|
62
|
+
const initialEl = document.createElement('span');
|
|
63
|
+
initialEl.textContent = initial;
|
|
64
|
+
initialEl.className = 'telepointer-initial';
|
|
65
|
+
initialEl.style.backgroundColor = avatarColor.backgroundColor;
|
|
66
|
+
cursor.appendChild(initialEl);
|
|
67
|
+
}
|
|
56
68
|
return decorations.concat(
|
|
57
69
|
// Ignored via go/ees005
|
|
58
70
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -53,11 +53,16 @@ export var PluginState = /*#__PURE__*/function () {
|
|
|
53
53
|
get: function get() {
|
|
54
54
|
return this.sid;
|
|
55
55
|
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "getFullName",
|
|
58
|
+
value: function getFullName(sessionId) {
|
|
59
|
+
var participant = this.participants.get(sessionId);
|
|
60
|
+
return participant ? participant.name : 'X';
|
|
61
|
+
}
|
|
56
62
|
}, {
|
|
57
63
|
key: "getInitial",
|
|
58
64
|
value: function getInitial(sessionId) {
|
|
59
|
-
|
|
60
|
-
return participant ? participant.name.substring(0, 1).toUpperCase() : 'X';
|
|
65
|
+
return this.getFullName(sessionId).substring(0, 1).toUpperCase();
|
|
61
66
|
}
|
|
62
67
|
}, {
|
|
63
68
|
key: "getPresenceId",
|
|
@@ -136,7 +141,7 @@ export var PluginState = /*#__PURE__*/function () {
|
|
|
136
141
|
} catch (err) {
|
|
137
142
|
this.onError(err);
|
|
138
143
|
}
|
|
139
|
-
add = add.concat(createTelepointers(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId)));
|
|
144
|
+
add = add.concat(createTelepointers(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId), this.getFullName(sessionId)));
|
|
140
145
|
}
|
|
141
146
|
}
|
|
142
147
|
if (tr.docChanged) {
|
|
@@ -155,7 +160,7 @@ export var PluginState = /*#__PURE__*/function () {
|
|
|
155
160
|
size = _ref.slice.content.size,
|
|
156
161
|
_from = _ref.from;
|
|
157
162
|
var pos = getValidPos(tr, size ? Math.min(_from + size, tr.doc.nodeSize - 3) : Math.max(_from, 1));
|
|
158
|
-
add = add.concat(createTelepointers(pos, pos, _sessionId, false, _this.getInitial(_sessionId), presenceId));
|
|
163
|
+
add = add.concat(createTelepointers(pos, pos, _sessionId, false, _this.getInitial(_sessionId), presenceId, _this.getFullName(_sessionId)));
|
|
159
164
|
}
|
|
160
165
|
}
|
|
161
166
|
}
|
|
@@ -28,7 +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) {
|
|
31
|
+
export var createTelepointers = function createTelepointers(from, to, sessionId, isSelection, initial, presenceId, fullName) {
|
|
32
32
|
var decorations = [];
|
|
33
33
|
var avatarColor = getAvatarColor(presenceId);
|
|
34
34
|
var color = avatarColor.index.toString();
|
|
@@ -58,6 +58,18 @@ export var createTelepointers = function createTelepointers(from, to, sessionId,
|
|
|
58
58
|
color: avatarColor.backgroundColor
|
|
59
59
|
}), ";");
|
|
60
60
|
cursor.setAttribute('data-initial', initial);
|
|
61
|
+
if (fg('confluence_team_presence_scroll_to_pointer')) {
|
|
62
|
+
var fullNameEl = document.createElement('span');
|
|
63
|
+
fullNameEl.textContent = fullName;
|
|
64
|
+
fullNameEl.className = 'telepointer-fullname';
|
|
65
|
+
fullNameEl.style.backgroundColor = avatarColor.backgroundColor;
|
|
66
|
+
cursor.appendChild(fullNameEl);
|
|
67
|
+
var initialEl = document.createElement('span');
|
|
68
|
+
initialEl.textContent = initial;
|
|
69
|
+
initialEl.className = 'telepointer-initial';
|
|
70
|
+
initialEl.style.backgroundColor = avatarColor.backgroundColor;
|
|
71
|
+
cursor.appendChild(initialEl);
|
|
72
|
+
}
|
|
61
73
|
return decorations.concat(
|
|
62
74
|
// Ignored via go/ees005
|
|
63
75
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -16,6 +16,7 @@ export declare class PluginState {
|
|
|
16
16
|
get activeParticipants(): ReadOnlyParticipants;
|
|
17
17
|
get sessionId(): string | undefined;
|
|
18
18
|
constructor(decorations: DecorationSet, participants: Participants, sessionId?: string, collabInitalised?: boolean, onError?: (err: Error) => void);
|
|
19
|
+
getFullName(sessionId: string): string;
|
|
19
20
|
getInitial(sessionId: string): string;
|
|
20
21
|
getPresenceId(sessionId: string): string;
|
|
21
22
|
apply(tr: ReadonlyTransaction): PluginState;
|
|
@@ -10,7 +10,7 @@ export declare function getAvatarColor(str: string): {
|
|
|
10
10
|
backgroundColor: string;
|
|
11
11
|
textColor: string;
|
|
12
12
|
};
|
|
13
|
-
export declare const createTelepointers: (from: number, to: number, sessionId: string, isSelection: boolean, initial: string, presenceId: string) => Decoration[];
|
|
13
|
+
export declare const createTelepointers: (from: number, to: number, sessionId: string, isSelection: boolean, initial: string, presenceId: string, fullName: string) => Decoration[];
|
|
14
14
|
export declare const replaceDocument: (doc: any, state: EditorState, version?: number, options?: CollabEditOptions, reserveCursor?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => Transaction;
|
|
15
15
|
export declare const scrollToCollabCursor: (editorView: EditorView, participants: CollabParticipant[], sessionId: string | undefined, index: number, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => void;
|
|
16
16
|
export declare const getPositionOfTelepointer: (sessionId: string, decorationSet: DecorationSet) => undefined | number;
|
|
@@ -16,6 +16,7 @@ export declare class PluginState {
|
|
|
16
16
|
get activeParticipants(): ReadOnlyParticipants;
|
|
17
17
|
get sessionId(): string | undefined;
|
|
18
18
|
constructor(decorations: DecorationSet, participants: Participants, sessionId?: string, collabInitalised?: boolean, onError?: (err: Error) => void);
|
|
19
|
+
getFullName(sessionId: string): string;
|
|
19
20
|
getInitial(sessionId: string): string;
|
|
20
21
|
getPresenceId(sessionId: string): string;
|
|
21
22
|
apply(tr: ReadonlyTransaction): PluginState;
|
|
@@ -10,7 +10,7 @@ export declare function getAvatarColor(str: string): {
|
|
|
10
10
|
backgroundColor: string;
|
|
11
11
|
textColor: string;
|
|
12
12
|
};
|
|
13
|
-
export declare const createTelepointers: (from: number, to: number, sessionId: string, isSelection: boolean, initial: string, presenceId: string) => Decoration[];
|
|
13
|
+
export declare const createTelepointers: (from: number, to: number, sessionId: string, isSelection: boolean, initial: string, presenceId: string, fullName: string) => Decoration[];
|
|
14
14
|
export declare const replaceDocument: (doc: any, state: EditorState, version?: number, options?: CollabEditOptions, reserveCursor?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => Transaction;
|
|
15
15
|
export declare const scrollToCollabCursor: (editorView: EditorView, participants: CollabParticipant[], sessionId: string | undefined, index: number, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => void;
|
|
16
16
|
export declare const getPositionOfTelepointer: (sessionId: string, decorationSet: DecorationSet) => undefined | number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-collab-edit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Collab Edit plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
35
35
|
"@atlaskit/custom-steps": "^0.11.0",
|
|
36
|
-
"@atlaskit/editor-common": "^103.
|
|
36
|
+
"@atlaskit/editor-common": "^103.22.0",
|
|
37
37
|
"@atlaskit/editor-json-transformer": "^8.24.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-connectivity": "^2.0.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
45
|
"@atlaskit/prosemirror-collab": "^0.16.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^4.15.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0",
|
|
48
48
|
"memoize-one": "^6.0.0"
|
|
49
49
|
},
|
|
@@ -52,17 +52,17 @@
|
|
|
52
52
|
"react-dom": "^18.2.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@af/integration-testing": "
|
|
56
|
-
"@af/visual-regression": "
|
|
57
|
-
"@atlaskit/editor-plugin-mentions": "^4.
|
|
55
|
+
"@af/integration-testing": "workspace:^",
|
|
56
|
+
"@af/visual-regression": "workspace:^",
|
|
57
|
+
"@atlaskit/editor-plugin-mentions": "^4.5.0",
|
|
58
58
|
"@atlaskit/editor-plugin-text-formatting": "^2.2.0",
|
|
59
|
-
"@atlaskit/editor-plugin-type-ahead": "^2.
|
|
59
|
+
"@atlaskit/editor-plugin-type-ahead": "^2.6.0",
|
|
60
60
|
"@atlaskit/editor-plugin-unsupported-content": "^2.1.0",
|
|
61
|
-
"@atlaskit/editor-test-helpers": "
|
|
62
|
-
"@atlaskit/ssr": "
|
|
63
|
-
"@atlaskit/synchrony-test-helpers": "
|
|
61
|
+
"@atlaskit/editor-test-helpers": "workspace:^",
|
|
62
|
+
"@atlaskit/ssr": "workspace:^",
|
|
63
|
+
"@atlaskit/synchrony-test-helpers": "workspace:^",
|
|
64
64
|
"@atlaskit/util-data-test": "^18.0.0",
|
|
65
|
-
"@atlaskit/visual-regression": "
|
|
65
|
+
"@atlaskit/visual-regression": "workspace:^",
|
|
66
66
|
"@testing-library/react": "^13.4.0",
|
|
67
67
|
"typescript": "~5.4.2",
|
|
68
68
|
"wait-for-expect": "^1.2.0"
|
|
@@ -112,6 +112,9 @@
|
|
|
112
112
|
},
|
|
113
113
|
"platform_editor_no_telecursor_on_live_doc_init": {
|
|
114
114
|
"type": "boolean"
|
|
115
|
+
},
|
|
116
|
+
"confluence_team_presence_scroll_to_pointer": {
|
|
117
|
+
"type": "boolean"
|
|
115
118
|
}
|
|
116
119
|
}
|
|
117
120
|
}
|