@atlaskit/editor-plugin-collab-edit 3.5.1 → 3.6.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 +8 -0
- package/dist/cjs/pm-plugins/main/plugin-state.js +12 -2
- package/dist/cjs/pm-plugins/utils.js +10 -2
- package/dist/es2019/pm-plugins/main/plugin-state.js +13 -3
- package/dist/es2019/pm-plugins/utils.js +5 -1
- package/dist/esm/pm-plugins/main/plugin-state.js +13 -3
- package/dist/esm/pm-plugins/utils.js +9 -1
- package/dist/types/pm-plugins/utils.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/utils.d.ts +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-collab-edit
|
|
2
2
|
|
|
3
|
+
## 3.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#149711](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/149711)
|
|
8
|
+
[`70859ded55acd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/70859ded55acd) -
|
|
9
|
+
[ux] Telepointers deduplicated based on presence id
|
|
10
|
+
|
|
3
11
|
## 3.5.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -110,7 +110,12 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
|
|
|
110
110
|
|
|
111
111
|
// Remove telepointers for users that left
|
|
112
112
|
left.forEach(function (i) {
|
|
113
|
-
var pointers
|
|
113
|
+
var pointers;
|
|
114
|
+
if ((0, _platformFeatureFlags.fg)('confluence_team_presence_scroll_to_pointer')) {
|
|
115
|
+
pointers = (0, _utils.findPointers)(_this.getPresenceId(i.sessionId), _this.decorationSet);
|
|
116
|
+
} else {
|
|
117
|
+
pointers = (0, _utils._findPointers)(i.sessionId, _this.decorationSet);
|
|
118
|
+
}
|
|
114
119
|
if (pointers) {
|
|
115
120
|
remove = remove.concat(pointers);
|
|
116
121
|
}
|
|
@@ -119,7 +124,12 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
|
|
|
119
124
|
if (telepointerData) {
|
|
120
125
|
var sessionId = telepointerData.sessionId;
|
|
121
126
|
if (participants.get(sessionId) && sessionId !== sid) {
|
|
122
|
-
var oldPointers
|
|
127
|
+
var oldPointers;
|
|
128
|
+
if ((0, _platformFeatureFlags.fg)('confluence_team_presence_scroll_to_pointer')) {
|
|
129
|
+
oldPointers = (0, _utils.findPointers)(this.getPresenceId(sessionId), this.decorationSet);
|
|
130
|
+
} else {
|
|
131
|
+
oldPointers = (0, _utils._findPointers)(sessionId, this.decorationSet);
|
|
132
|
+
}
|
|
123
133
|
if (oldPointers) {
|
|
124
134
|
remove = remove.concat(oldPointers);
|
|
125
135
|
}
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.findPointers = exports.createTelepointers = void 0;
|
|
7
|
+
exports.findPointers = exports.createTelepointers = exports._findPointers = void 0;
|
|
8
8
|
exports.getAvatarColor = getAvatarColor;
|
|
9
9
|
exports.scrollToCollabCursor = exports.replaceDocument = exports.originalTransactionHasMeta = exports.isReplaceStep = exports.isOrganicChange = exports.getPositionOfTelepointer = void 0;
|
|
10
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
@@ -17,7 +17,7 @@ var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
|
17
17
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
18
18
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
19
19
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
|
-
var
|
|
20
|
+
var _findPointers = exports._findPointers = function _findPointers(id, decorations) {
|
|
21
21
|
return decorations.find()
|
|
22
22
|
// Ignored via go/ees005
|
|
23
23
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -25,6 +25,14 @@ var findPointers = exports.findPointers = function findPointers(id, decorations)
|
|
|
25
25
|
return deco.spec.pointer.sessionId === id ? arr.concat(deco) : arr;
|
|
26
26
|
}, []);
|
|
27
27
|
};
|
|
28
|
+
var findPointers = exports.findPointers = function findPointers(id, decorations) {
|
|
29
|
+
return decorations.find().reduce(
|
|
30
|
+
// Ignored via go/ees005
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
+
function (arr, deco) {
|
|
33
|
+
return deco.spec.pointer.presenceId === id ? arr.concat(deco) : arr;
|
|
34
|
+
}, []);
|
|
35
|
+
};
|
|
28
36
|
function style(options) {
|
|
29
37
|
var color = options && options.color || 'black';
|
|
30
38
|
return "border-right: 2px solid ".concat(color, "; margin-right: -2px; z-index: 1");
|
|
@@ -5,7 +5,7 @@ import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
5
5
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { Participants } from '../participants';
|
|
8
|
-
import { createTelepointers, findPointers, getPositionOfTelepointer, isReplaceStep } from '../utils';
|
|
8
|
+
import { createTelepointers, _findPointers, findPointers, getPositionOfTelepointer, isReplaceStep } from '../utils';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Returns position where it's possible to place a decoration.
|
|
@@ -82,7 +82,12 @@ export class PluginState {
|
|
|
82
82
|
|
|
83
83
|
// Remove telepointers for users that left
|
|
84
84
|
left.forEach(i => {
|
|
85
|
-
|
|
85
|
+
let pointers;
|
|
86
|
+
if (fg('confluence_team_presence_scroll_to_pointer')) {
|
|
87
|
+
pointers = findPointers(this.getPresenceId(i.sessionId), this.decorationSet);
|
|
88
|
+
} else {
|
|
89
|
+
pointers = _findPointers(i.sessionId, this.decorationSet);
|
|
90
|
+
}
|
|
86
91
|
if (pointers) {
|
|
87
92
|
remove = remove.concat(pointers);
|
|
88
93
|
}
|
|
@@ -93,7 +98,12 @@ export class PluginState {
|
|
|
93
98
|
sessionId
|
|
94
99
|
} = telepointerData;
|
|
95
100
|
if (participants.get(sessionId) && sessionId !== sid) {
|
|
96
|
-
|
|
101
|
+
let oldPointers;
|
|
102
|
+
if (fg('confluence_team_presence_scroll_to_pointer')) {
|
|
103
|
+
oldPointers = findPointers(this.getPresenceId(sessionId), this.decorationSet);
|
|
104
|
+
} else {
|
|
105
|
+
oldPointers = _findPointers(sessionId, this.decorationSet);
|
|
106
|
+
}
|
|
97
107
|
if (oldPointers) {
|
|
98
108
|
remove = remove.concat(oldPointers);
|
|
99
109
|
}
|
|
@@ -7,10 +7,14 @@ import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
|
7
7
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import { getParticipantColor } from '@atlaskit/editor-shared-styles';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
-
export const
|
|
10
|
+
export const _findPointers = (id, decorations) => decorations.find()
|
|
11
11
|
// Ignored via go/ees005
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
13
|
.reduce((arr, deco) => deco.spec.pointer.sessionId === id ? arr.concat(deco) : arr, []);
|
|
14
|
+
export const findPointers = (id, decorations) => decorations.find().reduce(
|
|
15
|
+
// Ignored via go/ees005
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
(arr, deco) => deco.spec.pointer.presenceId === id ? arr.concat(deco) : arr, []);
|
|
14
18
|
function style(options) {
|
|
15
19
|
const color = options && options.color || 'black';
|
|
16
20
|
return `border-right: 2px solid ${color}; margin-right: -2px; z-index: 1`;
|
|
@@ -7,7 +7,7 @@ import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
7
7
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { Participants } from '../participants';
|
|
10
|
-
import { createTelepointers, findPointers, getPositionOfTelepointer, isReplaceStep } from '../utils';
|
|
10
|
+
import { createTelepointers, _findPointers, findPointers, getPositionOfTelepointer, isReplaceStep } from '../utils';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Returns position where it's possible to place a decoration.
|
|
@@ -104,7 +104,12 @@ export var PluginState = /*#__PURE__*/function () {
|
|
|
104
104
|
|
|
105
105
|
// Remove telepointers for users that left
|
|
106
106
|
left.forEach(function (i) {
|
|
107
|
-
var pointers
|
|
107
|
+
var pointers;
|
|
108
|
+
if (fg('confluence_team_presence_scroll_to_pointer')) {
|
|
109
|
+
pointers = findPointers(_this.getPresenceId(i.sessionId), _this.decorationSet);
|
|
110
|
+
} else {
|
|
111
|
+
pointers = _findPointers(i.sessionId, _this.decorationSet);
|
|
112
|
+
}
|
|
108
113
|
if (pointers) {
|
|
109
114
|
remove = remove.concat(pointers);
|
|
110
115
|
}
|
|
@@ -113,7 +118,12 @@ export var PluginState = /*#__PURE__*/function () {
|
|
|
113
118
|
if (telepointerData) {
|
|
114
119
|
var sessionId = telepointerData.sessionId;
|
|
115
120
|
if (participants.get(sessionId) && sessionId !== sid) {
|
|
116
|
-
var oldPointers
|
|
121
|
+
var oldPointers;
|
|
122
|
+
if (fg('confluence_team_presence_scroll_to_pointer')) {
|
|
123
|
+
oldPointers = findPointers(this.getPresenceId(sessionId), this.decorationSet);
|
|
124
|
+
} else {
|
|
125
|
+
oldPointers = _findPointers(sessionId, this.decorationSet);
|
|
126
|
+
}
|
|
117
127
|
if (oldPointers) {
|
|
118
128
|
remove = remove.concat(oldPointers);
|
|
119
129
|
}
|
|
@@ -8,7 +8,7 @@ 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 var
|
|
11
|
+
export var _findPointers = function _findPointers(id, decorations) {
|
|
12
12
|
return decorations.find()
|
|
13
13
|
// Ignored via go/ees005
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -16,6 +16,14 @@ export var findPointers = function findPointers(id, decorations) {
|
|
|
16
16
|
return deco.spec.pointer.sessionId === id ? arr.concat(deco) : arr;
|
|
17
17
|
}, []);
|
|
18
18
|
};
|
|
19
|
+
export var findPointers = function findPointers(id, decorations) {
|
|
20
|
+
return decorations.find().reduce(
|
|
21
|
+
// Ignored via go/ees005
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
function (arr, deco) {
|
|
24
|
+
return deco.spec.pointer.presenceId === id ? arr.concat(deco) : arr;
|
|
25
|
+
}, []);
|
|
26
|
+
};
|
|
19
27
|
function style(options) {
|
|
20
28
|
var color = options && options.color || 'black';
|
|
21
29
|
return "border-right: 2px solid ".concat(color, "; margin-right: -2px; z-index: 1");
|
|
@@ -4,6 +4,7 @@ import { type EditorState, type ReadonlyTransaction, Transaction } from '@atlask
|
|
|
4
4
|
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
5
5
|
import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
export declare const _findPointers: (id: string, decorations: DecorationSet) => Decoration[];
|
|
7
8
|
export declare const findPointers: (id: string, decorations: DecorationSet) => Decoration[];
|
|
8
9
|
export declare function getAvatarColor(str: string): {
|
|
9
10
|
index: number;
|
|
@@ -4,6 +4,7 @@ import { type EditorState, type ReadonlyTransaction, Transaction } from '@atlask
|
|
|
4
4
|
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
5
5
|
import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
export declare const _findPointers: (id: string, decorations: DecorationSet) => Decoration[];
|
|
7
8
|
export declare const findPointers: (id: string, decorations: DecorationSet) => Decoration[];
|
|
8
9
|
export declare function getAvatarColor(str: string): {
|
|
9
10
|
index: 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.6.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": "^104.
|
|
36
|
+
"@atlaskit/editor-common": "^104.1.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.18.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0",
|
|
48
48
|
"memoize-one": "^6.0.0"
|
|
49
49
|
},
|