@atlaskit/editor-synced-block-provider 4.1.7 → 4.2.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 +11 -0
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +21 -2
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +16 -0
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +21 -2
- package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +7 -0
- package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +7 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-synced-block-provider
|
|
2
2
|
|
|
3
|
+
## 4.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`a9d6a5531d4ba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a9d6a5531d4ba) -
|
|
8
|
+
[ux] Ensures hasUnsavedBodiedSyncBlockChanges state is updated when page is being published.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 4.1.7
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -12,6 +12,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
13
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
14
14
|
var _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
16
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
17
|
var _types = require("../common/types");
|
|
17
18
|
var _errorHandling = require("../utils/errorHandling");
|
|
@@ -39,7 +40,18 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
39
40
|
this.syncBlockCache = new Map();
|
|
40
41
|
this.creationCompletionCallbacks = new Map();
|
|
41
42
|
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Register a callback to be invoked after flush() completes.
|
|
46
|
+
* Used by the pm-plugin to dispatch a transaction so that
|
|
47
|
+
* hasUnsavedBodiedSyncBlockChanges is recalculated in plugin state.
|
|
48
|
+
*/
|
|
42
49
|
return (0, _createClass2.default)(SourceSyncBlockStoreManager, [{
|
|
50
|
+
key: "registerFlushCompletionCallback",
|
|
51
|
+
value: function registerFlushCompletionCallback(callback) {
|
|
52
|
+
this.flushCompletionCallback = callback;
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
43
55
|
key: "setFireAnalyticsEvent",
|
|
44
56
|
value: function setFireAnalyticsEvent(fireAnalyticsEvent) {
|
|
45
57
|
this.fireAnalyticsEvent = fireAnalyticsEvent;
|
|
@@ -100,7 +112,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
100
112
|
value: (function () {
|
|
101
113
|
var _flush = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
102
114
|
var _this2 = this;
|
|
103
|
-
var _this$saveExperience, bodiedSyncBlockNodes, bodiedSyncBlockData, writeResults, _this$saveExperience2, _this$saveExperience3, _this$fireAnalyticsEv2;
|
|
115
|
+
var _this$saveExperience, bodiedSyncBlockNodes, bodiedSyncBlockData, writeResults, _this$saveExperience2, _this$saveExperience3, _this$fireAnalyticsEv2, _this$flushCompletion;
|
|
104
116
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
105
117
|
while (1) switch (_context.prev = _context.next) {
|
|
106
118
|
case 0:
|
|
@@ -194,10 +206,16 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
194
206
|
(_this$fireAnalyticsEv2 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv2 === void 0 || _this$fireAnalyticsEv2.call(this, (0, _errorHandling.updateErrorPayload)(_context.t0.message));
|
|
195
207
|
return _context.abrupt("return", false);
|
|
196
208
|
case 29:
|
|
209
|
+
_context.prev = 29;
|
|
210
|
+
if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_7')) {
|
|
211
|
+
(_this$flushCompletion = this.flushCompletionCallback) === null || _this$flushCompletion === void 0 || _this$flushCompletion.call(this);
|
|
212
|
+
}
|
|
213
|
+
return _context.finish(29);
|
|
214
|
+
case 32:
|
|
197
215
|
case "end":
|
|
198
216
|
return _context.stop();
|
|
199
217
|
}
|
|
200
|
-
}, _callee, this, [[0, 24]]);
|
|
218
|
+
}, _callee, this, [[0, 24, 29, 32]]);
|
|
201
219
|
}));
|
|
202
220
|
function flush() {
|
|
203
221
|
return _flush.apply(this, arguments);
|
|
@@ -581,6 +599,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
581
599
|
this.syncBlockCache.clear();
|
|
582
600
|
this.confirmationCallback = undefined;
|
|
583
601
|
this.creationCompletionCallbacks.clear();
|
|
602
|
+
this.flushCompletionCallback = undefined;
|
|
584
603
|
this.dataProvider = undefined;
|
|
585
604
|
(_this$saveExperience4 = this.saveExperience) === null || _this$saveExperience4 === void 0 || _this$saveExperience4.abort({
|
|
586
605
|
reason: 'editorDestroyed'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import isEqual from 'lodash/isEqual';
|
|
3
3
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
6
|
import { SyncBlockError } from '../common/types';
|
|
6
7
|
import { updateErrorPayload, createErrorPayload, deleteErrorPayload, updateCacheErrorPayload, getSourceInfoErrorPayload, updateSuccessPayload, createSuccessPayload, deleteSuccessPayload, fetchReferencesErrorPayload } from '../utils/errorHandling';
|
|
@@ -24,6 +25,15 @@ export class SourceSyncBlockStoreManager {
|
|
|
24
25
|
this.syncBlockCache = new Map();
|
|
25
26
|
this.creationCompletionCallbacks = new Map();
|
|
26
27
|
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Register a callback to be invoked after flush() completes.
|
|
31
|
+
* Used by the pm-plugin to dispatch a transaction so that
|
|
32
|
+
* hasUnsavedBodiedSyncBlockChanges is recalculated in plugin state.
|
|
33
|
+
*/
|
|
34
|
+
registerFlushCompletionCallback(callback) {
|
|
35
|
+
this.flushCompletionCallback = callback;
|
|
36
|
+
}
|
|
27
37
|
setFireAnalyticsEvent(fireAnalyticsEvent) {
|
|
28
38
|
this.fireAnalyticsEvent = fireAnalyticsEvent;
|
|
29
39
|
this.createExperience = getCreateSourceExperience(fireAnalyticsEvent);
|
|
@@ -151,6 +161,11 @@ export class SourceSyncBlockStoreManager {
|
|
|
151
161
|
});
|
|
152
162
|
(_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 ? void 0 : _this$fireAnalyticsEv4.call(this, updateErrorPayload(error.message));
|
|
153
163
|
return false;
|
|
164
|
+
} finally {
|
|
165
|
+
if (fg('platform_synced_block_patch_7')) {
|
|
166
|
+
var _this$flushCompletion;
|
|
167
|
+
(_this$flushCompletion = this.flushCompletionCallback) === null || _this$flushCompletion === void 0 ? void 0 : _this$flushCompletion.call(this);
|
|
168
|
+
}
|
|
154
169
|
}
|
|
155
170
|
}
|
|
156
171
|
hasUnsavedChanges() {
|
|
@@ -430,6 +445,7 @@ export class SourceSyncBlockStoreManager {
|
|
|
430
445
|
this.syncBlockCache.clear();
|
|
431
446
|
this.confirmationCallback = undefined;
|
|
432
447
|
this.creationCompletionCallbacks.clear();
|
|
448
|
+
this.flushCompletionCallback = undefined;
|
|
433
449
|
this.dataProvider = undefined;
|
|
434
450
|
(_this$saveExperience4 = this.saveExperience) === null || _this$saveExperience4 === void 0 ? void 0 : _this$saveExperience4.abort({
|
|
435
451
|
reason: 'editorDestroyed'
|
|
@@ -7,6 +7,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
8
|
import isEqual from 'lodash/isEqual';
|
|
9
9
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
12
|
import { SyncBlockError } from '../common/types';
|
|
12
13
|
import { updateErrorPayload, createErrorPayload, deleteErrorPayload, updateCacheErrorPayload, getSourceInfoErrorPayload, updateSuccessPayload, createSuccessPayload, deleteSuccessPayload, fetchReferencesErrorPayload } from '../utils/errorHandling';
|
|
@@ -32,7 +33,18 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
32
33
|
this.syncBlockCache = new Map();
|
|
33
34
|
this.creationCompletionCallbacks = new Map();
|
|
34
35
|
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Register a callback to be invoked after flush() completes.
|
|
39
|
+
* Used by the pm-plugin to dispatch a transaction so that
|
|
40
|
+
* hasUnsavedBodiedSyncBlockChanges is recalculated in plugin state.
|
|
41
|
+
*/
|
|
35
42
|
return _createClass(SourceSyncBlockStoreManager, [{
|
|
43
|
+
key: "registerFlushCompletionCallback",
|
|
44
|
+
value: function registerFlushCompletionCallback(callback) {
|
|
45
|
+
this.flushCompletionCallback = callback;
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
36
48
|
key: "setFireAnalyticsEvent",
|
|
37
49
|
value: function setFireAnalyticsEvent(fireAnalyticsEvent) {
|
|
38
50
|
this.fireAnalyticsEvent = fireAnalyticsEvent;
|
|
@@ -93,7 +105,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
93
105
|
value: (function () {
|
|
94
106
|
var _flush = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
95
107
|
var _this2 = this;
|
|
96
|
-
var _this$saveExperience, bodiedSyncBlockNodes, bodiedSyncBlockData, writeResults, _this$saveExperience2, _this$saveExperience3, _this$fireAnalyticsEv2;
|
|
108
|
+
var _this$saveExperience, bodiedSyncBlockNodes, bodiedSyncBlockData, writeResults, _this$saveExperience2, _this$saveExperience3, _this$fireAnalyticsEv2, _this$flushCompletion;
|
|
97
109
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
98
110
|
while (1) switch (_context.prev = _context.next) {
|
|
99
111
|
case 0:
|
|
@@ -187,10 +199,16 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
187
199
|
(_this$fireAnalyticsEv2 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv2 === void 0 || _this$fireAnalyticsEv2.call(this, updateErrorPayload(_context.t0.message));
|
|
188
200
|
return _context.abrupt("return", false);
|
|
189
201
|
case 29:
|
|
202
|
+
_context.prev = 29;
|
|
203
|
+
if (fg('platform_synced_block_patch_7')) {
|
|
204
|
+
(_this$flushCompletion = this.flushCompletionCallback) === null || _this$flushCompletion === void 0 || _this$flushCompletion.call(this);
|
|
205
|
+
}
|
|
206
|
+
return _context.finish(29);
|
|
207
|
+
case 32:
|
|
190
208
|
case "end":
|
|
191
209
|
return _context.stop();
|
|
192
210
|
}
|
|
193
|
-
}, _callee, this, [[0, 24]]);
|
|
211
|
+
}, _callee, this, [[0, 24, 29, 32]]);
|
|
194
212
|
}));
|
|
195
213
|
function flush() {
|
|
196
214
|
return _flush.apply(this, arguments);
|
|
@@ -574,6 +592,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
574
592
|
this.syncBlockCache.clear();
|
|
575
593
|
this.confirmationCallback = undefined;
|
|
576
594
|
this.creationCompletionCallbacks.clear();
|
|
595
|
+
this.flushCompletionCallback = undefined;
|
|
577
596
|
this.dataProvider = undefined;
|
|
578
597
|
(_this$saveExperience4 = this.saveExperience) === null || _this$saveExperience4 === void 0 || _this$saveExperience4.abort({
|
|
579
598
|
reason: 'editorDestroyed'
|
|
@@ -14,11 +14,18 @@ export declare class SourceSyncBlockStoreManager {
|
|
|
14
14
|
private confirmationCallback?;
|
|
15
15
|
private deletionRetryInfo?;
|
|
16
16
|
private creationCompletionCallbacks;
|
|
17
|
+
private flushCompletionCallback?;
|
|
17
18
|
private createExperience;
|
|
18
19
|
private saveExperience;
|
|
19
20
|
private deleteExperience;
|
|
20
21
|
private fetchSourceInfoExperience;
|
|
21
22
|
constructor(dataProvider?: SyncBlockDataProviderInterface);
|
|
23
|
+
/**
|
|
24
|
+
* Register a callback to be invoked after flush() completes.
|
|
25
|
+
* Used by the pm-plugin to dispatch a transaction so that
|
|
26
|
+
* hasUnsavedBodiedSyncBlockChanges is recalculated in plugin state.
|
|
27
|
+
*/
|
|
28
|
+
registerFlushCompletionCallback(callback: () => void): void;
|
|
22
29
|
setFireAnalyticsEvent(fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void): void;
|
|
23
30
|
isSourceBlock(node: PMNode): boolean;
|
|
24
31
|
/**
|
|
@@ -14,11 +14,18 @@ export declare class SourceSyncBlockStoreManager {
|
|
|
14
14
|
private confirmationCallback?;
|
|
15
15
|
private deletionRetryInfo?;
|
|
16
16
|
private creationCompletionCallbacks;
|
|
17
|
+
private flushCompletionCallback?;
|
|
17
18
|
private createExperience;
|
|
18
19
|
private saveExperience;
|
|
19
20
|
private deleteExperience;
|
|
20
21
|
private fetchSourceInfoExperience;
|
|
21
22
|
constructor(dataProvider?: SyncBlockDataProviderInterface);
|
|
23
|
+
/**
|
|
24
|
+
* Register a callback to be invoked after flush() completes.
|
|
25
|
+
* Used by the pm-plugin to dispatch a transaction so that
|
|
26
|
+
* hasUnsavedBodiedSyncBlockChanges is recalculated in plugin state.
|
|
27
|
+
*/
|
|
28
|
+
registerFlushCompletionCallback(callback: () => void): void;
|
|
22
29
|
setFireAnalyticsEvent(fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void): void;
|
|
23
30
|
isSourceBlock(node: PMNode): boolean;
|
|
24
31
|
/**
|
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
30
30
|
"@atlaskit/node-data-provider": "^9.0.0",
|
|
31
31
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
32
|
-
"@atlaskit/tmp-editor-statsig": "^45.
|
|
32
|
+
"@atlaskit/tmp-editor-statsig": "^45.1.0",
|
|
33
33
|
"@babel/runtime": "^7.0.0",
|
|
34
34
|
"@compiled/react": "^0.20.0",
|
|
35
35
|
"graphql-ws": "^5.14.2",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"uuid": "^3.1.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@atlaskit/editor-common": "^112.
|
|
41
|
+
"@atlaskit/editor-common": "^112.9.0",
|
|
42
42
|
"react": "^18.2.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
"name": "@atlaskit/editor-synced-block-provider",
|
|
84
|
-
"version": "4.
|
|
84
|
+
"version": "4.2.0",
|
|
85
85
|
"description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
|
|
86
86
|
"author": "Atlassian Pty Ltd",
|
|
87
87
|
"license": "Apache-2.0",
|
|
@@ -91,6 +91,9 @@
|
|
|
91
91
|
"platform-feature-flags": {
|
|
92
92
|
"block_service_source_repair": {
|
|
93
93
|
"type": "boolean"
|
|
94
|
+
},
|
|
95
|
+
"platform_synced_block_patch_7": {
|
|
96
|
+
"type": "boolean"
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
99
|
}
|