@atlaskit/collab-provider 10.5.0 → 10.5.2
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 +16 -0
- package/dist/cjs/connectivity/reconnect-helper.js +1 -0
- package/dist/cjs/document/document-service.js +26 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/document/document-service.js +23 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/connectivity/reconnect-helper.js +1 -0
- package/dist/esm/document/document-service.js +26 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/document/document-service.d.ts +7 -0
- package/dist/types-ts4.5/document/document-service.d.ts +7 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 10.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#109636](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/109636)
|
|
8
|
+
[`2eadf04054ac2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2eadf04054ac2) -
|
|
9
|
+
[ux] Introduces way to retrieve the document from offline if there is a possible conflict event on
|
|
10
|
+
reconnection.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 10.5.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 10.5.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _readOnlyError2 = _interopRequireDefault(require("@babel/runtime/helpers/readOnlyError"));
|
|
8
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -120,6 +120,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
120
120
|
(_this$analyticsHelper = _this.analyticsHelper) === null || _this$analyticsHelper === void 0 || _this$analyticsHelper.sendActionEvent(_const.EVENT_ACTION.RECONNECTION, _const.EVENT_STATUS.INFO, _objectSpread(_objectSpread({}, reconnectionMetadata), {}, {
|
|
121
121
|
remoteStepsLength: (_steps$length = steps === null || steps === void 0 ? void 0 : steps.length) !== null && _steps$length !== void 0 ? _steps$length : 0
|
|
122
122
|
}));
|
|
123
|
+
_this.notifyReconnectionConflict(steps);
|
|
123
124
|
}
|
|
124
125
|
},
|
|
125
126
|
getState: _this.getState
|
|
@@ -724,6 +725,29 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
724
725
|
}
|
|
725
726
|
return collabState.version;
|
|
726
727
|
}
|
|
728
|
+
}, {
|
|
729
|
+
key: "notifyReconnectionConflict",
|
|
730
|
+
value:
|
|
731
|
+
/**
|
|
732
|
+
* In the event we reconnect check if we have existing unconfirmed steps and if so
|
|
733
|
+
* notify the editor that we have a potential conflict to resolve on the frontend.
|
|
734
|
+
*
|
|
735
|
+
* @param data remote steps payload
|
|
736
|
+
*/
|
|
737
|
+
function notifyReconnectionConflict(steps) {
|
|
738
|
+
var _this$getState7, _getCollabState;
|
|
739
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_offline_conflict_resolution')) {
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
var state = (_this$getState7 = this.getState) === null || _this$getState7 === void 0 ? void 0 : _this$getState7.call(this);
|
|
743
|
+
var unconfirmedSteps = state ? (_getCollabState = (0, _prosemirrorCollab.getCollabState)(state)) === null || _getCollabState === void 0 ? void 0 : _getCollabState.unconfirmed : undefined;
|
|
744
|
+
if (steps.length > 0 && state && unconfirmedSteps && unconfirmedSteps.length > 0) {
|
|
745
|
+
// In the future we can determine the type of conflict
|
|
746
|
+
this.providerEmitCallback('data:conflict', {
|
|
747
|
+
offlineDoc: state.doc
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
}
|
|
727
751
|
}, {
|
|
728
752
|
key: "processQueue",
|
|
729
753
|
value: function processQueue() {
|
|
@@ -817,8 +841,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
817
841
|
}, {
|
|
818
842
|
key: "sendStepsFromCurrentState",
|
|
819
843
|
value: function sendStepsFromCurrentState(sendAnalyticsEvent) {
|
|
820
|
-
var _this$
|
|
821
|
-
var state = (_this$
|
|
844
|
+
var _this$getState8;
|
|
845
|
+
var state = (_this$getState8 = this.getState) === null || _this$getState8 === void 0 ? void 0 : _this$getState8.call(this);
|
|
822
846
|
if (!state) {
|
|
823
847
|
var _this$analyticsHelper33;
|
|
824
848
|
(_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 || _this$analyticsHelper33.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/collab-provider";
|
|
8
|
-
var version = exports.version = "10.5.
|
|
8
|
+
var version = exports.version = "10.5.2";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -114,6 +114,7 @@ export class DocumentService {
|
|
|
114
114
|
...reconnectionMetadata,
|
|
115
115
|
remoteStepsLength: (_steps$length = steps === null || steps === void 0 ? void 0 : steps.length) !== null && _steps$length !== void 0 ? _steps$length : 0
|
|
116
116
|
});
|
|
117
|
+
this.notifyReconnectionConflict(steps);
|
|
117
118
|
}
|
|
118
119
|
},
|
|
119
120
|
getState: this.getState
|
|
@@ -611,6 +612,26 @@ export class DocumentService {
|
|
|
611
612
|
}
|
|
612
613
|
return collabState.version;
|
|
613
614
|
}
|
|
615
|
+
/**
|
|
616
|
+
* In the event we reconnect check if we have existing unconfirmed steps and if so
|
|
617
|
+
* notify the editor that we have a potential conflict to resolve on the frontend.
|
|
618
|
+
*
|
|
619
|
+
* @param data remote steps payload
|
|
620
|
+
*/
|
|
621
|
+
notifyReconnectionConflict(steps) {
|
|
622
|
+
var _this$getState7, _getCollabState;
|
|
623
|
+
if (!fg('platform_editor_offline_conflict_resolution')) {
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
const state = (_this$getState7 = this.getState) === null || _this$getState7 === void 0 ? void 0 : _this$getState7.call(this);
|
|
627
|
+
const unconfirmedSteps = state ? (_getCollabState = getCollabState(state)) === null || _getCollabState === void 0 ? void 0 : _getCollabState.unconfirmed : undefined;
|
|
628
|
+
if (steps.length > 0 && state && unconfirmedSteps && unconfirmedSteps.length > 0) {
|
|
629
|
+
// In the future we can determine the type of conflict
|
|
630
|
+
this.providerEmitCallback('data:conflict', {
|
|
631
|
+
offlineDoc: state.doc
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
}
|
|
614
635
|
processQueue() {
|
|
615
636
|
if (this.stepQueue.isPaused()) {
|
|
616
637
|
logger(`Queue is paused. Aborting.`);
|
|
@@ -693,8 +714,8 @@ export class DocumentService {
|
|
|
693
714
|
* from the EditorView.
|
|
694
715
|
*/
|
|
695
716
|
sendStepsFromCurrentState(sendAnalyticsEvent) {
|
|
696
|
-
var _this$
|
|
697
|
-
const state = (_this$
|
|
717
|
+
var _this$getState8;
|
|
718
|
+
const state = (_this$getState8 = this.getState) === null || _this$getState8 === void 0 ? void 0 : _this$getState8.call(this);
|
|
698
719
|
if (!state) {
|
|
699
720
|
var _this$analyticsHelper33;
|
|
700
721
|
(_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 ? void 0 : _this$analyticsHelper33.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
|
|
@@ -113,6 +113,7 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
113
113
|
(_this$analyticsHelper = _this.analyticsHelper) === null || _this$analyticsHelper === void 0 || _this$analyticsHelper.sendActionEvent(EVENT_ACTION.RECONNECTION, EVENT_STATUS.INFO, _objectSpread(_objectSpread({}, reconnectionMetadata), {}, {
|
|
114
114
|
remoteStepsLength: (_steps$length = steps === null || steps === void 0 ? void 0 : steps.length) !== null && _steps$length !== void 0 ? _steps$length : 0
|
|
115
115
|
}));
|
|
116
|
+
_this.notifyReconnectionConflict(steps);
|
|
116
117
|
}
|
|
117
118
|
},
|
|
118
119
|
getState: _this.getState
|
|
@@ -717,6 +718,29 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
717
718
|
}
|
|
718
719
|
return collabState.version;
|
|
719
720
|
}
|
|
721
|
+
}, {
|
|
722
|
+
key: "notifyReconnectionConflict",
|
|
723
|
+
value:
|
|
724
|
+
/**
|
|
725
|
+
* In the event we reconnect check if we have existing unconfirmed steps and if so
|
|
726
|
+
* notify the editor that we have a potential conflict to resolve on the frontend.
|
|
727
|
+
*
|
|
728
|
+
* @param data remote steps payload
|
|
729
|
+
*/
|
|
730
|
+
function notifyReconnectionConflict(steps) {
|
|
731
|
+
var _this$getState7, _getCollabState;
|
|
732
|
+
if (!fg('platform_editor_offline_conflict_resolution')) {
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
var state = (_this$getState7 = this.getState) === null || _this$getState7 === void 0 ? void 0 : _this$getState7.call(this);
|
|
736
|
+
var unconfirmedSteps = state ? (_getCollabState = getCollabState(state)) === null || _getCollabState === void 0 ? void 0 : _getCollabState.unconfirmed : undefined;
|
|
737
|
+
if (steps.length > 0 && state && unconfirmedSteps && unconfirmedSteps.length > 0) {
|
|
738
|
+
// In the future we can determine the type of conflict
|
|
739
|
+
this.providerEmitCallback('data:conflict', {
|
|
740
|
+
offlineDoc: state.doc
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
}
|
|
720
744
|
}, {
|
|
721
745
|
key: "processQueue",
|
|
722
746
|
value: function processQueue() {
|
|
@@ -810,8 +834,8 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
810
834
|
}, {
|
|
811
835
|
key: "sendStepsFromCurrentState",
|
|
812
836
|
value: function sendStepsFromCurrentState(sendAnalyticsEvent) {
|
|
813
|
-
var _this$
|
|
814
|
-
var state = (_this$
|
|
837
|
+
var _this$getState8;
|
|
838
|
+
var state = (_this$getState8 = this.getState) === null || _this$getState8 === void 0 ? void 0 : _this$getState8.call(this);
|
|
815
839
|
if (!state) {
|
|
816
840
|
var _this$analyticsHelper33;
|
|
817
841
|
(_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 || _this$analyticsHelper33.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
|
|
@@ -62,6 +62,13 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
62
62
|
private catchupv2;
|
|
63
63
|
private getVersionFromCollabState;
|
|
64
64
|
getCurrentPmVersion: () => number;
|
|
65
|
+
/**
|
|
66
|
+
* In the event we reconnect check if we have existing unconfirmed steps and if so
|
|
67
|
+
* notify the editor that we have a potential conflict to resolve on the frontend.
|
|
68
|
+
*
|
|
69
|
+
* @param data remote steps payload
|
|
70
|
+
*/
|
|
71
|
+
private notifyReconnectionConflict;
|
|
65
72
|
private processQueue;
|
|
66
73
|
getCurrentState: () => Promise<ResolvedEditorState>;
|
|
67
74
|
private isStepsFromNewClientIdForSameUserId;
|
|
@@ -62,6 +62,13 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
62
62
|
private catchupv2;
|
|
63
63
|
private getVersionFromCollabState;
|
|
64
64
|
getCurrentPmVersion: () => number;
|
|
65
|
+
/**
|
|
66
|
+
* In the event we reconnect check if we have existing unconfirmed steps and if so
|
|
67
|
+
* notify the editor that we have a potential conflict to resolve on the frontend.
|
|
68
|
+
*
|
|
69
|
+
* @param data remote steps payload
|
|
70
|
+
*/
|
|
71
|
+
private notifyReconnectionConflict;
|
|
65
72
|
private processQueue;
|
|
66
73
|
getCurrentState: () => Promise<ResolvedEditorState>;
|
|
67
74
|
private isStepsFromNewClientIdForSameUserId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "10.5.
|
|
3
|
+
"version": "10.5.2",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"@atlaskit/adf-utils": "^19.18.0",
|
|
36
36
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
37
37
|
"@atlaskit/analytics-listeners": "^8.14.0",
|
|
38
|
-
"@atlaskit/editor-common": "^99.
|
|
38
|
+
"@atlaskit/editor-common": "^99.8.0",
|
|
39
39
|
"@atlaskit/editor-json-transformer": "^8.22.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
41
41
|
"@atlaskit/feature-gate-js-client": "^4.22.0",
|
|
42
|
-
"@atlaskit/platform-feature-flags": "^0.
|
|
42
|
+
"@atlaskit/platform-feature-flags": "^1.0.0",
|
|
43
43
|
"@atlaskit/prosemirror-collab": "^0.11.0",
|
|
44
44
|
"@atlaskit/react-ufo": "^2.14.0",
|
|
45
45
|
"@atlaskit/ufo": "^0.3.0",
|
|
@@ -85,6 +85,9 @@
|
|
|
85
85
|
"tag_unconfirmed_steps_after_recovery": {
|
|
86
86
|
"type": "boolean"
|
|
87
87
|
},
|
|
88
|
+
"platform_editor_offline_conflict_resolution": {
|
|
89
|
+
"type": "boolean"
|
|
90
|
+
},
|
|
88
91
|
"platform_collab_provider_tracingheaders": {
|
|
89
92
|
"type": "boolean"
|
|
90
93
|
},
|