@atlaskit/editor-plugin-card 5.4.6 → 5.4.8

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,23 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 5.4.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [#134468](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/134468)
8
+ [`e312ec529d05a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e312ec529d05a) -
9
+ [ux] Apply hover decoration when hovering on copy/delete button on overflow menu
10
+ - Updated dependencies
11
+
12
+ ## 5.4.7
13
+
14
+ ### Patch Changes
15
+
16
+ - [#132269](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/132269)
17
+ [`f6984f0b31c02`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f6984f0b31c02) -
18
+ [ux] Fixed alignment of the icon in OpenButtonOverlay on header link.
19
+ - Updated dependencies
20
+
3
21
  ## 5.4.6
4
22
 
5
23
  ### Patch Changes
@@ -8,10 +8,13 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.InlineCardWithAwareness = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
+ var _hooks = require("@atlaskit/editor-common/hooks");
11
12
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
12
14
  var _actions = require("../pm-plugins/actions");
13
15
  var _pluginKey = require("../pm-plugins/plugin-key");
14
16
  var _AwarenessWrapper = require("../ui/AwarenessWrapper");
17
+ var _OpenButtonOverlay = _interopRequireDefault(require("../ui/OpenButtonOverlay"));
15
18
  var _inlineCard = require("./inlineCard");
16
19
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
17
20
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -72,7 +75,26 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
72
75
  setIsHovered(isHovered);
73
76
  }
74
77
  }, [isOverlayEnabled]);
75
- var innerCard = (0, _react.useMemo)(function () {
78
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorViewMode']),
79
+ editorViewModeState = _useSharedPluginState.editorViewModeState;
80
+ var innerCardWithOpenButtonOverlay = (0, _react.useMemo)(function () {
81
+ return /*#__PURE__*/_react.default.createElement(_OpenButtonOverlay.default, {
82
+ isVisible: isResolvedViewRendered,
83
+ url: node.attrs.url
84
+ }, /*#__PURE__*/_react.default.createElement(_inlineCard.InlineCard, {
85
+ node: node,
86
+ view: view,
87
+ getPos: getPos,
88
+ useAlternativePreloader: useAlternativePreloader,
89
+ actionOptions: actionOptions,
90
+ onResolve: onResolve,
91
+ onClick: onClick,
92
+ cardContext: cardContext,
93
+ isHovered: isHovered,
94
+ isPageSSRed: isPageSSRed
95
+ }));
96
+ }, [isResolvedViewRendered, node, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed]);
97
+ var innerCardOriginal = (0, _react.useMemo)(function () {
76
98
  return /*#__PURE__*/_react.default.createElement(_inlineCard.InlineCard, {
77
99
  node: node,
78
100
  view: view,
@@ -86,6 +108,7 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
86
108
  isPageSSRed: isPageSSRed
87
109
  });
88
110
  }, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed]);
111
+ var innerCard = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'edit' && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1') ? innerCardWithOpenButtonOverlay : innerCardOriginal;
89
112
  return isOverlayEnabled || isPulseEnabled ? /*#__PURE__*/_react.default.createElement(_AwarenessWrapper.AwarenessWrapper, {
90
113
  isOverlayEnabled: isOverlayEnabled,
91
114
  isPulseEnabled: isPulseEnabled,
@@ -14,7 +14,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
14
14
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != (0, _typeof2.default)(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
15
  var lazyInlineCardView = exports.lazyInlineCardView = function lazyInlineCardView(props) {
16
16
  var isPageSSRed = props.isPageSSRed || false;
17
- if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false) || !(0, _platformFeatureFlags.fg)('platform_editor_ssr_fix_smartlinks') || isPageSSRed && (0, _platformFeatureFlags.fg)('platform_ssr_smartlinks_editor')) {
17
+ if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false) || isPageSSRed && (0, _platformFeatureFlags.fg)('platform_ssr_smartlinks_editor')) {
18
18
  return (0, _inlineCard.inlineCardNodeView)(props);
19
19
  }
20
20
  return (0, _lazyNodeView.withLazyLoading)({
@@ -8,15 +8,11 @@ exports.inlineCardSpecWithFixedToDOM = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _adfSchema = require("@atlaskit/adf-schema");
10
10
  var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
11
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
11
  var _colors = require("@atlaskit/theme/colors");
13
12
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
13
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
15
14
  // @nodeSpecException:toDOM patch
16
15
  var inlineCardSpecWithFixedToDOM = exports.inlineCardSpecWithFixedToDOM = function inlineCardSpecWithFixedToDOM() {
17
- if (!(0, _platformFeatureFlags.fg)('platform_editor_ssr_fix_smartlinks')) {
18
- return _adfSchema.inlineCard;
19
- }
20
16
  return _objectSpread(_objectSpread({}, _adfSchema.inlineCard), {}, {
21
17
  toDOM: function toDOM(node) {
22
18
  var wrapperAttrs = {
@@ -87,7 +87,7 @@ var AwarenessWrapper = exports.AwarenessWrapper = function AwarenessWrapper(_ref
87
87
  setOverlayHoveredStyles(isHovered);
88
88
  }, [setOverlayHoveredStyles]);
89
89
  var cardWithOverlay = (0, _react.useMemo)(function () {
90
- if (shouldShowLinkOverlay) {
90
+ if (shouldShowLinkOverlay && !((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1'))) {
91
91
  return (0, _react2.jsx)(_InlineCardOverlay.default, {
92
92
  isSelected: isSelected,
93
93
  isVisible: isResolvedViewRendered && (isInserted || isHovered || isSelected),
@@ -103,20 +103,17 @@ var AwarenessWrapper = exports.AwarenessWrapper = function AwarenessWrapper(_ref
103
103
  return children;
104
104
  }, [shouldShowLinkOverlay, children, isSelected, isResolvedViewRendered, isInserted, isHovered, url, handleOverlayChange]);
105
105
  var cardWithOpenButtonOverlay = (0, _react.useMemo)(function () {
106
- if (shouldShowLinkOverlay || !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1')) {
107
- return (0, _react2.jsx)(_OpenButtonOverlay.default, {
108
- isVisible: isResolvedViewRendered && isHovered,
109
- onMouseEnter: function onMouseEnter() {
110
- return handleOverlayChange(true);
111
- },
112
- onMouseLeave: function onMouseLeave() {
113
- return handleOverlayChange(false);
114
- },
115
- url: url
116
- }, children);
117
- }
118
- return children;
119
- }, [children, isHovered, url, handleOverlayChange, isResolvedViewRendered, shouldShowLinkOverlay]);
106
+ return (0, _react2.jsx)(_OpenButtonOverlay.default, {
107
+ isVisible: isResolvedViewRendered && isHovered,
108
+ onMouseEnter: function onMouseEnter() {
109
+ return handleOverlayChange(true);
110
+ },
111
+ onMouseLeave: function onMouseLeave() {
112
+ return handleOverlayChange(false);
113
+ },
114
+ url: url
115
+ }, children);
116
+ }, [children, isHovered, url, handleOverlayChange, isResolvedViewRendered]);
120
117
  var isInline = appearance === 'inline';
121
118
  return (0, _react.useMemo)(function () {
122
119
  var _cardContext$value;
@@ -136,7 +133,7 @@ var AwarenessWrapper = exports.AwarenessWrapper = function AwarenessWrapper(_ref
136
133
  shouldShowPulse: isResolvedViewRendered && shouldShowLinkPulse,
137
134
  testId: "link-discovery-pulse",
138
135
  isInline: isInline
139
- }, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? cardWithOpenButtonOverlay : cardWithOverlay)))
136
+ }, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1') ? cardWithOpenButtonOverlay : cardWithOverlay)))
140
137
  );
141
138
  }, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, isResolvedViewRendered, cardWithOverlay, cardWithOpenButtonOverlay, isInline]);
142
139
  };
@@ -12,6 +12,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
  var _react2 = require("@emotion/react");
14
14
  var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
15
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
16
  var _primitives = require("@atlaskit/primitives");
16
17
  var _excluded = ["children", "isVisible", "url"];
17
18
  /* eslint-disable @atlaskit/design-system/no-nested-styles */
@@ -71,20 +72,56 @@ var OpenButtonOverlay = function OpenButtonOverlay(_ref) {
71
72
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
72
73
  showLabel = _useState2[0],
73
74
  setShowLabel = _useState2[1];
75
+ var _useState3 = (0, _react.useState)(false),
76
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
77
+ isHovered = _useState4[0],
78
+ setHovered = _useState4[1];
74
79
  var handleDoubleClick = function handleDoubleClick() {
75
80
  // Double click opens the link in a new tab
76
81
  window.open(url, '_blank');
77
82
  };
78
83
  (0, _react.useLayoutEffect)(function () {
79
84
  var _containerRef$current, _openButtonRef$curren;
80
- if (!isVisible) {
85
+ if (!isVisible || !isHovered) {
81
86
  return;
82
87
  }
83
88
  var cardWidth = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetWidth;
84
89
  var openButtonWidth = (_openButtonRef$curren = openButtonRef.current) === null || _openButtonRef$curren === void 0 ? void 0 : _openButtonRef$curren.offsetWidth;
85
90
  var canShowLabel = cardWidth && openButtonWidth ? cardWidth - openButtonWidth > MIN_AVAILABLE_SPACE_WITH_LABEL_OVERLAY : true;
86
91
  setShowLabel(canShowLabel);
87
- }, [isVisible]);
92
+ }, [isVisible, isHovered]);
93
+ var handleOverlayChange = (0, _react.useCallback)(function (isHovered) {
94
+ setHovered(isHovered);
95
+ }, []);
96
+ if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1')) {
97
+ return (
98
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
99
+ (0, _react2.jsx)("span", {
100
+ ref: containerRef,
101
+ css: containerStyles,
102
+ onDoubleClick: handleDoubleClick,
103
+ onMouseEnter: function onMouseEnter() {
104
+ return handleOverlayChange(true);
105
+ },
106
+ onMouseLeave: function onMouseLeave() {
107
+ return handleOverlayChange(false);
108
+ }
109
+ }, children, isHovered && (0, _react2.jsx)(_primitives.Anchor, {
110
+ ref: openButtonRef,
111
+ xcss: linkStyles,
112
+ href: url,
113
+ target: "_blank"
114
+ }, (0, _react2.jsx)(_primitives.Box, {
115
+ xcss: iconWrapperStyles
116
+ }, (0, _react2.jsx)(_linkExternal.default, {
117
+ label: ""
118
+ })), showLabel && (0, _react2.jsx)(_primitives.Text, {
119
+ size: "small",
120
+ color: "color.text.subtle",
121
+ maxLines: 1
122
+ }, label)))
123
+ );
124
+ }
88
125
  return (
89
126
  // Ignored via go/ees005
90
127
  // eslint-disable-next-line react/jsx-props-no-spreading, jsx-a11y/no-static-element-interactions
@@ -99,7 +136,8 @@ var OpenButtonOverlay = function OpenButtonOverlay(_ref) {
99
136
  href: url,
100
137
  target: "_blank"
101
138
  }, (0, _react2.jsx)(_primitives.Box, {
102
- xcss: iconWrapperStyles
139
+ xcss: iconWrapperStyles,
140
+ "data-inlinecard-button-overlay": "icon-wrapper-line-height"
103
141
  }, (0, _react2.jsx)(_linkExternal.default, {
104
142
  label: ""
105
143
  })), showLabel && (0, _react2.jsx)(_primitives.Text, {
@@ -18,6 +18,7 @@ var _styles = require("@atlaskit/editor-common/styles");
18
18
  var _utils = require("@atlaskit/editor-common/utils");
19
19
  var _state = require("@atlaskit/editor-prosemirror/state");
20
20
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
21
+ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
21
22
  var _comment = _interopRequireDefault(require("@atlaskit/icon/core/comment"));
22
23
  var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
23
24
  var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
@@ -423,12 +424,20 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
423
424
  }]));
424
425
  }
425
426
  if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
427
+ var hoverDecorationProps = function hoverDecorationProps(nodeType, className) {
428
+ return (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1') ? {
429
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
430
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className),
431
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
432
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className)
433
+ } : undefined;
434
+ };
426
435
  var overflowMenuConfig = [{
427
436
  type: 'separator',
428
437
  fullHeight: true
429
438
  }, {
430
439
  type: 'overflow-dropdown',
431
- options: [{
440
+ options: [_objectSpread({
432
441
  title: intl.formatMessage(_messages.default.copyToClipboard),
433
442
  onClick: function onClick() {
434
443
  var _pluginInjectionApi$c2, _pluginInjectionApi$f;
@@ -439,13 +448,13 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
439
448
  icon: /*#__PURE__*/_react.default.createElement(_copy.default, {
440
449
  label: intl.formatMessage(_messages.default.copyToClipboard)
441
450
  })
442
- }, {
451
+ }, hoverDecorationProps(node.type, _editorSharedStyles.akEditorSelectedNodeClassName)), _objectSpread({
443
452
  title: intl.formatMessage(_messages.default.delete),
444
453
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
445
454
  icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
446
455
  label: intl.formatMessage(_messages.default.delete)
447
456
  })
448
- }]
457
+ }, hoverDecorationProps(node.type))]
449
458
  }];
450
459
  toolbarItems.push.apply(toolbarItems, overflowMenuConfig);
451
460
  }
@@ -623,12 +632,20 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
623
632
  pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f2 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.commands.copyNode(node.type));
624
633
  return true;
625
634
  },
635
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true, _editorSharedStyles.akEditorSelectedNodeClassName),
636
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false, _editorSharedStyles.akEditorSelectedNodeClassName),
637
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true, _editorSharedStyles.akEditorSelectedNodeClassName),
638
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false, _editorSharedStyles.akEditorSelectedNodeClassName),
626
639
  icon: /*#__PURE__*/_react.default.createElement(_copy.default, {
627
640
  label: intl.formatMessage(_messages.default.copyToClipboard)
628
641
  })
629
642
  }, {
630
643
  title: intl.formatMessage(_messages.default.delete),
631
644
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
645
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
646
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
647
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
648
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
632
649
  icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
633
650
  label: intl.formatMessage(_messages.default.delete)
634
651
  })
@@ -1,8 +1,11 @@
1
1
  import React, { memo, useCallback, useMemo, useState } from 'react';
2
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
2
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
5
  import { registerRemoveOverlay } from '../pm-plugins/actions';
4
6
  import { pluginKey } from '../pm-plugins/plugin-key';
5
7
  import { AwarenessWrapper } from '../ui/AwarenessWrapper';
8
+ import OpenButtonOverlay from '../ui/OpenButtonOverlay';
6
9
  import { InlineCard } from './inlineCard';
7
10
  export const InlineCardWithAwareness = /*#__PURE__*/memo(({
8
11
  node,
@@ -47,7 +50,25 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
47
50
  setIsHovered(isHovered);
48
51
  }
49
52
  }, [isOverlayEnabled]);
50
- const innerCard = useMemo(() => /*#__PURE__*/React.createElement(InlineCard, {
53
+ const {
54
+ editorViewModeState
55
+ } = useSharedPluginState(pluginInjectionApi, ['editorViewMode']);
56
+ const innerCardWithOpenButtonOverlay = useMemo(() => /*#__PURE__*/React.createElement(OpenButtonOverlay, {
57
+ isVisible: isResolvedViewRendered,
58
+ url: node.attrs.url
59
+ }, /*#__PURE__*/React.createElement(InlineCard, {
60
+ node: node,
61
+ view: view,
62
+ getPos: getPos,
63
+ useAlternativePreloader: useAlternativePreloader,
64
+ actionOptions: actionOptions,
65
+ onResolve: onResolve,
66
+ onClick: onClick,
67
+ cardContext: cardContext,
68
+ isHovered: isHovered,
69
+ isPageSSRed: isPageSSRed
70
+ })), [isResolvedViewRendered, node, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed]);
71
+ const innerCardOriginal = useMemo(() => /*#__PURE__*/React.createElement(InlineCard, {
51
72
  node: node,
52
73
  view: view,
53
74
  getPos: getPos,
@@ -59,6 +80,7 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
59
80
  isHovered: isHovered,
60
81
  isPageSSRed: isPageSSRed
61
82
  }), [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed]);
83
+ const innerCard = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'edit' && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_1') ? innerCardWithOpenButtonOverlay : innerCardOriginal;
62
84
  return isOverlayEnabled || isPulseEnabled ? /*#__PURE__*/React.createElement(AwarenessWrapper, {
63
85
  isOverlayEnabled: isOverlayEnabled,
64
86
  isPulseEnabled: isPulseEnabled,
@@ -4,7 +4,7 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
4
  import { inlineCardNodeView } from './inlineCard';
5
5
  export const lazyInlineCardView = props => {
6
6
  const isPageSSRed = props.isPageSSRed || false;
7
- if (editorExperiment('platform_editor_exp_lazy_node_views', false) || !fg('platform_editor_ssr_fix_smartlinks') || isPageSSRed && fg('platform_ssr_smartlinks_editor')) {
7
+ if (editorExperiment('platform_editor_exp_lazy_node_views', false) || isPageSSRed && fg('platform_ssr_smartlinks_editor')) {
8
8
  return inlineCardNodeView(props);
9
9
  }
10
10
  return withLazyLoading({
@@ -1,12 +1,8 @@
1
1
  import { inlineCard } from '@atlaskit/adf-schema';
2
2
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
3
  import { B400 } from '@atlaskit/theme/colors';
5
4
  // @nodeSpecException:toDOM patch
6
5
  export const inlineCardSpecWithFixedToDOM = () => {
7
- if (!fg('platform_editor_ssr_fix_smartlinks')) {
8
- return inlineCard;
9
- }
10
6
  return {
11
7
  ...inlineCard,
12
8
  toDOM: node => {
@@ -77,7 +77,7 @@ export const AwarenessWrapper = ({
77
77
  setOverlayHoveredStyles(isHovered);
78
78
  }, [setOverlayHoveredStyles]);
79
79
  const cardWithOverlay = useMemo(() => {
80
- if (shouldShowLinkOverlay) {
80
+ if (shouldShowLinkOverlay && !(editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_1'))) {
81
81
  return jsx(InlineCardOverlay, {
82
82
  isSelected: isSelected,
83
83
  isVisible: isResolvedViewRendered && (isInserted || isHovered || isSelected),
@@ -89,16 +89,13 @@ export const AwarenessWrapper = ({
89
89
  return children;
90
90
  }, [shouldShowLinkOverlay, children, isSelected, isResolvedViewRendered, isInserted, isHovered, url, handleOverlayChange]);
91
91
  const cardWithOpenButtonOverlay = useMemo(() => {
92
- if (shouldShowLinkOverlay || !fg('platform_editor_controls_patch_1')) {
93
- return jsx(OpenButtonOverlay, {
94
- isVisible: isResolvedViewRendered && isHovered,
95
- onMouseEnter: () => handleOverlayChange(true),
96
- onMouseLeave: () => handleOverlayChange(false),
97
- url: url
98
- }, children);
99
- }
100
- return children;
101
- }, [children, isHovered, url, handleOverlayChange, isResolvedViewRendered, shouldShowLinkOverlay]);
92
+ return jsx(OpenButtonOverlay, {
93
+ isVisible: isResolvedViewRendered && isHovered,
94
+ onMouseEnter: () => handleOverlayChange(true),
95
+ onMouseLeave: () => handleOverlayChange(false),
96
+ url: url
97
+ }, children);
98
+ }, [children, isHovered, url, handleOverlayChange, isResolvedViewRendered]);
102
99
  const isInline = appearance === 'inline';
103
100
  return useMemo(() => {
104
101
  var _cardContext$value;
@@ -118,7 +115,7 @@ export const AwarenessWrapper = ({
118
115
  shouldShowPulse: isResolvedViewRendered && shouldShowLinkPulse,
119
116
  testId: "link-discovery-pulse",
120
117
  isInline: isInline
121
- }, editorExperiment('platform_editor_controls', 'variant1') ? cardWithOpenButtonOverlay : cardWithOverlay)))
118
+ }, editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_controls_patch_1') ? cardWithOpenButtonOverlay : cardWithOverlay)))
122
119
  );
123
120
  }, [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, isInline]);
124
121
  };
@@ -5,11 +5,12 @@ import _extends from "@babel/runtime/helpers/extends";
5
5
  * @jsxRuntime classic
6
6
  * @jsx jsx
7
7
  */
8
- import React, { useLayoutEffect, useRef, useState } from 'react';
8
+ import React, { useCallback, useLayoutEffect, useRef, useState } from 'react';
9
9
  import { css, jsx } from '@emotion/react'; // eslint-disable-line @atlaskit/ui-styling-standard/use-compiled
10
10
 
11
11
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
12
12
  import LinkExternalIcon from '@atlaskit/icon/core/link-external';
13
+ import { fg } from '@atlaskit/platform-feature-flags';
13
14
  import { Anchor, Box, Text, xcss } from '@atlaskit/primitives';
14
15
  const containerStyles = css({
15
16
  position: 'relative'
@@ -55,20 +56,49 @@ const OpenButtonOverlay = ({
55
56
  const containerRef = useRef(null);
56
57
  const openButtonRef = useRef(null);
57
58
  const [showLabel, setShowLabel] = useState(true);
59
+ const [isHovered, setHovered] = useState(false);
58
60
  const handleDoubleClick = () => {
59
61
  // Double click opens the link in a new tab
60
62
  window.open(url, '_blank');
61
63
  };
62
64
  useLayoutEffect(() => {
63
65
  var _containerRef$current, _openButtonRef$curren;
64
- if (!isVisible) {
66
+ if (!isVisible || !isHovered) {
65
67
  return;
66
68
  }
67
69
  const cardWidth = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetWidth;
68
70
  const openButtonWidth = (_openButtonRef$curren = openButtonRef.current) === null || _openButtonRef$curren === void 0 ? void 0 : _openButtonRef$curren.offsetWidth;
69
71
  const canShowLabel = cardWidth && openButtonWidth ? cardWidth - openButtonWidth > MIN_AVAILABLE_SPACE_WITH_LABEL_OVERLAY : true;
70
72
  setShowLabel(canShowLabel);
71
- }, [isVisible]);
73
+ }, [isVisible, isHovered]);
74
+ const handleOverlayChange = useCallback(isHovered => {
75
+ setHovered(isHovered);
76
+ }, []);
77
+ if (fg('platform_editor_controls_patch_1')) {
78
+ return (
79
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
80
+ jsx("span", {
81
+ ref: containerRef,
82
+ css: containerStyles,
83
+ onDoubleClick: handleDoubleClick,
84
+ onMouseEnter: () => handleOverlayChange(true),
85
+ onMouseLeave: () => handleOverlayChange(false)
86
+ }, children, isHovered && jsx(Anchor, {
87
+ ref: openButtonRef,
88
+ xcss: linkStyles,
89
+ href: url,
90
+ target: "_blank"
91
+ }, jsx(Box, {
92
+ xcss: iconWrapperStyles
93
+ }, jsx(LinkExternalIcon, {
94
+ label: ""
95
+ })), showLabel && jsx(Text, {
96
+ size: "small",
97
+ color: "color.text.subtle",
98
+ maxLines: 1
99
+ }, label)))
100
+ );
101
+ }
72
102
  return (
73
103
  // Ignored via go/ees005
74
104
  // eslint-disable-next-line react/jsx-props-no-spreading, jsx-a11y/no-static-element-interactions
@@ -83,7 +113,8 @@ const OpenButtonOverlay = ({
83
113
  href: url,
84
114
  target: "_blank"
85
115
  }, jsx(Box, {
86
- xcss: iconWrapperStyles
116
+ xcss: iconWrapperStyles,
117
+ "data-inlinecard-button-overlay": "icon-wrapper-line-height"
87
118
  }, jsx(LinkExternalIcon, {
88
119
  label: ""
89
120
  })), showLabel && jsx(Text, {
@@ -8,6 +8,7 @@ import { FLOATING_TOOLBAR_LINKPICKER_CLASSNAME, richMediaClassName } from '@atla
8
8
  import { canRenderDatasource } from '@atlaskit/editor-common/utils';
9
9
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
10
10
  import { findDomRefAtPos, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
11
+ import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
11
12
  import CommentIcon from '@atlaskit/icon/core/comment';
12
13
  import CopyIcon from '@atlaskit/icon/core/copy';
13
14
  import DeleteIcon from '@atlaskit/icon/core/delete';
@@ -413,6 +414,12 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
413
414
  });
414
415
  }
415
416
  if (editorExperiment('platform_editor_controls', 'variant1')) {
417
+ const hoverDecorationProps = (nodeType, className) => fg('platform_editor_controls_patch_1') ? {
418
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
419
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className),
420
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
421
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className)
422
+ } : undefined;
416
423
  const overflowMenuConfig = [{
417
424
  type: 'separator',
418
425
  fullHeight: true
@@ -428,13 +435,15 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
428
435
  },
429
436
  icon: /*#__PURE__*/React.createElement(CopyIcon, {
430
437
  label: intl.formatMessage(commonMessages.copyToClipboard)
431
- })
438
+ }),
439
+ ...hoverDecorationProps(node.type, akEditorSelectedNodeClassName)
432
440
  }, {
433
441
  title: intl.formatMessage(commonMessages.delete),
434
442
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
435
443
  icon: /*#__PURE__*/React.createElement(DeleteIcon, {
436
444
  label: intl.formatMessage(commonMessages.delete)
437
- })
445
+ }),
446
+ ...hoverDecorationProps(node.type)
438
447
  }]
439
448
  }];
440
449
  toolbarItems.push(...overflowMenuConfig);
@@ -612,12 +621,20 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
612
621
  pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f2 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.commands.copyNode(node.type));
613
622
  return true;
614
623
  },
624
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true, akEditorSelectedNodeClassName),
625
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false, akEditorSelectedNodeClassName),
626
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true, akEditorSelectedNodeClassName),
627
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false, akEditorSelectedNodeClassName),
615
628
  icon: /*#__PURE__*/React.createElement(CopyIcon, {
616
629
  label: intl.formatMessage(commonMessages.copyToClipboard)
617
630
  })
618
631
  }, {
619
632
  title: intl.formatMessage(commonMessages.delete),
620
633
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
634
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
635
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
636
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
637
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
621
638
  icon: /*#__PURE__*/React.createElement(DeleteIcon, {
622
639
  label: intl.formatMessage(commonMessages.delete)
623
640
  })
@@ -1,9 +1,12 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { memo, useCallback, useMemo, useState } from 'react';
3
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
6
  import { registerRemoveOverlay } from '../pm-plugins/actions';
5
7
  import { pluginKey } from '../pm-plugins/plugin-key';
6
8
  import { AwarenessWrapper } from '../ui/AwarenessWrapper';
9
+ import OpenButtonOverlay from '../ui/OpenButtonOverlay';
7
10
  import { InlineCard } from './inlineCard';
8
11
  export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
9
12
  var node = _ref.node,
@@ -62,7 +65,26 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
62
65
  setIsHovered(isHovered);
63
66
  }
64
67
  }, [isOverlayEnabled]);
65
- var innerCard = useMemo(function () {
68
+ var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['editorViewMode']),
69
+ editorViewModeState = _useSharedPluginState.editorViewModeState;
70
+ var innerCardWithOpenButtonOverlay = useMemo(function () {
71
+ return /*#__PURE__*/React.createElement(OpenButtonOverlay, {
72
+ isVisible: isResolvedViewRendered,
73
+ url: node.attrs.url
74
+ }, /*#__PURE__*/React.createElement(InlineCard, {
75
+ node: node,
76
+ view: view,
77
+ getPos: getPos,
78
+ useAlternativePreloader: useAlternativePreloader,
79
+ actionOptions: actionOptions,
80
+ onResolve: onResolve,
81
+ onClick: onClick,
82
+ cardContext: cardContext,
83
+ isHovered: isHovered,
84
+ isPageSSRed: isPageSSRed
85
+ }));
86
+ }, [isResolvedViewRendered, node, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed]);
87
+ var innerCardOriginal = useMemo(function () {
66
88
  return /*#__PURE__*/React.createElement(InlineCard, {
67
89
  node: node,
68
90
  view: view,
@@ -76,6 +98,7 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
76
98
  isPageSSRed: isPageSSRed
77
99
  });
78
100
  }, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed]);
101
+ var innerCard = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'edit' && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_1') ? innerCardWithOpenButtonOverlay : innerCardOriginal;
79
102
  return isOverlayEnabled || isPulseEnabled ? /*#__PURE__*/React.createElement(AwarenessWrapper, {
80
103
  isOverlayEnabled: isOverlayEnabled,
81
104
  isPulseEnabled: isPulseEnabled,
@@ -4,7 +4,7 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
4
  import { inlineCardNodeView } from './inlineCard';
5
5
  export var lazyInlineCardView = function lazyInlineCardView(props) {
6
6
  var isPageSSRed = props.isPageSSRed || false;
7
- if (editorExperiment('platform_editor_exp_lazy_node_views', false) || !fg('platform_editor_ssr_fix_smartlinks') || isPageSSRed && fg('platform_ssr_smartlinks_editor')) {
7
+ if (editorExperiment('platform_editor_exp_lazy_node_views', false) || isPageSSRed && fg('platform_ssr_smartlinks_editor')) {
8
8
  return inlineCardNodeView(props);
9
9
  }
10
10
  return withLazyLoading({
@@ -3,13 +3,9 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { inlineCard } from '@atlaskit/adf-schema';
5
5
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
6
  import { B400 } from '@atlaskit/theme/colors';
8
7
  // @nodeSpecException:toDOM patch
9
8
  export var inlineCardSpecWithFixedToDOM = function inlineCardSpecWithFixedToDOM() {
10
- if (!fg('platform_editor_ssr_fix_smartlinks')) {
11
- return inlineCard;
12
- }
13
9
  return _objectSpread(_objectSpread({}, inlineCard), {}, {
14
10
  toDOM: function toDOM(node) {
15
11
  var wrapperAttrs = {
@@ -79,7 +79,7 @@ export var AwarenessWrapper = function AwarenessWrapper(_ref) {
79
79
  setOverlayHoveredStyles(isHovered);
80
80
  }, [setOverlayHoveredStyles]);
81
81
  var cardWithOverlay = useMemo(function () {
82
- if (shouldShowLinkOverlay) {
82
+ if (shouldShowLinkOverlay && !(editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_1'))) {
83
83
  return jsx(InlineCardOverlay, {
84
84
  isSelected: isSelected,
85
85
  isVisible: isResolvedViewRendered && (isInserted || isHovered || isSelected),
@@ -95,20 +95,17 @@ export var AwarenessWrapper = function AwarenessWrapper(_ref) {
95
95
  return children;
96
96
  }, [shouldShowLinkOverlay, children, isSelected, isResolvedViewRendered, isInserted, isHovered, url, handleOverlayChange]);
97
97
  var cardWithOpenButtonOverlay = useMemo(function () {
98
- if (shouldShowLinkOverlay || !fg('platform_editor_controls_patch_1')) {
99
- return jsx(OpenButtonOverlay, {
100
- isVisible: isResolvedViewRendered && isHovered,
101
- onMouseEnter: function onMouseEnter() {
102
- return handleOverlayChange(true);
103
- },
104
- onMouseLeave: function onMouseLeave() {
105
- return handleOverlayChange(false);
106
- },
107
- url: url
108
- }, children);
109
- }
110
- return children;
111
- }, [children, isHovered, url, handleOverlayChange, isResolvedViewRendered, shouldShowLinkOverlay]);
98
+ return jsx(OpenButtonOverlay, {
99
+ isVisible: isResolvedViewRendered && isHovered,
100
+ onMouseEnter: function onMouseEnter() {
101
+ return handleOverlayChange(true);
102
+ },
103
+ onMouseLeave: function onMouseLeave() {
104
+ return handleOverlayChange(false);
105
+ },
106
+ url: url
107
+ }, children);
108
+ }, [children, isHovered, url, handleOverlayChange, isResolvedViewRendered]);
112
109
  var isInline = appearance === 'inline';
113
110
  return useMemo(function () {
114
111
  var _cardContext$value;
@@ -128,7 +125,7 @@ export var AwarenessWrapper = function AwarenessWrapper(_ref) {
128
125
  shouldShowPulse: isResolvedViewRendered && shouldShowLinkPulse,
129
126
  testId: "link-discovery-pulse",
130
127
  isInline: isInline
131
- }, editorExperiment('platform_editor_controls', 'variant1') ? cardWithOpenButtonOverlay : cardWithOverlay)))
128
+ }, editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_controls_patch_1') ? cardWithOpenButtonOverlay : cardWithOverlay)))
132
129
  );
133
130
  }, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, isResolvedViewRendered, cardWithOverlay, cardWithOpenButtonOverlay, isInline]);
134
131
  };
@@ -8,11 +8,12 @@ var _excluded = ["children", "isVisible", "url"];
8
8
  * @jsxRuntime classic
9
9
  * @jsx jsx
10
10
  */
11
- import React, { useLayoutEffect, useRef, useState } from 'react';
11
+ import React, { useCallback, useLayoutEffect, useRef, useState } from 'react';
12
12
  import { css, jsx } from '@emotion/react'; // eslint-disable-line @atlaskit/ui-styling-standard/use-compiled
13
13
 
14
14
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
15
15
  import LinkExternalIcon from '@atlaskit/icon/core/link-external';
16
+ import { fg } from '@atlaskit/platform-feature-flags';
16
17
  import { Anchor, Box, Text, xcss } from '@atlaskit/primitives';
17
18
  var containerStyles = css({
18
19
  position: 'relative'
@@ -61,20 +62,56 @@ var OpenButtonOverlay = function OpenButtonOverlay(_ref) {
61
62
  _useState2 = _slicedToArray(_useState, 2),
62
63
  showLabel = _useState2[0],
63
64
  setShowLabel = _useState2[1];
65
+ var _useState3 = useState(false),
66
+ _useState4 = _slicedToArray(_useState3, 2),
67
+ isHovered = _useState4[0],
68
+ setHovered = _useState4[1];
64
69
  var handleDoubleClick = function handleDoubleClick() {
65
70
  // Double click opens the link in a new tab
66
71
  window.open(url, '_blank');
67
72
  };
68
73
  useLayoutEffect(function () {
69
74
  var _containerRef$current, _openButtonRef$curren;
70
- if (!isVisible) {
75
+ if (!isVisible || !isHovered) {
71
76
  return;
72
77
  }
73
78
  var cardWidth = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetWidth;
74
79
  var openButtonWidth = (_openButtonRef$curren = openButtonRef.current) === null || _openButtonRef$curren === void 0 ? void 0 : _openButtonRef$curren.offsetWidth;
75
80
  var canShowLabel = cardWidth && openButtonWidth ? cardWidth - openButtonWidth > MIN_AVAILABLE_SPACE_WITH_LABEL_OVERLAY : true;
76
81
  setShowLabel(canShowLabel);
77
- }, [isVisible]);
82
+ }, [isVisible, isHovered]);
83
+ var handleOverlayChange = useCallback(function (isHovered) {
84
+ setHovered(isHovered);
85
+ }, []);
86
+ if (fg('platform_editor_controls_patch_1')) {
87
+ return (
88
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
89
+ jsx("span", {
90
+ ref: containerRef,
91
+ css: containerStyles,
92
+ onDoubleClick: handleDoubleClick,
93
+ onMouseEnter: function onMouseEnter() {
94
+ return handleOverlayChange(true);
95
+ },
96
+ onMouseLeave: function onMouseLeave() {
97
+ return handleOverlayChange(false);
98
+ }
99
+ }, children, isHovered && jsx(Anchor, {
100
+ ref: openButtonRef,
101
+ xcss: linkStyles,
102
+ href: url,
103
+ target: "_blank"
104
+ }, jsx(Box, {
105
+ xcss: iconWrapperStyles
106
+ }, jsx(LinkExternalIcon, {
107
+ label: ""
108
+ })), showLabel && jsx(Text, {
109
+ size: "small",
110
+ color: "color.text.subtle",
111
+ maxLines: 1
112
+ }, label)))
113
+ );
114
+ }
78
115
  return (
79
116
  // Ignored via go/ees005
80
117
  // eslint-disable-next-line react/jsx-props-no-spreading, jsx-a11y/no-static-element-interactions
@@ -89,7 +126,8 @@ var OpenButtonOverlay = function OpenButtonOverlay(_ref) {
89
126
  href: url,
90
127
  target: "_blank"
91
128
  }, jsx(Box, {
92
- xcss: iconWrapperStyles
129
+ xcss: iconWrapperStyles,
130
+ "data-inlinecard-button-overlay": "icon-wrapper-line-height"
93
131
  }, jsx(LinkExternalIcon, {
94
132
  label: ""
95
133
  })), showLabel && jsx(Text, {
@@ -12,6 +12,7 @@ import { FLOATING_TOOLBAR_LINKPICKER_CLASSNAME, richMediaClassName } from '@atla
12
12
  import { canRenderDatasource } from '@atlaskit/editor-common/utils';
13
13
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
14
14
  import { findDomRefAtPos, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
15
+ import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
15
16
  import CommentIcon from '@atlaskit/icon/core/comment';
16
17
  import CopyIcon from '@atlaskit/icon/core/copy';
17
18
  import DeleteIcon from '@atlaskit/icon/core/delete';
@@ -413,12 +414,20 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
413
414
  }]));
414
415
  }
415
416
  if (editorExperiment('platform_editor_controls', 'variant1')) {
417
+ var hoverDecorationProps = function hoverDecorationProps(nodeType, className) {
418
+ return fg('platform_editor_controls_patch_1') ? {
419
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
420
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className),
421
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
422
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className)
423
+ } : undefined;
424
+ };
416
425
  var overflowMenuConfig = [{
417
426
  type: 'separator',
418
427
  fullHeight: true
419
428
  }, {
420
429
  type: 'overflow-dropdown',
421
- options: [{
430
+ options: [_objectSpread({
422
431
  title: intl.formatMessage(commonMessages.copyToClipboard),
423
432
  onClick: function onClick() {
424
433
  var _pluginInjectionApi$c2, _pluginInjectionApi$f;
@@ -429,13 +438,13 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
429
438
  icon: /*#__PURE__*/React.createElement(CopyIcon, {
430
439
  label: intl.formatMessage(commonMessages.copyToClipboard)
431
440
  })
432
- }, {
441
+ }, hoverDecorationProps(node.type, akEditorSelectedNodeClassName)), _objectSpread({
433
442
  title: intl.formatMessage(commonMessages.delete),
434
443
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
435
444
  icon: /*#__PURE__*/React.createElement(DeleteIcon, {
436
445
  label: intl.formatMessage(commonMessages.delete)
437
446
  })
438
- }]
447
+ }, hoverDecorationProps(node.type))]
439
448
  }];
440
449
  toolbarItems.push.apply(toolbarItems, overflowMenuConfig);
441
450
  }
@@ -613,12 +622,20 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
613
622
  pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f2 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.commands.copyNode(node.type));
614
623
  return true;
615
624
  },
625
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true, akEditorSelectedNodeClassName),
626
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false, akEditorSelectedNodeClassName),
627
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true, akEditorSelectedNodeClassName),
628
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false, akEditorSelectedNodeClassName),
616
629
  icon: /*#__PURE__*/React.createElement(CopyIcon, {
617
630
  label: intl.formatMessage(commonMessages.copyToClipboard)
618
631
  })
619
632
  }, {
620
633
  title: intl.formatMessage(commonMessages.delete),
621
634
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
635
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
636
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
637
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
638
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
622
639
  icon: /*#__PURE__*/React.createElement(DeleteIcon, {
623
640
  label: intl.formatMessage(commonMessages.delete)
624
641
  })
@@ -1 +1,24 @@
1
- export declare const inlineCardSpecWithFixedToDOM: () => import("prosemirror-model").NodeSpec;
1
+ import type { DOMOutputSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
+ export declare const inlineCardSpecWithFixedToDOM: () => {
3
+ toDOM: (node: PMNode) => DOMOutputSpec;
4
+ content?: string | undefined;
5
+ marks?: string | undefined;
6
+ group?: string | undefined;
7
+ inline?: boolean | undefined;
8
+ atom?: boolean | undefined;
9
+ attrs?: {
10
+ [name: string]: import("prosemirror-model").AttributeSpec;
11
+ } | undefined;
12
+ selectable?: boolean | undefined;
13
+ draggable?: boolean | undefined;
14
+ code?: boolean | undefined;
15
+ whitespace?: "pre" | "normal" | undefined;
16
+ definingAsContext?: boolean | undefined;
17
+ definingForContent?: boolean | undefined;
18
+ defining?: boolean | undefined;
19
+ isolating?: boolean | undefined;
20
+ parseDOM?: readonly import("prosemirror-model").TagParseRule[] | undefined;
21
+ toDebugString?: ((node: PMNode) => string) | undefined;
22
+ leafText?: ((node: PMNode) => string) | undefined;
23
+ linebreakReplacement?: boolean | undefined;
24
+ };
@@ -1 +1,24 @@
1
- export declare const inlineCardSpecWithFixedToDOM: () => import("prosemirror-model").NodeSpec;
1
+ import type { DOMOutputSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
+ export declare const inlineCardSpecWithFixedToDOM: () => {
3
+ toDOM: (node: PMNode) => DOMOutputSpec;
4
+ content?: string | undefined;
5
+ marks?: string | undefined;
6
+ group?: string | undefined;
7
+ inline?: boolean | undefined;
8
+ atom?: boolean | undefined;
9
+ attrs?: {
10
+ [name: string]: import("prosemirror-model").AttributeSpec;
11
+ } | undefined;
12
+ selectable?: boolean | undefined;
13
+ draggable?: boolean | undefined;
14
+ code?: boolean | undefined;
15
+ whitespace?: "pre" | "normal" | undefined;
16
+ definingAsContext?: boolean | undefined;
17
+ definingForContent?: boolean | undefined;
18
+ defining?: boolean | undefined;
19
+ isolating?: boolean | undefined;
20
+ parseDOM?: readonly import("prosemirror-model").TagParseRule[] | undefined;
21
+ toDebugString?: ((node: PMNode) => string) | undefined;
22
+ leafText?: ((node: PMNode) => string) | undefined;
23
+ linebreakReplacement?: boolean | undefined;
24
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "5.4.6",
3
+ "version": "5.4.8",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -37,7 +37,7 @@
37
37
  "@atlaskit/analytics-next": "^11.0.0",
38
38
  "@atlaskit/button": "^22.0.0",
39
39
  "@atlaskit/custom-steps": "^0.11.0",
40
- "@atlaskit/editor-common": "^102.13.0",
40
+ "@atlaskit/editor-common": "^102.15.0",
41
41
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
42
42
  "@atlaskit/editor-plugin-base": "^2.3.0",
43
43
  "@atlaskit/editor-plugin-connectivity": "^2.0.0",
@@ -51,18 +51,18 @@
51
51
  "@atlaskit/editor-prosemirror": "7.0.0",
52
52
  "@atlaskit/editor-shared-styles": "^3.4.0",
53
53
  "@atlaskit/frontend-utilities": "^3.0.0",
54
- "@atlaskit/icon": "^25.2.0",
54
+ "@atlaskit/icon": "^25.3.0",
55
55
  "@atlaskit/link-analytics": "^9.1.0",
56
56
  "@atlaskit/link-client-extension": "^4.0.0",
57
57
  "@atlaskit/link-datasource": "^4.1.0",
58
58
  "@atlaskit/linking-common": "^8.0.0",
59
59
  "@atlaskit/linking-types": "^9.6.0",
60
- "@atlaskit/menu": "^3.1.0",
60
+ "@atlaskit/menu": "^3.2.0",
61
61
  "@atlaskit/platform-feature-flags": "^1.1.0",
62
62
  "@atlaskit/primitives": "^14.2.0",
63
63
  "@atlaskit/smart-card": "^36.2.0",
64
64
  "@atlaskit/theme": "^18.0.0",
65
- "@atlaskit/tmp-editor-statsig": "^4.4.0",
65
+ "@atlaskit/tmp-editor-statsig": "^4.6.0",
66
66
  "@atlaskit/tokens": "^4.5.0",
67
67
  "@babel/runtime": "^7.0.0",
68
68
  "@emotion/react": "^11.7.1",
@@ -128,9 +128,6 @@
128
128
  "linking_platform_smart_links_in_live_pages": {
129
129
  "type": "boolean"
130
130
  },
131
- "platform_editor_ssr_fix_smartlinks": {
132
- "type": "boolean"
133
- },
134
131
  "platform_editor_fix_card_plugin_state": {
135
132
  "type": "boolean"
136
133
  },