@atlaskit/editor-plugin-card 13.0.0 → 13.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/nodeviews/datasource.js +1 -1
  3. package/dist/cjs/nodeviews/inlineCard.js +8 -1
  4. package/dist/cjs/pm-plugins/utils.js +3 -1
  5. package/dist/cjs/ui/AwarenessWrapper/index.js +1 -1
  6. package/dist/cjs/ui/ConfigureOverlay/index.js +1 -1
  7. package/dist/cjs/ui/DatasourceAppearanceButton.js +1 -1
  8. package/dist/cjs/ui/EditToolbarButton/EditToolbarButtonPresentation.js +1 -1
  9. package/dist/cjs/ui/EditToolbarButton/index.js +1 -1
  10. package/dist/cjs/ui/InlineCardOverlay/index.js +1 -1
  11. package/dist/cjs/ui/LayoutButton/index.js +3 -2
  12. package/dist/cjs/ui/ResizableEmbedCard.js +1 -1
  13. package/dist/es2019/nodeviews/datasource.js +1 -1
  14. package/dist/es2019/nodeviews/inlineCard.js +9 -2
  15. package/dist/es2019/pm-plugins/utils.js +3 -1
  16. package/dist/es2019/ui/AwarenessWrapper/index.js +1 -1
  17. package/dist/es2019/ui/ConfigureOverlay/index.js +1 -1
  18. package/dist/es2019/ui/DatasourceAppearanceButton.js +1 -1
  19. package/dist/es2019/ui/EditToolbarButton/EditToolbarButtonPresentation.js +1 -1
  20. package/dist/es2019/ui/EditToolbarButton/index.js +1 -1
  21. package/dist/es2019/ui/InlineCardOverlay/index.js +1 -1
  22. package/dist/es2019/ui/LayoutButton/index.js +3 -2
  23. package/dist/es2019/ui/ResizableEmbedCard.js +1 -1
  24. package/dist/esm/nodeviews/datasource.js +1 -1
  25. package/dist/esm/nodeviews/inlineCard.js +9 -2
  26. package/dist/esm/pm-plugins/utils.js +3 -1
  27. package/dist/esm/ui/AwarenessWrapper/index.js +1 -1
  28. package/dist/esm/ui/ConfigureOverlay/index.js +1 -1
  29. package/dist/esm/ui/DatasourceAppearanceButton.js +1 -1
  30. package/dist/esm/ui/EditToolbarButton/EditToolbarButtonPresentation.js +1 -1
  31. package/dist/esm/ui/EditToolbarButton/index.js +1 -1
  32. package/dist/esm/ui/InlineCardOverlay/index.js +1 -1
  33. package/dist/esm/ui/LayoutButton/index.js +3 -2
  34. package/dist/esm/ui/ResizableEmbedCard.js +1 -1
  35. package/dist/types/nodeviews/blockCard.d.ts +2 -2
  36. package/dist/types/nodeviews/inlineCard.d.ts +4 -3
  37. package/dist/types/nodeviews/lazy-inline-card.d.ts +2 -1
  38. package/dist/types/nodeviews/toDOM-fixes/blockCard.d.ts +18 -17
  39. package/dist/types/nodeviews/toDOM-fixes/embedCard.d.ts +18 -17
  40. package/dist/types/nodeviews/toDOM-fixes/inlineCard.d.ts +18 -17
  41. package/dist/types/pm-plugins/doc.d.ts +2 -2
  42. package/dist/types/pm-plugins/util/resolve.d.ts +2 -2
  43. package/dist/types/pm-plugins/util/state.d.ts +28 -20
  44. package/dist/types/ui/DatasourceDropdownOption.d.ts +8 -7
  45. package/dist/types/ui/LayoutButton/index.d.ts +9 -4
  46. package/dist/types/ui/LayoutButton/utils.d.ts +3 -2
  47. package/dist/types/ui/ResizableEmbedCard.d.ts +3 -2
  48. package/dist/types/ui/analytics/utils.d.ts +2 -1
  49. package/dist/types/ui/datasourceErrorBoundary.d.ts +1 -1
  50. package/dist/types-ts4.5/nodeviews/blockCard.d.ts +2 -2
  51. package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +4 -3
  52. package/dist/types-ts4.5/nodeviews/lazy-inline-card.d.ts +2 -1
  53. package/dist/types-ts4.5/nodeviews/toDOM-fixes/blockCard.d.ts +18 -17
  54. package/dist/types-ts4.5/nodeviews/toDOM-fixes/embedCard.d.ts +18 -17
  55. package/dist/types-ts4.5/nodeviews/toDOM-fixes/inlineCard.d.ts +18 -17
  56. package/dist/types-ts4.5/pm-plugins/doc.d.ts +2 -2
  57. package/dist/types-ts4.5/pm-plugins/util/resolve.d.ts +2 -2
  58. package/dist/types-ts4.5/pm-plugins/util/state.d.ts +28 -20
  59. package/dist/types-ts4.5/ui/DatasourceDropdownOption.d.ts +8 -7
  60. package/dist/types-ts4.5/ui/LayoutButton/index.d.ts +9 -4
  61. package/dist/types-ts4.5/ui/LayoutButton/utils.d.ts +3 -2
  62. package/dist/types-ts4.5/ui/ResizableEmbedCard.d.ts +3 -2
  63. package/dist/types-ts4.5/ui/analytics/utils.d.ts +2 -1
  64. package/dist/types-ts4.5/ui/datasourceErrorBoundary.d.ts +1 -1
  65. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 13.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`14aa7871be0b7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/14aa7871be0b7) -
8
+ [ux] EDITOR-5513: fix(editor-plugin-card): guard inline card cleanup to dispatch removeCard at
9
+ most once per effect cycle
10
+ - Updated dependencies
11
+
12
+ ## 13.0.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 13.0.0
4
19
 
5
20
  ### Minor Changes
@@ -31,7 +31,7 @@ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0,
31
31
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
32
32
  * @jsxRuntime classic
33
33
  * @jsx jsx
34
- */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
34
+ */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
35
35
  var getPosSafely = function getPosSafely(pos) {
36
36
  if (!pos || typeof pos === 'boolean') {
37
37
  return;
@@ -49,12 +49,18 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
49
49
  data = _node$attrs.data;
50
50
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
51
51
  var refId = (0, _react.useRef)((0, _v.default)());
52
+ var removeCardDispatched = (0, _react.useRef)(false);
52
53
  var _ref2 = (cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store) || {},
53
54
  getSmartlinkState = _ref2.getState;
54
55
  var cardState = getSmartlinkState === null || getSmartlinkState === void 0 ? void 0 : getSmartlinkState()[url || ''];
55
56
  (0, _react.useEffect)(function () {
56
57
  var id = refId.current;
58
+ removeCardDispatched.current = false;
57
59
  return function () {
60
+ if ((0, _expValEquals.expValEquals)('platform_editor_inline_card_dispatch_guard', 'isEnabled', true) && removeCardDispatched.current) {
61
+ return;
62
+ }
63
+ removeCardDispatched.current = true;
58
64
  var tr = view.state.tr;
59
65
  (0, _actions.removeCard)({
60
66
  id: id
@@ -167,6 +173,7 @@ var selector = function selector(states) {
167
173
  };
168
174
 
169
175
  /**
176
+ * Inline card node view component that renders a Smart Link inline card within the editor.
170
177
  *
171
178
  * @param props
172
179
  * @example
@@ -208,7 +215,7 @@ function InlineCardNodeView(props) {
208
215
  }, enableInlineUpgradeFeatures && (0, _utils.getAwarenessProps)(view.state, getPos, allowEmbeds, allowBlockCards, mode === 'view'))), CompetitorPromptComponent);
209
216
  return (0, _expValEquals.expValEquals)('cc_drag_and_drop_smart_link_from_content_to_tree', 'isEnabled', true) ? /*#__PURE__*/_react.default.createElement(_editorSmartLinkDraggable.SmartLinkDraggable, {
210
217
  url: url,
211
- appearance: _editorSmartLinkDraggable.SMART_LINK_APPERANCE.INLINE,
218
+ appearance: _editorSmartLinkDraggable.SMART_LINK_APPEARANCE.INLINE,
212
219
  source: _editorSmartLinkDraggable.SMART_LINK_DRAG_TYPES.EDITOR
213
220
  }, inlineCardContent) : inlineCardContent;
214
221
  }
@@ -68,7 +68,9 @@ var isEmbedSupportedAtPosition = exports.isEmbedSupportedAtPosition = function i
68
68
  var isBlockSupportedAtPosition = exports.isBlockSupportedAtPosition = function isBlockSupportedAtPosition(currentNodePosition, editorState, currentAppearance) {
69
69
  return isAppearanceSupportedInParent(currentNodePosition, editorState, _model.Fragment.from(editorState.schema.nodes.blockCard.createChecked({})), currentAppearance);
70
70
  };
71
- var getResolvedAttributesFromStore = exports.getResolvedAttributesFromStore = function getResolvedAttributesFromStore(url, display, store) {
71
+ var getResolvedAttributesFromStore = exports.getResolvedAttributesFromStore = function getResolvedAttributesFromStore(url, display, store
72
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
73
+ ) {
72
74
  if (!store) {
73
75
  return {};
74
76
  }
@@ -20,7 +20,7 @@ var _Pulse = require("../Pulse");
20
20
  * @jsx jsx
21
21
  */
22
22
 
23
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
23
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
24
24
 
25
25
  // editor adds a standard line-height that is bigger than an inline smart link
26
26
  // due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
@@ -16,7 +16,7 @@ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
16
16
  */
17
17
 
18
18
  // not permitted to migrate atlaskit packages to compiled yet, see https://hello.atlassian.net/wiki/spaces/UAF/pages/3006969423/Migrating+AFM+platform+components+to+Compiled+a+guide
19
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
19
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
20
20
 
21
21
  var ConfigureOverlayWrapperStyles = (0, _react2.css)({
22
22
  position: 'relative',
@@ -22,7 +22,7 @@ var _useFetchDatasourceInfo = require("./useFetchDatasourceInfo");
22
22
  * @jsx jsx
23
23
  */
24
24
 
25
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
26
26
 
27
27
  var buttonStyles = (0, _react2.css)({
28
28
  pointerEvents: 'auto'
@@ -23,7 +23,7 @@ var _editDatasourceAction = require("../editDatasourceAction");
23
23
  * @jsx jsx
24
24
  */
25
25
 
26
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
27
27
 
28
28
  var dropdownExpandContainer = (0, _react2.css)({
29
29
  margin: "0px ".concat("var(--ds-space-negative-050, -4px)")
@@ -28,7 +28,7 @@ var _excluded = ["extensionKey"];
28
28
  * @jsxRuntime classic
29
29
  * @jsx jsx
30
30
  */
31
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
31
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
32
32
  var dropdownExpandContainer = (0, _react2.css)({
33
33
  margin: "0px ".concat("var(--ds-space-negative-050, -4px)")
34
34
  });
@@ -26,7 +26,7 @@ var _excluded = ["children", "isSelected", "isVisible", "testId", "url"];
26
26
  * @jsxRuntime classic
27
27
  * @jsx jsx
28
28
  */
29
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
29
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
30
30
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
31
31
  var DEBOUNCE_IN_MS = 5;
32
32
  var ESTIMATED_MIN_WIDTH_IN_PX = 16;
@@ -24,7 +24,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
24
24
  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; } /**
25
25
  * @jsxRuntime classic
26
26
  * @jsx jsx
27
- */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
27
+ */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
28
28
  var toolbarButtonWrapperStyles = (0, _react2.css)({
29
29
  background: "".concat("var(--ds-background-neutral, ".concat(_colors.N20A, ")")),
30
30
  color: "".concat("var(--ds-icon, ".concat(_colors.N300, ")")),
@@ -131,4 +131,5 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
131
131
  intl: intl
132
132
  });
133
133
  };
134
- var _default = exports.default = (0, _reactIntlNext.injectIntl)(LayoutButtonWrapper);
134
+ var _default_1 = (0, _reactIntlNext.injectIntl)(LayoutButtonWrapper);
135
+ var _default = exports.default = _default_1;
@@ -25,7 +25,7 @@ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0,
25
25
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
26
26
  * @jsxRuntime classic
27
27
  * @jsx jsx
28
- */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
28
+ */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
29
29
  // eslint-disable-next-line @repo/internal/react/no-class-components
30
30
  var ResizableEmbedCard = exports.default = /*#__PURE__*/function (_React$Component) {
31
31
  function ResizableEmbedCard() {
@@ -5,7 +5,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  */
6
6
  import React from 'react';
7
7
 
8
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
9
9
  import { jsx } from '@emotion/react';
10
10
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
11
11
  import { DATASOURCE_INNER_CONTAINER_CLASSNAME, SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles';
@@ -6,7 +6,7 @@ import uuid from 'uuid/v4';
6
6
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
7
7
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
8
8
  import { UnsupportedInline, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
9
- import { SmartLinkDraggable, SMART_LINK_DRAG_TYPES, SMART_LINK_APPERANCE } from '@atlaskit/editor-smart-link-draggable';
9
+ import { SmartLinkDraggable, SMART_LINK_DRAG_TYPES, SMART_LINK_APPEARANCE } from '@atlaskit/editor-smart-link-draggable';
10
10
  import { Card as SmartCard } from '@atlaskit/smart-card';
11
11
  import { CardSSR } from '@atlaskit/smart-card/ssr';
12
12
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -39,13 +39,19 @@ export const InlineCard = /*#__PURE__*/memo(({
39
39
  } = node.attrs;
40
40
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
41
41
  const refId = useRef(uuid());
42
+ const removeCardDispatched = useRef(false);
42
43
  const {
43
44
  getState: getSmartlinkState
44
45
  } = (cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store) || {};
45
46
  const cardState = getSmartlinkState === null || getSmartlinkState === void 0 ? void 0 : getSmartlinkState()[url || ''];
46
47
  useEffect(() => {
47
48
  const id = refId.current;
49
+ removeCardDispatched.current = false;
48
50
  return () => {
51
+ if (expValEquals('platform_editor_inline_card_dispatch_guard', 'isEnabled', true) && removeCardDispatched.current) {
52
+ return;
53
+ }
54
+ removeCardDispatched.current = true;
49
55
  const {
50
56
  tr
51
57
  } = view.state;
@@ -163,6 +169,7 @@ const selector = states => {
163
169
  };
164
170
 
165
171
  /**
172
+ * Inline card node view component that renders a Smart Link inline card within the editor.
166
173
  *
167
174
  * @param props
168
175
  * @example
@@ -207,7 +214,7 @@ export function InlineCardNodeView(props) {
207
214
  }, enableInlineUpgradeFeatures && getAwarenessProps(view.state, getPos, allowEmbeds, allowBlockCards, mode === 'view'))), CompetitorPromptComponent);
208
215
  return expValEquals('cc_drag_and_drop_smart_link_from_content_to_tree', 'isEnabled', true) ? /*#__PURE__*/React.createElement(SmartLinkDraggable, {
209
216
  url: url,
210
- appearance: SMART_LINK_APPERANCE.INLINE,
217
+ appearance: SMART_LINK_APPEARANCE.INLINE,
211
218
  source: SMART_LINK_DRAG_TYPES.EDITOR
212
219
  }, inlineCardContent) : inlineCardContent;
213
220
  }
@@ -54,7 +54,9 @@ const isAppearanceSupportedInParent = (currentNodePosition, editorState, fragmen
54
54
  };
55
55
  export const isEmbedSupportedAtPosition = (currentNodePosition, editorState, currentAppearance) => isAppearanceSupportedInParent(currentNodePosition, editorState, Fragment.from(editorState.schema.nodes.embedCard.createChecked({})), currentAppearance);
56
56
  export const isBlockSupportedAtPosition = (currentNodePosition, editorState, currentAppearance) => isAppearanceSupportedInParent(currentNodePosition, editorState, Fragment.from(editorState.schema.nodes.blockCard.createChecked({})), currentAppearance);
57
- export const getResolvedAttributesFromStore = (url, display, store) => {
57
+ export const getResolvedAttributesFromStore = (url, display, store
58
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
59
+ ) => {
58
60
  if (!store) {
59
61
  return {};
60
62
  }
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { useCallback, useEffect, useMemo, useState } from 'react';
6
6
 
7
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { AnalyticsContext } from '@atlaskit/analytics-next';
10
10
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -5,7 +5,7 @@
5
5
  import { useCallback, useState } from 'react';
6
6
 
7
7
  // not permitted to migrate atlaskit packages to compiled yet, see https://hello.atlassian.net/wiki/spaces/UAF/pages/3006969423/Migrating+AFM+platform+components+to+Compiled+a+guide
8
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
8
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
9
9
  import { css, jsx } from '@emotion/react';
10
10
  import { OverlayButton } from '@atlaskit/editor-common/link';
11
11
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { useCallback } from 'react';
6
6
 
7
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { cardMessages as messages } from '@atlaskit/editor-common/messages';
10
10
  import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { useCallback, useRef, useState } from 'react';
6
6
 
7
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { FormattedMessage } from 'react-intl-next';
10
10
  import { linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { useCallback, useMemo, useRef, useState } from 'react';
6
6
 
7
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { FormattedMessage } from 'react-intl-next';
10
10
  import { linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
@@ -7,7 +7,7 @@ import _extends from "@babel/runtime/helpers/extends";
7
7
  */
8
8
  import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
9
9
 
10
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
11
11
  import { css, jsx } from '@emotion/react';
12
12
  import debounce from 'lodash/debounce';
13
13
  import { useIntl } from 'react-intl-next';
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { useCallback, useMemo } from 'react';
6
6
 
7
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { injectIntl } from 'react-intl-next';
10
10
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
@@ -130,4 +130,5 @@ const LayoutButtonWrapper = ({
130
130
  intl: intl
131
131
  });
132
132
  };
133
- export default injectIntl(LayoutButtonWrapper);
133
+ const _default_1 = injectIntl(LayoutButtonWrapper);
134
+ export default _default_1;
@@ -6,7 +6,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
6
  */
7
7
  import React from 'react';
8
8
 
9
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
10
10
  import { jsx } from '@emotion/react';
11
11
  import { calcColumnsFromPx, calcMediaPxWidth, calcPctFromPx, calcPxFromColumns, handleSides, imageAlignmentMap, Resizer, snapTo, wrappedLayouts, wrapperStyle } from '@atlaskit/editor-common/ui';
12
12
  import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
@@ -17,7 +17,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
17
17
  */
18
18
  import React from 'react';
19
19
 
20
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
20
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
21
21
  import { jsx } from '@emotion/react';
22
22
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
23
23
  import { DATASOURCE_INNER_CONTAINER_CLASSNAME, SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles';
@@ -6,7 +6,7 @@ import uuid from 'uuid/v4';
6
6
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
7
7
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
8
8
  import { UnsupportedInline, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
9
- import { SmartLinkDraggable, SMART_LINK_DRAG_TYPES, SMART_LINK_APPERANCE } from '@atlaskit/editor-smart-link-draggable';
9
+ import { SmartLinkDraggable, SMART_LINK_DRAG_TYPES, SMART_LINK_APPEARANCE } from '@atlaskit/editor-smart-link-draggable';
10
10
  import { Card as SmartCard } from '@atlaskit/smart-card';
11
11
  import { CardSSR } from '@atlaskit/smart-card/ssr';
12
12
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -37,12 +37,18 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
37
37
  data = _node$attrs.data;
38
38
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
39
39
  var refId = useRef(uuid());
40
+ var removeCardDispatched = useRef(false);
40
41
  var _ref2 = (cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store) || {},
41
42
  getSmartlinkState = _ref2.getState;
42
43
  var cardState = getSmartlinkState === null || getSmartlinkState === void 0 ? void 0 : getSmartlinkState()[url || ''];
43
44
  useEffect(function () {
44
45
  var id = refId.current;
46
+ removeCardDispatched.current = false;
45
47
  return function () {
48
+ if (expValEquals('platform_editor_inline_card_dispatch_guard', 'isEnabled', true) && removeCardDispatched.current) {
49
+ return;
50
+ }
51
+ removeCardDispatched.current = true;
46
52
  var tr = view.state.tr;
47
53
  removeCard({
48
54
  id: id
@@ -155,6 +161,7 @@ var selector = function selector(states) {
155
161
  };
156
162
 
157
163
  /**
164
+ * Inline card node view component that renders a Smart Link inline card within the editor.
158
165
  *
159
166
  * @param props
160
167
  * @example
@@ -196,7 +203,7 @@ export function InlineCardNodeView(props) {
196
203
  }, enableInlineUpgradeFeatures && getAwarenessProps(view.state, getPos, allowEmbeds, allowBlockCards, mode === 'view'))), CompetitorPromptComponent);
197
204
  return expValEquals('cc_drag_and_drop_smart_link_from_content_to_tree', 'isEnabled', true) ? /*#__PURE__*/React.createElement(SmartLinkDraggable, {
198
205
  url: url,
199
- appearance: SMART_LINK_APPERANCE.INLINE,
206
+ appearance: SMART_LINK_APPEARANCE.INLINE,
200
207
  source: SMART_LINK_DRAG_TYPES.EDITOR
201
208
  }, inlineCardContent) : inlineCardContent;
202
209
  }
@@ -61,7 +61,9 @@ export var isEmbedSupportedAtPosition = function isEmbedSupportedAtPosition(curr
61
61
  export var isBlockSupportedAtPosition = function isBlockSupportedAtPosition(currentNodePosition, editorState, currentAppearance) {
62
62
  return isAppearanceSupportedInParent(currentNodePosition, editorState, Fragment.from(editorState.schema.nodes.blockCard.createChecked({})), currentAppearance);
63
63
  };
64
- export var getResolvedAttributesFromStore = function getResolvedAttributesFromStore(url, display, store) {
64
+ export var getResolvedAttributesFromStore = function getResolvedAttributesFromStore(url, display, store
65
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
66
+ ) {
65
67
  if (!store) {
66
68
  return {};
67
69
  }
@@ -5,7 +5,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
5
  */
6
6
  import { useCallback, useEffect, useMemo, useState } from 'react';
7
7
 
8
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
9
9
  import { css, jsx } from '@emotion/react';
10
10
  import { AnalyticsContext } from '@atlaskit/analytics-next';
11
11
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -6,7 +6,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
6
6
  import { useCallback, useState } from 'react';
7
7
 
8
8
  // not permitted to migrate atlaskit packages to compiled yet, see https://hello.atlassian.net/wiki/spaces/UAF/pages/3006969423/Migrating+AFM+platform+components+to+Compiled+a+guide
9
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
9
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
10
10
  import { css, jsx } from '@emotion/react';
11
11
  import { OverlayButton } from '@atlaskit/editor-common/link';
12
12
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { useCallback } from 'react';
6
6
 
7
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { cardMessages as messages } from '@atlaskit/editor-common/messages';
10
10
  import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
@@ -5,7 +5,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
5
  */
6
6
  import { useCallback, useRef, useState } from 'react';
7
7
 
8
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
9
9
  import { css, jsx } from '@emotion/react';
10
10
  import { FormattedMessage } from 'react-intl-next';
11
11
  import { linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
@@ -7,7 +7,7 @@ var _excluded = ["extensionKey"];
7
7
  */
8
8
  import { useCallback, useMemo, useRef, useState } from 'react';
9
9
 
10
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
11
11
  import { css, jsx } from '@emotion/react';
12
12
  import { FormattedMessage } from 'react-intl-next';
13
13
  import { linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
@@ -11,7 +11,7 @@ var _excluded = ["children", "isSelected", "isVisible", "testId", "url"];
11
11
  */
12
12
  import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
13
13
 
14
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
14
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
15
15
  import { css, jsx } from '@emotion/react';
16
16
  import debounce from 'lodash/debounce';
17
17
  import { useIntl } from 'react-intl-next';
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  */
8
8
  import { useCallback, useMemo } from 'react';
9
9
 
10
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
11
11
  import { css, jsx } from '@emotion/react';
12
12
  import { injectIntl } from 'react-intl-next';
13
13
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
@@ -127,4 +127,5 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
127
127
  intl: intl
128
128
  });
129
129
  };
130
- export default injectIntl(LayoutButtonWrapper);
130
+ var _default_1 = injectIntl(LayoutButtonWrapper);
131
+ export default _default_1;
@@ -15,7 +15,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
15
15
  */
16
16
  import React from 'react';
17
17
 
18
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
18
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
19
19
  import { jsx } from '@emotion/react';
20
20
  import { calcColumnsFromPx, calcMediaPxWidth, calcPctFromPx, calcPxFromColumns, handleSides, imageAlignmentMap, Resizer, snapTo, wrappedLayouts, wrapperStyle } from '@atlaskit/editor-common/ui';
21
21
  import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import ReactNodeView, { type getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
3
3
  import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
4
4
  import type { Node } from '@atlaskit/editor-prosemirror/model';
5
- import type { Decoration, DecorationSource, EditorView } from '@atlaskit/editor-prosemirror/view';
5
+ import type { Decoration, DecorationSource, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
6
6
  import { Datasource } from '../nodeviews/datasource';
7
7
  import type { SmartCardProps } from './genericCard';
8
8
  export declare class BlockCardComponent extends React.PureComponent<SmartCardProps & {
@@ -50,4 +50,4 @@ export interface BlockCardNodeViewProperties {
50
50
  pmPluginFactoryParams: PMPluginFactoryParams;
51
51
  provider: BlockCardNodeViewProps['provider'];
52
52
  }
53
- export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, provider, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
53
+ export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, provider, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => BlockCard | Datasource | NodeView;
@@ -1,12 +1,13 @@
1
1
  import React from 'react';
2
2
  import type { InlineNodeViewComponentProps, getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
3
3
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
- import type { Decoration, EditorView } from '@atlaskit/editor-prosemirror/view';
4
+ import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { SmartCardProps } from './genericCard';
6
6
  import { type InlineCardWithAwarenessProps } from './inlineCardWithAwareness';
7
- export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick: propsOnClick, onResolve: onRes, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, pluginInjectionApi, disablePreviewPanel, }: SmartCardProps) => React.JSX.Element | null>;
7
+ export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick, onResolve, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, pluginInjectionApi, disablePreviewPanel, }: SmartCardProps) => React.JSX.Element | null>;
8
8
  export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'CompetitorPrompt' | 'provider'>;
9
9
  /**
10
+ * Inline card node view component that renders a Smart Link inline card within the editor.
10
11
  *
11
12
  * @param props
12
13
  * @example
@@ -16,4 +17,4 @@ export interface InlineCardNodeViewProperties {
16
17
  inlineCardViewProducer: ReturnType<typeof getInlineNodeViewProducer>;
17
18
  isPageSSRed: InlineCardNodeViewProps['isPageSSRed'];
18
19
  }
19
- export declare const inlineCardNodeView: ({ inlineCardViewProducer }: InlineCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView;
20
+ export declare const inlineCardNodeView: ({ inlineCardViewProducer }: InlineCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => NodeView;
@@ -1,2 +1,3 @@
1
+ import { type NodeViewConstructor } from '@atlaskit/editor-common/lazy-node-view';
1
2
  import { type InlineCardNodeViewProperties } from './inlineCard';
2
- export declare const lazyInlineCardView: (props: InlineCardNodeViewProperties) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor;
3
+ export declare const lazyInlineCardView: (props: InlineCardNodeViewProperties) => NodeViewConstructor;
@@ -1,28 +1,29 @@
1
- import type { DOMOutputSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
1
+ import type { AttributeSpec, DOMOutputSpec, Node as PMNode, TagParseRule } from '@atlaskit/editor-prosemirror/model';
2
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
3
  export declare const blockCardSpecWithFixedToDOM: () => {
3
- toDOM: (node: PMNode) => DOMOutputSpec;
4
- content?: string;
5
- marks?: string;
6
- group?: string;
7
- inline?: boolean;
8
4
  atom?: boolean;
9
5
  attrs?: {
10
- [name: string]: import("prosemirror-model").AttributeSpec;
6
+ [name: string]: AttributeSpec;
11
7
  };
12
- selectable?: boolean;
13
- draggable?: boolean;
14
8
  code?: boolean;
15
- whitespace?: "pre" | "normal";
9
+ content?: string;
10
+ defining?: boolean;
16
11
  definingAsContext?: boolean;
17
12
  definingForContent?: boolean;
18
- defining?: boolean;
13
+ disableDropCursor?: boolean | ((view: EditorView, pos: {
14
+ inside: number;
15
+ pos: number;
16
+ }, event: DragEvent) => boolean);
17
+ draggable?: boolean;
18
+ group?: string;
19
+ inline?: boolean;
19
20
  isolating?: boolean;
20
- parseDOM?: readonly import("prosemirror-model").TagParseRule[];
21
- toDebugString?: (node: PMNode) => string;
22
21
  leafText?: (node: PMNode) => string;
23
22
  linebreakReplacement?: boolean;
24
- disableDropCursor?: boolean | ((view: import("prosemirror-view").EditorView, pos: {
25
- pos: number;
26
- inside: number;
27
- }, event: DragEvent) => boolean);
23
+ marks?: string;
24
+ parseDOM?: readonly TagParseRule[];
25
+ selectable?: boolean;
26
+ toDebugString?: (node: PMNode) => string;
27
+ toDOM: (node: PMNode) => DOMOutputSpec;
28
+ whitespace?: "pre" | "normal";
28
29
  };