@atlaskit/editor-plugin-card 2.5.1 → 2.6.0

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,26 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 2.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#119966](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/119966)
8
+ [`596ad24e38929`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/596ad24e38929) -
9
+ Clean up typescript references to LegacyPortalProviderAPI
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 2.5.2
16
+
17
+ ### Patch Changes
18
+
19
+ - [#119704](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/119704)
20
+ [`2308f93f42b1a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2308f93f42b1a) -
21
+ EDM-10361 Show highlighted border on hover of inline card configure overlay
22
+ - Updated dependencies
23
+
3
24
  ## 2.5.1
4
25
 
5
26
  ### Patch Changes
@@ -225,7 +225,7 @@ var Datasource = exports.Datasource = /*#__PURE__*/function (_ReactNodeView) {
225
225
  var _props$pluginInjectio, _sharedState$currentS;
226
226
  var _this2;
227
227
  (0, _classCallCheck2.default)(this, Datasource);
228
- _this2 = _super2.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
228
+ _this2 = _super2.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props);
229
229
  var sharedState = props === null || props === void 0 || (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 || (_props$pluginInjectio = _props$pluginInjectio.width) === null || _props$pluginInjectio === void 0 ? void 0 : _props$pluginInjectio.sharedState;
230
230
  _this2.tableWidth = sharedState === null || sharedState === void 0 || (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
231
231
  _this2.isNodeNested = props.isNodeNested;
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.InlineCard = void 0;
9
9
  exports.InlineCardNodeView = InlineCardNodeView;
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
12
  var _react = _interopRequireWildcard(require("react"));
12
13
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
13
14
  var _hooks = require("@atlaskit/editor-common/hooks");
@@ -114,14 +115,20 @@ function InlineCardNodeView(props) {
114
115
  enableInlineUpgradeFeatures = props.enableInlineUpgradeFeatures,
115
116
  pluginInjectionApi = props.pluginInjectionApi,
116
117
  onClickCallback = props.onClickCallback;
118
+ var _useState = (0, _react.useState)(false),
119
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
120
+ isOverlayHovered = _useState2[0],
121
+ setIsOverlayHovered = _useState2[1];
117
122
  var floatingToolbarNode = (_useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['floatingToolbar']).floatingToolbarState) === null || _useSharedPluginState === void 0 || (_useSharedPluginState = _useSharedPluginState.configWithNodeInfo) === null || _useSharedPluginState === void 0 ? void 0 : _useSharedPluginState.node;
118
123
  if ((0, _platformFeatureFlags.fg)('platform.linking-platform.smart-links-in-live-pages')) {
119
124
  var showHoverPreview = floatingToolbarNode !== node;
120
125
  var livePagesHoverCardFadeInDelay = 800;
121
126
  return /*#__PURE__*/_react.default.createElement(_ConfigureOverlay.default, {
122
127
  targetElementPos: getPos(),
123
- view: view
128
+ view: view,
129
+ isHoveredCallback: setIsOverlayHovered
124
130
  }, /*#__PURE__*/_react.default.createElement(WrappedInlineCard, {
131
+ isHovered: isOverlayHovered,
125
132
  node: node,
126
133
  view: view,
127
134
  getPos: getPos,
@@ -41,7 +41,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
41
41
  var LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = 'smart-link-upgrade-pulse';
42
42
  var ALLOW_EVENTS_CLASSNAME = exports.ALLOW_EVENTS_CLASSNAME = 'card-plugin-element-allow-events';
43
43
  var stopEvent = exports.stopEvent = function stopEvent(event) {
44
- if (!(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-links-in-live-pages')) {
44
+ if (!(0, _platformFeatureFlags.fg)('platform.linking-platform.smart-links-in-live-pages')) {
45
45
  return false;
46
46
  }
47
47
  var target = event.target;
@@ -124,7 +124,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
124
124
  var events = (0, _eventsFromTr.eventsFromTransaction)(tr, prevEditorState);
125
125
  cardPluginEvents.push.apply(cardPluginEvents, (0, _toConsumableArray2.default)(events));
126
126
  }
127
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.enable-datasource-appearance-toolbar') && !meta) {
127
+ if (!meta && (0, _platformFeatureFlags.fg)('platform.linking-platform.enable-datasource-appearance-toolbar')) {
128
128
  if (pluginState.datasourceTableRef) {
129
129
  if (!(tr.selection instanceof _state.NodeSelection) || !tr.selection.node.attrs.datasource) {
130
130
  // disable resize button when switching from datasource to block card
@@ -195,7 +195,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
195
195
  };
196
196
 
197
197
  // since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
198
- var layout = (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.editor-datasource-typeguards') ? getLayout() : (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || _linkingCommon.DATASOURCE_DEFAULT_LAYOUT;
198
+ var layout = (0, _platformFeatureFlags.fg)('platform.linking-platform.editor-datasource-typeguards') ? getLayout() : (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || _linkingCommon.DATASOURCE_DEFAULT_LAYOUT;
199
199
  var isNested = selection.$anchor.depth > 0;
200
200
 
201
201
  // we want to disable resize button when datasource table is nested by not setting then datasourceTableRef on selection
@@ -268,8 +268,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
268
268
  pluginInjectionApi: pluginInjectionApi,
269
269
  onClickCallback: options.onClickCallback
270
270
  };
271
- var hasIntlContext = true;
272
- var isDatasource = (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.editor-datasource-typeguards') ? (0, _utils4.isDatasourceNode)(node) : !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
271
+ var isDatasource = (0, _platformFeatureFlags.fg)('platform.linking-platform.editor-datasource-typeguards') ? (0, _utils4.isDatasourceNode)(node) : !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
273
272
  if (isDatasource) {
274
273
  var _node$attrs4;
275
274
  if (options.allowDatasource && platform !== 'mobile' && (0, _utils.canRenderDatasource)(node === null || node === void 0 || (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 || (_node$attrs4 = _node$attrs4.datasource) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.id)) {
@@ -282,7 +281,6 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
282
281
  getPos: getPos,
283
282
  portalProviderAPI: portalProviderAPI,
284
283
  eventDispatcher: eventDispatcher,
285
- hasIntlContext: hasIntlContext,
286
284
  pluginInjectionApi: pluginInjectionApi,
287
285
  isNodeNested: isNodeNested
288
286
  }).init();
@@ -290,7 +288,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
290
288
  return inlineCardViewProducer(node, view, getPos, decorations);
291
289
  }
292
290
  }
293
- return new _blockCard.BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
291
+ return new _blockCard.BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
294
292
  },
295
293
  embedCard: function embedCard(node, view, getPos) {
296
294
  var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
@@ -307,8 +305,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
307
305
  showServerActions: showServerActions,
308
306
  onClickCallback: options.onClickCallback
309
307
  };
310
- var hasIntlContext = true;
311
- return new _embedCard.EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
308
+ return new _embedCard.EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
312
309
  }
313
310
  }
314
311
  }, enableInlineUpgradeFeatures && {
@@ -21,7 +21,8 @@ var ConfigureOverlayWrapperStyles = (0, _react2.css)({
21
21
  var OverlayWrapper = function OverlayWrapper(_ref) {
22
22
  var view = _ref.view,
23
23
  targetElementPos = _ref.targetElementPos,
24
- children = _ref.children;
24
+ children = _ref.children,
25
+ hoverCallback = _ref.isHoveredCallback;
25
26
  var _useState = (0, _react.useState)(false),
26
27
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
27
28
  showConfigureButton = _useState2[0],
@@ -38,11 +39,13 @@ var OverlayWrapper = function OverlayWrapper(_ref) {
38
39
  }, []);
39
40
  return (0, _react2.jsx)("span", {
40
41
  onMouseEnter: function onMouseEnter() {
41
- return setShowConfigureButton(true);
42
+ setShowConfigureButton(true);
43
+ hoverCallback(true);
42
44
  },
43
45
  onMouseLeave: function onMouseLeave() {
44
46
  if (!dropdownOpen) {
45
47
  setShowConfigureButton(false);
48
+ hoverCallback(false);
46
49
  }
47
50
  },
48
51
  "data-testid": "inline-card-overlay-wrapper"
@@ -184,7 +184,7 @@ _defineProperty(DatasourceComponent, "contextTypes", {
184
184
  export class Datasource extends ReactNodeView {
185
185
  constructor(props) {
186
186
  var _props$pluginInjectio, _props$pluginInjectio2, _sharedState$currentS;
187
- super(props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
187
+ super(props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props);
188
188
  const sharedState = props === null || props === void 0 ? void 0 : (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 ? void 0 : (_props$pluginInjectio2 = _props$pluginInjectio.width) === null || _props$pluginInjectio2 === void 0 ? void 0 : _props$pluginInjectio2.sharedState;
189
189
  this.tableWidth = sharedState === null || sharedState === void 0 ? void 0 : (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
190
190
  this.isNodeNested = props.isNodeNested;
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { memo, useCallback, useMemo } from 'react';
2
+ import React, { memo, useCallback, useMemo, useState } from 'react';
3
3
  import rafSchedule from 'raf-schd';
4
4
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
5
5
  import { findOverflowScrollParent, UnsupportedInline } from '@atlaskit/editor-common/ui';
@@ -107,14 +107,17 @@ export function InlineCardNodeView(props) {
107
107
  pluginInjectionApi,
108
108
  onClickCallback
109
109
  } = props;
110
+ const [isOverlayHovered, setIsOverlayHovered] = useState(false);
110
111
  const floatingToolbarNode = (_useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['floatingToolbar']).floatingToolbarState) === null || _useSharedPluginState === void 0 ? void 0 : (_useSharedPluginState2 = _useSharedPluginState.configWithNodeInfo) === null || _useSharedPluginState2 === void 0 ? void 0 : _useSharedPluginState2.node;
111
112
  if (fg('platform.linking-platform.smart-links-in-live-pages')) {
112
113
  const showHoverPreview = floatingToolbarNode !== node;
113
114
  const livePagesHoverCardFadeInDelay = 800;
114
115
  return /*#__PURE__*/React.createElement(OverlayWrapper, {
115
116
  targetElementPos: getPos(),
116
- view: view
117
+ view: view,
118
+ isHoveredCallback: setIsOverlayHovered
117
119
  }, /*#__PURE__*/React.createElement(WrappedInlineCard, {
120
+ isHovered: isOverlayHovered,
118
121
  node: node,
119
122
  view: view,
120
123
  getPos: getPos,
@@ -6,7 +6,7 @@ import { canRenderDatasource } from '@atlaskit/editor-common/utils';
6
6
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
8
8
  import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
9
- import { fg, getBooleanFF } from '@atlaskit/platform-feature-flags';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
10
10
  import { eventsFromTransaction } from '../analytics/events-from-tr';
11
11
  import { isLocalStorageKeyDiscovered } from '../common/local-storage';
12
12
  import { BlockCard } from '../nodeviews/blockCard';
@@ -24,7 +24,7 @@ export { pluginKey } from './plugin-key';
24
24
  const LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = 'smart-link-upgrade-pulse';
25
25
  export const ALLOW_EVENTS_CLASSNAME = 'card-plugin-element-allow-events';
26
26
  export const stopEvent = event => {
27
- if (!getBooleanFF('platform.linking-platform.smart-links-in-live-pages')) {
27
+ if (!fg('platform.linking-platform.smart-links-in-live-pages')) {
28
28
  return false;
29
29
  }
30
30
  const target = event.target;
@@ -108,7 +108,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
108
108
  const events = eventsFromTransaction(tr, prevEditorState);
109
109
  cardPluginEvents.push(...events);
110
110
  }
111
- if (getBooleanFF('platform.linking-platform.enable-datasource-appearance-toolbar') && !meta) {
111
+ if (!meta && fg('platform.linking-platform.enable-datasource-appearance-toolbar')) {
112
112
  if (pluginState.datasourceTableRef) {
113
113
  if (!(tr.selection instanceof NodeSelection) || !tr.selection.node.attrs.datasource) {
114
114
  // disable resize button when switching from datasource to block card
@@ -184,7 +184,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
184
184
  };
185
185
 
186
186
  // since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
187
- const layout = getBooleanFF('platform.linking-platform.editor-datasource-typeguards') ? getLayout() : (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || DATASOURCE_DEFAULT_LAYOUT;
187
+ const layout = fg('platform.linking-platform.editor-datasource-typeguards') ? getLayout() : (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || DATASOURCE_DEFAULT_LAYOUT;
188
188
  const isNested = selection.$anchor.depth > 0;
189
189
 
190
190
  // we want to disable resize button when datasource table is nested by not setting then datasourceTableRef on selection
@@ -259,8 +259,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
259
259
  pluginInjectionApi,
260
260
  onClickCallback: options.onClickCallback
261
261
  };
262
- const hasIntlContext = true;
263
- const isDatasource = getBooleanFF('platform.linking-platform.editor-datasource-typeguards') ? isDatasourceNode(node) : !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
262
+ const isDatasource = fg('platform.linking-platform.editor-datasource-typeguards') ? isDatasourceNode(node) : !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
264
263
  if (isDatasource) {
265
264
  var _node$attrs4, _node$attrs4$datasour;
266
265
  if (options.allowDatasource && platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : (_node$attrs4$datasour = _node$attrs4.datasource) === null || _node$attrs4$datasour === void 0 ? void 0 : _node$attrs4$datasour.id)) {
@@ -273,7 +272,6 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
273
272
  getPos,
274
273
  portalProviderAPI,
275
274
  eventDispatcher,
276
- hasIntlContext,
277
275
  pluginInjectionApi,
278
276
  isNodeNested
279
277
  }).init();
@@ -281,7 +279,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
281
279
  return inlineCardViewProducer(node, view, getPos, decorations);
282
280
  }
283
281
  }
284
- return new BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
282
+ return new BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
285
283
  },
286
284
  embedCard: (node, view, getPos) => {
287
285
  const {
@@ -300,8 +298,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
300
298
  showServerActions,
301
299
  onClickCallback: options.onClickCallback
302
300
  };
303
- const hasIntlContext = true;
304
- return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
301
+ return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
305
302
  }
306
303
  },
307
304
  ...(enableInlineUpgradeFeatures && {
@@ -12,7 +12,8 @@ const ConfigureOverlayWrapperStyles = css({
12
12
  const OverlayWrapper = ({
13
13
  view,
14
14
  targetElementPos,
15
- children
15
+ children,
16
+ isHoveredCallback: hoverCallback
16
17
  }) => {
17
18
  const [showConfigureButton, setShowConfigureButton] = useState(false);
18
19
  const [dropdownOpen, setDropdownOpen] = useState(false);
@@ -23,10 +24,14 @@ const OverlayWrapper = ({
23
24
  }
24
25
  }, []);
25
26
  return jsx("span", {
26
- onMouseEnter: () => setShowConfigureButton(true),
27
+ onMouseEnter: () => {
28
+ setShowConfigureButton(true);
29
+ hoverCallback(true);
30
+ },
27
31
  onMouseLeave: () => {
28
32
  if (!dropdownOpen) {
29
33
  setShowConfigureButton(false);
34
+ hoverCallback(false);
30
35
  }
31
36
  },
32
37
  "data-testid": "inline-card-overlay-wrapper"
@@ -221,7 +221,7 @@ export var Datasource = /*#__PURE__*/function (_ReactNodeView) {
221
221
  var _props$pluginInjectio, _sharedState$currentS;
222
222
  var _this2;
223
223
  _classCallCheck(this, Datasource);
224
- _this2 = _super2.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
224
+ _this2 = _super2.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props);
225
225
  var sharedState = props === null || props === void 0 || (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 || (_props$pluginInjectio = _props$pluginInjectio.width) === null || _props$pluginInjectio === void 0 ? void 0 : _props$pluginInjectio.sharedState;
226
226
  _this2.tableWidth = sharedState === null || sharedState === void 0 || (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
227
227
  _this2.isNodeNested = props.isNodeNested;
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { memo, useCallback, useMemo } from 'react';
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import React, { memo, useCallback, useMemo, useState } from 'react';
3
4
  import rafSchedule from 'raf-schd';
4
5
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
5
6
  import { findOverflowScrollParent, UnsupportedInline } from '@atlaskit/editor-common/ui';
@@ -103,14 +104,20 @@ export function InlineCardNodeView(props) {
103
104
  enableInlineUpgradeFeatures = props.enableInlineUpgradeFeatures,
104
105
  pluginInjectionApi = props.pluginInjectionApi,
105
106
  onClickCallback = props.onClickCallback;
107
+ var _useState = useState(false),
108
+ _useState2 = _slicedToArray(_useState, 2),
109
+ isOverlayHovered = _useState2[0],
110
+ setIsOverlayHovered = _useState2[1];
106
111
  var floatingToolbarNode = (_useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['floatingToolbar']).floatingToolbarState) === null || _useSharedPluginState === void 0 || (_useSharedPluginState = _useSharedPluginState.configWithNodeInfo) === null || _useSharedPluginState === void 0 ? void 0 : _useSharedPluginState.node;
107
112
  if (fg('platform.linking-platform.smart-links-in-live-pages')) {
108
113
  var showHoverPreview = floatingToolbarNode !== node;
109
114
  var livePagesHoverCardFadeInDelay = 800;
110
115
  return /*#__PURE__*/React.createElement(OverlayWrapper, {
111
116
  targetElementPos: getPos(),
112
- view: view
117
+ view: view,
118
+ isHoveredCallback: setIsOverlayHovered
113
119
  }, /*#__PURE__*/React.createElement(WrappedInlineCard, {
120
+ isHovered: isOverlayHovered,
114
121
  node: node,
115
122
  view: view,
116
123
  getPos: getPos,
@@ -10,7 +10,7 @@ import { canRenderDatasource } from '@atlaskit/editor-common/utils';
10
10
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
11
11
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
12
12
  import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
13
- import { fg, getBooleanFF } from '@atlaskit/platform-feature-flags';
13
+ import { fg } from '@atlaskit/platform-feature-flags';
14
14
  import { eventsFromTransaction } from '../analytics/events-from-tr';
15
15
  import { isLocalStorageKeyDiscovered } from '../common/local-storage';
16
16
  import { BlockCard } from '../nodeviews/blockCard';
@@ -28,7 +28,7 @@ export { pluginKey } from './plugin-key';
28
28
  var LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = 'smart-link-upgrade-pulse';
29
29
  export var ALLOW_EVENTS_CLASSNAME = 'card-plugin-element-allow-events';
30
30
  export var stopEvent = function stopEvent(event) {
31
- if (!getBooleanFF('platform.linking-platform.smart-links-in-live-pages')) {
31
+ if (!fg('platform.linking-platform.smart-links-in-live-pages')) {
32
32
  return false;
33
33
  }
34
34
  var target = event.target;
@@ -111,7 +111,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
111
111
  var events = eventsFromTransaction(tr, prevEditorState);
112
112
  cardPluginEvents.push.apply(cardPluginEvents, _toConsumableArray(events));
113
113
  }
114
- if (getBooleanFF('platform.linking-platform.enable-datasource-appearance-toolbar') && !meta) {
114
+ if (!meta && fg('platform.linking-platform.enable-datasource-appearance-toolbar')) {
115
115
  if (pluginState.datasourceTableRef) {
116
116
  if (!(tr.selection instanceof NodeSelection) || !tr.selection.node.attrs.datasource) {
117
117
  // disable resize button when switching from datasource to block card
@@ -182,7 +182,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
182
182
  };
183
183
 
184
184
  // since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
185
- var layout = getBooleanFF('platform.linking-platform.editor-datasource-typeguards') ? getLayout() : (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || DATASOURCE_DEFAULT_LAYOUT;
185
+ var layout = fg('platform.linking-platform.editor-datasource-typeguards') ? getLayout() : (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || DATASOURCE_DEFAULT_LAYOUT;
186
186
  var isNested = selection.$anchor.depth > 0;
187
187
 
188
188
  // we want to disable resize button when datasource table is nested by not setting then datasourceTableRef on selection
@@ -255,8 +255,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
255
255
  pluginInjectionApi: pluginInjectionApi,
256
256
  onClickCallback: options.onClickCallback
257
257
  };
258
- var hasIntlContext = true;
259
- var isDatasource = getBooleanFF('platform.linking-platform.editor-datasource-typeguards') ? isDatasourceNode(node) : !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
258
+ var isDatasource = fg('platform.linking-platform.editor-datasource-typeguards') ? isDatasourceNode(node) : !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
260
259
  if (isDatasource) {
261
260
  var _node$attrs4;
262
261
  if (options.allowDatasource && platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 || (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 || (_node$attrs4 = _node$attrs4.datasource) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.id)) {
@@ -269,7 +268,6 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
269
268
  getPos: getPos,
270
269
  portalProviderAPI: portalProviderAPI,
271
270
  eventDispatcher: eventDispatcher,
272
- hasIntlContext: hasIntlContext,
273
271
  pluginInjectionApi: pluginInjectionApi,
274
272
  isNodeNested: isNodeNested
275
273
  }).init();
@@ -277,7 +275,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
277
275
  return inlineCardViewProducer(node, view, getPos, decorations);
278
276
  }
279
277
  }
280
- return new BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
278
+ return new BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
281
279
  },
282
280
  embedCard: function embedCard(node, view, getPos) {
283
281
  var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
@@ -294,8 +292,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
294
292
  showServerActions: showServerActions,
295
293
  onClickCallback: options.onClickCallback
296
294
  };
297
- var hasIntlContext = true;
298
- return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
295
+ return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
299
296
  }
300
297
  }
301
298
  }, enableInlineUpgradeFeatures && {
@@ -13,7 +13,8 @@ var ConfigureOverlayWrapperStyles = css({
13
13
  var OverlayWrapper = function OverlayWrapper(_ref) {
14
14
  var view = _ref.view,
15
15
  targetElementPos = _ref.targetElementPos,
16
- children = _ref.children;
16
+ children = _ref.children,
17
+ hoverCallback = _ref.isHoveredCallback;
17
18
  var _useState = useState(false),
18
19
  _useState2 = _slicedToArray(_useState, 2),
19
20
  showConfigureButton = _useState2[0],
@@ -30,11 +31,13 @@ var OverlayWrapper = function OverlayWrapper(_ref) {
30
31
  }, []);
31
32
  return jsx("span", {
32
33
  onMouseEnter: function onMouseEnter() {
33
- return setShowConfigureButton(true);
34
+ setShowConfigureButton(true);
35
+ hoverCallback(true);
34
36
  },
35
37
  onMouseLeave: function onMouseLeave() {
36
38
  if (!dropdownOpen) {
37
39
  setShowConfigureButton(false);
40
+ hoverCallback(false);
38
41
  }
39
42
  },
40
43
  "data-testid": "inline-card-overlay-wrapper"
@@ -4,7 +4,6 @@ import { jsx } from '@emotion/react';
4
4
  import PropTypes from 'prop-types';
5
5
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
6
6
  import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
7
- import type { LegacyPortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
8
7
  import type { getPosHandler, ReactComponentProps } from '@atlaskit/editor-common/react-node-view';
9
8
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
10
9
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
@@ -15,9 +14,8 @@ export interface DatasourceProps extends ReactComponentProps {
15
14
  node: PMNode;
16
15
  view: EditorView;
17
16
  getPos: getPosHandler;
18
- portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI;
17
+ portalProviderAPI: PortalProviderAPI;
19
18
  eventDispatcher: EventDispatcher;
20
- hasIntlContext: boolean;
21
19
  pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
22
20
  isNodeNested?: boolean;
23
21
  }
@@ -1,9 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import { jsx } from '@emotion/react';
3
3
  import { type EditorView } from '@atlaskit/editor-prosemirror/view';
4
- declare const OverlayWrapper: ({ view, targetElementPos, children, }: {
4
+ declare const OverlayWrapper: ({ view, targetElementPos, children, isHoveredCallback: hoverCallback, }: {
5
5
  view: EditorView;
6
6
  targetElementPos: number | undefined;
7
7
  children: JSX.Element;
8
+ /** Fired when the mouse enters or leaves the overlay button */
9
+ isHoveredCallback: (isHovered: boolean) => void;
8
10
  }) => jsx.JSX.Element;
9
11
  export default OverlayWrapper;
@@ -4,7 +4,6 @@ import { jsx } from '@emotion/react';
4
4
  import PropTypes from 'prop-types';
5
5
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
6
6
  import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
7
- import type { LegacyPortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
8
7
  import type { getPosHandler, ReactComponentProps } from '@atlaskit/editor-common/react-node-view';
9
8
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
10
9
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
@@ -15,9 +14,8 @@ export interface DatasourceProps extends ReactComponentProps {
15
14
  node: PMNode;
16
15
  view: EditorView;
17
16
  getPos: getPosHandler;
18
- portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI;
17
+ portalProviderAPI: PortalProviderAPI;
19
18
  eventDispatcher: EventDispatcher;
20
- hasIntlContext: boolean;
21
19
  pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
22
20
  isNodeNested?: boolean;
23
21
  }
@@ -1,9 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import { jsx } from '@emotion/react';
3
3
  import { type EditorView } from '@atlaskit/editor-prosemirror/view';
4
- declare const OverlayWrapper: ({ view, targetElementPos, children, }: {
4
+ declare const OverlayWrapper: ({ view, targetElementPos, children, isHoveredCallback: hoverCallback, }: {
5
5
  view: EditorView;
6
6
  targetElementPos: number | undefined;
7
7
  children: JSX.Element;
8
+ /** Fired when the mouse enters or leaves the overlay button */
9
+ isHoveredCallback: (isHovered: boolean) => void;
8
10
  }) => jsx.JSX.Element;
9
11
  export default OverlayWrapper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "2.5.1",
3
+ "version": "2.6.0",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,10 +34,10 @@
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-schema": "^39.0.3",
36
36
  "@atlaskit/analytics-next": "^9.3.0",
37
- "@atlaskit/button": "^18.3.0",
37
+ "@atlaskit/button": "^18.4.0",
38
38
  "@atlaskit/custom-steps": "^0.4.0",
39
39
  "@atlaskit/dropdown-menu": "^12.14.0",
40
- "@atlaskit/editor-common": "^84.5.0",
40
+ "@atlaskit/editor-common": "^85.0.0",
41
41
  "@atlaskit/editor-plugin-analytics": "^1.4.0",
42
42
  "@atlaskit/editor-plugin-decorations": "^1.1.0",
43
43
  "@atlaskit/editor-plugin-editor-disabled": "^1.1.0",
@@ -54,13 +54,13 @@
54
54
  "@atlaskit/link-client-extension": "^1.9.0",
55
55
  "@atlaskit/link-datasource": "^2.5.0",
56
56
  "@atlaskit/linking-common": "^5.7.0",
57
- "@atlaskit/linking-types": "^8.10.0",
58
- "@atlaskit/menu": "2.7.4",
57
+ "@atlaskit/linking-types": "^8.11.0",
58
+ "@atlaskit/menu": "2.8.0",
59
59
  "@atlaskit/platform-feature-flags": "^0.3.0",
60
60
  "@atlaskit/primitives": "^11.0.0",
61
61
  "@atlaskit/smart-card": "^27.9.0",
62
62
  "@atlaskit/theme": "^12.11.0",
63
- "@atlaskit/tokens": "^1.53.0",
63
+ "@atlaskit/tokens": "^1.54.0",
64
64
  "@atlaskit/tooltip": "^18.5.0",
65
65
  "@babel/runtime": "^7.0.0",
66
66
  "@emotion/react": "^11.7.1",