@atlaskit/editor-plugin-collab-edit 1.2.0 → 1.3.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 +17 -0
- package/dist/cjs/utils.js +4 -10
- package/dist/es2019/utils.js +4 -5
- package/dist/esm/utils.js +4 -5
- package/dist/types/utils.d.ts +2 -4
- package/dist/types-ts4.5/utils.d.ts +2 -4
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-collab-edit
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#86433](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86433) [`88ca3b199a49`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/88ca3b199a49) - [ux] EDF-412 Collaborators avatars and telepointer colors are tokenised.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 1.2.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#93689](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/93689) [`5ba5d2b4a9ac`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5ba5d2b4a9ac) - Updating adf-schema version to 35.10.0
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 1.2.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/dist/cjs/utils.js
CHANGED
|
@@ -4,21 +4,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
Object.defineProperty(exports, "colors", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function get() {
|
|
10
|
-
return _collab.colors;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
7
|
exports.findPointers = exports.createTelepointers = void 0;
|
|
14
8
|
exports.getAvatarColor = getAvatarColor;
|
|
15
9
|
exports.scrollToCollabCursor = exports.replaceDocument = exports.getPositionOfTelepointer = void 0;
|
|
16
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
17
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
18
|
-
var _collab = require("@atlaskit/editor-common/collab");
|
|
19
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
20
13
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
21
14
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
15
|
+
var _consts = require("@atlaskit/editor-shared-styles/consts");
|
|
22
16
|
var findPointers = exports.findPointers = function findPointers(id, decorations) {
|
|
23
17
|
return decorations.find().reduce(function (arr, deco) {
|
|
24
18
|
return deco.spec.pointer.sessionId === id ? arr.concat(deco) : arr;
|
|
@@ -36,10 +30,10 @@ function getAvatarColor(str) {
|
|
|
36
30
|
hash = hash & hash;
|
|
37
31
|
/* eslint-enable no-bitwise */
|
|
38
32
|
}
|
|
39
|
-
var index = Math.abs(hash) %
|
|
33
|
+
var index = Math.abs(hash) % _consts.avatarColors.length;
|
|
40
34
|
return {
|
|
41
35
|
index: index,
|
|
42
|
-
color:
|
|
36
|
+
color: _consts.avatarColors[index]
|
|
43
37
|
};
|
|
44
38
|
}
|
|
45
39
|
var createTelepointers = exports.createTelepointers = function createTelepointers(from, to, sessionId, isSelection, initial) {
|
|
@@ -65,7 +59,7 @@ var createTelepointers = exports.createTelepointers = function createTelepointer
|
|
|
65
59
|
cursor.textContent = _utils.ZERO_WIDTH_JOINER;
|
|
66
60
|
cursor.className = "telepointer color-".concat(color, " telepointer-selection-badge");
|
|
67
61
|
cursor.style.cssText = "".concat(style({
|
|
68
|
-
color: avatarColor.color
|
|
62
|
+
color: avatarColor.color
|
|
69
63
|
}), ";");
|
|
70
64
|
cursor.setAttribute('data-initial', initial);
|
|
71
65
|
return decorations.concat(_view.Decoration.widget(to, spaceJoinerAfter, {
|
package/dist/es2019/utils.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { colors } from '@atlaskit/editor-common/collab';
|
|
3
2
|
import { ZERO_WIDTH_JOINER } from '@atlaskit/editor-common/utils';
|
|
4
3
|
import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
4
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
-
|
|
5
|
+
import { avatarColors } from '@atlaskit/editor-shared-styles/consts';
|
|
7
6
|
export const findPointers = (id, decorations) => decorations.find().reduce((arr, deco) => deco.spec.pointer.sessionId === id ? arr.concat(deco) : arr, []);
|
|
8
7
|
function style(options) {
|
|
9
8
|
const color = options && options.color || 'black';
|
|
@@ -17,10 +16,10 @@ export function getAvatarColor(str) {
|
|
|
17
16
|
hash = hash & hash;
|
|
18
17
|
/* eslint-enable no-bitwise */
|
|
19
18
|
}
|
|
20
|
-
const index = Math.abs(hash) %
|
|
19
|
+
const index = Math.abs(hash) % avatarColors.length;
|
|
21
20
|
return {
|
|
22
21
|
index,
|
|
23
|
-
color:
|
|
22
|
+
color: avatarColors[index]
|
|
24
23
|
};
|
|
25
24
|
}
|
|
26
25
|
export const createTelepointers = (from, to, sessionId, isSelection, initial) => {
|
|
@@ -46,7 +45,7 @@ export const createTelepointers = (from, to, sessionId, isSelection, initial) =>
|
|
|
46
45
|
cursor.textContent = ZERO_WIDTH_JOINER;
|
|
47
46
|
cursor.className = `telepointer color-${color} telepointer-selection-badge`;
|
|
48
47
|
cursor.style.cssText = `${style({
|
|
49
|
-
color: avatarColor.color
|
|
48
|
+
color: avatarColor.color
|
|
50
49
|
})};`;
|
|
51
50
|
cursor.setAttribute('data-initial', initial);
|
|
52
51
|
return decorations.concat(Decoration.widget(to, spaceJoinerAfter, {
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { colors } from '@atlaskit/editor-common/collab';
|
|
4
3
|
import { ZERO_WIDTH_JOINER } from '@atlaskit/editor-common/utils';
|
|
5
4
|
import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
5
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
-
|
|
6
|
+
import { avatarColors } from '@atlaskit/editor-shared-styles/consts';
|
|
8
7
|
export var findPointers = function findPointers(id, decorations) {
|
|
9
8
|
return decorations.find().reduce(function (arr, deco) {
|
|
10
9
|
return deco.spec.pointer.sessionId === id ? arr.concat(deco) : arr;
|
|
@@ -22,10 +21,10 @@ export function getAvatarColor(str) {
|
|
|
22
21
|
hash = hash & hash;
|
|
23
22
|
/* eslint-enable no-bitwise */
|
|
24
23
|
}
|
|
25
|
-
var index = Math.abs(hash) %
|
|
24
|
+
var index = Math.abs(hash) % avatarColors.length;
|
|
26
25
|
return {
|
|
27
26
|
index: index,
|
|
28
|
-
color:
|
|
27
|
+
color: avatarColors[index]
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
30
|
export var createTelepointers = function createTelepointers(from, to, sessionId, isSelection, initial) {
|
|
@@ -51,7 +50,7 @@ export var createTelepointers = function createTelepointers(from, to, sessionId,
|
|
|
51
50
|
cursor.textContent = ZERO_WIDTH_JOINER;
|
|
52
51
|
cursor.className = "telepointer color-".concat(color, " telepointer-selection-badge");
|
|
53
52
|
cursor.style.cssText = "".concat(style({
|
|
54
|
-
color: avatarColor.color
|
|
53
|
+
color: avatarColor.color
|
|
55
54
|
}), ";");
|
|
56
55
|
cursor.setAttribute('data-initial', initial);
|
|
57
56
|
return decorations.concat(Decoration.widget(to, spaceJoinerAfter, {
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { CollabEditOptions, CollabParticipant
|
|
3
|
-
import { colors } from '@atlaskit/editor-common/collab';
|
|
2
|
+
import type { CollabEditOptions, CollabParticipant } from '@atlaskit/editor-common/collab';
|
|
4
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
4
|
import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
5
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
-
export { Color, colors };
|
|
8
6
|
export declare const findPointers: (id: string, decorations: DecorationSet) => Decoration[];
|
|
9
7
|
export declare function getAvatarColor(str: string): {
|
|
10
8
|
index: number;
|
|
11
|
-
color:
|
|
9
|
+
color: "var(--ds-icon-accent-lime)" | "var(--ds-icon-accent-red)" | "var(--ds-icon-accent-orange)" | "var(--ds-icon-accent-yellow)" | "var(--ds-icon-accent-green)" | "var(--ds-icon-accent-teal)" | "var(--ds-icon-accent-blue)" | "var(--ds-icon-accent-purple)" | "var(--ds-icon-accent-magenta)" | "var(--ds-icon-accent-gray)" | "var(--ds-background-accent-lime-bolder-hovered)" | "var(--ds-background-accent-red-bolder-hovered)" | "var(--ds-background-accent-orange-bolder-hovered)" | "var(--ds-background-accent-yellow-bolder-hovered)" | "var(--ds-background-accent-yellow-bolder-pressed)" | "var(--ds-background-accent-green-bolder-hovered)" | "var(--ds-background-accent-teal-bolder-hovered)" | "var(--ds-background-accent-blue-bolder-hovered)" | "var(--ds-background-accent-purple-bolder-hovered)" | "var(--ds-background-accent-magenta-bolder-hovered)" | "var(--ds-background-accent-gray-bolder-hovered)";
|
|
12
10
|
};
|
|
13
11
|
export declare const createTelepointers: (from: number, to: number, sessionId: string, isSelection: boolean, initial: string) => Decoration[];
|
|
14
12
|
export declare const replaceDocument: (doc: any, state: EditorState, version?: number, options?: CollabEditOptions, reserveCursor?: boolean) => import("prosemirror-state").Transaction;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { CollabEditOptions, CollabParticipant
|
|
3
|
-
import { colors } from '@atlaskit/editor-common/collab';
|
|
2
|
+
import type { CollabEditOptions, CollabParticipant } from '@atlaskit/editor-common/collab';
|
|
4
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
4
|
import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
5
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
-
export { Color, colors };
|
|
8
6
|
export declare const findPointers: (id: string, decorations: DecorationSet) => Decoration[];
|
|
9
7
|
export declare function getAvatarColor(str: string): {
|
|
10
8
|
index: number;
|
|
11
|
-
color:
|
|
9
|
+
color: "var(--ds-icon-accent-lime)" | "var(--ds-icon-accent-red)" | "var(--ds-icon-accent-orange)" | "var(--ds-icon-accent-yellow)" | "var(--ds-icon-accent-green)" | "var(--ds-icon-accent-teal)" | "var(--ds-icon-accent-blue)" | "var(--ds-icon-accent-purple)" | "var(--ds-icon-accent-magenta)" | "var(--ds-icon-accent-gray)" | "var(--ds-background-accent-lime-bolder-hovered)" | "var(--ds-background-accent-red-bolder-hovered)" | "var(--ds-background-accent-orange-bolder-hovered)" | "var(--ds-background-accent-yellow-bolder-hovered)" | "var(--ds-background-accent-yellow-bolder-pressed)" | "var(--ds-background-accent-green-bolder-hovered)" | "var(--ds-background-accent-teal-bolder-hovered)" | "var(--ds-background-accent-blue-bolder-hovered)" | "var(--ds-background-accent-purple-bolder-hovered)" | "var(--ds-background-accent-magenta-bolder-hovered)" | "var(--ds-background-accent-gray-bolder-hovered)";
|
|
12
10
|
};
|
|
13
11
|
export declare const createTelepointers: (from: number, to: number, sessionId: string, isSelection: boolean, initial: string) => Decoration[];
|
|
14
12
|
export declare const replaceDocument: (doc: any, state: EditorState, version?: number, options?: CollabEditOptions, reserveCursor?: boolean) => import("prosemirror-state").Transaction;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-collab-edit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Collab Edit plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,12 +32,13 @@
|
|
|
32
32
|
".": "./src/index.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atlaskit/adf-schema": "^35.
|
|
35
|
+
"@atlaskit/adf-schema": "^35.10.0",
|
|
36
36
|
"@atlaskit/custom-steps": "^0.1.0",
|
|
37
|
-
"@atlaskit/editor-common": "^78.
|
|
38
|
-
"@atlaskit/editor-plugin-analytics": "1.1.
|
|
37
|
+
"@atlaskit/editor-common": "^78.32.0",
|
|
38
|
+
"@atlaskit/editor-plugin-analytics": "1.1.1",
|
|
39
39
|
"@atlaskit/editor-plugin-feature-flags": "^1.1.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "4.0.0",
|
|
41
|
+
"@atlaskit/editor-shared-styles": "^2.10.0",
|
|
41
42
|
"@atlaskit/prosemirror-collab": "^0.3.0",
|
|
42
43
|
"@babel/runtime": "^7.0.0",
|
|
43
44
|
"memoize-one": "^6.0.0"
|