@atlaskit/editor-plugin-card 5.3.4 → 5.3.5
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 +9 -0
- package/dist/cjs/ui/toolbar.js +64 -32
- package/dist/es2019/ui/toolbar.js +64 -32
- package/dist/esm/ui/toolbar.js +64 -32
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 5.3.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#128122](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128122)
|
|
8
|
+
[`552a7081e75d7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/552a7081e75d7) -
|
|
9
|
+
[ux] ED-27167 Move copy and delete button to overflow menu for datasource floating toolbar
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 5.3.4
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -256,7 +256,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
256
256
|
lpLinkPicker: lpLinkPicker
|
|
257
257
|
})];
|
|
258
258
|
} else if (shouldRenderDatasourceToolbar) {
|
|
259
|
-
return getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, node.attrs.datasource.id, state, cardOptions, currentAppearance);
|
|
259
|
+
return getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, node.attrs.datasource.id, state, cardOptions, currentAppearance, pluginInjectionApi);
|
|
260
260
|
} else {
|
|
261
261
|
var _pluginInjectionApi$c;
|
|
262
262
|
var inlineCard = state.schema.nodes.inlineCard;
|
|
@@ -429,7 +429,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
429
429
|
}, {
|
|
430
430
|
type: 'overflow-dropdown',
|
|
431
431
|
options: [{
|
|
432
|
-
title:
|
|
432
|
+
title: intl.formatMessage(_messages.default.copyToClipboard),
|
|
433
433
|
onClick: function onClick() {
|
|
434
434
|
var _pluginInjectionApi$c2, _pluginInjectionApi$f;
|
|
435
435
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 || _pluginInjectionApi$c2.actions.execute( // @ts-ignore
|
|
@@ -437,13 +437,13 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
437
437
|
return true;
|
|
438
438
|
},
|
|
439
439
|
icon: /*#__PURE__*/_react.default.createElement(_copy.default, {
|
|
440
|
-
label:
|
|
440
|
+
label: intl.formatMessage(_messages.default.copyToClipboard)
|
|
441
441
|
})
|
|
442
442
|
}, {
|
|
443
|
-
title:
|
|
443
|
+
title: intl.formatMessage(_messages.default.delete),
|
|
444
444
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
|
|
445
445
|
icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
|
|
446
|
-
label:
|
|
446
|
+
label: intl.formatMessage(_messages.default.delete)
|
|
447
447
|
})
|
|
448
448
|
}]
|
|
449
449
|
}];
|
|
@@ -478,7 +478,7 @@ var getSettingsButton = exports.getSettingsButton = function getSettingsButton(i
|
|
|
478
478
|
target: '_blank'
|
|
479
479
|
};
|
|
480
480
|
};
|
|
481
|
-
var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, datasourceId, state, cardOptions, currentAppearance) {
|
|
481
|
+
var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, datasourceId, state, cardOptions, currentAppearance, pluginInjectionApi) {
|
|
482
482
|
var _node$attrs2;
|
|
483
483
|
var toolbarItems = [];
|
|
484
484
|
var canShowAppearanceSwitch = function canShowAppearanceSwitch() {
|
|
@@ -574,36 +574,68 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
574
574
|
className: 'hyperlink-open-link',
|
|
575
575
|
title: intl.formatMessage(_messages.linkMessages.openLink),
|
|
576
576
|
onClick: visitCardLink(editorAnalyticsApi)
|
|
577
|
+
});
|
|
578
|
+
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'control')) {
|
|
579
|
+
toolbarItems.push({
|
|
580
|
+
type: 'separator'
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'control')) {
|
|
585
|
+
toolbarItems.push({
|
|
586
|
+
type: 'copy-button',
|
|
587
|
+
supportsViewMode: true,
|
|
588
|
+
items: [{
|
|
589
|
+
state: state,
|
|
590
|
+
formatMessage: intl.formatMessage,
|
|
591
|
+
nodeType: node.type
|
|
592
|
+
}]
|
|
577
593
|
}, {
|
|
578
594
|
type: 'separator'
|
|
595
|
+
}, getSettingsButton(intl, editorAnalyticsApi, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.userPreferencesLink), {
|
|
596
|
+
type: 'separator'
|
|
597
|
+
}, {
|
|
598
|
+
id: 'editor.link.delete',
|
|
599
|
+
focusEditoronEnter: true,
|
|
600
|
+
type: 'button',
|
|
601
|
+
appearance: 'danger',
|
|
602
|
+
icon: _delete.default,
|
|
603
|
+
iconFallback: _remove.default,
|
|
604
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
605
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
606
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
607
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
608
|
+
title: intl.formatMessage(_messages.default.remove),
|
|
609
|
+
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
579
610
|
});
|
|
611
|
+
} else {
|
|
612
|
+
toolbarItems.push({
|
|
613
|
+
type: 'separator',
|
|
614
|
+
fullHeight: true
|
|
615
|
+
});
|
|
616
|
+
var overflowMenuConfig = [{
|
|
617
|
+
type: 'overflow-dropdown',
|
|
618
|
+
options: [{
|
|
619
|
+
title: intl.formatMessage(_messages.default.copyToClipboard),
|
|
620
|
+
onClick: function onClick() {
|
|
621
|
+
var _pluginInjectionApi$c3, _pluginInjectionApi$f2;
|
|
622
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.core) === null || _pluginInjectionApi$c3 === void 0 || _pluginInjectionApi$c3.actions.execute( // @ts-ignore
|
|
623
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f2 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.commands.copyNode(node.type));
|
|
624
|
+
return true;
|
|
625
|
+
},
|
|
626
|
+
icon: /*#__PURE__*/_react.default.createElement(_copy.default, {
|
|
627
|
+
label: intl.formatMessage(_messages.default.copyToClipboard)
|
|
628
|
+
})
|
|
629
|
+
}, {
|
|
630
|
+
title: intl.formatMessage(_messages.default.delete),
|
|
631
|
+
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
|
|
632
|
+
icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
|
|
633
|
+
label: intl.formatMessage(_messages.default.delete)
|
|
634
|
+
})
|
|
635
|
+
}]
|
|
636
|
+
}];
|
|
637
|
+
toolbarItems.push.apply(toolbarItems, overflowMenuConfig);
|
|
580
638
|
}
|
|
581
|
-
toolbarItems.push({
|
|
582
|
-
type: 'copy-button',
|
|
583
|
-
supportsViewMode: true,
|
|
584
|
-
items: [{
|
|
585
|
-
state: state,
|
|
586
|
-
formatMessage: intl.formatMessage,
|
|
587
|
-
nodeType: node.type
|
|
588
|
-
}]
|
|
589
|
-
}, {
|
|
590
|
-
type: 'separator'
|
|
591
|
-
}, getSettingsButton(intl, editorAnalyticsApi, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.userPreferencesLink), {
|
|
592
|
-
type: 'separator'
|
|
593
|
-
}, {
|
|
594
|
-
id: 'editor.link.delete',
|
|
595
|
-
focusEditoronEnter: true,
|
|
596
|
-
type: 'button',
|
|
597
|
-
appearance: 'danger',
|
|
598
|
-
icon: _delete.default,
|
|
599
|
-
iconFallback: _remove.default,
|
|
600
|
-
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
601
|
-
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
602
|
-
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
603
|
-
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
604
|
-
title: intl.formatMessage(_messages.default.remove),
|
|
605
|
-
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
606
|
-
});
|
|
607
639
|
return toolbarItems;
|
|
608
640
|
};
|
|
609
641
|
var shouldRenderToolbarPulse = exports.shouldRenderToolbarPulse = function shouldRenderToolbarPulse(embedEnabled, appearance, status, isDiscoverabilityEnabled) {
|
|
@@ -248,7 +248,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
248
248
|
lpLinkPicker
|
|
249
249
|
})];
|
|
250
250
|
} else if (shouldRenderDatasourceToolbar) {
|
|
251
|
-
return getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, node.attrs.datasource.id, state, cardOptions, currentAppearance);
|
|
251
|
+
return getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, node.attrs.datasource.id, state, cardOptions, currentAppearance, pluginInjectionApi);
|
|
252
252
|
} else {
|
|
253
253
|
var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$c3;
|
|
254
254
|
const {
|
|
@@ -419,7 +419,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
419
419
|
}, {
|
|
420
420
|
type: 'overflow-dropdown',
|
|
421
421
|
options: [{
|
|
422
|
-
title:
|
|
422
|
+
title: intl.formatMessage(commonMessages.copyToClipboard),
|
|
423
423
|
onClick: () => {
|
|
424
424
|
var _pluginInjectionApi$c4, _pluginInjectionApi$f;
|
|
425
425
|
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c4 = pluginInjectionApi.core) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.actions.execute( // @ts-ignore
|
|
@@ -427,13 +427,13 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
427
427
|
return true;
|
|
428
428
|
},
|
|
429
429
|
icon: /*#__PURE__*/React.createElement(CopyIcon, {
|
|
430
|
-
label:
|
|
430
|
+
label: intl.formatMessage(commonMessages.copyToClipboard)
|
|
431
431
|
})
|
|
432
432
|
}, {
|
|
433
|
-
title:
|
|
433
|
+
title: intl.formatMessage(commonMessages.delete),
|
|
434
434
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
|
|
435
435
|
icon: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
436
|
-
label:
|
|
436
|
+
label: intl.formatMessage(commonMessages.delete)
|
|
437
437
|
})
|
|
438
438
|
}]
|
|
439
439
|
}];
|
|
@@ -467,7 +467,7 @@ export const getSettingsButton = (intl, editorAnalyticsApi, userPreferencesLink)
|
|
|
467
467
|
target: '_blank'
|
|
468
468
|
};
|
|
469
469
|
};
|
|
470
|
-
const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hoverDecoration, datasourceId, state, cardOptions, currentAppearance) => {
|
|
470
|
+
const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hoverDecoration, datasourceId, state, cardOptions, currentAppearance, pluginInjectionApi) => {
|
|
471
471
|
var _node$attrs2;
|
|
472
472
|
const toolbarItems = [];
|
|
473
473
|
const canShowAppearanceSwitch = () => {
|
|
@@ -563,36 +563,68 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
563
563
|
className: 'hyperlink-open-link',
|
|
564
564
|
title: intl.formatMessage(linkMessages.openLink),
|
|
565
565
|
onClick: visitCardLink(editorAnalyticsApi)
|
|
566
|
+
});
|
|
567
|
+
if (editorExperiment('platform_editor_controls', 'control')) {
|
|
568
|
+
toolbarItems.push({
|
|
569
|
+
type: 'separator'
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
if (editorExperiment('platform_editor_controls', 'control')) {
|
|
574
|
+
toolbarItems.push({
|
|
575
|
+
type: 'copy-button',
|
|
576
|
+
supportsViewMode: true,
|
|
577
|
+
items: [{
|
|
578
|
+
state,
|
|
579
|
+
formatMessage: intl.formatMessage,
|
|
580
|
+
nodeType: node.type
|
|
581
|
+
}]
|
|
566
582
|
}, {
|
|
567
583
|
type: 'separator'
|
|
584
|
+
}, getSettingsButton(intl, editorAnalyticsApi, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.userPreferencesLink), {
|
|
585
|
+
type: 'separator'
|
|
586
|
+
}, {
|
|
587
|
+
id: 'editor.link.delete',
|
|
588
|
+
focusEditoronEnter: true,
|
|
589
|
+
type: 'button',
|
|
590
|
+
appearance: 'danger',
|
|
591
|
+
icon: DeleteIcon,
|
|
592
|
+
iconFallback: RemoveIcon,
|
|
593
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
594
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
595
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
596
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
597
|
+
title: intl.formatMessage(commonMessages.remove),
|
|
598
|
+
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
599
|
+
});
|
|
600
|
+
} else {
|
|
601
|
+
toolbarItems.push({
|
|
602
|
+
type: 'separator',
|
|
603
|
+
fullHeight: true
|
|
568
604
|
});
|
|
605
|
+
const overflowMenuConfig = [{
|
|
606
|
+
type: 'overflow-dropdown',
|
|
607
|
+
options: [{
|
|
608
|
+
title: intl.formatMessage(commonMessages.copyToClipboard),
|
|
609
|
+
onClick: () => {
|
|
610
|
+
var _pluginInjectionApi$c5, _pluginInjectionApi$f2;
|
|
611
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c5 = pluginInjectionApi.core) === null || _pluginInjectionApi$c5 === void 0 ? void 0 : _pluginInjectionApi$c5.actions.execute( // @ts-ignore
|
|
612
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f2 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.commands.copyNode(node.type));
|
|
613
|
+
return true;
|
|
614
|
+
},
|
|
615
|
+
icon: /*#__PURE__*/React.createElement(CopyIcon, {
|
|
616
|
+
label: intl.formatMessage(commonMessages.copyToClipboard)
|
|
617
|
+
})
|
|
618
|
+
}, {
|
|
619
|
+
title: intl.formatMessage(commonMessages.delete),
|
|
620
|
+
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
|
|
621
|
+
icon: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
622
|
+
label: intl.formatMessage(commonMessages.delete)
|
|
623
|
+
})
|
|
624
|
+
}]
|
|
625
|
+
}];
|
|
626
|
+
toolbarItems.push(...overflowMenuConfig);
|
|
569
627
|
}
|
|
570
|
-
toolbarItems.push({
|
|
571
|
-
type: 'copy-button',
|
|
572
|
-
supportsViewMode: true,
|
|
573
|
-
items: [{
|
|
574
|
-
state,
|
|
575
|
-
formatMessage: intl.formatMessage,
|
|
576
|
-
nodeType: node.type
|
|
577
|
-
}]
|
|
578
|
-
}, {
|
|
579
|
-
type: 'separator'
|
|
580
|
-
}, getSettingsButton(intl, editorAnalyticsApi, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.userPreferencesLink), {
|
|
581
|
-
type: 'separator'
|
|
582
|
-
}, {
|
|
583
|
-
id: 'editor.link.delete',
|
|
584
|
-
focusEditoronEnter: true,
|
|
585
|
-
type: 'button',
|
|
586
|
-
appearance: 'danger',
|
|
587
|
-
icon: DeleteIcon,
|
|
588
|
-
iconFallback: RemoveIcon,
|
|
589
|
-
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
590
|
-
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
591
|
-
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
592
|
-
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
593
|
-
title: intl.formatMessage(commonMessages.remove),
|
|
594
|
-
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
595
|
-
});
|
|
596
628
|
return toolbarItems;
|
|
597
629
|
};
|
|
598
630
|
export const shouldRenderToolbarPulse = (embedEnabled, appearance, status, isDiscoverabilityEnabled) => {
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -246,7 +246,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
246
246
|
lpLinkPicker: lpLinkPicker
|
|
247
247
|
})];
|
|
248
248
|
} else if (shouldRenderDatasourceToolbar) {
|
|
249
|
-
return getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, node.attrs.datasource.id, state, cardOptions, currentAppearance);
|
|
249
|
+
return getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, node.attrs.datasource.id, state, cardOptions, currentAppearance, pluginInjectionApi);
|
|
250
250
|
} else {
|
|
251
251
|
var _pluginInjectionApi$c;
|
|
252
252
|
var inlineCard = state.schema.nodes.inlineCard;
|
|
@@ -419,7 +419,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
419
419
|
}, {
|
|
420
420
|
type: 'overflow-dropdown',
|
|
421
421
|
options: [{
|
|
422
|
-
title:
|
|
422
|
+
title: intl.formatMessage(commonMessages.copyToClipboard),
|
|
423
423
|
onClick: function onClick() {
|
|
424
424
|
var _pluginInjectionApi$c2, _pluginInjectionApi$f;
|
|
425
425
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 || _pluginInjectionApi$c2.actions.execute( // @ts-ignore
|
|
@@ -427,13 +427,13 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
427
427
|
return true;
|
|
428
428
|
},
|
|
429
429
|
icon: /*#__PURE__*/React.createElement(CopyIcon, {
|
|
430
|
-
label:
|
|
430
|
+
label: intl.formatMessage(commonMessages.copyToClipboard)
|
|
431
431
|
})
|
|
432
432
|
}, {
|
|
433
|
-
title:
|
|
433
|
+
title: intl.formatMessage(commonMessages.delete),
|
|
434
434
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
|
|
435
435
|
icon: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
436
|
-
label:
|
|
436
|
+
label: intl.formatMessage(commonMessages.delete)
|
|
437
437
|
})
|
|
438
438
|
}]
|
|
439
439
|
}];
|
|
@@ -468,7 +468,7 @@ export var getSettingsButton = function getSettingsButton(intl, editorAnalyticsA
|
|
|
468
468
|
target: '_blank'
|
|
469
469
|
};
|
|
470
470
|
};
|
|
471
|
-
var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, datasourceId, state, cardOptions, currentAppearance) {
|
|
471
|
+
var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, datasourceId, state, cardOptions, currentAppearance, pluginInjectionApi) {
|
|
472
472
|
var _node$attrs2;
|
|
473
473
|
var toolbarItems = [];
|
|
474
474
|
var canShowAppearanceSwitch = function canShowAppearanceSwitch() {
|
|
@@ -564,36 +564,68 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
564
564
|
className: 'hyperlink-open-link',
|
|
565
565
|
title: intl.formatMessage(linkMessages.openLink),
|
|
566
566
|
onClick: visitCardLink(editorAnalyticsApi)
|
|
567
|
+
});
|
|
568
|
+
if (editorExperiment('platform_editor_controls', 'control')) {
|
|
569
|
+
toolbarItems.push({
|
|
570
|
+
type: 'separator'
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
if (editorExperiment('platform_editor_controls', 'control')) {
|
|
575
|
+
toolbarItems.push({
|
|
576
|
+
type: 'copy-button',
|
|
577
|
+
supportsViewMode: true,
|
|
578
|
+
items: [{
|
|
579
|
+
state: state,
|
|
580
|
+
formatMessage: intl.formatMessage,
|
|
581
|
+
nodeType: node.type
|
|
582
|
+
}]
|
|
567
583
|
}, {
|
|
568
584
|
type: 'separator'
|
|
585
|
+
}, getSettingsButton(intl, editorAnalyticsApi, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.userPreferencesLink), {
|
|
586
|
+
type: 'separator'
|
|
587
|
+
}, {
|
|
588
|
+
id: 'editor.link.delete',
|
|
589
|
+
focusEditoronEnter: true,
|
|
590
|
+
type: 'button',
|
|
591
|
+
appearance: 'danger',
|
|
592
|
+
icon: DeleteIcon,
|
|
593
|
+
iconFallback: RemoveIcon,
|
|
594
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
595
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
596
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
597
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
598
|
+
title: intl.formatMessage(commonMessages.remove),
|
|
599
|
+
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
569
600
|
});
|
|
601
|
+
} else {
|
|
602
|
+
toolbarItems.push({
|
|
603
|
+
type: 'separator',
|
|
604
|
+
fullHeight: true
|
|
605
|
+
});
|
|
606
|
+
var overflowMenuConfig = [{
|
|
607
|
+
type: 'overflow-dropdown',
|
|
608
|
+
options: [{
|
|
609
|
+
title: intl.formatMessage(commonMessages.copyToClipboard),
|
|
610
|
+
onClick: function onClick() {
|
|
611
|
+
var _pluginInjectionApi$c3, _pluginInjectionApi$f2;
|
|
612
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.core) === null || _pluginInjectionApi$c3 === void 0 || _pluginInjectionApi$c3.actions.execute( // @ts-ignore
|
|
613
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f2 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.commands.copyNode(node.type));
|
|
614
|
+
return true;
|
|
615
|
+
},
|
|
616
|
+
icon: /*#__PURE__*/React.createElement(CopyIcon, {
|
|
617
|
+
label: intl.formatMessage(commonMessages.copyToClipboard)
|
|
618
|
+
})
|
|
619
|
+
}, {
|
|
620
|
+
title: intl.formatMessage(commonMessages.delete),
|
|
621
|
+
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
|
|
622
|
+
icon: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
623
|
+
label: intl.formatMessage(commonMessages.delete)
|
|
624
|
+
})
|
|
625
|
+
}]
|
|
626
|
+
}];
|
|
627
|
+
toolbarItems.push.apply(toolbarItems, overflowMenuConfig);
|
|
570
628
|
}
|
|
571
|
-
toolbarItems.push({
|
|
572
|
-
type: 'copy-button',
|
|
573
|
-
supportsViewMode: true,
|
|
574
|
-
items: [{
|
|
575
|
-
state: state,
|
|
576
|
-
formatMessage: intl.formatMessage,
|
|
577
|
-
nodeType: node.type
|
|
578
|
-
}]
|
|
579
|
-
}, {
|
|
580
|
-
type: 'separator'
|
|
581
|
-
}, getSettingsButton(intl, editorAnalyticsApi, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.userPreferencesLink), {
|
|
582
|
-
type: 'separator'
|
|
583
|
-
}, {
|
|
584
|
-
id: 'editor.link.delete',
|
|
585
|
-
focusEditoronEnter: true,
|
|
586
|
-
type: 'button',
|
|
587
|
-
appearance: 'danger',
|
|
588
|
-
icon: DeleteIcon,
|
|
589
|
-
iconFallback: RemoveIcon,
|
|
590
|
-
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
591
|
-
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
592
|
-
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
593
|
-
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
594
|
-
title: intl.formatMessage(commonMessages.remove),
|
|
595
|
-
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
596
|
-
});
|
|
597
629
|
return toolbarItems;
|
|
598
630
|
};
|
|
599
631
|
export var shouldRenderToolbarPulse = function shouldRenderToolbarPulse(embedEnabled, appearance, status, isDiscoverabilityEnabled) {
|