@atlaskit/renderer 112.4.0 → 112.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 112.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#162298](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/162298)
8
+ [`f5893b7270927`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f5893b7270927) -
9
+ ED-25498 Integrate transformNestedTablesIncomingDocument with Editor and Renderer to transform
10
+ nested table extensions
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 112.4.1
17
+
18
+ ### Patch Changes
19
+
20
+ - [#161210](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/161210)
21
+ [`ffa275ccb1a59`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ffa275ccb1a59) -
22
+ adjust temporary sticky table config options to accept an id rather than the HTMLElement
23
+ - Updated dependencies
24
+
3
25
  ## 112.4.0
4
26
 
5
27
  ### Minor Changes
@@ -173,7 +173,7 @@ var StickyTable = exports.StickyTable = function StickyTable(_ref) {
173
173
  /**
174
174
  * Traverse DOM Tree upwards looking for table parents with "overflow: scroll".
175
175
  */
176
- function findHorizontalOverflowScrollParent(table, defaultScrollRootEl) {
176
+ function findHorizontalOverflowScrollParent(table, defaultScrollRootId) {
177
177
  var parent = table;
178
178
  if (!parent) {
179
179
  return null;
@@ -184,9 +184,9 @@ function findHorizontalOverflowScrollParent(table, defaultScrollRootEl) {
184
184
  if (style.overflow === 'scroll' || style.overflowY === 'scroll') {
185
185
  return parent;
186
186
  }
187
- if (!!defaultScrollRootEl && defaultScrollRootEl === parent) {
188
- // If a defaultScrollRootEl was specified and we reached it without finding a closer scroll parent,
189
- // use the defaultScrollRootEl.
187
+ if (!!defaultScrollRootId && parent.id === defaultScrollRootId) {
188
+ // If a defaultScrollRootId was specified and we reached the element with this id without finding a closer
189
+ // scroll parent, use this element as the scroll parent
190
190
  return parent;
191
191
  }
192
192
  }
@@ -203,6 +203,14 @@ var OverflowParent = exports.OverflowParent = /*#__PURE__*/function () {
203
203
  get: function get() {
204
204
  return this.ref instanceof HTMLElement;
205
205
  }
206
+ }, {
207
+ key: "id",
208
+ get: function get() {
209
+ if (this.ref instanceof HTMLElement) {
210
+ return this.ref.id;
211
+ }
212
+ return '';
213
+ }
206
214
  }, {
207
215
  key: "top",
208
216
  get: function get() {
@@ -231,8 +239,8 @@ var OverflowParent = exports.OverflowParent = /*#__PURE__*/function () {
231
239
  }
232
240
  }], [{
233
241
  key: "fromElement",
234
- value: function fromElement(el, defaultScrollRootEl) {
235
- return new OverflowParent(findHorizontalOverflowScrollParent(el, defaultScrollRootEl) || window);
242
+ value: function fromElement(el, defaultScrollRootId) {
243
+ return new OverflowParent(findHorizontalOverflowScrollParent(el, defaultScrollRootId) || window);
236
244
  }
237
245
  }]);
238
246
  return OverflowParent;
@@ -254,7 +254,7 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
254
254
  }
255
255
  if (this.props.stickyHeaders) {
256
256
  var _this$props$stickyHea;
257
- this.overflowParent = _sticky.OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea = this.props.stickyHeaders) === null || _this$props$stickyHea === void 0 ? void 0 : _this$props$stickyHea.defaultScrollRoot_DO_NOT_USE);
257
+ this.overflowParent = _sticky.OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea = this.props.stickyHeaders) === null || _this$props$stickyHea === void 0 ? void 0 : _this$props$stickyHea.defaultScrollRootId_DO_NOT_USE);
258
258
  this.overflowParent.addEventListener('scroll', this.onScroll);
259
259
  }
260
260
  if (this.wrapperRef.current && isStickyScrollbarEnabled(this.props.rendererAppearance)) {
@@ -267,7 +267,7 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
267
267
  // toggling sticky headers visiblity
268
268
  if (this.props.stickyHeaders && !this.overflowParent) {
269
269
  var _this$props$stickyHea2;
270
- this.overflowParent = _sticky.OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea2 = this.props.stickyHeaders) === null || _this$props$stickyHea2 === void 0 ? void 0 : _this$props$stickyHea2.defaultScrollRoot_DO_NOT_USE);
270
+ this.overflowParent = _sticky.OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea2 = this.props.stickyHeaders) === null || _this$props$stickyHea2 === void 0 ? void 0 : _this$props$stickyHea2.defaultScrollRootId_DO_NOT_USE);
271
271
  } else if (!this.props.stickyHeaders && this.overflowParent) {
272
272
  this.overflowParent.removeEventListener('scroll', this.onScroll);
273
273
  this.overflowParent = null;
@@ -291,6 +291,15 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
291
291
  }
292
292
  return this.tableRef.current.offsetHeight - this.stickyHeaderRef.current.offsetHeight + _styles.tableMarginTop - _sticky.tableStickyPadding;
293
293
  }
294
+ }, {
295
+ key: "shouldAddOverflowParentOffsetTop_DO_NOT_USE",
296
+ get: function get() {
297
+ // IF the StickyHeaderConfig specifies that the default scroll root offsetTop should be added
298
+ // AND the StickyHeaderConfig specifies a default scroll root id
299
+ // AND the OverflowParent is the corresponding element
300
+ // THEN we should add the OverflowParent offset top (RETURN TRUE)
301
+ return this.props.stickyHeaders && !!this.props.stickyHeaders.shouldAddDefaultScrollRootOffsetTop_DO_NOT_USE && !!this.props.stickyHeaders.defaultScrollRootId_DO_NOT_USE && this.overflowParent && this.overflowParent.id === this.props.stickyHeaders.defaultScrollRootId_DO_NOT_USE;
302
+ }
294
303
  }, {
295
304
  key: "stickyTop",
296
305
  get: function get() {
@@ -299,10 +308,9 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
299
308
  return this.pinTop;
300
309
  case 'stick':
301
310
  var offsetTop = this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
302
- if (typeof offsetTop === 'number') {
303
- var _this$props$stickyHea3, _this$props$stickyHea4;
304
- var defaultScrollRootOffsetTop = (_this$props$stickyHea3 = (_this$props$stickyHea4 = this.props.stickyHeaders) === null || _this$props$stickyHea4 === void 0 ? void 0 : _this$props$stickyHea4.defaultScrollRootTop_DO_NOT_USE) !== null && _this$props$stickyHea3 !== void 0 ? _this$props$stickyHea3 : 0;
305
- return offsetTop + defaultScrollRootOffsetTop;
311
+ if (typeof offsetTop === 'number' && this.shouldAddOverflowParentOffsetTop_DO_NOT_USE) {
312
+ var overflowParentOffsetTop = this.overflowParent ? this.overflowParent.top : 0;
313
+ return offsetTop + overflowParentOffsetTop;
306
314
  } else {
307
315
  return offsetTop;
308
316
  }
@@ -15,6 +15,7 @@ var _events = require("./analytics/events");
15
15
  var _unsupportedContent = require("./analytics/unsupported-content");
16
16
  var _transforms = require("@atlaskit/adf-utils/transforms");
17
17
  var _countNodes = require("./ui/Renderer/count-nodes");
18
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
19
  var SUPPORTS_HIRES_TIMER_API = !!(typeof window !== 'undefined' && window.performance && performance.now);
19
20
  var withStopwatch = function withStopwatch(cb) {
20
21
  var startTime = SUPPORTS_HIRES_TIMER_API ? performance.now() : Date.now();
@@ -63,6 +64,32 @@ var _validation = function _validation(doc, schema, adfStage, useSpecBasedValida
63
64
  result.version = 1;
64
65
  }
65
66
  }
67
+ if ((0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes')) {
68
+ // Convert nested-table extensions into nested tables
69
+ try {
70
+ var _transformNestedTable = (0, _transforms.transformNestedTablesIncomingDocument)(result),
71
+ _transformedAdf = _transformNestedTable.transformedAdf,
72
+ _isTransformed = _transformNestedTable.isTransformed;
73
+ if (_isTransformed) {
74
+ dispatchAnalyticsEvent === null || dispatchAnalyticsEvent === void 0 || dispatchAnalyticsEvent({
75
+ action: _analytics.ACTION.NESTED_TABLE_TRANSFORMED,
76
+ actionSubject: _analytics.ACTION_SUBJECT.RENDERER,
77
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL
78
+ });
79
+ result = _transformedAdf;
80
+ }
81
+ } catch (e) {
82
+ dispatchAnalyticsEvent === null || dispatchAnalyticsEvent === void 0 || dispatchAnalyticsEvent({
83
+ action: _analytics.ACTION.INVALID_PROSEMIRROR_DOCUMENT,
84
+ actionSubject: _analytics.ACTION_SUBJECT.RENDERER,
85
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL,
86
+ attributes: {
87
+ platform: _events.PLATFORM.WEB,
88
+ errorStack: 'Failed to transform one or more nested tables in the document'
89
+ }
90
+ });
91
+ }
92
+ }
66
93
  return result;
67
94
  };
68
95
  var memoValidation = (0, _memoizeOne.default)(_validation, function (newArgs, lastArgs) {
@@ -65,7 +65,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
65
65
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
66
66
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
67
67
  var packageName = "@atlaskit/renderer";
68
- var packageVersion = "112.4.0";
68
+ var packageVersion = "112.5.0";
69
69
  var setAsQueryContainerStyles = (0, _react2.css)({
70
70
  containerName: 'ak-renderer-wrapper',
71
71
  containerType: 'inline-size',
@@ -174,7 +174,7 @@ export const StickyTable = ({
174
174
  /**
175
175
  * Traverse DOM Tree upwards looking for table parents with "overflow: scroll".
176
176
  */
177
- function findHorizontalOverflowScrollParent(table, defaultScrollRootEl) {
177
+ function findHorizontalOverflowScrollParent(table, defaultScrollRootId) {
178
178
  let parent = table;
179
179
  if (!parent) {
180
180
  return null;
@@ -185,9 +185,9 @@ function findHorizontalOverflowScrollParent(table, defaultScrollRootEl) {
185
185
  if (style.overflow === 'scroll' || style.overflowY === 'scroll') {
186
186
  return parent;
187
187
  }
188
- if (!!defaultScrollRootEl && defaultScrollRootEl === parent) {
189
- // If a defaultScrollRootEl was specified and we reached it without finding a closer scroll parent,
190
- // use the defaultScrollRootEl.
188
+ if (!!defaultScrollRootId && parent.id === defaultScrollRootId) {
189
+ // If a defaultScrollRootId was specified and we reached the element with this id without finding a closer
190
+ // scroll parent, use this element as the scroll parent
191
191
  return parent;
192
192
  }
193
193
  }
@@ -198,12 +198,18 @@ export class OverflowParent {
198
198
  this.ref = ref;
199
199
  this.ref = ref;
200
200
  }
201
- static fromElement(el, defaultScrollRootEl) {
202
- return new OverflowParent(findHorizontalOverflowScrollParent(el, defaultScrollRootEl) || window);
201
+ static fromElement(el, defaultScrollRootId) {
202
+ return new OverflowParent(findHorizontalOverflowScrollParent(el, defaultScrollRootId) || window);
203
203
  }
204
204
  get isElement() {
205
205
  return this.ref instanceof HTMLElement;
206
206
  }
207
+ get id() {
208
+ if (this.ref instanceof HTMLElement) {
209
+ return this.ref.id;
210
+ }
211
+ return '';
212
+ }
207
213
  get top() {
208
214
  if (this.ref instanceof HTMLElement) {
209
215
  return this.ref.getBoundingClientRect().top;
@@ -205,7 +205,7 @@ export class TableContainer extends React.Component {
205
205
  }
206
206
  if (this.props.stickyHeaders) {
207
207
  var _this$props$stickyHea;
208
- this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea = this.props.stickyHeaders) === null || _this$props$stickyHea === void 0 ? void 0 : _this$props$stickyHea.defaultScrollRoot_DO_NOT_USE);
208
+ this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea = this.props.stickyHeaders) === null || _this$props$stickyHea === void 0 ? void 0 : _this$props$stickyHea.defaultScrollRootId_DO_NOT_USE);
209
209
  this.overflowParent.addEventListener('scroll', this.onScroll);
210
210
  }
211
211
  if (this.wrapperRef.current && isStickyScrollbarEnabled(this.props.rendererAppearance)) {
@@ -216,7 +216,7 @@ export class TableContainer extends React.Component {
216
216
  // toggling sticky headers visiblity
217
217
  if (this.props.stickyHeaders && !this.overflowParent) {
218
218
  var _this$props$stickyHea2;
219
- this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea2 = this.props.stickyHeaders) === null || _this$props$stickyHea2 === void 0 ? void 0 : _this$props$stickyHea2.defaultScrollRoot_DO_NOT_USE);
219
+ this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea2 = this.props.stickyHeaders) === null || _this$props$stickyHea2 === void 0 ? void 0 : _this$props$stickyHea2.defaultScrollRootId_DO_NOT_USE);
220
220
  } else if (!this.props.stickyHeaders && this.overflowParent) {
221
221
  this.overflowParent.removeEventListener('scroll', this.onScroll);
222
222
  this.overflowParent = null;
@@ -238,16 +238,22 @@ export class TableContainer extends React.Component {
238
238
  }
239
239
  return this.tableRef.current.offsetHeight - this.stickyHeaderRef.current.offsetHeight + tableMarginTop - tableStickyPadding;
240
240
  }
241
+ get shouldAddOverflowParentOffsetTop_DO_NOT_USE() {
242
+ // IF the StickyHeaderConfig specifies that the default scroll root offsetTop should be added
243
+ // AND the StickyHeaderConfig specifies a default scroll root id
244
+ // AND the OverflowParent is the corresponding element
245
+ // THEN we should add the OverflowParent offset top (RETURN TRUE)
246
+ return this.props.stickyHeaders && !!this.props.stickyHeaders.shouldAddDefaultScrollRootOffsetTop_DO_NOT_USE && !!this.props.stickyHeaders.defaultScrollRootId_DO_NOT_USE && this.overflowParent && this.overflowParent.id === this.props.stickyHeaders.defaultScrollRootId_DO_NOT_USE;
247
+ }
241
248
  get stickyTop() {
242
249
  switch (this.state.stickyMode) {
243
250
  case 'pin-bottom':
244
251
  return this.pinTop;
245
252
  case 'stick':
246
253
  const offsetTop = this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
247
- if (typeof offsetTop === 'number') {
248
- var _this$props$stickyHea3, _this$props$stickyHea4;
249
- const defaultScrollRootOffsetTop = (_this$props$stickyHea3 = (_this$props$stickyHea4 = this.props.stickyHeaders) === null || _this$props$stickyHea4 === void 0 ? void 0 : _this$props$stickyHea4.defaultScrollRootTop_DO_NOT_USE) !== null && _this$props$stickyHea3 !== void 0 ? _this$props$stickyHea3 : 0;
250
- return offsetTop + defaultScrollRootOffsetTop;
254
+ if (typeof offsetTop === 'number' && this.shouldAddOverflowParentOffsetTop_DO_NOT_USE) {
255
+ const overflowParentOffsetTop = this.overflowParent ? this.overflowParent.top : 0;
256
+ return offsetTop + overflowParentOffsetTop;
251
257
  } else {
252
258
  return offsetTop;
253
259
  }
@@ -5,8 +5,9 @@ import { validateADFEntity, findAndTrackUnsupportedContentNodes } from '@atlaski
5
5
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
6
6
  import { PLATFORM } from './analytics/events';
7
7
  import { trackUnsupportedContentLevels } from './analytics/unsupported-content';
8
- import { transformMediaLinkMarks } from '@atlaskit/adf-utils/transforms';
8
+ import { transformMediaLinkMarks, transformNestedTablesIncomingDocument } from '@atlaskit/adf-utils/transforms';
9
9
  import { countNodes } from './ui/Renderer/count-nodes';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  const SUPPORTS_HIRES_TIMER_API = !!(typeof window !== 'undefined' && window.performance && performance.now);
11
12
  const withStopwatch = cb => {
12
13
  const startTime = SUPPORTS_HIRES_TIMER_API ? performance.now() : Date.now();
@@ -56,6 +57,33 @@ const _validation = (doc, schema, adfStage, useSpecBasedValidator, dispatchAnaly
56
57
  result.version = 1;
57
58
  }
58
59
  }
60
+ if (fg('platform_editor_use_nested_table_pm_nodes')) {
61
+ // Convert nested-table extensions into nested tables
62
+ try {
63
+ const {
64
+ transformedAdf,
65
+ isTransformed
66
+ } = transformNestedTablesIncomingDocument(result);
67
+ if (isTransformed) {
68
+ dispatchAnalyticsEvent === null || dispatchAnalyticsEvent === void 0 ? void 0 : dispatchAnalyticsEvent({
69
+ action: ACTION.NESTED_TABLE_TRANSFORMED,
70
+ actionSubject: ACTION_SUBJECT.RENDERER,
71
+ eventType: EVENT_TYPE.OPERATIONAL
72
+ });
73
+ result = transformedAdf;
74
+ }
75
+ } catch (e) {
76
+ dispatchAnalyticsEvent === null || dispatchAnalyticsEvent === void 0 ? void 0 : dispatchAnalyticsEvent({
77
+ action: ACTION.INVALID_PROSEMIRROR_DOCUMENT,
78
+ actionSubject: ACTION_SUBJECT.RENDERER,
79
+ eventType: EVENT_TYPE.OPERATIONAL,
80
+ attributes: {
81
+ platform: PLATFORM.WEB,
82
+ errorStack: 'Failed to transform one or more nested tables in the document'
83
+ }
84
+ });
85
+ }
86
+ }
59
87
  return result;
60
88
  };
61
89
  const memoValidation = memoizeOne(_validation, (newArgs, lastArgs) => {
@@ -45,7 +45,7 @@ import { countNodes } from './count-nodes';
45
45
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
46
46
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
47
47
  const packageName = "@atlaskit/renderer";
48
- const packageVersion = "112.4.0";
48
+ const packageVersion = "112.5.0";
49
49
  const setAsQueryContainerStyles = css({
50
50
  containerName: 'ak-renderer-wrapper',
51
51
  containerType: 'inline-size',
@@ -164,7 +164,7 @@ export var StickyTable = function StickyTable(_ref) {
164
164
  /**
165
165
  * Traverse DOM Tree upwards looking for table parents with "overflow: scroll".
166
166
  */
167
- function findHorizontalOverflowScrollParent(table, defaultScrollRootEl) {
167
+ function findHorizontalOverflowScrollParent(table, defaultScrollRootId) {
168
168
  var parent = table;
169
169
  if (!parent) {
170
170
  return null;
@@ -175,9 +175,9 @@ function findHorizontalOverflowScrollParent(table, defaultScrollRootEl) {
175
175
  if (style.overflow === 'scroll' || style.overflowY === 'scroll') {
176
176
  return parent;
177
177
  }
178
- if (!!defaultScrollRootEl && defaultScrollRootEl === parent) {
179
- // If a defaultScrollRootEl was specified and we reached it without finding a closer scroll parent,
180
- // use the defaultScrollRootEl.
178
+ if (!!defaultScrollRootId && parent.id === defaultScrollRootId) {
179
+ // If a defaultScrollRootId was specified and we reached the element with this id without finding a closer
180
+ // scroll parent, use this element as the scroll parent
181
181
  return parent;
182
182
  }
183
183
  }
@@ -194,6 +194,14 @@ export var OverflowParent = /*#__PURE__*/function () {
194
194
  get: function get() {
195
195
  return this.ref instanceof HTMLElement;
196
196
  }
197
+ }, {
198
+ key: "id",
199
+ get: function get() {
200
+ if (this.ref instanceof HTMLElement) {
201
+ return this.ref.id;
202
+ }
203
+ return '';
204
+ }
197
205
  }, {
198
206
  key: "top",
199
207
  get: function get() {
@@ -222,8 +230,8 @@ export var OverflowParent = /*#__PURE__*/function () {
222
230
  }
223
231
  }], [{
224
232
  key: "fromElement",
225
- value: function fromElement(el, defaultScrollRootEl) {
226
- return new OverflowParent(findHorizontalOverflowScrollParent(el, defaultScrollRootEl) || window);
233
+ value: function fromElement(el, defaultScrollRootId) {
234
+ return new OverflowParent(findHorizontalOverflowScrollParent(el, defaultScrollRootId) || window);
227
235
  }
228
236
  }]);
229
237
  return OverflowParent;
@@ -247,7 +247,7 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
247
247
  }
248
248
  if (this.props.stickyHeaders) {
249
249
  var _this$props$stickyHea;
250
- this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea = this.props.stickyHeaders) === null || _this$props$stickyHea === void 0 ? void 0 : _this$props$stickyHea.defaultScrollRoot_DO_NOT_USE);
250
+ this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea = this.props.stickyHeaders) === null || _this$props$stickyHea === void 0 ? void 0 : _this$props$stickyHea.defaultScrollRootId_DO_NOT_USE);
251
251
  this.overflowParent.addEventListener('scroll', this.onScroll);
252
252
  }
253
253
  if (this.wrapperRef.current && isStickyScrollbarEnabled(this.props.rendererAppearance)) {
@@ -260,7 +260,7 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
260
260
  // toggling sticky headers visiblity
261
261
  if (this.props.stickyHeaders && !this.overflowParent) {
262
262
  var _this$props$stickyHea2;
263
- this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea2 = this.props.stickyHeaders) === null || _this$props$stickyHea2 === void 0 ? void 0 : _this$props$stickyHea2.defaultScrollRoot_DO_NOT_USE);
263
+ this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea2 = this.props.stickyHeaders) === null || _this$props$stickyHea2 === void 0 ? void 0 : _this$props$stickyHea2.defaultScrollRootId_DO_NOT_USE);
264
264
  } else if (!this.props.stickyHeaders && this.overflowParent) {
265
265
  this.overflowParent.removeEventListener('scroll', this.onScroll);
266
266
  this.overflowParent = null;
@@ -284,6 +284,15 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
284
284
  }
285
285
  return this.tableRef.current.offsetHeight - this.stickyHeaderRef.current.offsetHeight + tableMarginTop - tableStickyPadding;
286
286
  }
287
+ }, {
288
+ key: "shouldAddOverflowParentOffsetTop_DO_NOT_USE",
289
+ get: function get() {
290
+ // IF the StickyHeaderConfig specifies that the default scroll root offsetTop should be added
291
+ // AND the StickyHeaderConfig specifies a default scroll root id
292
+ // AND the OverflowParent is the corresponding element
293
+ // THEN we should add the OverflowParent offset top (RETURN TRUE)
294
+ return this.props.stickyHeaders && !!this.props.stickyHeaders.shouldAddDefaultScrollRootOffsetTop_DO_NOT_USE && !!this.props.stickyHeaders.defaultScrollRootId_DO_NOT_USE && this.overflowParent && this.overflowParent.id === this.props.stickyHeaders.defaultScrollRootId_DO_NOT_USE;
295
+ }
287
296
  }, {
288
297
  key: "stickyTop",
289
298
  get: function get() {
@@ -292,10 +301,9 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
292
301
  return this.pinTop;
293
302
  case 'stick':
294
303
  var offsetTop = this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
295
- if (typeof offsetTop === 'number') {
296
- var _this$props$stickyHea3, _this$props$stickyHea4;
297
- var defaultScrollRootOffsetTop = (_this$props$stickyHea3 = (_this$props$stickyHea4 = this.props.stickyHeaders) === null || _this$props$stickyHea4 === void 0 ? void 0 : _this$props$stickyHea4.defaultScrollRootTop_DO_NOT_USE) !== null && _this$props$stickyHea3 !== void 0 ? _this$props$stickyHea3 : 0;
298
- return offsetTop + defaultScrollRootOffsetTop;
304
+ if (typeof offsetTop === 'number' && this.shouldAddOverflowParentOffsetTop_DO_NOT_USE) {
305
+ var overflowParentOffsetTop = this.overflowParent ? this.overflowParent.top : 0;
306
+ return offsetTop + overflowParentOffsetTop;
299
307
  } else {
300
308
  return offsetTop;
301
309
  }
@@ -6,8 +6,9 @@ import { validateADFEntity, findAndTrackUnsupportedContentNodes } from '@atlaski
6
6
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
7
7
  import { PLATFORM } from './analytics/events';
8
8
  import { trackUnsupportedContentLevels } from './analytics/unsupported-content';
9
- import { transformMediaLinkMarks } from '@atlaskit/adf-utils/transforms';
9
+ import { transformMediaLinkMarks, transformNestedTablesIncomingDocument } from '@atlaskit/adf-utils/transforms';
10
10
  import { countNodes } from './ui/Renderer/count-nodes';
11
+ import { fg } from '@atlaskit/platform-feature-flags';
11
12
  var SUPPORTS_HIRES_TIMER_API = !!(typeof window !== 'undefined' && window.performance && performance.now);
12
13
  var withStopwatch = function withStopwatch(cb) {
13
14
  var startTime = SUPPORTS_HIRES_TIMER_API ? performance.now() : Date.now();
@@ -56,6 +57,32 @@ var _validation = function _validation(doc, schema, adfStage, useSpecBasedValida
56
57
  result.version = 1;
57
58
  }
58
59
  }
60
+ if (fg('platform_editor_use_nested_table_pm_nodes')) {
61
+ // Convert nested-table extensions into nested tables
62
+ try {
63
+ var _transformNestedTable = transformNestedTablesIncomingDocument(result),
64
+ _transformedAdf = _transformNestedTable.transformedAdf,
65
+ _isTransformed = _transformNestedTable.isTransformed;
66
+ if (_isTransformed) {
67
+ dispatchAnalyticsEvent === null || dispatchAnalyticsEvent === void 0 || dispatchAnalyticsEvent({
68
+ action: ACTION.NESTED_TABLE_TRANSFORMED,
69
+ actionSubject: ACTION_SUBJECT.RENDERER,
70
+ eventType: EVENT_TYPE.OPERATIONAL
71
+ });
72
+ result = _transformedAdf;
73
+ }
74
+ } catch (e) {
75
+ dispatchAnalyticsEvent === null || dispatchAnalyticsEvent === void 0 || dispatchAnalyticsEvent({
76
+ action: ACTION.INVALID_PROSEMIRROR_DOCUMENT,
77
+ actionSubject: ACTION_SUBJECT.RENDERER,
78
+ eventType: EVENT_TYPE.OPERATIONAL,
79
+ attributes: {
80
+ platform: PLATFORM.WEB,
81
+ errorStack: 'Failed to transform one or more nested tables in the document'
82
+ }
83
+ });
84
+ }
85
+ }
59
86
  return result;
60
87
  };
61
88
  var memoValidation = memoizeOne(_validation, function (newArgs, lastArgs) {
@@ -55,7 +55,7 @@ import { countNodes } from './count-nodes';
55
55
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
56
56
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
57
57
  var packageName = "@atlaskit/renderer";
58
- var packageVersion = "112.4.0";
58
+ var packageVersion = "112.5.0";
59
59
  var setAsQueryContainerStyles = css({
60
60
  containerName: 'ak-renderer-wrapper',
61
61
  containerType: 'inline-size',
@@ -114,6 +114,7 @@ type RendererTTIAEP = AEP<ACTION.RENDERER_TTI, ACTION_SUBJECT.RENDERER, undefine
114
114
  ttiFromInvocation: number;
115
115
  canceled: boolean;
116
116
  }, EVENT_TYPE.OPERATIONAL>;
117
- export type AnalyticsEventPayload<T = void> = RendererStartAEP | RendererRenderedAEP | ComponentCrashErrorAEP | RendererUnsupportedContentLevelsTrackingSucceeded | RendererUnsupportedContentLevelsTrackingErrored | RendererSelectAllCaughtAEP | RendererSelectAllEscapedAEP | CodeBlockCopyAEP | CodeBlockWrapAEP | HeadingAnchorLinkButtonAEP | AnchorLinkAEP | TableSortColumnNotAllowedAEP | TableSortColumnAEP | VisitLinkAEP | VisitMediaLinkAEP | ExpandAEP | UnsupportedContentPayload | UnsupportedContentTooltipPayload | AnnotationAEP | AnnotationDeleteAEP | MediaLnkTransformedAEP | InvalidProsemirrorDocumentErrorAEP | RendererTTIAEP;
117
+ type NestedTableTransformedAEP = OperationalAEP<ACTION.NESTED_TABLE_TRANSFORMED, ACTION_SUBJECT.RENDERER, undefined, undefined>;
118
+ export type AnalyticsEventPayload<T = void> = RendererStartAEP | RendererRenderedAEP | ComponentCrashErrorAEP | RendererUnsupportedContentLevelsTrackingSucceeded | RendererUnsupportedContentLevelsTrackingErrored | RendererSelectAllCaughtAEP | RendererSelectAllEscapedAEP | CodeBlockCopyAEP | CodeBlockWrapAEP | HeadingAnchorLinkButtonAEP | AnchorLinkAEP | TableSortColumnNotAllowedAEP | TableSortColumnAEP | VisitLinkAEP | VisitMediaLinkAEP | ExpandAEP | UnsupportedContentPayload | UnsupportedContentTooltipPayload | AnnotationAEP | AnnotationDeleteAEP | MediaLnkTransformedAEP | InvalidProsemirrorDocumentErrorAEP | RendererTTIAEP | NestedTableTransformedAEP;
118
119
  export type FireAnalyticsCallback = <T = void>(payload: AnalyticsEventPayload<T>) => void | undefined;
119
120
  export {};
@@ -31,8 +31,9 @@ export declare const StickyTable: ({ top, left, mode, shadowClassNames, innerRef
31
31
  export declare class OverflowParent {
32
32
  private ref;
33
33
  private constructor();
34
- static fromElement(el: HTMLElement | null, defaultScrollRootEl?: HTMLElement): OverflowParent;
34
+ static fromElement(el: HTMLElement | null, defaultScrollRootId?: string): OverflowParent;
35
35
  get isElement(): boolean;
36
+ get id(): string;
36
37
  get top(): number;
37
38
  addEventListener(type: string, cb: EventListenerOrEventListenerObject, ...args: any[]): void;
38
39
  removeEventListener(type: string, cb: EventListenerOrEventListenerObject, ...args: any[]): void;
@@ -48,6 +48,7 @@ export declare class TableContainer extends React.Component<TableProps & Overflo
48
48
  onScroll: () => void;
49
49
  onWrapperScrolled: () => void;
50
50
  get pinTop(): number | undefined;
51
+ get shouldAddOverflowParentOffsetTop_DO_NOT_USE(): boolean | null | undefined;
51
52
  get stickyTop(): number | undefined;
52
53
  render(): JSX.Element;
53
54
  private grabFirstRowRef;
@@ -7,17 +7,17 @@ export type RendererAppearance = 'comment' | 'full-page' | 'full-width' | undefi
7
7
  *
8
8
  * They will be cleaned up ASAP after Confluence refactors its page layout to add an explicit scroll container (DISCO-3121)
9
9
  *
10
- * `defaultScrollRoot_DO_NOT_USE` - defaults to undefined - can be used to specify the default OverflowParent if the table
11
- * doesn't have a parent that explicitly specifies `overflow: scroll` or `overflow-y: scroll`. When undefined, the
12
- * default OverflowParent will be the window
13
- * `defaultScrollRootTop_DO_NOT_USE` - defaults to 0 - can be used to specify any offset that should be applied to the
14
- * sticky table header offset but does not need to be included when determining if the header should be sticky.
15
- * This is required bcause the llogic that determines if the header should be sticky takes the OverflowParent.offsetTop
10
+ * `defaultScrollRootId_DO_NOT_USE` - defaults to undefined - can be used to specify the id of default OverflowParent if
11
+ * the table doesn't have a parent that explicitly specifies `overflow: scroll` or `overflow-y: scroll`. When undefined,
12
+ * the default OverflowParent will be the window
13
+ * `shouldAddDefaultScrollRootOffsetTop_DO_NOT_USE` - defaults to false - can be used to specify that if the OverflowParent
14
+ * is the default one specificed, then the sticky table header offset should include the OverflowParent offset.
15
+ * This is required because the logic that determines if the header should be sticky always takes the OverflowParent.offsetTop
16
16
  * into account. But the calculation to get the actual header offset does not.
17
17
  */
18
18
  type StickyHeaderConfig_DO_NOT_USE = {
19
- defaultScrollRoot_DO_NOT_USE?: HTMLElement;
20
- defaultScrollRootTop_DO_NOT_USE?: number;
19
+ defaultScrollRootId_DO_NOT_USE?: string;
20
+ shouldAddDefaultScrollRootOffsetTop_DO_NOT_USE?: boolean;
21
21
  };
22
22
  export type StickyHeaderConfig = {
23
23
  offsetTop?: number;
@@ -114,6 +114,7 @@ type RendererTTIAEP = AEP<ACTION.RENDERER_TTI, ACTION_SUBJECT.RENDERER, undefine
114
114
  ttiFromInvocation: number;
115
115
  canceled: boolean;
116
116
  }, EVENT_TYPE.OPERATIONAL>;
117
- export type AnalyticsEventPayload<T = void> = RendererStartAEP | RendererRenderedAEP | ComponentCrashErrorAEP | RendererUnsupportedContentLevelsTrackingSucceeded | RendererUnsupportedContentLevelsTrackingErrored | RendererSelectAllCaughtAEP | RendererSelectAllEscapedAEP | CodeBlockCopyAEP | CodeBlockWrapAEP | HeadingAnchorLinkButtonAEP | AnchorLinkAEP | TableSortColumnNotAllowedAEP | TableSortColumnAEP | VisitLinkAEP | VisitMediaLinkAEP | ExpandAEP | UnsupportedContentPayload | UnsupportedContentTooltipPayload | AnnotationAEP | AnnotationDeleteAEP | MediaLnkTransformedAEP | InvalidProsemirrorDocumentErrorAEP | RendererTTIAEP;
117
+ type NestedTableTransformedAEP = OperationalAEP<ACTION.NESTED_TABLE_TRANSFORMED, ACTION_SUBJECT.RENDERER, undefined, undefined>;
118
+ export type AnalyticsEventPayload<T = void> = RendererStartAEP | RendererRenderedAEP | ComponentCrashErrorAEP | RendererUnsupportedContentLevelsTrackingSucceeded | RendererUnsupportedContentLevelsTrackingErrored | RendererSelectAllCaughtAEP | RendererSelectAllEscapedAEP | CodeBlockCopyAEP | CodeBlockWrapAEP | HeadingAnchorLinkButtonAEP | AnchorLinkAEP | TableSortColumnNotAllowedAEP | TableSortColumnAEP | VisitLinkAEP | VisitMediaLinkAEP | ExpandAEP | UnsupportedContentPayload | UnsupportedContentTooltipPayload | AnnotationAEP | AnnotationDeleteAEP | MediaLnkTransformedAEP | InvalidProsemirrorDocumentErrorAEP | RendererTTIAEP | NestedTableTransformedAEP;
118
119
  export type FireAnalyticsCallback = <T = void>(payload: AnalyticsEventPayload<T>) => void | undefined;
119
120
  export {};
@@ -31,8 +31,9 @@ export declare const StickyTable: ({ top, left, mode, shadowClassNames, innerRef
31
31
  export declare class OverflowParent {
32
32
  private ref;
33
33
  private constructor();
34
- static fromElement(el: HTMLElement | null, defaultScrollRootEl?: HTMLElement): OverflowParent;
34
+ static fromElement(el: HTMLElement | null, defaultScrollRootId?: string): OverflowParent;
35
35
  get isElement(): boolean;
36
+ get id(): string;
36
37
  get top(): number;
37
38
  addEventListener(type: string, cb: EventListenerOrEventListenerObject, ...args: any[]): void;
38
39
  removeEventListener(type: string, cb: EventListenerOrEventListenerObject, ...args: any[]): void;
@@ -48,6 +48,7 @@ export declare class TableContainer extends React.Component<TableProps & Overflo
48
48
  onScroll: () => void;
49
49
  onWrapperScrolled: () => void;
50
50
  get pinTop(): number | undefined;
51
+ get shouldAddOverflowParentOffsetTop_DO_NOT_USE(): boolean | null | undefined;
51
52
  get stickyTop(): number | undefined;
52
53
  render(): JSX.Element;
53
54
  private grabFirstRowRef;
@@ -7,17 +7,17 @@ export type RendererAppearance = 'comment' | 'full-page' | 'full-width' | undefi
7
7
  *
8
8
  * They will be cleaned up ASAP after Confluence refactors its page layout to add an explicit scroll container (DISCO-3121)
9
9
  *
10
- * `defaultScrollRoot_DO_NOT_USE` - defaults to undefined - can be used to specify the default OverflowParent if the table
11
- * doesn't have a parent that explicitly specifies `overflow: scroll` or `overflow-y: scroll`. When undefined, the
12
- * default OverflowParent will be the window
13
- * `defaultScrollRootTop_DO_NOT_USE` - defaults to 0 - can be used to specify any offset that should be applied to the
14
- * sticky table header offset but does not need to be included when determining if the header should be sticky.
15
- * This is required bcause the llogic that determines if the header should be sticky takes the OverflowParent.offsetTop
10
+ * `defaultScrollRootId_DO_NOT_USE` - defaults to undefined - can be used to specify the id of default OverflowParent if
11
+ * the table doesn't have a parent that explicitly specifies `overflow: scroll` or `overflow-y: scroll`. When undefined,
12
+ * the default OverflowParent will be the window
13
+ * `shouldAddDefaultScrollRootOffsetTop_DO_NOT_USE` - defaults to false - can be used to specify that if the OverflowParent
14
+ * is the default one specificed, then the sticky table header offset should include the OverflowParent offset.
15
+ * This is required because the logic that determines if the header should be sticky always takes the OverflowParent.offsetTop
16
16
  * into account. But the calculation to get the actual header offset does not.
17
17
  */
18
18
  type StickyHeaderConfig_DO_NOT_USE = {
19
- defaultScrollRoot_DO_NOT_USE?: HTMLElement;
20
- defaultScrollRootTop_DO_NOT_USE?: number;
19
+ defaultScrollRootId_DO_NOT_USE?: string;
20
+ shouldAddDefaultScrollRootOffsetTop_DO_NOT_USE?: boolean;
21
21
  };
22
22
  export type StickyHeaderConfig = {
23
23
  offsetTop?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "112.4.0",
3
+ "version": "112.5.0",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -23,14 +23,14 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@atlaskit/adf-schema": "^44.2.0",
26
- "@atlaskit/adf-utils": "^19.10.0",
26
+ "@atlaskit/adf-utils": "^19.12.0",
27
27
  "@atlaskit/analytics-listeners": "^8.11.0",
28
28
  "@atlaskit/analytics-namespaced-context": "^6.12.0",
29
29
  "@atlaskit/analytics-next": "^10.1.0",
30
30
  "@atlaskit/button": "^20.3.0",
31
31
  "@atlaskit/code": "^15.6.0",
32
- "@atlaskit/editor-common": "^94.13.0",
33
- "@atlaskit/editor-json-transformer": "^8.20.0",
32
+ "@atlaskit/editor-common": "^94.17.0",
33
+ "@atlaskit/editor-json-transformer": "^8.21.0",
34
34
  "@atlaskit/editor-palette": "1.6.3",
35
35
  "@atlaskit/editor-prosemirror": "6.0.0",
36
36
  "@atlaskit/editor-shared-styles": "^3.2.0",
@@ -38,13 +38,13 @@
38
38
  "@atlaskit/feature-gate-js-client": "^4.22.0",
39
39
  "@atlaskit/icon": "^22.24.0",
40
40
  "@atlaskit/link-datasource": "^3.8.0",
41
- "@atlaskit/media-card": "^78.11.0",
42
- "@atlaskit/media-client": "^28.0.0",
41
+ "@atlaskit/media-card": "^78.12.0",
42
+ "@atlaskit/media-client": "^28.2.0",
43
43
  "@atlaskit/media-client-react": "^2.3.0",
44
44
  "@atlaskit/media-common": "^11.7.0",
45
- "@atlaskit/media-filmstrip": "^47.4.0",
46
- "@atlaskit/media-ui": "^26.0.0",
47
- "@atlaskit/media-viewer": "^49.2.0",
45
+ "@atlaskit/media-filmstrip": "^47.5.0",
46
+ "@atlaskit/media-ui": "^26.1.0",
47
+ "@atlaskit/media-viewer": "^49.3.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.3.0",
49
49
  "@atlaskit/smart-card": "^30.2.0",
50
50
  "@atlaskit/status": "^1.5.0",
@@ -52,7 +52,7 @@
52
52
  "@atlaskit/theme": "^14.0.0",
53
53
  "@atlaskit/tmp-editor-statsig": "^2.12.0",
54
54
  "@atlaskit/tokens": "^2.2.0",
55
- "@atlaskit/tooltip": "^18.8.0",
55
+ "@atlaskit/tooltip": "^18.9.0",
56
56
  "@babel/runtime": "^7.0.0",
57
57
  "@emotion/react": "^11.7.1",
58
58
  "lodash": "^4.17.21",
@@ -77,7 +77,7 @@
77
77
  "@atlaskit/linking-common": "^6.0.0",
78
78
  "@atlaskit/media-core": "^34.3.0",
79
79
  "@atlaskit/media-integration-test-helpers": "^3.1.0",
80
- "@atlaskit/media-test-helpers": "^34.5.0",
80
+ "@atlaskit/media-test-helpers": "^34.6.0",
81
81
  "@atlaskit/mention": "^23.3.0",
82
82
  "@atlaskit/navigation-next": "^9.0.0",
83
83
  "@atlaskit/util-data-test": "^17.12.0",
@@ -126,7 +126,7 @@
126
126
  "annotations_align_editor_and_renderer_styles": {
127
127
  "type": "boolean"
128
128
  },
129
- "platform_editor_react18_phase2": {
129
+ "platform_editor_react18_phase2_v2": {
130
130
  "type": "boolean"
131
131
  },
132
132
  "platform-fix-table-ssr-resizing": {
@@ -149,6 +149,9 @@
149
149
  },
150
150
  "platform_editor_advanced_layouts_breakout_resizing": {
151
151
  "type": "boolean"
152
+ },
153
+ "platform_editor_use_nested_table_pm_nodes": {
154
+ "type": "boolean"
152
155
  }
153
156
  },
154
157
  "af:exports": {