@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.
Files changed (42) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/nodeviews/datasource.js +3 -1
  3. package/dist/cjs/pm-plugins/doc.js +2 -0
  4. package/dist/cjs/toolbar.js +28 -26
  5. package/dist/cjs/ui/AwarenessWrapper/index.js +1 -1
  6. package/dist/cjs/ui/EditLinkToolbar.js +2 -1
  7. package/dist/cjs/ui/EditToolbarButton.js +97 -65
  8. package/dist/cjs/ui/HyperlinkToolbarAppearance.js +2 -1
  9. package/dist/cjs/ui/InlineCardOverlay/index.js +4 -0
  10. package/dist/cjs/ui/LayoutButton/index.js +2 -0
  11. package/dist/cjs/ui/LeftIconOverlay/ConfigureLinkDropdown/index.js +5 -5
  12. package/dist/cjs/ui/LeftIconOverlay/index.js +6 -1
  13. package/dist/cjs/ui/ResizableEmbedCard.js +2 -0
  14. package/dist/es2019/nodeviews/datasource.js +3 -1
  15. package/dist/es2019/pm-plugins/doc.js +2 -0
  16. package/dist/es2019/toolbar.js +24 -22
  17. package/dist/es2019/ui/AwarenessWrapper/index.js +1 -1
  18. package/dist/es2019/ui/EditLinkToolbar.js +2 -1
  19. package/dist/es2019/ui/EditToolbarButton.js +95 -62
  20. package/dist/es2019/ui/HyperlinkToolbarAppearance.js +2 -1
  21. package/dist/es2019/ui/InlineCardOverlay/index.js +6 -0
  22. package/dist/es2019/ui/LayoutButton/index.js +2 -0
  23. package/dist/es2019/ui/LeftIconOverlay/ConfigureLinkDropdown/index.js +12 -12
  24. package/dist/es2019/ui/LeftIconOverlay/index.js +6 -1
  25. package/dist/es2019/ui/ResizableEmbedCard.js +2 -0
  26. package/dist/esm/nodeviews/datasource.js +3 -1
  27. package/dist/esm/pm-plugins/doc.js +2 -0
  28. package/dist/esm/toolbar.js +28 -26
  29. package/dist/esm/ui/AwarenessWrapper/index.js +1 -1
  30. package/dist/esm/ui/EditLinkToolbar.js +2 -1
  31. package/dist/esm/ui/EditToolbarButton.js +98 -66
  32. package/dist/esm/ui/HyperlinkToolbarAppearance.js +2 -1
  33. package/dist/esm/ui/InlineCardOverlay/index.js +4 -0
  34. package/dist/esm/ui/LayoutButton/index.js +2 -0
  35. package/dist/esm/ui/LeftIconOverlay/ConfigureLinkDropdown/index.js +12 -12
  36. package/dist/esm/ui/LeftIconOverlay/index.js +6 -1
  37. package/dist/esm/ui/ResizableEmbedCard.js +2 -0
  38. package/dist/types/ui/EditLinkToolbar.d.ts +1 -1
  39. package/dist/types/ui/EditToolbarButton.d.ts +3 -2
  40. package/dist/types-ts4.5/ui/EditLinkToolbar.d.ts +1 -1
  41. package/dist/types-ts4.5/ui/EditToolbarButton.d.ts +3 -2
  42. package/package.json +129 -147
@@ -3,7 +3,7 @@ import { useCallback, useMemo, useRef, useState } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
4
  import { FormattedMessage } from 'react-intl-next';
5
5
  import { linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
6
- import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
6
+ import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
7
7
  import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu';
8
8
  import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
9
9
  import { ButtonItem } from '@atlaskit/menu';
@@ -15,21 +15,22 @@ import { useFetchDatasourceInfo } from './useFetchDatasourceInfo';
15
15
  const dropdownExpandContainer = css({
16
16
  margin: `0px ${"var(--ds-space-negative-050, -4px)"}`
17
17
  });
18
- const EditButtonWithCardContext = ({
19
- cardContext,
20
- intl,
21
- editorAnalyticsApi,
22
- url,
23
- editorView,
24
- onLinkEditClick
25
- }) => {
18
+ const EditToolbarButtonWithCardContext = props => {
19
+ var _response$datasourceI;
26
20
  const {
27
- datasourceId
28
- } = useFetchDatasourceInfo({
21
+ url,
22
+ cardContext,
23
+ intl,
24
+ editorAnalyticsApi,
25
+ editorView,
26
+ onLinkEditClick
27
+ } = props;
28
+ const response = useFetchDatasourceInfo({
29
29
  isRegularCardNode: true,
30
30
  url,
31
31
  cardContext
32
32
  });
33
+ const datasourceId = (_response$datasourceI = response.datasourceId) !== null && _response$datasourceI !== void 0 ? _response$datasourceI : props.datasourceId;
33
34
  const [isOpen, setIsOpen] = useState(false);
34
35
  const containerRef = useRef();
35
36
  const toggleOpen = () => setIsOpen(open => !open);
@@ -45,74 +46,106 @@ const EditButtonWithCardContext = ({
45
46
  const onEditLink = useCallback(() => {
46
47
  dispatchCommand(onLinkEditClick);
47
48
  }, [dispatchCommand, onLinkEditClick]);
48
- const shouldFallbackToEditButton = useMemo(() => {
49
+ const editVariant = useMemo(() => {
50
+ const hasUrl = url !== null && url !== undefined;
49
51
  if (!datasourceId || !isDatasourceConfigEditable(datasourceId)) {
50
- return true;
52
+ if (hasUrl) {
53
+ return 'edit-link';
54
+ }
55
+ return 'none';
51
56
  }
52
- if (url) {
57
+ if (hasUrl) {
53
58
  var _cardContext$store, _urlState$error;
54
59
  const urlState = cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$store = cardContext.store) === null || _cardContext$store === void 0 ? void 0 : _cardContext$store.getState()[url];
55
60
  if ((urlState === null || urlState === void 0 ? void 0 : (_urlState$error = urlState.error) === null || _urlState$error === void 0 ? void 0 : _urlState$error.kind) === 'fatal') {
56
- return true;
61
+ return 'edit-link';
57
62
  }
63
+ return 'edit-dropdown';
64
+ } else {
65
+ return 'edit-datasource';
58
66
  }
59
- return false;
60
67
  }, [cardContext === null || cardContext === void 0 ? void 0 : cardContext.store, datasourceId, url]);
61
68
  const onEditDatasource = useCallback(() => {
62
69
  if (datasourceId) {
63
70
  dispatchCommand(editDatasource(datasourceId, editorAnalyticsApi));
64
71
  }
65
72
  }, [dispatchCommand, datasourceId, editorAnalyticsApi]);
66
- if (shouldFallbackToEditButton) {
67
- return jsx(Button, {
68
- testId: "edit-link",
69
- onClick: onEditLink
70
- }, jsx(FormattedMessage, linkToolbarMessages.editLink));
73
+ switch (editVariant) {
74
+ case 'edit-link':
75
+ {
76
+ return jsx(Flex, {
77
+ gap: "space.050"
78
+ }, jsx(Button, {
79
+ testId: "edit-link",
80
+ onClick: onEditLink
81
+ }, jsx(FormattedMessage, linkToolbarMessages.editLink)), jsx(Separator, null));
82
+ }
83
+ case 'edit-datasource':
84
+ {
85
+ return jsx(Flex, {
86
+ gap: "space.050"
87
+ }, jsx(Button, {
88
+ testId: "edit-datasource",
89
+ tooltipContent: intl.formatMessage(linkToolbarMessages.editDatasourceStandaloneTooltip),
90
+ onClick: onEditDatasource
91
+ }, jsx(FormattedMessage, linkToolbarMessages.editDatasourceStandalone)), jsx(Separator, null));
92
+ }
93
+ case 'edit-dropdown':
94
+ {
95
+ const trigger = jsx(Flex, {
96
+ gap: "space.050"
97
+ }, jsx(Button, {
98
+ testId: "edit-dropdown-trigger",
99
+ iconAfter: jsx("span", {
100
+ css: dropdownExpandContainer
101
+ }, jsx(ExpandIcon, {
102
+ label: intl.formatMessage(messages.editDropdownTriggerTitle)
103
+ })),
104
+ onClick: toggleOpen,
105
+ selected: isOpen,
106
+ disabled: false,
107
+ ariaHasPopup: true
108
+ }, jsx(FormattedMessage, messages.editDropdownTriggerTitle)), jsx(Separator, null));
109
+ return jsx(Flex, {
110
+ ref: containerRef
111
+ }, jsx(UiDropdown, {
112
+ mountTo: containerRef.current,
113
+ isOpen: isOpen,
114
+ handleClickOutside: onClose,
115
+ handleEscapeKeydown: onClose,
116
+ trigger: trigger,
117
+ scrollableElement: containerRef.current,
118
+ arrowKeyNavigationProviderOptions: {
119
+ type: ArrowKeyNavigationType.MENU
120
+ }
121
+ }, jsx(ButtonItem, {
122
+ key: "edit.link",
123
+ onClick: onEditLink,
124
+ testId: "edit-dropdown-edit-link-item"
125
+ }, jsx(FormattedMessage, messages.editDropdownEditLinkTitle)), jsx(ButtonItem, {
126
+ key: "edit.datasource",
127
+ onClick: onEditDatasource,
128
+ testId: "edit-dropdown-edit-datasource-item"
129
+ }, jsx(FormattedMessage, messages.editDropdownEditDatasourceTitle))));
130
+ }
131
+ case 'none':
132
+ default:
133
+ return null;
71
134
  }
72
- const trigger = jsx(Button, {
73
- testId: "edit-dropdown-trigger",
74
- iconAfter: jsx("span", {
75
- css: dropdownExpandContainer
76
- }, jsx(ExpandIcon, {
77
- label: intl.formatMessage(messages.editDropdownTriggerTitle)
78
- })),
79
- onClick: toggleOpen,
80
- selected: isOpen,
81
- disabled: false,
82
- ariaHasPopup: true
83
- }, jsx(FormattedMessage, messages.editDropdownTriggerTitle));
84
- return jsx(Flex, {
85
- ref: containerRef
86
- }, jsx(UiDropdown, {
87
- mountTo: containerRef.current,
88
- isOpen: isOpen,
89
- handleClickOutside: onClose,
90
- handleEscapeKeydown: onClose,
91
- trigger: trigger,
92
- scrollableElement: containerRef.current,
93
- arrowKeyNavigationProviderOptions: {
94
- type: ArrowKeyNavigationType.MENU
95
- }
96
- }, jsx(ButtonItem, {
97
- key: "edit.link",
98
- onClick: onEditLink,
99
- testId: "edit-dropdown-edit-link-item"
100
- }, jsx(FormattedMessage, messages.editDropdownEditLinkTitle)), jsx(ButtonItem, {
101
- key: "edit.datasource",
102
- onClick: onEditDatasource,
103
- testId: "edit-dropdown-edit-datasource-item"
104
- }, jsx(FormattedMessage, messages.editDropdownEditDatasourceTitle))));
105
135
  };
106
- export const EditToolbarButton = ({
107
- intl,
108
- editorAnalyticsApi,
109
- url,
110
- editorView,
111
- onLinkEditClick
112
- }) => {
136
+ export const EditToolbarButton = props => {
137
+ const {
138
+ datasourceId,
139
+ intl,
140
+ editorAnalyticsApi,
141
+ url,
142
+ editorView,
143
+ onLinkEditClick
144
+ } = props;
113
145
  return jsx(CardContextProvider, null, ({
114
146
  cardContext
115
- }) => jsx(EditButtonWithCardContext, {
147
+ }) => jsx(EditToolbarButtonWithCardContext, {
148
+ datasourceId: datasourceId,
116
149
  url: url,
117
150
  intl: intl,
118
151
  editorAnalyticsApi: editorAnalyticsApi,
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React, { Component } from 'react';
3
3
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
+ import { FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
4
5
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
6
  import { Flex } from '@atlaskit/primitives';
6
7
  import { DatasourceAppearanceButton } from './DatasourceAppearanceButton';
@@ -98,6 +99,6 @@ export class HyperlinkToolbarAppearance extends Component {
98
99
  editorView: editorView,
99
100
  editorAnalyticsApi: editorAnalyticsApi,
100
101
  inputMethod: INPUT_METHOD.FLOATING_TB
101
- }));
102
+ }), /*#__PURE__*/React.createElement(Separator, null));
102
103
  }
103
104
  }
@@ -28,11 +28,15 @@ const getGradientWithColor = color => {
28
28
  const containerStyles = css({
29
29
  position: 'relative',
30
30
  lineHeight: 'normal',
31
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
31
32
  ':active': {
33
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
32
34
  [`.${ICON_AND_LABEL_CLASSNAME}`]: {
33
35
  background: SMART_LINK_ACTIVE_COLOR
34
36
  },
37
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
35
38
  [`.${OVERLAY_GRADIENT_CLASSNAME}`]: {
39
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
36
40
  background: getGradientWithColor(SMART_LINK_ACTIVE_COLOR)
37
41
  }
38
42
  }
@@ -60,6 +64,7 @@ const showOverlayStyles = css({
60
64
  });
61
65
  const iconStyles = css({
62
66
  // Position icon in the middle
67
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
63
68
  span: {
64
69
  display: 'flex'
65
70
  }
@@ -90,6 +95,7 @@ const overflowingContainerStyles = css({
90
95
  const gradientStyles = css({
91
96
  width: '2.5rem',
92
97
  height: '100%',
98
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
93
99
  background: getGradientWithColor(SMART_LINK_BACKGROUND_COLOR)
94
100
  });
95
101
  const InlineCardOverlay = ({
@@ -17,8 +17,10 @@ import { getDatasource, isDatasourceTableLayout } from './utils';
17
17
  const toolbarButtonWrapperStyles = css({
18
18
  background: `${`var(--ds-background-neutral, ${N20A})`}`,
19
19
  color: `${`var(--ds-icon, ${N300})`}`,
20
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
20
21
  ':hover': {
21
22
  background: `${`var(--ds-background-neutral-hovered, ${B300})`}`,
23
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
22
24
  color: `${"var(--ds-icon, white)"} !important`
23
25
  }
24
26
  });
@@ -1,12 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
- import { useIntl } from "react-intl-next";
4
- import Button from "@atlaskit/button/new";
5
- import DropdownMenu, { DropdownItem, DropdownItemGroup } from "@atlaskit/dropdown-menu";
6
- import { cardMessages as messages } from "@atlaskit/editor-common/messages";
7
- import ChevronDownIcon from "@atlaskit/icon/glyph/chevron-down";
8
- import PreferencesIcon from "@atlaskit/icon/glyph/preferences";
9
- import ShortcutIcon from "@atlaskit/icon/glyph/shortcut";
3
+ import { useIntl } from 'react-intl-next';
4
+ import Button from '@atlaskit/button/new';
5
+ import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
6
+ import { cardMessages as messages } from '@atlaskit/editor-common/messages';
7
+ import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
8
+ import PreferencesIcon from '@atlaskit/icon/glyph/preferences';
9
+ import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
10
10
  const ConfigureLinkDropdown = props => {
11
11
  const {
12
12
  testId
@@ -19,7 +19,7 @@ const ConfigureLinkDropdown = props => {
19
19
  triggerRef,
20
20
  ...props
21
21
  }) => /*#__PURE__*/React.createElement(Button, _extends({}, props, {
22
- spacing: "none",
22
+ spacing: 'none',
23
23
  ref: triggerRef
24
24
  }), /*#__PURE__*/React.createElement("span", {
25
25
  style: {
@@ -30,17 +30,17 @@ const ConfigureLinkDropdown = props => {
30
30
  size: 'small',
31
31
  testId: `${testId}-icon`
32
32
  }))),
33
- spacing: "compact",
34
- placement: "bottom-start"
33
+ spacing: 'compact',
34
+ placement: 'bottom-start'
35
35
  }, /*#__PURE__*/React.createElement(DropdownItemGroup, null, /*#__PURE__*/React.createElement(DropdownItem, {
36
36
  elemBefore: /*#__PURE__*/React.createElement(ShortcutIcon, {
37
37
  label: goToLinkLabel,
38
- size: "small"
38
+ size: 'small'
39
39
  })
40
40
  }, goToLinkLabel), /*#__PURE__*/React.createElement(DropdownItem, {
41
41
  elemBefore: /*#__PURE__*/React.createElement(PreferencesIcon, {
42
42
  label: configureLinkLabel,
43
- size: "small"
43
+ size: 'small'
44
44
  })
45
45
  }, configureLinkLabel)));
46
46
  };
@@ -42,12 +42,15 @@ const showOverlayStyles = css({
42
42
  });
43
43
  const iconStyles = css({
44
44
  background: CONFIGURE_ICON_BACKGROUND_COLOR,
45
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
45
46
  ':hover': {
46
47
  background: CONFIGURE_ICON_BACKGROUND_HOVERED_COLOR
47
48
  },
49
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
48
50
  ':active': {
49
51
  background: CONFIGURE_ICON_BACKGROUND_ACTIVE_COLOR
50
52
  },
53
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
51
54
  span: {
52
55
  // If PreferencesIcon left as inline-block (default), height is incorrect and border radius is clipped when parent element
53
56
  // uses 1lh height (rather than 100%)
@@ -157,7 +160,9 @@ const LeftIconOverlay = ({
157
160
  tabIndex: -1,
158
161
  "data-testid": testId
159
162
  }, jsx("span", _extends({}, tooltipProps, {
160
- css: iconAndLabelStyles,
163
+ css: iconAndLabelStyles
164
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
165
+ ,
161
166
  className: ICON_AND_LABEL_CLASSNAME
162
167
  }), jsx("span", {
163
168
  css: iconStyles
@@ -341,9 +341,11 @@ export default class ResizableEmbedCard extends React.Component {
341
341
  return jsx("div", {
342
342
  "data-testid": "resizable-embed-card-spacing"
343
343
  }, jsx("div", {
344
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
344
345
  css: wrapperStyle({
345
346
  layout,
346
347
  isResized: !!pctWidth,
348
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
347
349
  containerWidth: containerWidth || DEFAULT_EMBED_CARD_WIDTH,
348
350
  fullWidthMode
349
351
  })
@@ -278,7 +278,9 @@ export var Datasource = /*#__PURE__*/function (_ReactNodeView) {
278
278
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
279
279
  className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
280
280
  style: {
281
- minWidth: this.isNodeNested ? '100%' : calcBreakoutWidth(attrs.layout || DATASOURCE_DEFAULT_LAYOUT, this.tableWidth)
281
+ minWidth: this.isNodeNested ? '100%' :
282
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
283
+ calcBreakoutWidth(attrs.layout || DATASOURCE_DEFAULT_LAYOUT, this.tableWidth)
282
284
  }
283
285
  }, jsx(DatasourceComponent, {
284
286
  node: this.node,
@@ -616,6 +616,8 @@ export var getStartingToolbarItems = function getStartingToolbarItems(options, a
616
616
  title: intl.formatMessage(linkToolbarMessages.editLink),
617
617
  showTitle: true,
618
618
  metadata: metadata
619
+ }, {
620
+ type: 'separator'
619
621
  }];
620
622
  return [{
621
623
  type: 'custom',
@@ -216,7 +216,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
216
216
  } else {
217
217
  var inlineCard = state.schema.nodes.inlineCard;
218
218
  var isEditDropdownEnabled = getBooleanFF('platform.linking-platform.enable-datasource-edit-dropdown-toolbar') && platform !== 'mobile' && cardOptions.allowDatasource;
219
- var toolbarItems = [isEditDropdownEnabled ? {
219
+ var editItems = isEditDropdownEnabled ? [{
220
220
  type: 'custom',
221
221
  fallback: [],
222
222
  render: function render(editorView) {
@@ -226,10 +226,10 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
226
226
  intl: intl,
227
227
  editorAnalyticsApi: editorAnalyticsApi,
228
228
  editorView: editorView,
229
- onLinkEditClick: editLink(editorAnalyticsApi)
229
+ onLinkEditClick: editLink(editorAnalyticsApi, true)
230
230
  });
231
231
  }
232
- } : {
232
+ }] : [{
233
233
  id: 'editor.link.edit',
234
234
  type: 'button',
235
235
  selected: false,
@@ -237,10 +237,11 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
237
237
  title: intl.formatMessage(linkToolbarMessages.editLink),
238
238
  showTitle: true,
239
239
  testId: 'link-toolbar-edit-link-button',
240
- onClick: editLink(editorAnalyticsApi)
240
+ onClick: editLink(editorAnalyticsApi, true)
241
241
  }, {
242
242
  type: 'separator'
243
- }, {
243
+ }];
244
+ var toolbarItems = [].concat(editItems, [{
244
245
  id: 'editor.link.openLink',
245
246
  type: 'button',
246
247
  icon: OpenIcon,
@@ -250,7 +251,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
250
251
  onClick: visitCardLink(editorAnalyticsApi)
251
252
  }, {
252
253
  type: 'separator'
253
- }].concat(_toConsumableArray(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [{
254
+ }], _toConsumableArray(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [{
254
255
  type: 'copy-button',
255
256
  supportsViewMode: true,
256
257
  items: [{
@@ -400,23 +401,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
400
401
  type: 'separator'
401
402
  });
402
403
  }
403
- var editDropdownWithSeparator = [{
404
- type: 'custom',
405
- fallback: [],
406
- render: function render(editorView) {
407
- return /*#__PURE__*/React.createElement(EditToolbarButton, {
408
- key: "edit-toolbar-item",
409
- url: metadata.url,
410
- intl: intl,
411
- editorAnalyticsApi: editorAnalyticsApi,
412
- editorView: editorView,
413
- onLinkEditClick: editLink(editorAnalyticsApi)
414
- });
415
- }
416
- }, {
417
- type: 'separator'
418
- }];
419
- var canShowMainToolbar = function canShowMainToolbar() {
404
+ var canShowAppearanceSwitch = function canShowAppearanceSwitch() {
420
405
  // we do not show smart-link or the datasource icons when the node does not have a url to resolve
421
406
  if (!metadata.url) {
422
407
  return false;
@@ -430,12 +415,12 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
430
415
  // FF to enable additional toolbar buttons based on if the datasource is configurable or not
431
416
  return getBooleanFF('platform.linking-platform.datasource-enable-toolbar-buttons-for-all-datasources') ? true : !isDatasourceConfigEditable(datasourceId);
432
417
  };
433
- if (canShowMainToolbar()) {
418
+ if (canShowAppearanceSwitch()) {
434
419
  var allowBlockCards = cardOptions.allowBlockCards,
435
420
  allowEmbeds = cardOptions.allowEmbeds,
436
421
  showUpgradeDiscoverability = cardOptions.showUpgradeDiscoverability;
437
422
  var url = metadata.url;
438
- toolbarItems.push.apply(toolbarItems, [{
423
+ toolbarItems.push({
439
424
  type: 'custom',
440
425
  fallback: [],
441
426
  render: function render(editorView) {
@@ -470,7 +455,24 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
470
455
  }
471
456
  }, {
472
457
  type: 'separator'
473
- }].concat(_toConsumableArray(getBooleanFF('platform.linking-platform.enable-datasource-edit-dropdown-toolbar') ? [].concat(editDropdownWithSeparator) : [])));
458
+ });
459
+ }
460
+ if (getBooleanFF('platform.linking-platform.enable-datasource-edit-dropdown-toolbar')) {
461
+ toolbarItems.push({
462
+ type: 'custom',
463
+ fallback: [],
464
+ render: function render(editorView) {
465
+ return /*#__PURE__*/React.createElement(EditToolbarButton, {
466
+ datasourceId: datasourceId,
467
+ key: "edit-toolbar-item",
468
+ url: metadata.url,
469
+ intl: intl,
470
+ editorAnalyticsApi: editorAnalyticsApi,
471
+ editorView: editorView,
472
+ onLinkEditClick: editLink(editorAnalyticsApi, false)
473
+ });
474
+ }
475
+ });
474
476
  }
475
477
  if (node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.url) {
476
478
  toolbarItems.push({
@@ -13,7 +13,7 @@ import { DiscoveryPulse } from '../Pulse';
13
13
  // editor adds a standard line-height that is bigger than an inline smart link
14
14
  // due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
15
15
  var loaderWrapperStyles = css({
16
- // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
16
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
17
17
  '.loader-wrapper': {
18
18
  lineHeight: 'normal'
19
19
  }
@@ -124,7 +124,7 @@ export var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
124
124
  }]);
125
125
  return EditLinkToolbar;
126
126
  }(React.Component);
127
- export var editLink = function editLink(editorAnalyticsApi) {
127
+ export var editLink = function editLink(editorAnalyticsApi, scrollIntoView) {
128
128
  return function (state, dispatch) {
129
129
  var type = 'hyperlink';
130
130
  if (state.selection instanceof NodeSelection) {
@@ -134,6 +134,7 @@ export var editLink = function editLink(editorAnalyticsApi) {
134
134
  var tr = state.tr;
135
135
  showLinkToolbar(tr);
136
136
  editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(buildEditLinkPayload(type))(tr);
137
+ tr.setMeta('scrollIntoView', scrollIntoView);
137
138
  dispatch(tr);
138
139
  return true;
139
140
  }