@atlaskit/editor-plugin-card 2.0.3 → 2.0.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 +21 -0
- package/dist/cjs/nodeviews/datasource.js +3 -1
- package/dist/cjs/pm-plugins/doc.js +2 -0
- package/dist/cjs/toolbar.js +28 -26
- package/dist/cjs/ui/AwarenessWrapper/index.js +1 -1
- package/dist/cjs/ui/EditLinkToolbar.js +2 -1
- package/dist/cjs/ui/EditToolbarButton.js +97 -65
- package/dist/cjs/ui/HyperlinkToolbarAppearance.js +2 -1
- package/dist/cjs/ui/InlineCardOverlay/index.js +4 -0
- package/dist/cjs/ui/LayoutButton/index.js +2 -0
- package/dist/cjs/ui/LeftIconOverlay/ConfigureLinkDropdown/index.js +5 -5
- package/dist/cjs/ui/LeftIconOverlay/index.js +6 -1
- package/dist/cjs/ui/ResizableEmbedCard.js +2 -0
- package/dist/es2019/nodeviews/datasource.js +3 -1
- package/dist/es2019/pm-plugins/doc.js +2 -0
- package/dist/es2019/toolbar.js +24 -22
- package/dist/es2019/ui/AwarenessWrapper/index.js +1 -1
- package/dist/es2019/ui/EditLinkToolbar.js +2 -1
- package/dist/es2019/ui/EditToolbarButton.js +95 -62
- package/dist/es2019/ui/HyperlinkToolbarAppearance.js +2 -1
- package/dist/es2019/ui/InlineCardOverlay/index.js +6 -0
- package/dist/es2019/ui/LayoutButton/index.js +2 -0
- package/dist/es2019/ui/LeftIconOverlay/ConfigureLinkDropdown/index.js +12 -12
- package/dist/es2019/ui/LeftIconOverlay/index.js +6 -1
- package/dist/es2019/ui/ResizableEmbedCard.js +2 -0
- package/dist/esm/nodeviews/datasource.js +3 -1
- package/dist/esm/pm-plugins/doc.js +2 -0
- package/dist/esm/toolbar.js +28 -26
- package/dist/esm/ui/AwarenessWrapper/index.js +1 -1
- package/dist/esm/ui/EditLinkToolbar.js +2 -1
- package/dist/esm/ui/EditToolbarButton.js +98 -66
- package/dist/esm/ui/HyperlinkToolbarAppearance.js +2 -1
- package/dist/esm/ui/InlineCardOverlay/index.js +4 -0
- package/dist/esm/ui/LayoutButton/index.js +2 -0
- package/dist/esm/ui/LeftIconOverlay/ConfigureLinkDropdown/index.js +12 -12
- package/dist/esm/ui/LeftIconOverlay/index.js +6 -1
- package/dist/esm/ui/ResizableEmbedCard.js +2 -0
- package/dist/types/ui/EditLinkToolbar.d.ts +1 -1
- package/dist/types/ui/EditToolbarButton.d.ts +3 -2
- package/dist/types-ts4.5/ui/EditLinkToolbar.d.ts +1 -1
- package/dist/types-ts4.5/ui/EditToolbarButton.d.ts +3 -2
- package/package.json +129 -147
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 2.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#110890](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110890)
|
|
8
|
+
[`a0ec52861fce2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a0ec52861fce2) -
|
|
9
|
+
[ux] Fixed a duplicate separator showing in the floating toolbar.
|
|
10
|
+
- [#110903](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110903)
|
|
11
|
+
[`7fafce0ccd594`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7fafce0ccd594) -
|
|
12
|
+
[ux] Clicking edit link or edit datasource while in SLLV view will no longer trigger scrolling.
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 2.0.4
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#108600](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/108600)
|
|
20
|
+
[`ab0ef9cd9d368`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ab0ef9cd9d368) -
|
|
21
|
+
[ux] Fixed the toolbar edit button in the new dropdown button for assets.
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 2.0.3
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -284,7 +284,9 @@ var Datasource = exports.Datasource = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
284
284
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
285
285
|
className: _styles.DATASOURCE_INNER_CONTAINER_CLASSNAME,
|
|
286
286
|
style: {
|
|
287
|
-
minWidth: this.isNodeNested ? '100%' :
|
|
287
|
+
minWidth: this.isNodeNested ? '100%' :
|
|
288
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
289
|
+
(0, _utils.calcBreakoutWidth)(attrs.layout || _linkingCommon.DATASOURCE_DEFAULT_LAYOUT, this.tableWidth)
|
|
288
290
|
}
|
|
289
291
|
}, (0, _react2.jsx)(DatasourceComponent, {
|
|
290
292
|
node: this.node,
|
|
@@ -622,6 +622,8 @@ var getStartingToolbarItems = exports.getStartingToolbarItems = function getStar
|
|
|
622
622
|
title: intl.formatMessage(_messages.linkToolbarMessages.editLink),
|
|
623
623
|
showTitle: true,
|
|
624
624
|
metadata: metadata
|
|
625
|
+
}, {
|
|
626
|
+
type: 'separator'
|
|
625
627
|
}];
|
|
626
628
|
return [{
|
|
627
629
|
type: 'custom',
|
package/dist/cjs/toolbar.js
CHANGED
|
@@ -226,7 +226,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
226
226
|
} else {
|
|
227
227
|
var inlineCard = state.schema.nodes.inlineCard;
|
|
228
228
|
var isEditDropdownEnabled = (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.enable-datasource-edit-dropdown-toolbar') && platform !== 'mobile' && cardOptions.allowDatasource;
|
|
229
|
-
var
|
|
229
|
+
var editItems = isEditDropdownEnabled ? [{
|
|
230
230
|
type: 'custom',
|
|
231
231
|
fallback: [],
|
|
232
232
|
render: function render(editorView) {
|
|
@@ -236,10 +236,10 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
236
236
|
intl: intl,
|
|
237
237
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
238
238
|
editorView: editorView,
|
|
239
|
-
onLinkEditClick: (0, _EditLinkToolbar.editLink)(editorAnalyticsApi)
|
|
239
|
+
onLinkEditClick: (0, _EditLinkToolbar.editLink)(editorAnalyticsApi, true)
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
|
-
} : {
|
|
242
|
+
}] : [{
|
|
243
243
|
id: 'editor.link.edit',
|
|
244
244
|
type: 'button',
|
|
245
245
|
selected: false,
|
|
@@ -247,10 +247,11 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
247
247
|
title: intl.formatMessage(_messages.linkToolbarMessages.editLink),
|
|
248
248
|
showTitle: true,
|
|
249
249
|
testId: 'link-toolbar-edit-link-button',
|
|
250
|
-
onClick: (0, _EditLinkToolbar.editLink)(editorAnalyticsApi)
|
|
250
|
+
onClick: (0, _EditLinkToolbar.editLink)(editorAnalyticsApi, true)
|
|
251
251
|
}, {
|
|
252
252
|
type: 'separator'
|
|
253
|
-
}
|
|
253
|
+
}];
|
|
254
|
+
var toolbarItems = [].concat(editItems, [{
|
|
254
255
|
id: 'editor.link.openLink',
|
|
255
256
|
type: 'button',
|
|
256
257
|
icon: _shortcut.default,
|
|
@@ -260,7 +261,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
260
261
|
onClick: visitCardLink(editorAnalyticsApi)
|
|
261
262
|
}, {
|
|
262
263
|
type: 'separator'
|
|
263
|
-
}]
|
|
264
|
+
}], (0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [{
|
|
264
265
|
type: 'copy-button',
|
|
265
266
|
supportsViewMode: true,
|
|
266
267
|
items: [{
|
|
@@ -410,23 +411,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
410
411
|
type: 'separator'
|
|
411
412
|
});
|
|
412
413
|
}
|
|
413
|
-
var
|
|
414
|
-
type: 'custom',
|
|
415
|
-
fallback: [],
|
|
416
|
-
render: function render(editorView) {
|
|
417
|
-
return /*#__PURE__*/_react.default.createElement(_EditToolbarButton.EditToolbarButton, {
|
|
418
|
-
key: "edit-toolbar-item",
|
|
419
|
-
url: metadata.url,
|
|
420
|
-
intl: intl,
|
|
421
|
-
editorAnalyticsApi: editorAnalyticsApi,
|
|
422
|
-
editorView: editorView,
|
|
423
|
-
onLinkEditClick: (0, _EditLinkToolbar.editLink)(editorAnalyticsApi)
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
}, {
|
|
427
|
-
type: 'separator'
|
|
428
|
-
}];
|
|
429
|
-
var canShowMainToolbar = function canShowMainToolbar() {
|
|
414
|
+
var canShowAppearanceSwitch = function canShowAppearanceSwitch() {
|
|
430
415
|
// we do not show smart-link or the datasource icons when the node does not have a url to resolve
|
|
431
416
|
if (!metadata.url) {
|
|
432
417
|
return false;
|
|
@@ -440,12 +425,12 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
440
425
|
// FF to enable additional toolbar buttons based on if the datasource is configurable or not
|
|
441
426
|
return (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource-enable-toolbar-buttons-for-all-datasources') ? true : !(0, _utils3.isDatasourceConfigEditable)(datasourceId);
|
|
442
427
|
};
|
|
443
|
-
if (
|
|
428
|
+
if (canShowAppearanceSwitch()) {
|
|
444
429
|
var allowBlockCards = cardOptions.allowBlockCards,
|
|
445
430
|
allowEmbeds = cardOptions.allowEmbeds,
|
|
446
431
|
showUpgradeDiscoverability = cardOptions.showUpgradeDiscoverability;
|
|
447
432
|
var url = metadata.url;
|
|
448
|
-
toolbarItems.push
|
|
433
|
+
toolbarItems.push({
|
|
449
434
|
type: 'custom',
|
|
450
435
|
fallback: [],
|
|
451
436
|
render: function render(editorView) {
|
|
@@ -480,7 +465,24 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
480
465
|
}
|
|
481
466
|
}, {
|
|
482
467
|
type: 'separator'
|
|
483
|
-
}
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.enable-datasource-edit-dropdown-toolbar')) {
|
|
471
|
+
toolbarItems.push({
|
|
472
|
+
type: 'custom',
|
|
473
|
+
fallback: [],
|
|
474
|
+
render: function render(editorView) {
|
|
475
|
+
return /*#__PURE__*/_react.default.createElement(_EditToolbarButton.EditToolbarButton, {
|
|
476
|
+
datasourceId: datasourceId,
|
|
477
|
+
key: "edit-toolbar-item",
|
|
478
|
+
url: metadata.url,
|
|
479
|
+
intl: intl,
|
|
480
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
481
|
+
editorView: editorView,
|
|
482
|
+
onLinkEditClick: (0, _EditLinkToolbar.editLink)(editorAnalyticsApi, false)
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
});
|
|
484
486
|
}
|
|
485
487
|
if (node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.url) {
|
|
486
488
|
toolbarItems.push({
|
|
@@ -21,7 +21,7 @@ var _Pulse = require("../Pulse");
|
|
|
21
21
|
// editor adds a standard line-height that is bigger than an inline smart link
|
|
22
22
|
// due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
|
|
23
23
|
var loaderWrapperStyles = (0, _react2.css)({
|
|
24
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
24
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
25
25
|
'.loader-wrapper': {
|
|
26
26
|
lineHeight: 'normal'
|
|
27
27
|
}
|
|
@@ -133,7 +133,7 @@ var EditLinkToolbar = exports.EditLinkToolbar = /*#__PURE__*/function (_React$Co
|
|
|
133
133
|
}]);
|
|
134
134
|
return EditLinkToolbar;
|
|
135
135
|
}(_react.default.Component);
|
|
136
|
-
var editLink = exports.editLink = function editLink(editorAnalyticsApi) {
|
|
136
|
+
var editLink = exports.editLink = function editLink(editorAnalyticsApi, scrollIntoView) {
|
|
137
137
|
return function (state, dispatch) {
|
|
138
138
|
var type = 'hyperlink';
|
|
139
139
|
if (state.selection instanceof _state.NodeSelection) {
|
|
@@ -143,6 +143,7 @@ var editLink = exports.editLink = function editLink(editorAnalyticsApi) {
|
|
|
143
143
|
var tr = state.tr;
|
|
144
144
|
(0, _actions.showLinkToolbar)(tr);
|
|
145
145
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent((0, _analytics.buildEditLinkPayload)(type))(tr);
|
|
146
|
+
tr.setMeta('scrollIntoView', scrollIntoView);
|
|
146
147
|
dispatch(tr);
|
|
147
148
|
return true;
|
|
148
149
|
}
|
|
@@ -24,19 +24,20 @@ var _useFetchDatasourceInfo = require("./useFetchDatasourceInfo");
|
|
|
24
24
|
var dropdownExpandContainer = (0, _react2.css)({
|
|
25
25
|
margin: "0px ".concat("var(--ds-space-negative-050, -4px)")
|
|
26
26
|
});
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
27
|
+
var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext(props) {
|
|
28
|
+
var _response$datasourceI;
|
|
29
|
+
var url = props.url,
|
|
30
|
+
cardContext = props.cardContext,
|
|
31
|
+
intl = props.intl,
|
|
32
|
+
editorAnalyticsApi = props.editorAnalyticsApi,
|
|
33
|
+
editorView = props.editorView,
|
|
34
|
+
onLinkEditClick = props.onLinkEditClick;
|
|
35
|
+
var response = (0, _useFetchDatasourceInfo.useFetchDatasourceInfo)({
|
|
36
|
+
isRegularCardNode: true,
|
|
37
|
+
url: url,
|
|
38
|
+
cardContext: cardContext
|
|
39
|
+
});
|
|
40
|
+
var datasourceId = (_response$datasourceI = response.datasourceId) !== null && _response$datasourceI !== void 0 ? _response$datasourceI : props.datasourceId;
|
|
40
41
|
var _useState = (0, _react.useState)(false),
|
|
41
42
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
42
43
|
isOpen = _useState2[0],
|
|
@@ -61,73 +62,104 @@ var EditButtonWithCardContext = function EditButtonWithCardContext(_ref) {
|
|
|
61
62
|
var onEditLink = (0, _react.useCallback)(function () {
|
|
62
63
|
dispatchCommand(onLinkEditClick);
|
|
63
64
|
}, [dispatchCommand, onLinkEditClick]);
|
|
64
|
-
var
|
|
65
|
+
var editVariant = (0, _react.useMemo)(function () {
|
|
66
|
+
var hasUrl = url !== null && url !== undefined;
|
|
65
67
|
if (!datasourceId || !(0, _utils.isDatasourceConfigEditable)(datasourceId)) {
|
|
66
|
-
|
|
68
|
+
if (hasUrl) {
|
|
69
|
+
return 'edit-link';
|
|
70
|
+
}
|
|
71
|
+
return 'none';
|
|
67
72
|
}
|
|
68
|
-
if (
|
|
73
|
+
if (hasUrl) {
|
|
69
74
|
var _cardContext$store, _urlState$error;
|
|
70
75
|
var urlState = cardContext === null || cardContext === void 0 || (_cardContext$store = cardContext.store) === null || _cardContext$store === void 0 ? void 0 : _cardContext$store.getState()[url];
|
|
71
76
|
if ((urlState === null || urlState === void 0 || (_urlState$error = urlState.error) === null || _urlState$error === void 0 ? void 0 : _urlState$error.kind) === 'fatal') {
|
|
72
|
-
return
|
|
77
|
+
return 'edit-link';
|
|
73
78
|
}
|
|
79
|
+
return 'edit-dropdown';
|
|
80
|
+
} else {
|
|
81
|
+
return 'edit-datasource';
|
|
74
82
|
}
|
|
75
|
-
return false;
|
|
76
83
|
}, [cardContext === null || cardContext === void 0 ? void 0 : cardContext.store, datasourceId, url]);
|
|
77
84
|
var onEditDatasource = (0, _react.useCallback)(function () {
|
|
78
85
|
if (datasourceId) {
|
|
79
86
|
dispatchCommand((0, _doc.editDatasource)(datasourceId, editorAnalyticsApi));
|
|
80
87
|
}
|
|
81
88
|
}, [dispatchCommand, datasourceId, editorAnalyticsApi]);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
switch (editVariant) {
|
|
90
|
+
case 'edit-link':
|
|
91
|
+
{
|
|
92
|
+
return (0, _react2.jsx)(_primitives.Flex, {
|
|
93
|
+
gap: "space.050"
|
|
94
|
+
}, (0, _react2.jsx)(_ui.FloatingToolbarButton, {
|
|
95
|
+
testId: "edit-link",
|
|
96
|
+
onClick: onEditLink
|
|
97
|
+
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.linkToolbarMessages.editLink)), (0, _react2.jsx)(_ui.FloatingToolbarSeparator, null));
|
|
98
|
+
}
|
|
99
|
+
case 'edit-datasource':
|
|
100
|
+
{
|
|
101
|
+
return (0, _react2.jsx)(_primitives.Flex, {
|
|
102
|
+
gap: "space.050"
|
|
103
|
+
}, (0, _react2.jsx)(_ui.FloatingToolbarButton, {
|
|
104
|
+
testId: "edit-datasource",
|
|
105
|
+
tooltipContent: intl.formatMessage(_messages.linkToolbarMessages.editDatasourceStandaloneTooltip),
|
|
106
|
+
onClick: onEditDatasource
|
|
107
|
+
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.linkToolbarMessages.editDatasourceStandalone)), (0, _react2.jsx)(_ui.FloatingToolbarSeparator, null));
|
|
108
|
+
}
|
|
109
|
+
case 'edit-dropdown':
|
|
110
|
+
{
|
|
111
|
+
var trigger = (0, _react2.jsx)(_primitives.Flex, {
|
|
112
|
+
gap: "space.050"
|
|
113
|
+
}, (0, _react2.jsx)(_ui.FloatingToolbarButton, {
|
|
114
|
+
testId: "edit-dropdown-trigger",
|
|
115
|
+
iconAfter: (0, _react2.jsx)("span", {
|
|
116
|
+
css: dropdownExpandContainer
|
|
117
|
+
}, (0, _react2.jsx)(_chevronDown.default, {
|
|
118
|
+
label: intl.formatMessage(_messages.cardMessages.editDropdownTriggerTitle)
|
|
119
|
+
})),
|
|
120
|
+
onClick: toggleOpen,
|
|
121
|
+
selected: isOpen,
|
|
122
|
+
disabled: false,
|
|
123
|
+
ariaHasPopup: true
|
|
124
|
+
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.cardMessages.editDropdownTriggerTitle)), (0, _react2.jsx)(_ui.FloatingToolbarSeparator, null));
|
|
125
|
+
return (0, _react2.jsx)(_primitives.Flex, {
|
|
126
|
+
ref: containerRef
|
|
127
|
+
}, (0, _react2.jsx)(_uiMenu.DropdownContainer, {
|
|
128
|
+
mountTo: containerRef.current,
|
|
129
|
+
isOpen: isOpen,
|
|
130
|
+
handleClickOutside: onClose,
|
|
131
|
+
handleEscapeKeydown: onClose,
|
|
132
|
+
trigger: trigger,
|
|
133
|
+
scrollableElement: containerRef.current,
|
|
134
|
+
arrowKeyNavigationProviderOptions: {
|
|
135
|
+
type: _uiMenu.ArrowKeyNavigationType.MENU
|
|
136
|
+
}
|
|
137
|
+
}, (0, _react2.jsx)(_menu.ButtonItem, {
|
|
138
|
+
key: "edit.link",
|
|
139
|
+
onClick: onEditLink,
|
|
140
|
+
testId: "edit-dropdown-edit-link-item"
|
|
141
|
+
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.cardMessages.editDropdownEditLinkTitle)), (0, _react2.jsx)(_menu.ButtonItem, {
|
|
142
|
+
key: "edit.datasource",
|
|
143
|
+
onClick: onEditDatasource,
|
|
144
|
+
testId: "edit-dropdown-edit-datasource-item"
|
|
145
|
+
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.cardMessages.editDropdownEditDatasourceTitle))));
|
|
146
|
+
}
|
|
147
|
+
case 'none':
|
|
148
|
+
default:
|
|
149
|
+
return null;
|
|
87
150
|
}
|
|
88
|
-
var trigger = (0, _react2.jsx)(_ui.FloatingToolbarButton, {
|
|
89
|
-
testId: "edit-dropdown-trigger",
|
|
90
|
-
iconAfter: (0, _react2.jsx)("span", {
|
|
91
|
-
css: dropdownExpandContainer
|
|
92
|
-
}, (0, _react2.jsx)(_chevronDown.default, {
|
|
93
|
-
label: intl.formatMessage(_messages.cardMessages.editDropdownTriggerTitle)
|
|
94
|
-
})),
|
|
95
|
-
onClick: toggleOpen,
|
|
96
|
-
selected: isOpen,
|
|
97
|
-
disabled: false,
|
|
98
|
-
ariaHasPopup: true
|
|
99
|
-
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.cardMessages.editDropdownTriggerTitle));
|
|
100
|
-
return (0, _react2.jsx)(_primitives.Flex, {
|
|
101
|
-
ref: containerRef
|
|
102
|
-
}, (0, _react2.jsx)(_uiMenu.DropdownContainer, {
|
|
103
|
-
mountTo: containerRef.current,
|
|
104
|
-
isOpen: isOpen,
|
|
105
|
-
handleClickOutside: onClose,
|
|
106
|
-
handleEscapeKeydown: onClose,
|
|
107
|
-
trigger: trigger,
|
|
108
|
-
scrollableElement: containerRef.current,
|
|
109
|
-
arrowKeyNavigationProviderOptions: {
|
|
110
|
-
type: _uiMenu.ArrowKeyNavigationType.MENU
|
|
111
|
-
}
|
|
112
|
-
}, (0, _react2.jsx)(_menu.ButtonItem, {
|
|
113
|
-
key: "edit.link",
|
|
114
|
-
onClick: onEditLink,
|
|
115
|
-
testId: "edit-dropdown-edit-link-item"
|
|
116
|
-
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.cardMessages.editDropdownEditLinkTitle)), (0, _react2.jsx)(_menu.ButtonItem, {
|
|
117
|
-
key: "edit.datasource",
|
|
118
|
-
onClick: onEditDatasource,
|
|
119
|
-
testId: "edit-dropdown-edit-datasource-item"
|
|
120
|
-
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.cardMessages.editDropdownEditDatasourceTitle))));
|
|
121
151
|
};
|
|
122
|
-
var EditToolbarButton = exports.EditToolbarButton = function EditToolbarButton(
|
|
123
|
-
var
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
152
|
+
var EditToolbarButton = exports.EditToolbarButton = function EditToolbarButton(props) {
|
|
153
|
+
var datasourceId = props.datasourceId,
|
|
154
|
+
intl = props.intl,
|
|
155
|
+
editorAnalyticsApi = props.editorAnalyticsApi,
|
|
156
|
+
url = props.url,
|
|
157
|
+
editorView = props.editorView,
|
|
158
|
+
onLinkEditClick = props.onLinkEditClick;
|
|
159
|
+
return (0, _react2.jsx)(_CardContextProvider.CardContextProvider, null, function (_ref) {
|
|
160
|
+
var cardContext = _ref.cardContext;
|
|
161
|
+
return (0, _react2.jsx)(EditToolbarButtonWithCardContext, {
|
|
162
|
+
datasourceId: datasourceId,
|
|
131
163
|
url: url,
|
|
132
164
|
intl: intl,
|
|
133
165
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
@@ -17,6 +17,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
17
17
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
19
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
20
|
+
var _ui = require("@atlaskit/editor-common/ui");
|
|
20
21
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
22
|
var _primitives = require("@atlaskit/primitives");
|
|
22
23
|
var _DatasourceAppearanceButton = require("./DatasourceAppearanceButton");
|
|
@@ -183,7 +184,7 @@ var HyperlinkToolbarAppearance = exports.HyperlinkToolbarAppearance = /*#__PURE_
|
|
|
183
184
|
editorView: editorView,
|
|
184
185
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
185
186
|
inputMethod: _analytics.INPUT_METHOD.FLOATING_TB
|
|
186
|
-
}));
|
|
187
|
+
}), /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarSeparator, null));
|
|
187
188
|
}
|
|
188
189
|
}]);
|
|
189
190
|
return HyperlinkToolbarAppearance;
|
|
@@ -43,9 +43,11 @@ var getGradientWithColor = function getGradientWithColor(color) {
|
|
|
43
43
|
var containerStyles = (0, _react2.css)({
|
|
44
44
|
position: 'relative',
|
|
45
45
|
lineHeight: 'normal',
|
|
46
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
46
47
|
':active': (_active = {}, (0, _defineProperty2.default)(_active, ".".concat(ICON_AND_LABEL_CLASSNAME), {
|
|
47
48
|
background: SMART_LINK_ACTIVE_COLOR
|
|
48
49
|
}), (0, _defineProperty2.default)(_active, ".".concat(OVERLAY_GRADIENT_CLASSNAME), {
|
|
50
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
49
51
|
background: getGradientWithColor(SMART_LINK_ACTIVE_COLOR)
|
|
50
52
|
}), _active)
|
|
51
53
|
});
|
|
@@ -72,6 +74,7 @@ var showOverlayStyles = (0, _react2.css)({
|
|
|
72
74
|
});
|
|
73
75
|
var iconStyles = (0, _react2.css)({
|
|
74
76
|
// Position icon in the middle
|
|
77
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
75
78
|
span: {
|
|
76
79
|
display: 'flex'
|
|
77
80
|
}
|
|
@@ -102,6 +105,7 @@ var overflowingContainerStyles = (0, _react2.css)({
|
|
|
102
105
|
var gradientStyles = (0, _react2.css)({
|
|
103
106
|
width: '2.5rem',
|
|
104
107
|
height: '100%',
|
|
108
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
105
109
|
background: getGradientWithColor(SMART_LINK_BACKGROUND_COLOR)
|
|
106
110
|
});
|
|
107
111
|
var InlineCardOverlay = function InlineCardOverlay(_ref) {
|
|
@@ -26,8 +26,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
26
26
|
var toolbarButtonWrapperStyles = (0, _react2.css)({
|
|
27
27
|
background: "".concat("var(--ds-background-neutral, ".concat(_colors.N20A, ")")),
|
|
28
28
|
color: "".concat("var(--ds-icon, ".concat(_colors.N300, ")")),
|
|
29
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
29
30
|
':hover': {
|
|
30
31
|
background: "".concat("var(--ds-background-neutral-hovered, ".concat(_colors.B300, ")")),
|
|
32
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
31
33
|
color: "var(--ds-icon, white)".concat(" !important")
|
|
32
34
|
}
|
|
33
35
|
});
|
|
@@ -29,7 +29,7 @@ var ConfigureLinkDropdown = function ConfigureLinkDropdown(props) {
|
|
|
29
29
|
var triggerRef = _ref.triggerRef,
|
|
30
30
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
31
31
|
return /*#__PURE__*/_react.default.createElement(_new.default, (0, _extends2.default)({}, props, {
|
|
32
|
-
spacing:
|
|
32
|
+
spacing: 'none',
|
|
33
33
|
ref: triggerRef
|
|
34
34
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
35
35
|
style: {
|
|
@@ -41,17 +41,17 @@ var ConfigureLinkDropdown = function ConfigureLinkDropdown(props) {
|
|
|
41
41
|
testId: "".concat(testId, "-icon")
|
|
42
42
|
})));
|
|
43
43
|
},
|
|
44
|
-
spacing:
|
|
45
|
-
placement:
|
|
44
|
+
spacing: 'compact',
|
|
45
|
+
placement: 'bottom-start'
|
|
46
46
|
}, /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItemGroup, null, /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
|
|
47
47
|
elemBefore: /*#__PURE__*/_react.default.createElement(_shortcut.default, {
|
|
48
48
|
label: goToLinkLabel,
|
|
49
|
-
size:
|
|
49
|
+
size: 'small'
|
|
50
50
|
})
|
|
51
51
|
}, goToLinkLabel), /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
|
|
52
52
|
elemBefore: /*#__PURE__*/_react.default.createElement(_preferences.default, {
|
|
53
53
|
label: configureLinkLabel,
|
|
54
|
-
size:
|
|
54
|
+
size: 'small'
|
|
55
55
|
})
|
|
56
56
|
}, configureLinkLabel)));
|
|
57
57
|
};
|
|
@@ -55,12 +55,15 @@ var showOverlayStyles = (0, _react2.css)({
|
|
|
55
55
|
});
|
|
56
56
|
var iconStyles = (0, _react2.css)({
|
|
57
57
|
background: CONFIGURE_ICON_BACKGROUND_COLOR,
|
|
58
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
58
59
|
':hover': {
|
|
59
60
|
background: CONFIGURE_ICON_BACKGROUND_HOVERED_COLOR
|
|
60
61
|
},
|
|
62
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
61
63
|
':active': {
|
|
62
64
|
background: CONFIGURE_ICON_BACKGROUND_ACTIVE_COLOR
|
|
63
65
|
},
|
|
66
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
64
67
|
span: {
|
|
65
68
|
// If PreferencesIcon left as inline-block (default), height is incorrect and border radius is clipped when parent element
|
|
66
69
|
// uses 1lh height (rather than 100%)
|
|
@@ -179,7 +182,9 @@ var LeftIconOverlay = function LeftIconOverlay(_ref) {
|
|
|
179
182
|
tabIndex: -1,
|
|
180
183
|
"data-testid": testId
|
|
181
184
|
}, (0, _react2.jsx)("span", (0, _extends2.default)({}, tooltipProps, {
|
|
182
|
-
css: iconAndLabelStyles
|
|
185
|
+
css: iconAndLabelStyles
|
|
186
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
187
|
+
,
|
|
183
188
|
className: ICON_AND_LABEL_CLASSNAME
|
|
184
189
|
}), (0, _react2.jsx)("span", {
|
|
185
190
|
css: iconStyles
|
|
@@ -366,9 +366,11 @@ var ResizableEmbedCard = exports.default = /*#__PURE__*/function (_React$Compone
|
|
|
366
366
|
return (0, _react2.jsx)("div", {
|
|
367
367
|
"data-testid": "resizable-embed-card-spacing"
|
|
368
368
|
}, (0, _react2.jsx)("div", {
|
|
369
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
369
370
|
css: (0, _ui.wrapperStyle)({
|
|
370
371
|
layout: layout,
|
|
371
372
|
isResized: !!pctWidth,
|
|
373
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
372
374
|
containerWidth: containerWidth || _editorSharedStyles.DEFAULT_EMBED_CARD_WIDTH,
|
|
373
375
|
fullWidthMode: fullWidthMode
|
|
374
376
|
})
|
|
@@ -232,7 +232,9 @@ export class Datasource extends ReactNodeView {
|
|
|
232
232
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
233
233
|
className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
|
|
234
234
|
style: {
|
|
235
|
-
minWidth: this.isNodeNested ? '100%' :
|
|
235
|
+
minWidth: this.isNodeNested ? '100%' :
|
|
236
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
237
|
+
calcBreakoutWidth(attrs.layout || DATASOURCE_DEFAULT_LAYOUT, this.tableWidth)
|
|
236
238
|
}
|
|
237
239
|
}, jsx(DatasourceComponent, {
|
|
238
240
|
node: this.node,
|
package/dist/es2019/toolbar.js
CHANGED
|
@@ -220,7 +220,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
220
220
|
inlineCard
|
|
221
221
|
} = state.schema.nodes;
|
|
222
222
|
const isEditDropdownEnabled = getBooleanFF('platform.linking-platform.enable-datasource-edit-dropdown-toolbar') && platform !== 'mobile' && cardOptions.allowDatasource;
|
|
223
|
-
const
|
|
223
|
+
const editItems = isEditDropdownEnabled ? [{
|
|
224
224
|
type: 'custom',
|
|
225
225
|
fallback: [],
|
|
226
226
|
render: editorView => /*#__PURE__*/React.createElement(EditToolbarButton, {
|
|
@@ -229,9 +229,9 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
229
229
|
intl: intl,
|
|
230
230
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
231
231
|
editorView: editorView,
|
|
232
|
-
onLinkEditClick: editLink(editorAnalyticsApi)
|
|
232
|
+
onLinkEditClick: editLink(editorAnalyticsApi, true)
|
|
233
233
|
})
|
|
234
|
-
} : {
|
|
234
|
+
}] : [{
|
|
235
235
|
id: 'editor.link.edit',
|
|
236
236
|
type: 'button',
|
|
237
237
|
selected: false,
|
|
@@ -239,10 +239,11 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
239
239
|
title: intl.formatMessage(linkToolbarMessages.editLink),
|
|
240
240
|
showTitle: true,
|
|
241
241
|
testId: 'link-toolbar-edit-link-button',
|
|
242
|
-
onClick: editLink(editorAnalyticsApi)
|
|
242
|
+
onClick: editLink(editorAnalyticsApi, true)
|
|
243
243
|
}, {
|
|
244
244
|
type: 'separator'
|
|
245
|
-
}
|
|
245
|
+
}];
|
|
246
|
+
const toolbarItems = [...editItems, {
|
|
246
247
|
id: 'editor.link.openLink',
|
|
247
248
|
type: 'button',
|
|
248
249
|
icon: OpenIcon,
|
|
@@ -397,21 +398,7 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
397
398
|
type: 'separator'
|
|
398
399
|
});
|
|
399
400
|
}
|
|
400
|
-
const
|
|
401
|
-
type: 'custom',
|
|
402
|
-
fallback: [],
|
|
403
|
-
render: editorView => /*#__PURE__*/React.createElement(EditToolbarButton, {
|
|
404
|
-
key: "edit-toolbar-item",
|
|
405
|
-
url: metadata.url,
|
|
406
|
-
intl: intl,
|
|
407
|
-
editorAnalyticsApi: editorAnalyticsApi,
|
|
408
|
-
editorView: editorView,
|
|
409
|
-
onLinkEditClick: editLink(editorAnalyticsApi)
|
|
410
|
-
})
|
|
411
|
-
}, {
|
|
412
|
-
type: 'separator'
|
|
413
|
-
}];
|
|
414
|
-
const canShowMainToolbar = () => {
|
|
401
|
+
const canShowAppearanceSwitch = () => {
|
|
415
402
|
// we do not show smart-link or the datasource icons when the node does not have a url to resolve
|
|
416
403
|
if (!metadata.url) {
|
|
417
404
|
return false;
|
|
@@ -425,7 +412,7 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
425
412
|
// FF to enable additional toolbar buttons based on if the datasource is configurable or not
|
|
426
413
|
return getBooleanFF('platform.linking-platform.datasource-enable-toolbar-buttons-for-all-datasources') ? true : !isDatasourceConfigEditable(datasourceId);
|
|
427
414
|
};
|
|
428
|
-
if (
|
|
415
|
+
if (canShowAppearanceSwitch()) {
|
|
429
416
|
const {
|
|
430
417
|
allowBlockCards,
|
|
431
418
|
allowEmbeds,
|
|
@@ -467,7 +454,22 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
467
454
|
})
|
|
468
455
|
}, {
|
|
469
456
|
type: 'separator'
|
|
470
|
-
}
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
if (getBooleanFF('platform.linking-platform.enable-datasource-edit-dropdown-toolbar')) {
|
|
460
|
+
toolbarItems.push({
|
|
461
|
+
type: 'custom',
|
|
462
|
+
fallback: [],
|
|
463
|
+
render: editorView => /*#__PURE__*/React.createElement(EditToolbarButton, {
|
|
464
|
+
datasourceId: datasourceId,
|
|
465
|
+
key: "edit-toolbar-item",
|
|
466
|
+
url: metadata.url,
|
|
467
|
+
intl: intl,
|
|
468
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
469
|
+
editorView: editorView,
|
|
470
|
+
onLinkEditClick: editLink(editorAnalyticsApi, false)
|
|
471
|
+
})
|
|
472
|
+
});
|
|
471
473
|
}
|
|
472
474
|
if (node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.url) {
|
|
473
475
|
toolbarItems.push({
|
|
@@ -12,7 +12,7 @@ import { DiscoveryPulse } from '../Pulse';
|
|
|
12
12
|
// editor adds a standard line-height that is bigger than an inline smart link
|
|
13
13
|
// due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
|
|
14
14
|
const loaderWrapperStyles = css({
|
|
15
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
15
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
16
16
|
'.loader-wrapper': {
|
|
17
17
|
lineHeight: 'normal'
|
|
18
18
|
}
|
|
@@ -107,7 +107,7 @@ export class EditLinkToolbar extends React.Component {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
export const editLink = editorAnalyticsApi => (state, dispatch) => {
|
|
110
|
+
export const editLink = (editorAnalyticsApi, scrollIntoView) => (state, dispatch) => {
|
|
111
111
|
let type = 'hyperlink';
|
|
112
112
|
if (state.selection instanceof NodeSelection) {
|
|
113
113
|
type = state.selection.node.type.name;
|
|
@@ -118,6 +118,7 @@ export const editLink = editorAnalyticsApi => (state, dispatch) => {
|
|
|
118
118
|
} = state;
|
|
119
119
|
showLinkToolbar(tr);
|
|
120
120
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(buildEditLinkPayload(type))(tr);
|
|
121
|
+
tr.setMeta('scrollIntoView', scrollIntoView);
|
|
121
122
|
dispatch(tr);
|
|
122
123
|
return true;
|
|
123
124
|
}
|