@atlaskit/editor-plugin-synced-block 5.1.10 → 5.1.12
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 +10 -4
- package/afm-jira/tsconfig.json +9 -0
- package/afm-products/tsconfig.json +9 -0
- package/dist/cjs/nodeviews/bodiedSyncedBlock.js +13 -2
- package/dist/cjs/nodeviews/syncedBlock.js +21 -2
- package/dist/cjs/ui/SyncedLocationDropdown.compiled.css +26 -0
- package/dist/cjs/ui/SyncedLocationDropdown.js +302 -0
- package/dist/cjs/ui/floating-toolbar.js +20 -0
- package/dist/es2019/nodeviews/bodiedSyncedBlock.js +13 -2
- package/dist/es2019/nodeviews/syncedBlock.js +19 -4
- package/dist/es2019/ui/SyncedLocationDropdown.compiled.css +26 -0
- package/dist/es2019/ui/SyncedLocationDropdown.js +254 -0
- package/dist/es2019/ui/floating-toolbar.js +21 -0
- package/dist/esm/nodeviews/bodiedSyncedBlock.js +13 -2
- package/dist/esm/nodeviews/syncedBlock.js +21 -2
- package/dist/esm/ui/SyncedLocationDropdown.compiled.css +26 -0
- package/dist/esm/ui/SyncedLocationDropdown.js +293 -0
- package/dist/esm/ui/floating-toolbar.js +20 -0
- package/dist/types/ui/SyncedLocationDropdown.d.ts +12 -0
- package/dist/types-ts4.5/ui/SyncedLocationDropdown.d.ts +12 -0
- package/package.json +7 -3
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
2
4
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
3
5
|
import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
4
6
|
import { useFetchSyncBlockData, useFetchSyncBlockTitle } from '@atlaskit/editor-synced-block-provider';
|
|
@@ -17,7 +19,7 @@ export class SyncBlock extends ReactNodeView {
|
|
|
17
19
|
return domRef;
|
|
18
20
|
}
|
|
19
21
|
render() {
|
|
20
|
-
var _this$options, _this$api$syncedBlock, _this$api, _this$api$syncedBlock2, _this$api$syncedBlock3, _this$options2;
|
|
22
|
+
var _this$options, _this$api$syncedBlock, _this$api, _this$api$syncedBlock2, _this$api$syncedBlock3, _this$api2, _this$api2$analytics, _this$options2, _this$options3;
|
|
21
23
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.syncedBlockRenderer)) {
|
|
22
24
|
return null;
|
|
23
25
|
}
|
|
@@ -35,13 +37,26 @@ export class SyncBlock extends ReactNodeView {
|
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
// get document node from data provider
|
|
38
|
-
return /*#__PURE__*/React.createElement(
|
|
40
|
+
return fg('platform_synced_block_dogfooding') ? /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
41
|
+
component: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
42
|
+
dispatchAnalyticsEvent: (_this$api2 = this.api) === null || _this$api2 === void 0 ? void 0 : (_this$api2$analytics = _this$api2.analytics) === null || _this$api2$analytics === void 0 ? void 0 : _this$api2$analytics.actions.fireAnalyticsEvent,
|
|
43
|
+
fallbackComponent: null
|
|
44
|
+
}, /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
|
|
39
45
|
localId: this.node.attrs.localId,
|
|
40
46
|
syncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.syncedBlockRenderer,
|
|
41
47
|
useFetchSyncBlockTitle: () => useFetchSyncBlockTitle(syncBlockStore, this.node),
|
|
42
48
|
useFetchSyncBlockData: () => {
|
|
43
|
-
var _this$
|
|
44
|
-
return useFetchSyncBlockData(syncBlockStore, resourceId, localId, (_this$
|
|
49
|
+
var _this$api3, _this$api3$analytics, _this$api3$analytics$;
|
|
50
|
+
return useFetchSyncBlockData(syncBlockStore, resourceId, localId, (_this$api3 = this.api) === null || _this$api3 === void 0 ? void 0 : (_this$api3$analytics = _this$api3.analytics) === null || _this$api3$analytics === void 0 ? void 0 : (_this$api3$analytics$ = _this$api3$analytics.actions) === null || _this$api3$analytics$ === void 0 ? void 0 : _this$api3$analytics$.fireAnalyticsEvent);
|
|
51
|
+
},
|
|
52
|
+
api: this.api
|
|
53
|
+
})) : /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
|
|
54
|
+
localId: this.node.attrs.localId,
|
|
55
|
+
syncedBlockRenderer: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncedBlockRenderer,
|
|
56
|
+
useFetchSyncBlockTitle: () => useFetchSyncBlockTitle(syncBlockStore, this.node),
|
|
57
|
+
useFetchSyncBlockData: () => {
|
|
58
|
+
var _this$api4, _this$api4$analytics, _this$api4$analytics$;
|
|
59
|
+
return useFetchSyncBlockData(syncBlockStore, resourceId, localId, (_this$api4 = this.api) === null || _this$api4 === void 0 ? void 0 : (_this$api4$analytics = _this$api4.analytics) === null || _this$api4$analytics === void 0 ? void 0 : (_this$api4$analytics$ = _this$api4$analytics.actions) === null || _this$api4$analytics$ === void 0 ? void 0 : _this$api4$analytics$.fireAnalyticsEvent);
|
|
45
60
|
},
|
|
46
61
|
api: this.api
|
|
47
62
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
._1mour5cr{margin-block:var(--ds-space-negative-050,-4px)}
|
|
3
|
+
._1rjcv77o{padding-block:var(--ds-space-025,2px)}
|
|
4
|
+
._ku9g126e [data-ds--menu--heading-item]{margin-block:var(--ds-space-050,4px)!important}._18bk1rpy [data-ds--menu--heading-item]{color:var(--ds-text-subtlest,#6b6e76)}
|
|
5
|
+
._18m915vq{overflow-y:hidden}
|
|
6
|
+
._18m91wug{overflow-y:auto}
|
|
7
|
+
._1bah1h6o{justify-content:center}
|
|
8
|
+
._1bsb1osq{width:100%}
|
|
9
|
+
._1bsb96ou{width:327px}
|
|
10
|
+
._1bsbo8uj{width:235px}
|
|
11
|
+
._1bto1l2s{text-overflow:ellipsis}
|
|
12
|
+
._1e0c1txw{display:flex}
|
|
13
|
+
._1hmsglyw{text-decoration-line:none}
|
|
14
|
+
._1reo15vq{overflow-x:hidden}
|
|
15
|
+
._1tkeqkoa{min-height:9pc}
|
|
16
|
+
._1ul91wqb{min-width:60px}
|
|
17
|
+
._1wpz1fhb{align-self:stretch}
|
|
18
|
+
._4bfu1r31{text-decoration-color:currentColor}
|
|
19
|
+
._4cvr1h6o{align-items:center}
|
|
20
|
+
._ahbq1b66{margin-inline-start:var(--ds-space-050,4px)}
|
|
21
|
+
._ajmmnqa1{text-decoration-style:solid}
|
|
22
|
+
._c71lko4j{max-height:19pc}
|
|
23
|
+
._o5721q9c{white-space:nowrap}
|
|
24
|
+
._syaz1rpy{color:var(--ds-text-subtlest,#6b6e76)}
|
|
25
|
+
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
26
|
+
._y3gn1h6o{text-align:center}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/* SyncedLocationDropdown.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./SyncedLocationDropdown.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { useState, useEffect } from 'react';
|
|
7
|
+
import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
|
|
8
|
+
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
9
|
+
import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
10
|
+
import { IconTile } from '@atlaskit/icon';
|
|
11
|
+
import PageLiveDocIcon from '@atlaskit/icon-lab/core/page-live-doc';
|
|
12
|
+
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
13
|
+
import PageIcon from '@atlaskit/icon/core/page';
|
|
14
|
+
import StatusErrorIcon from '@atlaskit/icon/core/status-error';
|
|
15
|
+
import { ConfluenceIcon, JiraIcon } from '@atlaskit/logo';
|
|
16
|
+
import Lozenge from '@atlaskit/lozenge';
|
|
17
|
+
import { Box, Text, Inline, Anchor, Stack } from '@atlaskit/primitives/compiled';
|
|
18
|
+
import Spinner from '@atlaskit/spinner';
|
|
19
|
+
const headingStyles = null;
|
|
20
|
+
const styles = {
|
|
21
|
+
title: "_1reo15vq _18m915vq _syazazsu _1bto1l2s _o5721q9c",
|
|
22
|
+
note: "_syaz1rpy _o5721q9c",
|
|
23
|
+
lozenge: "_ahbq1b66 _1ul91wqb",
|
|
24
|
+
noResultsContainer: "_1bsbo8uj _y3gn1h6o",
|
|
25
|
+
dropdownContent: "_1rjcv77o _1bsb96ou _1tkeqkoa _c71lko4j _1e0c1txw _1bah1h6o _4cvr1h6o",
|
|
26
|
+
contentContainer: "_1bsb1osq _1wpz1fhb _18m91wug",
|
|
27
|
+
errorContainer: "_1bsbo8uj _1e0c1txw",
|
|
28
|
+
errorIcon: "_1mour5cr",
|
|
29
|
+
learnMoreLink: "_4bfu1r31 _1hmsglyw _ajmmnqa1"
|
|
30
|
+
};
|
|
31
|
+
const ItemTitle = ({
|
|
32
|
+
title,
|
|
33
|
+
formatMessage,
|
|
34
|
+
onSamePage,
|
|
35
|
+
isSource
|
|
36
|
+
}) => {
|
|
37
|
+
return /*#__PURE__*/React.createElement(Inline, null, /*#__PURE__*/React.createElement(Box, {
|
|
38
|
+
as: "span",
|
|
39
|
+
xcss: styles.title
|
|
40
|
+
}, title), onSamePage && /*#__PURE__*/React.createElement(Box, {
|
|
41
|
+
as: "span",
|
|
42
|
+
xcss: styles.note
|
|
43
|
+
}, "\xA0- ", formatMessage(messages.syncedLocationDropdownTitleNote)), isSource && /*#__PURE__*/React.createElement(Box, {
|
|
44
|
+
as: "span",
|
|
45
|
+
xcss: styles.lozenge
|
|
46
|
+
}, /*#__PURE__*/React.createElement(Lozenge, null, formatMessage(messages.syncedLocationDropdownSourceLozenge))));
|
|
47
|
+
};
|
|
48
|
+
const Logo = ({
|
|
49
|
+
product
|
|
50
|
+
}) => {
|
|
51
|
+
switch (product) {
|
|
52
|
+
case 'confluence-page':
|
|
53
|
+
return /*#__PURE__*/React.createElement(ConfluenceIcon, {
|
|
54
|
+
size: "xsmall"
|
|
55
|
+
});
|
|
56
|
+
case 'jira-work-item':
|
|
57
|
+
return /*#__PURE__*/React.createElement(JiraIcon, {
|
|
58
|
+
size: "xsmall"
|
|
59
|
+
});
|
|
60
|
+
default:
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const ItemIcon = ({
|
|
65
|
+
reference
|
|
66
|
+
}) => {
|
|
67
|
+
const {
|
|
68
|
+
hasAccess,
|
|
69
|
+
subType
|
|
70
|
+
} = reference;
|
|
71
|
+
const icon = hasAccess ? subType ? PageLiveDocIcon : PageIcon : () => /*#__PURE__*/React.createElement(Logo, {
|
|
72
|
+
product: reference.productType
|
|
73
|
+
});
|
|
74
|
+
return /*#__PURE__*/React.createElement(IconTile, {
|
|
75
|
+
icon: icon,
|
|
76
|
+
label: "",
|
|
77
|
+
appearance: hasAccess ? 'grayBold' : 'gray',
|
|
78
|
+
size: "xsmall"
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
export const processReferenceData = (referenceData, intl) => {
|
|
82
|
+
const {
|
|
83
|
+
formatMessage
|
|
84
|
+
} = intl;
|
|
85
|
+
const sourceInfoMap = new Map();
|
|
86
|
+
referenceData === null || referenceData === void 0 ? void 0 : referenceData.forEach(reference => {
|
|
87
|
+
if (!reference) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (sourceInfoMap.has(reference.sourceAri)) {
|
|
91
|
+
var _sourceInfoMap$get;
|
|
92
|
+
(_sourceInfoMap$get = sourceInfoMap.get(reference.sourceAri)) === null || _sourceInfoMap$get === void 0 ? void 0 : _sourceInfoMap$get.push(reference);
|
|
93
|
+
} else {
|
|
94
|
+
sourceInfoMap.set(reference.sourceAri, [reference]);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
for (const references of sourceInfoMap.values()) {
|
|
98
|
+
if (references.length > 1) {
|
|
99
|
+
references.forEach((reference, index) => reference.title = `${reference.title}: ${formatMessage(messages.syncedLocationDropdownTitleBlockIndex, {
|
|
100
|
+
index: index + 1
|
|
101
|
+
})}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const sortedReferences = Array.from(sourceInfoMap.values()).flat().sort((a, b) => {
|
|
105
|
+
if (a.isSource !== b.isSource) {
|
|
106
|
+
return b.isSource ? 1 : -1;
|
|
107
|
+
}
|
|
108
|
+
if (a.hasAccess !== b.hasAccess) {
|
|
109
|
+
return a.hasAccess ? -1 : 1;
|
|
110
|
+
}
|
|
111
|
+
return (a.title || '').localeCompare(b.title || '');
|
|
112
|
+
});
|
|
113
|
+
return sortedReferences;
|
|
114
|
+
};
|
|
115
|
+
export const SyncedLocationDropdown = ({
|
|
116
|
+
syncBlockStore,
|
|
117
|
+
resourceId,
|
|
118
|
+
intl,
|
|
119
|
+
isSource,
|
|
120
|
+
localId
|
|
121
|
+
}) => {
|
|
122
|
+
const {
|
|
123
|
+
formatMessage
|
|
124
|
+
} = intl;
|
|
125
|
+
const triggerTitle = formatMessage(messages.syncedLocationDropdownTitle);
|
|
126
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
127
|
+
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
128
|
+
isOpen: isOpen,
|
|
129
|
+
onOpenChange: ({
|
|
130
|
+
isOpen
|
|
131
|
+
}) => setIsOpen(isOpen),
|
|
132
|
+
trigger: ({
|
|
133
|
+
triggerRef,
|
|
134
|
+
...triggerProps
|
|
135
|
+
}) => /*#__PURE__*/React.createElement(Button, _extends({
|
|
136
|
+
ref: triggerRef,
|
|
137
|
+
areAnyNewToolbarFlagsEnabled: true,
|
|
138
|
+
iconAfter: /*#__PURE__*/React.createElement(ChevronDownIcon, {
|
|
139
|
+
color: "currentColor",
|
|
140
|
+
spacing: "spacious",
|
|
141
|
+
label: "",
|
|
142
|
+
size: "small"
|
|
143
|
+
})
|
|
144
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
145
|
+
}, triggerProps), triggerTitle)
|
|
146
|
+
}, isOpen && /*#__PURE__*/React.createElement(DropdownContent, {
|
|
147
|
+
syncBlockStore: syncBlockStore,
|
|
148
|
+
resourceId: resourceId,
|
|
149
|
+
intl: intl,
|
|
150
|
+
isSource: isSource,
|
|
151
|
+
localId: localId
|
|
152
|
+
}));
|
|
153
|
+
};
|
|
154
|
+
const DropdownContent = ({
|
|
155
|
+
syncBlockStore,
|
|
156
|
+
resourceId,
|
|
157
|
+
intl,
|
|
158
|
+
isSource,
|
|
159
|
+
localId
|
|
160
|
+
}) => {
|
|
161
|
+
const {
|
|
162
|
+
formatMessage
|
|
163
|
+
} = intl;
|
|
164
|
+
const [fetchStatus, setFetchStatus] = useState('none');
|
|
165
|
+
const [referenceData, setReferenceData] = useState([]);
|
|
166
|
+
useEffect(() => {
|
|
167
|
+
setFetchStatus('loading');
|
|
168
|
+
const getReferenceData = async () => {
|
|
169
|
+
const response = await syncBlockStore.fetchReferencesSourceInfo(resourceId, localId, isSource);
|
|
170
|
+
if (response.error) {
|
|
171
|
+
setFetchStatus('error');
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
setReferenceData(processReferenceData(response.references, intl));
|
|
175
|
+
setFetchStatus('success');
|
|
176
|
+
};
|
|
177
|
+
getReferenceData();
|
|
178
|
+
}, [syncBlockStore, intl, isSource, localId, resourceId]);
|
|
179
|
+
const content = () => {
|
|
180
|
+
switch (fetchStatus) {
|
|
181
|
+
case 'loading':
|
|
182
|
+
return /*#__PURE__*/React.createElement(LoadingScreen, null);
|
|
183
|
+
case 'error':
|
|
184
|
+
return /*#__PURE__*/React.createElement(ErrorScreen, {
|
|
185
|
+
formatMessage: formatMessage
|
|
186
|
+
});
|
|
187
|
+
case 'success':
|
|
188
|
+
if (referenceData.length > 0) {
|
|
189
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
190
|
+
"data-testid": "synced-locations-dropdown-content",
|
|
191
|
+
className: ax([styles.contentContainer, "_ku9g126e _18bk1rpy"])
|
|
192
|
+
}, /*#__PURE__*/React.createElement(DropdownItemGroup, {
|
|
193
|
+
title: formatMessage(messages.syncedLocationDropdownHeading, {
|
|
194
|
+
count: `${referenceData.length > 99 ? '99+' : referenceData.length}`
|
|
195
|
+
})
|
|
196
|
+
}, referenceData.map(reference => /*#__PURE__*/React.createElement(DropdownItem, {
|
|
197
|
+
elemBefore: /*#__PURE__*/React.createElement(ItemIcon, {
|
|
198
|
+
reference: reference
|
|
199
|
+
}),
|
|
200
|
+
href: reference.url,
|
|
201
|
+
key: reference.title
|
|
202
|
+
}, /*#__PURE__*/React.createElement(ItemTitle, {
|
|
203
|
+
title: reference.title || reference.url || '',
|
|
204
|
+
formatMessage: formatMessage,
|
|
205
|
+
onSamePage: reference.onSamePage,
|
|
206
|
+
isSource: reference.isSource
|
|
207
|
+
})))));
|
|
208
|
+
} else {
|
|
209
|
+
return /*#__PURE__*/React.createElement(NoResultScreen, {
|
|
210
|
+
formatMessage: formatMessage
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
216
|
+
xcss: styles.dropdownContent
|
|
217
|
+
}, content());
|
|
218
|
+
};
|
|
219
|
+
const LoadingScreen = () => {
|
|
220
|
+
return /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Spinner, null));
|
|
221
|
+
};
|
|
222
|
+
const ErrorScreen = ({
|
|
223
|
+
formatMessage
|
|
224
|
+
}) => {
|
|
225
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
226
|
+
xcss: styles.errorContainer
|
|
227
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
228
|
+
xcss: styles.errorIcon
|
|
229
|
+
}, /*#__PURE__*/React.createElement(StatusErrorIcon, {
|
|
230
|
+
color: "var(--ds-icon-danger, #C9372C)",
|
|
231
|
+
spacing: "spacious",
|
|
232
|
+
label: "",
|
|
233
|
+
size: "small"
|
|
234
|
+
})), /*#__PURE__*/React.createElement(Text, {
|
|
235
|
+
as: "p",
|
|
236
|
+
size: "medium"
|
|
237
|
+
}, formatMessage(messages.syncedLocationDropdownError)));
|
|
238
|
+
};
|
|
239
|
+
const NoResultScreen = ({
|
|
240
|
+
formatMessage
|
|
241
|
+
}) => {
|
|
242
|
+
return /*#__PURE__*/React.createElement(Stack, {
|
|
243
|
+
xcss: styles.noResultsContainer,
|
|
244
|
+
space: "space.100"
|
|
245
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
246
|
+
as: "p"
|
|
247
|
+
}, formatMessage(messages.syncedLocationDropdownNoResults)), /*#__PURE__*/React.createElement(Text, {
|
|
248
|
+
as: "p"
|
|
249
|
+
}, /*#__PURE__*/React.createElement(Anchor, {
|
|
250
|
+
href: "https://hello.atlassian.net/wiki/x/tAtCeAE",
|
|
251
|
+
target: "_blank",
|
|
252
|
+
xcss: styles.learnMoreLink
|
|
253
|
+
}, formatMessage(messages.syncedLocationDropdownLearnMoreLink))));
|
|
254
|
+
};
|
|
@@ -9,6 +9,7 @@ import EditIcon from '@atlaskit/icon/core/edit';
|
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { copySyncedBlockReferenceToClipboard, editSyncedBlockSource, removeSyncedBlock } from '../editor-commands';
|
|
11
11
|
import { findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
12
|
+
import { SyncedLocationDropdown } from './SyncedLocationDropdown';
|
|
12
13
|
export const getToolbarConfig = (state, intl, api, syncBlockStore) => {
|
|
13
14
|
var _api$decorations, _api$connectivity, _api$connectivity$sha;
|
|
14
15
|
const syncBlockObject = findSyncBlockOrBodiedSyncBlock(state.schema, state.selection);
|
|
@@ -25,6 +26,10 @@ export const getToolbarConfig = (state, intl, api, syncBlockStore) => {
|
|
|
25
26
|
}
|
|
26
27
|
} = state;
|
|
27
28
|
const isBodiedSyncBlock = isBodiedSyncBlockNode(syncBlockObject.node, bodiedSyncBlock);
|
|
29
|
+
const {
|
|
30
|
+
resourceId,
|
|
31
|
+
localId
|
|
32
|
+
} = syncBlockObject.node.attrs;
|
|
28
33
|
const {
|
|
29
34
|
formatMessage
|
|
30
35
|
} = intl;
|
|
@@ -48,6 +53,22 @@ export const getToolbarConfig = (state, intl, api, syncBlockStore) => {
|
|
|
48
53
|
};
|
|
49
54
|
items.push(deleteButton);
|
|
50
55
|
} else {
|
|
56
|
+
if (fg('platform_synced_block_dogfooding')) {
|
|
57
|
+
const syncedLocation = {
|
|
58
|
+
type: 'custom',
|
|
59
|
+
fallback: [],
|
|
60
|
+
render: () => {
|
|
61
|
+
return /*#__PURE__*/React.createElement(SyncedLocationDropdown, {
|
|
62
|
+
syncBlockStore: syncBlockStore,
|
|
63
|
+
resourceId: resourceId,
|
|
64
|
+
localId: localId,
|
|
65
|
+
intl: intl,
|
|
66
|
+
isSource: isBodiedSyncBlock
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
items.push(syncedLocation);
|
|
71
|
+
}
|
|
51
72
|
const copyButton = {
|
|
52
73
|
id: 'editor.syncedBlock.copy',
|
|
53
74
|
type: 'button',
|
|
@@ -6,10 +6,13 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
6
6
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
7
7
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
8
8
|
import React from 'react';
|
|
9
|
+
import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
10
|
+
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
9
11
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
10
12
|
import { BodiedSyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
11
13
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
12
14
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
16
|
import { BodiedSyncBlockWrapper } from '../ui/BodiedSyncBlockWrapper';
|
|
14
17
|
var toDOM = function toDOM() {
|
|
15
18
|
return ['div', {
|
|
@@ -82,12 +85,20 @@ var BodiedSyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
82
85
|
}, {
|
|
83
86
|
key: "render",
|
|
84
87
|
value: function render(_props, forwardRef) {
|
|
85
|
-
var _this$api5;
|
|
88
|
+
var _this$api5, _this$api6;
|
|
86
89
|
var syncBlockStore = (_this$api5 = this.api) === null || _this$api5 === void 0 || (_this$api5 = _this$api5.syncedBlock.sharedState) === null || _this$api5 === void 0 || (_this$api5 = _this$api5.currentState()) === null || _this$api5 === void 0 ? void 0 : _this$api5.syncBlockStore;
|
|
87
90
|
if (!syncBlockStore) {
|
|
88
91
|
return null;
|
|
89
92
|
}
|
|
90
|
-
return /*#__PURE__*/React.createElement(
|
|
93
|
+
return fg('platform_synced_block_dogfooding') ? /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
94
|
+
component: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
95
|
+
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
|
+
fallbackComponent: null
|
|
97
|
+
}, /*#__PURE__*/React.createElement(BodiedSyncBlockWrapper, {
|
|
98
|
+
ref: forwardRef,
|
|
99
|
+
syncBlockStore: syncBlockStore,
|
|
100
|
+
node: this.node
|
|
101
|
+
})) : /*#__PURE__*/React.createElement(BodiedSyncBlockWrapper, {
|
|
91
102
|
ref: forwardRef,
|
|
92
103
|
syncBlockStore: syncBlockStore,
|
|
93
104
|
node: this.node
|
|
@@ -8,6 +8,8 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
8
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
9
|
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
10
10
|
import React from 'react';
|
|
11
|
+
import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
12
|
+
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
11
13
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
12
14
|
import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
13
15
|
import { useFetchSyncBlockData as _useFetchSyncBlockData, useFetchSyncBlockTitle as _useFetchSyncBlockTitle } from '@atlaskit/editor-synced-block-provider';
|
|
@@ -37,8 +39,10 @@ export var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
37
39
|
var _this$options,
|
|
38
40
|
_this$api$syncedBlock,
|
|
39
41
|
_this$api,
|
|
42
|
+
_this$api2,
|
|
40
43
|
_this$options2,
|
|
41
|
-
_this2 = this
|
|
44
|
+
_this2 = this,
|
|
45
|
+
_this$options3;
|
|
42
46
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.syncedBlockRenderer)) {
|
|
43
47
|
return null;
|
|
44
48
|
}
|
|
@@ -55,7 +59,11 @@ export var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
// get document node from data provider
|
|
58
|
-
return /*#__PURE__*/React.createElement(
|
|
62
|
+
return fg('platform_synced_block_dogfooding') ? /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
63
|
+
component: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
64
|
+
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,
|
|
65
|
+
fallbackComponent: null
|
|
66
|
+
}, /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
|
|
59
67
|
localId: this.node.attrs.localId,
|
|
60
68
|
syncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.syncedBlockRenderer,
|
|
61
69
|
useFetchSyncBlockTitle: function useFetchSyncBlockTitle() {
|
|
@@ -66,6 +74,17 @@ export var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
66
74
|
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);
|
|
67
75
|
},
|
|
68
76
|
api: this.api
|
|
77
|
+
})) : /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
|
|
78
|
+
localId: this.node.attrs.localId,
|
|
79
|
+
syncedBlockRenderer: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncedBlockRenderer,
|
|
80
|
+
useFetchSyncBlockTitle: function useFetchSyncBlockTitle() {
|
|
81
|
+
return _useFetchSyncBlockTitle(syncBlockStore, _this2.node);
|
|
82
|
+
},
|
|
83
|
+
useFetchSyncBlockData: function useFetchSyncBlockData() {
|
|
84
|
+
var _this2$api2;
|
|
85
|
+
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);
|
|
86
|
+
},
|
|
87
|
+
api: this.api
|
|
69
88
|
});
|
|
70
89
|
}
|
|
71
90
|
}, {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
._1mour5cr{margin-block:var(--ds-space-negative-050,-4px)}
|
|
3
|
+
._1rjcv77o{padding-block:var(--ds-space-025,2px)}
|
|
4
|
+
._ku9g126e [data-ds--menu--heading-item]{margin-block:var(--ds-space-050,4px)!important}._18bk1rpy [data-ds--menu--heading-item]{color:var(--ds-text-subtlest,#6b6e76)}
|
|
5
|
+
._18m915vq{overflow-y:hidden}
|
|
6
|
+
._18m91wug{overflow-y:auto}
|
|
7
|
+
._1bah1h6o{justify-content:center}
|
|
8
|
+
._1bsb1osq{width:100%}
|
|
9
|
+
._1bsb96ou{width:327px}
|
|
10
|
+
._1bsbo8uj{width:235px}
|
|
11
|
+
._1bto1l2s{text-overflow:ellipsis}
|
|
12
|
+
._1e0c1txw{display:flex}
|
|
13
|
+
._1hmsglyw{text-decoration-line:none}
|
|
14
|
+
._1reo15vq{overflow-x:hidden}
|
|
15
|
+
._1tkeqkoa{min-height:9pc}
|
|
16
|
+
._1ul91wqb{min-width:60px}
|
|
17
|
+
._1wpz1fhb{align-self:stretch}
|
|
18
|
+
._4bfu1r31{text-decoration-color:currentColor}
|
|
19
|
+
._4cvr1h6o{align-items:center}
|
|
20
|
+
._ahbq1b66{margin-inline-start:var(--ds-space-050,4px)}
|
|
21
|
+
._ajmmnqa1{text-decoration-style:solid}
|
|
22
|
+
._c71lko4j{max-height:19pc}
|
|
23
|
+
._o5721q9c{white-space:nowrap}
|
|
24
|
+
._syaz1rpy{color:var(--ds-text-subtlest,#6b6e76)}
|
|
25
|
+
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
26
|
+
._y3gn1h6o{text-align:center}
|