@atlaskit/editor-plugin-card 7.4.2 → 7.4.4

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,21 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 7.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`20d3223b57972`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/20d3223b57972) -
8
+ Opted out of debounced portal provider
9
+ - [`0412437292a6d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0412437292a6d) -
10
+ Switches linking changes for Preview Panel from FG to an experiment.
11
+ - Updated dependencies
12
+
13
+ ## 7.4.3
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 7.4.2
4
20
 
5
21
  ### Patch Changes
@@ -537,6 +537,8 @@ var embedCardNodeView = exports.embedCardNodeView = function embedCardNodeView(_
537
537
  CompetitorPrompt: CompetitorPrompt,
538
538
  isPageSSRed: isPageSSRed
539
539
  };
540
- return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
540
+ return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, undefined,
541
+ // @portal-render-immediately
542
+ true).init();
541
543
  };
542
544
  };
@@ -11,8 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
11
11
  var _hooks = require("@atlaskit/editor-common/hooks");
12
12
  var _ui = require("@atlaskit/editor-common/ui");
13
13
  var _state = require("@atlaskit/editor-prosemirror/state");
14
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
14
  var _smartCard = require("@atlaskit/smart-card");
15
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
16
16
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
17
17
  var _actions = require("../pm-plugins/actions");
18
18
  var _pluginKey = require("../pm-plugins/plugin-key");
@@ -96,7 +96,7 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
96
96
  selection = _useSharedState.selection;
97
97
  var floatingToolbarNode = selection instanceof _state.NodeSelection && selection.node;
98
98
  // This is a prop to show Hover card, Hover card should be shown only in Live View and Classic Renderer (note when only Editor controls enabled we don't show in Live view)
99
- var showHoverPreview = floatingToolbarNode !== node && (0, _platformFeatureFlags.fg)('platform_editor_preview_panel_linking');
99
+ var showHoverPreview = floatingToolbarNode !== node && (0, _expValEquals.expValEquals)('platform_editor_preview_panel_linking_exp', 'isEnabled', true);
100
100
  var innerCardWithOpenButtonOverlay = (0, _react.useMemo)(function () {
101
101
  var _pluginInjectionApi$a;
102
102
  return /*#__PURE__*/_react.default.createElement(_ui.HoverLinkOverlay, {
@@ -137,10 +137,10 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
137
137
  }, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed, pluginInjectionApi]);
138
138
  var shouldShowOpenButtonOverlay = (0, _react.useMemo)(function () {
139
139
  var shouldShowOpenButtonOverlayInChomeless = editorAppearance === 'chromeless';
140
- return (mode === 'edit' || editorAppearance === 'comment' || shouldShowOpenButtonOverlayInChomeless) && ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') || (0, _platformFeatureFlags.fg)('platform_editor_preview_panel_linking'));
140
+ return (mode === 'edit' || editorAppearance === 'comment' || shouldShowOpenButtonOverlayInChomeless) && ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') || (0, _expValEquals.expValEquals)('platform_editor_preview_panel_linking_exp', 'isEnabled', true));
141
141
  }, [mode, editorAppearance]);
142
142
  var innerCard = shouldShowOpenButtonOverlay ? innerCardWithOpenButtonOverlay : innerCardOriginal;
143
- if (mode === 'view' && (0, _platformFeatureFlags.fg)('platform_editor_preview_panel_linking')) {
143
+ if (mode === 'view' && (0, _expValEquals.expValEquals)('platform_editor_preview_panel_linking_exp', 'isEnabled', true)) {
144
144
  var _cardContext$value;
145
145
  var url = node.attrs.url;
146
146
  var cardState = cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 || (_cardContext$value = _cardContext$value.store) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.getState()[url];
@@ -8,12 +8,14 @@ exports.blockCardSpecWithFixedToDOM = 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");
11
12
  var _colors = require("@atlaskit/theme/colors");
12
13
  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; }
13
14
  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; }
14
15
  // @nodeSpecException:toDOM patch
15
16
  var blockCardSpecWithFixedToDOM = exports.blockCardSpecWithFixedToDOM = function blockCardSpecWithFixedToDOM() {
16
- return _objectSpread(_objectSpread({}, _adfSchema.blockCard), {}, {
17
+ var blockCardNode = (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? _adfSchema.blockCardWithLocalId : _adfSchema.blockCard;
18
+ return _objectSpread(_objectSpread({}, blockCardNode), {}, {
17
19
  toDOM: function toDOM(node) {
18
20
  var _node$attrs;
19
21
  var _ref = node.attrs,
@@ -24,7 +26,7 @@ var blockCardSpecWithFixedToDOM = exports.blockCardSpecWithFixedToDOM = function
24
26
  layout = _ref3.layout,
25
27
  width = _ref3.width,
26
28
  datasource = _ref3.datasource;
27
- var attrs = {
29
+ var attrs = _objectSpread({
28
30
  'data-block-card': '',
29
31
  'data-card-url': url || '',
30
32
  'data-card-data': data ? JSON.stringify(data) : '',
@@ -32,7 +34,9 @@ var blockCardSpecWithFixedToDOM = exports.blockCardSpecWithFixedToDOM = function
32
34
  'data-layout': layout,
33
35
  'data-width': "".concat(width),
34
36
  class: 'blockCardView-content-wrap'
35
- };
37
+ }, (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? {
38
+ 'data-local-id': node.attrs.localId
39
+ } : {});
36
40
  return ['div', attrs, ['a', {
37
41
  // To match `packages/linking-platform/smart-card/src/view/CardWithUrl/component-lazy/LoadingCardLink.tsx`
38
42
  // Which uses frame styling `packages/linking-platform/smart-card/src/view/InlineCard/Frame/styled.ts`
@@ -9,6 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _adfSchema = require("@atlaskit/adf-schema");
10
10
  var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
11
11
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _colors = require("@atlaskit/theme/colors");
13
14
  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
15
  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; } /**
@@ -61,7 +62,8 @@ var LINE_LENGTH = 760;
61
62
 
62
63
  // @nodeSpecException:toDOM patch
63
64
  var embedCardSpecWithFixedToDOM = exports.embedCardSpecWithFixedToDOM = function embedCardSpecWithFixedToDOM() {
64
- return _objectSpread(_objectSpread({}, _adfSchema.embedCard), {}, {
65
+ var embedCardNode = (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? _adfSchema.embedCardWithLocalId : _adfSchema.embedCard;
66
+ return _objectSpread(_objectSpread({}, embedCardNode), {}, {
65
67
  toDOM: function toDOM(node) {
66
68
  var _node$attrs = node.attrs,
67
69
  url = _node$attrs.url,
@@ -70,7 +72,7 @@ var embedCardSpecWithFixedToDOM = exports.embedCardSpecWithFixedToDOM = function
70
72
  originalWidth = _node$attrs.originalWidth,
71
73
  originalHeight = _node$attrs.originalHeight;
72
74
  var aspectRatio = originalWidth && originalHeight ? originalWidth / originalHeight : _editorSharedStyles.DEFAULT_EMBED_CARD_WIDTH / _editorSharedStyles.DEFAULT_EMBED_CARD_HEIGHT;
73
- var attrs = {
75
+ var attrs = _objectSpread({
74
76
  'data-embed-card': '',
75
77
  'data-card-url': url,
76
78
  'data-layout': layout,
@@ -86,7 +88,9 @@ var embedCardSpecWithFixedToDOM = exports.embedCardSpecWithFixedToDOM = function
86
88
  marginLeft: layout === 'align-start' ? '0' : '',
87
89
  float: float(layout)
88
90
  })
89
- };
91
+ }, (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? {
92
+ 'data-local-id': node.attrs.localId
93
+ } : {});
90
94
  return ['div', attrs,
91
95
  // This is the only modification to the embed card `toDOM`
92
96
  // This is to match the behaviour of Card which lazy loads
@@ -8,12 +8,14 @@ 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");
11
12
  var _colors = require("@atlaskit/theme/colors");
12
13
  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; }
13
14
  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; }
14
15
  // @nodeSpecException:toDOM patch
15
16
  var inlineCardSpecWithFixedToDOM = exports.inlineCardSpecWithFixedToDOM = function inlineCardSpecWithFixedToDOM() {
16
- return _objectSpread(_objectSpread({}, _adfSchema.inlineCard), {}, {
17
+ var inlineCardNode = (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? _adfSchema.inlineCardWithLocalId : _adfSchema.inlineCard;
18
+ return _objectSpread(_objectSpread({}, inlineCardNode), {}, {
17
19
  toDOM: function toDOM(node) {
18
20
  var wrapperAttrs = {
19
21
  class: 'inlineCardView-content-wrap inlineNodeView'
@@ -22,7 +24,7 @@ var inlineCardSpecWithFixedToDOM = exports.inlineCardSpecWithFixedToDOM = functi
22
24
  'aria-busy': 'true',
23
25
  class: 'card'
24
26
  };
25
- var attrs = {
27
+ var attrs = _objectSpread({
26
28
  'data-inline-card': '',
27
29
  href: node.attrs.url || '',
28
30
  'data-card-data': node.attrs.data ? JSON.stringify(node.attrs.data) : '',
@@ -45,7 +47,9 @@ var inlineCardSpecWithFixedToDOM = exports.inlineCardSpecWithFixedToDOM = functi
45
47
  msUserSelect: 'text',
46
48
  MozUserSelect: 'none' // -moz-user-select
47
49
  })
48
- };
50
+ }, (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? {
51
+ 'data-local-id': node.attrs.localId
52
+ } : {});
49
53
  if (node.attrs.url) {
50
54
  return ['span', wrapperAttrs, ['span', cardAttrs, ['a', attrs, node.attrs.url]]];
51
55
  } else {
@@ -9,7 +9,7 @@ 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 _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
13
13
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
14
14
  var _utils = require("../../pm-plugins/utils");
15
15
  var _useLinkUpgradeDiscoverability = _interopRequireDefault(require("../hooks/useLinkUpgradeDiscoverability"));
@@ -86,7 +86,7 @@ var AwarenessWrapper = exports.AwarenessWrapper = function AwarenessWrapper(_ref
86
86
  setOverlayHoveredStyles(isHovered);
87
87
  }, [setOverlayHoveredStyles]);
88
88
  var cardWithOverlay = (0, _react.useMemo)(function () {
89
- if (shouldShowLinkOverlay && !(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && !(0, _platformFeatureFlags.fg)('platform_editor_preview_panel_linking')) {
89
+ if (shouldShowLinkOverlay && !(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && !(0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_preview_panel_linking_exp', 'isEnabled', true)) {
90
90
  return (0, _react2.jsx)(_InlineCardOverlay.default, {
91
91
  isSelected: isSelected,
92
92
  isVisible: isResolvedViewRendered && (isInserted || isHovered || isSelected),
@@ -331,7 +331,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
331
331
  testId: 'link-toolbar-edit-link-button',
332
332
  onClick: (0, _EditLinkToolbar.getEditLinkCallback)(editorAnalyticsApi, true)
333
333
  }];
334
- var openPreviewPanelItems = (0, _platformFeatureFlags.fg)('platform_editor_preview_panel_linking') ? [{
334
+ var openPreviewPanelItems = (0, _expValEquals.expValEquals)('platform_editor_preview_panel_linking_exp', 'isEnabled', true) ? [{
335
335
  type: 'custom',
336
336
  fallback: [],
337
337
  render: function render() {
@@ -510,5 +510,7 @@ export const embedCardNodeView = ({
510
510
  CompetitorPrompt,
511
511
  isPageSSRed
512
512
  };
513
- return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
513
+ return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, undefined,
514
+ // @portal-render-immediately
515
+ true).init();
514
516
  };
@@ -2,8 +2,8 @@ import React, { memo, useCallback, useMemo, useState } from 'react';
2
2
  import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { HoverLinkOverlay } from '@atlaskit/editor-common/ui';
4
4
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
- import { fg } from '@atlaskit/platform-feature-flags';
6
5
  import { getObjectAri, getObjectName, getObjectIconUrl } from '@atlaskit/smart-card';
6
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
7
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
8
  import { registerRemoveOverlay } from '../pm-plugins/actions';
9
9
  import { pluginKey } from '../pm-plugins/plugin-key';
@@ -76,7 +76,7 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
76
76
  } = useSharedState(pluginInjectionApi);
77
77
  const floatingToolbarNode = selection instanceof NodeSelection && selection.node;
78
78
  // This is a prop to show Hover card, Hover card should be shown only in Live View and Classic Renderer (note when only Editor controls enabled we don't show in Live view)
79
- const showHoverPreview = floatingToolbarNode !== node && fg('platform_editor_preview_panel_linking');
79
+ const showHoverPreview = floatingToolbarNode !== node && expValEquals('platform_editor_preview_panel_linking_exp', 'isEnabled', true);
80
80
  const innerCardWithOpenButtonOverlay = useMemo(() => {
81
81
  var _pluginInjectionApi$a;
82
82
  return /*#__PURE__*/React.createElement(HoverLinkOverlay, {
@@ -115,10 +115,10 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
115
115
  }), [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed, pluginInjectionApi]);
116
116
  const shouldShowOpenButtonOverlay = useMemo(() => {
117
117
  const shouldShowOpenButtonOverlayInChomeless = editorAppearance === 'chromeless';
118
- return (mode === 'edit' || editorAppearance === 'comment' || shouldShowOpenButtonOverlayInChomeless) && (editorExperiment('platform_editor_controls', 'variant1') || fg('platform_editor_preview_panel_linking'));
118
+ return (mode === 'edit' || editorAppearance === 'comment' || shouldShowOpenButtonOverlayInChomeless) && (editorExperiment('platform_editor_controls', 'variant1') || expValEquals('platform_editor_preview_panel_linking_exp', 'isEnabled', true));
119
119
  }, [mode, editorAppearance]);
120
120
  let innerCard = shouldShowOpenButtonOverlay ? innerCardWithOpenButtonOverlay : innerCardOriginal;
121
- if (mode === 'view' && fg('platform_editor_preview_panel_linking')) {
121
+ if (mode === 'view' && expValEquals('platform_editor_preview_panel_linking_exp', 'isEnabled', true)) {
122
122
  var _cardContext$value, _cardContext$value$st;
123
123
  const url = node.attrs.url;
124
124
  const cardState = cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : (_cardContext$value$st = _cardContext$value.store) === null || _cardContext$value$st === void 0 ? void 0 : _cardContext$value$st.getState()[url];
@@ -1,10 +1,12 @@
1
- import { blockCard } from '@atlaskit/adf-schema';
1
+ import { blockCard, blockCardWithLocalId } from '@atlaskit/adf-schema';
2
2
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { B400 } from '@atlaskit/theme/colors';
4
5
  // @nodeSpecException:toDOM patch
5
6
  export const blockCardSpecWithFixedToDOM = () => {
7
+ const blockCardNode = fg('platform_editor_adf_with_localid') ? blockCardWithLocalId : blockCard;
6
8
  return {
7
- ...blockCard,
9
+ ...blockCardNode,
8
10
  toDOM: node => {
9
11
  var _node$attrs;
10
12
  const {
@@ -25,7 +27,10 @@ export const blockCardSpecWithFixedToDOM = () => {
25
27
  'data-datasource': datasource ? JSON.stringify(datasource) : '',
26
28
  'data-layout': layout,
27
29
  'data-width': `${width}`,
28
- class: 'blockCardView-content-wrap'
30
+ class: 'blockCardView-content-wrap',
31
+ ...(fg('platform_editor_adf_with_localid') ? {
32
+ 'data-local-id': node.attrs.localId
33
+ } : {})
29
34
  };
30
35
  return ['div', attrs, ['a', {
31
36
  // To match `packages/linking-platform/smart-card/src/view/CardWithUrl/component-lazy/LoadingCardLink.tsx`
@@ -8,9 +8,10 @@
8
8
  * In the long term likely `toDOM` will move back out of `adf-schema` in which
9
9
  * case we can consolidate them.
10
10
  */
11
- import { embedCard } from '@atlaskit/adf-schema';
11
+ import { embedCard, embedCardWithLocalId } from '@atlaskit/adf-schema';
12
12
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
13
13
  import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
14
+ import { fg } from '@atlaskit/platform-feature-flags';
14
15
  import { B400 } from '@atlaskit/theme/colors';
15
16
  // From `packages/editor/editor-common/src/ui/MediaSingle/styled.tsx`
16
17
  function calcMargin(layout) {
@@ -52,8 +53,9 @@ const LINE_LENGTH = 760;
52
53
 
53
54
  // @nodeSpecException:toDOM patch
54
55
  export const embedCardSpecWithFixedToDOM = () => {
56
+ const embedCardNode = fg('platform_editor_adf_with_localid') ? embedCardWithLocalId : embedCard;
55
57
  return {
56
- ...embedCard,
58
+ ...embedCardNode,
57
59
  toDOM: node => {
58
60
  const {
59
61
  url,
@@ -78,7 +80,10 @@ export const embedCardSpecWithFixedToDOM = () => {
78
80
  marginRight: layout === 'align-end' ? '0' : '',
79
81
  marginLeft: layout === 'align-start' ? '0' : '',
80
82
  float: float(layout)
81
- })
83
+ }),
84
+ ...(fg('platform_editor_adf_with_localid') ? {
85
+ 'data-local-id': node.attrs.localId
86
+ } : {})
82
87
  };
83
88
  return ['div', attrs,
84
89
  // This is the only modification to the embed card `toDOM`
@@ -1,10 +1,12 @@
1
- import { inlineCard } from '@atlaskit/adf-schema';
1
+ import { inlineCard, inlineCardWithLocalId } from '@atlaskit/adf-schema';
2
2
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { B400 } from '@atlaskit/theme/colors';
4
5
  // @nodeSpecException:toDOM patch
5
6
  export const inlineCardSpecWithFixedToDOM = () => {
7
+ const inlineCardNode = fg('platform_editor_adf_with_localid') ? inlineCardWithLocalId : inlineCard;
6
8
  return {
7
- ...inlineCard,
9
+ ...inlineCardNode,
8
10
  toDOM: node => {
9
11
  const wrapperAttrs = {
10
12
  class: 'inlineCardView-content-wrap inlineNodeView'
@@ -35,7 +37,10 @@ export const inlineCardSpecWithFixedToDOM = () => {
35
37
  WebkitUserSelect: 'text',
36
38
  msUserSelect: 'text',
37
39
  MozUserSelect: 'none' // -moz-user-select
38
- })
40
+ }),
41
+ ...(fg('platform_editor_adf_with_localid') ? {
42
+ 'data-local-id': node.attrs.localId
43
+ } : {})
39
44
  };
40
45
  if (node.attrs.url) {
41
46
  return ['span', wrapperAttrs, ['span', cardAttrs, ['a', attrs, node.attrs.url]]];
@@ -7,7 +7,7 @@ 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 { fg } from '@atlaskit/platform-feature-flags';
10
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
11
11
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
12
12
  import { getResolvedAttributesFromStore } from '../../pm-plugins/utils';
13
13
  import useLinkUpgradeDiscoverability from '../hooks/useLinkUpgradeDiscoverability';
@@ -76,7 +76,7 @@ export const AwarenessWrapper = ({
76
76
  setOverlayHoveredStyles(isHovered);
77
77
  }, [setOverlayHoveredStyles]);
78
78
  const cardWithOverlay = useMemo(() => {
79
- if (shouldShowLinkOverlay && !editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_preview_panel_linking')) {
79
+ if (shouldShowLinkOverlay && !editorExperiment('platform_editor_controls', 'variant1') && !expValEqualsNoExposure('platform_editor_preview_panel_linking_exp', 'isEnabled', true)) {
80
80
  return jsx(InlineCardOverlay, {
81
81
  isSelected: isSelected,
82
82
  isVisible: isResolvedViewRendered && (isInserted || isHovered || isSelected),
@@ -321,7 +321,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
321
321
  testId: 'link-toolbar-edit-link-button',
322
322
  onClick: getEditLinkCallback(editorAnalyticsApi, true)
323
323
  }];
324
- const openPreviewPanelItems = fg('platform_editor_preview_panel_linking') ? [{
324
+ const openPreviewPanelItems = expValEquals('platform_editor_preview_panel_linking_exp', 'isEnabled', true) ? [{
325
325
  type: 'custom',
326
326
  fallback: [],
327
327
  render: () => /*#__PURE__*/React.createElement(OpenPreviewPanelToolbarButton, {
@@ -530,6 +530,8 @@ export var embedCardNodeView = function embedCardNodeView(_ref4) {
530
530
  CompetitorPrompt: CompetitorPrompt,
531
531
  isPageSSRed: isPageSSRed
532
532
  };
533
- return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
533
+ return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, undefined,
534
+ // @portal-render-immediately
535
+ true).init();
534
536
  };
535
537
  };
@@ -3,8 +3,8 @@ import React, { memo, useCallback, useMemo, useState } from 'react';
3
3
  import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
4
  import { HoverLinkOverlay } from '@atlaskit/editor-common/ui';
5
5
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
6
  import { getObjectAri, getObjectName, getObjectIconUrl } from '@atlaskit/smart-card';
7
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
9
  import { registerRemoveOverlay } from '../pm-plugins/actions';
10
10
  import { pluginKey } from '../pm-plugins/plugin-key';
@@ -87,7 +87,7 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
87
87
  selection = _useSharedState.selection;
88
88
  var floatingToolbarNode = selection instanceof NodeSelection && selection.node;
89
89
  // This is a prop to show Hover card, Hover card should be shown only in Live View and Classic Renderer (note when only Editor controls enabled we don't show in Live view)
90
- var showHoverPreview = floatingToolbarNode !== node && fg('platform_editor_preview_panel_linking');
90
+ var showHoverPreview = floatingToolbarNode !== node && expValEquals('platform_editor_preview_panel_linking_exp', 'isEnabled', true);
91
91
  var innerCardWithOpenButtonOverlay = useMemo(function () {
92
92
  var _pluginInjectionApi$a;
93
93
  return /*#__PURE__*/React.createElement(HoverLinkOverlay, {
@@ -128,10 +128,10 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
128
128
  }, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed, pluginInjectionApi]);
129
129
  var shouldShowOpenButtonOverlay = useMemo(function () {
130
130
  var shouldShowOpenButtonOverlayInChomeless = editorAppearance === 'chromeless';
131
- return (mode === 'edit' || editorAppearance === 'comment' || shouldShowOpenButtonOverlayInChomeless) && (editorExperiment('platform_editor_controls', 'variant1') || fg('platform_editor_preview_panel_linking'));
131
+ return (mode === 'edit' || editorAppearance === 'comment' || shouldShowOpenButtonOverlayInChomeless) && (editorExperiment('platform_editor_controls', 'variant1') || expValEquals('platform_editor_preview_panel_linking_exp', 'isEnabled', true));
132
132
  }, [mode, editorAppearance]);
133
133
  var innerCard = shouldShowOpenButtonOverlay ? innerCardWithOpenButtonOverlay : innerCardOriginal;
134
- if (mode === 'view' && fg('platform_editor_preview_panel_linking')) {
134
+ if (mode === 'view' && expValEquals('platform_editor_preview_panel_linking_exp', 'isEnabled', true)) {
135
135
  var _cardContext$value;
136
136
  var url = node.attrs.url;
137
137
  var cardState = cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 || (_cardContext$value = _cardContext$value.store) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.getState()[url];
@@ -1,12 +1,14 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
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
- import { blockCard } from '@atlaskit/adf-schema';
4
+ import { blockCard, blockCardWithLocalId } from '@atlaskit/adf-schema';
5
5
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { B400 } from '@atlaskit/theme/colors';
7
8
  // @nodeSpecException:toDOM patch
8
9
  export var blockCardSpecWithFixedToDOM = function blockCardSpecWithFixedToDOM() {
9
- return _objectSpread(_objectSpread({}, blockCard), {}, {
10
+ var blockCardNode = fg('platform_editor_adf_with_localid') ? blockCardWithLocalId : blockCard;
11
+ return _objectSpread(_objectSpread({}, blockCardNode), {}, {
10
12
  toDOM: function toDOM(node) {
11
13
  var _node$attrs;
12
14
  var _ref = node.attrs,
@@ -17,7 +19,7 @@ export var blockCardSpecWithFixedToDOM = function blockCardSpecWithFixedToDOM()
17
19
  layout = _ref3.layout,
18
20
  width = _ref3.width,
19
21
  datasource = _ref3.datasource;
20
- var attrs = {
22
+ var attrs = _objectSpread({
21
23
  'data-block-card': '',
22
24
  'data-card-url': url || '',
23
25
  'data-card-data': data ? JSON.stringify(data) : '',
@@ -25,7 +27,9 @@ export var blockCardSpecWithFixedToDOM = function blockCardSpecWithFixedToDOM()
25
27
  'data-layout': layout,
26
28
  'data-width': "".concat(width),
27
29
  class: 'blockCardView-content-wrap'
28
- };
30
+ }, fg('platform_editor_adf_with_localid') ? {
31
+ 'data-local-id': node.attrs.localId
32
+ } : {});
29
33
  return ['div', attrs, ['a', {
30
34
  // To match `packages/linking-platform/smart-card/src/view/CardWithUrl/component-lazy/LoadingCardLink.tsx`
31
35
  // Which uses frame styling `packages/linking-platform/smart-card/src/view/InlineCard/Frame/styled.ts`
@@ -11,9 +11,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
11
11
  * In the long term likely `toDOM` will move back out of `adf-schema` in which
12
12
  * case we can consolidate them.
13
13
  */
14
- import { embedCard } from '@atlaskit/adf-schema';
14
+ import { embedCard, embedCardWithLocalId } from '@atlaskit/adf-schema';
15
15
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
16
16
  import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
17
+ import { fg } from '@atlaskit/platform-feature-flags';
17
18
  import { B400 } from '@atlaskit/theme/colors';
18
19
  // From `packages/editor/editor-common/src/ui/MediaSingle/styled.tsx`
19
20
  function calcMargin(layout) {
@@ -55,7 +56,8 @@ var LINE_LENGTH = 760;
55
56
 
56
57
  // @nodeSpecException:toDOM patch
57
58
  export var embedCardSpecWithFixedToDOM = function embedCardSpecWithFixedToDOM() {
58
- return _objectSpread(_objectSpread({}, embedCard), {}, {
59
+ var embedCardNode = fg('platform_editor_adf_with_localid') ? embedCardWithLocalId : embedCard;
60
+ return _objectSpread(_objectSpread({}, embedCardNode), {}, {
59
61
  toDOM: function toDOM(node) {
60
62
  var _node$attrs = node.attrs,
61
63
  url = _node$attrs.url,
@@ -64,7 +66,7 @@ export var embedCardSpecWithFixedToDOM = function embedCardSpecWithFixedToDOM()
64
66
  originalWidth = _node$attrs.originalWidth,
65
67
  originalHeight = _node$attrs.originalHeight;
66
68
  var aspectRatio = originalWidth && originalHeight ? originalWidth / originalHeight : DEFAULT_EMBED_CARD_WIDTH / DEFAULT_EMBED_CARD_HEIGHT;
67
- var attrs = {
69
+ var attrs = _objectSpread({
68
70
  'data-embed-card': '',
69
71
  'data-card-url': url,
70
72
  'data-layout': layout,
@@ -80,7 +82,9 @@ export var embedCardSpecWithFixedToDOM = function embedCardSpecWithFixedToDOM()
80
82
  marginLeft: layout === 'align-start' ? '0' : '',
81
83
  float: float(layout)
82
84
  })
83
- };
85
+ }, fg('platform_editor_adf_with_localid') ? {
86
+ 'data-local-id': node.attrs.localId
87
+ } : {});
84
88
  return ['div', attrs,
85
89
  // This is the only modification to the embed card `toDOM`
86
90
  // This is to match the behaviour of Card which lazy loads
@@ -1,12 +1,14 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
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
- import { inlineCard } from '@atlaskit/adf-schema';
4
+ import { inlineCard, inlineCardWithLocalId } from '@atlaskit/adf-schema';
5
5
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { B400 } from '@atlaskit/theme/colors';
7
8
  // @nodeSpecException:toDOM patch
8
9
  export var inlineCardSpecWithFixedToDOM = function inlineCardSpecWithFixedToDOM() {
9
- return _objectSpread(_objectSpread({}, inlineCard), {}, {
10
+ var inlineCardNode = fg('platform_editor_adf_with_localid') ? inlineCardWithLocalId : inlineCard;
11
+ return _objectSpread(_objectSpread({}, inlineCardNode), {}, {
10
12
  toDOM: function toDOM(node) {
11
13
  var wrapperAttrs = {
12
14
  class: 'inlineCardView-content-wrap inlineNodeView'
@@ -15,7 +17,7 @@ export var inlineCardSpecWithFixedToDOM = function inlineCardSpecWithFixedToDOM(
15
17
  'aria-busy': 'true',
16
18
  class: 'card'
17
19
  };
18
- var attrs = {
20
+ var attrs = _objectSpread({
19
21
  'data-inline-card': '',
20
22
  href: node.attrs.url || '',
21
23
  'data-card-data': node.attrs.data ? JSON.stringify(node.attrs.data) : '',
@@ -38,7 +40,9 @@ export var inlineCardSpecWithFixedToDOM = function inlineCardSpecWithFixedToDOM(
38
40
  msUserSelect: 'text',
39
41
  MozUserSelect: 'none' // -moz-user-select
40
42
  })
41
- };
43
+ }, fg('platform_editor_adf_with_localid') ? {
44
+ 'data-local-id': node.attrs.localId
45
+ } : {});
42
46
  if (node.attrs.url) {
43
47
  return ['span', wrapperAttrs, ['span', cardAttrs, ['a', attrs, node.attrs.url]]];
44
48
  } else {
@@ -8,7 +8,7 @@ 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 { fg } from '@atlaskit/platform-feature-flags';
11
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
12
12
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
13
13
  import { getResolvedAttributesFromStore } from '../../pm-plugins/utils';
14
14
  import useLinkUpgradeDiscoverability from '../hooks/useLinkUpgradeDiscoverability';
@@ -78,7 +78,7 @@ export var AwarenessWrapper = function AwarenessWrapper(_ref) {
78
78
  setOverlayHoveredStyles(isHovered);
79
79
  }, [setOverlayHoveredStyles]);
80
80
  var cardWithOverlay = useMemo(function () {
81
- if (shouldShowLinkOverlay && !editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_preview_panel_linking')) {
81
+ if (shouldShowLinkOverlay && !editorExperiment('platform_editor_controls', 'variant1') && !expValEqualsNoExposure('platform_editor_preview_panel_linking_exp', 'isEnabled', true)) {
82
82
  return jsx(InlineCardOverlay, {
83
83
  isSelected: isSelected,
84
84
  isVisible: isResolvedViewRendered && (isInserted || isHovered || isSelected),
@@ -322,7 +322,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
322
322
  testId: 'link-toolbar-edit-link-button',
323
323
  onClick: getEditLinkCallback(editorAnalyticsApi, true)
324
324
  }];
325
- var openPreviewPanelItems = fg('platform_editor_preview_panel_linking') ? [{
325
+ var openPreviewPanelItems = expValEquals('platform_editor_preview_panel_linking_exp', 'isEnabled', true) ? [{
326
326
  type: 'custom',
327
327
  fallback: [],
328
328
  render: function render() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "7.4.2",
3
+ "version": "7.4.4",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -54,7 +54,7 @@
54
54
  "@atlaskit/link-analytics": "^10.0.0",
55
55
  "@atlaskit/link-client-extension": "^5.0.0",
56
56
  "@atlaskit/link-datasource": "^4.19.0",
57
- "@atlaskit/linking-common": "^9.2.0",
57
+ "@atlaskit/linking-common": "^9.4.0",
58
58
  "@atlaskit/linking-types": "^14.0.0",
59
59
  "@atlaskit/menu": "^8.3.0",
60
60
  "@atlaskit/platform-feature-flags": "^1.1.0",
@@ -62,7 +62,7 @@
62
62
  "@atlaskit/primitives": "^14.11.0",
63
63
  "@atlaskit/smart-card": "^40.10.0",
64
64
  "@atlaskit/theme": "^19.0.0",
65
- "@atlaskit/tmp-editor-statsig": "^10.0.0",
65
+ "@atlaskit/tmp-editor-statsig": "^11.1.0",
66
66
  "@atlaskit/tokens": "^6.0.0",
67
67
  "@babel/runtime": "^7.0.0",
68
68
  "@emotion/react": "^11.7.1",
@@ -73,7 +73,7 @@
73
73
  },
74
74
  "peerDependencies": {
75
75
  "@atlaskit/editor-common": "^107.25.0",
76
- "@atlaskit/link-provider": "^3.4.0",
76
+ "@atlaskit/link-provider": "^3.6.0",
77
77
  "react": "^18.2.0",
78
78
  "react-intl-next": "npm:react-intl@^5.18.1"
79
79
  },
@@ -126,10 +126,10 @@
126
126
  "platform_editor_cards_maxcallstackfix": {
127
127
  "type": "boolean"
128
128
  },
129
- "platform_editor_preview_panel_linking": {
129
+ "platform_editor_controls_patch_15": {
130
130
  "type": "boolean"
131
131
  },
132
- "platform_editor_controls_patch_15": {
132
+ "platform_editor_adf_with_localid": {
133
133
  "type": "boolean"
134
134
  }
135
135
  },