@atlaskit/editor-plugin-card 5.0.0 → 5.0.2

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 5.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#117485](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/117485)
8
+ [`e9a8d9ba26963`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e9a8d9ba26963) -
9
+ Reorder icons, and remove some based on new editor controls. Changes under
10
+ `editor_plugin_controls` experiment.
11
+ - Updated dependencies
12
+
13
+ ## 5.0.1
14
+
15
+ ### Patch Changes
16
+
17
+ - [#117971](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117971)
18
+ [`d63604c31bb17`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d63604c31bb17) -
19
+ [ux] Editor controls - Link consumption friendliness with open link on hover
20
+ - Updated dependencies
21
+
3
22
  ## 5.0.0
4
23
 
5
24
  ### Major Changes
@@ -9,10 +9,12 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
9
9
  var _react = require("react");
10
10
  var _react2 = require("@emotion/react");
11
11
  var _analyticsNext = require("@atlaskit/analytics-next");
12
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
12
13
  var _utils = require("../../pm-plugins/utils");
13
14
  var _useLinkUpgradeDiscoverability = _interopRequireDefault(require("../hooks/useLinkUpgradeDiscoverability"));
14
15
  var _InlineCardOverlay = _interopRequireDefault(require("../InlineCardOverlay"));
15
16
  var _localStorage = require("../local-storage");
17
+ var _OpenButtonOverlay = _interopRequireDefault(require("../OpenButtonOverlay"));
16
18
  var _Pulse = require("../Pulse");
17
19
  /**
18
20
  * @jsxRuntime classic
@@ -98,6 +100,18 @@ var AwarenessWrapper = exports.AwarenessWrapper = function AwarenessWrapper(_ref
98
100
  }
99
101
  return children;
100
102
  }, [shouldShowLinkOverlay, children, isSelected, isResolvedViewRendered, isInserted, isHovered, url, handleOverlayChange]);
103
+ var cardWithOpenButtonOverlay = (0, _react.useMemo)(function () {
104
+ return (0, _react2.jsx)(_OpenButtonOverlay.default, {
105
+ isVisible: isHovered,
106
+ onMouseEnter: function onMouseEnter() {
107
+ return handleOverlayChange(true);
108
+ },
109
+ onMouseLeave: function onMouseLeave() {
110
+ return handleOverlayChange(false);
111
+ },
112
+ url: url
113
+ }, children);
114
+ }, [children, isHovered, url, handleOverlayChange]);
101
115
  return (0, _react.useMemo)(function () {
102
116
  var _cardContext$value;
103
117
  return (
@@ -115,7 +129,7 @@ var AwarenessWrapper = exports.AwarenessWrapper = function AwarenessWrapper(_ref
115
129
  discoveryMode: "start",
116
130
  shouldShowPulse: isResolvedViewRendered && shouldShowLinkPulse,
117
131
  testId: "link-discovery-pulse"
118
- }, cardWithOverlay)))
132
+ }, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? cardWithOpenButtonOverlay : cardWithOverlay)))
119
133
  );
120
- }, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, isResolvedViewRendered, cardWithOverlay]);
134
+ }, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, isResolvedViewRendered, cardWithOverlay, cardWithOpenButtonOverlay]);
121
135
  };
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _react2 = require("@emotion/react");
12
+ var _new = require("@atlaskit/button/new");
13
+ var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
14
+ var _excluded = ["children", "isVisible", "url"];
15
+ /* eslint-disable @atlaskit/design-system/no-nested-styles */
16
+ /* eslint-disable @atlaskit/design-system/prefer-primitives */
17
+ /**
18
+ * @jsxRuntime classic
19
+ * @jsx jsx
20
+ */
21
+ // eslint-disable-line @atlaskit/ui-styling-standard/use-compiled
22
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
23
+ var containerStyles = (0, _react2.css)({
24
+ position: 'relative'
25
+ });
26
+ var overlayStyles = (0, _react2.css)({
27
+ position: 'absolute',
28
+ left: '2px',
29
+ top: 0,
30
+ backgroundColor: "var(--ds-background-accent-gray-subtlest, #F1F2F4)",
31
+ borderRadius: "var(--ds-border-radius, 3px)",
32
+ display: 'inline-flex',
33
+ justifyContent: 'flex-start',
34
+ alignItems: 'center',
35
+ verticalAlign: 'text-top',
36
+ height: '19px',
37
+ overflow: 'hidden',
38
+ // EDM-1717: box-shadow Safari fix bring load wrapper zIndex to 1
39
+ zIndex: 2,
40
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
41
+ a: {
42
+ padding: "var(--ds-border-width, 1px)".concat(" ", "var(--ds-space-050, 4px)", " 0")
43
+ }
44
+ });
45
+ var OpenButtonOverlay = function OpenButtonOverlay(_ref) {
46
+ var children = _ref.children,
47
+ _ref$isVisible = _ref.isVisible,
48
+ isVisible = _ref$isVisible === void 0 ? false : _ref$isVisible,
49
+ url = _ref.url,
50
+ props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
51
+ // TODO add translation
52
+ var label = 'Open';
53
+ var handleDoubleClick = function handleDoubleClick() {
54
+ // Double click opens the link in a new tab
55
+ window.open(url, '_blank');
56
+ };
57
+ return (
58
+ // Ignored via go/ees005
59
+ // eslint-disable-next-line react/jsx-props-no-spreading, jsx-a11y/no-static-element-interactions
60
+ (0, _react2.jsx)("span", (0, _extends2.default)({}, props, {
61
+ css: containerStyles,
62
+ onDoubleClick: handleDoubleClick
63
+ }), children, isVisible && (0, _react2.jsx)("div", {
64
+ css: [overlayStyles]
65
+ }, (0, _react2.jsx)(_new.LinkButton, {
66
+ spacing: "compact",
67
+ href: url,
68
+ target: "_blank",
69
+ iconBefore: _linkExternal.default,
70
+ appearance: "default"
71
+ }, label)))
72
+ );
73
+ };
74
+ var _default = exports.default = OpenButtonOverlay;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -29,6 +29,7 @@ var _settings2 = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/set
29
29
  var _unlink = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/unlink"));
30
30
  var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"));
31
31
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
32
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
32
33
  var _doc = require("../pm-plugins/doc");
33
34
  var _pluginKey = require("../pm-plugins/plugin-key");
34
35
  var _utils3 = require("../pm-plugins/utils");
@@ -288,12 +289,13 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
288
289
  testId: 'inline-card-toolbar-comment-button',
289
290
  iconFallback: _comment2.default,
290
291
  title: intl.formatMessage(_messages.annotationMessages.createComment),
292
+ showTitle: (0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? undefined : true,
291
293
  onClick: onCommentButtonClick,
292
294
  disabled: (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.mode) === 'offline'
293
295
  }, {
294
296
  type: 'separator'
295
297
  }] : [];
296
- var toolbarItems = [].concat(editItems, commentItems, [{
298
+ var toolbarItems = (0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? [].concat(editItems, commentItems, [{
297
299
  id: 'editor.link.openLink',
298
300
  type: 'button',
299
301
  icon: _linkExternal.default,
@@ -328,7 +330,44 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
328
330
  onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
329
331
  title: intl.formatMessage(_messages.default.remove),
330
332
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
331
- }]);
333
+ }]) : [].concat(editItems, (0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink), {
334
+ type: 'separator'
335
+ }, {
336
+ id: 'editor.link.delete',
337
+ focusEditoronEnter: true,
338
+ type: 'button',
339
+ appearance: 'danger',
340
+ icon: _delete.default,
341
+ iconFallback: _remove.default,
342
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
343
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
344
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
345
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
346
+ title: intl.formatMessage(_messages.default.remove),
347
+ onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
348
+ }, {
349
+ type: 'separator'
350
+ }, {
351
+ id: 'editor.link.openLink',
352
+ type: 'button',
353
+ icon: _linkExternal.default,
354
+ iconFallback: _shortcut.default,
355
+ metadata: metadata,
356
+ className: 'hyperlink-open-link',
357
+ title: intl.formatMessage(_messages.linkMessages.openLink),
358
+ onClick: visitCardLink(editorAnalyticsApi)
359
+ }, {
360
+ type: 'separator'
361
+ }, {
362
+ type: 'copy-button',
363
+ items: [{
364
+ state: state,
365
+ formatMessage: intl.formatMessage,
366
+ nodeType: node.type
367
+ }]
368
+ }], (0, _toConsumableArray2.default)(commentItems.length > 1 ? [{
369
+ type: 'separator'
370
+ }, commentItems[0]] : commentItems));
332
371
  if (currentAppearance === 'embed') {
333
372
  var _pluginInjectionApi$a4;
334
373
  var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions, cardOptions);
@@ -509,7 +548,8 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
509
548
  focusEditoronEnter: true,
510
549
  type: 'button',
511
550
  appearance: 'danger',
512
- icon: _remove.default,
551
+ icon: _delete.default,
552
+ iconFallback: _remove.default,
513
553
  onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
514
554
  onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
515
555
  onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
@@ -7,10 +7,12 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { AnalyticsContext } from '@atlaskit/analytics-next';
10
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
11
  import { getResolvedAttributesFromStore } from '../../pm-plugins/utils';
11
12
  import useLinkUpgradeDiscoverability from '../hooks/useLinkUpgradeDiscoverability';
12
13
  import InlineCardOverlay from '../InlineCardOverlay';
13
14
  import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK, LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR, markLocalStorageKeyDiscovered, ONE_DAY_IN_MILLISECONDS } from '../local-storage';
15
+ import OpenButtonOverlay from '../OpenButtonOverlay';
14
16
  import { DiscoveryPulse } from '../Pulse';
15
17
  // editor adds a standard line-height that is bigger than an inline smart link
16
18
  // due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
@@ -84,6 +86,14 @@ export const AwarenessWrapper = ({
84
86
  }
85
87
  return children;
86
88
  }, [shouldShowLinkOverlay, children, isSelected, isResolvedViewRendered, isInserted, isHovered, url, handleOverlayChange]);
89
+ const cardWithOpenButtonOverlay = useMemo(() => {
90
+ return jsx(OpenButtonOverlay, {
91
+ isVisible: isHovered,
92
+ onMouseEnter: () => handleOverlayChange(true),
93
+ onMouseLeave: () => handleOverlayChange(false),
94
+ url: url
95
+ }, children);
96
+ }, [children, isHovered, url, handleOverlayChange]);
87
97
  return useMemo(() => {
88
98
  var _cardContext$value;
89
99
  return (
@@ -101,7 +111,7 @@ export const AwarenessWrapper = ({
101
111
  discoveryMode: "start",
102
112
  shouldShowPulse: isResolvedViewRendered && shouldShowLinkPulse,
103
113
  testId: "link-discovery-pulse"
104
- }, cardWithOverlay)))
114
+ }, editorExperiment('platform_editor_controls', 'variant1') ? cardWithOpenButtonOverlay : cardWithOverlay)))
105
115
  );
106
- }, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, isResolvedViewRendered, cardWithOverlay]);
116
+ }, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, isResolvedViewRendered, cardWithOverlay, cardWithOpenButtonOverlay]);
107
117
  };
@@ -0,0 +1,65 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /* eslint-disable @atlaskit/design-system/no-nested-styles */
3
+ /* eslint-disable @atlaskit/design-system/prefer-primitives */
4
+ /**
5
+ * @jsxRuntime classic
6
+ * @jsx jsx
7
+ */
8
+ import React from 'react';
9
+ import { css, jsx } from '@emotion/react'; // eslint-disable-line @atlaskit/ui-styling-standard/use-compiled
10
+
11
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
12
+ import { LinkButton } from '@atlaskit/button/new';
13
+ import LinkExternalIcon from '@atlaskit/icon/core/link-external';
14
+ const containerStyles = css({
15
+ position: 'relative'
16
+ });
17
+ const overlayStyles = css({
18
+ position: 'absolute',
19
+ left: '2px',
20
+ top: 0,
21
+ backgroundColor: "var(--ds-background-accent-gray-subtlest, #F1F2F4)",
22
+ borderRadius: "var(--ds-border-radius, 3px)",
23
+ display: 'inline-flex',
24
+ justifyContent: 'flex-start',
25
+ alignItems: 'center',
26
+ verticalAlign: 'text-top',
27
+ height: '19px',
28
+ overflow: 'hidden',
29
+ // EDM-1717: box-shadow Safari fix bring load wrapper zIndex to 1
30
+ zIndex: 2,
31
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
32
+ a: {
33
+ padding: `${"var(--ds-border-width, 1px)"} ${"var(--ds-space-050, 4px)"} 0`
34
+ }
35
+ });
36
+ const OpenButtonOverlay = ({
37
+ children,
38
+ isVisible = false,
39
+ url,
40
+ ...props
41
+ }) => {
42
+ // TODO add translation
43
+ const label = 'Open';
44
+ const handleDoubleClick = () => {
45
+ // Double click opens the link in a new tab
46
+ window.open(url, '_blank');
47
+ };
48
+ return (
49
+ // Ignored via go/ees005
50
+ // eslint-disable-next-line react/jsx-props-no-spreading, jsx-a11y/no-static-element-interactions
51
+ jsx("span", _extends({}, props, {
52
+ css: containerStyles,
53
+ onDoubleClick: handleDoubleClick
54
+ }), children, isVisible && jsx("div", {
55
+ css: [overlayStyles]
56
+ }, jsx(LinkButton, {
57
+ spacing: "compact",
58
+ href: url,
59
+ target: "_blank",
60
+ iconBefore: LinkExternalIcon,
61
+ appearance: "default"
62
+ }, label)))
63
+ );
64
+ };
65
+ export default OpenButtonOverlay;
File without changes
@@ -19,6 +19,7 @@ import CogIcon from '@atlaskit/icon/glyph/editor/settings';
19
19
  import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
20
20
  import OpenIcon from '@atlaskit/icon/glyph/shortcut';
21
21
  import { fg } from '@atlaskit/platform-feature-flags';
22
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
22
23
  import { changeSelectedCardToText } from '../pm-plugins/doc';
23
24
  import { pluginKey } from '../pm-plugins/plugin-key';
24
25
  import { appearanceForNodeType, displayInfoForCard, findCardInfo, isDatasourceNode, titleUrlPairFromNode } from '../pm-plugins/utils';
@@ -280,12 +281,13 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
280
281
  testId: 'inline-card-toolbar-comment-button',
281
282
  iconFallback: LegacyCommentIcon,
282
283
  title: intl.formatMessage(annotationMessages.createComment),
284
+ showTitle: editorExperiment('platform_editor_controls', 'control') ? undefined : true,
283
285
  onClick: onCommentButtonClick,
284
286
  disabled: (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : (_pluginInjectionApi$c3 = _pluginInjectionApi$c2.currentState()) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.mode) === 'offline'
285
287
  }, {
286
288
  type: 'separator'
287
289
  }] : [];
288
- const toolbarItems = [...editItems, ...commentItems, {
290
+ const toolbarItems = editorExperiment('platform_editor_controls', 'control') ? [...editItems, ...commentItems, {
289
291
  id: 'editor.link.openLink',
290
292
  type: 'button',
291
293
  icon: LinkExternalIcon,
@@ -320,7 +322,44 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
320
322
  onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
321
323
  title: intl.formatMessage(commonMessages.remove),
322
324
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
323
- }];
325
+ }] : [...editItems, ...getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi), getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink), {
326
+ type: 'separator'
327
+ }, {
328
+ id: 'editor.link.delete',
329
+ focusEditoronEnter: true,
330
+ type: 'button',
331
+ appearance: 'danger',
332
+ icon: DeleteIcon,
333
+ iconFallback: RemoveIcon,
334
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
335
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
336
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
337
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
338
+ title: intl.formatMessage(commonMessages.remove),
339
+ onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
340
+ }, {
341
+ type: 'separator'
342
+ }, {
343
+ id: 'editor.link.openLink',
344
+ type: 'button',
345
+ icon: LinkExternalIcon,
346
+ iconFallback: OpenIcon,
347
+ metadata: metadata,
348
+ className: 'hyperlink-open-link',
349
+ title: intl.formatMessage(linkMessages.openLink),
350
+ onClick: visitCardLink(editorAnalyticsApi)
351
+ }, {
352
+ type: 'separator'
353
+ }, {
354
+ type: 'copy-button',
355
+ items: [{
356
+ state,
357
+ formatMessage: intl.formatMessage,
358
+ nodeType: node.type
359
+ }]
360
+ }, ...(commentItems.length > 1 ? [{
361
+ type: 'separator'
362
+ }, commentItems[0]] : commentItems)];
324
363
  if (currentAppearance === 'embed') {
325
364
  var _pluginInjectionApi$a5;
326
365
  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);
@@ -498,7 +537,8 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
498
537
  focusEditoronEnter: true,
499
538
  type: 'button',
500
539
  appearance: 'danger',
501
- icon: RemoveIcon,
540
+ icon: DeleteIcon,
541
+ iconFallback: RemoveIcon,
502
542
  onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
503
543
  onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
504
544
  onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
@@ -8,10 +8,12 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
9
  import { css, jsx } from '@emotion/react';
10
10
  import { AnalyticsContext } from '@atlaskit/analytics-next';
11
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
11
12
  import { getResolvedAttributesFromStore } from '../../pm-plugins/utils';
12
13
  import useLinkUpgradeDiscoverability from '../hooks/useLinkUpgradeDiscoverability';
13
14
  import InlineCardOverlay from '../InlineCardOverlay';
14
15
  import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK, LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR, markLocalStorageKeyDiscovered, ONE_DAY_IN_MILLISECONDS } from '../local-storage';
16
+ import OpenButtonOverlay from '../OpenButtonOverlay';
15
17
  import { DiscoveryPulse } from '../Pulse';
16
18
  // editor adds a standard line-height that is bigger than an inline smart link
17
19
  // due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
@@ -90,6 +92,18 @@ export var AwarenessWrapper = function AwarenessWrapper(_ref) {
90
92
  }
91
93
  return children;
92
94
  }, [shouldShowLinkOverlay, children, isSelected, isResolvedViewRendered, isInserted, isHovered, url, handleOverlayChange]);
95
+ var cardWithOpenButtonOverlay = useMemo(function () {
96
+ return jsx(OpenButtonOverlay, {
97
+ isVisible: isHovered,
98
+ onMouseEnter: function onMouseEnter() {
99
+ return handleOverlayChange(true);
100
+ },
101
+ onMouseLeave: function onMouseLeave() {
102
+ return handleOverlayChange(false);
103
+ },
104
+ url: url
105
+ }, children);
106
+ }, [children, isHovered, url, handleOverlayChange]);
93
107
  return useMemo(function () {
94
108
  var _cardContext$value;
95
109
  return (
@@ -107,7 +121,7 @@ export var AwarenessWrapper = function AwarenessWrapper(_ref) {
107
121
  discoveryMode: "start",
108
122
  shouldShowPulse: isResolvedViewRendered && shouldShowLinkPulse,
109
123
  testId: "link-discovery-pulse"
110
- }, cardWithOverlay)))
124
+ }, editorExperiment('platform_editor_controls', 'variant1') ? cardWithOpenButtonOverlay : cardWithOverlay)))
111
125
  );
112
- }, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, isResolvedViewRendered, cardWithOverlay]);
126
+ }, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, isResolvedViewRendered, cardWithOverlay, cardWithOpenButtonOverlay]);
113
127
  };
@@ -0,0 +1,67 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["children", "isVisible", "url"];
4
+ /* eslint-disable @atlaskit/design-system/no-nested-styles */
5
+ /* eslint-disable @atlaskit/design-system/prefer-primitives */
6
+ /**
7
+ * @jsxRuntime classic
8
+ * @jsx jsx
9
+ */
10
+ import React from 'react';
11
+ import { css, jsx } from '@emotion/react'; // eslint-disable-line @atlaskit/ui-styling-standard/use-compiled
12
+
13
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
14
+ import { LinkButton } from '@atlaskit/button/new';
15
+ import LinkExternalIcon from '@atlaskit/icon/core/link-external';
16
+ var containerStyles = css({
17
+ position: 'relative'
18
+ });
19
+ var overlayStyles = css({
20
+ position: 'absolute',
21
+ left: '2px',
22
+ top: 0,
23
+ backgroundColor: "var(--ds-background-accent-gray-subtlest, #F1F2F4)",
24
+ borderRadius: "var(--ds-border-radius, 3px)",
25
+ display: 'inline-flex',
26
+ justifyContent: 'flex-start',
27
+ alignItems: 'center',
28
+ verticalAlign: 'text-top',
29
+ height: '19px',
30
+ overflow: 'hidden',
31
+ // EDM-1717: box-shadow Safari fix bring load wrapper zIndex to 1
32
+ zIndex: 2,
33
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
34
+ a: {
35
+ padding: "var(--ds-border-width, 1px)".concat(" ", "var(--ds-space-050, 4px)", " 0")
36
+ }
37
+ });
38
+ var OpenButtonOverlay = function OpenButtonOverlay(_ref) {
39
+ var children = _ref.children,
40
+ _ref$isVisible = _ref.isVisible,
41
+ isVisible = _ref$isVisible === void 0 ? false : _ref$isVisible,
42
+ url = _ref.url,
43
+ props = _objectWithoutProperties(_ref, _excluded);
44
+ // TODO add translation
45
+ var label = 'Open';
46
+ var handleDoubleClick = function handleDoubleClick() {
47
+ // Double click opens the link in a new tab
48
+ window.open(url, '_blank');
49
+ };
50
+ return (
51
+ // Ignored via go/ees005
52
+ // eslint-disable-next-line react/jsx-props-no-spreading, jsx-a11y/no-static-element-interactions
53
+ jsx("span", _extends({}, props, {
54
+ css: containerStyles,
55
+ onDoubleClick: handleDoubleClick
56
+ }), children, isVisible && jsx("div", {
57
+ css: [overlayStyles]
58
+ }, jsx(LinkButton, {
59
+ spacing: "compact",
60
+ href: url,
61
+ target: "_blank",
62
+ iconBefore: LinkExternalIcon,
63
+ appearance: "default"
64
+ }, label)))
65
+ );
66
+ };
67
+ export default OpenButtonOverlay;
File without changes
@@ -23,6 +23,7 @@ import CogIcon from '@atlaskit/icon/glyph/editor/settings';
23
23
  import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
24
24
  import OpenIcon from '@atlaskit/icon/glyph/shortcut';
25
25
  import { fg } from '@atlaskit/platform-feature-flags';
26
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
26
27
  import { changeSelectedCardToText } from '../pm-plugins/doc';
27
28
  import { pluginKey } from '../pm-plugins/plugin-key';
28
29
  import { appearanceForNodeType, displayInfoForCard, findCardInfo, isDatasourceNode, titleUrlPairFromNode } from '../pm-plugins/utils';
@@ -278,12 +279,13 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
278
279
  testId: 'inline-card-toolbar-comment-button',
279
280
  iconFallback: LegacyCommentIcon,
280
281
  title: intl.formatMessage(annotationMessages.createComment),
282
+ showTitle: editorExperiment('platform_editor_controls', 'control') ? undefined : true,
281
283
  onClick: onCommentButtonClick,
282
284
  disabled: (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.mode) === 'offline'
283
285
  }, {
284
286
  type: 'separator'
285
287
  }] : [];
286
- var toolbarItems = [].concat(editItems, commentItems, [{
288
+ var toolbarItems = editorExperiment('platform_editor_controls', 'control') ? [].concat(editItems, commentItems, [{
287
289
  id: 'editor.link.openLink',
288
290
  type: 'button',
289
291
  icon: LinkExternalIcon,
@@ -318,7 +320,44 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
318
320
  onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
319
321
  title: intl.formatMessage(commonMessages.remove),
320
322
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
321
- }]);
323
+ }]) : [].concat(editItems, _toConsumableArray(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink), {
324
+ type: 'separator'
325
+ }, {
326
+ id: 'editor.link.delete',
327
+ focusEditoronEnter: true,
328
+ type: 'button',
329
+ appearance: 'danger',
330
+ icon: DeleteIcon,
331
+ iconFallback: RemoveIcon,
332
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
333
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
334
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
335
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
336
+ title: intl.formatMessage(commonMessages.remove),
337
+ onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
338
+ }, {
339
+ type: 'separator'
340
+ }, {
341
+ id: 'editor.link.openLink',
342
+ type: 'button',
343
+ icon: LinkExternalIcon,
344
+ iconFallback: OpenIcon,
345
+ metadata: metadata,
346
+ className: 'hyperlink-open-link',
347
+ title: intl.formatMessage(linkMessages.openLink),
348
+ onClick: visitCardLink(editorAnalyticsApi)
349
+ }, {
350
+ type: 'separator'
351
+ }, {
352
+ type: 'copy-button',
353
+ items: [{
354
+ state: state,
355
+ formatMessage: intl.formatMessage,
356
+ nodeType: node.type
357
+ }]
358
+ }], _toConsumableArray(commentItems.length > 1 ? [{
359
+ type: 'separator'
360
+ }, commentItems[0]] : commentItems));
322
361
  if (currentAppearance === 'embed') {
323
362
  var _pluginInjectionApi$a4;
324
363
  var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions, cardOptions);
@@ -499,7 +538,8 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
499
538
  focusEditoronEnter: true,
500
539
  type: 'button',
501
540
  appearance: 'danger',
502
- icon: RemoveIcon,
541
+ icon: DeleteIcon,
542
+ iconFallback: RemoveIcon,
503
543
  onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
504
544
  onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
505
545
  onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import React from 'react';
6
+ import { jsx } from '@emotion/react';
7
+ import type { OpenButtonOverlayProps } from './types';
8
+ declare const OpenButtonOverlay: ({ children, isVisible, url, ...props }: React.PropsWithChildren<OpenButtonOverlayProps>) => jsx.JSX.Element;
9
+ export default OpenButtonOverlay;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export type OpenButtonOverlayProps = React.HTMLAttributes<HTMLSpanElement> & {
3
+ isVisible?: boolean;
4
+ url: string;
5
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import React from 'react';
6
+ import { jsx } from '@emotion/react';
7
+ import type { OpenButtonOverlayProps } from './types';
8
+ declare const OpenButtonOverlay: ({ children, isVisible, url, ...props }: React.PropsWithChildren<OpenButtonOverlayProps>) => jsx.JSX.Element;
9
+ export default OpenButtonOverlay;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export type OpenButtonOverlayProps = React.HTMLAttributes<HTMLSpanElement> & {
3
+ isVisible?: boolean;
4
+ url: string;
5
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "5.0.0",
3
+ "version": "5.0.2",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,7 +34,7 @@
34
34
  "@atlaskit/adf-schema": "^47.2.1",
35
35
  "@atlaskit/analytics-next": "^11.0.0",
36
36
  "@atlaskit/custom-steps": "^0.10.0",
37
- "@atlaskit/editor-common": "^100.0.0",
37
+ "@atlaskit/editor-common": "^100.1.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^2.0.0",
39
39
  "@atlaskit/editor-plugin-base": "^2.2.0",
40
40
  "@atlaskit/editor-plugin-connectivity": "^2.0.0",
@@ -48,19 +48,19 @@
48
48
  "@atlaskit/editor-prosemirror": "7.0.0",
49
49
  "@atlaskit/editor-shared-styles": "^3.3.0",
50
50
  "@atlaskit/frontend-utilities": "^3.0.0",
51
- "@atlaskit/icon": "^24.0.0",
51
+ "@atlaskit/icon": "^24.1.0",
52
52
  "@atlaskit/link-analytics": "^9.0.0",
53
53
  "@atlaskit/link-client-extension": "^4.0.0",
54
54
  "@atlaskit/link-datasource": "^3.21.0",
55
55
  "@atlaskit/linking-common": "^8.0.0",
56
56
  "@atlaskit/linking-types": "^9.6.0",
57
- "@atlaskit/menu": "3.0.0",
57
+ "@atlaskit/menu": "3.1.0",
58
58
  "@atlaskit/platform-feature-flags": "^1.1.0",
59
- "@atlaskit/primitives": "^14.0.0",
59
+ "@atlaskit/primitives": "^14.1.0",
60
60
  "@atlaskit/smart-card": "^35.0.0",
61
61
  "@atlaskit/theme": "^17.0.0",
62
- "@atlaskit/tmp-editor-statsig": "^3.0.0",
63
- "@atlaskit/tokens": "^4.0.0",
62
+ "@atlaskit/tmp-editor-statsig": "^3.2.0",
63
+ "@atlaskit/tokens": "^4.2.0",
64
64
  "@babel/runtime": "^7.0.0",
65
65
  "@emotion/react": "^11.7.1",
66
66
  "lodash": "^4.17.21",