@atlaskit/editor-plugin-card 8.0.1 → 8.1.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 +13 -0
- package/dist/cjs/ui/DatasourceAppearanceButton.js +8 -4
- package/dist/cjs/ui/EditToolbarButton/EditToolbarButtonPresentation.js +20 -12
- package/dist/cjs/ui/EditToolbarButton/index.js +33 -15
- package/dist/cjs/ui/HyperlinkToolbarAppearance.js +10 -4
- package/dist/cjs/ui/HyperlinkToolbarAppearanceDropdown.js +11 -6
- package/dist/cjs/ui/LinkToolbarAppearance.js +3 -2
- package/dist/cjs/ui/LinkToolbarAppearanceDropdown.js +4 -2
- package/dist/cjs/ui/OpenPreviewButton/index.js +6 -5
- package/dist/cjs/ui/toolbar.js +44 -32
- package/dist/es2019/ui/DatasourceAppearanceButton.js +8 -4
- package/dist/es2019/ui/EditToolbarButton/EditToolbarButtonPresentation.js +20 -12
- package/dist/es2019/ui/EditToolbarButton/index.js +33 -15
- package/dist/es2019/ui/HyperlinkToolbarAppearance.js +10 -4
- package/dist/es2019/ui/HyperlinkToolbarAppearanceDropdown.js +11 -6
- package/dist/es2019/ui/LinkToolbarAppearance.js +3 -2
- package/dist/es2019/ui/LinkToolbarAppearanceDropdown.js +4 -2
- package/dist/es2019/ui/OpenPreviewButton/index.js +6 -5
- package/dist/es2019/ui/toolbar.js +44 -32
- package/dist/esm/ui/DatasourceAppearanceButton.js +8 -4
- package/dist/esm/ui/EditToolbarButton/EditToolbarButtonPresentation.js +20 -12
- package/dist/esm/ui/EditToolbarButton/index.js +33 -15
- package/dist/esm/ui/HyperlinkToolbarAppearance.js +10 -4
- package/dist/esm/ui/HyperlinkToolbarAppearanceDropdown.js +11 -6
- package/dist/esm/ui/LinkToolbarAppearance.js +3 -2
- package/dist/esm/ui/LinkToolbarAppearanceDropdown.js +4 -2
- package/dist/esm/ui/OpenPreviewButton/index.js +6 -5
- package/dist/esm/ui/toolbar.js +44 -32
- package/dist/types/cardPluginType.d.ts +3 -1
- package/dist/types/ui/DatasourceAppearanceButton.d.ts +2 -1
- package/dist/types/ui/EditToolbarButton/EditToolbarButtonPresentation.d.ts +1 -1
- package/dist/types/ui/EditToolbarButton/types.d.ts +1 -0
- package/dist/types/ui/LinkToolbarAppearance.d.ts +1 -0
- package/dist/types/ui/LinkToolbarAppearanceDropdown.d.ts +1 -1
- package/dist/types/ui/OpenPreviewButton/index.d.ts +2 -1
- package/dist/types-ts4.5/cardPluginType.d.ts +3 -1
- package/dist/types-ts4.5/ui/DatasourceAppearanceButton.d.ts +2 -1
- package/dist/types-ts4.5/ui/EditToolbarButton/EditToolbarButtonPresentation.d.ts +1 -1
- package/dist/types-ts4.5/ui/EditToolbarButton/types.d.ts +1 -0
- package/dist/types-ts4.5/ui/LinkToolbarAppearance.d.ts +1 -0
- package/dist/types-ts4.5/ui/LinkToolbarAppearanceDropdown.d.ts +1 -1
- package/dist/types-ts4.5/ui/OpenPreviewButton/index.d.ts +2 -1
- package/package.json +9 -8
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { linkMessages } from '@atlaskit/editor-common/messages';
|
|
3
|
-
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
4
3
|
import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
5
4
|
import PanelRightIcon from '@atlaskit/icon/core/panel-right';
|
|
6
5
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
@@ -8,7 +7,8 @@ import { Inline, Box, Flex } from '@atlaskit/primitives/compiled';
|
|
|
8
7
|
import { getObjectAri, getObjectIconUrl, getObjectName } from '@atlaskit/smart-card';
|
|
9
8
|
export const OpenPreviewPanelToolbarButton = ({
|
|
10
9
|
node,
|
|
11
|
-
intl
|
|
10
|
+
intl,
|
|
11
|
+
areAnyNewToolbarFlagsEnabled
|
|
12
12
|
}) => {
|
|
13
13
|
const {
|
|
14
14
|
store,
|
|
@@ -35,13 +35,13 @@ export const OpenPreviewPanelToolbarButton = ({
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
const title = intl.formatMessage(linkMessages.openPreviewPanel);
|
|
38
|
-
const icon =
|
|
38
|
+
const icon = areAnyNewToolbarFlagsEnabled ? /*#__PURE__*/React.createElement(PanelRightIcon, {
|
|
39
39
|
label: "",
|
|
40
40
|
spacing: "spacious"
|
|
41
41
|
}) :
|
|
42
42
|
/*#__PURE__*/
|
|
43
43
|
// This is a hack required for Jira until areToolbarFlagsEnabled are enabled to ensure the icon has padding
|
|
44
|
-
// Padding is removed when
|
|
44
|
+
// Padding is removed when areToolbarFlagsEnabled for a button with icon only in platform/packages/editor/editor-common/src/ui/FloatingToolbar/Button.tsx
|
|
45
45
|
React.createElement(Inline, {
|
|
46
46
|
as: "span",
|
|
47
47
|
space: "space.050",
|
|
@@ -65,7 +65,8 @@ export const OpenPreviewPanelToolbarButton = ({
|
|
|
65
65
|
testId: "open-preview-panel-floating-toolbar-button",
|
|
66
66
|
onClick: handleOpenGlancePanelClick,
|
|
67
67
|
icon: icon,
|
|
68
|
-
title: title
|
|
68
|
+
title: title,
|
|
69
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
69
70
|
}));
|
|
70
71
|
}
|
|
71
72
|
}
|
|
@@ -169,8 +169,8 @@ const unlinkCard = (node, state, editorAnalyticsApi) => {
|
|
|
169
169
|
}
|
|
170
170
|
return () => false;
|
|
171
171
|
};
|
|
172
|
-
const buildAlignmentOptions = (state, intl, widthPluginDependencyApi, analyticsApi, cardOptions) => {
|
|
173
|
-
if (
|
|
172
|
+
const buildAlignmentOptions = (state, intl, widthPluginDependencyApi, analyticsApi, cardOptions, areAnyNewToolbarFlagsEnabled) => {
|
|
173
|
+
if (areAnyNewToolbarFlagsEnabled) {
|
|
174
174
|
return buildLayoutDropdown(state, intl, state.schema.nodes.embedCard, widthPluginDependencyApi, analyticsApi, true, true, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowWrapping, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowAlignment);
|
|
175
175
|
}
|
|
176
176
|
return buildLayoutButtons(state, intl, state.schema.nodes.embedCard, widthPluginDependencyApi, analyticsApi, true, true, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowWrapping, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowAlignment);
|
|
@@ -213,7 +213,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
213
213
|
title: title
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
|
-
const
|
|
216
|
+
const areAllNewToolbarFlagsDisabled = !areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
217
217
|
const currentAppearance = appearanceForNodeType(node.type);
|
|
218
218
|
const {
|
|
219
219
|
hoverDecoration
|
|
@@ -271,7 +271,8 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
271
271
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
272
272
|
editorView: editorView,
|
|
273
273
|
onLinkEditClick: getEditLinkCallback(editorAnalyticsApi, true),
|
|
274
|
-
currentAppearance: currentAppearance
|
|
274
|
+
currentAppearance: currentAppearance,
|
|
275
|
+
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
275
276
|
})
|
|
276
277
|
}] : [{
|
|
277
278
|
id: 'editor.link.edit',
|
|
@@ -309,7 +310,8 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
309
310
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
310
311
|
editorView: editorView,
|
|
311
312
|
onLinkEditClick: getEditLinkCallback(editorAnalyticsApi, true),
|
|
312
|
-
currentAppearance: currentAppearance
|
|
313
|
+
currentAppearance: currentAppearance,
|
|
314
|
+
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
313
315
|
})
|
|
314
316
|
}] : [{
|
|
315
317
|
id: 'editor.link.edit',
|
|
@@ -329,10 +331,11 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
329
331
|
render: () => /*#__PURE__*/React.createElement(OpenPreviewPanelToolbarButton, {
|
|
330
332
|
node: node,
|
|
331
333
|
intl: intl,
|
|
332
|
-
editorAnalyticsApi: editorAnalyticsApi
|
|
334
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
335
|
+
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
333
336
|
})
|
|
334
337
|
}] : [];
|
|
335
|
-
const toolbarItems =
|
|
338
|
+
const toolbarItems = areAllNewToolbarFlagsDisabled ? [...editItems, ...commentItems, ...openPreviewPanelItems, {
|
|
336
339
|
id: 'editor.link.openLink',
|
|
337
340
|
type: 'button',
|
|
338
341
|
icon: LinkExternalIcon,
|
|
@@ -345,7 +348,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
345
348
|
target: '_blank'
|
|
346
349
|
}, {
|
|
347
350
|
type: 'separator'
|
|
348
|
-
}, ...getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi), {
|
|
351
|
+
}, ...getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi, !areAllNewToolbarFlagsDisabled), {
|
|
349
352
|
type: 'copy-button',
|
|
350
353
|
items: [{
|
|
351
354
|
state,
|
|
@@ -369,10 +372,10 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
369
372
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
370
373
|
title: intl.formatMessage(commonMessages.remove),
|
|
371
374
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
372
|
-
}] : [...openPreviewPanelItems, ...editButtonItems, ...(fg('platform_editor_controls_patch_15') ? [...getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi), {
|
|
375
|
+
}] : [...openPreviewPanelItems, ...editButtonItems, ...(fg('platform_editor_controls_patch_15') ? [...getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi, !areAllNewToolbarFlagsDisabled), {
|
|
373
376
|
type: 'separator',
|
|
374
377
|
fullHeight: true
|
|
375
|
-
}] : getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), {
|
|
378
|
+
}] : getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi, !areAllNewToolbarFlagsDisabled)), {
|
|
376
379
|
id: 'editor.link.openLink',
|
|
377
380
|
type: 'button',
|
|
378
381
|
icon: LinkExternalIcon,
|
|
@@ -389,8 +392,8 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
389
392
|
}, commentItems[0]] : commentItems)];
|
|
390
393
|
if (currentAppearance === 'embed') {
|
|
391
394
|
var _pluginInjectionApi$a5;
|
|
392
|
-
const alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions, cardOptions);
|
|
393
|
-
if (alignmentOptions.length &&
|
|
395
|
+
const alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions, cardOptions, !areAllNewToolbarFlagsDisabled);
|
|
396
|
+
if (alignmentOptions.length && areAllNewToolbarFlagsDisabled) {
|
|
394
397
|
alignmentOptions.push({
|
|
395
398
|
type: 'separator'
|
|
396
399
|
});
|
|
@@ -407,7 +410,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
407
410
|
// For url appearance, please see HyperlinkToolbarAppearanceProps
|
|
408
411
|
if (currentAppearance) {
|
|
409
412
|
const showDatasourceAppearance = allowDatasource && url;
|
|
410
|
-
toolbarItems.unshift(...getToolbarViewedItem(url, currentAppearance),
|
|
413
|
+
toolbarItems.unshift(...getToolbarViewedItem(url, currentAppearance), areAllNewToolbarFlagsDisabled ? {
|
|
411
414
|
type: 'custom',
|
|
412
415
|
fallback: [],
|
|
413
416
|
render: editorView => /*#__PURE__*/React.createElement(LinkToolbarAppearance, {
|
|
@@ -420,7 +423,8 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
420
423
|
allowEmbeds: allowEmbeds,
|
|
421
424
|
allowBlockCards: allowBlockCards,
|
|
422
425
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
423
|
-
showUpgradeDiscoverability: showUpgradeDiscoverability
|
|
426
|
+
showUpgradeDiscoverability: showUpgradeDiscoverability,
|
|
427
|
+
areAnyNewToolbarFlagsEnabled: false
|
|
424
428
|
})
|
|
425
429
|
} : getLinkAppearanceDropdown({
|
|
426
430
|
url,
|
|
@@ -433,8 +437,9 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
433
437
|
allowDatasource: cardOptions.allowDatasource,
|
|
434
438
|
showUpgradeDiscoverability: showUpgradeDiscoverability,
|
|
435
439
|
settingsConfig: getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink),
|
|
436
|
-
isDatasourceView: isDatasource
|
|
437
|
-
|
|
440
|
+
isDatasourceView: isDatasource,
|
|
441
|
+
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
442
|
+
}), ...(showDatasourceAppearance && areAllNewToolbarFlagsDisabled ? [{
|
|
438
443
|
type: 'custom',
|
|
439
444
|
fallback: [],
|
|
440
445
|
render: editorView => /*#__PURE__*/React.createElement(DatasourceAppearanceButton, {
|
|
@@ -443,13 +448,14 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
443
448
|
url: url,
|
|
444
449
|
editorView: editorView,
|
|
445
450
|
editorState: state,
|
|
446
|
-
inputMethod: INPUT_METHOD.FLOATING_TB
|
|
451
|
+
inputMethod: INPUT_METHOD.FLOATING_TB,
|
|
452
|
+
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
447
453
|
})
|
|
448
|
-
}] : []), ...(!
|
|
454
|
+
}] : []), ...(!areAllNewToolbarFlagsDisabled ? [] : [{
|
|
449
455
|
type: 'separator'
|
|
450
456
|
}]));
|
|
451
457
|
}
|
|
452
|
-
if (!
|
|
458
|
+
if (!areAllNewToolbarFlagsDisabled) {
|
|
453
459
|
const hoverDecorationProps = (nodeType, className) => ({
|
|
454
460
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
455
461
|
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className),
|
|
@@ -491,7 +497,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
491
497
|
return toolbarItems;
|
|
492
498
|
}
|
|
493
499
|
};
|
|
494
|
-
const getUnlinkButtonGroup = (state, intl, node, inlineCard, editorAnalyticsApi) => {
|
|
500
|
+
const getUnlinkButtonGroup = (state, intl, node, inlineCard, editorAnalyticsApi, areAnyNewToolbarFlagsEnabled) => {
|
|
495
501
|
return node.type === inlineCard ? [{
|
|
496
502
|
id: 'editor.link.unlink',
|
|
497
503
|
focusEditoronEnter: true,
|
|
@@ -500,7 +506,7 @@ const getUnlinkButtonGroup = (state, intl, node, inlineCard, editorAnalyticsApi)
|
|
|
500
506
|
icon: LinkBrokenIcon,
|
|
501
507
|
iconFallback: UnlinkIcon,
|
|
502
508
|
onClick: withToolbarMetadata(unlinkCard(node, state, editorAnalyticsApi))
|
|
503
|
-
}, ...(
|
|
509
|
+
}, ...(areAnyNewToolbarFlagsEnabled ? [] : [{
|
|
504
510
|
type: 'separator'
|
|
505
511
|
}])] : [];
|
|
506
512
|
};
|
|
@@ -519,7 +525,7 @@ export const getSettingsButton = (intl, editorAnalyticsApi, userPreferencesLink)
|
|
|
519
525
|
const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hoverDecoration, datasourceId, state, cardOptions, currentAppearance, pluginInjectionApi) => {
|
|
520
526
|
var _node$attrs2;
|
|
521
527
|
const toolbarItems = [];
|
|
522
|
-
const
|
|
528
|
+
const areAllNewToolbarFlagsDisabled = !areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
523
529
|
const canShowAppearanceSwitch = () => {
|
|
524
530
|
// we do not show smart-link or the datasource icons when the node does not have a url to resolve
|
|
525
531
|
if (!metadata.url) {
|
|
@@ -536,7 +542,7 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
536
542
|
const {
|
|
537
543
|
url
|
|
538
544
|
} = metadata;
|
|
539
|
-
if (
|
|
545
|
+
if (areAllNewToolbarFlagsDisabled) {
|
|
540
546
|
toolbarItems.push({
|
|
541
547
|
type: 'custom',
|
|
542
548
|
fallback: [],
|
|
@@ -552,7 +558,8 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
552
558
|
allowBlockCards: allowBlockCards,
|
|
553
559
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
554
560
|
showUpgradeDiscoverability: showUpgradeDiscoverability,
|
|
555
|
-
isDatasourceView: true
|
|
561
|
+
isDatasourceView: true,
|
|
562
|
+
areAnyNewToolbarFlagsEnabled: false
|
|
556
563
|
});
|
|
557
564
|
}
|
|
558
565
|
}, {
|
|
@@ -565,7 +572,8 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
565
572
|
editorView: editorView,
|
|
566
573
|
editorState: state,
|
|
567
574
|
selected: true,
|
|
568
|
-
inputMethod: INPUT_METHOD.FLOATING_TB
|
|
575
|
+
inputMethod: INPUT_METHOD.FLOATING_TB,
|
|
576
|
+
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
569
577
|
})
|
|
570
578
|
}, {
|
|
571
579
|
type: 'separator'
|
|
@@ -582,7 +590,8 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
582
590
|
allowDatasource: cardOptions.allowDatasource,
|
|
583
591
|
showUpgradeDiscoverability: showUpgradeDiscoverability,
|
|
584
592
|
settingsConfig: getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink),
|
|
585
|
-
isDatasourceView: true
|
|
593
|
+
isDatasourceView: true,
|
|
594
|
+
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
586
595
|
}), {
|
|
587
596
|
type: 'separator'
|
|
588
597
|
});
|
|
@@ -601,7 +610,8 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
601
610
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
602
611
|
editorView: editorView,
|
|
603
612
|
onLinkEditClick: getEditLinkCallback(editorAnalyticsApi, false),
|
|
604
|
-
currentAppearance: "datasource"
|
|
613
|
+
currentAppearance: "datasource",
|
|
614
|
+
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
605
615
|
})
|
|
606
616
|
});
|
|
607
617
|
if (node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.url) {
|
|
@@ -617,13 +627,13 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
617
627
|
href: node.attrs.url,
|
|
618
628
|
target: '_blank'
|
|
619
629
|
});
|
|
620
|
-
if (
|
|
630
|
+
if (areAllNewToolbarFlagsDisabled) {
|
|
621
631
|
toolbarItems.push({
|
|
622
632
|
type: 'separator'
|
|
623
633
|
});
|
|
624
634
|
}
|
|
625
635
|
}
|
|
626
|
-
if (
|
|
636
|
+
if (areAllNewToolbarFlagsDisabled) {
|
|
627
637
|
toolbarItems.push({
|
|
628
638
|
type: 'copy-button',
|
|
629
639
|
supportsViewMode: true,
|
|
@@ -711,6 +721,7 @@ export const shouldRenderToolbarPulse = (embedEnabled, appearance, status, isDis
|
|
|
711
721
|
};
|
|
712
722
|
export const getStartingToolbarItems = (options, api) => {
|
|
713
723
|
return (intl, link, onEditLink, metadata, state) => {
|
|
724
|
+
const areAllNewToolbarFlagsDisabled = !areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
714
725
|
const editLinkItem = options.allowDatasource ? [{
|
|
715
726
|
type: 'custom',
|
|
716
727
|
fallback: [],
|
|
@@ -726,7 +737,8 @@ export const getStartingToolbarItems = (options, api) => {
|
|
|
726
737
|
url: link,
|
|
727
738
|
editorView: editorView,
|
|
728
739
|
onLinkEditClick: onEditLink,
|
|
729
|
-
currentAppearance: "url"
|
|
740
|
+
currentAppearance: "url",
|
|
741
|
+
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
730
742
|
});
|
|
731
743
|
}
|
|
732
744
|
}] : [{
|
|
@@ -741,7 +753,7 @@ export const getStartingToolbarItems = (options, api) => {
|
|
|
741
753
|
}, {
|
|
742
754
|
type: 'separator'
|
|
743
755
|
}];
|
|
744
|
-
if (
|
|
756
|
+
if (!areAllNewToolbarFlagsDisabled) {
|
|
745
757
|
var _api$analytics2, _api$analytics3;
|
|
746
758
|
const hyperlinkAppearance = [getCustomHyperlinkAppearanceDropdown({
|
|
747
759
|
url: link,
|
|
@@ -800,7 +812,7 @@ export const getEndingToolbarItems = (options, api) => (intl, link) => {
|
|
|
800
812
|
* Require either provider to be supplied (controls link preferences)
|
|
801
813
|
* Or explicit user preferences config in order to enable button
|
|
802
814
|
*/
|
|
803
|
-
if ((options.provider || options.userPreferencesLink) && !areToolbarFlagsEnabled()) {
|
|
815
|
+
if ((options.provider || options.userPreferencesLink) && !areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar))) {
|
|
804
816
|
var _api$analytics5;
|
|
805
817
|
return [{
|
|
806
818
|
type: 'separator'
|
|
@@ -27,7 +27,8 @@ var DatasourceAppearanceButtonWithCardContext = function DatasourceAppearanceBut
|
|
|
27
27
|
editorView = _ref.editorView,
|
|
28
28
|
editorState = _ref.editorState,
|
|
29
29
|
selected = _ref.selected,
|
|
30
|
-
inputMethod = _ref.inputMethod
|
|
30
|
+
inputMethod = _ref.inputMethod,
|
|
31
|
+
areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled;
|
|
31
32
|
var _useFetchDatasourceIn = useFetchDatasourceInfo({
|
|
32
33
|
isRegularCardNode: true,
|
|
33
34
|
url: url,
|
|
@@ -94,7 +95,8 @@ var DatasourceAppearanceButtonWithCardContext = function DatasourceAppearanceBut
|
|
|
94
95
|
}),
|
|
95
96
|
selected: selected,
|
|
96
97
|
onClick: onChangeAppearance,
|
|
97
|
-
testId: 'card-datasource-appearance-button'
|
|
98
|
+
testId: 'card-datasource-appearance-button',
|
|
99
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
98
100
|
}));
|
|
99
101
|
};
|
|
100
102
|
export var DatasourceAppearanceButton = function DatasourceAppearanceButton(_ref2) {
|
|
@@ -104,7 +106,8 @@ export var DatasourceAppearanceButton = function DatasourceAppearanceButton(_ref
|
|
|
104
106
|
editorView = _ref2.editorView,
|
|
105
107
|
editorState = _ref2.editorState,
|
|
106
108
|
selected = _ref2.selected,
|
|
107
|
-
inputMethod = _ref2.inputMethod
|
|
109
|
+
inputMethod = _ref2.inputMethod,
|
|
110
|
+
areAnyNewToolbarFlagsEnabled = _ref2.areAnyNewToolbarFlagsEnabled;
|
|
108
111
|
var cardContext = useSmartLinkContext();
|
|
109
112
|
return jsx(DatasourceAppearanceButtonWithCardContext, {
|
|
110
113
|
url: url,
|
|
@@ -114,6 +117,7 @@ export var DatasourceAppearanceButton = function DatasourceAppearanceButton(_ref
|
|
|
114
117
|
editorState: editorState,
|
|
115
118
|
cardContext: cardContext,
|
|
116
119
|
selected: selected,
|
|
117
|
-
inputMethod: inputMethod
|
|
120
|
+
inputMethod: inputMethod,
|
|
121
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
118
122
|
});
|
|
119
123
|
};
|
|
@@ -9,7 +9,6 @@ import { useCallback, useRef, useState } from 'react';
|
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { FormattedMessage } from 'react-intl-next';
|
|
11
11
|
import { linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
12
|
-
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
13
12
|
import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
|
|
14
13
|
import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu';
|
|
15
14
|
import EditIcon from '@atlaskit/icon/core/edit';
|
|
@@ -29,7 +28,8 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
29
28
|
editorView = _ref.editorView,
|
|
30
29
|
extensionKey = _ref.extensionKey,
|
|
31
30
|
onLinkEditClick = _ref.onLinkEditClick,
|
|
32
|
-
intl = _ref.intl
|
|
31
|
+
intl = _ref.intl,
|
|
32
|
+
areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled;
|
|
33
33
|
var _useState = useState(false),
|
|
34
34
|
_useState2 = _slicedToArray(_useState, 2),
|
|
35
35
|
isOpen = _useState2[0],
|
|
@@ -55,11 +55,10 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
55
55
|
focusEditorView(editorView);
|
|
56
56
|
}
|
|
57
57
|
}, [currentAppearance, datasourceId, editorAnalyticsApi, editorView, extensionKey]);
|
|
58
|
-
var
|
|
59
|
-
var icon = isNewEditorToolbarEnabled ? jsx(EditIcon, {
|
|
58
|
+
var icon = areAnyNewToolbarFlagsEnabled ? jsx(EditIcon, {
|
|
60
59
|
label: ""
|
|
61
60
|
}) : undefined;
|
|
62
|
-
var tooltipContent =
|
|
61
|
+
var tooltipContent = areAnyNewToolbarFlagsEnabled ? intl.formatMessage(linkToolbarMessages.editLink) : undefined;
|
|
63
62
|
switch (editVariant) {
|
|
64
63
|
case 'edit-link':
|
|
65
64
|
{
|
|
@@ -69,11 +68,14 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
69
68
|
testId: "edit-link",
|
|
70
69
|
onClick: onEditLink,
|
|
71
70
|
icon: icon,
|
|
72
|
-
tooltipContent: tooltipContent
|
|
73
|
-
|
|
71
|
+
tooltipContent: tooltipContent,
|
|
72
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
73
|
+
}, !areAnyNewToolbarFlagsEnabled && jsx(FormattedMessage
|
|
74
74
|
// Ignored via go/ees005
|
|
75
75
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
76
|
-
, linkToolbarMessages.editLink)), !
|
|
76
|
+
, linkToolbarMessages.editLink)), !areAnyNewToolbarFlagsEnabled && jsx(Separator, {
|
|
77
|
+
areAnyNewToolbarFlagsEnabled: false
|
|
78
|
+
}));
|
|
77
79
|
}
|
|
78
80
|
case 'edit-datasource':
|
|
79
81
|
{
|
|
@@ -82,11 +84,14 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
82
84
|
}, jsx(Button, {
|
|
83
85
|
testId: "edit-datasource",
|
|
84
86
|
tooltipContent: intl.formatMessage(linkToolbarMessages.editDatasourceStandaloneTooltip),
|
|
85
|
-
onClick: onEditDatasource
|
|
87
|
+
onClick: onEditDatasource,
|
|
88
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
86
89
|
}, jsx(FormattedMessage
|
|
87
90
|
// Ignored via go/ees005
|
|
88
91
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
89
|
-
, linkToolbarMessages.editDatasourceStandalone)), !
|
|
92
|
+
, linkToolbarMessages.editDatasourceStandalone)), !areAnyNewToolbarFlagsEnabled && jsx(Separator, {
|
|
93
|
+
areAnyNewToolbarFlagsEnabled: false
|
|
94
|
+
}));
|
|
90
95
|
}
|
|
91
96
|
case 'edit-dropdown':
|
|
92
97
|
{
|
|
@@ -103,11 +108,14 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
103
108
|
onClick: toggleOpen,
|
|
104
109
|
selected: isOpen,
|
|
105
110
|
disabled: false,
|
|
106
|
-
ariaHasPopup: true
|
|
111
|
+
ariaHasPopup: true,
|
|
112
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
107
113
|
}, jsx(FormattedMessage
|
|
108
114
|
// Ignored via go/ees005
|
|
109
115
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
110
|
-
, messages.editDropdownTriggerTitle)), !
|
|
116
|
+
, messages.editDropdownTriggerTitle)), !areAnyNewToolbarFlagsEnabled && jsx(Separator, {
|
|
117
|
+
areAnyNewToolbarFlagsEnabled: false
|
|
118
|
+
}));
|
|
111
119
|
return jsx(Flex, {
|
|
112
120
|
ref: containerRef
|
|
113
121
|
}, jsx(UiDropdown, {
|
|
@@ -34,7 +34,8 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
34
34
|
editorView = props.editorView,
|
|
35
35
|
intl = props.intl,
|
|
36
36
|
onLinkEditClick = props.onLinkEditClick,
|
|
37
|
-
url = props.url
|
|
37
|
+
url = props.url,
|
|
38
|
+
areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
|
|
38
39
|
var _useFetchDatasourceIn = useFetchDatasourceInfo({
|
|
39
40
|
isRegularCardNode: true,
|
|
40
41
|
url: url,
|
|
@@ -94,11 +95,14 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
94
95
|
gap: "space.050"
|
|
95
96
|
}, jsx(Button, {
|
|
96
97
|
testId: "edit-link",
|
|
97
|
-
onClick: onEditLink
|
|
98
|
+
onClick: onEditLink,
|
|
99
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
98
100
|
}, jsx(FormattedMessage
|
|
99
101
|
// Ignored via go/ees005
|
|
100
102
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
101
|
-
, linkToolbarMessages.editLink)), !editorExperiment('platform_editor_controls', 'variant1') && jsx(Separator,
|
|
103
|
+
, linkToolbarMessages.editLink)), !editorExperiment('platform_editor_controls', 'variant1') && jsx(Separator, {
|
|
104
|
+
areAnyNewToolbarFlagsEnabled: false
|
|
105
|
+
}));
|
|
102
106
|
}
|
|
103
107
|
case 'edit-datasource':
|
|
104
108
|
{
|
|
@@ -107,11 +111,14 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
107
111
|
}, jsx(Button, {
|
|
108
112
|
testId: "edit-datasource",
|
|
109
113
|
tooltipContent: intl.formatMessage(linkToolbarMessages.editDatasourceStandaloneTooltip),
|
|
110
|
-
onClick: onEditDatasource
|
|
114
|
+
onClick: onEditDatasource,
|
|
115
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
111
116
|
}, jsx(FormattedMessage
|
|
112
117
|
// Ignored via go/ees005
|
|
113
118
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
114
|
-
, linkToolbarMessages.editDatasourceStandalone)), !editorExperiment('platform_editor_controls', 'variant1') && jsx(Separator,
|
|
119
|
+
, linkToolbarMessages.editDatasourceStandalone)), !editorExperiment('platform_editor_controls', 'variant1') && jsx(Separator, {
|
|
120
|
+
areAnyNewToolbarFlagsEnabled: false
|
|
121
|
+
}));
|
|
115
122
|
}
|
|
116
123
|
case 'edit-dropdown':
|
|
117
124
|
{
|
|
@@ -128,11 +135,14 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
128
135
|
onClick: toggleOpen,
|
|
129
136
|
selected: isOpen,
|
|
130
137
|
disabled: false,
|
|
131
|
-
ariaHasPopup: true
|
|
138
|
+
ariaHasPopup: true,
|
|
139
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
132
140
|
}, jsx(FormattedMessage
|
|
133
141
|
// Ignored via go/ees005
|
|
134
142
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
135
|
-
, messages.editDropdownTriggerTitle)), !editorExperiment('platform_editor_controls', 'variant1') && jsx(Separator,
|
|
143
|
+
, messages.editDropdownTriggerTitle)), !editorExperiment('platform_editor_controls', 'variant1') && jsx(Separator, {
|
|
144
|
+
areAnyNewToolbarFlagsEnabled: false
|
|
145
|
+
}));
|
|
136
146
|
return jsx(Flex, {
|
|
137
147
|
ref: containerRef
|
|
138
148
|
}, jsx(UiDropdown, {
|
|
@@ -174,7 +184,8 @@ var EditToolbarButtonWithUrl = function EditToolbarButtonWithUrl(props) {
|
|
|
174
184
|
editorView = props.editorView,
|
|
175
185
|
intl = props.intl,
|
|
176
186
|
onLinkEditClick = props.onLinkEditClick,
|
|
177
|
-
url = props.url
|
|
187
|
+
url = props.url,
|
|
188
|
+
areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
|
|
178
189
|
var _useFetchDatasourceIn2 = useFetchDatasourceInfo({
|
|
179
190
|
isRegularCardNode: true,
|
|
180
191
|
url: url,
|
|
@@ -202,7 +213,8 @@ var EditToolbarButtonWithUrl = function EditToolbarButtonWithUrl(props) {
|
|
|
202
213
|
editorView: editorView,
|
|
203
214
|
extensionKey: extensionKey,
|
|
204
215
|
onLinkEditClick: onLinkEditClick,
|
|
205
|
-
intl: intl
|
|
216
|
+
intl: intl,
|
|
217
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
206
218
|
});
|
|
207
219
|
};
|
|
208
220
|
var EditToolbarButtonWithDatasourceId = function EditToolbarButtonWithDatasourceId(props) {
|
|
@@ -212,7 +224,8 @@ var EditToolbarButtonWithDatasourceId = function EditToolbarButtonWithDatasource
|
|
|
212
224
|
intl = props.intl,
|
|
213
225
|
onLinkEditClick = props.onLinkEditClick,
|
|
214
226
|
datasourceId = props.datasourceId,
|
|
215
|
-
node = props.node
|
|
227
|
+
node = props.node,
|
|
228
|
+
areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
|
|
216
229
|
var fetchData = useMemo(function () {
|
|
217
230
|
try {
|
|
218
231
|
var _attrs$datasource$vie;
|
|
@@ -250,7 +263,8 @@ var EditToolbarButtonWithDatasourceId = function EditToolbarButtonWithDatasource
|
|
|
250
263
|
editorView: editorView,
|
|
251
264
|
extensionKey: extensionKey,
|
|
252
265
|
onLinkEditClick: onLinkEditClick,
|
|
253
|
-
intl: intl
|
|
266
|
+
intl: intl,
|
|
267
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
254
268
|
});
|
|
255
269
|
};
|
|
256
270
|
export var EditToolbarButton = function EditToolbarButton(props) {
|
|
@@ -260,7 +274,8 @@ export var EditToolbarButton = function EditToolbarButton(props) {
|
|
|
260
274
|
editorView = props.editorView,
|
|
261
275
|
intl = props.intl,
|
|
262
276
|
onLinkEditClick = props.onLinkEditClick,
|
|
263
|
-
url = props.url
|
|
277
|
+
url = props.url,
|
|
278
|
+
areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
|
|
264
279
|
var cardContext = useSmartLinkContext();
|
|
265
280
|
if (props.url) {
|
|
266
281
|
return jsx(EditToolbarButtonWithUrl, {
|
|
@@ -271,7 +286,8 @@ export var EditToolbarButton = function EditToolbarButton(props) {
|
|
|
271
286
|
editorView: editorView,
|
|
272
287
|
cardContext: cardContext,
|
|
273
288
|
onLinkEditClick: onLinkEditClick,
|
|
274
|
-
currentAppearance: currentAppearance
|
|
289
|
+
currentAppearance: currentAppearance,
|
|
290
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
275
291
|
});
|
|
276
292
|
}
|
|
277
293
|
if (props.datasourceId && props.node) {
|
|
@@ -282,7 +298,8 @@ export var EditToolbarButton = function EditToolbarButton(props) {
|
|
|
282
298
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
283
299
|
editorView: editorView,
|
|
284
300
|
onLinkEditClick: onLinkEditClick,
|
|
285
|
-
currentAppearance: currentAppearance
|
|
301
|
+
currentAppearance: currentAppearance,
|
|
302
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
286
303
|
});
|
|
287
304
|
}
|
|
288
305
|
return jsx(EditToolbarButtonWithCardContext, {
|
|
@@ -293,6 +310,7 @@ export var EditToolbarButton = function EditToolbarButton(props) {
|
|
|
293
310
|
editorView: editorView,
|
|
294
311
|
cardContext: cardContext,
|
|
295
312
|
onLinkEditClick: onLinkEditClick,
|
|
296
|
-
currentAppearance: currentAppearance
|
|
313
|
+
currentAppearance: currentAppearance,
|
|
314
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
297
315
|
});
|
|
298
316
|
};
|
|
@@ -3,12 +3,13 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
|
+
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
6
7
|
import { FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
|
|
7
8
|
import { Flex } from '@atlaskit/primitives/compiled';
|
|
8
9
|
import { DatasourceAppearanceButton } from './DatasourceAppearanceButton';
|
|
9
10
|
import { LinkToolbarAppearance } from './LinkToolbarAppearance';
|
|
10
11
|
export function HyperlinkToolbarAppearance(props) {
|
|
11
|
-
var _props$cardOptions3;
|
|
12
|
+
var _props$cardOptions3, _props$editorPluginAp2;
|
|
12
13
|
var _useState = useState(new Map()),
|
|
13
14
|
_useState2 = _slicedToArray(_useState, 2),
|
|
14
15
|
supportedUrlsMap = _useState2[0],
|
|
@@ -127,6 +128,7 @@ export function HyperlinkToolbarAppearance(props) {
|
|
|
127
128
|
if (!supportedUrlsMap.get(url)) {
|
|
128
129
|
return null;
|
|
129
130
|
}
|
|
131
|
+
var areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean((_props$editorPluginAp2 = props.editorPluginApi) === null || _props$editorPluginAp2 === void 0 ? void 0 : _props$editorPluginAp2.toolbar));
|
|
130
132
|
return /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement(LinkToolbarAppearance, {
|
|
131
133
|
key: "link-appearance",
|
|
132
134
|
url: url,
|
|
@@ -135,13 +137,17 @@ export function HyperlinkToolbarAppearance(props) {
|
|
|
135
137
|
editorState: editorState,
|
|
136
138
|
allowEmbeds: cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowEmbeds,
|
|
137
139
|
allowBlockCards: cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowBlockCards,
|
|
138
|
-
editorAnalyticsApi: editorAnalyticsApi
|
|
140
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
141
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
139
142
|
}), (cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowDatasource) && /*#__PURE__*/React.createElement(DatasourceAppearanceButton, {
|
|
140
143
|
intl: intl,
|
|
141
144
|
url: url,
|
|
142
145
|
editorState: editorState,
|
|
143
146
|
editorView: editorView,
|
|
144
147
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
145
|
-
inputMethod: INPUT_METHOD.FLOATING_TB
|
|
146
|
-
|
|
148
|
+
inputMethod: INPUT_METHOD.FLOATING_TB,
|
|
149
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
150
|
+
}), /*#__PURE__*/React.createElement(Separator, {
|
|
151
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
152
|
+
}));
|
|
147
153
|
}
|
|
@@ -11,7 +11,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
11
11
|
import { Flex } from '@atlaskit/primitives/compiled';
|
|
12
12
|
import { LinkAppearanceMenu } from './LinkToolbarAppearanceDropdown';
|
|
13
13
|
var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
14
|
-
var _props$cardOptions3;
|
|
14
|
+
var _props$editorPluginAp, _props$cardOptions3, _props$editorPluginAp3, _props$editorPluginAp4;
|
|
15
15
|
var _useState = useState(new Map()),
|
|
16
16
|
_useState2 = _slicedToArray(_useState, 2),
|
|
17
17
|
supportedUrlsMap = _useState2[0],
|
|
@@ -22,6 +22,7 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
22
22
|
setIsOpen = _useState4[1];
|
|
23
23
|
var cardProvider = useRef(undefined);
|
|
24
24
|
var containerRef = useRef(undefined);
|
|
25
|
+
var areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean((_props$editorPluginAp = props.editorPluginApi) === null || _props$editorPluginAp === void 0 ? void 0 : _props$editorPluginAp.toolbar));
|
|
25
26
|
var url = props.url,
|
|
26
27
|
intl = props.intl,
|
|
27
28
|
editorView = props.editorView,
|
|
@@ -52,8 +53,8 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
52
53
|
return _context.abrupt("return", cardProvider.current);
|
|
53
54
|
case 4:
|
|
54
55
|
return _context.abrupt("return", new Promise(function (resolve) {
|
|
55
|
-
var _props$
|
|
56
|
-
var cardProvider = (_props$
|
|
56
|
+
var _props$editorPluginAp2;
|
|
57
|
+
var cardProvider = (_props$editorPluginAp2 = props.editorPluginApi) === null || _props$editorPluginAp2 === void 0 || (_props$editorPluginAp2 = _props$editorPluginAp2.card) === null || _props$editorPluginAp2 === void 0 || (_props$editorPluginAp2 = _props$editorPluginAp2.sharedState) === null || _props$editorPluginAp2 === void 0 || (_props$editorPluginAp2 = _props$editorPluginAp2.currentState()) === null || _props$editorPluginAp2 === void 0 ? void 0 : _props$editorPluginAp2.provider;
|
|
57
58
|
if (cardProvider) {
|
|
58
59
|
resolve(cardProvider);
|
|
59
60
|
}
|
|
@@ -170,7 +171,8 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
170
171
|
label: "",
|
|
171
172
|
spacing: "compact",
|
|
172
173
|
size: "small"
|
|
173
|
-
})
|
|
174
|
+
}),
|
|
175
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
174
176
|
}, title);
|
|
175
177
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
176
178
|
ref: containerRef,
|
|
@@ -198,8 +200,11 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
198
200
|
isDatasourceView: isDatasourceView,
|
|
199
201
|
allowDatasource: allowDatasource,
|
|
200
202
|
dispatchCommand: dispatchCommand,
|
|
201
|
-
settingsConfig: settingsConfig
|
|
202
|
-
|
|
203
|
+
settingsConfig: settingsConfig,
|
|
204
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
205
|
+
})), !(areToolbarFlagsEnabled(Boolean((_props$editorPluginAp3 = props.editorPluginApi) === null || _props$editorPluginAp3 === void 0 ? void 0 : _props$editorPluginAp3.toolbar)) && fg('platform_editor_controls_patch_15')) && /*#__PURE__*/React.createElement(Separator, {
|
|
206
|
+
areAnyNewToolbarFlagsEnabled: areToolbarFlagsEnabled(Boolean((_props$editorPluginAp4 = props.editorPluginApi) === null || _props$editorPluginAp4 === void 0 ? void 0 : _props$editorPluginAp4.toolbar))
|
|
207
|
+
}));
|
|
203
208
|
};
|
|
204
209
|
export var getCustomHyperlinkAppearanceDropdown = function getCustomHyperlinkAppearanceDropdown(_ref3) {
|
|
205
210
|
var url = _ref3.url,
|