@atlaskit/editor-plugin-collab-edit 1.6.1 → 1.8.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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # @atlaskit/editor-plugin-collab-edit
2
2
 
3
+ ## 1.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#115247](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/115247)
8
+ [`251d23ff9e6c8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/251d23ff9e6c8) -
9
+ upgrade adf-schema version to 38.0.0
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 1.7.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#114811](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/114811)
20
+ [`ad0d2f10ef71b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ad0d2f10ef71b) -
21
+ CONFONBO-3268: Changes for the experiment Teammate Presence: expose 2 new collab events to add
22
+ statuses (viewing/editing) to Confluence
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies
27
+
3
28
  ## 1.6.1
4
29
 
5
30
  ### Patch Changes
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.handleTelePointer = exports.handlePresence = exports.handleInit = exports.handleConnection = exports.getSendableSelection = exports.applyRemoteSteps = exports.applyRemoteData = void 0;
6
+ exports.handleTelePointer = exports.handlePresence = exports.handleInit = exports.handleConnection = exports.handleActivityJoin = exports.handleActivityAck = exports.getSendableSelection = exports.applyRemoteSteps = exports.applyRemoteData = void 0;
7
7
  var _state = require("@atlaskit/editor-prosemirror/state");
8
8
  var _transform = require("@atlaskit/editor-prosemirror/transform");
9
9
  var _prosemirrorCollab = require("@atlaskit/prosemirror-collab");
@@ -30,6 +30,31 @@ var handlePresence = exports.handlePresence = function handlePresence(presenceDa
30
30
  var tr = view.state.tr;
31
31
  view.dispatch(tr.setMeta('presence', presenceData));
32
32
  };
33
+ var ACTIVITY_EDITING = 'EDITING';
34
+
35
+ /**
36
+ * A Handler for event "activity:ack" forwarded from NCS.
37
+ * This event "activity:ack" is emitted by the existing collaborators in response to a new collaborator
38
+ * joining. It is used to inform the new collaborator about the current actions or states of the existing
39
+ * collaborators, such as viewing or editing.
40
+ */
41
+ var handleActivityAck = exports.handleActivityAck = function handleActivityAck() {};
42
+
43
+ /**
44
+ * A Handler for event "activity:join" forwarded from NCS.
45
+ * Existing participant respond to the new joiner with their status.
46
+ * This event "activity:join" is emitted when a new collaborator joins the session. The event carries
47
+ * information about the action the new collaborator is currently doing in the session, such as viewing
48
+ * or editing.
49
+ */
50
+ var handleActivityJoin = exports.handleActivityJoin = function handleActivityJoin(provider) {
51
+ if (provider) {
52
+ provider.sendMessage({
53
+ type: 'activity:ack',
54
+ activity: ACTIVITY_EDITING
55
+ });
56
+ }
57
+ };
33
58
  var applyRemoteData = exports.applyRemoteData = function applyRemoteData(remoteData, view, options) {
34
59
  var json = remoteData.json,
35
60
  _remoteData$userIds = remoteData.userIds,
@@ -51,6 +51,12 @@ var subscribe = exports.subscribe = effect(function (view, provider, options, fe
51
51
  presenceHandler: function presenceHandler(data) {
52
52
  return (0, _actions.handlePresence)(data, view);
53
53
  },
54
+ activityAckHandler: function activityAckHandler() {
55
+ return (0, _actions.handleActivityAck)();
56
+ },
57
+ activityJoinHandler: function activityJoinHandler() {
58
+ return (0, _actions.handleActivityJoin)(provider);
59
+ },
54
60
  telepointerHandler: function telepointerHandler(data) {
55
61
  return (0, _actions.handleTelePointer)(data, view);
56
62
  },
@@ -76,10 +82,10 @@ var subscribe = exports.subscribe = effect(function (view, provider, options, fe
76
82
  }
77
83
  }
78
84
  };
79
- provider.on('init', handlers.initHandler).on('connected', handlers.connectedHandler).on('data', handlers.dataHandler).on('presence', handlers.presenceHandler).on('telepointer', handlers.telepointerHandler).on('local-steps', handlers.localStepsHandler).on('error', handlers.errorHandler).on('entity', handlers.entityHandler);
85
+ provider.on('init', handlers.initHandler).on('connected', handlers.connectedHandler).on('data', handlers.dataHandler).on('presence', handlers.presenceHandler).on('activity:ack', handlers.activityAckHandler).on('activity:join', handlers.activityJoinHandler).on('telepointer', handlers.telepointerHandler).on('local-steps', handlers.localStepsHandler).on('error', handlers.errorHandler).on('entity', handlers.entityHandler);
80
86
  return function () {
81
87
  unsubscribeSynchronyEntity();
82
- provider.off('init', handlers.initHandler).off('connected', handlers.connectedHandler).off('data', handlers.dataHandler).off('presence', handlers.presenceHandler).off('telepointer', handlers.telepointerHandler).off('local-steps', handlers.localStepsHandler).off('error', handlers.errorHandler).off('entity', handlers.entityHandler);
88
+ provider.off('init', handlers.initHandler).off('connected', handlers.connectedHandler).off('data', handlers.dataHandler).off('presence', handlers.presenceHandler).off('activity:ack', handlers.activityAckHandler).off('activity:join', handlers.activityJoinHandler).off('telepointer', handlers.telepointerHandler).off('local-steps', handlers.localStepsHandler).off('error', handlers.errorHandler).off('entity', handlers.entityHandler);
83
89
  };
84
90
  }, function (previousDeps, currentDeps) {
85
91
  return currentDeps && currentDeps.every(function (dep, i) {
@@ -36,6 +36,31 @@ export const handlePresence = (presenceData, view) => {
36
36
  } = view;
37
37
  view.dispatch(tr.setMeta('presence', presenceData));
38
38
  };
39
+ const ACTIVITY_EDITING = 'EDITING';
40
+
41
+ /**
42
+ * A Handler for event "activity:ack" forwarded from NCS.
43
+ * This event "activity:ack" is emitted by the existing collaborators in response to a new collaborator
44
+ * joining. It is used to inform the new collaborator about the current actions or states of the existing
45
+ * collaborators, such as viewing or editing.
46
+ */
47
+ export const handleActivityAck = () => {};
48
+
49
+ /**
50
+ * A Handler for event "activity:join" forwarded from NCS.
51
+ * Existing participant respond to the new joiner with their status.
52
+ * This event "activity:join" is emitted when a new collaborator joins the session. The event carries
53
+ * information about the action the new collaborator is currently doing in the session, such as viewing
54
+ * or editing.
55
+ */
56
+ export const handleActivityJoin = provider => {
57
+ if (provider) {
58
+ provider.sendMessage({
59
+ type: 'activity:ack',
60
+ activity: ACTIVITY_EDITING
61
+ });
62
+ }
63
+ };
39
64
  export const applyRemoteData = (remoteData, view, options) => {
40
65
  const {
41
66
  json,
@@ -1,4 +1,4 @@
1
- import { applyRemoteData, handleConnection, handleInit, handlePresence, handleTelePointer } from '../actions';
1
+ import { applyRemoteData, handleActivityAck, handleActivityJoin, handleConnection, handleInit, handlePresence, handleTelePointer } from '../actions';
2
2
  import { addSynchronyEntityAnalytics, addSynchronyErrorAnalytics } from '../analytics';
3
3
  const effect = (fn, eq) => {
4
4
  let previousDeps;
@@ -36,6 +36,8 @@ export const subscribe = effect((view, provider, options, featureFlags, _provide
36
36
  connectedHandler: data => handleConnection(data, view),
37
37
  dataHandler: data => applyRemoteData(data, view, options),
38
38
  presenceHandler: data => handlePresence(data, view),
39
+ activityAckHandler: () => handleActivityAck(),
40
+ activityJoinHandler: () => handleActivityJoin(provider),
39
41
  telepointerHandler: data => handleTelePointer(data, view),
40
42
  localStepsHandler: data => {
41
43
  const {
@@ -64,9 +66,9 @@ export const subscribe = effect((view, provider, options, featureFlags, _provide
64
66
  }
65
67
  }
66
68
  };
67
- provider.on('init', handlers.initHandler).on('connected', handlers.connectedHandler).on('data', handlers.dataHandler).on('presence', handlers.presenceHandler).on('telepointer', handlers.telepointerHandler).on('local-steps', handlers.localStepsHandler).on('error', handlers.errorHandler).on('entity', handlers.entityHandler);
69
+ provider.on('init', handlers.initHandler).on('connected', handlers.connectedHandler).on('data', handlers.dataHandler).on('presence', handlers.presenceHandler).on('activity:ack', handlers.activityAckHandler).on('activity:join', handlers.activityJoinHandler).on('telepointer', handlers.telepointerHandler).on('local-steps', handlers.localStepsHandler).on('error', handlers.errorHandler).on('entity', handlers.entityHandler);
68
70
  return () => {
69
71
  unsubscribeSynchronyEntity();
70
- provider.off('init', handlers.initHandler).off('connected', handlers.connectedHandler).off('data', handlers.dataHandler).off('presence', handlers.presenceHandler).off('telepointer', handlers.telepointerHandler).off('local-steps', handlers.localStepsHandler).off('error', handlers.errorHandler).off('entity', handlers.entityHandler);
72
+ provider.off('init', handlers.initHandler).off('connected', handlers.connectedHandler).off('data', handlers.dataHandler).off('presence', handlers.presenceHandler).off('activity:ack', handlers.activityAckHandler).off('activity:join', handlers.activityJoinHandler).off('telepointer', handlers.telepointerHandler).off('local-steps', handlers.localStepsHandler).off('error', handlers.errorHandler).off('entity', handlers.entityHandler);
71
73
  };
72
74
  }, (previousDeps, currentDeps) => currentDeps && currentDeps.every((dep, i) => dep === previousDeps[i]));
@@ -24,6 +24,31 @@ export var handlePresence = function handlePresence(presenceData, view) {
24
24
  var tr = view.state.tr;
25
25
  view.dispatch(tr.setMeta('presence', presenceData));
26
26
  };
27
+ var ACTIVITY_EDITING = 'EDITING';
28
+
29
+ /**
30
+ * A Handler for event "activity:ack" forwarded from NCS.
31
+ * This event "activity:ack" is emitted by the existing collaborators in response to a new collaborator
32
+ * joining. It is used to inform the new collaborator about the current actions or states of the existing
33
+ * collaborators, such as viewing or editing.
34
+ */
35
+ export var handleActivityAck = function handleActivityAck() {};
36
+
37
+ /**
38
+ * A Handler for event "activity:join" forwarded from NCS.
39
+ * Existing participant respond to the new joiner with their status.
40
+ * This event "activity:join" is emitted when a new collaborator joins the session. The event carries
41
+ * information about the action the new collaborator is currently doing in the session, such as viewing
42
+ * or editing.
43
+ */
44
+ export var handleActivityJoin = function handleActivityJoin(provider) {
45
+ if (provider) {
46
+ provider.sendMessage({
47
+ type: 'activity:ack',
48
+ activity: ACTIVITY_EDITING
49
+ });
50
+ }
51
+ };
27
52
  export var applyRemoteData = function applyRemoteData(remoteData, view, options) {
28
53
  var json = remoteData.json,
29
54
  _remoteData$userIds = remoteData.userIds,
@@ -1,4 +1,4 @@
1
- import { applyRemoteData, handleConnection, handleInit, handlePresence, handleTelePointer } from '../actions';
1
+ import { applyRemoteData, handleActivityAck, handleActivityJoin, handleConnection, handleInit, handlePresence, handleTelePointer } from '../actions';
2
2
  import { addSynchronyEntityAnalytics, addSynchronyErrorAnalytics } from '../analytics';
3
3
  var effect = function effect(fn, eq) {
4
4
  var previousDeps;
@@ -45,6 +45,12 @@ export var subscribe = effect(function (view, provider, options, featureFlags, _
45
45
  presenceHandler: function presenceHandler(data) {
46
46
  return handlePresence(data, view);
47
47
  },
48
+ activityAckHandler: function activityAckHandler() {
49
+ return handleActivityAck();
50
+ },
51
+ activityJoinHandler: function activityJoinHandler() {
52
+ return handleActivityJoin(provider);
53
+ },
48
54
  telepointerHandler: function telepointerHandler(data) {
49
55
  return handleTelePointer(data, view);
50
56
  },
@@ -70,10 +76,10 @@ export var subscribe = effect(function (view, provider, options, featureFlags, _
70
76
  }
71
77
  }
72
78
  };
73
- provider.on('init', handlers.initHandler).on('connected', handlers.connectedHandler).on('data', handlers.dataHandler).on('presence', handlers.presenceHandler).on('telepointer', handlers.telepointerHandler).on('local-steps', handlers.localStepsHandler).on('error', handlers.errorHandler).on('entity', handlers.entityHandler);
79
+ provider.on('init', handlers.initHandler).on('connected', handlers.connectedHandler).on('data', handlers.dataHandler).on('presence', handlers.presenceHandler).on('activity:ack', handlers.activityAckHandler).on('activity:join', handlers.activityJoinHandler).on('telepointer', handlers.telepointerHandler).on('local-steps', handlers.localStepsHandler).on('error', handlers.errorHandler).on('entity', handlers.entityHandler);
74
80
  return function () {
75
81
  unsubscribeSynchronyEntity();
76
- provider.off('init', handlers.initHandler).off('connected', handlers.connectedHandler).off('data', handlers.dataHandler).off('presence', handlers.presenceHandler).off('telepointer', handlers.telepointerHandler).off('local-steps', handlers.localStepsHandler).off('error', handlers.errorHandler).off('entity', handlers.entityHandler);
82
+ provider.off('init', handlers.initHandler).off('connected', handlers.connectedHandler).off('data', handlers.dataHandler).off('presence', handlers.presenceHandler).off('activity:ack', handlers.activityAckHandler).off('activity:join', handlers.activityJoinHandler).off('telepointer', handlers.telepointerHandler).off('local-steps', handlers.localStepsHandler).off('error', handlers.errorHandler).off('entity', handlers.entityHandler);
77
83
  };
78
84
  }, function (previousDeps, currentDeps) {
79
85
  return currentDeps && currentDeps.every(function (dep, i) {
@@ -1,10 +1,25 @@
1
- import type { CollabEventConnectionData, CollabEventInitData, CollabEventPresenceData, CollabEventRemoteData, CollabSendableSelection, CollabTelepointerPayload } from '@atlaskit/editor-common/collab';
1
+ import type { CollabEditProvider, CollabEventConnectionData, CollabEventInitData, CollabEventPresenceData, CollabEventRemoteData, CollabSendableSelection, CollabTelepointerPayload } from '@atlaskit/editor-common/collab';
2
2
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { PrivateCollabEditOptions } from './types';
5
5
  export declare const handleInit: (initData: CollabEventInitData, view: EditorView, options?: PrivateCollabEditOptions) => void;
6
6
  export declare const handleConnection: (connectionData: CollabEventConnectionData, view: EditorView) => void;
7
7
  export declare const handlePresence: (presenceData: CollabEventPresenceData, view: EditorView) => void;
8
+ /**
9
+ * A Handler for event "activity:ack" forwarded from NCS.
10
+ * This event "activity:ack" is emitted by the existing collaborators in response to a new collaborator
11
+ * joining. It is used to inform the new collaborator about the current actions or states of the existing
12
+ * collaborators, such as viewing or editing.
13
+ */
14
+ export declare const handleActivityAck: () => void;
15
+ /**
16
+ * A Handler for event "activity:join" forwarded from NCS.
17
+ * Existing participant respond to the new joiner with their status.
18
+ * This event "activity:join" is emitted when a new collaborator joins the session. The event carries
19
+ * information about the action the new collaborator is currently doing in the session, such as viewing
20
+ * or editing.
21
+ */
22
+ export declare const handleActivityJoin: (provider: CollabEditProvider | null) => void;
8
23
  export declare const applyRemoteData: (remoteData: CollabEventRemoteData, view: EditorView, options: PrivateCollabEditOptions) => void;
9
24
  export declare const applyRemoteSteps: (json: any[], view: EditorView, userIds?: (number | string)[], options?: PrivateCollabEditOptions) => void;
10
25
  export declare const handleTelePointer: (telepointerData: CollabTelepointerPayload, view: EditorView) => void;
@@ -13,6 +13,8 @@ export interface CollabHandlers {
13
13
  connectedHandler: (data: CollabEventConnectionData) => void;
14
14
  dataHandler: (data: CollabEventRemoteData) => void;
15
15
  presenceHandler: (data: CollabEventPresenceData) => void;
16
+ activityAckHandler: () => void;
17
+ activityJoinHandler: () => void;
16
18
  telepointerHandler: (data: CollabTelepointerPayload) => void;
17
19
  localStepsHandler: (data: CollabEventLocalStepData) => void;
18
20
  errorHandler: (error: any) => void;
@@ -1,10 +1,25 @@
1
- import type { CollabEventConnectionData, CollabEventInitData, CollabEventPresenceData, CollabEventRemoteData, CollabSendableSelection, CollabTelepointerPayload } from '@atlaskit/editor-common/collab';
1
+ import type { CollabEditProvider, CollabEventConnectionData, CollabEventInitData, CollabEventPresenceData, CollabEventRemoteData, CollabSendableSelection, CollabTelepointerPayload } from '@atlaskit/editor-common/collab';
2
2
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { PrivateCollabEditOptions } from './types';
5
5
  export declare const handleInit: (initData: CollabEventInitData, view: EditorView, options?: PrivateCollabEditOptions) => void;
6
6
  export declare const handleConnection: (connectionData: CollabEventConnectionData, view: EditorView) => void;
7
7
  export declare const handlePresence: (presenceData: CollabEventPresenceData, view: EditorView) => void;
8
+ /**
9
+ * A Handler for event "activity:ack" forwarded from NCS.
10
+ * This event "activity:ack" is emitted by the existing collaborators in response to a new collaborator
11
+ * joining. It is used to inform the new collaborator about the current actions or states of the existing
12
+ * collaborators, such as viewing or editing.
13
+ */
14
+ export declare const handleActivityAck: () => void;
15
+ /**
16
+ * A Handler for event "activity:join" forwarded from NCS.
17
+ * Existing participant respond to the new joiner with their status.
18
+ * This event "activity:join" is emitted when a new collaborator joins the session. The event carries
19
+ * information about the action the new collaborator is currently doing in the session, such as viewing
20
+ * or editing.
21
+ */
22
+ export declare const handleActivityJoin: (provider: CollabEditProvider | null) => void;
8
23
  export declare const applyRemoteData: (remoteData: CollabEventRemoteData, view: EditorView, options: PrivateCollabEditOptions) => void;
9
24
  export declare const applyRemoteSteps: (json: any[], view: EditorView, userIds?: (number | string)[], options?: PrivateCollabEditOptions) => void;
10
25
  export declare const handleTelePointer: (telepointerData: CollabTelepointerPayload, view: EditorView) => void;
@@ -13,6 +13,8 @@ export interface CollabHandlers {
13
13
  connectedHandler: (data: CollabEventConnectionData) => void;
14
14
  dataHandler: (data: CollabEventRemoteData) => void;
15
15
  presenceHandler: (data: CollabEventPresenceData) => void;
16
+ activityAckHandler: () => void;
17
+ activityJoinHandler: () => void;
16
18
  telepointerHandler: (data: CollabTelepointerPayload) => void;
17
19
  localStepsHandler: (data: CollabEventLocalStepData) => void;
18
20
  errorHandler: (error: any) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-collab-edit",
3
- "version": "1.6.1",
3
+ "version": "1.8.0",
4
4
  "description": "Collab Edit plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,16 +32,16 @@
32
32
  ".": "./src/index.ts"
33
33
  },
34
34
  "dependencies": {
35
- "@atlaskit/adf-schema": "^37.0.0",
36
- "@atlaskit/custom-steps": "^0.3.0",
37
- "@atlaskit/editor-common": "^83.0.0",
38
- "@atlaskit/editor-plugin-analytics": "1.3.1",
35
+ "@atlaskit/adf-schema": "^38.0.0",
36
+ "@atlaskit/custom-steps": "^0.4.0",
37
+ "@atlaskit/editor-common": "^83.3.0",
38
+ "@atlaskit/editor-plugin-analytics": "1.4.0",
39
39
  "@atlaskit/editor-plugin-editor-viewmode": "^2.0.0",
40
40
  "@atlaskit/editor-plugin-feature-flags": "^1.1.0",
41
41
  "@atlaskit/editor-prosemirror": "4.0.1",
42
42
  "@atlaskit/editor-shared-styles": "^2.12.0",
43
43
  "@atlaskit/platform-feature-flags": "^0.2.5",
44
- "@atlaskit/prosemirror-collab": "^0.5.0",
44
+ "@atlaskit/prosemirror-collab": "^0.6.0",
45
45
  "@babel/runtime": "^7.0.0",
46
46
  "memoize-one": "^6.0.0"
47
47
  },
@@ -51,11 +51,11 @@
51
51
  "devDependencies": {
52
52
  "@af/integration-testing": "*",
53
53
  "@af/visual-regression": "*",
54
- "@atlaskit/editor-plugin-mentions": "^1.7.0",
55
- "@atlaskit/editor-plugin-text-formatting": "^1.8.0",
56
- "@atlaskit/editor-plugin-type-ahead": "^1.3.0",
57
- "@atlaskit/editor-plugin-unsupported-content": "^1.3.0",
58
- "@atlaskit/editor-test-helpers": "^18.24.0",
54
+ "@atlaskit/editor-plugin-mentions": "^1.8.0",
55
+ "@atlaskit/editor-plugin-text-formatting": "^1.9.0",
56
+ "@atlaskit/editor-plugin-type-ahead": "^1.4.0",
57
+ "@atlaskit/editor-plugin-unsupported-content": "^1.4.0",
58
+ "@atlaskit/editor-test-helpers": "^18.25.0",
59
59
  "@atlaskit/ssr": "*",
60
60
  "@atlaskit/synchrony-test-helpers": "^2.4.0",
61
61
  "@atlaskit/util-data-test": "^17.9.0",