@atlaskit/editor-synced-block-renderer 3.3.0 → 3.4.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/afm-products/tsconfig.json +3 -0
- package/dist/cjs/ui/SyncedBlockErrorComponent.js +14 -4
- package/dist/cjs/ui/SyncedBlockNodeComponentRenderer.js +3 -2
- package/dist/cjs/ui/SyncedBlockRenderer.js +3 -2
- package/dist/es2019/ui/SyncedBlockErrorComponent.js +13 -2
- package/dist/es2019/ui/SyncedBlockNodeComponentRenderer.js +3 -2
- package/dist/es2019/ui/SyncedBlockRenderer.js +3 -2
- package/dist/esm/ui/SyncedBlockErrorComponent.js +14 -4
- package/dist/esm/ui/SyncedBlockNodeComponentRenderer.js +3 -2
- package/dist/esm/ui/SyncedBlockRenderer.js +3 -2
- package/dist/types/ui/SyncedBlockErrorComponent.d.ts +2 -1
- package/dist/types-ts4.5/ui/SyncedBlockErrorComponent.d.ts +2 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-synced-block-renderer
|
|
2
2
|
|
|
3
|
+
## 3.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`00d86f82d23fa`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/00d86f82d23fa) -
|
|
8
|
+
Move ARI checks to providers
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 3.3.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
|
@@ -16,15 +16,25 @@ var SyncedBlockErrorComponent = exports.SyncedBlockErrorComponent = function Syn
|
|
|
16
16
|
var error = _ref.error,
|
|
17
17
|
isLoading = _ref.isLoading,
|
|
18
18
|
onRetry = _ref.onRetry,
|
|
19
|
-
resourceId = _ref.resourceId
|
|
19
|
+
resourceId = _ref.resourceId,
|
|
20
|
+
documentAri = _ref.documentAri;
|
|
20
21
|
var getErrorContent = (0, _react.useMemo)(function () {
|
|
21
22
|
switch (error) {
|
|
22
23
|
case _editorSyncedBlockProvider.SyncBlockError.Forbidden:
|
|
23
24
|
if (!resourceId) {
|
|
24
25
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockGenericError.SyncedBlockGenericError, null);
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
if (documentAri) {
|
|
28
|
+
var _getPageIdAndTypeFrom = (0, _editorSyncedBlockProvider.getPageIdAndTypeFromAri)(documentAri),
|
|
29
|
+
_contentId = _getPageIdAndTypeFrom.id;
|
|
30
|
+
if (_contentId) {
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedBlockPermissionDenied.SyncedBlockPermissionDenied, {
|
|
32
|
+
contentId: _contentId
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
var _getPageIdAndTypeFrom2 = (0, _editorSyncedBlockProvider.getPageIdAndTypeFromAri)(resourceId),
|
|
37
|
+
contentId = _getPageIdAndTypeFrom2.id;
|
|
28
38
|
if (contentId) {
|
|
29
39
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockPermissionDenied.SyncedBlockPermissionDenied, {
|
|
30
40
|
contentId: contentId
|
|
@@ -40,7 +50,7 @@ var SyncedBlockErrorComponent = exports.SyncedBlockErrorComponent = function Syn
|
|
|
40
50
|
default:
|
|
41
51
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockGenericError.SyncedBlockGenericError, null);
|
|
42
52
|
}
|
|
43
|
-
}, [error, isLoading, onRetry, resourceId]);
|
|
53
|
+
}, [documentAri, error, isLoading, onRetry, resourceId]);
|
|
44
54
|
return (
|
|
45
55
|
/*#__PURE__*/
|
|
46
56
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -25,12 +25,13 @@ var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer
|
|
|
25
25
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadingState.SyncedBlockLoadingState, null);
|
|
26
26
|
}
|
|
27
27
|
if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data)) {
|
|
28
|
-
var _syncBlockInstance$er;
|
|
28
|
+
var _syncBlockInstance$er, _syncBlockInstance$da;
|
|
29
29
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
|
|
30
30
|
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : _editorSyncedBlockProvider.SyncBlockError.Errored,
|
|
31
31
|
resourceId: resourceId,
|
|
32
32
|
onRetry: reloadData,
|
|
33
|
-
isLoading: isLoading
|
|
33
|
+
isLoading: isLoading,
|
|
34
|
+
documentAri: syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceDocumentAri
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
var syncBlockDoc = {
|
|
@@ -23,12 +23,13 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
23
23
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadingState.SyncedBlockLoadingState, null);
|
|
24
24
|
}
|
|
25
25
|
if (syncBlockInstance.error || !syncBlockInstance.data) {
|
|
26
|
-
var _syncBlockInstance$er;
|
|
26
|
+
var _syncBlockInstance$er, _syncBlockInstance$da;
|
|
27
27
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
|
|
28
28
|
error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : _editorSyncedBlockProvider.SyncBlockError.Errored,
|
|
29
29
|
resourceId: syncBlockInstance.resourceId,
|
|
30
30
|
onRetry: reloadData,
|
|
31
|
-
isLoading: isLoading
|
|
31
|
+
isLoading: isLoading,
|
|
32
|
+
documentAri: (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceDocumentAri
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
35
|
var syncBlockDoc = {
|
|
@@ -8,7 +8,8 @@ export const SyncedBlockErrorComponent = ({
|
|
|
8
8
|
error,
|
|
9
9
|
isLoading,
|
|
10
10
|
onRetry,
|
|
11
|
-
resourceId
|
|
11
|
+
resourceId,
|
|
12
|
+
documentAri
|
|
12
13
|
}) => {
|
|
13
14
|
const getErrorContent = useMemo(() => {
|
|
14
15
|
switch (error) {
|
|
@@ -16,6 +17,16 @@ export const SyncedBlockErrorComponent = ({
|
|
|
16
17
|
if (!resourceId) {
|
|
17
18
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
18
19
|
}
|
|
20
|
+
if (documentAri) {
|
|
21
|
+
const {
|
|
22
|
+
id: contentId
|
|
23
|
+
} = getPageIdAndTypeFromAri(documentAri);
|
|
24
|
+
if (contentId) {
|
|
25
|
+
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
26
|
+
contentId: contentId
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
19
30
|
const {
|
|
20
31
|
id: contentId
|
|
21
32
|
} = getPageIdAndTypeFromAri(resourceId);
|
|
@@ -34,7 +45,7 @@ export const SyncedBlockErrorComponent = ({
|
|
|
34
45
|
default:
|
|
35
46
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
36
47
|
}
|
|
37
|
-
}, [error, isLoading, onRetry, resourceId]);
|
|
48
|
+
}, [documentAri, error, isLoading, onRetry, resourceId]);
|
|
38
49
|
return (
|
|
39
50
|
/*#__PURE__*/
|
|
40
51
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -22,12 +22,13 @@ export const SyncedBlockNodeComponentRenderer = ({
|
|
|
22
22
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
23
23
|
}
|
|
24
24
|
if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data)) {
|
|
25
|
-
var _syncBlockInstance$er;
|
|
25
|
+
var _syncBlockInstance$er, _syncBlockInstance$da;
|
|
26
26
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
27
27
|
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
|
|
28
28
|
resourceId: resourceId,
|
|
29
29
|
onRetry: reloadData,
|
|
30
|
-
isLoading: isLoading
|
|
30
|
+
isLoading: isLoading,
|
|
31
|
+
documentAri: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceDocumentAri
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
const syncBlockDoc = {
|
|
@@ -17,12 +17,13 @@ const SyncedBlockRendererComponent = ({
|
|
|
17
17
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
18
18
|
}
|
|
19
19
|
if (syncBlockInstance.error || !syncBlockInstance.data) {
|
|
20
|
-
var _syncBlockInstance$er;
|
|
20
|
+
var _syncBlockInstance$er, _syncBlockInstance$da;
|
|
21
21
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
22
22
|
error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
|
|
23
23
|
resourceId: syncBlockInstance.resourceId,
|
|
24
24
|
onRetry: reloadData,
|
|
25
|
-
isLoading: isLoading
|
|
25
|
+
isLoading: isLoading,
|
|
26
|
+
documentAri: (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceDocumentAri
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
const syncBlockDoc = {
|
|
@@ -8,15 +8,25 @@ export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref)
|
|
|
8
8
|
var error = _ref.error,
|
|
9
9
|
isLoading = _ref.isLoading,
|
|
10
10
|
onRetry = _ref.onRetry,
|
|
11
|
-
resourceId = _ref.resourceId
|
|
11
|
+
resourceId = _ref.resourceId,
|
|
12
|
+
documentAri = _ref.documentAri;
|
|
12
13
|
var getErrorContent = useMemo(function () {
|
|
13
14
|
switch (error) {
|
|
14
15
|
case SyncBlockError.Forbidden:
|
|
15
16
|
if (!resourceId) {
|
|
16
17
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
if (documentAri) {
|
|
20
|
+
var _getPageIdAndTypeFrom = getPageIdAndTypeFromAri(documentAri),
|
|
21
|
+
_contentId = _getPageIdAndTypeFrom.id;
|
|
22
|
+
if (_contentId) {
|
|
23
|
+
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
24
|
+
contentId: _contentId
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
var _getPageIdAndTypeFrom2 = getPageIdAndTypeFromAri(resourceId),
|
|
29
|
+
contentId = _getPageIdAndTypeFrom2.id;
|
|
20
30
|
if (contentId) {
|
|
21
31
|
return /*#__PURE__*/React.createElement(SyncedBlockPermissionDenied, {
|
|
22
32
|
contentId: contentId
|
|
@@ -32,7 +42,7 @@ export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref)
|
|
|
32
42
|
default:
|
|
33
43
|
return /*#__PURE__*/React.createElement(SyncedBlockGenericError, null);
|
|
34
44
|
}
|
|
35
|
-
}, [error, isLoading, onRetry, resourceId]);
|
|
45
|
+
}, [documentAri, error, isLoading, onRetry, resourceId]);
|
|
36
46
|
return (
|
|
37
47
|
/*#__PURE__*/
|
|
38
48
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -18,12 +18,13 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
|
|
|
18
18
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
19
19
|
}
|
|
20
20
|
if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data)) {
|
|
21
|
-
var _syncBlockInstance$er;
|
|
21
|
+
var _syncBlockInstance$er, _syncBlockInstance$da;
|
|
22
22
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
23
23
|
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
|
|
24
24
|
resourceId: resourceId,
|
|
25
25
|
onRetry: reloadData,
|
|
26
|
-
isLoading: isLoading
|
|
26
|
+
isLoading: isLoading,
|
|
27
|
+
documentAri: syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceDocumentAri
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
30
|
var syncBlockDoc = {
|
|
@@ -15,12 +15,13 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
15
15
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
16
16
|
}
|
|
17
17
|
if (syncBlockInstance.error || !syncBlockInstance.data) {
|
|
18
|
-
var _syncBlockInstance$er;
|
|
18
|
+
var _syncBlockInstance$er, _syncBlockInstance$da;
|
|
19
19
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
20
20
|
error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
|
|
21
21
|
resourceId: syncBlockInstance.resourceId,
|
|
22
22
|
onRetry: reloadData,
|
|
23
|
-
isLoading: isLoading
|
|
23
|
+
isLoading: isLoading,
|
|
24
|
+
documentAri: (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.sourceDocumentAri
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
var syncBlockDoc = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
|
|
3
|
-
export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, resourceId, }: {
|
|
3
|
+
export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, resourceId, documentAri, }: {
|
|
4
|
+
documentAri?: string;
|
|
4
5
|
error: SyncBlockError;
|
|
5
6
|
isLoading?: boolean;
|
|
6
7
|
onRetry?: () => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
|
|
3
|
-
export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, resourceId, }: {
|
|
3
|
+
export declare const SyncedBlockErrorComponent: ({ error, isLoading, onRetry, resourceId, documentAri, }: {
|
|
4
|
+
documentAri?: string;
|
|
4
5
|
error: SyncBlockError;
|
|
5
6
|
isLoading?: boolean;
|
|
6
7
|
onRetry?: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-synced-block-renderer",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "SyncedBlockRenderer for @atlaskit/editor-plugin-synced-block",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,20 +32,20 @@
|
|
|
32
32
|
"@atlaskit/css": "^0.15.0",
|
|
33
33
|
"@atlaskit/editor-plugin-synced-block": "^4.2.0",
|
|
34
34
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
35
|
-
"@atlaskit/editor-synced-block-provider": "^2.
|
|
35
|
+
"@atlaskit/editor-synced-block-provider": "^2.10.0",
|
|
36
36
|
"@atlaskit/heading": "^5.2.0",
|
|
37
37
|
"@atlaskit/icon": "^29.0.0",
|
|
38
38
|
"@atlaskit/image": "^3.0.0",
|
|
39
39
|
"@atlaskit/primitives": "^16.1.0",
|
|
40
|
-
"@atlaskit/renderer": "^124.
|
|
40
|
+
"@atlaskit/renderer": "^124.15.0",
|
|
41
41
|
"@atlaskit/spinner": "^19.0.0",
|
|
42
42
|
"@atlaskit/tokens": "^8.0.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
|
-
"react-relay": "npm:atl-react-relay@0.0.0-main-
|
|
45
|
-
"relay-runtime": "npm:atl-relay-compiler@0.0.0-main-
|
|
44
|
+
"react-relay": "npm:atl-react-relay@0.0.0-main-39e79f66",
|
|
45
|
+
"relay-runtime": "npm:atl-relay-compiler@0.0.0-main-39e79f66"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@atlaskit/editor-common": "^110.
|
|
48
|
+
"@atlaskit/editor-common": "^110.32.0",
|
|
49
49
|
"react": "^18.2.0",
|
|
50
50
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
51
51
|
},
|