@atlaskit/editor-synced-block-provider 2.10.3 → 2.10.5
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 +14 -0
- package/dist/cjs/clients/confluence/contentProperty.js +2 -6
- package/dist/cjs/providers/confluence/confluenceContentAPI.js +17 -7
- package/dist/es2019/clients/confluence/contentProperty.js +2 -6
- package/dist/es2019/providers/confluence/confluenceContentAPI.js +17 -7
- package/dist/esm/clients/confluence/contentProperty.js +2 -6
- package/dist/esm/providers/confluence/confluenceContentAPI.js +17 -7
- package/dist/types/providers/confluence/confluenceContentAPI.d.ts +1 -1
- package/dist/types-ts4.5/providers/confluence/confluenceContentAPI.d.ts +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-synced-block-provider
|
|
2
2
|
|
|
3
|
+
## 2.10.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 2.10.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`e48b21e64bb2e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e48b21e64bb2e) -
|
|
14
|
+
EDITOR-3312 Populate the sync block data on creation and fetch properly
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 2.10.3
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -140,9 +140,7 @@ var updateContentProperty = exports.updateContentProperty = /*#__PURE__*/functio
|
|
|
140
140
|
pageId: documentARI
|
|
141
141
|
}), {}, {
|
|
142
142
|
key: key,
|
|
143
|
-
value: JSON.stringify(
|
|
144
|
-
content: value.content
|
|
145
|
-
})
|
|
143
|
+
value: JSON.stringify(value)
|
|
146
144
|
}); // Blog content properties don't support the useSameVersion flag at the moment
|
|
147
145
|
if (!isBlog) {
|
|
148
146
|
input = _objectSpread(_objectSpread({}, input), useSameVersion);
|
|
@@ -201,9 +199,7 @@ var createContentProperty = exports.createContentProperty = /*#__PURE__*/functio
|
|
|
201
199
|
pageId: documentARI
|
|
202
200
|
}), {}, {
|
|
203
201
|
key: key,
|
|
204
|
-
value: JSON.stringify(
|
|
205
|
-
content: value.content
|
|
206
|
-
})
|
|
202
|
+
value: JSON.stringify(value)
|
|
207
203
|
})
|
|
208
204
|
}
|
|
209
205
|
};
|
|
@@ -113,8 +113,18 @@ var ConfluenceADFFetchProvider = /*#__PURE__*/function () {
|
|
|
113
113
|
return _context.abrupt("return", {
|
|
114
114
|
data: {
|
|
115
115
|
content: syncedBlockData.content,
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
// If the block instance ID is not set, use the local ID from the fetch data request
|
|
117
|
+
// This is a fallback for the case where the block instance ID is not set in the synced block data (old data)
|
|
118
|
+
blockInstanceId: syncedBlockData.blockInstanceId || localId,
|
|
119
|
+
// If the resource ID is not set, use the resource ID from the fetch data request
|
|
120
|
+
// This is a fallback for the case where the resource ID is not set in the synced block data (old data)
|
|
121
|
+
resourceId: syncedBlockData.resourceId || resourceId,
|
|
122
|
+
// If the product is not set, use the default product 'confluence-page'
|
|
123
|
+
// This is a fallback for the case where the product is not set in the synced block data (old data)
|
|
124
|
+
product: syncedBlockData.product || 'confluence-page',
|
|
125
|
+
// If the source Ari is not set, use the resource ID as the source Ari
|
|
126
|
+
// This is a fallback for the case where the source Ari is not set in the synced block data (old data)
|
|
127
|
+
sourceAri: syncedBlockData.sourceAri || resourceId
|
|
118
128
|
},
|
|
119
129
|
resourceId: resourceId
|
|
120
130
|
});
|
|
@@ -218,14 +228,14 @@ var ConfluenceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
218
228
|
return (0, _createClass2.default)(ConfluenceADFWriteProvider, [{
|
|
219
229
|
key: "writeData",
|
|
220
230
|
value: function () {
|
|
221
|
-
var _writeData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(
|
|
231
|
+
var _writeData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(syncBlockData) {
|
|
222
232
|
var match, resourceId, _match, pageId, pageType, localId, key, sourceAri, syncBlockDataWithSourceDocumentAri, options, updatePayload, updateResult;
|
|
223
233
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
224
234
|
while (1) switch (_context3.prev = _context3.next) {
|
|
225
235
|
case 0:
|
|
226
|
-
resourceId =
|
|
236
|
+
resourceId = syncBlockData.resourceId;
|
|
227
237
|
_context3.prev = 1;
|
|
228
|
-
match = (0, _ari.getPageIdAndTypeFromConfluencePageAri)(
|
|
238
|
+
match = (0, _ari.getPageIdAndTypeFromConfluencePageAri)(resourceId);
|
|
229
239
|
_context3.next = 8;
|
|
230
240
|
break;
|
|
231
241
|
case 5:
|
|
@@ -241,7 +251,7 @@ var ConfluenceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
241
251
|
localId = (0, _ari.getLocalIdFromConfluencePageAri)(resourceId);
|
|
242
252
|
key = getContentPropertyKey(this.config.contentPropertyKey, localId);
|
|
243
253
|
sourceAri = (0, _ari.getConfluencePageAri)(pageId, this.config.cloudId, pageType);
|
|
244
|
-
syncBlockDataWithSourceDocumentAri = _objectSpread(_objectSpread({},
|
|
254
|
+
syncBlockDataWithSourceDocumentAri = _objectSpread(_objectSpread({}, syncBlockData), {}, {
|
|
245
255
|
product: 'confluence-page',
|
|
246
256
|
sourceAri: sourceAri
|
|
247
257
|
});
|
|
@@ -269,7 +279,7 @@ var ConfluenceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
269
279
|
_context3.next = 27;
|
|
270
280
|
break;
|
|
271
281
|
}
|
|
272
|
-
return _context3.abrupt("return", this.createNewContentProperty(pageId, key,
|
|
282
|
+
return _context3.abrupt("return", this.createNewContentProperty(pageId, key, syncBlockDataWithSourceDocumentAri, pageType).then(function () {
|
|
273
283
|
return {
|
|
274
284
|
resourceId: resourceId
|
|
275
285
|
};
|
|
@@ -183,9 +183,7 @@ export const updateContentProperty = async ({
|
|
|
183
183
|
pageId: documentARI
|
|
184
184
|
}),
|
|
185
185
|
key,
|
|
186
|
-
value: JSON.stringify(
|
|
187
|
-
content: value.content
|
|
188
|
-
})
|
|
186
|
+
value: JSON.stringify(value)
|
|
189
187
|
};
|
|
190
188
|
|
|
191
189
|
// Blog content properties don't support the useSameVersion flag at the moment
|
|
@@ -235,9 +233,7 @@ export const createContentProperty = async ({
|
|
|
235
233
|
pageId: documentARI
|
|
236
234
|
}),
|
|
237
235
|
key,
|
|
238
|
-
value: JSON.stringify(
|
|
239
|
-
content: value.content
|
|
240
|
-
})
|
|
236
|
+
value: JSON.stringify(value)
|
|
241
237
|
}
|
|
242
238
|
}
|
|
243
239
|
};
|
|
@@ -86,8 +86,18 @@ class ConfluenceADFFetchProvider {
|
|
|
86
86
|
return {
|
|
87
87
|
data: {
|
|
88
88
|
content: syncedBlockData.content,
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
// If the block instance ID is not set, use the local ID from the fetch data request
|
|
90
|
+
// This is a fallback for the case where the block instance ID is not set in the synced block data (old data)
|
|
91
|
+
blockInstanceId: syncedBlockData.blockInstanceId || localId,
|
|
92
|
+
// If the resource ID is not set, use the resource ID from the fetch data request
|
|
93
|
+
// This is a fallback for the case where the resource ID is not set in the synced block data (old data)
|
|
94
|
+
resourceId: syncedBlockData.resourceId || resourceId,
|
|
95
|
+
// If the product is not set, use the default product 'confluence-page'
|
|
96
|
+
// This is a fallback for the case where the product is not set in the synced block data (old data)
|
|
97
|
+
product: syncedBlockData.product || 'confluence-page',
|
|
98
|
+
// If the source Ari is not set, use the resource ID as the source Ari
|
|
99
|
+
// This is a fallback for the case where the source Ari is not set in the synced block data (old data)
|
|
100
|
+
sourceAri: syncedBlockData.sourceAri || resourceId
|
|
91
101
|
},
|
|
92
102
|
resourceId
|
|
93
103
|
};
|
|
@@ -146,13 +156,13 @@ class ConfluenceADFWriteProvider {
|
|
|
146
156
|
});
|
|
147
157
|
this.config = config;
|
|
148
158
|
}
|
|
149
|
-
async writeData(
|
|
159
|
+
async writeData(syncBlockData) {
|
|
150
160
|
let match;
|
|
151
161
|
const {
|
|
152
162
|
resourceId
|
|
153
|
-
} =
|
|
163
|
+
} = syncBlockData;
|
|
154
164
|
try {
|
|
155
|
-
match = getPageIdAndTypeFromConfluencePageAri(
|
|
165
|
+
match = getPageIdAndTypeFromConfluencePageAri(resourceId);
|
|
156
166
|
} catch (error) {
|
|
157
167
|
return {
|
|
158
168
|
error: stringifyError(error)
|
|
@@ -168,7 +178,7 @@ class ConfluenceADFWriteProvider {
|
|
|
168
178
|
const key = getContentPropertyKey(this.config.contentPropertyKey, localId);
|
|
169
179
|
const sourceAri = getConfluencePageAri(pageId, this.config.cloudId, pageType);
|
|
170
180
|
const syncBlockDataWithSourceDocumentAri = {
|
|
171
|
-
...
|
|
181
|
+
...syncBlockData,
|
|
172
182
|
product: 'confluence-page',
|
|
173
183
|
sourceAri
|
|
174
184
|
};
|
|
@@ -186,7 +196,7 @@ class ConfluenceADFWriteProvider {
|
|
|
186
196
|
resourceId
|
|
187
197
|
};
|
|
188
198
|
} else if (!updateResult) {
|
|
189
|
-
return this.createNewContentProperty(pageId, key,
|
|
199
|
+
return this.createNewContentProperty(pageId, key, syncBlockDataWithSourceDocumentAri, pageType).then(() => {
|
|
190
200
|
return {
|
|
191
201
|
resourceId
|
|
192
202
|
};
|
|
@@ -133,9 +133,7 @@ export var updateContentProperty = /*#__PURE__*/function () {
|
|
|
133
133
|
pageId: documentARI
|
|
134
134
|
}), {}, {
|
|
135
135
|
key: key,
|
|
136
|
-
value: JSON.stringify(
|
|
137
|
-
content: value.content
|
|
138
|
-
})
|
|
136
|
+
value: JSON.stringify(value)
|
|
139
137
|
}); // Blog content properties don't support the useSameVersion flag at the moment
|
|
140
138
|
if (!isBlog) {
|
|
141
139
|
input = _objectSpread(_objectSpread({}, input), useSameVersion);
|
|
@@ -194,9 +192,7 @@ export var createContentProperty = /*#__PURE__*/function () {
|
|
|
194
192
|
pageId: documentARI
|
|
195
193
|
}), {}, {
|
|
196
194
|
key: key,
|
|
197
|
-
value: JSON.stringify(
|
|
198
|
-
content: value.content
|
|
199
|
-
})
|
|
195
|
+
value: JSON.stringify(value)
|
|
200
196
|
})
|
|
201
197
|
}
|
|
202
198
|
};
|
|
@@ -107,8 +107,18 @@ var ConfluenceADFFetchProvider = /*#__PURE__*/function () {
|
|
|
107
107
|
return _context.abrupt("return", {
|
|
108
108
|
data: {
|
|
109
109
|
content: syncedBlockData.content,
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
// If the block instance ID is not set, use the local ID from the fetch data request
|
|
111
|
+
// This is a fallback for the case where the block instance ID is not set in the synced block data (old data)
|
|
112
|
+
blockInstanceId: syncedBlockData.blockInstanceId || localId,
|
|
113
|
+
// If the resource ID is not set, use the resource ID from the fetch data request
|
|
114
|
+
// This is a fallback for the case where the resource ID is not set in the synced block data (old data)
|
|
115
|
+
resourceId: syncedBlockData.resourceId || resourceId,
|
|
116
|
+
// If the product is not set, use the default product 'confluence-page'
|
|
117
|
+
// This is a fallback for the case where the product is not set in the synced block data (old data)
|
|
118
|
+
product: syncedBlockData.product || 'confluence-page',
|
|
119
|
+
// If the source Ari is not set, use the resource ID as the source Ari
|
|
120
|
+
// This is a fallback for the case where the source Ari is not set in the synced block data (old data)
|
|
121
|
+
sourceAri: syncedBlockData.sourceAri || resourceId
|
|
112
122
|
},
|
|
113
123
|
resourceId: resourceId
|
|
114
124
|
});
|
|
@@ -212,14 +222,14 @@ var ConfluenceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
212
222
|
return _createClass(ConfluenceADFWriteProvider, [{
|
|
213
223
|
key: "writeData",
|
|
214
224
|
value: function () {
|
|
215
|
-
var _writeData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(
|
|
225
|
+
var _writeData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(syncBlockData) {
|
|
216
226
|
var match, resourceId, _match, pageId, pageType, localId, key, sourceAri, syncBlockDataWithSourceDocumentAri, options, updatePayload, updateResult;
|
|
217
227
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
218
228
|
while (1) switch (_context3.prev = _context3.next) {
|
|
219
229
|
case 0:
|
|
220
|
-
resourceId =
|
|
230
|
+
resourceId = syncBlockData.resourceId;
|
|
221
231
|
_context3.prev = 1;
|
|
222
|
-
match = getPageIdAndTypeFromConfluencePageAri(
|
|
232
|
+
match = getPageIdAndTypeFromConfluencePageAri(resourceId);
|
|
223
233
|
_context3.next = 8;
|
|
224
234
|
break;
|
|
225
235
|
case 5:
|
|
@@ -235,7 +245,7 @@ var ConfluenceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
235
245
|
localId = getLocalIdFromConfluencePageAri(resourceId);
|
|
236
246
|
key = getContentPropertyKey(this.config.contentPropertyKey, localId);
|
|
237
247
|
sourceAri = getConfluencePageAri(pageId, this.config.cloudId, pageType);
|
|
238
|
-
syncBlockDataWithSourceDocumentAri = _objectSpread(_objectSpread({},
|
|
248
|
+
syncBlockDataWithSourceDocumentAri = _objectSpread(_objectSpread({}, syncBlockData), {}, {
|
|
239
249
|
product: 'confluence-page',
|
|
240
250
|
sourceAri: sourceAri
|
|
241
251
|
});
|
|
@@ -263,7 +273,7 @@ var ConfluenceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
263
273
|
_context3.next = 27;
|
|
264
274
|
break;
|
|
265
275
|
}
|
|
266
|
-
return _context3.abrupt("return", this.createNewContentProperty(pageId, key,
|
|
276
|
+
return _context3.abrupt("return", this.createNewContentProperty(pageId, key, syncBlockDataWithSourceDocumentAri, pageType).then(function () {
|
|
267
277
|
return {
|
|
268
278
|
resourceId: resourceId
|
|
269
279
|
};
|
|
@@ -23,7 +23,7 @@ declare class ConfluenceADFWriteProvider implements ADFWriteProvider {
|
|
|
23
23
|
private config;
|
|
24
24
|
constructor(config: ContentAPIConfig);
|
|
25
25
|
private createNewContentProperty;
|
|
26
|
-
writeData(
|
|
26
|
+
writeData(syncBlockData: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
27
27
|
deleteData(resourceId: string): Promise<DeleteSyncBlockResult>;
|
|
28
28
|
generateResourceId(sourceId: string, localId: string): string;
|
|
29
29
|
}
|
|
@@ -23,7 +23,7 @@ declare class ConfluenceADFWriteProvider implements ADFWriteProvider {
|
|
|
23
23
|
private config;
|
|
24
24
|
constructor(config: ContentAPIConfig);
|
|
25
25
|
private createNewContentProperty;
|
|
26
|
-
writeData(
|
|
26
|
+
writeData(syncBlockData: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
27
27
|
deleteData(resourceId: string): Promise<DeleteSyncBlockResult>;
|
|
28
28
|
generateResourceId(sourceId: string, localId: string): string;
|
|
29
29
|
}
|
package/package.json
CHANGED
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@atlaskit/adf-schema": "^51.4.0",
|
|
28
28
|
"@atlaskit/adf-utils": "^19.26.0",
|
|
29
|
-
"@atlaskit/css": "^0.
|
|
29
|
+
"@atlaskit/css": "^0.17.0",
|
|
30
30
|
"@atlaskit/editor-json-transformer": "^8.31.0",
|
|
31
31
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
32
32
|
"@atlaskit/node-data-provider": "^7.5.0",
|
|
33
|
-
"@atlaskit/primitives": "^16.
|
|
34
|
-
"@atlaskit/tokens": "^8.
|
|
33
|
+
"@atlaskit/primitives": "^16.3.0",
|
|
34
|
+
"@atlaskit/tokens": "^8.3.0",
|
|
35
35
|
"@babel/runtime": "^7.0.0",
|
|
36
36
|
"@compiled/react": "^0.18.6",
|
|
37
37
|
"uuid": "^3.1.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@atlaskit/editor-common": "^110.
|
|
40
|
+
"@atlaskit/editor-common": "^110.34.0",
|
|
41
41
|
"react": "^18.2.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
85
|
"name": "@atlaskit/editor-synced-block-provider",
|
|
86
|
-
"version": "2.10.
|
|
86
|
+
"version": "2.10.5",
|
|
87
87
|
"description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
|
|
88
88
|
"author": "Atlassian Pty Ltd",
|
|
89
89
|
"license": "Apache-2.0",
|