@atlaskit/editor-plugin-synced-block 5.3.12 → 5.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/afm-cc/tsconfig.json +0 -3
- package/afm-jira/tsconfig.json +0 -3
- package/afm-products/tsconfig.json +0 -3
- package/dist/cjs/editor-commands/index.js +34 -38
- package/dist/cjs/nodeviews/bodiedSyncedBlock.js +2 -7
- package/dist/cjs/nodeviews/syncedBlock.js +4 -18
- package/dist/cjs/pm-plugins/main.js +120 -67
- package/dist/cjs/pm-plugins/utils/handle-bodied-sync-block-creation.js +141 -0
- package/dist/cjs/pm-plugins/utils/track-sync-blocks.js +2 -2
- package/dist/cjs/pm-plugins/utils/utils.js +1 -46
- package/dist/cjs/syncedBlockPlugin.js +7 -7
- package/dist/cjs/types/index.js +1 -0
- package/dist/cjs/ui/DeleteConfirmationModal.js +4 -20
- package/dist/cjs/ui/Flag.js +5 -1
- package/dist/cjs/ui/SyncBlockLabel.js +4 -10
- package/dist/cjs/ui/SyncBlockRefresher.js +7 -9
- package/dist/cjs/ui/floating-toolbar.js +6 -3
- package/dist/es2019/editor-commands/index.js +34 -38
- package/dist/es2019/nodeviews/bodiedSyncedBlock.js +2 -7
- package/dist/es2019/nodeviews/syncedBlock.js +4 -15
- package/dist/es2019/pm-plugins/main.js +99 -58
- package/dist/es2019/pm-plugins/utils/handle-bodied-sync-block-creation.js +134 -0
- package/dist/es2019/pm-plugins/utils/track-sync-blocks.js +2 -2
- package/dist/es2019/pm-plugins/utils/utils.js +0 -47
- package/dist/es2019/syncedBlockPlugin.js +7 -6
- package/dist/es2019/types/index.js +1 -0
- package/dist/es2019/ui/DeleteConfirmationModal.js +4 -20
- package/dist/es2019/ui/Flag.js +5 -0
- package/dist/es2019/ui/SyncBlockLabel.js +4 -10
- package/dist/es2019/ui/SyncBlockRefresher.js +7 -9
- package/dist/es2019/ui/floating-toolbar.js +6 -3
- package/dist/esm/editor-commands/index.js +34 -38
- package/dist/esm/nodeviews/bodiedSyncedBlock.js +2 -7
- package/dist/esm/nodeviews/syncedBlock.js +4 -18
- package/dist/esm/pm-plugins/main.js +120 -67
- package/dist/esm/pm-plugins/utils/handle-bodied-sync-block-creation.js +134 -0
- package/dist/esm/pm-plugins/utils/track-sync-blocks.js +2 -2
- package/dist/esm/pm-plugins/utils/utils.js +0 -45
- package/dist/esm/syncedBlockPlugin.js +7 -7
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/ui/DeleteConfirmationModal.js +4 -20
- package/dist/esm/ui/Flag.js +5 -1
- package/dist/esm/ui/SyncBlockLabel.js +4 -10
- package/dist/esm/ui/SyncBlockRefresher.js +7 -9
- package/dist/esm/ui/floating-toolbar.js +6 -3
- package/dist/types/pm-plugins/main.d.ts +2 -1
- package/dist/types/pm-plugins/utils/handle-bodied-sync-block-creation.d.ts +9 -0
- package/dist/types/pm-plugins/utils/handle-bodied-sync-block-removal.d.ts +2 -2
- package/dist/types/pm-plugins/utils/utils.d.ts +1 -3
- package/dist/types/types/index.d.ts +19 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/utils/handle-bodied-sync-block-creation.d.ts +9 -0
- package/dist/types-ts4.5/pm-plugins/utils/handle-bodied-sync-block-removal.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/utils/utils.d.ts +1 -3
- package/dist/types-ts4.5/types/index.d.ts +19 -1
- package/package.json +1 -5
|
@@ -8,7 +8,6 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
8
8
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
9
9
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
10
10
|
import ModalDialog, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
11
|
import { Text, Box } from '@atlaskit/primitives/compiled';
|
|
13
12
|
import Spinner from '@atlaskit/spinner';
|
|
14
13
|
import { syncedBlockPluginKey } from '../pm-plugins/main';
|
|
@@ -35,7 +34,7 @@ export const DeleteConfirmationModal = ({
|
|
|
35
34
|
syncBlockStoreManager,
|
|
36
35
|
api
|
|
37
36
|
}) => {
|
|
38
|
-
var _api$core2, _api$core4, _api$core6
|
|
37
|
+
var _api$core2, _api$core4, _api$core6;
|
|
39
38
|
const [isOpen, setIsOpen] = useState(false);
|
|
40
39
|
const [syncBlockIds, setSyncBlockIds] = useState(undefined);
|
|
41
40
|
const [referenceCount, setReferenceCount] = useState(undefined);
|
|
@@ -119,7 +118,7 @@ export const DeleteConfirmationModal = ({
|
|
|
119
118
|
}
|
|
120
119
|
}, [api === null || api === void 0 ? void 0 : (_api$core6 = api.core) === null || _api$core6 === void 0 ? void 0 : _api$core6.actions, bodiedSyncBlockDeletionStatus, isOpen]);
|
|
121
120
|
useEffect(() => {
|
|
122
|
-
if (isOpen && syncBlockIds !== undefined
|
|
121
|
+
if (isOpen && syncBlockIds !== undefined) {
|
|
123
122
|
const fetchReferences = async () => {
|
|
124
123
|
try {
|
|
125
124
|
const references = await Promise.all(syncBlockIds.map(async syncBlockId => {
|
|
@@ -144,7 +143,7 @@ export const DeleteConfirmationModal = ({
|
|
|
144
143
|
onClose: handleClick(false),
|
|
145
144
|
testId: "sync-block-delete-confirmation",
|
|
146
145
|
height: 184
|
|
147
|
-
},
|
|
146
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, referenceCount === undefined ? /*#__PURE__*/React.createElement(Box, {
|
|
148
147
|
xcss: styles.spinner
|
|
149
148
|
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
150
149
|
size: "large"
|
|
@@ -157,22 +156,7 @@ export const DeleteConfirmationModal = ({
|
|
|
157
156
|
isDisabled: isOfflineMode(mode),
|
|
158
157
|
deleteReason: deleteReason,
|
|
159
158
|
sourceCount: (syncBlockIds === null || syncBlockIds === void 0 ? void 0 : syncBlockIds.length) || 0
|
|
160
|
-
}))
|
|
161
|
-
hasCloseButton: true
|
|
162
|
-
}, /*#__PURE__*/React.createElement(ModalTitle, {
|
|
163
|
-
appearance: "warning"
|
|
164
|
-
}, formatMessage(messages.deleteConfirmationModalTitleSingle))), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Text, null, formatMessage(messages.deleteConfirmationModalDescription, {
|
|
165
|
-
syncBlockCount: (_syncBlockIds$length = syncBlockIds === null || syncBlockIds === void 0 ? void 0 : syncBlockIds.length) !== null && _syncBlockIds$length !== void 0 ? _syncBlockIds$length : 1
|
|
166
|
-
}))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
167
|
-
appearance: "subtle",
|
|
168
|
-
onClick: handleClick(false)
|
|
169
|
-
}, formatMessage(messages.deleteConfirmationModalCancelButton)), /*#__PURE__*/React.createElement(Button, {
|
|
170
|
-
appearance: "warning",
|
|
171
|
-
onClick: handleClick(true),
|
|
172
|
-
autoFocus: true,
|
|
173
|
-
isDisabled: isOfflineMode(mode),
|
|
174
|
-
isLoading: bodiedSyncBlockDeletionStatus === 'processing'
|
|
175
|
-
}, formatMessage(messages.deleteConfirmationModalDeleteButton))))));
|
|
159
|
+
}))));
|
|
176
160
|
};
|
|
177
161
|
const ModalContent = ({
|
|
178
162
|
content,
|
package/dist/es2019/ui/Flag.js
CHANGED
|
@@ -37,6 +37,11 @@ const flagMap = {
|
|
|
37
37
|
title: messages.unpublishedSyncBlockPastedTitle,
|
|
38
38
|
description: messages.unpublishedSyncBlockPastedDescription,
|
|
39
39
|
type: 'info'
|
|
40
|
+
},
|
|
41
|
+
[FLAG_ID.CANNOT_CREATE_SYNC_BLOCK]: {
|
|
42
|
+
title: messages.cannotCreateSyncBlockTitle,
|
|
43
|
+
description: messages.CannotCreateSyncBlockDescription,
|
|
44
|
+
type: 'error'
|
|
40
45
|
}
|
|
41
46
|
};
|
|
42
47
|
export const Flag = ({
|
|
@@ -3,7 +3,6 @@ import { useIntl } from 'react-intl-next';
|
|
|
3
3
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { SyncBlockLabelSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
5
5
|
import BlockSyncedIcon from '@atlaskit/icon-lab/core/block-synced';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { Text } from '@atlaskit/primitives/compiled';
|
|
8
7
|
import Tooltip from '@atlaskit/tooltip';
|
|
9
8
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
@@ -22,17 +21,12 @@ const SyncBlockLabelComponent = ({
|
|
|
22
21
|
} = intl;
|
|
23
22
|
const [tooltipContent, setTooltipContent] = useState(formatMessage(messages.defaultSyncBlockTooltip));
|
|
24
23
|
let tooltipMessage = formatMessage(messages.defaultSyncBlockTooltip);
|
|
25
|
-
if (
|
|
26
|
-
tooltipMessage = formatMessage(messages.sourceSyncBlockTooltip);
|
|
27
|
-
} else if (title) {
|
|
24
|
+
if (title) {
|
|
28
25
|
tooltipMessage = formatMessage(messages.referenceSyncBlockTooltip, {
|
|
29
26
|
title
|
|
30
27
|
});
|
|
31
28
|
}
|
|
32
29
|
const updateTooltipContent = useCallback(() => {
|
|
33
|
-
if (!fg('platform_synced_block_dogfooding')) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
30
|
let tooltipContent = tooltipMessage;
|
|
37
31
|
if (contentUpdatedAt) {
|
|
38
32
|
const elapsedTime = formatElapsedTime(contentUpdatedAt, intl);
|
|
@@ -52,7 +46,7 @@ const SyncBlockLabelComponent = ({
|
|
|
52
46
|
}, [contentUpdatedAt, formatMessage, intl, tooltipMessage]);
|
|
53
47
|
const ariaDescribedById = `sync-block-label-description-${localId}`;
|
|
54
48
|
const getLabelContent = useMemo(() => {
|
|
55
|
-
if (isUnsyncedBlock
|
|
49
|
+
if (isUnsyncedBlock) {
|
|
56
50
|
return /*#__PURE__*/React.createElement(Text, {
|
|
57
51
|
size: "small",
|
|
58
52
|
color: "color.text.subtle"
|
|
@@ -81,12 +75,12 @@ const SyncBlockLabelComponent = ({
|
|
|
81
75
|
size: "small",
|
|
82
76
|
label: ""
|
|
83
77
|
}), getLabelContent);
|
|
84
|
-
if (
|
|
78
|
+
if (isSource || isUnsyncedBlock) {
|
|
85
79
|
return label;
|
|
86
80
|
}
|
|
87
81
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
88
82
|
position: "top",
|
|
89
|
-
content:
|
|
83
|
+
content: tooltipContent
|
|
90
84
|
// workaround because tooltip adds aria-describedby with a new id every time the tooltip is opened
|
|
91
85
|
// this causes an infinite rerender loop because of the forwardRef from the node view we are inside in bodiedSyncBlock
|
|
92
86
|
// tooltip content is available for screen readers in visually hidden content after the label
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
export const SYNC_BLOCK_FETCH_INTERVAL = 3000;
|
|
6
5
|
|
|
7
6
|
// Component that manages synced block data synchronization.
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
7
|
+
// Component that manages synced block data synchronization.
|
|
8
|
+
// Uses provider-based GraphQL subscriptions for updates when online.
|
|
9
|
+
// Falls back to polling at regular intervals when offline.
|
|
11
10
|
export const SyncBlockRefresher = ({
|
|
12
11
|
syncBlockStoreManager,
|
|
13
12
|
api
|
|
@@ -20,14 +19,13 @@ export const SyncBlockRefresher = ({
|
|
|
20
19
|
mode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
|
|
21
20
|
};
|
|
22
21
|
});
|
|
23
|
-
const featureFlagEnabled = fg('platform_synced_block_dogfooding');
|
|
24
22
|
const isOnline = !isOfflineMode(mode);
|
|
25
23
|
useEffect(() => {
|
|
26
|
-
const useRealTimeSubscriptions =
|
|
24
|
+
const useRealTimeSubscriptions = isOnline;
|
|
27
25
|
syncBlockStoreManager.referenceManager.setRealTimeSubscriptionsEnabled(useRealTimeSubscriptions);
|
|
28
|
-
}, [syncBlockStoreManager,
|
|
26
|
+
}, [syncBlockStoreManager, isOnline]);
|
|
29
27
|
useEffect(() => {
|
|
30
|
-
const useRealTimeSubscriptions =
|
|
28
|
+
const useRealTimeSubscriptions = isOnline;
|
|
31
29
|
if (useRealTimeSubscriptions) {
|
|
32
30
|
return;
|
|
33
31
|
}
|
|
@@ -46,6 +44,6 @@ export const SyncBlockRefresher = ({
|
|
|
46
44
|
return () => {
|
|
47
45
|
window.clearInterval(interval);
|
|
48
46
|
};
|
|
49
|
-
}, [syncBlockStoreManager, isOnline
|
|
47
|
+
}, [syncBlockStoreManager, isOnline]);
|
|
50
48
|
return null;
|
|
51
49
|
};
|
|
@@ -20,6 +20,9 @@ export const getToolbarConfig = (state, intl, api, syncBlockStore) => {
|
|
|
20
20
|
if (!syncBlockObject) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
+
if (syncBlockStore.sourceManager.isPendingCreation(syncBlockObject.node.attrs.resourceId) && fg('platform_synced_block_patch_1')) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
23
26
|
const syncBlockInstance = syncBlockStore.referenceManager.getFromCache(syncBlockObject.node.attrs.resourceId);
|
|
24
27
|
const isUnsyncedBlock = (syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$er = syncBlockInstance.error) === null || _syncBlockInstance$er === void 0 ? void 0 : _syncBlockInstance$er.type) === SyncBlockError.NotFound;
|
|
25
28
|
const isErroredBlock = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error;
|
|
@@ -53,12 +56,12 @@ export const getToolbarConfig = (state, intl, api, syncBlockStore) => {
|
|
|
53
56
|
title: formatMessage(commonMessages.delete),
|
|
54
57
|
onClick: removeSyncedBlock(api),
|
|
55
58
|
icon: DeleteIcon,
|
|
56
|
-
testId:
|
|
57
|
-
...hoverDecorationProps(nodeType,
|
|
59
|
+
testId: SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete,
|
|
60
|
+
...hoverDecorationProps(nodeType, akEditorSelectedNodeClassName)
|
|
58
61
|
};
|
|
59
62
|
items.push(deleteButton);
|
|
60
63
|
} else {
|
|
61
|
-
if (!isErroredBlock
|
|
64
|
+
if (!isErroredBlock) {
|
|
62
65
|
const syncedLocation = {
|
|
63
66
|
type: 'custom',
|
|
64
67
|
fallback: [],
|
|
@@ -24,23 +24,23 @@ export var createSyncedBlock = function createSyncedBlock(_ref) {
|
|
|
24
24
|
var paragraphNode = paragraph.createAndFill({});
|
|
25
25
|
var newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(attrs, paragraphNode ? [paragraphNode] : []);
|
|
26
26
|
if (!newBodiedSyncBlockNode) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
}
|
|
27
|
+
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
|
|
28
|
+
action: ACTION.ERROR,
|
|
29
|
+
actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
30
|
+
actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
|
|
31
|
+
attributes: {
|
|
32
|
+
error: 'Create and fill for empty content failed'
|
|
33
|
+
},
|
|
34
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
35
|
+
});
|
|
38
36
|
return false;
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
// Save the new node with empty content to backend
|
|
42
40
|
// This is so that the node can be copied and referenced without the source being saved/published
|
|
43
|
-
|
|
41
|
+
if (!fg('platform_synced_block_patch_1')) {
|
|
42
|
+
syncBlockStore.sourceManager.createBodiedSyncBlockNode(attrs, function () {});
|
|
43
|
+
}
|
|
44
44
|
if (typeAheadInsert) {
|
|
45
45
|
tr = typeAheadInsert(newBodiedSyncBlockNode);
|
|
46
46
|
} else {
|
|
@@ -49,47 +49,43 @@ export var createSyncedBlock = function createSyncedBlock(_ref) {
|
|
|
49
49
|
} else {
|
|
50
50
|
var conversionInfo = canBeConvertedToSyncBlock(tr.selection);
|
|
51
51
|
if (!conversionInfo) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
});
|
|
62
|
-
}
|
|
52
|
+
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
|
|
53
|
+
action: ACTION.ERROR,
|
|
54
|
+
actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
55
|
+
actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
|
|
56
|
+
attributes: {
|
|
57
|
+
error: 'Content cannot be converted to sync block'
|
|
58
|
+
},
|
|
59
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
60
|
+
});
|
|
63
61
|
return false;
|
|
64
62
|
}
|
|
65
63
|
var _attrs = syncBlockStore.sourceManager.generateBodiedSyncBlockAttrs();
|
|
66
64
|
var _newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(_attrs, conversionInfo.contentToInclude);
|
|
67
65
|
if (!_newBodiedSyncBlockNode) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
});
|
|
78
|
-
}
|
|
66
|
+
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
|
|
67
|
+
action: ACTION.ERROR,
|
|
68
|
+
actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
69
|
+
actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
|
|
70
|
+
attributes: {
|
|
71
|
+
error: 'Create and fill for content failed'
|
|
72
|
+
},
|
|
73
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
74
|
+
});
|
|
79
75
|
return false;
|
|
80
76
|
}
|
|
81
77
|
|
|
82
78
|
// Save the new node with empty content to backend
|
|
83
79
|
// This is so that the node can be copied and referenced without the source being saved/published
|
|
84
|
-
|
|
80
|
+
if (!fg('platform_synced_block_patch_1')) {
|
|
81
|
+
// Moved to appendTransaction
|
|
82
|
+
syncBlockStore.sourceManager.createBodiedSyncBlockNode(_attrs, function () {}, _newBodiedSyncBlockNode);
|
|
83
|
+
}
|
|
85
84
|
tr.replaceWith(conversionInfo.from, conversionInfo.to, _newBodiedSyncBlockNode).scrollIntoView();
|
|
86
85
|
|
|
87
86
|
// set selection to the start of the previous selection for the position taken up by the start of the new synced block
|
|
88
87
|
tr.setSelection(TextSelection.create(tr.doc, conversionInfo.from));
|
|
89
88
|
}
|
|
90
|
-
|
|
91
|
-
// This transaction will be intercepted in filterTransaction and dispatched when saving to backend succeeds
|
|
92
|
-
// see filterTransaction for more details
|
|
93
89
|
return tr;
|
|
94
90
|
};
|
|
95
91
|
export var copySyncedBlockReferenceToClipboardEditorCommand = function copySyncedBlockReferenceToClipboardEditorCommand(syncBlockStore, inputMethod, api) {
|
|
@@ -12,7 +12,6 @@ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
|
12
12
|
import { BodiedSyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
13
13
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
14
14
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
15
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
15
|
import { BodiedSyncBlockWrapper } from '../ui/BodiedSyncBlockWrapper';
|
|
17
16
|
var toDOM = function toDOM() {
|
|
18
17
|
return ['div', {
|
|
@@ -90,7 +89,7 @@ var BodiedSyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
90
89
|
if (!syncBlockStore) {
|
|
91
90
|
return null;
|
|
92
91
|
}
|
|
93
|
-
return
|
|
92
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
94
93
|
component: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
95
94
|
dispatchAnalyticsEvent: (_this$api6 = this.api) === null || _this$api6 === void 0 || (_this$api6 = _this$api6.analytics) === null || _this$api6 === void 0 ? void 0 : _this$api6.actions.fireAnalyticsEvent,
|
|
96
95
|
fallbackComponent: null
|
|
@@ -98,11 +97,7 @@ var BodiedSyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
98
97
|
ref: forwardRef,
|
|
99
98
|
syncBlockStore: syncBlockStore,
|
|
100
99
|
node: this.node
|
|
101
|
-
}))
|
|
102
|
-
ref: forwardRef,
|
|
103
|
-
syncBlockStore: syncBlockStore,
|
|
104
|
-
node: this.node
|
|
105
|
-
});
|
|
100
|
+
}));
|
|
106
101
|
}
|
|
107
102
|
}, {
|
|
108
103
|
key: "getContentDOM",
|
|
@@ -13,7 +13,6 @@ import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
|
13
13
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
14
14
|
import { SyncBlockSharedCssClassName, SyncBlockActionsProvider } from '@atlaskit/editor-common/sync-block';
|
|
15
15
|
import { useFetchSyncBlockData as _useFetchSyncBlockData, useFetchSyncBlockTitle as _useFetchSyncBlockTitle } from '@atlaskit/editor-synced-block-provider';
|
|
16
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
16
|
import { removeSyncedBlockAtPos } from '../editor-commands';
|
|
18
17
|
import { SyncBlockRendererWrapper } from '../ui/SyncBlockRendererWrapper';
|
|
19
18
|
export var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
@@ -42,8 +41,7 @@ export var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
42
41
|
_this$api,
|
|
43
42
|
_this$api2,
|
|
44
43
|
_this2 = this,
|
|
45
|
-
_this$options2
|
|
46
|
-
_this$options3;
|
|
44
|
+
_this$options2;
|
|
47
45
|
var getPos = _ref.getPos;
|
|
48
46
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.syncedBlockRenderer)) {
|
|
49
47
|
return null;
|
|
@@ -54,14 +52,13 @@ export var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
54
52
|
if (!resourceId || !localId) {
|
|
55
53
|
return null;
|
|
56
54
|
}
|
|
57
|
-
var
|
|
58
|
-
var syncBlockStore = (_this$api$syncedBlock = (_this$api = this.api) === null || _this$api === void 0 || (_this$api = _this$api.syncedBlock) === null || _this$api === void 0 || (_this$api = _this$api.sharedState.currentState()) === null || _this$api === void 0 ? void 0 : _this$api.syncBlockStore) !== null && _this$api$syncedBlock !== void 0 ? _this$api$syncedBlock : initialSyncBlockStore;
|
|
55
|
+
var syncBlockStore = (_this$api$syncedBlock = (_this$api = this.api) === null || _this$api === void 0 || (_this$api = _this$api.syncedBlock) === null || _this$api === void 0 || (_this$api = _this$api.sharedState.currentState()) === null || _this$api === void 0 ? void 0 : _this$api.syncBlockStore) !== null && _this$api$syncedBlock !== void 0 ? _this$api$syncedBlock : this.syncBlockStore;
|
|
59
56
|
if (!syncBlockStore) {
|
|
60
57
|
return null;
|
|
61
58
|
}
|
|
62
59
|
|
|
63
60
|
// get document node from data provider
|
|
64
|
-
return
|
|
61
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
65
62
|
component: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
66
63
|
dispatchAnalyticsEvent: (_this$api2 = this.api) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.analytics) === null || _this$api2 === void 0 ? void 0 : _this$api2.actions.fireAnalyticsEvent,
|
|
67
64
|
fallbackComponent: null
|
|
@@ -86,18 +83,7 @@ export var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
86
83
|
return _useFetchSyncBlockData(syncBlockStore, resourceId, localId, (_this2$api = _this2.api) === null || _this2$api === void 0 || (_this2$api = _this2$api.analytics) === null || _this2$api === void 0 || (_this2$api = _this2$api.actions) === null || _this2$api === void 0 ? void 0 : _this2$api.fireAnalyticsEvent);
|
|
87
84
|
},
|
|
88
85
|
api: this.api
|
|
89
|
-
})))
|
|
90
|
-
localId: this.node.attrs.localId,
|
|
91
|
-
syncedBlockRenderer: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncedBlockRenderer,
|
|
92
|
-
useFetchSyncBlockTitle: function useFetchSyncBlockTitle() {
|
|
93
|
-
return _useFetchSyncBlockTitle(syncBlockStore, _this2.node);
|
|
94
|
-
},
|
|
95
|
-
useFetchSyncBlockData: function useFetchSyncBlockData() {
|
|
96
|
-
var _this2$api2;
|
|
97
|
-
return _useFetchSyncBlockData(syncBlockStore, resourceId, localId, (_this2$api2 = _this2.api) === null || _this2$api2 === void 0 || (_this2$api2 = _this2$api2.analytics) === null || _this2$api2 === void 0 || (_this2$api2 = _this2$api2.actions) === null || _this2$api2 === void 0 ? void 0 : _this2$api2.fireAnalyticsEvent);
|
|
98
|
-
},
|
|
99
|
-
api: this.api
|
|
100
|
-
});
|
|
86
|
+
})));
|
|
101
87
|
}
|
|
102
88
|
}, {
|
|
103
89
|
key: "destroy",
|