@atlaskit/editor-common 74.22.0 → 74.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 74.23.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`3fb20c4aeba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3fb20c4aeba) - Add postinstall check to enforce internal peer dependencies
8
+
9
+ ## 74.23.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`5f028fb62a1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5f028fb62a1) - ED-19038 added mediaSingle.widthType support to renderer.
14
+
3
15
  ## 74.22.0
4
16
 
5
17
  ### Minor Changes
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "74.22.0";
19
+ var packageVersion = "74.23.1";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // TODO: Sanitise the URL instead of just removing it
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
24
24
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
25
25
  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; } } /** @jsx jsx */
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "74.22.0";
27
+ var packageVersion = "74.23.1";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -40,6 +40,7 @@ function MediaSingle(_ref) {
40
40
  _ref$isLoading = _ref.isLoading,
41
41
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
42
42
  pctWidth = _ref.pctWidth,
43
+ size = _ref.size,
43
44
  className = _ref.className,
44
45
  propsChildren = _ref.children,
45
46
  _ref$nodeType = _ref.nodeType,
@@ -49,16 +50,18 @@ function MediaSingle(_ref) {
49
50
  _ref$hasFallbackConta = _ref.hasFallbackContainer,
50
51
  hasFallbackContainer = _ref$hasFallbackConta === void 0 ? true : _ref$hasFallbackConta,
51
52
  handleMediaSingleRef = _ref.handleMediaSingleRef;
53
+ var isPixelWidth = (size === null || size === void 0 ? void 0 : size.widthType) === 'pixel';
54
+ var mediaSingleWidth = (size === null || size === void 0 ? void 0 : size.width) || pctWidth;
52
55
  var children = _react.default.Children.toArray(propsChildren);
53
- if (!pctWidth && shouldAddDefaultWrappedWidth(layout, width, lineLength)) {
54
- pctWidth = 50;
56
+ if (!mediaSingleWidth && shouldAddDefaultWrappedWidth(layout, width, lineLength)) {
57
+ mediaSingleWidth = isPixelWidth ? lineLength / 2 : 50;
55
58
  }
56
59
  // When width is not set we have an absolute height for a given embed.
57
60
  // When both width and height are set we use them to determine ratio and use that to define
58
61
  // embed height in relation to whatever width of an dom element is in runtime
59
62
  var isHeightOnly = width === undefined;
60
- if (pctWidth) {
61
- var pxWidth = Math.ceil((0, _grid.calcPxFromPct)(pctWidth / 100, lineLength || containerWidth || 0));
63
+ if (mediaSingleWidth) {
64
+ var pxWidth = isPixelWidth ? mediaSingleWidth : Math.ceil((0, _grid.calcPxFromPct)(mediaSingleWidth / 100, lineLength || containerWidth || 0));
62
65
  if (isHeightOnly) {
63
66
  width = pxWidth - _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide;
64
67
  } else if (width !== undefined) {
@@ -66,7 +69,7 @@ function MediaSingle(_ref) {
66
69
  width = pxWidth;
67
70
  }
68
71
  } else if (isHeightOnly) {
69
- // No pctWidth can be found on already existing pages with existing embeds
72
+ // No mediaSingleWidth can be found on already existing pages with existing embeds
70
73
 
71
74
  // It's ok to use Embed specific width, because width can be not set only in embed card.
72
75
  // This value will be used only in the case of non `wide` and non `full-width` cases inside MediaSingleDimensionHelper.
@@ -102,11 +105,12 @@ function MediaSingle(_ref) {
102
105
  width: width,
103
106
  layout: layout,
104
107
  containerWidth: containerWidth,
105
- pctWidth: pctWidth,
108
+ mediaSingleWidth: mediaSingleWidth,
106
109
  fullWidthMode: fullWidthMode
107
110
  }),
108
111
  "data-layout": layout,
109
- "data-width": pctWidth,
112
+ "data-width": mediaSingleWidth,
113
+ "data-width-type": (size === null || size === void 0 ? void 0 : size.widthType) || 'percentage',
110
114
  "data-node-type": nodeType,
111
115
  className: (0, _classnames.default)('rich-media-item mediaSingleView-content-wrap', "image-".concat(layout), className, {
112
116
  'is-loading': isLoading,
@@ -118,8 +118,9 @@ var MediaSingleDimensionHelper = function MediaSingleDimensionHelper(_ref) {
118
118
  isResized = _ref.isResized,
119
119
  layout = _ref.layout,
120
120
  pctWidth = _ref.pctWidth,
121
+ mediaSingleWidth = _ref.mediaSingleWidth,
121
122
  width = _ref.width;
122
- return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /* For nested rich media items, set max-width to 100% */\n tr &,\n [data-layout-column] &,\n [data-node-type='expand'] & {\n max-width: 100%;\n }\n\n width: ", ";\n ", "\n max-width: ", ";\n float: ", ";\n margin: ", ";\n ", ";\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n"])), pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized), layout === 'full-width' && (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n min-width: 100%;\n "]))), calcMaxWidth(layout, containerWidth), float(layout), calcMargin(layout), isImageAligned(layout));
123
+ return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /* For nested rich media items, set max-width to 100% */\n tr &,\n [data-layout-column] &,\n [data-node-type='expand'] & {\n max-width: 100%;\n }\n\n width: ", ";\n ", "\n max-width: ", ";\n float: ", ";\n margin: ", ";\n ", ";\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n"])), mediaSingleWidth || pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized), layout === 'full-width' && (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n min-width: 100%;\n "]))), calcMaxWidth(layout, containerWidth), float(layout), calcMargin(layout), isImageAligned(layout));
123
124
  };
124
125
  exports.MediaSingleDimensionHelper = MediaSingleDimensionHelper;
125
126
  var RenderFallbackContainer = function RenderFallbackContainer(_ref2) {
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.22.0",
3
+ "version": "74.23.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,6 @@
1
1
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
2
2
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
3
- const packageVersion = "74.22.0";
3
+ const packageVersion = "74.23.1";
4
4
  const sanitiseSentryEvents = (data, _hint) => {
5
5
  // Remove URL as it has UGC
6
6
  // TODO: Sanitise the URL instead of just removing it
@@ -8,7 +8,7 @@ import { themed } from '@atlaskit/theme/components';
8
8
  import { borderRadius } from '@atlaskit/theme/constants';
9
9
  import Layer from '../Layer';
10
10
  const packageName = "@atlaskit/editor-common";
11
- const packageVersion = "74.22.0";
11
+ const packageVersion = "74.23.1";
12
12
  const halfFocusRing = 1;
13
13
  const dropOffset = '0, 8';
14
14
  class DropList extends Component {
@@ -23,6 +23,7 @@ export default function MediaSingle({
23
23
  containerWidth = width,
24
24
  isLoading = false,
25
25
  pctWidth,
26
+ size,
26
27
  className,
27
28
  children: propsChildren,
28
29
  nodeType = 'mediaSingle',
@@ -31,16 +32,18 @@ export default function MediaSingle({
31
32
  hasFallbackContainer = true,
32
33
  handleMediaSingleRef
33
34
  }) {
35
+ const isPixelWidth = (size === null || size === void 0 ? void 0 : size.widthType) === 'pixel';
36
+ let mediaSingleWidth = (size === null || size === void 0 ? void 0 : size.width) || pctWidth;
34
37
  const children = React.Children.toArray(propsChildren);
35
- if (!pctWidth && shouldAddDefaultWrappedWidth(layout, width, lineLength)) {
36
- pctWidth = 50;
38
+ if (!mediaSingleWidth && shouldAddDefaultWrappedWidth(layout, width, lineLength)) {
39
+ mediaSingleWidth = isPixelWidth ? lineLength / 2 : 50;
37
40
  }
38
41
  // When width is not set we have an absolute height for a given embed.
39
42
  // When both width and height are set we use them to determine ratio and use that to define
40
43
  // embed height in relation to whatever width of an dom element is in runtime
41
44
  const isHeightOnly = width === undefined;
42
- if (pctWidth) {
43
- const pxWidth = Math.ceil(calcPxFromPct(pctWidth / 100, lineLength || containerWidth || 0));
45
+ if (mediaSingleWidth) {
46
+ const pxWidth = isPixelWidth ? mediaSingleWidth : Math.ceil(calcPxFromPct(mediaSingleWidth / 100, lineLength || containerWidth || 0));
44
47
  if (isHeightOnly) {
45
48
  width = pxWidth - akEditorMediaResizeHandlerPaddingWide;
46
49
  } else if (width !== undefined) {
@@ -48,7 +51,7 @@ export default function MediaSingle({
48
51
  width = pxWidth;
49
52
  }
50
53
  } else if (isHeightOnly) {
51
- // No pctWidth can be found on already existing pages with existing embeds
54
+ // No mediaSingleWidth can be found on already existing pages with existing embeds
52
55
 
53
56
  // It's ok to use Embed specific width, because width can be not set only in embed card.
54
57
  // This value will be used only in the case of non `wide` and non `full-width` cases inside MediaSingleDimensionHelper.
@@ -82,11 +85,12 @@ export default function MediaSingle({
82
85
  width,
83
86
  layout,
84
87
  containerWidth,
85
- pctWidth,
88
+ mediaSingleWidth,
86
89
  fullWidthMode
87
90
  }),
88
91
  "data-layout": layout,
89
- "data-width": pctWidth,
92
+ "data-width": mediaSingleWidth,
93
+ "data-width-type": (size === null || size === void 0 ? void 0 : size.widthType) || 'percentage',
90
94
  "data-node-type": nodeType,
91
95
  className: classnames('rich-media-item mediaSingleView-content-wrap', `image-${layout}`, className, {
92
96
  'is-loading': isLoading,
@@ -99,6 +99,7 @@ export const MediaSingleDimensionHelper = ({
99
99
  isResized,
100
100
  layout,
101
101
  pctWidth,
102
+ mediaSingleWidth,
102
103
  width
103
104
  }) => css`
104
105
  /* For nested rich media items, set max-width to 100% */
@@ -108,7 +109,7 @@ export const MediaSingleDimensionHelper = ({
108
109
  max-width: 100%;
109
110
  }
110
111
 
111
- width: ${pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized)};
112
+ width: ${mediaSingleWidth || pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized)};
112
113
  ${layout === 'full-width' && css`
113
114
  min-width: 100%;
114
115
  `}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.22.0",
3
+ "version": "74.23.1",
4
4
  "sideEffects": false
5
5
  }
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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 = "74.22.0";
9
+ var packageVersion = "74.23.1";
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
@@ -18,7 +18,7 @@ import { themed } from '@atlaskit/theme/components';
18
18
  import { borderRadius } from '@atlaskit/theme/constants';
19
19
  import Layer from '../Layer';
20
20
  var packageName = "@atlaskit/editor-common";
21
- var packageVersion = "74.22.0";
21
+ var packageVersion = "74.23.1";
22
22
  var halfFocusRing = 1;
23
23
  var dropOffset = '0, 8';
24
24
  var DropList = /*#__PURE__*/function (_Component) {
@@ -26,6 +26,7 @@ export default function MediaSingle(_ref) {
26
26
  _ref$isLoading = _ref.isLoading,
27
27
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
28
28
  pctWidth = _ref.pctWidth,
29
+ size = _ref.size,
29
30
  className = _ref.className,
30
31
  propsChildren = _ref.children,
31
32
  _ref$nodeType = _ref.nodeType,
@@ -35,16 +36,18 @@ export default function MediaSingle(_ref) {
35
36
  _ref$hasFallbackConta = _ref.hasFallbackContainer,
36
37
  hasFallbackContainer = _ref$hasFallbackConta === void 0 ? true : _ref$hasFallbackConta,
37
38
  handleMediaSingleRef = _ref.handleMediaSingleRef;
39
+ var isPixelWidth = (size === null || size === void 0 ? void 0 : size.widthType) === 'pixel';
40
+ var mediaSingleWidth = (size === null || size === void 0 ? void 0 : size.width) || pctWidth;
38
41
  var children = React.Children.toArray(propsChildren);
39
- if (!pctWidth && shouldAddDefaultWrappedWidth(layout, width, lineLength)) {
40
- pctWidth = 50;
42
+ if (!mediaSingleWidth && shouldAddDefaultWrappedWidth(layout, width, lineLength)) {
43
+ mediaSingleWidth = isPixelWidth ? lineLength / 2 : 50;
41
44
  }
42
45
  // When width is not set we have an absolute height for a given embed.
43
46
  // When both width and height are set we use them to determine ratio and use that to define
44
47
  // embed height in relation to whatever width of an dom element is in runtime
45
48
  var isHeightOnly = width === undefined;
46
- if (pctWidth) {
47
- var pxWidth = Math.ceil(calcPxFromPct(pctWidth / 100, lineLength || containerWidth || 0));
49
+ if (mediaSingleWidth) {
50
+ var pxWidth = isPixelWidth ? mediaSingleWidth : Math.ceil(calcPxFromPct(mediaSingleWidth / 100, lineLength || containerWidth || 0));
48
51
  if (isHeightOnly) {
49
52
  width = pxWidth - akEditorMediaResizeHandlerPaddingWide;
50
53
  } else if (width !== undefined) {
@@ -52,7 +55,7 @@ export default function MediaSingle(_ref) {
52
55
  width = pxWidth;
53
56
  }
54
57
  } else if (isHeightOnly) {
55
- // No pctWidth can be found on already existing pages with existing embeds
58
+ // No mediaSingleWidth can be found on already existing pages with existing embeds
56
59
 
57
60
  // It's ok to use Embed specific width, because width can be not set only in embed card.
58
61
  // This value will be used only in the case of non `wide` and non `full-width` cases inside MediaSingleDimensionHelper.
@@ -88,11 +91,12 @@ export default function MediaSingle(_ref) {
88
91
  width: width,
89
92
  layout: layout,
90
93
  containerWidth: containerWidth,
91
- pctWidth: pctWidth,
94
+ mediaSingleWidth: mediaSingleWidth,
92
95
  fullWidthMode: fullWidthMode
93
96
  }),
94
97
  "data-layout": layout,
95
- "data-width": pctWidth,
98
+ "data-width": mediaSingleWidth,
99
+ "data-width-type": (size === null || size === void 0 ? void 0 : size.widthType) || 'percentage',
96
100
  "data-node-type": nodeType,
97
101
  className: classnames('rich-media-item mediaSingleView-content-wrap', "image-".concat(layout), className, {
98
102
  'is-loading': isLoading,
@@ -108,8 +108,9 @@ export var MediaSingleDimensionHelper = function MediaSingleDimensionHelper(_ref
108
108
  isResized = _ref.isResized,
109
109
  layout = _ref.layout,
110
110
  pctWidth = _ref.pctWidth,
111
+ mediaSingleWidth = _ref.mediaSingleWidth,
111
112
  width = _ref.width;
112
- 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 max-width: 100%;\n }\n\n width: ", ";\n ", "\n max-width: ", ";\n float: ", ";\n margin: ", ";\n ", ";\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n"])), pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized), layout === 'full-width' && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: 100%;\n "]))), calcMaxWidth(layout, containerWidth), float(layout), calcMargin(layout), isImageAligned(layout));
113
+ 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 max-width: 100%;\n }\n\n width: ", ";\n ", "\n max-width: ", ";\n float: ", ";\n margin: ", ";\n ", ";\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n"])), mediaSingleWidth || pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized), layout === 'full-width' && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: 100%;\n "]))), calcMaxWidth(layout, containerWidth), float(layout), calcMargin(layout), isImageAligned(layout));
113
114
  };
114
115
  var RenderFallbackContainer = function RenderFallbackContainer(_ref2) {
115
116
  var hasFallbackContainer = _ref2.hasFallbackContainer,
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.22.0",
3
+ "version": "74.23.1",
4
4
  "sideEffects": false
5
5
  }
@@ -2,6 +2,7 @@
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  import { RichMediaLayout as MediaSingleLayout, RichMediaLayout } from '@atlaskit/adf-schema';
5
+ import type { MediaSingleSize, MediaSingleWidthType } from './types';
5
6
  export declare const DEFAULT_IMAGE_WIDTH = 250;
6
7
  export declare const DEFAULT_IMAGE_HEIGHT = 200;
7
8
  export declare const IMAGE_AND_BORDER_ADJUSTMENT = 2;
@@ -14,11 +15,18 @@ export interface Props {
14
15
  containerWidth?: number;
15
16
  isLoading?: boolean;
16
17
  className?: string;
18
+ /**
19
+ * @private
20
+ * @deprecated Use {@link Props.size.width} instead.
21
+ * Cleanup ticket: https://product-fabric.atlassian.net/browse/ED-19076
22
+ */
17
23
  pctWidth?: number;
24
+ size?: MediaSingleSize;
18
25
  nodeType?: string;
19
26
  fullWidthMode?: boolean;
20
27
  hasFallbackContainer?: boolean;
21
28
  handleMediaSingleRef?: React.RefObject<HTMLDivElement>;
22
29
  }
23
30
  export declare const shouldAddDefaultWrappedWidth: (layout: RichMediaLayout, width?: number, lineLength?: number) => boolean | 0 | undefined;
24
- export default function MediaSingle({ layout, width, height, containerWidth, isLoading, pctWidth, className, children: propsChildren, nodeType, fullWidthMode, lineLength, hasFallbackContainer, handleMediaSingleRef, }: Props): jsx.JSX.Element;
31
+ export type { MediaSingleWidthType, MediaSingleSize };
32
+ export default function MediaSingle({ layout, width, height, containerWidth, isLoading, pctWidth, size, className, children: propsChildren, nodeType, fullWidthMode, lineLength, hasFallbackContainer, handleMediaSingleRef, }: Props): jsx.JSX.Element;
@@ -22,7 +22,13 @@ export interface MediaSingleWrapperProps {
22
22
  fullWidthMode?: boolean;
23
23
  isResized?: boolean;
24
24
  layout: MediaSingleLayout;
25
+ /**
26
+ * @private
27
+ * @deprecated Use {@link MediaSingleWrapperProps.mediaSingleWidth} instead.
28
+ * Cleanup ticket: https://product-fabric.atlassian.net/browse/ED-19076
29
+ */
25
30
  pctWidth?: number;
31
+ mediaSingleWidth?: number;
26
32
  width?: number;
27
33
  innerRef?: ((elem: HTMLDivElement) => void) | RefObject<HTMLDivElement>;
28
34
  }
@@ -30,7 +36,7 @@ export interface MediaSingleWrapperProps {
30
36
  * Can't use `.attrs` to handle highly dynamic styles because we are still
31
37
  * supporting `styled-components` v1.
32
38
  */
33
- export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, pctWidth, width, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
39
+ export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, pctWidth, mediaSingleWidth, width, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
34
40
  export interface MediaWrapperProps {
35
41
  paddingBottom?: string;
36
42
  height?: number;
@@ -0,0 +1,12 @@
1
+ export type MediaSingleWidthType = 'pixel' | 'percentage';
2
+ export type MediaSingleSize = {
3
+ /**
4
+ * The width attribute from mediaSingle node
5
+ */
6
+ width?: number;
7
+ /**
8
+ * The widthType attribute from mediaSingle node
9
+ * @default percentage
10
+ */
11
+ widthType?: MediaSingleWidthType;
12
+ };
@@ -1,6 +1,6 @@
1
1
  export { default as Caption } from './Caption';
2
2
  export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT, shouldAddDefaultWrappedWidth, } from './MediaSingle';
3
- export type { Props as MediaSingleProps } from './MediaSingle';
3
+ export type { Props as MediaSingleProps, MediaSingleWidthType, MediaSingleSize, } from './MediaSingle';
4
4
  export { MediaSingleDimensionHelper } from './MediaSingle/styled';
5
5
  export type { MediaSingleWrapperProps as MediaSingleDimensionHelperProps } from './MediaSingle/styled';
6
6
  export { layoutSupportsWidth, calcPxFromColumns, calcPctFromPx, calcPxFromPct, calcColumnsFromPx, snapToGrid, calcMediaPxWidth, wrappedLayouts, } from './MediaSingle/grid';
@@ -2,6 +2,7 @@
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  import { RichMediaLayout as MediaSingleLayout, RichMediaLayout } from '@atlaskit/adf-schema';
5
+ import type { MediaSingleSize, MediaSingleWidthType } from './types';
5
6
  export declare const DEFAULT_IMAGE_WIDTH = 250;
6
7
  export declare const DEFAULT_IMAGE_HEIGHT = 200;
7
8
  export declare const IMAGE_AND_BORDER_ADJUSTMENT = 2;
@@ -14,11 +15,18 @@ export interface Props {
14
15
  containerWidth?: number;
15
16
  isLoading?: boolean;
16
17
  className?: string;
18
+ /**
19
+ * @private
20
+ * @deprecated Use {@link Props.size.width} instead.
21
+ * Cleanup ticket: https://product-fabric.atlassian.net/browse/ED-19076
22
+ */
17
23
  pctWidth?: number;
24
+ size?: MediaSingleSize;
18
25
  nodeType?: string;
19
26
  fullWidthMode?: boolean;
20
27
  hasFallbackContainer?: boolean;
21
28
  handleMediaSingleRef?: React.RefObject<HTMLDivElement>;
22
29
  }
23
30
  export declare const shouldAddDefaultWrappedWidth: (layout: RichMediaLayout, width?: number, lineLength?: number) => boolean | 0 | undefined;
24
- export default function MediaSingle({ layout, width, height, containerWidth, isLoading, pctWidth, className, children: propsChildren, nodeType, fullWidthMode, lineLength, hasFallbackContainer, handleMediaSingleRef, }: Props): jsx.JSX.Element;
31
+ export type { MediaSingleWidthType, MediaSingleSize };
32
+ export default function MediaSingle({ layout, width, height, containerWidth, isLoading, pctWidth, size, className, children: propsChildren, nodeType, fullWidthMode, lineLength, hasFallbackContainer, handleMediaSingleRef, }: Props): jsx.JSX.Element;
@@ -22,7 +22,13 @@ export interface MediaSingleWrapperProps {
22
22
  fullWidthMode?: boolean;
23
23
  isResized?: boolean;
24
24
  layout: MediaSingleLayout;
25
+ /**
26
+ * @private
27
+ * @deprecated Use {@link MediaSingleWrapperProps.mediaSingleWidth} instead.
28
+ * Cleanup ticket: https://product-fabric.atlassian.net/browse/ED-19076
29
+ */
25
30
  pctWidth?: number;
31
+ mediaSingleWidth?: number;
26
32
  width?: number;
27
33
  innerRef?: ((elem: HTMLDivElement) => void) | RefObject<HTMLDivElement>;
28
34
  }
@@ -30,7 +36,7 @@ export interface MediaSingleWrapperProps {
30
36
  * Can't use `.attrs` to handle highly dynamic styles because we are still
31
37
  * supporting `styled-components` v1.
32
38
  */
33
- export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, pctWidth, width, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
39
+ export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, pctWidth, mediaSingleWidth, width, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
34
40
  export interface MediaWrapperProps {
35
41
  paddingBottom?: string;
36
42
  height?: number;
@@ -0,0 +1,12 @@
1
+ export type MediaSingleWidthType = 'pixel' | 'percentage';
2
+ export type MediaSingleSize = {
3
+ /**
4
+ * The width attribute from mediaSingle node
5
+ */
6
+ width?: number;
7
+ /**
8
+ * The widthType attribute from mediaSingle node
9
+ * @default percentage
10
+ */
11
+ widthType?: MediaSingleWidthType;
12
+ };
@@ -1,6 +1,6 @@
1
1
  export { default as Caption } from './Caption';
2
2
  export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT, shouldAddDefaultWrappedWidth, } from './MediaSingle';
3
- export type { Props as MediaSingleProps } from './MediaSingle';
3
+ export type { Props as MediaSingleProps, MediaSingleWidthType, MediaSingleSize, } from './MediaSingle';
4
4
  export { MediaSingleDimensionHelper } from './MediaSingle/styled';
5
5
  export type { MediaSingleWrapperProps as MediaSingleDimensionHelperProps } from './MediaSingle/styled';
6
6
  export { layoutSupportsWidth, calcPxFromColumns, calcPctFromPx, calcPxFromPct, calcColumnsFromPx, snapToGrid, calcMediaPxWidth, wrappedLayouts, } from './MediaSingle/grid';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.22.0",
3
+ "version": "74.23.1",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -89,6 +89,7 @@
89
89
  "@atlaskit/editor-palette": "1.5.1",
90
90
  "@atlaskit/editor-shared-styles": "^2.4.0",
91
91
  "@atlaskit/emoji": "^67.4.0",
92
+ "@atlaskit/enforce-peer-dependencies": "^1.0.1",
92
93
  "@atlaskit/icon": "^21.12.0",
93
94
  "@atlaskit/icon-object": "^6.3.0",
94
95
  "@atlaskit/in-product-testing": "^0.2.0",
@@ -195,5 +196,8 @@
195
196
  "platform.linking-platform.datasource-jira_issues": {
196
197
  "type": "boolean"
197
198
  }
199
+ },
200
+ "scripts": {
201
+ "postinstall": "npx enforce-peer-dependencies --internal-packages"
198
202
  }
199
203
  }
@@ -1,9 +0,0 @@
1
- ## API Report File for "@atlaskit/editor-common"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- // (No @packageDocumentation comment for this package)
8
-
9
- ```