@atlaskit/editor-plugin-card 4.5.3 → 4.5.5

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 (32) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/nodeviews/blockCard.js +14 -18
  3. package/dist/cjs/nodeviews/datasource.js +25 -35
  4. package/dist/cjs/nodeviews/embedCard.js +20 -24
  5. package/dist/cjs/nodeviews/genericCard.js +8 -11
  6. package/dist/cjs/ui/EditLinkToolbar.js +5 -7
  7. package/dist/cjs/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.js +4 -5
  8. package/dist/cjs/ui/EditorLinkingPlatformAnalytics/LinkEvents.js +4 -5
  9. package/dist/cjs/ui/EditorLinkingPlatformAnalytics/index.js +5 -7
  10. package/dist/cjs/ui/InlineCardOverlay/index.js +3 -4
  11. package/dist/cjs/ui/LinkToolbarAppearance.js +6 -9
  12. package/dist/cjs/ui/ResizableEmbedCard.js +11 -14
  13. package/dist/cjs/ui/datasourceErrorBoundary.js +6 -9
  14. package/dist/cjs/ui/toolbar.js +14 -2
  15. package/dist/es2019/index.js +3 -0
  16. package/dist/es2019/nodeviews/datasource.js +7 -13
  17. package/dist/es2019/ui/toolbar.js +15 -3
  18. package/dist/esm/index.js +3 -0
  19. package/dist/esm/nodeviews/blockCard.js +14 -18
  20. package/dist/esm/nodeviews/datasource.js +25 -35
  21. package/dist/esm/nodeviews/embedCard.js +20 -24
  22. package/dist/esm/nodeviews/genericCard.js +8 -11
  23. package/dist/esm/ui/EditLinkToolbar.js +5 -7
  24. package/dist/esm/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.js +4 -5
  25. package/dist/esm/ui/EditorLinkingPlatformAnalytics/LinkEvents.js +4 -5
  26. package/dist/esm/ui/EditorLinkingPlatformAnalytics/index.js +5 -7
  27. package/dist/esm/ui/InlineCardOverlay/index.js +3 -4
  28. package/dist/esm/ui/LinkToolbarAppearance.js +6 -9
  29. package/dist/esm/ui/ResizableEmbedCard.js +11 -14
  30. package/dist/esm/ui/datasourceErrorBoundary.js +6 -9
  31. package/dist/esm/ui/toolbar.js +15 -3
  32. package/package.json +4 -4
@@ -1,14 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+ import _inherits from "@babel/runtime/helpers/inherits";
8
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
8
  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; }
10
9
  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; }
11
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
10
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
12
11
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
13
12
  /**
14
13
  * @jsxRuntime classic
@@ -24,19 +23,17 @@ import { akEditorBreakoutPadding, akEditorMediaResizeHandlerPadding, akEditorWid
24
23
  import { embedHeaderHeight } from '@atlaskit/smart-card';
25
24
  // eslint-disable-next-line @repo/internal/react/no-class-components
26
25
  var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
27
- _inherits(ResizableEmbedCard, _React$Component);
28
- var _super = _createSuper(ResizableEmbedCard);
29
26
  function ResizableEmbedCard() {
30
27
  var _this;
31
28
  _classCallCheck(this, ResizableEmbedCard);
32
29
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
33
30
  args[_key] = arguments[_key];
34
31
  }
35
- _this = _super.call.apply(_super, [this].concat(args));
36
- _defineProperty(_assertThisInitialized(_this), "state", {
32
+ _this = _callSuper(this, ResizableEmbedCard, [].concat(args));
33
+ _defineProperty(_this, "state", {
37
34
  offsetLeft: _this.calcOffsetLeft()
38
35
  });
39
- _defineProperty(_assertThisInitialized(_this), "calcNewSize", function (newWidth, stop) {
36
+ _defineProperty(_this, "calcNewSize", function (newWidth, stop) {
40
37
  var _this$props = _this.props,
41
38
  layout = _this$props.layout,
42
39
  state = _this$props.view.state;
@@ -60,7 +57,7 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
60
57
  };
61
58
  }
62
59
  });
63
- _defineProperty(_assertThisInitialized(_this), "calcUnwrappedLayout", function (pct, width) {
60
+ _defineProperty(_this, "calcUnwrappedLayout", function (pct, width) {
64
61
  if (pct <= 100) {
65
62
  return 'center';
66
63
  }
@@ -69,11 +66,11 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
69
66
  }
70
67
  return 'full-width';
71
68
  });
72
- _defineProperty(_assertThisInitialized(_this), "calcColumnLeftOffset", function () {
69
+ _defineProperty(_this, "calcColumnLeftOffset", function () {
73
70
  var offsetLeft = _this.state.offsetLeft;
74
71
  return _this.insideInlineLike ? calcColumnsFromPx(offsetLeft, _this.props.lineLength, _this.props.gridSize) : 0;
75
72
  });
76
- _defineProperty(_assertThisInitialized(_this), "calcPxWidth", function (useLayout) {
73
+ _defineProperty(_this, "calcPxWidth", function (useLayout) {
77
74
  var _this$props2 = _this.props,
78
75
  layout = _this$props2.layout,
79
76
  pctWidth = _this$props2.pctWidth,
@@ -99,7 +96,7 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
99
96
  resizedPctWidth: resizedPctWidth
100
97
  });
101
98
  });
102
- _defineProperty(_assertThisInitialized(_this), "highlights", function (newWidth, snapPoints) {
99
+ _defineProperty(_this, "highlights", function (newWidth, snapPoints) {
103
100
  var snapWidth = snapTo(newWidth, snapPoints);
104
101
  var _this$props$view$stat = _this.props.view.state.schema.nodes,
105
102
  layoutColumn = _this$props$view$stat.layoutColumn,
@@ -132,7 +129,8 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
132
129
  });
133
130
  return _this;
134
131
  }
135
- _createClass(ResizableEmbedCard, [{
132
+ _inherits(ResizableEmbedCard, _React$Component);
133
+ return _createClass(ResizableEmbedCard, [{
136
134
  key: "componentDidUpdate",
137
135
  value: function componentDidUpdate(prevProps) {
138
136
  var offsetLeft = this.calcOffsetLeft();
@@ -381,7 +379,6 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
381
379
  /* eslint-enable @atlaskit/design-system/consistent-css-prop-usage */
382
380
  }
383
381
  }]);
384
- return ResizableEmbedCard;
385
382
  }(React.Component);
386
383
  _defineProperty(ResizableEmbedCard, "defaultProps", {
387
384
  aspectRatio: DEFAULT_EMBED_CARD_WIDTH / DEFAULT_EMBED_CARD_HEIGHT
@@ -1,11 +1,10 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
3
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
4
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
+ import _inherits from "@babel/runtime/helpers/inherits";
7
6
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
7
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
9
8
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
9
  /* eslint-disable @repo/internal/react/no-class-components */
11
10
  import React from 'react';
@@ -13,22 +12,21 @@ import { isSafeUrl } from '@atlaskit/adf-schema';
13
12
  import { LazyLoadedDatasourceRenderFailedAnalyticsWrapper } from '@atlaskit/link-datasource';
14
13
  import { setSelectedCardAppearance } from '../pm-plugins/doc';
15
14
  export var DatasourceErrorBoundary = /*#__PURE__*/function (_React$Component) {
16
- _inherits(DatasourceErrorBoundary, _React$Component);
17
- var _super = _createSuper(DatasourceErrorBoundary);
18
15
  function DatasourceErrorBoundary() {
19
16
  var _this;
20
17
  _classCallCheck(this, DatasourceErrorBoundary);
21
18
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22
19
  args[_key] = arguments[_key];
23
20
  }
24
- _this = _super.call.apply(_super, [this].concat(args));
25
- _defineProperty(_assertThisInitialized(_this), "state", {
21
+ _this = _callSuper(this, DatasourceErrorBoundary, [].concat(args));
22
+ _defineProperty(_this, "state", {
26
23
  isError: false,
27
24
  error: null
28
25
  });
29
26
  return _this;
30
27
  }
31
- _createClass(DatasourceErrorBoundary, [{
28
+ _inherits(DatasourceErrorBoundary, _React$Component);
29
+ return _createClass(DatasourceErrorBoundary, [{
32
30
  key: "componentDidCatch",
33
31
  value: function componentDidCatch(error) {
34
32
  if (this.props.handleError) {
@@ -78,5 +76,4 @@ export var DatasourceErrorBoundary = /*#__PURE__*/function (_React$Component) {
78
76
  };
79
77
  }
80
78
  }]);
81
- return DatasourceErrorBoundary;
82
79
  }(React.Component);
@@ -4,7 +4,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
4
4
  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; }
5
5
  import React from 'react';
6
6
  import { isSafeUrl } from '@atlaskit/adf-schema';
7
- import { ACTION, ACTION_SUBJECT, buildOpenedSettingsPayload, buildVisitedLinkPayload, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
7
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID as ACTION_SUBJECTID, buildOpenedSettingsPayload, buildVisitedLinkPayload, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
8
8
  import { buildLayoutButtons, commandWithMetadata } from '@atlaskit/editor-common/card';
9
9
  import { getLinkPreferencesURLFromENV } from '@atlaskit/editor-common/link';
10
10
  import commonMessages, { annotationMessages, linkMessages, linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
@@ -208,9 +208,21 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
208
208
  });
209
209
  var isCommentEnabled = annotationApiState && annotationApiState.isVisible && !annotationApiState.bookmark && !annotationApiState.mouseData.isSelecting && !activeCommentMark && node.type === state.schema.nodes.inlineCard && fg('platform_inline_node_as_valid_annotation_selection');
210
210
  var onCommentButtonClick = function onCommentButtonClick(state, dispatch) {
211
+ var _pluginInjectionApi$a3;
211
212
  if (!(pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.annotation) || !isCommentEnabled) {
212
213
  return false;
213
214
  }
215
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 || (_pluginInjectionApi$a3 = _pluginInjectionApi$a3.actions) === null || _pluginInjectionApi$a3 === void 0 || _pluginInjectionApi$a3.fireAnalyticsEvent({
216
+ action: ACTION.CLICKED,
217
+ actionSubject: ACTION_SUBJECT.BUTTON,
218
+ actionSubjectId: ACTION_SUBJECTID.CREATE_INLINE_COMMENT_FROM_HIGHLIGHT_ACTIONS_MENU,
219
+ eventType: EVENT_TYPE.UI,
220
+ attributes: {
221
+ source: 'highlightActionsMenu',
222
+ pageMode: 'edit',
223
+ sourceNode: 'inlineCard'
224
+ }
225
+ });
214
226
  var setInlineCommentDraftState = pluginInjectionApi.annotation.actions.setInlineCommentDraftState;
215
227
  var command = setInlineCommentDraftState(true, INPUT_METHOD.FLOATING_TB);
216
228
  return command(state, dispatch);
@@ -303,8 +315,8 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
303
315
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
304
316
  }]);
305
317
  if (currentAppearance === 'embed') {
306
- var _pluginInjectionApi$a3;
307
- var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions, cardOptions);
318
+ var _pluginInjectionApi$a4;
319
+ var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions, cardOptions);
308
320
  if (alignmentOptions.length) {
309
321
  alignmentOptions.push({
310
322
  type: 'separator'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "4.5.3",
3
+ "version": "4.5.5",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,7 +34,7 @@
34
34
  "@atlaskit/adf-schema": "^46.1.0",
35
35
  "@atlaskit/analytics-next": "^10.2.0",
36
36
  "@atlaskit/custom-steps": "^0.9.0",
37
- "@atlaskit/editor-common": "^96.3.0",
37
+ "@atlaskit/editor-common": "^96.5.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
39
39
  "@atlaskit/editor-plugin-decorations": "^1.3.0",
40
40
  "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
@@ -49,7 +49,7 @@
49
49
  "@atlaskit/icon": "^23.1.0",
50
50
  "@atlaskit/link-analytics": "^8.6.0",
51
51
  "@atlaskit/link-client-extension": "^3.0.0",
52
- "@atlaskit/link-datasource": "^3.14.0",
52
+ "@atlaskit/link-datasource": "^3.15.0",
53
53
  "@atlaskit/linking-common": "^6.0.0",
54
54
  "@atlaskit/linking-types": "^9.5.0",
55
55
  "@atlaskit/menu": "2.13.6",
@@ -57,7 +57,7 @@
57
57
  "@atlaskit/primitives": "^13.3.0",
58
58
  "@atlaskit/smart-card": "^32.7.0",
59
59
  "@atlaskit/theme": "^14.0.0",
60
- "@atlaskit/tmp-editor-statsig": "^2.24.0",
60
+ "@atlaskit/tmp-editor-statsig": "^2.26.0",
61
61
  "@atlaskit/tokens": "^2.4.0",
62
62
  "@babel/runtime": "^7.0.0",
63
63
  "@emotion/react": "^11.7.1",