@atlaskit/editor-synced-block-renderer 5.6.6 → 5.7.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 +15 -0
- package/afm-cc/tsconfig.json +0 -3
- package/afm-jira/tsconfig.json +0 -3
- package/afm-products/tsconfig.json +0 -3
- package/dist/cjs/ui/AKRendererWrapper.js +2 -0
- package/dist/cjs/ui/SyncedBlockErrorStateCard.js +2 -3
- package/dist/cjs/ui/SyncedBlockLoadError.js +2 -3
- package/dist/cjs/ui/SyncedBlockNodeComponentRenderer.js +5 -6
- package/dist/cjs/ui/SyncedBlockNotFoundError.js +15 -45
- package/dist/cjs/ui/SyncedBlockRenderer.js +5 -6
- package/dist/cjs/useSyncedBlockNodeComponent.js +3 -9
- package/dist/es2019/ui/AKRendererWrapper.js +2 -0
- package/dist/es2019/ui/SyncedBlockErrorStateCard.js +2 -3
- package/dist/es2019/ui/SyncedBlockLoadError.js +2 -3
- package/dist/es2019/ui/SyncedBlockNodeComponentRenderer.js +5 -6
- package/dist/es2019/ui/SyncedBlockNotFoundError.js +7 -35
- package/dist/es2019/ui/SyncedBlockRenderer.js +5 -6
- package/dist/es2019/useSyncedBlockNodeComponent.js +3 -9
- package/dist/esm/ui/AKRendererWrapper.js +2 -0
- package/dist/esm/ui/SyncedBlockErrorStateCard.js +2 -3
- package/dist/esm/ui/SyncedBlockLoadError.js +2 -3
- package/dist/esm/ui/SyncedBlockNodeComponentRenderer.js +5 -6
- package/dist/esm/ui/SyncedBlockNotFoundError.js +15 -45
- package/dist/esm/ui/SyncedBlockRenderer.js +5 -6
- package/dist/esm/useSyncedBlockNodeComponent.js +3 -9
- package/dist/types/types.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +1 -1
- package/package.json +2 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-synced-block-renderer
|
|
2
2
|
|
|
3
|
+
## 5.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`7daf10b49fce7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7daf10b49fce7) -
|
|
8
|
+
Pass in event handlers to the sync block options
|
|
9
|
+
|
|
10
|
+
## 5.6.7
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`7ba3979b92b42`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7ba3979b92b42) -
|
|
15
|
+
Remove platform_synced_block_dogfooding feature gate
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 5.6.6
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -89,6 +89,7 @@ var AKRendererWrapper = exports.AKRendererWrapper = /*#__PURE__*/(0, _react.memo
|
|
|
89
89
|
allowUgcScrubber = _ref4.allowUgcScrubber,
|
|
90
90
|
allowWrapCodeBlock = _ref4.allowWrapCodeBlock,
|
|
91
91
|
emojiResourceConfig = _ref4.emojiResourceConfig,
|
|
92
|
+
eventHandlers = _ref4.eventHandlers,
|
|
92
93
|
media = _ref4.media,
|
|
93
94
|
smartLinks = _ref4.smartLinks,
|
|
94
95
|
stickyHeaders = _ref4.stickyHeaders;
|
|
@@ -133,6 +134,7 @@ var AKRendererWrapper = exports.AKRendererWrapper = /*#__PURE__*/(0, _react.memo
|
|
|
133
134
|
allowUgcScrubber: allowUgcScrubber,
|
|
134
135
|
allowWrapCodeBlock: allowWrapCodeBlock,
|
|
135
136
|
emojiResourceConfig: emojiResourceConfig,
|
|
137
|
+
eventHandlers: (0, _platformFeatureFlags.fg)('platform_synced_block_patch_1') ? eventHandlers : undefined,
|
|
136
138
|
media: media,
|
|
137
139
|
smartLinks: smartLinks,
|
|
138
140
|
stickyHeaders: stickyHeaders
|
|
@@ -10,7 +10,6 @@ require("./SyncedBlockErrorStateCard.compiled.css");
|
|
|
10
10
|
var _runtime = require("@compiled/react/runtime");
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
var _warningOutline = _interopRequireDefault(require("@atlaskit/icon-lab/core/warning-outline"));
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
15
14
|
var styles = {
|
|
16
15
|
wrapper: "_zulppxbi _1rjc12x7 _bozgpxbi _1e0c1txw _1bahv2br _4cvr1h6o",
|
|
@@ -20,7 +19,7 @@ var SyncedBlockErrorStateCard = exports.SyncedBlockErrorStateCard = function Syn
|
|
|
20
19
|
var children = _ref.children,
|
|
21
20
|
description = _ref.description,
|
|
22
21
|
icon = _ref.icon;
|
|
23
|
-
var Icon =
|
|
22
|
+
var Icon = icon !== null && icon !== void 0 ? icon : _warningOutline.default;
|
|
24
23
|
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
25
24
|
xcss: styles.container
|
|
26
25
|
}, /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
@@ -30,5 +29,5 @@ var SyncedBlockErrorStateCard = exports.SyncedBlockErrorStateCard = function Syn
|
|
|
30
29
|
label: ""
|
|
31
30
|
}), /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
32
31
|
color: "color.text.subtle"
|
|
33
|
-
}, description)
|
|
32
|
+
}, description)), children);
|
|
34
33
|
};
|
|
@@ -12,7 +12,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
12
12
|
var _reactIntlNext = require("react-intl-next");
|
|
13
13
|
var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
14
14
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
17
16
|
var _SyncedBlockErrorStateCard = require("./SyncedBlockErrorStateCard");
|
|
18
17
|
var styles = {
|
|
@@ -36,7 +35,7 @@ var SyncedBlockLoadError = exports.SyncedBlockLoadError = function SyncedBlockLo
|
|
|
36
35
|
}, formatMessage(_messages.syncBlockMessages.retryButton));
|
|
37
36
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorStateCard.SyncedBlockErrorStateCard, {
|
|
38
37
|
description: formatMessage(_messages.syncBlockMessages.generalErrorDescription)
|
|
39
|
-
}, onRetry &&
|
|
38
|
+
}, onRetry && /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
40
39
|
xcss: styles.buttonContainer
|
|
41
|
-
}, button)
|
|
40
|
+
}, button));
|
|
42
41
|
};
|
|
@@ -12,7 +12,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
13
13
|
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
14
14
|
var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
var _AKRendererWrapper = require("./AKRendererWrapper");
|
|
17
16
|
var _SyncedBlockErrorComponent = require("./SyncedBlockErrorComponent");
|
|
18
17
|
var _SyncedBlockLoadingState = require("./SyncedBlockLoadingState");
|
|
@@ -38,7 +37,7 @@ var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer
|
|
|
38
37
|
var _rendererOptions$medi, _ssrProviders$media;
|
|
39
38
|
if (!(0, _coreUtils.isSSR)() || rendererOptions !== null && rendererOptions !== void 0 && (_rendererOptions$medi = rendererOptions.media) !== null && _rendererOptions$medi !== void 0 && _rendererOptions$medi.ssr ||
|
|
40
39
|
// already has ssr config
|
|
41
|
-
!(ssrProviders !== null && ssrProviders !== void 0 && (_ssrProviders$media = ssrProviders.media) !== null && _ssrProviders$media !== void 0 && _ssrProviders$media.viewMediaClientConfig)
|
|
40
|
+
!(ssrProviders !== null && ssrProviders !== void 0 && (_ssrProviders$media = ssrProviders.media) !== null && _ssrProviders$media !== void 0 && _ssrProviders$media.viewMediaClientConfig)) {
|
|
42
41
|
return rendererOptions;
|
|
43
42
|
}
|
|
44
43
|
var mediaSSR = {
|
|
@@ -57,13 +56,13 @@ var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer
|
|
|
57
56
|
|
|
58
57
|
// In SSR, if server returned error, we should render loading state instead of error state
|
|
59
58
|
// since FE will do another fetch and render the error state or proper data then
|
|
60
|
-
if ((0, _coreUtils.isSSR)() && syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error
|
|
59
|
+
if ((0, _coreUtils.isSSR)() && syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error) {
|
|
61
60
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadingState.SyncedBlockLoadingState, null);
|
|
62
61
|
}
|
|
63
|
-
if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data) || syncBlockInstance.data.status === 'deleted'
|
|
62
|
+
if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data) || syncBlockInstance.data.status === 'deleted') {
|
|
64
63
|
var _syncBlockInstance$er, _syncBlockInstance$da;
|
|
65
64
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
|
|
66
|
-
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted'
|
|
65
|
+
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
|
|
67
66
|
type: _editorSyncedBlockProvider.SyncBlockError.NotFound
|
|
68
67
|
} : {
|
|
69
68
|
type: _editorSyncedBlockProvider.SyncBlockError.Errored
|
|
@@ -74,7 +73,7 @@ var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer
|
|
|
74
73
|
fireAnalyticsEvent: fireAnalyticsEvent
|
|
75
74
|
});
|
|
76
75
|
}
|
|
77
|
-
if ((syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished'
|
|
76
|
+
if ((syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished') {
|
|
78
77
|
var _syncBlockInstance$da3;
|
|
79
78
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
|
|
80
79
|
error: {
|
|
@@ -20,8 +20,6 @@ var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
|
20
20
|
var _cross = _interopRequireDefault(require("@atlaskit/icon/core/cross"));
|
|
21
21
|
var _eyeOpenStrikethrough = _interopRequireDefault(require("@atlaskit/icon/core/eye-open-strikethrough"));
|
|
22
22
|
var _linkBroken = _interopRequireDefault(require("@atlaskit/icon/core/link-broken"));
|
|
23
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
24
|
-
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
25
23
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
26
24
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
27
25
|
var _SyncedBlockErrorStateCard = require("./SyncedBlockErrorStateCard");
|
|
@@ -49,26 +47,7 @@ var errorMap = {
|
|
|
49
47
|
icon: _linkBroken.default
|
|
50
48
|
}
|
|
51
49
|
};
|
|
52
|
-
var
|
|
53
|
-
return (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding');
|
|
54
|
-
}, function () {
|
|
55
|
-
var _useSyncBlockActions;
|
|
56
|
-
var _ref = (_useSyncBlockActions = (0, _syncBlock.useSyncBlockActions)()) !== null && _useSyncBlockActions !== void 0 ? _useSyncBlockActions : {},
|
|
57
|
-
deleteSyncBlock = _ref.deleteSyncBlock,
|
|
58
|
-
fetchSourceInfo = _ref.fetchSourceInfo;
|
|
59
|
-
return {
|
|
60
|
-
deleteSyncBlock: deleteSyncBlock,
|
|
61
|
-
fetchSourceInfo: fetchSourceInfo
|
|
62
|
-
};
|
|
63
|
-
}, function () {
|
|
64
|
-
return {
|
|
65
|
-
deleteSyncBlock: undefined,
|
|
66
|
-
fetchSourceInfo: undefined
|
|
67
|
-
};
|
|
68
|
-
});
|
|
69
|
-
var useErrorInfo = (0, _platformFeatureFlagsReact.conditionalHooksFactory)(function () {
|
|
70
|
-
return (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding');
|
|
71
|
-
}, function (reason, url, title) {
|
|
50
|
+
var useErrorInfo = function useErrorInfo(reason, url, title) {
|
|
72
51
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
73
52
|
formatMessage = _useIntl.formatMessage;
|
|
74
53
|
if (reason === 'source-document-deleted') {
|
|
@@ -105,29 +84,23 @@ var useErrorInfo = (0, _platformFeatureFlagsReact.conditionalHooksFactory)(funct
|
|
|
105
84
|
}),
|
|
106
85
|
icon: icon
|
|
107
86
|
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
var _ref2$reason = _ref2.reason,
|
|
118
|
-
reason = _ref2$reason === void 0 ? 'source-block-deleted' : _ref2$reason,
|
|
119
|
-
sourceAri = _ref2.sourceAri;
|
|
120
|
-
var _useSyncBlockInfo = useSyncBlockInfo(),
|
|
121
|
-
deleteSyncBlock = _useSyncBlockInfo.deleteSyncBlock,
|
|
122
|
-
fetchSourceInfo = _useSyncBlockInfo.fetchSourceInfo;
|
|
87
|
+
};
|
|
88
|
+
var SyncedBlockNotFoundError = exports.SyncedBlockNotFoundError = function SyncedBlockNotFoundError(_ref) {
|
|
89
|
+
var _useSyncBlockActions;
|
|
90
|
+
var _ref$reason = _ref.reason,
|
|
91
|
+
reason = _ref$reason === void 0 ? 'source-block-deleted' : _ref$reason,
|
|
92
|
+
sourceAri = _ref.sourceAri;
|
|
93
|
+
var _ref2 = (_useSyncBlockActions = (0, _syncBlock.useSyncBlockActions)()) !== null && _useSyncBlockActions !== void 0 ? _useSyncBlockActions : {},
|
|
94
|
+
deleteSyncBlock = _ref2.deleteSyncBlock,
|
|
95
|
+
fetchSourceInfo = _ref2.fetchSourceInfo;
|
|
123
96
|
var _useState = (0, _react.useState)(undefined),
|
|
124
97
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
125
98
|
sourceInfo = _useState2[0],
|
|
126
99
|
setSourceInfo = _useState2[1];
|
|
127
|
-
var
|
|
128
|
-
formatMessage =
|
|
100
|
+
var _useIntl2 = (0, _reactIntlNext.useIntl)(),
|
|
101
|
+
formatMessage = _useIntl2.formatMessage;
|
|
129
102
|
(0, _react.useEffect)(function () {
|
|
130
|
-
if (!
|
|
103
|
+
if (!sourceAri ||
|
|
131
104
|
// Only fetch source info for these 2 cases
|
|
132
105
|
!['source-block-deleted', 'source-block-unsynced'].includes(reason)) {
|
|
133
106
|
setSourceInfo({});
|
|
@@ -162,7 +135,7 @@ var SyncedBlockNotFoundError = exports.SyncedBlockNotFoundError = function Synce
|
|
|
162
135
|
var _useErrorInfo = useErrorInfo(reason, sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.url, sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.title),
|
|
163
136
|
description = _useErrorInfo.description,
|
|
164
137
|
icon = _useErrorInfo.icon;
|
|
165
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null,
|
|
138
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, sourceInfo === undefined ? /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
166
139
|
xcss: styles.spinner
|
|
167
140
|
}, /*#__PURE__*/_react.default.createElement(_spinner.default, null)) : /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorStateCard.SyncedBlockErrorStateCard, {
|
|
168
141
|
description: description,
|
|
@@ -174,8 +147,5 @@ var SyncedBlockNotFoundError = exports.SyncedBlockNotFoundError = function Synce
|
|
|
174
147
|
icon: _cross.default,
|
|
175
148
|
label: formatMessage(_messages.default.delete),
|
|
176
149
|
onClick: deleteSyncBlock
|
|
177
|
-
}))))
|
|
178
|
-
description: description,
|
|
179
|
-
icon: icon
|
|
180
|
-
}));
|
|
150
|
+
}))));
|
|
181
151
|
};
|
|
@@ -11,7 +11,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
12
12
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
13
|
var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
|
|
14
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
14
|
var _AKRendererWrapper = require("./AKRendererWrapper");
|
|
16
15
|
var _SyncedBlockErrorComponent = require("./SyncedBlockErrorComponent");
|
|
17
16
|
var _SyncedBlockLoadingState = require("./SyncedBlockLoadingState");
|
|
@@ -32,7 +31,7 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
32
31
|
var _syncBlockRendererOpt, _ssrProviders$media;
|
|
33
32
|
if (!(0, _coreUtils.isSSR)() || syncBlockRendererOptions !== null && syncBlockRendererOptions !== void 0 && (_syncBlockRendererOpt = syncBlockRendererOptions.media) !== null && _syncBlockRendererOpt !== void 0 && _syncBlockRendererOpt.ssr ||
|
|
34
33
|
// already has ssr config
|
|
35
|
-
!(ssrProviders !== null && ssrProviders !== void 0 && (_ssrProviders$media = ssrProviders.media) !== null && _ssrProviders$media !== void 0 && _ssrProviders$media.viewMediaClientConfig)
|
|
34
|
+
!(ssrProviders !== null && ssrProviders !== void 0 && (_ssrProviders$media = ssrProviders.media) !== null && _ssrProviders$media !== void 0 && _ssrProviders$media.viewMediaClientConfig)) {
|
|
36
35
|
return syncBlockRendererOptions;
|
|
37
36
|
}
|
|
38
37
|
var mediaSSR = {
|
|
@@ -68,13 +67,13 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
68
67
|
|
|
69
68
|
// In SSR, if server returned error, we should render loading state instead of error state
|
|
70
69
|
// since FE will do another fetch and render the error state or proper data then
|
|
71
|
-
if ((0, _coreUtils.isSSR)() && syncBlockInstance.error
|
|
70
|
+
if ((0, _coreUtils.isSSR)() && syncBlockInstance.error) {
|
|
72
71
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadingState.SyncedBlockLoadingState, null);
|
|
73
72
|
}
|
|
74
|
-
if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted'
|
|
73
|
+
if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted') {
|
|
75
74
|
var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics;
|
|
76
75
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
|
|
77
|
-
error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted'
|
|
76
|
+
error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
|
|
78
77
|
type: _editorSyncedBlockProvider.SyncBlockError.NotFound
|
|
79
78
|
} : {
|
|
80
79
|
type: _editorSyncedBlockProvider.SyncBlockError.Errored
|
|
@@ -87,7 +86,7 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
// Check for unpublished status
|
|
90
|
-
if (((_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished'
|
|
89
|
+
if (((_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished') {
|
|
91
90
|
var _syncBlockInstance$da3, _api$analytics2;
|
|
92
91
|
return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
|
|
93
92
|
error: {
|
|
@@ -10,7 +10,6 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
10
10
|
var _errorBoundary = require("@atlaskit/editor-common/error-boundary");
|
|
11
11
|
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
12
12
|
var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _SyncedBlockNodeComponentRenderer = require("./ui/SyncedBlockNodeComponentRenderer");
|
|
15
14
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
16
15
|
var getSyncBlockNodesFromDoc = exports.getSyncBlockNodesFromDoc = function getSyncBlockNodesFromDoc(doc) {
|
|
@@ -33,7 +32,7 @@ var useMemoizedSyncedBlockNodeComponent = exports.useMemoizedSyncedBlockNodeComp
|
|
|
33
32
|
|
|
34
33
|
// Initialize SSR data if available
|
|
35
34
|
(0, _react.useEffect)(function () {
|
|
36
|
-
if (getSSRData
|
|
35
|
+
if (getSSRData) {
|
|
37
36
|
var ssrData = getSSRData();
|
|
38
37
|
if (ssrData && syncBlockProvider.setSSRData) {
|
|
39
38
|
syncBlockProvider.setSSRData(ssrData);
|
|
@@ -46,7 +45,7 @@ var useMemoizedSyncedBlockNodeComponent = exports.useMemoizedSyncedBlockNodeComp
|
|
|
46
45
|
syncBlockStoreManager.referenceManager.fetchSyncBlocksData(syncBlockNodes);
|
|
47
46
|
}, [syncBlockNodes, syncBlockStoreManager.referenceManager]);
|
|
48
47
|
return (0, _react.useCallback)(function (props) {
|
|
49
|
-
return
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement(_errorBoundary.ErrorBoundary, {
|
|
50
49
|
component: _analytics.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
51
50
|
dispatchAnalyticsEvent: fireAnalyticsEvent,
|
|
52
51
|
fallbackComponent: null
|
|
@@ -59,11 +58,6 @@ var useMemoizedSyncedBlockNodeComponent = exports.useMemoizedSyncedBlockNodeComp
|
|
|
59
58
|
nodeProps: props,
|
|
60
59
|
syncBlockStoreManager: syncBlockStoreManager,
|
|
61
60
|
rendererOptions: syncBlockRendererOptions
|
|
62
|
-
})))
|
|
63
|
-
key: props.localId,
|
|
64
|
-
nodeProps: props,
|
|
65
|
-
syncBlockStoreManager: syncBlockStoreManager,
|
|
66
|
-
rendererOptions: syncBlockRendererOptions
|
|
67
|
-
});
|
|
61
|
+
})));
|
|
68
62
|
}, [syncBlockStoreManager, syncBlockRendererOptions, fireAnalyticsEvent]);
|
|
69
63
|
};
|
|
@@ -80,6 +80,7 @@ export const AKRendererWrapper = /*#__PURE__*/memo(({
|
|
|
80
80
|
allowUgcScrubber,
|
|
81
81
|
allowWrapCodeBlock,
|
|
82
82
|
emojiResourceConfig,
|
|
83
|
+
eventHandlers,
|
|
83
84
|
media,
|
|
84
85
|
smartLinks,
|
|
85
86
|
stickyHeaders
|
|
@@ -125,6 +126,7 @@ export const AKRendererWrapper = /*#__PURE__*/memo(({
|
|
|
125
126
|
allowUgcScrubber: allowUgcScrubber,
|
|
126
127
|
allowWrapCodeBlock: allowWrapCodeBlock,
|
|
127
128
|
emojiResourceConfig: emojiResourceConfig,
|
|
129
|
+
eventHandlers: fg('platform_synced_block_patch_1') ? eventHandlers : undefined,
|
|
128
130
|
media: media,
|
|
129
131
|
smartLinks: smartLinks,
|
|
130
132
|
stickyHeaders: stickyHeaders
|
|
@@ -3,7 +3,6 @@ import "./SyncedBlockErrorStateCard.compiled.css";
|
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import WarningOutlineIcon from '@atlaskit/icon-lab/core/warning-outline';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
8
7
|
const styles = {
|
|
9
8
|
wrapper: "_zulppxbi _1rjc12x7 _bozgpxbi _1e0c1txw _1bahv2br _4cvr1h6o",
|
|
@@ -14,7 +13,7 @@ export const SyncedBlockErrorStateCard = ({
|
|
|
14
13
|
description,
|
|
15
14
|
icon
|
|
16
15
|
}) => {
|
|
17
|
-
const Icon =
|
|
16
|
+
const Icon = icon !== null && icon !== void 0 ? icon : WarningOutlineIcon;
|
|
18
17
|
return /*#__PURE__*/React.createElement(Box, {
|
|
19
18
|
xcss: styles.container
|
|
20
19
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
@@ -24,5 +23,5 @@ export const SyncedBlockErrorStateCard = ({
|
|
|
24
23
|
label: ""
|
|
25
24
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
26
25
|
color: "color.text.subtle"
|
|
27
|
-
}, description)
|
|
26
|
+
}, description)), children);
|
|
28
27
|
};
|
|
@@ -5,7 +5,6 @@ import React from 'react';
|
|
|
5
5
|
import { useIntl } from 'react-intl-next';
|
|
6
6
|
import Button from '@atlaskit/button/new';
|
|
7
7
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
10
9
|
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
11
10
|
const styles = {
|
|
@@ -31,7 +30,7 @@ export const SyncedBlockLoadError = ({
|
|
|
31
30
|
}, formatMessage(messages.retryButton));
|
|
32
31
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
33
32
|
description: formatMessage(messages.generalErrorDescription)
|
|
34
|
-
}, onRetry &&
|
|
33
|
+
}, onRetry && /*#__PURE__*/React.createElement(Box, {
|
|
35
34
|
xcss: styles.buttonContainer
|
|
36
|
-
}, button)
|
|
35
|
+
}, button));
|
|
37
36
|
};
|
|
@@ -2,7 +2,6 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
3
3
|
import { SyncBlockSharedCssClassName, SyncBlockRendererDataAttributeName } from '@atlaskit/editor-common/sync-block';
|
|
4
4
|
import { SyncBlockError, useFetchSyncBlockData } from '@atlaskit/editor-synced-block-provider';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { AKRendererWrapper } from './AKRendererWrapper';
|
|
7
6
|
import { SyncedBlockErrorComponent } from './SyncedBlockErrorComponent';
|
|
8
7
|
import { SyncedBlockLoadingState } from './SyncedBlockLoadingState';
|
|
@@ -29,7 +28,7 @@ export const SyncedBlockNodeComponentRenderer = ({
|
|
|
29
28
|
var _rendererOptions$medi, _ssrProviders$media;
|
|
30
29
|
if (!isSSR() || rendererOptions !== null && rendererOptions !== void 0 && (_rendererOptions$medi = rendererOptions.media) !== null && _rendererOptions$medi !== void 0 && _rendererOptions$medi.ssr ||
|
|
31
30
|
// already has ssr config
|
|
32
|
-
!(ssrProviders !== null && ssrProviders !== void 0 && (_ssrProviders$media = ssrProviders.media) !== null && _ssrProviders$media !== void 0 && _ssrProviders$media.viewMediaClientConfig)
|
|
31
|
+
!(ssrProviders !== null && ssrProviders !== void 0 && (_ssrProviders$media = ssrProviders.media) !== null && _ssrProviders$media !== void 0 && _ssrProviders$media.viewMediaClientConfig)) {
|
|
33
32
|
return rendererOptions;
|
|
34
33
|
}
|
|
35
34
|
const mediaSSR = {
|
|
@@ -50,13 +49,13 @@ export const SyncedBlockNodeComponentRenderer = ({
|
|
|
50
49
|
|
|
51
50
|
// In SSR, if server returned error, we should render loading state instead of error state
|
|
52
51
|
// since FE will do another fetch and render the error state or proper data then
|
|
53
|
-
if (isSSR() && syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error
|
|
52
|
+
if (isSSR() && syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error) {
|
|
54
53
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
55
54
|
}
|
|
56
|
-
if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data) || syncBlockInstance.data.status === 'deleted'
|
|
55
|
+
if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data) || syncBlockInstance.data.status === 'deleted') {
|
|
57
56
|
var _syncBlockInstance$er, _syncBlockInstance$da;
|
|
58
57
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
59
|
-
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted'
|
|
58
|
+
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
|
|
60
59
|
type: SyncBlockError.NotFound
|
|
61
60
|
} : {
|
|
62
61
|
type: SyncBlockError.Errored
|
|
@@ -67,7 +66,7 @@ export const SyncedBlockNodeComponentRenderer = ({
|
|
|
67
66
|
fireAnalyticsEvent: fireAnalyticsEvent
|
|
68
67
|
});
|
|
69
68
|
}
|
|
70
|
-
if ((syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished'
|
|
69
|
+
if ((syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished') {
|
|
71
70
|
var _syncBlockInstance$da3;
|
|
72
71
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
73
72
|
error: {
|
|
@@ -9,8 +9,6 @@ import { useSyncBlockActions } from '@atlaskit/editor-common/sync-block';
|
|
|
9
9
|
import CrossIcon from '@atlaskit/icon/core/cross';
|
|
10
10
|
import EyeOpenStrikethroughIcon from '@atlaskit/icon/core/eye-open-strikethrough';
|
|
11
11
|
import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
-
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
14
12
|
import { Anchor, Box } from '@atlaskit/primitives/compiled';
|
|
15
13
|
import Spinner from '@atlaskit/spinner';
|
|
16
14
|
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
@@ -37,23 +35,7 @@ const errorMap = {
|
|
|
37
35
|
icon: LinkBrokenIcon
|
|
38
36
|
}
|
|
39
37
|
};
|
|
40
|
-
const
|
|
41
|
-
var _useSyncBlockActions;
|
|
42
|
-
const {
|
|
43
|
-
deleteSyncBlock,
|
|
44
|
-
fetchSourceInfo
|
|
45
|
-
} = (_useSyncBlockActions = useSyncBlockActions()) !== null && _useSyncBlockActions !== void 0 ? _useSyncBlockActions : {};
|
|
46
|
-
return {
|
|
47
|
-
deleteSyncBlock,
|
|
48
|
-
fetchSourceInfo
|
|
49
|
-
};
|
|
50
|
-
}, () => {
|
|
51
|
-
return {
|
|
52
|
-
deleteSyncBlock: undefined,
|
|
53
|
-
fetchSourceInfo: undefined
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
const useErrorInfo = conditionalHooksFactory(() => fg('platform_synced_block_dogfooding'), (reason, url, title) => {
|
|
38
|
+
const useErrorInfo = (reason, url, title) => {
|
|
57
39
|
const {
|
|
58
40
|
formatMessage
|
|
59
41
|
} = useIntl();
|
|
@@ -92,29 +74,22 @@ const useErrorInfo = conditionalHooksFactory(() => fg('platform_synced_block_dog
|
|
|
92
74
|
}),
|
|
93
75
|
icon
|
|
94
76
|
};
|
|
95
|
-
}
|
|
96
|
-
const {
|
|
97
|
-
formatMessage
|
|
98
|
-
} = useIntl();
|
|
99
|
-
return {
|
|
100
|
-
description: formatMessage(messages.notFoundDescription),
|
|
101
|
-
icon: undefined
|
|
102
|
-
};
|
|
103
|
-
});
|
|
77
|
+
};
|
|
104
78
|
export const SyncedBlockNotFoundError = ({
|
|
105
79
|
reason = 'source-block-deleted',
|
|
106
80
|
sourceAri
|
|
107
81
|
}) => {
|
|
82
|
+
var _useSyncBlockActions;
|
|
108
83
|
const {
|
|
109
84
|
deleteSyncBlock,
|
|
110
85
|
fetchSourceInfo
|
|
111
|
-
} =
|
|
86
|
+
} = (_useSyncBlockActions = useSyncBlockActions()) !== null && _useSyncBlockActions !== void 0 ? _useSyncBlockActions : {};
|
|
112
87
|
const [sourceInfo, setSourceInfo] = useState(undefined);
|
|
113
88
|
const {
|
|
114
89
|
formatMessage
|
|
115
90
|
} = useIntl();
|
|
116
91
|
useEffect(() => {
|
|
117
|
-
if (!
|
|
92
|
+
if (!sourceAri ||
|
|
118
93
|
// Only fetch source info for these 2 cases
|
|
119
94
|
!['source-block-deleted', 'source-block-unsynced'].includes(reason)) {
|
|
120
95
|
setSourceInfo({});
|
|
@@ -133,7 +108,7 @@ export const SyncedBlockNotFoundError = ({
|
|
|
133
108
|
description,
|
|
134
109
|
icon
|
|
135
110
|
} = useErrorInfo(reason, sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.url, sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.title);
|
|
136
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
111
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, sourceInfo === undefined ? /*#__PURE__*/React.createElement(Box, {
|
|
137
112
|
xcss: styles.spinner
|
|
138
113
|
}, /*#__PURE__*/React.createElement(Spinner, null)) : /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
139
114
|
description: description,
|
|
@@ -145,8 +120,5 @@ export const SyncedBlockNotFoundError = ({
|
|
|
145
120
|
icon: CrossIcon,
|
|
146
121
|
label: formatMessage(commonMessages.delete),
|
|
147
122
|
onClick: deleteSyncBlock
|
|
148
|
-
}))))
|
|
149
|
-
description: description,
|
|
150
|
-
icon: icon
|
|
151
|
-
}));
|
|
123
|
+
}))));
|
|
152
124
|
};
|
|
@@ -2,7 +2,6 @@ import React, { memo, useMemo } from 'react';
|
|
|
2
2
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { AKRendererWrapper } from './AKRendererWrapper';
|
|
7
6
|
import { SyncedBlockErrorComponent } from './SyncedBlockErrorComponent';
|
|
8
7
|
import { SyncedBlockLoadingState } from './SyncedBlockLoadingState';
|
|
@@ -23,7 +22,7 @@ const SyncedBlockRendererComponent = ({
|
|
|
23
22
|
var _syncBlockRendererOpt, _ssrProviders$media;
|
|
24
23
|
if (!isSSR() || syncBlockRendererOptions !== null && syncBlockRendererOptions !== void 0 && (_syncBlockRendererOpt = syncBlockRendererOptions.media) !== null && _syncBlockRendererOpt !== void 0 && _syncBlockRendererOpt.ssr ||
|
|
25
24
|
// already has ssr config
|
|
26
|
-
!(ssrProviders !== null && ssrProviders !== void 0 && (_ssrProviders$media = ssrProviders.media) !== null && _ssrProviders$media !== void 0 && _ssrProviders$media.viewMediaClientConfig)
|
|
25
|
+
!(ssrProviders !== null && ssrProviders !== void 0 && (_ssrProviders$media = ssrProviders.media) !== null && _ssrProviders$media !== void 0 && _ssrProviders$media.viewMediaClientConfig)) {
|
|
27
26
|
return syncBlockRendererOptions;
|
|
28
27
|
}
|
|
29
28
|
const mediaSSR = {
|
|
@@ -61,13 +60,13 @@ const SyncedBlockRendererComponent = ({
|
|
|
61
60
|
|
|
62
61
|
// In SSR, if server returned error, we should render loading state instead of error state
|
|
63
62
|
// since FE will do another fetch and render the error state or proper data then
|
|
64
|
-
if (isSSR() && syncBlockInstance.error
|
|
63
|
+
if (isSSR() && syncBlockInstance.error) {
|
|
65
64
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
66
65
|
}
|
|
67
|
-
if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted'
|
|
66
|
+
if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted') {
|
|
68
67
|
var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics;
|
|
69
68
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
70
|
-
error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted'
|
|
69
|
+
error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
|
|
71
70
|
type: SyncBlockError.NotFound
|
|
72
71
|
} : {
|
|
73
72
|
type: SyncBlockError.Errored
|
|
@@ -80,7 +79,7 @@ const SyncedBlockRendererComponent = ({
|
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
// Check for unpublished status
|
|
83
|
-
if (((_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished'
|
|
82
|
+
if (((_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished') {
|
|
84
83
|
var _syncBlockInstance$da3, _api$analytics2;
|
|
85
84
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
86
85
|
error: {
|
|
@@ -3,7 +3,6 @@ import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
|
3
3
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
4
4
|
import { SyncBlockActionsProvider } from '@atlaskit/editor-common/sync-block';
|
|
5
5
|
import { convertSyncBlockJSONNodeToSyncBlockNode, useMemoizedSyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { SyncedBlockNodeComponentRenderer } from './ui/SyncedBlockNodeComponentRenderer';
|
|
8
7
|
export const getSyncBlockNodesFromDoc = doc => {
|
|
9
8
|
const {
|
|
@@ -24,7 +23,7 @@ export const useMemoizedSyncedBlockNodeComponent = ({
|
|
|
24
23
|
|
|
25
24
|
// Initialize SSR data if available
|
|
26
25
|
useEffect(() => {
|
|
27
|
-
if (getSSRData
|
|
26
|
+
if (getSSRData) {
|
|
28
27
|
const ssrData = getSSRData();
|
|
29
28
|
if (ssrData && syncBlockProvider.setSSRData) {
|
|
30
29
|
syncBlockProvider.setSSRData(ssrData);
|
|
@@ -36,7 +35,7 @@ export const useMemoizedSyncedBlockNodeComponent = ({
|
|
|
36
35
|
useEffect(() => {
|
|
37
36
|
syncBlockStoreManager.referenceManager.fetchSyncBlocksData(syncBlockNodes);
|
|
38
37
|
}, [syncBlockNodes, syncBlockStoreManager.referenceManager]);
|
|
39
|
-
return useCallback(props =>
|
|
38
|
+
return useCallback(props => /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
40
39
|
component: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
41
40
|
dispatchAnalyticsEvent: fireAnalyticsEvent,
|
|
42
41
|
fallbackComponent: null
|
|
@@ -47,10 +46,5 @@ export const useMemoizedSyncedBlockNodeComponent = ({
|
|
|
47
46
|
nodeProps: props,
|
|
48
47
|
syncBlockStoreManager: syncBlockStoreManager,
|
|
49
48
|
rendererOptions: syncBlockRendererOptions
|
|
50
|
-
})))
|
|
51
|
-
key: props.localId,
|
|
52
|
-
nodeProps: props,
|
|
53
|
-
syncBlockStoreManager: syncBlockStoreManager,
|
|
54
|
-
rendererOptions: syncBlockRendererOptions
|
|
55
|
-
}), [syncBlockStoreManager, syncBlockRendererOptions, fireAnalyticsEvent]);
|
|
49
|
+
}))), [syncBlockStoreManager, syncBlockRendererOptions, fireAnalyticsEvent]);
|
|
56
50
|
};
|
|
@@ -80,6 +80,7 @@ export var AKRendererWrapper = /*#__PURE__*/memo(function (_ref3) {
|
|
|
80
80
|
allowUgcScrubber = _ref4.allowUgcScrubber,
|
|
81
81
|
allowWrapCodeBlock = _ref4.allowWrapCodeBlock,
|
|
82
82
|
emojiResourceConfig = _ref4.emojiResourceConfig,
|
|
83
|
+
eventHandlers = _ref4.eventHandlers,
|
|
83
84
|
media = _ref4.media,
|
|
84
85
|
smartLinks = _ref4.smartLinks,
|
|
85
86
|
stickyHeaders = _ref4.stickyHeaders;
|
|
@@ -124,6 +125,7 @@ export var AKRendererWrapper = /*#__PURE__*/memo(function (_ref3) {
|
|
|
124
125
|
allowUgcScrubber: allowUgcScrubber,
|
|
125
126
|
allowWrapCodeBlock: allowWrapCodeBlock,
|
|
126
127
|
emojiResourceConfig: emojiResourceConfig,
|
|
128
|
+
eventHandlers: fg('platform_synced_block_patch_1') ? eventHandlers : undefined,
|
|
127
129
|
media: media,
|
|
128
130
|
smartLinks: smartLinks,
|
|
129
131
|
stickyHeaders: stickyHeaders
|
|
@@ -3,7 +3,6 @@ import "./SyncedBlockErrorStateCard.compiled.css";
|
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import WarningOutlineIcon from '@atlaskit/icon-lab/core/warning-outline';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
8
7
|
var styles = {
|
|
9
8
|
wrapper: "_zulppxbi _1rjc12x7 _bozgpxbi _1e0c1txw _1bahv2br _4cvr1h6o",
|
|
@@ -13,7 +12,7 @@ export var SyncedBlockErrorStateCard = function SyncedBlockErrorStateCard(_ref)
|
|
|
13
12
|
var children = _ref.children,
|
|
14
13
|
description = _ref.description,
|
|
15
14
|
icon = _ref.icon;
|
|
16
|
-
var Icon =
|
|
15
|
+
var Icon = icon !== null && icon !== void 0 ? icon : WarningOutlineIcon;
|
|
17
16
|
return /*#__PURE__*/React.createElement(Box, {
|
|
18
17
|
xcss: styles.container
|
|
19
18
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
@@ -23,5 +22,5 @@ export var SyncedBlockErrorStateCard = function SyncedBlockErrorStateCard(_ref)
|
|
|
23
22
|
label: ""
|
|
24
23
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
25
24
|
color: "color.text.subtle"
|
|
26
|
-
}, description)
|
|
25
|
+
}, description)), children);
|
|
27
26
|
};
|
|
@@ -5,7 +5,6 @@ import React from 'react';
|
|
|
5
5
|
import { useIntl } from 'react-intl-next';
|
|
6
6
|
import Button from '@atlaskit/button/new';
|
|
7
7
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
10
9
|
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
11
10
|
var styles = {
|
|
@@ -29,7 +28,7 @@ export var SyncedBlockLoadError = function SyncedBlockLoadError(_ref) {
|
|
|
29
28
|
}, formatMessage(messages.retryButton));
|
|
30
29
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
31
30
|
description: formatMessage(messages.generalErrorDescription)
|
|
32
|
-
}, onRetry &&
|
|
31
|
+
}, onRetry && /*#__PURE__*/React.createElement(Box, {
|
|
33
32
|
xcss: styles.buttonContainer
|
|
34
|
-
}, button)
|
|
33
|
+
}, button));
|
|
35
34
|
};
|
|
@@ -6,7 +6,6 @@ import React, { useMemo } from 'react';
|
|
|
6
6
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
7
7
|
import { SyncBlockSharedCssClassName, SyncBlockRendererDataAttributeName } from '@atlaskit/editor-common/sync-block';
|
|
8
8
|
import { SyncBlockError, useFetchSyncBlockData } from '@atlaskit/editor-synced-block-provider';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
9
|
import { AKRendererWrapper } from './AKRendererWrapper';
|
|
11
10
|
import { SyncedBlockErrorComponent } from './SyncedBlockErrorComponent';
|
|
12
11
|
import { SyncedBlockLoadingState } from './SyncedBlockLoadingState';
|
|
@@ -29,7 +28,7 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
|
|
|
29
28
|
var _rendererOptions$medi, _ssrProviders$media;
|
|
30
29
|
if (!isSSR() || rendererOptions !== null && rendererOptions !== void 0 && (_rendererOptions$medi = rendererOptions.media) !== null && _rendererOptions$medi !== void 0 && _rendererOptions$medi.ssr ||
|
|
31
30
|
// already has ssr config
|
|
32
|
-
!(ssrProviders !== null && ssrProviders !== void 0 && (_ssrProviders$media = ssrProviders.media) !== null && _ssrProviders$media !== void 0 && _ssrProviders$media.viewMediaClientConfig)
|
|
31
|
+
!(ssrProviders !== null && ssrProviders !== void 0 && (_ssrProviders$media = ssrProviders.media) !== null && _ssrProviders$media !== void 0 && _ssrProviders$media.viewMediaClientConfig)) {
|
|
33
32
|
return rendererOptions;
|
|
34
33
|
}
|
|
35
34
|
var mediaSSR = {
|
|
@@ -48,13 +47,13 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
|
|
|
48
47
|
|
|
49
48
|
// In SSR, if server returned error, we should render loading state instead of error state
|
|
50
49
|
// since FE will do another fetch and render the error state or proper data then
|
|
51
|
-
if (isSSR() && syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error
|
|
50
|
+
if (isSSR() && syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error) {
|
|
52
51
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
53
52
|
}
|
|
54
|
-
if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data) || syncBlockInstance.data.status === 'deleted'
|
|
53
|
+
if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data) || syncBlockInstance.data.status === 'deleted') {
|
|
55
54
|
var _syncBlockInstance$er, _syncBlockInstance$da;
|
|
56
55
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
57
|
-
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted'
|
|
56
|
+
error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
|
|
58
57
|
type: SyncBlockError.NotFound
|
|
59
58
|
} : {
|
|
60
59
|
type: SyncBlockError.Errored
|
|
@@ -65,7 +64,7 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
|
|
|
65
64
|
fireAnalyticsEvent: fireAnalyticsEvent
|
|
66
65
|
});
|
|
67
66
|
}
|
|
68
|
-
if ((syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished'
|
|
67
|
+
if ((syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished') {
|
|
69
68
|
var _syncBlockInstance$da3;
|
|
70
69
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
71
70
|
error: {
|
|
@@ -12,8 +12,6 @@ import { useSyncBlockActions } from '@atlaskit/editor-common/sync-block';
|
|
|
12
12
|
import CrossIcon from '@atlaskit/icon/core/cross';
|
|
13
13
|
import EyeOpenStrikethroughIcon from '@atlaskit/icon/core/eye-open-strikethrough';
|
|
14
14
|
import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
|
|
15
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
|
-
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
17
15
|
import { Anchor, Box } from '@atlaskit/primitives/compiled';
|
|
18
16
|
import Spinner from '@atlaskit/spinner';
|
|
19
17
|
import { SyncedBlockErrorStateCard } from './SyncedBlockErrorStateCard';
|
|
@@ -40,26 +38,7 @@ var errorMap = {
|
|
|
40
38
|
icon: LinkBrokenIcon
|
|
41
39
|
}
|
|
42
40
|
};
|
|
43
|
-
var
|
|
44
|
-
return fg('platform_synced_block_dogfooding');
|
|
45
|
-
}, function () {
|
|
46
|
-
var _useSyncBlockActions;
|
|
47
|
-
var _ref = (_useSyncBlockActions = useSyncBlockActions()) !== null && _useSyncBlockActions !== void 0 ? _useSyncBlockActions : {},
|
|
48
|
-
deleteSyncBlock = _ref.deleteSyncBlock,
|
|
49
|
-
fetchSourceInfo = _ref.fetchSourceInfo;
|
|
50
|
-
return {
|
|
51
|
-
deleteSyncBlock: deleteSyncBlock,
|
|
52
|
-
fetchSourceInfo: fetchSourceInfo
|
|
53
|
-
};
|
|
54
|
-
}, function () {
|
|
55
|
-
return {
|
|
56
|
-
deleteSyncBlock: undefined,
|
|
57
|
-
fetchSourceInfo: undefined
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
var useErrorInfo = conditionalHooksFactory(function () {
|
|
61
|
-
return fg('platform_synced_block_dogfooding');
|
|
62
|
-
}, function (reason, url, title) {
|
|
41
|
+
var useErrorInfo = function useErrorInfo(reason, url, title) {
|
|
63
42
|
var _useIntl = useIntl(),
|
|
64
43
|
formatMessage = _useIntl.formatMessage;
|
|
65
44
|
if (reason === 'source-document-deleted') {
|
|
@@ -96,29 +75,23 @@ var useErrorInfo = conditionalHooksFactory(function () {
|
|
|
96
75
|
}),
|
|
97
76
|
icon: icon
|
|
98
77
|
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
var _ref2$reason = _ref2.reason,
|
|
109
|
-
reason = _ref2$reason === void 0 ? 'source-block-deleted' : _ref2$reason,
|
|
110
|
-
sourceAri = _ref2.sourceAri;
|
|
111
|
-
var _useSyncBlockInfo = useSyncBlockInfo(),
|
|
112
|
-
deleteSyncBlock = _useSyncBlockInfo.deleteSyncBlock,
|
|
113
|
-
fetchSourceInfo = _useSyncBlockInfo.fetchSourceInfo;
|
|
78
|
+
};
|
|
79
|
+
export var SyncedBlockNotFoundError = function SyncedBlockNotFoundError(_ref) {
|
|
80
|
+
var _useSyncBlockActions;
|
|
81
|
+
var _ref$reason = _ref.reason,
|
|
82
|
+
reason = _ref$reason === void 0 ? 'source-block-deleted' : _ref$reason,
|
|
83
|
+
sourceAri = _ref.sourceAri;
|
|
84
|
+
var _ref2 = (_useSyncBlockActions = useSyncBlockActions()) !== null && _useSyncBlockActions !== void 0 ? _useSyncBlockActions : {},
|
|
85
|
+
deleteSyncBlock = _ref2.deleteSyncBlock,
|
|
86
|
+
fetchSourceInfo = _ref2.fetchSourceInfo;
|
|
114
87
|
var _useState = useState(undefined),
|
|
115
88
|
_useState2 = _slicedToArray(_useState, 2),
|
|
116
89
|
sourceInfo = _useState2[0],
|
|
117
90
|
setSourceInfo = _useState2[1];
|
|
118
|
-
var
|
|
119
|
-
formatMessage =
|
|
91
|
+
var _useIntl2 = useIntl(),
|
|
92
|
+
formatMessage = _useIntl2.formatMessage;
|
|
120
93
|
useEffect(function () {
|
|
121
|
-
if (!
|
|
94
|
+
if (!sourceAri ||
|
|
122
95
|
// Only fetch source info for these 2 cases
|
|
123
96
|
!['source-block-deleted', 'source-block-unsynced'].includes(reason)) {
|
|
124
97
|
setSourceInfo({});
|
|
@@ -153,7 +126,7 @@ export var SyncedBlockNotFoundError = function SyncedBlockNotFoundError(_ref2) {
|
|
|
153
126
|
var _useErrorInfo = useErrorInfo(reason, sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.url, sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.title),
|
|
154
127
|
description = _useErrorInfo.description,
|
|
155
128
|
icon = _useErrorInfo.icon;
|
|
156
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
129
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, sourceInfo === undefined ? /*#__PURE__*/React.createElement(Box, {
|
|
157
130
|
xcss: styles.spinner
|
|
158
131
|
}, /*#__PURE__*/React.createElement(Spinner, null)) : /*#__PURE__*/React.createElement(SyncedBlockErrorStateCard, {
|
|
159
132
|
description: description,
|
|
@@ -165,8 +138,5 @@ export var SyncedBlockNotFoundError = function SyncedBlockNotFoundError(_ref2) {
|
|
|
165
138
|
icon: CrossIcon,
|
|
166
139
|
label: formatMessage(commonMessages.delete),
|
|
167
140
|
onClick: deleteSyncBlock
|
|
168
|
-
}))))
|
|
169
|
-
description: description,
|
|
170
|
-
icon: icon
|
|
171
|
-
}));
|
|
141
|
+
}))));
|
|
172
142
|
};
|
|
@@ -5,7 +5,6 @@ import React, { memo, useMemo } from 'react';
|
|
|
5
5
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
6
6
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
7
7
|
import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { AKRendererWrapper } from './AKRendererWrapper';
|
|
10
9
|
import { SyncedBlockErrorComponent } from './SyncedBlockErrorComponent';
|
|
11
10
|
import { SyncedBlockLoadingState } from './SyncedBlockLoadingState';
|
|
@@ -23,7 +22,7 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
23
22
|
var _syncBlockRendererOpt, _ssrProviders$media;
|
|
24
23
|
if (!isSSR() || syncBlockRendererOptions !== null && syncBlockRendererOptions !== void 0 && (_syncBlockRendererOpt = syncBlockRendererOptions.media) !== null && _syncBlockRendererOpt !== void 0 && _syncBlockRendererOpt.ssr ||
|
|
25
24
|
// already has ssr config
|
|
26
|
-
!(ssrProviders !== null && ssrProviders !== void 0 && (_ssrProviders$media = ssrProviders.media) !== null && _ssrProviders$media !== void 0 && _ssrProviders$media.viewMediaClientConfig)
|
|
25
|
+
!(ssrProviders !== null && ssrProviders !== void 0 && (_ssrProviders$media = ssrProviders.media) !== null && _ssrProviders$media !== void 0 && _ssrProviders$media.viewMediaClientConfig)) {
|
|
27
26
|
return syncBlockRendererOptions;
|
|
28
27
|
}
|
|
29
28
|
var mediaSSR = {
|
|
@@ -59,13 +58,13 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
59
58
|
|
|
60
59
|
// In SSR, if server returned error, we should render loading state instead of error state
|
|
61
60
|
// since FE will do another fetch and render the error state or proper data then
|
|
62
|
-
if (isSSR() && syncBlockInstance.error
|
|
61
|
+
if (isSSR() && syncBlockInstance.error) {
|
|
63
62
|
return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
|
|
64
63
|
}
|
|
65
|
-
if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted'
|
|
64
|
+
if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted') {
|
|
66
65
|
var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics;
|
|
67
66
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
68
|
-
error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted'
|
|
67
|
+
error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
|
|
69
68
|
type: SyncBlockError.NotFound
|
|
70
69
|
} : {
|
|
71
70
|
type: SyncBlockError.Errored
|
|
@@ -78,7 +77,7 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
|
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
// Check for unpublished status
|
|
81
|
-
if (((_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished'
|
|
80
|
+
if (((_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished') {
|
|
82
81
|
var _syncBlockInstance$da3, _api$analytics2;
|
|
83
82
|
return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
|
|
84
83
|
error: {
|
|
@@ -3,7 +3,6 @@ import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
|
3
3
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
4
4
|
import { SyncBlockActionsProvider } from '@atlaskit/editor-common/sync-block';
|
|
5
5
|
import { convertSyncBlockJSONNodeToSyncBlockNode, useMemoizedSyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { SyncedBlockNodeComponentRenderer } from './ui/SyncedBlockNodeComponentRenderer';
|
|
8
7
|
export var getSyncBlockNodesFromDoc = function getSyncBlockNodesFromDoc(doc) {
|
|
9
8
|
var content = doc.content;
|
|
@@ -25,7 +24,7 @@ export var useMemoizedSyncedBlockNodeComponent = function useMemoizedSyncedBlock
|
|
|
25
24
|
|
|
26
25
|
// Initialize SSR data if available
|
|
27
26
|
useEffect(function () {
|
|
28
|
-
if (getSSRData
|
|
27
|
+
if (getSSRData) {
|
|
29
28
|
var ssrData = getSSRData();
|
|
30
29
|
if (ssrData && syncBlockProvider.setSSRData) {
|
|
31
30
|
syncBlockProvider.setSSRData(ssrData);
|
|
@@ -38,7 +37,7 @@ export var useMemoizedSyncedBlockNodeComponent = function useMemoizedSyncedBlock
|
|
|
38
37
|
syncBlockStoreManager.referenceManager.fetchSyncBlocksData(syncBlockNodes);
|
|
39
38
|
}, [syncBlockNodes, syncBlockStoreManager.referenceManager]);
|
|
40
39
|
return useCallback(function (props) {
|
|
41
|
-
return
|
|
40
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
42
41
|
component: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
43
42
|
dispatchAnalyticsEvent: fireAnalyticsEvent,
|
|
44
43
|
fallbackComponent: null
|
|
@@ -51,11 +50,6 @@ export var useMemoizedSyncedBlockNodeComponent = function useMemoizedSyncedBlock
|
|
|
51
50
|
nodeProps: props,
|
|
52
51
|
syncBlockStoreManager: syncBlockStoreManager,
|
|
53
52
|
rendererOptions: syncBlockRendererOptions
|
|
54
|
-
})))
|
|
55
|
-
key: props.localId,
|
|
56
|
-
nodeProps: props,
|
|
57
|
-
syncBlockStoreManager: syncBlockStoreManager,
|
|
58
|
-
rendererOptions: syncBlockRendererOptions
|
|
59
|
-
});
|
|
53
|
+
})));
|
|
60
54
|
}, [syncBlockStoreManager, syncBlockRendererOptions, fireAnalyticsEvent]);
|
|
61
55
|
};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type RendererProps } from '@atlaskit/renderer';
|
|
2
|
-
export type SyncedBlockRendererOptions = Pick<RendererProps, 'appearance' | 'allowAltTextOnImages' | 'allowAnnotations' | 'allowColumnSorting' | 'allowCopyToClipboard' | 'allowCustomPanels' | 'allowHeadingAnchorLinks' | 'allowPlaceholderText' | 'allowRendererContainerStyles' | 'allowSelectAllTrap' | 'allowUgcScrubber' | 'allowWrapCodeBlock' | 'emojiResourceConfig' | 'media' | 'smartLinks' | 'stickyHeaders'>;
|
|
2
|
+
export type SyncedBlockRendererOptions = Pick<RendererProps, 'appearance' | 'allowAltTextOnImages' | 'allowAnnotations' | 'allowColumnSorting' | 'allowCopyToClipboard' | 'allowCustomPanels' | 'allowHeadingAnchorLinks' | 'allowPlaceholderText' | 'allowRendererContainerStyles' | 'allowSelectAllTrap' | 'allowUgcScrubber' | 'allowWrapCodeBlock' | 'emojiResourceConfig' | 'eventHandlers' | 'media' | 'smartLinks' | 'stickyHeaders'>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type RendererProps } from '@atlaskit/renderer';
|
|
2
|
-
export type SyncedBlockRendererOptions = Pick<RendererProps, 'appearance' | 'allowAltTextOnImages' | 'allowAnnotations' | 'allowColumnSorting' | 'allowCopyToClipboard' | 'allowCustomPanels' | 'allowHeadingAnchorLinks' | 'allowPlaceholderText' | 'allowRendererContainerStyles' | 'allowSelectAllTrap' | 'allowUgcScrubber' | 'allowWrapCodeBlock' | 'emojiResourceConfig' | 'media' | 'smartLinks' | 'stickyHeaders'>;
|
|
2
|
+
export type SyncedBlockRendererOptions = Pick<RendererProps, 'appearance' | 'allowAltTextOnImages' | 'allowAnnotations' | 'allowColumnSorting' | 'allowCopyToClipboard' | 'allowCustomPanels' | 'allowHeadingAnchorLinks' | 'allowPlaceholderText' | 'allowRendererContainerStyles' | 'allowSelectAllTrap' | 'allowUgcScrubber' | 'allowWrapCodeBlock' | 'emojiResourceConfig' | 'eventHandlers' | 'media' | 'smartLinks' | 'stickyHeaders'>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-synced-block-renderer",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.0",
|
|
4
4
|
"description": "SyncedBlockRenderer for @atlaskit/editor-plugin-synced-block",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,13 +31,12 @@
|
|
|
31
31
|
"@atlaskit/button": "^23.9.0",
|
|
32
32
|
"@atlaskit/css": "^0.19.0",
|
|
33
33
|
"@atlaskit/editor-plugin-synced-block": "^5.3.0",
|
|
34
|
-
"@atlaskit/editor-synced-block-provider": "^3.
|
|
34
|
+
"@atlaskit/editor-synced-block-provider": "^3.27.0",
|
|
35
35
|
"@atlaskit/heading": "^5.3.0",
|
|
36
36
|
"@atlaskit/icon": "^30.0.0",
|
|
37
37
|
"@atlaskit/icon-lab": "^5.15.0",
|
|
38
38
|
"@atlaskit/image": "^3.0.0",
|
|
39
39
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
40
|
-
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
41
40
|
"@atlaskit/primitives": "^18.0.0",
|
|
42
41
|
"@atlaskit/renderer": "^126.8.0",
|
|
43
42
|
"@atlaskit/spinner": "^19.0.0",
|
|
@@ -90,9 +89,6 @@
|
|
|
90
89
|
}
|
|
91
90
|
},
|
|
92
91
|
"platform-feature-flags": {
|
|
93
|
-
"platform_synced_block_dogfooding": {
|
|
94
|
-
"type": "boolean"
|
|
95
|
-
},
|
|
96
92
|
"platform_synced_block_patch_1": {
|
|
97
93
|
"type": "boolean"
|
|
98
94
|
}
|