@atlaskit/renderer 111.1.0 → 111.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 111.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#147736](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/147736)
8
+ [`b6868597a50cd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b6868597a50cd) -
9
+ [ux] Fix table resizing when rendering with AK renderer in SSR
10
+ - Updated dependencies
11
+
12
+ ## 111.1.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [#147863](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/147863)
17
+ [`422082d3df962`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/422082d3df962) -
18
+ Remove TTI tracking analytics
19
+
3
20
  ## 111.1.0
4
21
 
5
22
  ### Minor Changes
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.isTableResizingEnabled = exports.isStickyScrollbarEnabled = exports.default = exports.TableProcessor = exports.TableContainer = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
12
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
@@ -16,6 +17,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
16
17
  var _react = _interopRequireDefault(require("react"));
17
18
  var _styles = require("@atlaskit/editor-common/styles");
18
19
  var _ui = require("@atlaskit/editor-common/ui");
20
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
21
  var _utils = require("@atlaskit/editor-common/utils");
20
22
  var _types = require("@atlaskit/editor-common/types");
21
23
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
@@ -327,32 +329,43 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
327
329
  // Please consider changes below carefully to not negatively impact SSR
328
330
  // `renderWidth` cannot be depended on during SSR
329
331
  var isRenderWidthValid = !!renderWidth && renderWidth > 0;
332
+ var renderWidthCSS = rendererAppearance === 'full-page' ? "100cqw - ".concat(_style.FullPagePadding, "px * 2") : "100cqw";
330
333
  var calcDefaultLayoutWidthByAppearance = function calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode) {
331
334
  if (rendererAppearance === 'full-width' && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width)) {
332
- return isRenderWidthValid ? Math.min(_editorSharedStyles.akEditorFullWidthLayoutWidth, renderWidth) : _editorSharedStyles.akEditorFullWidthLayoutWidth;
335
+ return [isRenderWidthValid ? Math.min(_editorSharedStyles.akEditorFullWidthLayoutWidth, renderWidth) : _editorSharedStyles.akEditorFullWidthLayoutWidth, "min(".concat(_editorSharedStyles.akEditorFullWidthLayoutWidth, "px, ").concat(renderWidthCSS, ")")];
333
336
  } else if (rendererAppearance === 'comment' && allowTableResizing && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width)) {
334
337
  var tableContainerWidth = (0, _nodeWidth.getTableContainerWidth)(tableNode);
335
- return isRenderWidthValid ? renderWidth : tableContainerWidth;
338
+ return [isRenderWidthValid ? renderWidth : tableContainerWidth, renderWidthCSS];
336
339
  } else {
337
340
  // custom width, or width mapped to breakpoint
338
341
  var _tableContainerWidth = (0, _nodeWidth.getTableContainerWidth)(tableNode);
339
- return isRenderWidthValid ? Math.min(_tableContainerWidth, renderWidth) : _tableContainerWidth;
342
+ return [isRenderWidthValid ? Math.min(_tableContainerWidth, renderWidth) : _tableContainerWidth, "min(".concat(_tableContainerWidth, "px, ").concat(renderWidthCSS, ")")];
340
343
  }
341
344
  };
342
- var tableWidth = calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode);
345
+ var _calcDefaultLayoutWid = calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode),
346
+ _calcDefaultLayoutWid2 = (0, _slicedToArray2.default)(_calcDefaultLayoutWid, 2),
347
+ tableWidth = _calcDefaultLayoutWid2[0],
348
+ tableWidthCSS = _calcDefaultLayoutWid2[1];
343
349
 
344
350
  // Logic for table alignment in renderer
345
351
  var isTableAlignStart = tableNode && tableNode.attrs && tableNode.attrs.layout === 'align-start' && allowTableAlignment;
346
352
  var fullWidthLineLength = isRenderWidthValid ? Math.min(_editorSharedStyles.akEditorFullWidthLayoutWidth, renderWidth) : _editorSharedStyles.akEditorFullWidthLayoutWidth;
353
+ var fullWidthLineLengthCSS = "min(".concat(_editorSharedStyles.akEditorFullWidthLayoutWidth, "px, ").concat(renderWidthCSS, ")");
347
354
  var commentLineLength = isRenderWidthValid ? renderWidth : lineLengthFixedWidth;
348
355
  var isCommentAppearanceAndTableAlignmentEnabled = (0, _appearance.isCommentAppearance)(rendererAppearance) && allowTableAlignment;
349
356
  var lineLength = (0, _appearance.isFullWidthAppearance)(rendererAppearance) ? fullWidthLineLength : isCommentAppearanceAndTableAlignmentEnabled ? commentLineLength : lineLengthFixedWidth;
350
- var shouldCalculateLeftForAlignment = !isInsideOfBlockNode && isTableAlignStart && ((0, _appearance.isFullPageAppearance)(rendererAppearance) && tableWidth <= lineLengthFixedWidth || (0, _appearance.isFullWidthAppearance)(rendererAppearance) || isCommentAppearanceAndTableAlignmentEnabled);
357
+ var lineLengthCSS = (0, _appearance.isFullWidthAppearance)(rendererAppearance) ? fullWidthLineLengthCSS : isCommentAppearanceAndTableAlignmentEnabled ? renderWidthCSS : "".concat(lineLengthFixedWidth, "px");
358
+ var fixTableSSRResizing = (0, _platformFeatureFlags.fg)('platform-fix-table-ssr-resizing');
359
+ var tableWidthNew = fixTableSSRResizing ? (0, _nodeWidth.getTableContainerWidth)(tableNode) : tableWidth;
360
+ var shouldCalculateLeftForAlignment = !isInsideOfBlockNode && isTableAlignStart && ((0, _appearance.isFullPageAppearance)(rendererAppearance) && tableWidthNew <= lineLengthFixedWidth || (0, _appearance.isFullWidthAppearance)(rendererAppearance) || isCommentAppearanceAndTableAlignmentEnabled);
361
+ var leftCSS;
351
362
  if (shouldCalculateLeftForAlignment) {
352
363
  left = (tableWidth - lineLength) / 2;
364
+ leftCSS = "(".concat(tableWidthCSS, " - ").concat(lineLengthCSS, ") / 2");
353
365
  }
354
- if (!shouldCalculateLeftForAlignment && canUseLinelength(rendererAppearance) && tableWidth > lineLengthFixedWidth) {
366
+ if (!shouldCalculateLeftForAlignment && canUseLinelength(rendererAppearance) && tableWidthNew > lineLengthFixedWidth) {
355
367
  left = lineLengthFixedWidth / 2 - tableWidth / 2;
368
+ leftCSS = "".concat(lineLengthCSS, " / 2 - ").concat(tableWidthCSS, " / 2");
356
369
  }
357
370
  var children = _react.default.Children.toArray(this.props.children);
358
371
 
@@ -367,7 +380,14 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
367
380
  } else {
368
381
  updatedLayout = layout;
369
382
  }
370
- var finalTableContainerWidth = allowTableResizing ? tableWidth : 'inherit';
383
+ var finalTableContainerWidth = allowTableResizing ? tableWidthNew : 'inherit';
384
+
385
+ // We can only use CSS to determine the width when we have a known width in container.
386
+ // When appearance is full-page, full-width or comment we use CSS based width calculation.
387
+ // Otherwise it's fixed table width (customized width) or inherit.
388
+ if ((rendererAppearance === 'full-page' || rendererAppearance === 'full-width') && fixTableSSRResizing) {
389
+ finalTableContainerWidth = allowTableResizing ? "calc(".concat(tableWidthCSS, ")") : 'inherit';
390
+ }
371
391
  if (rendererAppearance === 'comment' && allowTableResizing && !allowTableAlignment) {
372
392
  // If table alignment is disabled and table width is akEditorDefaultLayoutWidth = 760,
373
393
  // it is most likely a table created before "Support Table in Comments" FF was enabled
@@ -376,24 +396,36 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
376
396
 
377
397
  // !NOTE: it a table resized to 760 is copied from 'full-page' editor and pasted in comment editor
378
398
  // where (allowTableResizing && !allowTableAlignment), the table will loose 760px width.
379
- finalTableContainerWidth = tableNode !== null && tableNode !== void 0 && tableNode.attrs.width && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width) !== _editorSharedStyles.akEditorDefaultLayoutWidth ? tableWidth : 'inherit';
399
+ finalTableContainerWidth = tableNode !== null && tableNode !== void 0 && tableNode.attrs.width && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width) !== _editorSharedStyles.akEditorDefaultLayoutWidth ? fixTableSSRResizing ? "calc(".concat(tableWidthCSS, ")") : tableWidth : 'inherit';
380
400
  }
381
401
  if (rendererAppearance === 'comment' && allowTableResizing && allowTableAlignment) {
382
402
  // If table alignment is enabled and layout is not 'align-start' or 'center', we are loading a table that was
383
403
  // created before "Support Table in Comments" FF was enabled. So the table should have the same width as renderer container
384
404
  // instead of 760 that was set on tableNode when the table had been published.
385
- finalTableContainerWidth = ((tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'align-start' || (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'center') && tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ? tableWidth : 'inherit';
405
+ finalTableContainerWidth = ((tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'align-start' || (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'center') && tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ? fixTableSSRResizing ? "calc(".concat(tableWidthCSS, ")") : tableWidth : 'inherit';
406
+ }
407
+ var style;
408
+ if (fixTableSSRResizing) {
409
+ style = {
410
+ width: finalTableContainerWidth,
411
+ left: leftCSS ? "calc(".concat(leftCSS, ")") : undefined,
412
+ marginLeft: shouldCalculateLeftForAlignment && leftCSS !== undefined ? "calc(-1 * (".concat(leftCSS, "))") : undefined
413
+ };
414
+ } else {
415
+ style = {
416
+ width: finalTableContainerWidth,
417
+ left: left,
418
+ marginLeft: shouldCalculateLeftForAlignment && left !== undefined ? -left : undefined
419
+ };
386
420
  }
387
421
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
388
422
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
389
423
  className: "".concat(_styles.TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
390
424
  "data-layout": updatedLayout,
391
- ref: this.props.handleRef,
392
- style: {
393
- width: finalTableContainerWidth,
394
- left: left,
395
- marginLeft: shouldCalculateLeftForAlignment && left !== undefined ? -left : undefined
396
- }
425
+ ref: this.props.handleRef
426
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
427
+ ,
428
+ style: style
397
429
  }, isStickyScrollbarEnabled(this.props.rendererAppearance) && /*#__PURE__*/_react.default.createElement("div", {
398
430
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
399
431
  className: _styles.TableSharedCssClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_TOP,
@@ -438,8 +470,10 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
438
470
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
439
471
  height: "var(--ds-space-250, 20px)",
440
472
  // MAX_BROWSER_SCROLLBAR_HEIGHT
473
+ // Follow editor to hide by default so it does not show empty gap in SSR
474
+ // https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/browse/platform/packages/editor/editor-plugin-table/src/nodeviews/TableComponent.tsx#957
441
475
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
442
- display: 'block',
476
+ display: fixTableSSRResizing ? 'none' : 'block',
443
477
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
444
478
  width: '100%'
445
479
  }
@@ -38,8 +38,7 @@ function BreakoutSSRInlineScript() {
38
38
  });
39
39
  }
40
40
  function createBreakoutInlineScript(id) {
41
- var shouldFixTableResizing = String(Boolean((0, _platformFeatureFlags.fg)('platform-fix-table-ssr-resizing')));
42
- return "\n (function(window){\n ".concat(breakoutInlineScriptContext, ";\n (").concat(applyBreakoutAfterSSR.toString(), ")(\"").concat(id, "\", breakoutConsts, ").concat(shouldFixTableResizing, ");\n })(window);\n");
41
+ return "\n (function(window){\n ".concat(breakoutInlineScriptContext, ";\n (").concat(applyBreakoutAfterSSR.toString(), ")(\"").concat(id, "\", breakoutConsts, ").concat(Boolean((0, _platformFeatureFlags.fg)('platform-fix-table-ssr-resizing')), ");\n })(window);\n");
43
42
  }
44
43
  var breakoutInlineScriptContext = exports.breakoutInlineScriptContext = "\n var breakoutConsts = ".concat(JSON.stringify(_utils.breakoutConsts), ";\n breakoutConsts.mapBreakpointToLayoutMaxWidth = ").concat(_utils.breakoutConsts.mapBreakpointToLayoutMaxWidth.toString(), ";\n breakoutConsts.getBreakpoint = ").concat(_utils.breakoutConsts.getBreakpoint.toString(), ";\n breakoutConsts.calcBreakoutWidth = ").concat(_utils.breakoutConsts.calcBreakoutWidth.toString(), ";\n breakoutConsts.calcLineLength = ").concat(_utils.breakoutConsts.calcLineLength.toString(), ";\n breakoutConsts.calcWideWidth = ").concat(_utils.breakoutConsts.calcWideWidth.toString(), ";\n breakoutConsts.FullPagePadding = ").concat(_style.FullPagePadding.toString(), ";\n");
45
44
  function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
@@ -80,35 +79,32 @@ function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
80
79
  if (!mode || !WIDE_LAYOUT_MODES.includes(mode)) {
81
80
  return;
82
81
  }
83
- if (node.classList.contains('pm-table-container') && mode === 'custom') {
84
- var isFullPage = renderer.classList.contains('is-full-page');
85
- var rendererWidth = renderer.offsetWidth;
86
- var effectiveWidth;
87
- if (shouldFixTableResizing) {
88
- // Logic from https://stash.atlassian.com/projects/atlassian/repos/atlassian-frontend-monorepo/browse/platform/packages/editor/renderer/src/react/nodes/table.tsx?at=d3af2ef54521ccf10e9b094996ad9528ec05c7e3#610
89
- effectiveWidth = isFullPage ? rendererWidth - 2 * breakoutConsts.FullPagePadding : rendererWidth;
82
+
83
+ // When flag is on we are using CSS to calculate the table width thus don't need logic below to set the width and left.
84
+ if (!shouldFixTableResizing) {
85
+ if (node.classList.contains('pm-table-container') && mode === 'custom') {
86
+ var rendererWidth = renderer.offsetWidth;
87
+ var effectiveWidth = rendererWidth - breakoutConsts.padding;
88
+ width = "".concat(Math.min(parseInt(node.style.width), effectiveWidth), "px");
90
89
  } else {
91
- effectiveWidth = rendererWidth - breakoutConsts.padding;
90
+ width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
92
91
  }
93
- width = "".concat(Math.min(parseInt(node.style.width), effectiveWidth), "px");
94
- } else {
95
- width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
96
- }
97
- if (node.style.width === width) {
98
- return;
99
- }
100
- node.style.width = width;
92
+ if (node.style.width === width) {
93
+ return;
94
+ }
95
+ node.style.width = width;
101
96
 
102
- // Tables require some special logic, as they are not using common css transform approach,
103
- // because it breaks with sticky headers. This logic is copied from a table node:
104
- // https://bitbucket.org/atlassian/atlassian-frontend/src/77938aee0c140d02ff99b98a03849be1236865b4/packages/editor/renderer/src/react/nodes/table.tsx#table.tsx-235:245
105
- if (node.classList.contains('pm-table-container') && !renderer.classList.contains('is-full-width')) {
106
- var lineLength = breakoutConsts.calcLineLength();
107
- var left = lineLength / 2 - parseInt(width) / 2;
108
- if (left < 0 && parseInt(width) > lineLength) {
109
- node.style.left = left + 'px';
110
- } else {
111
- node.style.left = '';
97
+ // Tables require some special logic, as they are not using common css transform approach,
98
+ // because it breaks with sticky headers. This logic is copied from a table node:
99
+ // https://bitbucket.org/atlassian/atlassian-frontend/src/77938aee0c140d02ff99b98a03849be1236865b4/packages/editor/renderer/src/react/nodes/table.tsx#table.tsx-235:245
100
+ if (node.classList.contains('pm-table-container') && !renderer.classList.contains('is-full-width')) {
101
+ var lineLength = breakoutConsts.calcLineLength();
102
+ var left = lineLength / 2 - parseInt(width) / 2;
103
+ if (left < 0 && parseInt(width) > lineLength) {
104
+ node.style.left = left + 'px';
105
+ } else {
106
+ node.style.left = '';
107
+ }
112
108
  }
113
109
  }
114
110
  });
@@ -124,16 +120,6 @@ function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
124
120
  applyMediaBreakout(item.target);
125
121
  }
126
122
  });
127
-
128
- // Renderer is initially set to hidden until we figure out the proper width in packages/editor/editor-common/src/ui/WidthProvider/index.tsx
129
- if (renderer.style.visibility === 'hidden') {
130
- // Hiding until we get the correct width. But didn't remove them from the DOM so vertical scrollbar can still be correctly calculated.
131
- renderer.style.visibility = '';
132
- // Since we don't have a screen width to use as initial value.
133
- // The width is set to a fix number. This will cause horizontal scrollbar to appear.
134
- // Hide it until we have the correct width.
135
- renderer.style.overflowX = '';
136
- }
137
123
  });
138
124
  var applyMediaBreakout = function applyMediaBreakout(card) {
139
125
  // width was already set by another breakout script
@@ -164,9 +150,6 @@ function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
164
150
  childList: true,
165
151
  subtree: true
166
152
  });
167
- if (shouldFixTableResizing) {
168
- window.__SSR_BREAKOUT_OBSERVED = true;
169
- }
170
153
 
171
154
  /**
172
155
  * Using window load event to unsubscribe from mutation observer, as at this stage document is fully rendered.
@@ -25,7 +25,6 @@ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
25
25
  var _ui = require("@atlaskit/editor-common/ui");
26
26
  var _performanceMeasures = require("@atlaskit/editor-common/performance-measures");
27
27
  var _utils = require("@atlaskit/editor-common/utils");
28
- var _measureTti = require("@atlaskit/editor-common/performance/measure-tti");
29
28
  var _measureRender = require("@atlaskit/editor-common/performance/measure-render");
30
29
  var _browser = require("@atlaskit/editor-common/browser");
31
30
  var _navigation = require("@atlaskit/editor-common/performance/navigation");
@@ -66,7 +65,12 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
66
65
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
67
66
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
68
67
  var packageName = "@atlaskit/renderer";
69
- var packageVersion = "111.1.0";
68
+ var packageVersion = "111.1.2";
69
+ var setAsQueryContainerStyles = (0, _react2.css)({
70
+ containerName: 'ak-renderer-wrapper',
71
+ containerType: 'inline-size',
72
+ contain: 'layout style inline-size'
73
+ });
70
74
  var defaultNodeComponents = exports.defaultNodeComponents = _nodes.nodeToReact;
71
75
 
72
76
  /**
@@ -159,21 +163,6 @@ var __RendererClassComponent = exports.__RendererClassComponent = /*#__PURE__*/f
159
163
  _this.editorRef = props.innerRef || /*#__PURE__*/_react.default.createRef();
160
164
  _this.id = (0, _v.default)();
161
165
  (0, _performanceMeasures.startMeasure)("Renderer Render Time: ".concat(_this.id));
162
- var _featureFlags = _this.featureFlags(_this.props.featureFlags).featureFlags;
163
- if (_featureFlags !== null && _featureFlags !== void 0 && _featureFlags.rendererTtiTracking) {
164
- (0, _measureTti.measureTTI)(function (tti, ttiFromInvocation, canceled) {
165
- _this.fireAnalyticsEvent({
166
- action: _analytics.ACTION.RENDERER_TTI,
167
- actionSubject: _analytics.ACTION_SUBJECT.RENDERER,
168
- attributes: {
169
- tti: tti,
170
- ttiFromInvocation: ttiFromInvocation,
171
- canceled: canceled
172
- },
173
- eventType: _analytics.EVENT_TYPE.OPERATIONAL
174
- });
175
- });
176
- }
177
166
  return _this;
178
167
  }
179
168
  (0, _createClass2.default)(__RendererClassComponent, [{
@@ -515,26 +504,26 @@ var RendererWrapper = /*#__PURE__*/_react.default.memo(function (props) {
515
504
  // We must check if window is defined, if it isn't we are in a SSR environment
516
505
  // and we don't want to add the telepointer
517
506
  if (typeof window !== 'undefined' && addTelepointer && innerRef !== null && innerRef !== void 0 && innerRef.current) {
518
- var renderer = innerRef.current.querySelector('.ak-renderer-document');
507
+ var _renderer = innerRef.current.querySelector('.ak-renderer-document');
519
508
  if (initialUpdate.current) {
520
- var lastChild = renderer.lastChild;
509
+ var lastChild = _renderer.lastChild;
521
510
  lastChild && lastChild.appendChild(createTelepointer());
522
511
  }
523
512
  var mutateTelepointer = function mutateTelepointer(mutations) {
524
513
  mutations.forEach(function (mutation) {
525
514
  if (initialUpdate.current) {
526
- var oldTelepointer = renderer.querySelector("#".concat(_style.TELEPOINTER_ID));
515
+ var oldTelepointer = _renderer.querySelector("#".concat(_style.TELEPOINTER_ID));
527
516
  if (oldTelepointer) {
528
517
  oldTelepointer.remove();
529
518
  }
530
- var _lastChild = renderer.lastChild;
519
+ var _lastChild = _renderer.lastChild;
531
520
  _lastChild && _lastChild.appendChild(createTelepointer());
532
521
  initialUpdate.current = false;
533
522
  }
534
523
  if (mutation.type === 'characterData') {
535
524
  var parentNode = mutation.target.parentElement;
536
525
  if (parentNode) {
537
- var _oldTelepointer = renderer.querySelector("#".concat(_style.TELEPOINTER_ID));
526
+ var _oldTelepointer = _renderer.querySelector("#".concat(_style.TELEPOINTER_ID));
538
527
  if (_oldTelepointer) {
539
528
  _oldTelepointer.remove();
540
529
  }
@@ -555,7 +544,7 @@ var RendererWrapper = /*#__PURE__*/_react.default.memo(function (props) {
555
544
  };
556
545
  }
557
546
  }, [innerRef, addTelepointer]);
558
- return (0, _react2.jsx)(_ui.WidthProvider
547
+ var renderer = (0, _react2.jsx)(_ui.WidthProvider
559
548
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
560
549
  , {
561
550
  className: "ak-renderer-wrapper is-".concat(appearance),
@@ -580,6 +569,17 @@ var RendererWrapper = /*#__PURE__*/_react.default.memo(function (props) {
580
569
  allowTableResizing: allowTableResizing
581
570
  })
582
571
  }, children))));
572
+
573
+ // We can only make the wrapper div query container when we have a known width.
574
+ // This is also required for SSR to work correctly. As WidthProvider/WithConsumer will not have the correct width during SSR.
575
+ //
576
+ // We are setting this wrapper div as query container conditionally.
577
+ // Only apply container-type = inline-size when having a known width in full-page/full-width/comment mode.
578
+ // Otherwise when appearance is unspecified the renderer size is decided by the content.
579
+ // In this case we can't set the container-type = inline-size as it will collapse width to 0.
580
+ return (appearance === 'full-page' || appearance === 'full-width' || appearance === 'comment') && (0, _platformFeatureFlags.fg)('platform-fix-table-ssr-resizing') ? (0, _react2.jsx)("div", {
581
+ css: setAsQueryContainerStyles
582
+ }, renderer) : renderer;
583
583
  });
584
584
  var RootRendererContext = /*#__PURE__*/_react.default.createContext(null);
585
585
  function RendererActionsInternalUpdater(_ref) {
@@ -3,6 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React from 'react';
4
4
  import { TableSharedCssClassName, tableMarginTop } from '@atlaskit/editor-common/styles';
5
5
  import { WidthConsumer, overflowShadow } from '@atlaskit/editor-common/ui';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose } from '@atlaskit/editor-common/utils';
7
8
  import { SortOrder } from '@atlaskit/editor-common/types';
8
9
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
@@ -272,32 +273,40 @@ export class TableContainer extends React.Component {
272
273
  // Please consider changes below carefully to not negatively impact SSR
273
274
  // `renderWidth` cannot be depended on during SSR
274
275
  const isRenderWidthValid = !!renderWidth && renderWidth > 0;
276
+ const renderWidthCSS = rendererAppearance === 'full-page' ? `100cqw - ${FullPagePadding}px * 2` : `100cqw`;
275
277
  const calcDefaultLayoutWidthByAppearance = (rendererAppearance, tableNode) => {
276
278
  if (rendererAppearance === 'full-width' && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width)) {
277
- return isRenderWidthValid ? Math.min(akEditorFullWidthLayoutWidth, renderWidth) : akEditorFullWidthLayoutWidth;
279
+ return [isRenderWidthValid ? Math.min(akEditorFullWidthLayoutWidth, renderWidth) : akEditorFullWidthLayoutWidth, `min(${akEditorFullWidthLayoutWidth}px, ${renderWidthCSS})`];
278
280
  } else if (rendererAppearance === 'comment' && allowTableResizing && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width)) {
279
281
  const tableContainerWidth = getTableContainerWidth(tableNode);
280
- return isRenderWidthValid ? renderWidth : tableContainerWidth;
282
+ return [isRenderWidthValid ? renderWidth : tableContainerWidth, renderWidthCSS];
281
283
  } else {
282
284
  // custom width, or width mapped to breakpoint
283
285
  const tableContainerWidth = getTableContainerWidth(tableNode);
284
- return isRenderWidthValid ? Math.min(tableContainerWidth, renderWidth) : tableContainerWidth;
286
+ return [isRenderWidthValid ? Math.min(tableContainerWidth, renderWidth) : tableContainerWidth, `min(${tableContainerWidth}px, ${renderWidthCSS})`];
285
287
  }
286
288
  };
287
- const tableWidth = calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode);
289
+ const [tableWidth, tableWidthCSS] = calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode);
288
290
 
289
291
  // Logic for table alignment in renderer
290
292
  const isTableAlignStart = tableNode && tableNode.attrs && tableNode.attrs.layout === 'align-start' && allowTableAlignment;
291
293
  const fullWidthLineLength = isRenderWidthValid ? Math.min(akEditorFullWidthLayoutWidth, renderWidth) : akEditorFullWidthLayoutWidth;
294
+ const fullWidthLineLengthCSS = `min(${akEditorFullWidthLayoutWidth}px, ${renderWidthCSS})`;
292
295
  const commentLineLength = isRenderWidthValid ? renderWidth : lineLengthFixedWidth;
293
296
  const isCommentAppearanceAndTableAlignmentEnabled = isCommentAppearance(rendererAppearance) && allowTableAlignment;
294
- let lineLength = isFullWidthAppearance(rendererAppearance) ? fullWidthLineLength : isCommentAppearanceAndTableAlignmentEnabled ? commentLineLength : lineLengthFixedWidth;
295
- const shouldCalculateLeftForAlignment = !isInsideOfBlockNode && isTableAlignStart && (isFullPageAppearance(rendererAppearance) && tableWidth <= lineLengthFixedWidth || isFullWidthAppearance(rendererAppearance) || isCommentAppearanceAndTableAlignmentEnabled);
297
+ const lineLength = isFullWidthAppearance(rendererAppearance) ? fullWidthLineLength : isCommentAppearanceAndTableAlignmentEnabled ? commentLineLength : lineLengthFixedWidth;
298
+ const lineLengthCSS = isFullWidthAppearance(rendererAppearance) ? fullWidthLineLengthCSS : isCommentAppearanceAndTableAlignmentEnabled ? renderWidthCSS : `${lineLengthFixedWidth}px`;
299
+ const fixTableSSRResizing = fg('platform-fix-table-ssr-resizing');
300
+ const tableWidthNew = fixTableSSRResizing ? getTableContainerWidth(tableNode) : tableWidth;
301
+ const shouldCalculateLeftForAlignment = !isInsideOfBlockNode && isTableAlignStart && (isFullPageAppearance(rendererAppearance) && tableWidthNew <= lineLengthFixedWidth || isFullWidthAppearance(rendererAppearance) || isCommentAppearanceAndTableAlignmentEnabled);
302
+ let leftCSS;
296
303
  if (shouldCalculateLeftForAlignment) {
297
304
  left = (tableWidth - lineLength) / 2;
305
+ leftCSS = `(${tableWidthCSS} - ${lineLengthCSS}) / 2`;
298
306
  }
299
- if (!shouldCalculateLeftForAlignment && canUseLinelength(rendererAppearance) && tableWidth > lineLengthFixedWidth) {
307
+ if (!shouldCalculateLeftForAlignment && canUseLinelength(rendererAppearance) && tableWidthNew > lineLengthFixedWidth) {
300
308
  left = lineLengthFixedWidth / 2 - tableWidth / 2;
309
+ leftCSS = `${lineLengthCSS} / 2 - ${tableWidthCSS} / 2`;
301
310
  }
302
311
  const children = React.Children.toArray(this.props.children);
303
312
 
@@ -312,7 +321,14 @@ export class TableContainer extends React.Component {
312
321
  } else {
313
322
  updatedLayout = layout;
314
323
  }
315
- let finalTableContainerWidth = allowTableResizing ? tableWidth : 'inherit';
324
+ let finalTableContainerWidth = allowTableResizing ? tableWidthNew : 'inherit';
325
+
326
+ // We can only use CSS to determine the width when we have a known width in container.
327
+ // When appearance is full-page, full-width or comment we use CSS based width calculation.
328
+ // Otherwise it's fixed table width (customized width) or inherit.
329
+ if ((rendererAppearance === 'full-page' || rendererAppearance === 'full-width') && fixTableSSRResizing) {
330
+ finalTableContainerWidth = allowTableResizing ? `calc(${tableWidthCSS})` : 'inherit';
331
+ }
316
332
  if (rendererAppearance === 'comment' && allowTableResizing && !allowTableAlignment) {
317
333
  // If table alignment is disabled and table width is akEditorDefaultLayoutWidth = 760,
318
334
  // it is most likely a table created before "Support Table in Comments" FF was enabled
@@ -321,24 +337,36 @@ export class TableContainer extends React.Component {
321
337
 
322
338
  // !NOTE: it a table resized to 760 is copied from 'full-page' editor and pasted in comment editor
323
339
  // where (allowTableResizing && !allowTableAlignment), the table will loose 760px width.
324
- finalTableContainerWidth = tableNode !== null && tableNode !== void 0 && tableNode.attrs.width && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width) !== akEditorDefaultLayoutWidth ? tableWidth : 'inherit';
340
+ finalTableContainerWidth = tableNode !== null && tableNode !== void 0 && tableNode.attrs.width && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width) !== akEditorDefaultLayoutWidth ? fixTableSSRResizing ? `calc(${tableWidthCSS})` : tableWidth : 'inherit';
325
341
  }
326
342
  if (rendererAppearance === 'comment' && allowTableResizing && allowTableAlignment) {
327
343
  // If table alignment is enabled and layout is not 'align-start' or 'center', we are loading a table that was
328
344
  // created before "Support Table in Comments" FF was enabled. So the table should have the same width as renderer container
329
345
  // instead of 760 that was set on tableNode when the table had been published.
330
- finalTableContainerWidth = ((tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'align-start' || (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'center') && tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ? tableWidth : 'inherit';
346
+ finalTableContainerWidth = ((tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'align-start' || (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'center') && tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ? fixTableSSRResizing ? `calc(${tableWidthCSS})` : tableWidth : 'inherit';
347
+ }
348
+ let style;
349
+ if (fixTableSSRResizing) {
350
+ style = {
351
+ width: finalTableContainerWidth,
352
+ left: leftCSS ? `calc(${leftCSS})` : undefined,
353
+ marginLeft: shouldCalculateLeftForAlignment && leftCSS !== undefined ? `calc(-1 * (${leftCSS}))` : undefined
354
+ };
355
+ } else {
356
+ style = {
357
+ width: finalTableContainerWidth,
358
+ left: left,
359
+ marginLeft: shouldCalculateLeftForAlignment && left !== undefined ? -left : undefined
360
+ };
331
361
  }
332
362
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
333
363
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
334
364
  className: `${TableSharedCssClassName.TABLE_CONTAINER} ${this.props.shadowClassNames || ''}`,
335
365
  "data-layout": updatedLayout,
336
- ref: this.props.handleRef,
337
- style: {
338
- width: finalTableContainerWidth,
339
- left: left,
340
- marginLeft: shouldCalculateLeftForAlignment && left !== undefined ? -left : undefined
341
- }
366
+ ref: this.props.handleRef
367
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
368
+ ,
369
+ style: style
342
370
  }, isStickyScrollbarEnabled(this.props.rendererAppearance) && /*#__PURE__*/React.createElement("div", {
343
371
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
344
372
  className: TableSharedCssClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_TOP,
@@ -383,8 +411,10 @@ export class TableContainer extends React.Component {
383
411
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
384
412
  height: "var(--ds-space-250, 20px)",
385
413
  // MAX_BROWSER_SCROLLBAR_HEIGHT
414
+ // Follow editor to hide by default so it does not show empty gap in SSR
415
+ // https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/browse/platform/packages/editor/editor-plugin-table/src/nodeviews/TableComponent.tsx#957
386
416
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
387
- display: 'block',
417
+ display: fixTableSSRResizing ? 'none' : 'block',
388
418
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
389
419
  width: '100%'
390
420
  }
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { breakoutConsts } from '@atlaskit/editor-common/utils';
3
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
4
  import { FullPagePadding } from './style';
5
+
5
6
  /**
6
7
  * Inline Script that updates breakout node width on client side,
7
8
  * before main JavaScript bundle is ready.
@@ -29,11 +30,10 @@ export function BreakoutSSRInlineScript() {
29
30
  });
30
31
  }
31
32
  export function createBreakoutInlineScript(id) {
32
- const shouldFixTableResizing = String(Boolean(fg('platform-fix-table-ssr-resizing')));
33
33
  return `
34
34
  (function(window){
35
35
  ${breakoutInlineScriptContext};
36
- (${applyBreakoutAfterSSR.toString()})("${id}", breakoutConsts, ${shouldFixTableResizing});
36
+ (${applyBreakoutAfterSSR.toString()})("${id}", breakoutConsts, ${Boolean(fg('platform-fix-table-ssr-resizing'))});
37
37
  })(window);
38
38
  `;
39
39
  }
@@ -84,35 +84,32 @@ function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
84
84
  if (!mode || !WIDE_LAYOUT_MODES.includes(mode)) {
85
85
  return;
86
86
  }
87
- if (node.classList.contains('pm-table-container') && mode === 'custom') {
88
- const isFullPage = renderer.classList.contains('is-full-page');
89
- const rendererWidth = renderer.offsetWidth;
90
- let effectiveWidth;
91
- if (shouldFixTableResizing) {
92
- // Logic from https://stash.atlassian.com/projects/atlassian/repos/atlassian-frontend-monorepo/browse/platform/packages/editor/renderer/src/react/nodes/table.tsx?at=d3af2ef54521ccf10e9b094996ad9528ec05c7e3#610
93
- effectiveWidth = isFullPage ? rendererWidth - 2 * breakoutConsts.FullPagePadding : rendererWidth;
87
+
88
+ // When flag is on we are using CSS to calculate the table width thus don't need logic below to set the width and left.
89
+ if (!shouldFixTableResizing) {
90
+ if (node.classList.contains('pm-table-container') && mode === 'custom') {
91
+ const rendererWidth = renderer.offsetWidth;
92
+ const effectiveWidth = rendererWidth - breakoutConsts.padding;
93
+ width = `${Math.min(parseInt(node.style.width), effectiveWidth)}px`;
94
94
  } else {
95
- effectiveWidth = rendererWidth - breakoutConsts.padding;
95
+ width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
96
96
  }
97
- width = `${Math.min(parseInt(node.style.width), effectiveWidth)}px`;
98
- } else {
99
- width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
100
- }
101
- if (node.style.width === width) {
102
- return;
103
- }
104
- node.style.width = width;
97
+ if (node.style.width === width) {
98
+ return;
99
+ }
100
+ node.style.width = width;
105
101
 
106
- // Tables require some special logic, as they are not using common css transform approach,
107
- // because it breaks with sticky headers. This logic is copied from a table node:
108
- // https://bitbucket.org/atlassian/atlassian-frontend/src/77938aee0c140d02ff99b98a03849be1236865b4/packages/editor/renderer/src/react/nodes/table.tsx#table.tsx-235:245
109
- if (node.classList.contains('pm-table-container') && !renderer.classList.contains('is-full-width')) {
110
- const lineLength = breakoutConsts.calcLineLength();
111
- const left = lineLength / 2 - parseInt(width) / 2;
112
- if (left < 0 && parseInt(width) > lineLength) {
113
- node.style.left = left + 'px';
114
- } else {
115
- node.style.left = '';
102
+ // Tables require some special logic, as they are not using common css transform approach,
103
+ // because it breaks with sticky headers. This logic is copied from a table node:
104
+ // https://bitbucket.org/atlassian/atlassian-frontend/src/77938aee0c140d02ff99b98a03849be1236865b4/packages/editor/renderer/src/react/nodes/table.tsx#table.tsx-235:245
105
+ if (node.classList.contains('pm-table-container') && !renderer.classList.contains('is-full-width')) {
106
+ const lineLength = breakoutConsts.calcLineLength();
107
+ const left = lineLength / 2 - parseInt(width) / 2;
108
+ if (left < 0 && parseInt(width) > lineLength) {
109
+ node.style.left = left + 'px';
110
+ } else {
111
+ node.style.left = '';
112
+ }
116
113
  }
117
114
  }
118
115
  });
@@ -128,16 +125,6 @@ function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
128
125
  applyMediaBreakout(item.target);
129
126
  }
130
127
  });
131
-
132
- // Renderer is initially set to hidden until we figure out the proper width in packages/editor/editor-common/src/ui/WidthProvider/index.tsx
133
- if (renderer.style.visibility === 'hidden') {
134
- // Hiding until we get the correct width. But didn't remove them from the DOM so vertical scrollbar can still be correctly calculated.
135
- renderer.style.visibility = '';
136
- // Since we don't have a screen width to use as initial value.
137
- // The width is set to a fix number. This will cause horizontal scrollbar to appear.
138
- // Hide it until we have the correct width.
139
- renderer.style.overflowX = '';
140
- }
141
128
  });
142
129
  const applyMediaBreakout = card => {
143
130
  // width was already set by another breakout script
@@ -166,9 +153,6 @@ function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
166
153
  childList: true,
167
154
  subtree: true
168
155
  });
169
- if (shouldFixTableResizing) {
170
- window.__SSR_BREAKOUT_OBSERVED = true;
171
- }
172
156
 
173
157
  /**
174
158
  * Using window load event to unsubscribe from mutation observer, as at this stage document is fully rendered.
@@ -6,7 +6,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
6
  */
7
7
  import React, { Fragment, useContext, useLayoutEffect, useRef, PureComponent } from 'react';
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
- import { jsx } from '@emotion/react';
9
+ import { css, jsx } from '@emotion/react';
10
10
  import { getSchemaBasedOnStage } from '@atlaskit/adf-schema/schema-default';
11
11
  import { reduce } from '@atlaskit/adf-utils/traverse';
12
12
  import { ProviderFactory, ProviderFactoryProvider } from '@atlaskit/editor-common/provider-factory';
@@ -14,7 +14,6 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
14
14
  import { UnsupportedBlock, BaseTheme, WidthProvider, WithCreateAnalyticsEvent, IntlErrorBoundary } from '@atlaskit/editor-common/ui';
15
15
  import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
16
16
  import { getAnalyticsAppearance, getAnalyticsEventSeverity, shouldForceTracking } from '@atlaskit/editor-common/utils';
17
- import { measureTTI } from '@atlaskit/editor-common/performance/measure-tti';
18
17
  import { getDistortedDurationMonitor } from '@atlaskit/editor-common/performance/measure-render';
19
18
  import { browser } from '@atlaskit/editor-common/browser';
20
19
  import { getResponseEndTime } from '@atlaskit/editor-common/performance/navigation';
@@ -46,7 +45,12 @@ import { nodeToReact } from '../../react/nodes';
46
45
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
47
46
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
48
47
  const packageName = "@atlaskit/renderer";
49
- const packageVersion = "111.1.0";
48
+ const packageVersion = "111.1.2";
49
+ const setAsQueryContainerStyles = css({
50
+ containerName: 'ak-renderer-wrapper',
51
+ containerType: 'inline-size',
52
+ contain: 'layout style inline-size'
53
+ });
50
54
  export const defaultNodeComponents = nodeToReact;
51
55
 
52
56
  /**
@@ -139,21 +143,6 @@ export class __RendererClassComponent extends PureComponent {
139
143
  this.editorRef = props.innerRef || /*#__PURE__*/React.createRef();
140
144
  this.id = uuid();
141
145
  startMeasure(`Renderer Render Time: ${this.id}`);
142
- const _featureFlags = this.featureFlags(this.props.featureFlags).featureFlags;
143
- if (_featureFlags !== null && _featureFlags !== void 0 && _featureFlags.rendererTtiTracking) {
144
- measureTTI((tti, ttiFromInvocation, canceled) => {
145
- this.fireAnalyticsEvent({
146
- action: ACTION.RENDERER_TTI,
147
- actionSubject: ACTION_SUBJECT.RENDERER,
148
- attributes: {
149
- tti,
150
- ttiFromInvocation,
151
- canceled
152
- },
153
- eventType: EVENT_TYPE.OPERATIONAL
154
- });
155
- });
156
- }
157
146
  }
158
147
  anchorLinkAnalytics() {
159
148
  const hash = window.location.hash && decodeURIComponent(window.location.hash.slice(1));
@@ -527,7 +516,7 @@ const RendererWrapper = /*#__PURE__*/React.memo(props => {
527
516
  return () => observer.disconnect();
528
517
  }
529
518
  }, [innerRef, addTelepointer]);
530
- return jsx(WidthProvider
519
+ const renderer = jsx(WidthProvider
531
520
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
532
521
  , {
533
522
  className: `ak-renderer-wrapper is-${appearance}`,
@@ -552,6 +541,17 @@ const RendererWrapper = /*#__PURE__*/React.memo(props => {
552
541
  allowTableResizing: allowTableResizing
553
542
  })
554
543
  }, children))));
544
+
545
+ // We can only make the wrapper div query container when we have a known width.
546
+ // This is also required for SSR to work correctly. As WidthProvider/WithConsumer will not have the correct width during SSR.
547
+ //
548
+ // We are setting this wrapper div as query container conditionally.
549
+ // Only apply container-type = inline-size when having a known width in full-page/full-width/comment mode.
550
+ // Otherwise when appearance is unspecified the renderer size is decided by the content.
551
+ // In this case we can't set the container-type = inline-size as it will collapse width to 0.
552
+ return (appearance === 'full-page' || appearance === 'full-width' || appearance === 'comment') && fg('platform-fix-table-ssr-resizing') ? jsx("div", {
553
+ css: setAsQueryContainerStyles
554
+ }, renderer) : renderer;
555
555
  });
556
556
  const RootRendererContext = /*#__PURE__*/React.createContext(null);
557
557
  function RendererActionsInternalUpdater({
@@ -1,4 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
4
5
  import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
@@ -14,6 +15,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
14
15
  import React from 'react';
15
16
  import { TableSharedCssClassName, tableMarginTop } from '@atlaskit/editor-common/styles';
16
17
  import { WidthConsumer, overflowShadow } from '@atlaskit/editor-common/ui';
18
+ import { fg } from '@atlaskit/platform-feature-flags';
17
19
  import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose } from '@atlaskit/editor-common/utils';
18
20
  import { SortOrder } from '@atlaskit/editor-common/types';
19
21
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
@@ -320,32 +322,43 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
320
322
  // Please consider changes below carefully to not negatively impact SSR
321
323
  // `renderWidth` cannot be depended on during SSR
322
324
  var isRenderWidthValid = !!renderWidth && renderWidth > 0;
325
+ var renderWidthCSS = rendererAppearance === 'full-page' ? "100cqw - ".concat(FullPagePadding, "px * 2") : "100cqw";
323
326
  var calcDefaultLayoutWidthByAppearance = function calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode) {
324
327
  if (rendererAppearance === 'full-width' && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width)) {
325
- return isRenderWidthValid ? Math.min(akEditorFullWidthLayoutWidth, renderWidth) : akEditorFullWidthLayoutWidth;
328
+ return [isRenderWidthValid ? Math.min(akEditorFullWidthLayoutWidth, renderWidth) : akEditorFullWidthLayoutWidth, "min(".concat(akEditorFullWidthLayoutWidth, "px, ").concat(renderWidthCSS, ")")];
326
329
  } else if (rendererAppearance === 'comment' && allowTableResizing && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width)) {
327
330
  var tableContainerWidth = getTableContainerWidth(tableNode);
328
- return isRenderWidthValid ? renderWidth : tableContainerWidth;
331
+ return [isRenderWidthValid ? renderWidth : tableContainerWidth, renderWidthCSS];
329
332
  } else {
330
333
  // custom width, or width mapped to breakpoint
331
334
  var _tableContainerWidth = getTableContainerWidth(tableNode);
332
- return isRenderWidthValid ? Math.min(_tableContainerWidth, renderWidth) : _tableContainerWidth;
335
+ return [isRenderWidthValid ? Math.min(_tableContainerWidth, renderWidth) : _tableContainerWidth, "min(".concat(_tableContainerWidth, "px, ").concat(renderWidthCSS, ")")];
333
336
  }
334
337
  };
335
- var tableWidth = calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode);
338
+ var _calcDefaultLayoutWid = calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode),
339
+ _calcDefaultLayoutWid2 = _slicedToArray(_calcDefaultLayoutWid, 2),
340
+ tableWidth = _calcDefaultLayoutWid2[0],
341
+ tableWidthCSS = _calcDefaultLayoutWid2[1];
336
342
 
337
343
  // Logic for table alignment in renderer
338
344
  var isTableAlignStart = tableNode && tableNode.attrs && tableNode.attrs.layout === 'align-start' && allowTableAlignment;
339
345
  var fullWidthLineLength = isRenderWidthValid ? Math.min(akEditorFullWidthLayoutWidth, renderWidth) : akEditorFullWidthLayoutWidth;
346
+ var fullWidthLineLengthCSS = "min(".concat(akEditorFullWidthLayoutWidth, "px, ").concat(renderWidthCSS, ")");
340
347
  var commentLineLength = isRenderWidthValid ? renderWidth : lineLengthFixedWidth;
341
348
  var isCommentAppearanceAndTableAlignmentEnabled = isCommentAppearance(rendererAppearance) && allowTableAlignment;
342
349
  var lineLength = isFullWidthAppearance(rendererAppearance) ? fullWidthLineLength : isCommentAppearanceAndTableAlignmentEnabled ? commentLineLength : lineLengthFixedWidth;
343
- var shouldCalculateLeftForAlignment = !isInsideOfBlockNode && isTableAlignStart && (isFullPageAppearance(rendererAppearance) && tableWidth <= lineLengthFixedWidth || isFullWidthAppearance(rendererAppearance) || isCommentAppearanceAndTableAlignmentEnabled);
350
+ var lineLengthCSS = isFullWidthAppearance(rendererAppearance) ? fullWidthLineLengthCSS : isCommentAppearanceAndTableAlignmentEnabled ? renderWidthCSS : "".concat(lineLengthFixedWidth, "px");
351
+ var fixTableSSRResizing = fg('platform-fix-table-ssr-resizing');
352
+ var tableWidthNew = fixTableSSRResizing ? getTableContainerWidth(tableNode) : tableWidth;
353
+ var shouldCalculateLeftForAlignment = !isInsideOfBlockNode && isTableAlignStart && (isFullPageAppearance(rendererAppearance) && tableWidthNew <= lineLengthFixedWidth || isFullWidthAppearance(rendererAppearance) || isCommentAppearanceAndTableAlignmentEnabled);
354
+ var leftCSS;
344
355
  if (shouldCalculateLeftForAlignment) {
345
356
  left = (tableWidth - lineLength) / 2;
357
+ leftCSS = "(".concat(tableWidthCSS, " - ").concat(lineLengthCSS, ") / 2");
346
358
  }
347
- if (!shouldCalculateLeftForAlignment && canUseLinelength(rendererAppearance) && tableWidth > lineLengthFixedWidth) {
359
+ if (!shouldCalculateLeftForAlignment && canUseLinelength(rendererAppearance) && tableWidthNew > lineLengthFixedWidth) {
348
360
  left = lineLengthFixedWidth / 2 - tableWidth / 2;
361
+ leftCSS = "".concat(lineLengthCSS, " / 2 - ").concat(tableWidthCSS, " / 2");
349
362
  }
350
363
  var children = React.Children.toArray(this.props.children);
351
364
 
@@ -360,7 +373,14 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
360
373
  } else {
361
374
  updatedLayout = layout;
362
375
  }
363
- var finalTableContainerWidth = allowTableResizing ? tableWidth : 'inherit';
376
+ var finalTableContainerWidth = allowTableResizing ? tableWidthNew : 'inherit';
377
+
378
+ // We can only use CSS to determine the width when we have a known width in container.
379
+ // When appearance is full-page, full-width or comment we use CSS based width calculation.
380
+ // Otherwise it's fixed table width (customized width) or inherit.
381
+ if ((rendererAppearance === 'full-page' || rendererAppearance === 'full-width') && fixTableSSRResizing) {
382
+ finalTableContainerWidth = allowTableResizing ? "calc(".concat(tableWidthCSS, ")") : 'inherit';
383
+ }
364
384
  if (rendererAppearance === 'comment' && allowTableResizing && !allowTableAlignment) {
365
385
  // If table alignment is disabled and table width is akEditorDefaultLayoutWidth = 760,
366
386
  // it is most likely a table created before "Support Table in Comments" FF was enabled
@@ -369,24 +389,36 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
369
389
 
370
390
  // !NOTE: it a table resized to 760 is copied from 'full-page' editor and pasted in comment editor
371
391
  // where (allowTableResizing && !allowTableAlignment), the table will loose 760px width.
372
- finalTableContainerWidth = tableNode !== null && tableNode !== void 0 && tableNode.attrs.width && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width) !== akEditorDefaultLayoutWidth ? tableWidth : 'inherit';
392
+ finalTableContainerWidth = tableNode !== null && tableNode !== void 0 && tableNode.attrs.width && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width) !== akEditorDefaultLayoutWidth ? fixTableSSRResizing ? "calc(".concat(tableWidthCSS, ")") : tableWidth : 'inherit';
373
393
  }
374
394
  if (rendererAppearance === 'comment' && allowTableResizing && allowTableAlignment) {
375
395
  // If table alignment is enabled and layout is not 'align-start' or 'center', we are loading a table that was
376
396
  // created before "Support Table in Comments" FF was enabled. So the table should have the same width as renderer container
377
397
  // instead of 760 that was set on tableNode when the table had been published.
378
- finalTableContainerWidth = ((tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'align-start' || (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'center') && tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ? tableWidth : 'inherit';
398
+ finalTableContainerWidth = ((tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'align-start' || (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'center') && tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ? fixTableSSRResizing ? "calc(".concat(tableWidthCSS, ")") : tableWidth : 'inherit';
399
+ }
400
+ var style;
401
+ if (fixTableSSRResizing) {
402
+ style = {
403
+ width: finalTableContainerWidth,
404
+ left: leftCSS ? "calc(".concat(leftCSS, ")") : undefined,
405
+ marginLeft: shouldCalculateLeftForAlignment && leftCSS !== undefined ? "calc(-1 * (".concat(leftCSS, "))") : undefined
406
+ };
407
+ } else {
408
+ style = {
409
+ width: finalTableContainerWidth,
410
+ left: left,
411
+ marginLeft: shouldCalculateLeftForAlignment && left !== undefined ? -left : undefined
412
+ };
379
413
  }
380
414
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
381
415
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
382
416
  className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
383
417
  "data-layout": updatedLayout,
384
- ref: this.props.handleRef,
385
- style: {
386
- width: finalTableContainerWidth,
387
- left: left,
388
- marginLeft: shouldCalculateLeftForAlignment && left !== undefined ? -left : undefined
389
- }
418
+ ref: this.props.handleRef
419
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
420
+ ,
421
+ style: style
390
422
  }, isStickyScrollbarEnabled(this.props.rendererAppearance) && /*#__PURE__*/React.createElement("div", {
391
423
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
392
424
  className: TableSharedCssClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_TOP,
@@ -431,8 +463,10 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
431
463
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
432
464
  height: "var(--ds-space-250, 20px)",
433
465
  // MAX_BROWSER_SCROLLBAR_HEIGHT
466
+ // Follow editor to hide by default so it does not show empty gap in SSR
467
+ // https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/browse/platform/packages/editor/editor-plugin-table/src/nodeviews/TableComponent.tsx#957
434
468
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
435
- display: 'block',
469
+ display: fixTableSSRResizing ? 'none' : 'block',
436
470
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
437
471
  width: '100%'
438
472
  }
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { breakoutConsts } from '@atlaskit/editor-common/utils';
3
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
4
  import { FullPagePadding } from './style';
5
+
5
6
  /**
6
7
  * Inline Script that updates breakout node width on client side,
7
8
  * before main JavaScript bundle is ready.
@@ -29,8 +30,7 @@ export function BreakoutSSRInlineScript() {
29
30
  });
30
31
  }
31
32
  export function createBreakoutInlineScript(id) {
32
- var shouldFixTableResizing = String(Boolean(fg('platform-fix-table-ssr-resizing')));
33
- return "\n (function(window){\n ".concat(breakoutInlineScriptContext, ";\n (").concat(applyBreakoutAfterSSR.toString(), ")(\"").concat(id, "\", breakoutConsts, ").concat(shouldFixTableResizing, ");\n })(window);\n");
33
+ return "\n (function(window){\n ".concat(breakoutInlineScriptContext, ";\n (").concat(applyBreakoutAfterSSR.toString(), ")(\"").concat(id, "\", breakoutConsts, ").concat(Boolean(fg('platform-fix-table-ssr-resizing')), ");\n })(window);\n");
34
34
  }
35
35
  export var breakoutInlineScriptContext = "\n var breakoutConsts = ".concat(JSON.stringify(breakoutConsts), ";\n breakoutConsts.mapBreakpointToLayoutMaxWidth = ").concat(breakoutConsts.mapBreakpointToLayoutMaxWidth.toString(), ";\n breakoutConsts.getBreakpoint = ").concat(breakoutConsts.getBreakpoint.toString(), ";\n breakoutConsts.calcBreakoutWidth = ").concat(breakoutConsts.calcBreakoutWidth.toString(), ";\n breakoutConsts.calcLineLength = ").concat(breakoutConsts.calcLineLength.toString(), ";\n breakoutConsts.calcWideWidth = ").concat(breakoutConsts.calcWideWidth.toString(), ";\n breakoutConsts.FullPagePadding = ").concat(FullPagePadding.toString(), ";\n");
36
36
  function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
@@ -71,35 +71,32 @@ function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
71
71
  if (!mode || !WIDE_LAYOUT_MODES.includes(mode)) {
72
72
  return;
73
73
  }
74
- if (node.classList.contains('pm-table-container') && mode === 'custom') {
75
- var isFullPage = renderer.classList.contains('is-full-page');
76
- var rendererWidth = renderer.offsetWidth;
77
- var effectiveWidth;
78
- if (shouldFixTableResizing) {
79
- // Logic from https://stash.atlassian.com/projects/atlassian/repos/atlassian-frontend-monorepo/browse/platform/packages/editor/renderer/src/react/nodes/table.tsx?at=d3af2ef54521ccf10e9b094996ad9528ec05c7e3#610
80
- effectiveWidth = isFullPage ? rendererWidth - 2 * breakoutConsts.FullPagePadding : rendererWidth;
74
+
75
+ // When flag is on we are using CSS to calculate the table width thus don't need logic below to set the width and left.
76
+ if (!shouldFixTableResizing) {
77
+ if (node.classList.contains('pm-table-container') && mode === 'custom') {
78
+ var rendererWidth = renderer.offsetWidth;
79
+ var effectiveWidth = rendererWidth - breakoutConsts.padding;
80
+ width = "".concat(Math.min(parseInt(node.style.width), effectiveWidth), "px");
81
81
  } else {
82
- effectiveWidth = rendererWidth - breakoutConsts.padding;
82
+ width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
83
83
  }
84
- width = "".concat(Math.min(parseInt(node.style.width), effectiveWidth), "px");
85
- } else {
86
- width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
87
- }
88
- if (node.style.width === width) {
89
- return;
90
- }
91
- node.style.width = width;
84
+ if (node.style.width === width) {
85
+ return;
86
+ }
87
+ node.style.width = width;
92
88
 
93
- // Tables require some special logic, as they are not using common css transform approach,
94
- // because it breaks with sticky headers. This logic is copied from a table node:
95
- // https://bitbucket.org/atlassian/atlassian-frontend/src/77938aee0c140d02ff99b98a03849be1236865b4/packages/editor/renderer/src/react/nodes/table.tsx#table.tsx-235:245
96
- if (node.classList.contains('pm-table-container') && !renderer.classList.contains('is-full-width')) {
97
- var lineLength = breakoutConsts.calcLineLength();
98
- var left = lineLength / 2 - parseInt(width) / 2;
99
- if (left < 0 && parseInt(width) > lineLength) {
100
- node.style.left = left + 'px';
101
- } else {
102
- node.style.left = '';
89
+ // Tables require some special logic, as they are not using common css transform approach,
90
+ // because it breaks with sticky headers. This logic is copied from a table node:
91
+ // https://bitbucket.org/atlassian/atlassian-frontend/src/77938aee0c140d02ff99b98a03849be1236865b4/packages/editor/renderer/src/react/nodes/table.tsx#table.tsx-235:245
92
+ if (node.classList.contains('pm-table-container') && !renderer.classList.contains('is-full-width')) {
93
+ var lineLength = breakoutConsts.calcLineLength();
94
+ var left = lineLength / 2 - parseInt(width) / 2;
95
+ if (left < 0 && parseInt(width) > lineLength) {
96
+ node.style.left = left + 'px';
97
+ } else {
98
+ node.style.left = '';
99
+ }
103
100
  }
104
101
  }
105
102
  });
@@ -115,16 +112,6 @@ function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
115
112
  applyMediaBreakout(item.target);
116
113
  }
117
114
  });
118
-
119
- // Renderer is initially set to hidden until we figure out the proper width in packages/editor/editor-common/src/ui/WidthProvider/index.tsx
120
- if (renderer.style.visibility === 'hidden') {
121
- // Hiding until we get the correct width. But didn't remove them from the DOM so vertical scrollbar can still be correctly calculated.
122
- renderer.style.visibility = '';
123
- // Since we don't have a screen width to use as initial value.
124
- // The width is set to a fix number. This will cause horizontal scrollbar to appear.
125
- // Hide it until we have the correct width.
126
- renderer.style.overflowX = '';
127
- }
128
115
  });
129
116
  var applyMediaBreakout = function applyMediaBreakout(card) {
130
117
  // width was already set by another breakout script
@@ -155,9 +142,6 @@ function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
155
142
  childList: true,
156
143
  subtree: true
157
144
  });
158
- if (shouldFixTableResizing) {
159
- window.__SSR_BREAKOUT_OBSERVED = true;
160
- }
161
145
 
162
146
  /**
163
147
  * Using window load event to unsubscribe from mutation observer, as at this stage document is fully rendered.
@@ -16,7 +16,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
16
16
  */
17
17
  import React, { Fragment, useContext, useLayoutEffect, useRef, PureComponent } from 'react';
18
18
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
19
- import { jsx } from '@emotion/react';
19
+ import { css, jsx } from '@emotion/react';
20
20
  import { getSchemaBasedOnStage } from '@atlaskit/adf-schema/schema-default';
21
21
  import { reduce } from '@atlaskit/adf-utils/traverse';
22
22
  import { ProviderFactory, ProviderFactoryProvider } from '@atlaskit/editor-common/provider-factory';
@@ -24,7 +24,6 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
24
24
  import { UnsupportedBlock, BaseTheme, WidthProvider, WithCreateAnalyticsEvent, IntlErrorBoundary } from '@atlaskit/editor-common/ui';
25
25
  import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
26
26
  import { getAnalyticsAppearance, getAnalyticsEventSeverity, shouldForceTracking } from '@atlaskit/editor-common/utils';
27
- import { measureTTI } from '@atlaskit/editor-common/performance/measure-tti';
28
27
  import { getDistortedDurationMonitor } from '@atlaskit/editor-common/performance/measure-render';
29
28
  import { browser } from '@atlaskit/editor-common/browser';
30
29
  import { getResponseEndTime } from '@atlaskit/editor-common/performance/navigation';
@@ -56,7 +55,12 @@ import { nodeToReact } from '../../react/nodes';
56
55
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
57
56
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
58
57
  var packageName = "@atlaskit/renderer";
59
- var packageVersion = "111.1.0";
58
+ var packageVersion = "111.1.2";
59
+ var setAsQueryContainerStyles = css({
60
+ containerName: 'ak-renderer-wrapper',
61
+ containerType: 'inline-size',
62
+ contain: 'layout style inline-size'
63
+ });
60
64
  export var defaultNodeComponents = nodeToReact;
61
65
 
62
66
  /**
@@ -149,21 +153,6 @@ export var __RendererClassComponent = /*#__PURE__*/function (_PureComponent) {
149
153
  _this.editorRef = props.innerRef || /*#__PURE__*/React.createRef();
150
154
  _this.id = uuid();
151
155
  startMeasure("Renderer Render Time: ".concat(_this.id));
152
- var _featureFlags = _this.featureFlags(_this.props.featureFlags).featureFlags;
153
- if (_featureFlags !== null && _featureFlags !== void 0 && _featureFlags.rendererTtiTracking) {
154
- measureTTI(function (tti, ttiFromInvocation, canceled) {
155
- _this.fireAnalyticsEvent({
156
- action: ACTION.RENDERER_TTI,
157
- actionSubject: ACTION_SUBJECT.RENDERER,
158
- attributes: {
159
- tti: tti,
160
- ttiFromInvocation: ttiFromInvocation,
161
- canceled: canceled
162
- },
163
- eventType: EVENT_TYPE.OPERATIONAL
164
- });
165
- });
166
- }
167
156
  return _this;
168
157
  }
169
158
  _createClass(__RendererClassComponent, [{
@@ -505,26 +494,26 @@ var RendererWrapper = /*#__PURE__*/React.memo(function (props) {
505
494
  // We must check if window is defined, if it isn't we are in a SSR environment
506
495
  // and we don't want to add the telepointer
507
496
  if (typeof window !== 'undefined' && addTelepointer && innerRef !== null && innerRef !== void 0 && innerRef.current) {
508
- var renderer = innerRef.current.querySelector('.ak-renderer-document');
497
+ var _renderer = innerRef.current.querySelector('.ak-renderer-document');
509
498
  if (initialUpdate.current) {
510
- var lastChild = renderer.lastChild;
499
+ var lastChild = _renderer.lastChild;
511
500
  lastChild && lastChild.appendChild(createTelepointer());
512
501
  }
513
502
  var mutateTelepointer = function mutateTelepointer(mutations) {
514
503
  mutations.forEach(function (mutation) {
515
504
  if (initialUpdate.current) {
516
- var oldTelepointer = renderer.querySelector("#".concat(TELEPOINTER_ID));
505
+ var oldTelepointer = _renderer.querySelector("#".concat(TELEPOINTER_ID));
517
506
  if (oldTelepointer) {
518
507
  oldTelepointer.remove();
519
508
  }
520
- var _lastChild = renderer.lastChild;
509
+ var _lastChild = _renderer.lastChild;
521
510
  _lastChild && _lastChild.appendChild(createTelepointer());
522
511
  initialUpdate.current = false;
523
512
  }
524
513
  if (mutation.type === 'characterData') {
525
514
  var parentNode = mutation.target.parentElement;
526
515
  if (parentNode) {
527
- var _oldTelepointer = renderer.querySelector("#".concat(TELEPOINTER_ID));
516
+ var _oldTelepointer = _renderer.querySelector("#".concat(TELEPOINTER_ID));
528
517
  if (_oldTelepointer) {
529
518
  _oldTelepointer.remove();
530
519
  }
@@ -545,7 +534,7 @@ var RendererWrapper = /*#__PURE__*/React.memo(function (props) {
545
534
  };
546
535
  }
547
536
  }, [innerRef, addTelepointer]);
548
- return jsx(WidthProvider
537
+ var renderer = jsx(WidthProvider
549
538
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
550
539
  , {
551
540
  className: "ak-renderer-wrapper is-".concat(appearance),
@@ -570,6 +559,17 @@ var RendererWrapper = /*#__PURE__*/React.memo(function (props) {
570
559
  allowTableResizing: allowTableResizing
571
560
  })
572
561
  }, children))));
562
+
563
+ // We can only make the wrapper div query container when we have a known width.
564
+ // This is also required for SSR to work correctly. As WidthProvider/WithConsumer will not have the correct width during SSR.
565
+ //
566
+ // We are setting this wrapper div as query container conditionally.
567
+ // Only apply container-type = inline-size when having a known width in full-page/full-width/comment mode.
568
+ // Otherwise when appearance is unspecified the renderer size is decided by the content.
569
+ // In this case we can't set the container-type = inline-size as it will collapse width to 0.
570
+ return (appearance === 'full-page' || appearance === 'full-width' || appearance === 'comment') && fg('platform-fix-table-ssr-resizing') ? jsx("div", {
571
+ css: setAsQueryContainerStyles
572
+ }, renderer) : renderer;
573
573
  });
574
574
  var RootRendererContext = /*#__PURE__*/React.createContext(null);
575
575
  function RendererActionsInternalUpdater(_ref) {
@@ -1,9 +1,4 @@
1
1
  /// <reference types="react" />
2
- declare global {
3
- interface Window {
4
- __SSR_BREAKOUT_OBSERVED?: boolean;
5
- }
6
- }
7
2
  /**
8
3
  * Inline Script that updates breakout node width on client side,
9
4
  * before main JavaScript bundle is ready.
@@ -1,9 +1,4 @@
1
1
  /// <reference types="react" />
2
- declare global {
3
- interface Window {
4
- __SSR_BREAKOUT_OBSERVED?: boolean;
5
- }
6
- }
7
2
  /**
8
3
  * Inline Script that updates breakout node width on client side,
9
4
  * before main JavaScript bundle is ready.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "111.1.0",
3
+ "version": "111.1.2",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,7 +29,7 @@
29
29
  "@atlaskit/analytics-next": "^10.1.0",
30
30
  "@atlaskit/button": "^20.2.0",
31
31
  "@atlaskit/code": "^15.6.0",
32
- "@atlaskit/editor-common": "^92.1.0",
32
+ "@atlaskit/editor-common": "^93.0.0",
33
33
  "@atlaskit/editor-json-transformer": "^8.18.0",
34
34
  "@atlaskit/editor-palette": "1.6.1",
35
35
  "@atlaskit/editor-prosemirror": "6.0.0",
@@ -37,7 +37,7 @@
37
37
  "@atlaskit/emoji": "^67.8.0",
38
38
  "@atlaskit/feature-gate-js-client": "^4.19.0",
39
39
  "@atlaskit/icon": "^22.20.0",
40
- "@atlaskit/link-datasource": "^3.2.0",
40
+ "@atlaskit/link-datasource": "^3.3.0",
41
41
  "@atlaskit/media-card": "^78.5.0",
42
42
  "@atlaskit/media-client": "^28.0.0",
43
43
  "@atlaskit/media-client-react": "^2.2.0",
@@ -52,7 +52,7 @@
52
52
  "@atlaskit/theme": "^13.0.0",
53
53
  "@atlaskit/tmp-editor-statsig": "*",
54
54
  "@atlaskit/tokens": "^2.0.0",
55
- "@atlaskit/tooltip": "^18.7.0",
55
+ "@atlaskit/tooltip": "^18.8.0",
56
56
  "@babel/runtime": "^7.0.0",
57
57
  "@emotion/react": "^11.7.1",
58
58
  "lodash": "^4.17.21",