@atlaskit/editor-common 78.10.0 → 78.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/extensibility/Extension/InlineExtension/index.js +40 -42
  3. package/dist/cjs/extensibility/Extension/InlineExtension/styles.js +32 -5
  4. package/dist/cjs/extensibility/ExtensionComponent.js +4 -2
  5. package/dist/cjs/extensibility/MultiBodiedExtension/index.js +21 -7
  6. package/dist/cjs/extensibility/MultiBodiedExtension/styles.js +17 -4
  7. package/dist/cjs/monitoring/error.js +1 -1
  8. package/dist/cjs/ui/DropList/index.js +1 -1
  9. package/dist/cjs/ui/MediaSingle/index.js +5 -2
  10. package/dist/cjs/ui/MediaSingle/styled.js +44 -8
  11. package/dist/cjs/ui/MultiBodiedExtension/index.js +1 -8
  12. package/dist/cjs/ui/WidthProvider/index.js +35 -49
  13. package/dist/cjs/ui/index.js +6 -0
  14. package/dist/es2019/extensibility/Extension/InlineExtension/index.js +43 -28
  15. package/dist/es2019/extensibility/Extension/InlineExtension/styles.js +29 -22
  16. package/dist/es2019/extensibility/ExtensionComponent.js +4 -2
  17. package/dist/es2019/extensibility/MultiBodiedExtension/index.js +22 -8
  18. package/dist/es2019/extensibility/MultiBodiedExtension/styles.js +16 -14
  19. package/dist/es2019/monitoring/error.js +1 -1
  20. package/dist/es2019/ui/DropList/index.js +1 -1
  21. package/dist/es2019/ui/MediaSingle/index.js +4 -2
  22. package/dist/es2019/ui/MediaSingle/styled.js +40 -10
  23. package/dist/es2019/ui/MultiBodiedExtension/index.js +1 -8
  24. package/dist/es2019/ui/WidthProvider/index.js +29 -35
  25. package/dist/es2019/ui/index.js +1 -1
  26. package/dist/esm/extensibility/Extension/InlineExtension/index.js +40 -45
  27. package/dist/esm/extensibility/Extension/InlineExtension/styles.js +31 -3
  28. package/dist/esm/extensibility/ExtensionComponent.js +4 -2
  29. package/dist/esm/extensibility/MultiBodiedExtension/index.js +22 -8
  30. package/dist/esm/extensibility/MultiBodiedExtension/styles.js +17 -3
  31. package/dist/esm/monitoring/error.js +1 -1
  32. package/dist/esm/ui/DropList/index.js +1 -1
  33. package/dist/esm/ui/MediaSingle/index.js +5 -2
  34. package/dist/esm/ui/MediaSingle/styled.js +44 -9
  35. package/dist/esm/ui/MultiBodiedExtension/index.js +1 -8
  36. package/dist/esm/ui/WidthProvider/index.js +31 -49
  37. package/dist/esm/ui/index.js +1 -1
  38. package/dist/types/extensibility/Extension/InlineExtension/index.d.ts +5 -4
  39. package/dist/types/extensibility/Extension/InlineExtension/styles.d.ts +1 -0
  40. package/dist/types/extensibility/MultiBodiedExtension/index.d.ts +1 -0
  41. package/dist/types/preset/plugin-injection-api.d.ts +1 -1
  42. package/dist/types/types/feature-flags.d.ts +16 -0
  43. package/dist/types/ui/MediaSingle/index.d.ts +2 -1
  44. package/dist/types/ui/MediaSingle/styled.d.ts +11 -2
  45. package/dist/types/ui/WidthProvider/index.d.ts +3 -10
  46. package/dist/types/ui/index.d.ts +1 -1
  47. package/dist/types-ts4.5/extensibility/Extension/InlineExtension/index.d.ts +5 -4
  48. package/dist/types-ts4.5/extensibility/Extension/InlineExtension/styles.d.ts +1 -0
  49. package/dist/types-ts4.5/extensibility/MultiBodiedExtension/index.d.ts +1 -0
  50. package/dist/types-ts4.5/preset/plugin-injection-api.d.ts +2 -2
  51. package/dist/types-ts4.5/types/feature-flags.d.ts +16 -0
  52. package/dist/types-ts4.5/ui/MediaSingle/index.d.ts +2 -1
  53. package/dist/types-ts4.5/ui/MediaSingle/styled.d.ts +11 -2
  54. package/dist/types-ts4.5/ui/WidthProvider/index.d.ts +3 -10
  55. package/dist/types-ts4.5/ui/index.d.ts +1 -1
  56. package/package.json +4 -1
  57. package/tsconfig.json +1 -4
@@ -198,7 +198,8 @@ export var ExtensionComponent = /*#__PURE__*/function (_Component) {
198
198
  eventDispatcher: eventDispatcher,
199
199
  pluginInjectionApi: pluginInjectionApi,
200
200
  editorAppearance: editorAppearance,
201
- showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates
201
+ showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates,
202
+ isNodeSelected: selectedNode === node
202
203
  });
203
204
  }
204
205
  var extensionHandlerResult = this.tryExtensionHandler(undefined);
@@ -222,7 +223,8 @@ export var ExtensionComponent = /*#__PURE__*/function (_Component) {
222
223
  return /*#__PURE__*/React.createElement(InlineExtension, {
223
224
  node: node,
224
225
  showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates,
225
- isNodeSelected: selectedNode === node
226
+ isNodeSelected: selectedNode === node,
227
+ pluginInjectionApi: pluginInjectionApi
226
228
  }, extensionHandlerResult);
227
229
  default:
228
230
  return null;
@@ -7,7 +7,7 @@ var _excluded = ["url"];
7
7
  /* eslint-disable @atlaskit/design-system/prefer-primitives */
8
8
  /** @jsx jsx */
9
9
 
10
- import React, { useState } from 'react';
10
+ import React, { Fragment, useState } from 'react';
11
11
  import { css, jsx } from '@emotion/react';
12
12
  import classnames from 'classnames';
13
13
  import EditorFileIcon from '@atlaskit/icon/glyph/editor/file';
@@ -15,10 +15,14 @@ import { useSharedPluginState } from '../../hooks';
15
15
  import { sharedMultiBodiedExtensionStyles } from '../../ui/MultiBodiedExtension';
16
16
  import { calculateBreakoutStyles, getExtensionLozengeData } from '../../utils';
17
17
  import { WithPluginState } from '../../with-plugin-state';
18
+ import ExtensionLozenge from '../Extension/Lozenge';
18
19
  import { useMultiBodiedExtensionActions } from './action-api';
19
20
  import { mbeExtensionWrapperCSS } from './styles';
20
21
  // Similar to the one in platform/packages/editor/editor-common/src/extensibility/Extension/Lozenge.tsx
21
- var getWrapperTitleContent = function getWrapperTitleContent(imageData, title) {
22
+ var getWrapperTitleContent = function getWrapperTitleContent(imageData, title, showMacroInteractionDesignUpdates) {
23
+ if (showMacroInteractionDesignUpdates) {
24
+ return null;
25
+ }
22
26
  if (imageData) {
23
27
  var url = imageData.url,
24
28
  rest = _objectWithoutProperties(imageData, _excluded);
@@ -35,7 +39,8 @@ var getWrapperTitleContent = function getWrapperTitleContent(imageData, title) {
35
39
  })), title);
36
40
  }
37
41
  return jsx("div", {
38
- className: "extension-title"
42
+ className: "extension-title",
43
+ "data-testid": 'multiBodiedExtension-default-lozenge'
39
44
  }, jsx(EditorFileIcon, {
40
45
  label: title
41
46
  }), title);
@@ -48,7 +53,9 @@ var MultiBodiedExtensionWithWidth = function MultiBodiedExtensionWithWidth(_ref)
48
53
  editorView = _ref.editorView,
49
54
  eventDispatcher = _ref.eventDispatcher,
50
55
  widthState = _ref.widthState,
51
- editorAppearance = _ref.editorAppearance;
56
+ editorAppearance = _ref.editorAppearance,
57
+ showMacroInteractionDesignUpdates = _ref.showMacroInteractionDesignUpdates,
58
+ isNodeSelected = _ref.isNodeSelected;
52
59
  var _node$attrs = node.attrs,
53
60
  parameters = _node$attrs.parameters,
54
61
  extensionKey = _node$attrs.extensionKey;
@@ -99,13 +106,20 @@ var MultiBodiedExtensionWithWidth = function MultiBodiedExtensionWithWidth(_ref)
99
106
  breakoutStyles = _extends({}, (_objectDestructuringEmpty(_calculateBreakoutSty), _calculateBreakoutSty));
100
107
  mbeWrapperStyles = breakoutStyles;
101
108
  }
102
- var wrapperClassNames = classnames('multiBodiedExtension--wrapper', 'extension-container', 'block');
103
- return jsx("div", {
109
+ var wrapperClassNames = classnames('multiBodiedExtension--wrapper', 'extension-container', 'block', {
110
+ 'remove-margin-top': showMacroInteractionDesignUpdates
111
+ });
112
+ return jsx(Fragment, null, showMacroInteractionDesignUpdates && jsx(ExtensionLozenge, {
113
+ isNodeSelected: isNodeSelected,
114
+ node: node,
115
+ showMacroInteractionDesignUpdates: true,
116
+ customContainerStyles: mbeWrapperStyles
117
+ }), jsx("div", {
104
118
  className: wrapperClassNames,
105
119
  css: mbeExtensionWrapperCSS,
106
120
  "data-testid": "multiBodiedExtension--wrapper",
107
121
  style: mbeWrapperStyles
108
- }, getWrapperTitleContent(imageData, title), jsx("div", {
122
+ }, getWrapperTitleContent(imageData, title, showMacroInteractionDesignUpdates), jsx("div", {
109
123
  className: "multiBodiedExtension--container",
110
124
  css: containerCssExtended,
111
125
  "data-testid": "multiBodiedExtension--container",
@@ -118,7 +132,7 @@ var MultiBodiedExtensionWithWidth = function MultiBodiedExtensionWithWidth(_ref)
118
132
  className: "multiBodiedExtension--frames",
119
133
  "data-testid": "multiBodiedExtension--frames",
120
134
  ref: articleRef
121
- })));
135
+ }))));
122
136
  };
123
137
  var MultiBodiedExtensionWithSharedState = function MultiBodiedExtensionWithSharedState(props) {
124
138
  var pluginInjectionApi = props.pluginInjectionApi;
@@ -1,7 +1,21 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject;
3
1
  import { css } from '@emotion/react';
4
2
  import { wrapperDefault } from '../Extension/styles';
5
3
 
6
4
  // Wrapper the extension title and extensionContainer
7
- export var mbeExtensionWrapperCSS = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", ";\n cursor: pointer;\n margin-top: ", ";\n margin-bottom: ", ";\n .extension-title {\n display: flex;\n align-items: center;\n line-height: 16px !important;\n margin-bottom: ", ";\n margin-left: ", " !important;\n margin-right: ", ";\n padding-top: ", " !important;\n }\n"])), wrapperDefault, "var(--ds-space-250, 24px)", "var(--ds-space-200, 16px)", "var(--ds-space-100, 8px)", "var(--ds-space-050, 4px)", "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)");
5
+ export var mbeExtensionWrapperCSS = css(wrapperDefault, {
6
+ '&.remove-margin-top': {
7
+ marginTop: 0
8
+ },
9
+ cursor: 'pointer',
10
+ marginTop: "var(--ds-space-250, 24px)",
11
+ marginBottom: "var(--ds-space-200, 16px)",
12
+ '.extension-title': {
13
+ display: 'flex',
14
+ alignItems: 'center',
15
+ lineHeight: '16px !important',
16
+ marginBottom: "var(--ds-space-100, 8px)",
17
+ marginLeft: "var(--ds-space-050, 4px)".concat(" !important"),
18
+ marginRight: "var(--ds-space-100, 8px)",
19
+ paddingTop: "var(--ds-space-100, 8px)".concat(" !important")
20
+ }
21
+ });
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
6
6
  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; }
7
7
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
8
8
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
9
- var packageVersion = "78.10.0";
9
+ var packageVersion = "78.11.0";
10
10
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
11
11
  // Remove URL as it has UGC
12
12
  // TODO: Sanitise the URL instead of just removing it
@@ -17,7 +17,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
17
17
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
18
18
  import Layer from '../Layer';
19
19
  var packageName = "@atlaskit/editor-common";
20
- var packageVersion = "78.10.0";
20
+ var packageVersion = "78.11.0";
21
21
  var halfFocusRing = 1;
22
22
  var dropOffset = '0, 8';
23
23
  var DropList = /*#__PURE__*/function (_Component) {
@@ -26,7 +26,9 @@ export default function MediaSingle(_ref) {
26
26
  editorWidth = _ref.lineLength,
27
27
  _ref$hasFallbackConta = _ref.hasFallbackContainer,
28
28
  hasFallbackContainer = _ref$hasFallbackConta === void 0 ? true : _ref$hasFallbackConta,
29
- handleMediaSingleRef = _ref.handleMediaSingleRef;
29
+ handleMediaSingleRef = _ref.handleMediaSingleRef,
30
+ _ref$isInsideOfInline = _ref.isInsideOfInlineExtension,
31
+ isInsideOfInlineExtension = _ref$isInsideOfInline === void 0 ? false : _ref$isInsideOfInline;
30
32
  var isPixelWidth = (size === null || size === void 0 ? void 0 : size.widthType) === 'pixel';
31
33
  var mediaSingleWidth = (size === null || size === void 0 ? void 0 : size.width) || pctWidth;
32
34
  var children = React.Children.toArray(propsChildren);
@@ -85,7 +87,8 @@ export default function MediaSingle(_ref) {
85
87
  containerWidth: containerWidth,
86
88
  mediaSingleWidth: mediaSingleWidth,
87
89
  fullWidthMode: fullWidthMode,
88
- isExtendedResizeExperienceOn: isPixelWidth
90
+ isExtendedResizeExperienceOn: isPixelWidth,
91
+ isInsideOfInlineExtension: isInsideOfInlineExtension
89
92
  }),
90
93
  "data-layout": layout,
91
94
  "data-width": mediaSingleWidth,
@@ -6,7 +6,7 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
6
6
 
7
7
  import React from 'react';
8
8
  import { css, jsx } from '@emotion/react';
9
- import { akEditorFullPageMaxWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
9
+ import { akEditorDefaultLayoutWidth, akEditorFullPageMaxWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
10
10
  import { nonWrappedLayouts } from '../../utils';
11
11
  import { calcBreakoutWidth, calcWideWidth } from '../../utils/breakout';
12
12
  function float(layout) {
@@ -19,11 +19,17 @@ function float(layout) {
19
19
  return 'none';
20
20
  }
21
21
  }
22
- function getWidthIfFullWidthMode(width) {
23
- return width > akEditorFullWidthLayoutWidth ? '100%' : "".concat(width, "px");
22
+ function getWidthIfFullWidthMode(originalWidth, containerWidth, isInsideOfInlineExtension) {
23
+ if (isInsideOfInlineExtension) {
24
+ return originalWidth > akEditorFullWidthLayoutWidth ? "".concat(Math.min(containerWidth, akEditorFullWidthLayoutWidth), "px") : "".concat(originalWidth, "px");
25
+ }
26
+ return originalWidth > akEditorFullWidthLayoutWidth ? '100%' : "".concat(originalWidth, "px");
24
27
  }
25
- function getWidthIfDefaultMode(width) {
26
- return width > akEditorFullPageMaxWidth ? '100%' : "".concat(width, "px");
28
+ function getWidthIfDefaultMode(originalWidth, containerWidth, isInsideOfInlineExtension) {
29
+ if (isInsideOfInlineExtension) {
30
+ return originalWidth > akEditorFullPageMaxWidth ? "".concat(Math.min(containerWidth, akEditorDefaultLayoutWidth), "px") : "".concat(originalWidth, "px");
31
+ }
32
+ return originalWidth > akEditorFullPageMaxWidth ? '100%' : "".concat(originalWidth, "px");
27
33
  }
28
34
 
29
35
  /**
@@ -37,6 +43,7 @@ export function calcLegacyWidth(layout, width) {
37
43
  var containerWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
38
44
  var fullWidthMode = arguments.length > 3 ? arguments[3] : undefined;
39
45
  var isResized = arguments.length > 4 ? arguments[4] : undefined;
46
+ var isInsideOfInlineExtension = arguments.length > 5 ? arguments[5] : undefined;
40
47
  switch (layout) {
41
48
  case 'align-start':
42
49
  case 'align-end':
@@ -44,11 +51,37 @@ export function calcLegacyWidth(layout, width) {
44
51
  case 'wrap-left':
45
52
  return width > containerWidth / 2 ? 'calc(50% - 12px)' : "".concat(width, "px");
46
53
  case 'wide':
47
- return calcWideWidth(containerWidth);
54
+ return isInsideOfInlineExtension ? calcWideWidth(containerWidth, Infinity, "".concat(containerWidth, "px")) : calcWideWidth(containerWidth);
55
+ case 'full-width':
56
+ return calcBreakoutWidth(layout, containerWidth);
57
+ default:
58
+ return isResized ? "".concat(width, "px") : fullWidthMode ? getWidthIfFullWidthMode(width, containerWidth, isInsideOfInlineExtension) : getWidthIfDefaultMode(width, containerWidth, isInsideOfInlineExtension);
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Calculates the image width for non-resized images.
64
+ *
65
+ * If an image has not been resized using the pctWidth attribute,
66
+ * then an image in wide or full-width can not be wider than the image's
67
+ * original width.
68
+ */
69
+ export function calcLegacyWidthForInline(layout, width) {
70
+ var containerWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
71
+ var fullWidthMode = arguments.length > 3 ? arguments[3] : undefined;
72
+ var isResized = arguments.length > 4 ? arguments[4] : undefined;
73
+ switch (layout) {
74
+ case 'align-start':
75
+ case 'align-end':
76
+ case 'wrap-right':
77
+ case 'wrap-left':
78
+ return width > containerWidth / 2 ? 'calc(50% - 12px)' : "".concat(width, "px");
79
+ case 'wide':
80
+ return calcWideWidth(containerWidth, Infinity, "".concat(containerWidth, "px"));
48
81
  case 'full-width':
49
82
  return calcBreakoutWidth(layout, containerWidth);
50
83
  default:
51
- return isResized ? "".concat(width, "px") : fullWidthMode ? getWidthIfFullWidthMode(width) : getWidthIfDefaultMode(width);
84
+ return isResized ? "".concat(width, "px") : fullWidthMode ? getWidthIfFullWidthMode(width, containerWidth) : getWidthIfDefaultMode(width, containerWidth);
52
85
  }
53
86
  }
54
87
 
@@ -113,8 +146,10 @@ export var MediaSingleDimensionHelper = function MediaSingleDimensionHelper(_ref
113
146
  width = _ref.width,
114
147
  isExtendedResizeExperienceOn = _ref.isExtendedResizeExperienceOn,
115
148
  _ref$isNestedNode = _ref.isNestedNode,
116
- isNestedNode = _ref$isNestedNode === void 0 ? false : _ref$isNestedNode;
117
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* For nested rich media items, set max-width to 100% */\n tr &,\n [data-layout-column] &,\n [data-node-type='expand'] &,\n [data-panel-type] &,\n li & {\n max-width: 100%;\n }\n\n width: ", ";\n ", "\n max-width: ", ";\n\n ", "\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n\n float: ", ";\n margin: ", ";\n\n &[class*='not-resizing'] {\n ", "\n }\n\n ", ";\n"])), isExtendedResizeExperienceOn ? "".concat(mediaSingleWidth || width, "px") : mediaSingleWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized), layout === 'full-width' &&
149
+ isNestedNode = _ref$isNestedNode === void 0 ? false : _ref$isNestedNode,
150
+ _ref$isInsideOfInline = _ref.isInsideOfInlineExtension,
151
+ isInsideOfInlineExtension = _ref$isInsideOfInline === void 0 ? false : _ref$isInsideOfInline;
152
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* For nested rich media items, set max-width to 100% */\n tr &,\n [data-layout-column] &,\n [data-node-type='expand'] &,\n [data-panel-type] &,\n li & {\n max-width: 100%;\n }\n\n width: ", ";\n ", "\n max-width: ", ";\n\n ", "\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n\n float: ", ";\n margin: ", ";\n\n &[class*='not-resizing'] {\n ", "\n }\n\n ", ";\n"])), isExtendedResizeExperienceOn ? "".concat(mediaSingleWidth || width, "px") : mediaSingleWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized, isInsideOfInlineExtension), layout === 'full-width' &&
118
153
  /* This causes issues for new experience where we don't strip layout attributes
119
154
  when copying top-level node and pasting into a table/layout,
120
155
  because full-width layout will remain, causing node to be edge-to-edge */
@@ -6,9 +6,8 @@ import { BODIED_EXT_MBE_MARGIN_TOP } from '../../styles';
6
6
 
7
7
  // Wraps the navigation bar and extensionFrames
8
8
  var mbeExtensionContainer = css({
9
- background: 'transpaent !important',
9
+ background: 'transparent !important',
10
10
  'padding:': {
11
- bottom: "var(--ds-space-100, 8px)".concat(" !important"),
12
11
  left: "var(--ds-space-100, 8px)".concat(" !important"),
13
12
  right: "var(--ds-space-100, 8px)".concat(" !important")
14
13
  },
@@ -60,12 +59,6 @@ var extensionFrameContent = css({
60
59
  },
61
60
  '.extensionView-content-wrap': {
62
61
  marginTop: "var(--ds-space-100, 8px)".concat(" !important")
63
- },
64
- '.decisionItemView-content-wrap': {
65
- marginTop: '0px !important'
66
- },
67
- '.decisionItemView-content-wrap > [data-decision-wrapper]': {
68
- marginTop: '0px !important'
69
62
  }
70
63
  });
71
64
  export var sharedMultiBodiedExtensionStyles = {
@@ -1,16 +1,8 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
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
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
9
3
  var _templateObject;
10
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
4
  /** @jsx jsx */
13
- import React from 'react';
5
+ import React, { Fragment } from 'react';
14
6
  import { css, jsx } from '@emotion/react';
15
7
  import rafSchedule from 'raf-schd';
16
8
  import { WidthObserver } from '@atlaskit/width-detector';
@@ -36,44 +28,34 @@ export function createWidthContext() {
36
28
  export var WidthContext = /*#__PURE__*/React.createContext(createWidthContext());
37
29
  var Provider = WidthContext.Provider,
38
30
  Consumer = WidthContext.Consumer;
39
- export var WidthProvider = /*#__PURE__*/function (_React$Component) {
40
- _inherits(WidthProvider, _React$Component);
41
- var _super = _createSuper(WidthProvider);
42
- function WidthProvider(props) {
43
- var _this;
44
- _classCallCheck(this, WidthProvider);
45
- _this = _super.call(this, props);
46
- _defineProperty(_assertThisInitialized(_this), "state", {
47
- width: 0
48
- });
49
- _defineProperty(_assertThisInitialized(_this), "setWidth", rafSchedule(function (width) {
50
- // Ignore changes that are less than SCROLLBAR_WIDTH, otherwise it can cause infinite re-scaling
51
- if (Math.abs(_this.state.width - width) < SCROLLBAR_WIDTH) {
52
- return;
53
- }
54
- _this.setState({
55
- width: width
56
- });
57
- }));
58
- if (typeof document !== 'undefined') {
59
- _this.state.width = document.body.offsetWidth;
31
+ export var WidthProvider = function WidthProvider(_ref) {
32
+ var className = _ref.className,
33
+ shouldCheckExistingValue = _ref.shouldCheckExistingValue,
34
+ children = _ref.children;
35
+ var existingContextValue = React.useContext(WidthContext);
36
+ var _React$useState = React.useState(typeof document !== 'undefined' ? document.body.offsetWidth : 0),
37
+ _React$useState2 = _slicedToArray(_React$useState, 2),
38
+ width = _React$useState2[0],
39
+ setWidth = _React$useState2[1];
40
+ var providerValue = React.useMemo(function () {
41
+ return createWidthContext(width);
42
+ }, [width]);
43
+ var updateWidth = rafSchedule(function (nextWidth) {
44
+ // Ignore changes that are less than SCROLLBAR_WIDTH, otherwise it can cause infinite re-scaling
45
+ if (Math.abs(width - nextWidth) < SCROLLBAR_WIDTH) {
46
+ return;
60
47
  }
61
- return _this;
62
- }
63
- _createClass(WidthProvider, [{
64
- key: "render",
65
- value: function render() {
66
- return jsx("div", {
67
- css: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n "]))),
68
- className: this.props.className
69
- }, jsx(WidthObserver, {
70
- setWidth: this.setWidth,
71
- offscreen: true
72
- }), jsx(Provider, {
73
- value: createWidthContext(this.state.width)
74
- }, this.props.children));
75
- }
76
- }]);
77
- return WidthProvider;
78
- }(React.Component);
48
+ setWidth(nextWidth);
49
+ });
50
+ var skipWidthDetection = shouldCheckExistingValue && existingContextValue.width > 0;
51
+ return jsx("div", {
52
+ css: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n "]))),
53
+ className: className
54
+ }, !skipWidthDetection && jsx(Fragment, null, jsx(WidthObserver, {
55
+ setWidth: updateWidth,
56
+ offscreen: true
57
+ }), jsx(Provider, {
58
+ value: providerValue
59
+ }, children)), skipWidthDetection && children);
60
+ };
79
61
  export { Consumer as WidthConsumer };
@@ -8,7 +8,7 @@ export { default as UnsupportedBlock } from './UnsupportedBlock';
8
8
  export { default as UnsupportedInline } from './UnsupportedInline';
9
9
  export { BaseTheme, mapBreakpointToLayoutMaxWidth } from './BaseTheme';
10
10
  export { default as withOuterListeners } from './with-outer-listeners';
11
- export { WidthContext, WidthConsumer, WidthProvider, getBreakpoint } from './WidthProvider';
11
+ export { WidthContext, WidthConsumer, WidthProvider, createWidthContext, getBreakpoint } from './WidthProvider';
12
12
  export { default as overflowShadow, shadowClassNames } from './OverflowShadow';
13
13
  export { shadowObserverClassNames, ShadowObserver } from './OverflowShadow/shadowObserver';
14
14
  export { WithCreateAnalyticsEvent } from './WithCreateAnalyticsEvent';
@@ -1,13 +1,14 @@
1
1
  /** @jsx jsx */
2
- import React, { Component } from 'react';
2
+ import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
5
+ import type { ExtensionsPluginInjectionAPI } from '../../types';
5
6
  export interface Props {
6
7
  node: PmNode;
8
+ pluginInjectionApi: ExtensionsPluginInjectionAPI;
7
9
  children?: React.ReactNode;
8
10
  showMacroInteractionDesignUpdates?: boolean;
9
11
  isNodeSelected?: boolean;
10
12
  }
11
- export default class InlineExtension extends Component<Props, any> {
12
- render(): jsx.JSX.Element;
13
- }
13
+ declare const InlineExtension: (props: Props) => jsx.JSX.Element;
14
+ export default InlineExtension;
@@ -1 +1,2 @@
1
1
  export declare const wrapperStyle: import("@emotion/react").SerializedStyles;
2
+ export declare const inlineWrapperStyels: import("@emotion/react").SerializedStyles;
@@ -19,6 +19,7 @@ type Props = {
19
19
  pluginInjectionApi?: ExtensionsPluginInjectionAPI;
20
20
  editorAppearance?: EditorAppearance;
21
21
  showMacroInteractionDesignUpdates?: boolean;
22
+ isNodeSelected?: boolean;
22
23
  };
23
24
  declare const MultiBodiedExtension: (props: Props & OverflowShadowProps) => jsx.JSX.Element;
24
25
  /**
@@ -39,7 +39,7 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
39
39
  private commandsAPI;
40
40
  private plugins;
41
41
  constructor({ getEditorState, getEditorView }: PluginInjectionAPIProps);
42
- api<T extends NextEditorPlugin<any, any>>(): import("../types/next-editor-plugin").PublicPluginAPI<[NextEditorPlugin<T extends import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<infer Name extends string, any, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never>, ..."dependencies" extends keyof (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never) ? (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"] extends (import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<any, any, any> | import("../types/next-editor-plugin").OptionalPlugin<import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<any, any, any>>)[] ? Exclude<(T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"], undefined> : [] : []]>;
42
+ api<T extends NextEditorPlugin<any, any>>(): import("../types/next-editor-plugin").PublicPluginAPI<[NextEditorPlugin<T extends import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<infer Name extends string, any, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata_1 extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata_1 : never>, ..."dependencies" extends keyof (T extends NextEditorPlugin<any, infer Metadata_1 extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata_1 : never) ? (T extends NextEditorPlugin<any, infer Metadata_1 extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata_1 : never)["dependencies"] extends (import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<any, any, any> | import("../types/next-editor-plugin").OptionalPlugin<import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<any, any, any>>)[] ? Exclude<(T extends NextEditorPlugin<any, infer Metadata_1 extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata_1 : never)["dependencies"], undefined> : [] : []]>;
43
43
  onEditorViewUpdated: ({ newEditorState, oldEditorState, }: EditorStateDiff) => void;
44
44
  onEditorPluginInitialized: (plugin: NextEditorPluginInitializedType) => void;
45
45
  private addPlugin;
@@ -211,6 +211,14 @@ export type FeatureFlags = {
211
211
  * @default false
212
212
  */
213
213
  tableSelector?: boolean;
214
+ /**
215
+ * @description
216
+ * Enables table to scale in the same way as renderer
217
+ *
218
+ * @see https://product-fabric.atlassian.net/browse/ED-22364
219
+ * @default false
220
+ */
221
+ tablePreserveWidth?: boolean;
214
222
  /**
215
223
  * @description
216
224
  * Enables commenting on media
@@ -219,6 +227,14 @@ export type FeatureFlags = {
219
227
  * @default false
220
228
  */
221
229
  commentsOnMedia?: boolean;
230
+ /**
231
+ * @description
232
+ * Enables macro interaction visual updates
233
+ *
234
+ * @see https://product-fabric.atlassian.net/browse/PGXT-4910
235
+ * @default false
236
+ */
237
+ macroInteractionUpdates?: boolean;
222
238
  };
223
239
  export type FeatureFlagKey = keyof FeatureFlags;
224
240
  export type GetEditorFeatureFlags = () => FeatureFlags;
@@ -23,6 +23,7 @@ export interface Props {
23
23
  fullWidthMode?: boolean;
24
24
  hasFallbackContainer?: boolean;
25
25
  handleMediaSingleRef?: React.RefObject<HTMLDivElement>;
26
+ isInsideOfInlineExtension?: boolean;
26
27
  }
27
28
  export type { MediaSingleWidthType, MediaSingleSize };
28
- export default function MediaSingle({ layout, width, height, containerWidth, isLoading, pctWidth, size, className, children: propsChildren, nodeType, fullWidthMode, lineLength: editorWidth, hasFallbackContainer, handleMediaSingleRef, }: Props): jsx.JSX.Element;
29
+ export default function MediaSingle({ layout, width, height, containerWidth, isLoading, pctWidth, size, className, children: propsChildren, nodeType, fullWidthMode, lineLength: editorWidth, hasFallbackContainer, handleMediaSingleRef, isInsideOfInlineExtension, }: Props): jsx.JSX.Element;
@@ -10,7 +10,15 @@ import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema'
10
10
  * then an image in wide or full-width can not be wider than the image's
11
11
  * original width.
12
12
  */
13
- export declare function calcLegacyWidth(layout: MediaSingleLayout, width: number, containerWidth?: number, fullWidthMode?: boolean, isResized?: boolean): string;
13
+ export declare function calcLegacyWidth(layout: MediaSingleLayout, width: number, containerWidth?: number, fullWidthMode?: boolean, isResized?: boolean, isInsideOfInlineExtension?: boolean): string;
14
+ /**
15
+ * Calculates the image width for non-resized images.
16
+ *
17
+ * If an image has not been resized using the pctWidth attribute,
18
+ * then an image in wide or full-width can not be wider than the image's
19
+ * original width.
20
+ */
21
+ export declare function calcLegacyWidthForInline(layout: MediaSingleLayout, width: number, containerWidth?: number, fullWidthMode?: boolean, isResized?: boolean): string;
14
22
  /**
15
23
  * Calculates the image width for previously resized images.
16
24
  *
@@ -34,12 +42,13 @@ export interface MediaSingleWrapperProps {
34
42
  innerRef?: ((elem: HTMLDivElement) => void) | RefObject<HTMLDivElement>;
35
43
  isExtendedResizeExperienceOn?: boolean;
36
44
  isNestedNode?: boolean;
45
+ isInsideOfInlineExtension?: boolean;
37
46
  }
38
47
  /**
39
48
  * Can't use `.attrs` to handle highly dynamic styles because we are still
40
49
  * supporting `styled-components` v1.
41
50
  */
42
- export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, mediaSingleWidth, width, isExtendedResizeExperienceOn, isNestedNode, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
51
+ export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, mediaSingleWidth, width, isExtendedResizeExperienceOn, isNestedNode, isInsideOfInlineExtension, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
43
52
  export interface MediaWrapperProps {
44
53
  paddingBottom?: string;
45
54
  height?: number;
@@ -15,15 +15,8 @@ export type WidthProviderState = {
15
15
  };
16
16
  type WidthProviderProps = {
17
17
  className?: string;
18
+ shouldCheckExistingValue?: boolean;
19
+ children?: React.ReactNode;
18
20
  };
19
- export declare class WidthProvider extends React.Component<WidthProviderProps, WidthProviderState> {
20
- state: {
21
- width: number;
22
- };
23
- constructor(props: any);
24
- render(): jsx.JSX.Element;
25
- setWidth: ((width: number) => void) & {
26
- cancel(): void;
27
- };
28
- }
21
+ export declare const WidthProvider: ({ className, shouldCheckExistingValue, children, }: WidthProviderProps) => jsx.JSX.Element;
29
22
  export { Consumer as WidthConsumer };
@@ -13,7 +13,7 @@ export { BaseTheme, mapBreakpointToLayoutMaxWidth } from './BaseTheme';
13
13
  export { default as withOuterListeners } from './with-outer-listeners';
14
14
  export type { WithOutsideClickProps } from './with-outer-listeners';
15
15
  export type { CardEventClickHandler, CardSurroundings, EventHandlers, LinkEventClickHandler, MentionEventHandler, MentionEventHandlers, SmartCardEventClickHandler, } from './EventHandlers';
16
- export { WidthContext, WidthConsumer, WidthProvider, getBreakpoint, } from './WidthProvider';
16
+ export { WidthContext, WidthConsumer, WidthProvider, createWidthContext, getBreakpoint, } from './WidthProvider';
17
17
  export type { WidthConsumerContext, Breakpoints } from './WidthProvider';
18
18
  export { default as overflowShadow, shadowClassNames } from './OverflowShadow';
19
19
  export type { OverflowShadowOptions, OverflowShadowProps, OverflowShadowState, } from './OverflowShadow';
@@ -1,13 +1,14 @@
1
1
  /** @jsx jsx */
2
- import React, { Component } from 'react';
2
+ import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
5
+ import type { ExtensionsPluginInjectionAPI } from '../../types';
5
6
  export interface Props {
6
7
  node: PmNode;
8
+ pluginInjectionApi: ExtensionsPluginInjectionAPI;
7
9
  children?: React.ReactNode;
8
10
  showMacroInteractionDesignUpdates?: boolean;
9
11
  isNodeSelected?: boolean;
10
12
  }
11
- export default class InlineExtension extends Component<Props, any> {
12
- render(): jsx.JSX.Element;
13
- }
13
+ declare const InlineExtension: (props: Props) => jsx.JSX.Element;
14
+ export default InlineExtension;
@@ -1 +1,2 @@
1
1
  export declare const wrapperStyle: import("@emotion/react").SerializedStyles;
2
+ export declare const inlineWrapperStyels: import("@emotion/react").SerializedStyles;
@@ -19,6 +19,7 @@ type Props = {
19
19
  pluginInjectionApi?: ExtensionsPluginInjectionAPI;
20
20
  editorAppearance?: EditorAppearance;
21
21
  showMacroInteractionDesignUpdates?: boolean;
22
+ isNodeSelected?: boolean;
22
23
  };
23
24
  declare const MultiBodiedExtension: (props: Props & OverflowShadowProps) => jsx.JSX.Element;
24
25
  /**
@@ -40,8 +40,8 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
40
40
  private plugins;
41
41
  constructor({ getEditorState, getEditorView }: PluginInjectionAPIProps);
42
42
  api<T extends NextEditorPlugin<any, any>>(): import("../types/next-editor-plugin").PublicPluginAPI<[
43
- NextEditorPlugin<T extends import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<infer Name extends string, any, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never>,
44
- ..."dependencies" extends keyof (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never) ? (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"] extends (import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<any, any, any> | import("../types/next-editor-plugin").OptionalPlugin<import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<any, any, any>>)[] ? Exclude<(T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"], undefined> : [
43
+ NextEditorPlugin<T extends import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<infer Name extends string, any, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata_1 extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata_1 : never>,
44
+ ..."dependencies" extends keyof (T extends NextEditorPlugin<any, infer Metadata_1 extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata_1 : never) ? (T extends NextEditorPlugin<any, infer Metadata_1 extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata_1 : never)["dependencies"] extends (import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<any, any, any> | import("../types/next-editor-plugin").OptionalPlugin<import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<any, any, any>>)[] ? Exclude<(T extends NextEditorPlugin<any, infer Metadata_1 extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata_1 : never)["dependencies"], undefined> : [
45
45
  ] : [
46
46
  ]
47
47
  ]>;
@@ -211,6 +211,14 @@ export type FeatureFlags = {
211
211
  * @default false
212
212
  */
213
213
  tableSelector?: boolean;
214
+ /**
215
+ * @description
216
+ * Enables table to scale in the same way as renderer
217
+ *
218
+ * @see https://product-fabric.atlassian.net/browse/ED-22364
219
+ * @default false
220
+ */
221
+ tablePreserveWidth?: boolean;
214
222
  /**
215
223
  * @description
216
224
  * Enables commenting on media
@@ -219,6 +227,14 @@ export type FeatureFlags = {
219
227
  * @default false
220
228
  */
221
229
  commentsOnMedia?: boolean;
230
+ /**
231
+ * @description
232
+ * Enables macro interaction visual updates
233
+ *
234
+ * @see https://product-fabric.atlassian.net/browse/PGXT-4910
235
+ * @default false
236
+ */
237
+ macroInteractionUpdates?: boolean;
222
238
  };
223
239
  export type FeatureFlagKey = keyof FeatureFlags;
224
240
  export type GetEditorFeatureFlags = () => FeatureFlags;