@atlaskit/renderer 108.15.3 → 108.15.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.
@@ -46,7 +46,19 @@ var checkForMediaElement = function checkForMediaElement(children) {
46
46
  // returns the existing container width if available (non SSR mode), otherwise
47
47
  // we return a default width value
48
48
  var getMediaContainerWidth = function getMediaContainerWidth(currentContainerWidth, layout) {
49
- return !currentContainerWidth && layout !== 'full-width' && layout !== 'wide' ? _editorSharedStyles.akEditorDefaultLayoutWidth : currentContainerWidth;
49
+ if (currentContainerWidth) {
50
+ return currentContainerWidth;
51
+ }
52
+
53
+ // SSR mode fallback to default layout width
54
+ switch (layout) {
55
+ case 'full-width':
56
+ return _editorSharedStyles.akEditorFullWidthLayoutWidth;
57
+ case 'wide':
58
+ return _editorSharedStyles.akEditorWideLayoutWidth;
59
+ default:
60
+ return _editorSharedStyles.akEditorDefaultLayoutWidth;
61
+ }
50
62
  };
51
63
  exports.getMediaContainerWidth = getMediaContainerWidth;
52
64
  var MediaSingle = function MediaSingle(props) {
@@ -116,7 +128,7 @@ var MediaSingle = function MediaSingle(props) {
116
128
 
117
129
  var padding = rendererAppearance === 'full-page' ? _style.FullPagePadding * 2 : 0;
118
130
  var isFullWidth = rendererAppearance === 'full-width';
119
- var calcDimensions = function calcDimensions(mediaContainerWidth, mediaBreakpoint) {
131
+ var calcDimensions = function calcDimensions(mediaContainerWidth) {
120
132
  var containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
121
133
  var maxWidth = containerWidth;
122
134
  var maxHeight = height / width * maxWidth;
@@ -145,8 +157,8 @@ var MediaSingle = function MediaSingle(props) {
145
157
  height: height,
146
158
  width: width
147
159
  };
148
- var renderMediaSingle = function renderMediaSingle(renderWidth, mediaBreakpoint) {
149
- var _calcDimensions = calcDimensions(renderWidth, mediaBreakpoint),
160
+ var renderMediaSingle = function renderMediaSingle(renderWidth) {
161
+ var _calcDimensions = calcDimensions(renderWidth),
150
162
  cardDimensions = _calcDimensions.cardDimensions,
151
163
  lineLength = _calcDimensions.lineLength,
152
164
  containerWidth = _calcDimensions.containerWidth;
@@ -175,9 +187,11 @@ var MediaSingle = function MediaSingle(props) {
175
187
  }, (0, _react2.jsx)(_react.Fragment, null, mediaComponent), showCaptions && caption);
176
188
  };
177
189
  return (0, _react2.jsx)(_ui.WidthConsumer, null, function (_ref3) {
178
- var width = _ref3.width,
179
- breakpoint = _ref3.breakpoint;
180
- return renderMediaSingle(width, breakpoint);
190
+ var width = _ref3.width;
191
+ // Note: in SSR mode the `window` object is not defined,
192
+ // therefore width here is 0, see:
193
+ // packages/editor/editor-common/src/ui/WidthProvider/index.tsx
194
+ return renderMediaSingle(width);
181
195
  });
182
196
  };
183
197
  var _default = (0, _reactIntlNext.injectIntl)(MediaSingle);
@@ -55,7 +55,7 @@ exports.NORMAL_SEVERITY_THRESHOLD = NORMAL_SEVERITY_THRESHOLD;
55
55
  var DEGRADED_SEVERITY_THRESHOLD = 3000;
56
56
  exports.DEGRADED_SEVERITY_THRESHOLD = DEGRADED_SEVERITY_THRESHOLD;
57
57
  var packageName = "@atlaskit/renderer";
58
- var packageVersion = "108.15.3";
58
+ var packageVersion = "108.15.5";
59
59
  var Renderer = /*#__PURE__*/function (_PureComponent) {
60
60
  (0, _inherits2.default)(Renderer, _PureComponent);
61
61
  var _super = _createSuper(Renderer);
@@ -5,7 +5,7 @@ import { jsx } from '@emotion/react';
5
5
  import { injectIntl } from 'react-intl-next';
6
6
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
7
7
  import { MediaSingle as UIMediaSingle, WidthConsumer } from '@atlaskit/editor-common/ui';
8
- import { akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
8
+ import { akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
9
9
  import { FullPagePadding } from '../../../ui/Renderer/style';
10
10
  import { uiMediaSingleBaseStyles, uiMediaSingleLayoutStyles } from './styles';
11
11
  const DEFAULT_WIDTH = 250;
@@ -34,7 +34,19 @@ const checkForMediaElement = children => {
34
34
  // returns the existing container width if available (non SSR mode), otherwise
35
35
  // we return a default width value
36
36
  export const getMediaContainerWidth = (currentContainerWidth, layout) => {
37
- return !currentContainerWidth && layout !== 'full-width' && layout !== 'wide' ? akEditorDefaultLayoutWidth : currentContainerWidth;
37
+ if (currentContainerWidth) {
38
+ return currentContainerWidth;
39
+ }
40
+
41
+ // SSR mode fallback to default layout width
42
+ switch (layout) {
43
+ case 'full-width':
44
+ return akEditorFullWidthLayoutWidth;
45
+ case 'wide':
46
+ return akEditorWideLayoutWidth;
47
+ default:
48
+ return akEditorDefaultLayoutWidth;
49
+ }
38
50
  };
39
51
  const MediaSingle = props => {
40
52
  const {
@@ -100,7 +112,7 @@ const MediaSingle = props => {
100
112
 
101
113
  const padding = rendererAppearance === 'full-page' ? FullPagePadding * 2 : 0;
102
114
  const isFullWidth = rendererAppearance === 'full-width';
103
- const calcDimensions = (mediaContainerWidth, mediaBreakpoint) => {
115
+ const calcDimensions = mediaContainerWidth => {
104
116
  const containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
105
117
  const maxWidth = containerWidth;
106
118
  const maxHeight = height / width * maxWidth;
@@ -129,12 +141,12 @@ const MediaSingle = props => {
129
141
  height,
130
142
  width
131
143
  };
132
- const renderMediaSingle = (renderWidth, mediaBreakpoint) => {
144
+ const renderMediaSingle = renderWidth => {
133
145
  const {
134
146
  cardDimensions,
135
147
  lineLength,
136
148
  containerWidth
137
- } = calcDimensions(renderWidth, mediaBreakpoint);
149
+ } = calcDimensions(renderWidth);
138
150
  const mediaComponent = /*#__PURE__*/React.cloneElement(media, {
139
151
  resizeMode: 'stretchy-fit',
140
152
  cardDimensions,
@@ -160,10 +172,12 @@ const MediaSingle = props => {
160
172
  }, jsx(Fragment, null, mediaComponent), showCaptions && caption);
161
173
  };
162
174
  return jsx(WidthConsumer, null, ({
163
- width,
164
- breakpoint
175
+ width
165
176
  }) => {
166
- return renderMediaSingle(width, breakpoint);
177
+ // Note: in SSR mode the `window` object is not defined,
178
+ // therefore width here is 0, see:
179
+ // packages/editor/editor-common/src/ui/WidthProvider/index.tsx
180
+ return renderMediaSingle(width);
167
181
  });
168
182
  };
169
183
  export default injectIntl(MediaSingle);
@@ -35,7 +35,7 @@ import { RenderTracking } from '../../react/utils/performance/RenderTracking';
35
35
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
36
36
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
37
37
  const packageName = "@atlaskit/renderer";
38
- const packageVersion = "108.15.3";
38
+ const packageVersion = "108.15.5";
39
39
  export class Renderer extends PureComponent {
40
40
  constructor(props) {
41
41
  super(props);
@@ -6,7 +6,7 @@ import { jsx } from '@emotion/react';
6
6
  import { injectIntl } from 'react-intl-next';
7
7
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
8
8
  import { MediaSingle as UIMediaSingle, WidthConsumer } from '@atlaskit/editor-common/ui';
9
- import { akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
9
+ import { akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
10
10
  import { FullPagePadding } from '../../../ui/Renderer/style';
11
11
  import { uiMediaSingleBaseStyles, uiMediaSingleLayoutStyles } from './styles';
12
12
  var DEFAULT_WIDTH = 250;
@@ -36,7 +36,19 @@ var checkForMediaElement = function checkForMediaElement(children) {
36
36
  // returns the existing container width if available (non SSR mode), otherwise
37
37
  // we return a default width value
38
38
  export var getMediaContainerWidth = function getMediaContainerWidth(currentContainerWidth, layout) {
39
- return !currentContainerWidth && layout !== 'full-width' && layout !== 'wide' ? akEditorDefaultLayoutWidth : currentContainerWidth;
39
+ if (currentContainerWidth) {
40
+ return currentContainerWidth;
41
+ }
42
+
43
+ // SSR mode fallback to default layout width
44
+ switch (layout) {
45
+ case 'full-width':
46
+ return akEditorFullWidthLayoutWidth;
47
+ case 'wide':
48
+ return akEditorWideLayoutWidth;
49
+ default:
50
+ return akEditorDefaultLayoutWidth;
51
+ }
40
52
  };
41
53
  var MediaSingle = function MediaSingle(props) {
42
54
  var rendererAppearance = props.rendererAppearance,
@@ -105,7 +117,7 @@ var MediaSingle = function MediaSingle(props) {
105
117
 
106
118
  var padding = rendererAppearance === 'full-page' ? FullPagePadding * 2 : 0;
107
119
  var isFullWidth = rendererAppearance === 'full-width';
108
- var calcDimensions = function calcDimensions(mediaContainerWidth, mediaBreakpoint) {
120
+ var calcDimensions = function calcDimensions(mediaContainerWidth) {
109
121
  var containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
110
122
  var maxWidth = containerWidth;
111
123
  var maxHeight = height / width * maxWidth;
@@ -134,8 +146,8 @@ var MediaSingle = function MediaSingle(props) {
134
146
  height: height,
135
147
  width: width
136
148
  };
137
- var renderMediaSingle = function renderMediaSingle(renderWidth, mediaBreakpoint) {
138
- var _calcDimensions = calcDimensions(renderWidth, mediaBreakpoint),
149
+ var renderMediaSingle = function renderMediaSingle(renderWidth) {
150
+ var _calcDimensions = calcDimensions(renderWidth),
139
151
  cardDimensions = _calcDimensions.cardDimensions,
140
152
  lineLength = _calcDimensions.lineLength,
141
153
  containerWidth = _calcDimensions.containerWidth;
@@ -164,9 +176,11 @@ var MediaSingle = function MediaSingle(props) {
164
176
  }, jsx(Fragment, null, mediaComponent), showCaptions && caption);
165
177
  };
166
178
  return jsx(WidthConsumer, null, function (_ref3) {
167
- var width = _ref3.width,
168
- breakpoint = _ref3.breakpoint;
169
- return renderMediaSingle(width, breakpoint);
179
+ var width = _ref3.width;
180
+ // Note: in SSR mode the `window` object is not defined,
181
+ // therefore width here is 0, see:
182
+ // packages/editor/editor-common/src/ui/WidthProvider/index.tsx
183
+ return renderMediaSingle(width);
170
184
  });
171
185
  };
172
186
  export default injectIntl(MediaSingle);
@@ -45,7 +45,7 @@ import { RenderTracking } from '../../react/utils/performance/RenderTracking';
45
45
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
46
46
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
47
47
  var packageName = "@atlaskit/renderer";
48
- var packageVersion = "108.15.3";
48
+ var packageVersion = "108.15.5";
49
49
  export var Renderer = /*#__PURE__*/function (_PureComponent) {
50
50
  _inherits(Renderer, _PureComponent);
51
51
  var _super = _createSuper(Renderer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "108.15.3",
3
+ "version": "108.15.5",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/analytics-next": "^9.1.0",
32
32
  "@atlaskit/button": "^16.10.0",
33
33
  "@atlaskit/code": "^14.6.0",
34
- "@atlaskit/editor-common": "^75.8.0",
34
+ "@atlaskit/editor-common": "^76.1.0",
35
35
  "@atlaskit/editor-json-transformer": "^8.10.0",
36
36
  "@atlaskit/editor-palette": "1.5.1",
37
37
  "@atlaskit/editor-prosemirror": "1.1.0",