@atlaskit/editor-plugin-table 10.4.2 → 10.4.4

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,42 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 10.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#128159](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128159)
8
+ [`fa48f40aa6143`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fa48f40aa6143) -
9
+ ED-26887 Fix flickering in create issue modal when scrolling slowly and there is table inside it
10
+ - Updated dependencies
11
+
12
+ ## 10.4.3
13
+
14
+ ### Patch Changes
15
+
16
+ - [#126154](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/126154)
17
+ [`be67d47906a7f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/be67d47906a7f) -
18
+ [ED-27099]
19
+
20
+ # Improvements
21
+
22
+ Feature Flag: `platform_editor_table_layout_shift_fix`
23
+
24
+ - Make all Editor block nodes a proper inline container
25
+
26
+ Feature Flag: `platform_editor_render_table_fallback_to_dom_on_ssr`
27
+
28
+ - Always render the Table.toDOM when on SSR
29
+
30
+ # Clean up
31
+
32
+ `platform_editor_exp_lazy_node_views`
33
+
34
+ - Make the `tableNodeSpecWithFixedToDOM` the default `Table.toDOM`
35
+
36
+ `platform_editor_table_layout_shift_fix`
37
+
38
+ - Fix the typo `px` typo
39
+
3
40
  ## 10.4.2
4
41
 
5
42
  ### Patch Changes
@@ -133,16 +133,21 @@ var TableStickyScrollbar = exports.TableStickyScrollbar = /*#__PURE__*/function
133
133
  }, {
134
134
  key: "sentinelBottomCallback",
135
135
  value: function sentinelBottomCallback(entry) {
136
- var _entry$rootBounds2;
137
- var sentinelIsAboveScrollArea = entry.boundingClientRect.top < (((_entry$rootBounds2 = entry.rootBounds) === null || _entry$rootBounds2 === void 0 ? void 0 : _entry$rootBounds2.top) || 0);
136
+ var _entry$rootBounds2, _entry$rootBounds3;
137
+ var sentinelIsAboveScrollArea = entry.boundingClientRect.top < (((_entry$rootBounds2 = entry.rootBounds) === null || _entry$rootBounds2 === void 0 ? void 0 : _entry$rootBounds2.top) || 0) ||
138
+ // When editorScrollableElement is the root document or inside modal,
139
+ // so the boundingClientRect.top will never be less than the rootBounds.top,
140
+ // so we need to check if the boundingClientRect.top is less than 20% of the rootBounds.height
141
+ // to determine if the bottom sentinel is above the scroll area
142
+ entry.boundingClientRect.top < (((_entry$rootBounds3 = entry.rootBounds) === null || _entry$rootBounds3 === void 0 ? void 0 : _entry$rootBounds3.height) || 0) * 0.2 && (0, _platformFeatureFlags.fg)('platform_editor_scroll_table_flickering_fix');
138
143
  this.bottomSentinelState = sentinelIsAboveScrollArea ? 'above' : entry.isIntersecting ? 'visible' : 'below';
139
144
  this.toggle();
140
145
  }
141
146
  }, {
142
147
  key: "sentinelTopCallback",
143
148
  value: function sentinelTopCallback(entry) {
144
- var _entry$rootBounds3;
145
- var sentinelIsBelowScrollArea = (((_entry$rootBounds3 = entry.rootBounds) === null || _entry$rootBounds3 === void 0 ? void 0 : _entry$rootBounds3.bottom) || 0) < entry.boundingClientRect.top;
149
+ var _entry$rootBounds4;
150
+ var sentinelIsBelowScrollArea = (((_entry$rootBounds4 = entry.rootBounds) === null || _entry$rootBounds4 === void 0 ? void 0 : _entry$rootBounds4.bottom) || 0) < entry.boundingClientRect.top;
146
151
  this.topSentinelState = sentinelIsBelowScrollArea ? 'below' : entry.isIntersecting ? 'visible' : 'above';
147
152
  this.toggle();
148
153
  }
@@ -12,8 +12,6 @@ var _kebabCase = _interopRequireDefault(require("lodash/kebabCase"));
12
12
  var _adfSchema = require("@atlaskit/adf-schema");
13
13
  var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
14
14
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
15
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
17
15
  var _colgroup = require("../pm-plugins/table-resizing/utils/colgroup");
18
16
  var _consts = require("../pm-plugins/table-resizing/utils/consts");
19
17
  var _tableContainerStyles = require("./table-container-styles");
@@ -21,9 +19,6 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
21
19
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
22
20
  var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(config) {
23
21
  var tableNode = config.isNestingSupported ? _adfSchema.tableWithNestedTable : _adfSchema.table;
24
- if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false)) {
25
- return tableNode;
26
- }
27
22
  return _objectSpread(_objectSpread({}, tableNode), {}, {
28
23
  toDOM: function toDOM(node) {
29
24
  var gutterPadding = (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2;
@@ -76,12 +71,13 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
76
71
  class: 'tableView-content-wrap'
77
72
  }, tableContainerDiv];
78
73
  }
74
+ var tableWidthAttribute = node.attrs.width ? "".concat(node.attrs.width, "px") : "100%";
79
75
  var tableResizingDiv = ['div', {
80
76
  'data-testid': 'table-alignment-container',
81
77
  style: alignmentStyle
82
78
  }, ['div', {
83
79
  class: 'pm-table-resizer-container',
84
- style: "width: min(calc(100cqw - ".concat(gutterPadding, "px), ").concat(node.attrs.width, "px);")
80
+ style: "width: min(calc(100cqw - ".concat(gutterPadding, "px), ").concat(tableWidthAttribute, ");")
85
81
  }, ['div', {
86
82
  class: 'resizer-item display-handle',
87
83
  style: (0, _lazyNodeView.convertToInlineCss)({
@@ -93,7 +89,7 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
93
89
  '--ak-editor-table-min-width': "".concat(tableMinWidth, "px"),
94
90
  minWidth: 'var(--ak-editor-table-min-width)',
95
91
  maxWidth: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))",
96
- width: (0, _platformFeatureFlags.fg)('platform_editor_table_layout_shift_fix') ? "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(node.attrs.width, "px)") : "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(node.attrs.width, ")")
92
+ width: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(tableWidthAttribute, ")")
97
93
  })
98
94
  }, ['span', {
99
95
  class: 'resizer-hover-zone'
@@ -59,6 +59,29 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
59
59
  }
60
60
  return editorView.state;
61
61
  };
62
+ var nodeViews = (0, _coreUtils.isSSR)() && (0, _platformFeatureFlags.fg)('platform_editor_table_fallback_to_dom_on_ssr') ? undefined : {
63
+ table: (0, _lazyNodeViews.lazyTableView)({
64
+ portalProviderAPI: portalProviderAPI,
65
+ eventDispatcher: eventDispatcher,
66
+ getEditorContainerWidth: getEditorContainerWidth,
67
+ getEditorFeatureFlags: getEditorFeatureFlags,
68
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
69
+ pluginInjectionApi: pluginInjectionApi,
70
+ isCommentEditor: isCommentEditor,
71
+ isChromelessEditor: isChromelessEditor
72
+ }),
73
+ tableRow: (0, _lazyNodeViews.lazyTableRowView)({
74
+ eventDispatcher: eventDispatcher
75
+ }),
76
+ tableCell: (0, _lazyNodeViews.lazyTableCellView)({
77
+ eventDispatcher: eventDispatcher,
78
+ pluginInjectionApi: pluginInjectionApi
79
+ }),
80
+ tableHeader: (0, _lazyNodeViews.lazyTableHeaderView)({
81
+ eventDispatcher: eventDispatcher,
82
+ pluginInjectionApi: pluginInjectionApi
83
+ })
84
+ };
62
85
  return new _safePlugin.SafePlugin({
63
86
  state: state,
64
87
  key: _pluginKey.pluginKey,
@@ -275,29 +298,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
275
298
  }
276
299
  return false;
277
300
  },
278
- nodeViews: {
279
- table: (0, _lazyNodeViews.lazyTableView)({
280
- portalProviderAPI: portalProviderAPI,
281
- eventDispatcher: eventDispatcher,
282
- getEditorContainerWidth: getEditorContainerWidth,
283
- getEditorFeatureFlags: getEditorFeatureFlags,
284
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
285
- pluginInjectionApi: pluginInjectionApi,
286
- isCommentEditor: isCommentEditor,
287
- isChromelessEditor: isChromelessEditor
288
- }),
289
- tableRow: (0, _lazyNodeViews.lazyTableRowView)({
290
- eventDispatcher: eventDispatcher
291
- }),
292
- tableCell: (0, _lazyNodeViews.lazyTableCellView)({
293
- eventDispatcher: eventDispatcher,
294
- pluginInjectionApi: pluginInjectionApi
295
- }),
296
- tableHeader: (0, _lazyNodeViews.lazyTableHeaderView)({
297
- eventDispatcher: eventDispatcher,
298
- pluginInjectionApi: pluginInjectionApi
299
- })
300
- },
301
+ nodeViews: nodeViews,
301
302
  handleDOMEvents: {
302
303
  focus: _eventHandlers.handleFocus,
303
304
  blur: _eventHandlers.handleBlur,
@@ -107,14 +107,19 @@ export class TableStickyScrollbar {
107
107
  }
108
108
  }
109
109
  sentinelBottomCallback(entry) {
110
- var _entry$rootBounds2;
111
- const sentinelIsAboveScrollArea = entry.boundingClientRect.top < (((_entry$rootBounds2 = entry.rootBounds) === null || _entry$rootBounds2 === void 0 ? void 0 : _entry$rootBounds2.top) || 0);
110
+ var _entry$rootBounds2, _entry$rootBounds3;
111
+ const sentinelIsAboveScrollArea = entry.boundingClientRect.top < (((_entry$rootBounds2 = entry.rootBounds) === null || _entry$rootBounds2 === void 0 ? void 0 : _entry$rootBounds2.top) || 0) ||
112
+ // When editorScrollableElement is the root document or inside modal,
113
+ // so the boundingClientRect.top will never be less than the rootBounds.top,
114
+ // so we need to check if the boundingClientRect.top is less than 20% of the rootBounds.height
115
+ // to determine if the bottom sentinel is above the scroll area
116
+ entry.boundingClientRect.top < (((_entry$rootBounds3 = entry.rootBounds) === null || _entry$rootBounds3 === void 0 ? void 0 : _entry$rootBounds3.height) || 0) * 0.2 && fg('platform_editor_scroll_table_flickering_fix');
112
117
  this.bottomSentinelState = sentinelIsAboveScrollArea ? 'above' : entry.isIntersecting ? 'visible' : 'below';
113
118
  this.toggle();
114
119
  }
115
120
  sentinelTopCallback(entry) {
116
- var _entry$rootBounds3;
117
- const sentinelIsBelowScrollArea = (((_entry$rootBounds3 = entry.rootBounds) === null || _entry$rootBounds3 === void 0 ? void 0 : _entry$rootBounds3.bottom) || 0) < entry.boundingClientRect.top;
121
+ var _entry$rootBounds4;
122
+ const sentinelIsBelowScrollArea = (((_entry$rootBounds4 = entry.rootBounds) === null || _entry$rootBounds4 === void 0 ? void 0 : _entry$rootBounds4.bottom) || 0) < entry.boundingClientRect.top;
118
123
  this.topSentinelState = sentinelIsBelowScrollArea ? 'below' : entry.isIntersecting ? 'visible' : 'above';
119
124
  this.toggle();
120
125
  }
@@ -2,16 +2,11 @@ import kebabCase from 'lodash/kebabCase';
2
2
  import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
3
3
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
4
4
  import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
5
- import { fg } from '@atlaskit/platform-feature-flags';
6
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
5
  import { generateColgroup, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
8
6
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
9
7
  import { getAlignmentStyle } from './table-container-styles';
10
8
  export const tableNodeSpecWithFixedToDOM = config => {
11
9
  const tableNode = config.isNestingSupported ? tableWithNestedTable : table;
12
- if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
13
- return tableNode;
14
- }
15
10
  return {
16
11
  ...tableNode,
17
12
  toDOM: node => {
@@ -60,12 +55,13 @@ export const tableNodeSpecWithFixedToDOM = config => {
60
55
  class: 'tableView-content-wrap'
61
56
  }, tableContainerDiv];
62
57
  }
58
+ const tableWidthAttribute = node.attrs.width ? `${node.attrs.width}px` : `100%`;
63
59
  const tableResizingDiv = ['div', {
64
60
  'data-testid': 'table-alignment-container',
65
61
  style: alignmentStyle
66
62
  }, ['div', {
67
63
  class: 'pm-table-resizer-container',
68
- style: `width: min(calc(100cqw - ${gutterPadding}px), ${node.attrs.width}px);`
64
+ style: `width: min(calc(100cqw - ${gutterPadding}px), ${tableWidthAttribute});`
69
65
  }, ['div', {
70
66
  class: 'resizer-item display-handle',
71
67
  style: convertToInlineCss({
@@ -77,7 +73,7 @@ export const tableNodeSpecWithFixedToDOM = config => {
77
73
  '--ak-editor-table-min-width': `${tableMinWidth}px`,
78
74
  minWidth: 'var(--ak-editor-table-min-width)',
79
75
  maxWidth: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))`,
80
- width: fg('platform_editor_table_layout_shift_fix') ? `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ${node.attrs.width}px)` : `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ${node.attrs.width})`
76
+ width: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ${tableWidthAttribute})`
81
77
  })
82
78
  }, ['span', {
83
79
  class: 'resizer-hover-zone'
@@ -1,5 +1,5 @@
1
1
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
- import { insideTable } from '@atlaskit/editor-common/core-utils';
2
+ import { insideTable, isSSR } from '@atlaskit/editor-common/core-utils';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveOpenNestedExpand } from '@atlaskit/editor-common/transforms';
5
5
  import { browser, closestElement } from '@atlaskit/editor-common/utils';
@@ -50,6 +50,29 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
50
50
  }
51
51
  return editorView.state;
52
52
  };
53
+ const nodeViews = isSSR() && fg('platform_editor_table_fallback_to_dom_on_ssr') ? undefined : {
54
+ table: lazyTableView({
55
+ portalProviderAPI,
56
+ eventDispatcher,
57
+ getEditorContainerWidth,
58
+ getEditorFeatureFlags,
59
+ dispatchAnalyticsEvent,
60
+ pluginInjectionApi,
61
+ isCommentEditor,
62
+ isChromelessEditor
63
+ }),
64
+ tableRow: lazyTableRowView({
65
+ eventDispatcher
66
+ }),
67
+ tableCell: lazyTableCellView({
68
+ eventDispatcher,
69
+ pluginInjectionApi
70
+ }),
71
+ tableHeader: lazyTableHeaderView({
72
+ eventDispatcher,
73
+ pluginInjectionApi
74
+ })
75
+ };
53
76
  return new SafePlugin({
54
77
  state: state,
55
78
  key: pluginKey,
@@ -273,29 +296,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
273
296
  }
274
297
  return false;
275
298
  },
276
- nodeViews: {
277
- table: lazyTableView({
278
- portalProviderAPI,
279
- eventDispatcher,
280
- getEditorContainerWidth,
281
- getEditorFeatureFlags,
282
- dispatchAnalyticsEvent,
283
- pluginInjectionApi,
284
- isCommentEditor,
285
- isChromelessEditor
286
- }),
287
- tableRow: lazyTableRowView({
288
- eventDispatcher
289
- }),
290
- tableCell: lazyTableCellView({
291
- eventDispatcher,
292
- pluginInjectionApi
293
- }),
294
- tableHeader: lazyTableHeaderView({
295
- eventDispatcher,
296
- pluginInjectionApi
297
- })
298
- },
299
+ nodeViews,
299
300
  handleDOMEvents: {
300
301
  focus: handleFocus,
301
302
  blur: handleBlur,
@@ -126,16 +126,21 @@ export var TableStickyScrollbar = /*#__PURE__*/function () {
126
126
  }, {
127
127
  key: "sentinelBottomCallback",
128
128
  value: function sentinelBottomCallback(entry) {
129
- var _entry$rootBounds2;
130
- var sentinelIsAboveScrollArea = entry.boundingClientRect.top < (((_entry$rootBounds2 = entry.rootBounds) === null || _entry$rootBounds2 === void 0 ? void 0 : _entry$rootBounds2.top) || 0);
129
+ var _entry$rootBounds2, _entry$rootBounds3;
130
+ var sentinelIsAboveScrollArea = entry.boundingClientRect.top < (((_entry$rootBounds2 = entry.rootBounds) === null || _entry$rootBounds2 === void 0 ? void 0 : _entry$rootBounds2.top) || 0) ||
131
+ // When editorScrollableElement is the root document or inside modal,
132
+ // so the boundingClientRect.top will never be less than the rootBounds.top,
133
+ // so we need to check if the boundingClientRect.top is less than 20% of the rootBounds.height
134
+ // to determine if the bottom sentinel is above the scroll area
135
+ entry.boundingClientRect.top < (((_entry$rootBounds3 = entry.rootBounds) === null || _entry$rootBounds3 === void 0 ? void 0 : _entry$rootBounds3.height) || 0) * 0.2 && fg('platform_editor_scroll_table_flickering_fix');
131
136
  this.bottomSentinelState = sentinelIsAboveScrollArea ? 'above' : entry.isIntersecting ? 'visible' : 'below';
132
137
  this.toggle();
133
138
  }
134
139
  }, {
135
140
  key: "sentinelTopCallback",
136
141
  value: function sentinelTopCallback(entry) {
137
- var _entry$rootBounds3;
138
- var sentinelIsBelowScrollArea = (((_entry$rootBounds3 = entry.rootBounds) === null || _entry$rootBounds3 === void 0 ? void 0 : _entry$rootBounds3.bottom) || 0) < entry.boundingClientRect.top;
142
+ var _entry$rootBounds4;
143
+ var sentinelIsBelowScrollArea = (((_entry$rootBounds4 = entry.rootBounds) === null || _entry$rootBounds4 === void 0 ? void 0 : _entry$rootBounds4.bottom) || 0) < entry.boundingClientRect.top;
139
144
  this.topSentinelState = sentinelIsBelowScrollArea ? 'below' : entry.isIntersecting ? 'visible' : 'above';
140
145
  this.toggle();
141
146
  }
@@ -7,16 +7,11 @@ import kebabCase from 'lodash/kebabCase';
7
7
  import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
8
8
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
9
9
  import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
10
- import { fg } from '@atlaskit/platform-feature-flags';
11
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
12
10
  import { generateColgroup, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
13
11
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
14
12
  import { getAlignmentStyle } from './table-container-styles';
15
13
  export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(config) {
16
14
  var tableNode = config.isNestingSupported ? tableWithNestedTable : table;
17
- if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
18
- return tableNode;
19
- }
20
15
  return _objectSpread(_objectSpread({}, tableNode), {}, {
21
16
  toDOM: function toDOM(node) {
22
17
  var gutterPadding = akEditorGutterPaddingDynamic() * 2;
@@ -69,12 +64,13 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
69
64
  class: 'tableView-content-wrap'
70
65
  }, tableContainerDiv];
71
66
  }
67
+ var tableWidthAttribute = node.attrs.width ? "".concat(node.attrs.width, "px") : "100%";
72
68
  var tableResizingDiv = ['div', {
73
69
  'data-testid': 'table-alignment-container',
74
70
  style: alignmentStyle
75
71
  }, ['div', {
76
72
  class: 'pm-table-resizer-container',
77
- style: "width: min(calc(100cqw - ".concat(gutterPadding, "px), ").concat(node.attrs.width, "px);")
73
+ style: "width: min(calc(100cqw - ".concat(gutterPadding, "px), ").concat(tableWidthAttribute, ");")
78
74
  }, ['div', {
79
75
  class: 'resizer-item display-handle',
80
76
  style: convertToInlineCss({
@@ -86,7 +82,7 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
86
82
  '--ak-editor-table-min-width': "".concat(tableMinWidth, "px"),
87
83
  minWidth: 'var(--ak-editor-table-min-width)',
88
84
  maxWidth: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))",
89
- width: fg('platform_editor_table_layout_shift_fix') ? "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(node.attrs.width, "px)") : "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(node.attrs.width, ")")
85
+ width: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(tableWidthAttribute, ")")
90
86
  })
91
87
  }, ['span', {
92
88
  class: 'resizer-hover-zone'
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
- import { insideTable } from '@atlaskit/editor-common/core-utils';
5
+ import { insideTable, isSSR } from '@atlaskit/editor-common/core-utils';
6
6
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
7
  import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveOpenNestedExpand } from '@atlaskit/editor-common/transforms';
8
8
  import { browser, closestElement } from '@atlaskit/editor-common/utils';
@@ -52,6 +52,29 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
52
52
  }
53
53
  return editorView.state;
54
54
  };
55
+ var nodeViews = isSSR() && fg('platform_editor_table_fallback_to_dom_on_ssr') ? undefined : {
56
+ table: lazyTableView({
57
+ portalProviderAPI: portalProviderAPI,
58
+ eventDispatcher: eventDispatcher,
59
+ getEditorContainerWidth: getEditorContainerWidth,
60
+ getEditorFeatureFlags: getEditorFeatureFlags,
61
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
62
+ pluginInjectionApi: pluginInjectionApi,
63
+ isCommentEditor: isCommentEditor,
64
+ isChromelessEditor: isChromelessEditor
65
+ }),
66
+ tableRow: lazyTableRowView({
67
+ eventDispatcher: eventDispatcher
68
+ }),
69
+ tableCell: lazyTableCellView({
70
+ eventDispatcher: eventDispatcher,
71
+ pluginInjectionApi: pluginInjectionApi
72
+ }),
73
+ tableHeader: lazyTableHeaderView({
74
+ eventDispatcher: eventDispatcher,
75
+ pluginInjectionApi: pluginInjectionApi
76
+ })
77
+ };
55
78
  return new SafePlugin({
56
79
  state: state,
57
80
  key: pluginKey,
@@ -268,29 +291,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
268
291
  }
269
292
  return false;
270
293
  },
271
- nodeViews: {
272
- table: lazyTableView({
273
- portalProviderAPI: portalProviderAPI,
274
- eventDispatcher: eventDispatcher,
275
- getEditorContainerWidth: getEditorContainerWidth,
276
- getEditorFeatureFlags: getEditorFeatureFlags,
277
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
278
- pluginInjectionApi: pluginInjectionApi,
279
- isCommentEditor: isCommentEditor,
280
- isChromelessEditor: isChromelessEditor
281
- }),
282
- tableRow: lazyTableRowView({
283
- eventDispatcher: eventDispatcher
284
- }),
285
- tableCell: lazyTableCellView({
286
- eventDispatcher: eventDispatcher,
287
- pluginInjectionApi: pluginInjectionApi
288
- }),
289
- tableHeader: lazyTableHeaderView({
290
- eventDispatcher: eventDispatcher,
291
- pluginInjectionApi: pluginInjectionApi
292
- })
293
- },
294
+ nodeViews: nodeViews,
294
295
  handleDOMEvents: {
295
296
  focus: handleFocus,
296
297
  blur: handleBlur,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "10.4.2",
3
+ "version": "10.4.4",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,7 +32,7 @@
32
32
  "@atlaskit/adf-schema": "^47.6.0",
33
33
  "@atlaskit/button": "^21.1.0",
34
34
  "@atlaskit/custom-steps": "^0.11.0",
35
- "@atlaskit/editor-common": "^102.8.0",
35
+ "@atlaskit/editor-common": "^102.10.0",
36
36
  "@atlaskit/editor-palette": "^2.1.0",
37
37
  "@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
54
54
  "@atlaskit/primitives": "^14.1.0",
55
55
  "@atlaskit/theme": "^18.0.0",
56
- "@atlaskit/tmp-editor-statsig": "^4.0.0",
56
+ "@atlaskit/tmp-editor-statsig": "^4.1.0",
57
57
  "@atlaskit/toggle": "^15.0.0",
58
58
  "@atlaskit/tokens": "^4.5.0",
59
59
  "@atlaskit/tooltip": "^20.0.0",
@@ -109,6 +109,9 @@
109
109
  }
110
110
  },
111
111
  "platform-feature-flags": {
112
+ "platform_editor_table_fallback_to_dom_on_ssr": {
113
+ "type": "boolean"
114
+ },
112
115
  "platform_editor_batch_steps_table": {
113
116
  "type": "boolean"
114
117
  },
@@ -149,9 +152,6 @@
149
152
  "platform_editor_nested_tables_paste_wrap_fix": {
150
153
  "type": "boolean"
151
154
  },
152
- "platform_editor_table_layout_shift_fix": {
153
- "type": "boolean"
154
- },
155
155
  "platform_editor_advanced_layouts_post_fix_patch_4": {
156
156
  "type": "boolean"
157
157
  },
@@ -193,6 +193,9 @@
193
193
  },
194
194
  "platform_editor_number_column_sticky_header_bug": {
195
195
  "type": "boolean"
196
+ },
197
+ "platform_editor_scroll_table_flickering_fix": {
198
+ "type": "boolean"
196
199
  }
197
200
  }
198
201
  }
@@ -144,7 +144,14 @@ export class TableStickyScrollbar {
144
144
  }
145
145
 
146
146
  private sentinelBottomCallback(entry: IntersectionObserverEntry) {
147
- const sentinelIsAboveScrollArea = entry.boundingClientRect.top < (entry.rootBounds?.top || 0);
147
+ const sentinelIsAboveScrollArea =
148
+ entry.boundingClientRect.top < (entry.rootBounds?.top || 0) ||
149
+ // When editorScrollableElement is the root document or inside modal,
150
+ // so the boundingClientRect.top will never be less than the rootBounds.top,
151
+ // so we need to check if the boundingClientRect.top is less than 20% of the rootBounds.height
152
+ // to determine if the bottom sentinel is above the scroll area
153
+ (entry.boundingClientRect.top < ((entry.rootBounds?.height || 0) * 0.2) &&
154
+ fg('platform_editor_scroll_table_flickering_fix'));
148
155
 
149
156
  this.bottomSentinelState = sentinelIsAboveScrollArea
150
157
  ? 'above'
@@ -159,6 +166,7 @@ export class TableStickyScrollbar {
159
166
  const sentinelIsBelowScrollArea =
160
167
  (entry.rootBounds?.bottom || 0) < entry.boundingClientRect.top;
161
168
 
169
+
162
170
  this.topSentinelState = sentinelIsBelowScrollArea
163
171
  ? 'below'
164
172
  : entry.isIntersecting
@@ -5,8 +5,6 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
5
5
  import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
6
6
  import type { DOMOutputSpec, NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
7
7
  import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
8
 
11
9
  import { generateColgroup, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
12
10
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
@@ -22,10 +20,6 @@ type Config = {
22
20
  export const tableNodeSpecWithFixedToDOM = (config: Config): NodeSpec => {
23
21
  const tableNode = config.isNestingSupported ? tableWithNestedTable : table;
24
22
 
25
- if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
26
- return tableNode;
27
- }
28
-
29
23
  return {
30
24
  ...tableNode,
31
25
  toDOM: (node: PMNode): DOMOutputSpec => {
@@ -120,6 +114,8 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): NodeSpec => {
120
114
  ];
121
115
  }
122
116
 
117
+ const tableWidthAttribute = node.attrs.width ? `${node.attrs.width}px` : `100%`;
118
+
123
119
  const tableResizingDiv = [
124
120
  'div',
125
121
  {
@@ -130,7 +126,7 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): NodeSpec => {
130
126
  'div',
131
127
  {
132
128
  class: 'pm-table-resizer-container',
133
- style: `width: min(calc(100cqw - ${gutterPadding}px), ${node.attrs.width}px);`,
129
+ style: `width: min(calc(100cqw - ${gutterPadding}px), ${tableWidthAttribute});`,
134
130
  },
135
131
  [
136
132
  'div',
@@ -145,9 +141,7 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): NodeSpec => {
145
141
  '--ak-editor-table-min-width': `${tableMinWidth}px`,
146
142
  minWidth: 'var(--ak-editor-table-min-width)',
147
143
  maxWidth: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))`,
148
- width: fg('platform_editor_table_layout_shift_fix')
149
- ? `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ${node.attrs.width}px)`
150
- : `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ${node.attrs.width})`,
144
+ width: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ${tableWidthAttribute})`,
151
145
  }),
152
146
  },
153
147
  [
@@ -7,7 +7,7 @@ import {
7
7
  INPUT_METHOD,
8
8
  } from '@atlaskit/editor-common/analytics';
9
9
  import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
10
- import { insideTable } from '@atlaskit/editor-common/core-utils';
10
+ import { insideTable, isSSR } from '@atlaskit/editor-common/core-utils';
11
11
  import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
12
12
  import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
13
13
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
@@ -130,6 +130,25 @@ export const createPlugin = (
130
130
 
131
131
  return editorView.state;
132
132
  };
133
+
134
+ const nodeViews =
135
+ isSSR() && fg('platform_editor_table_fallback_to_dom_on_ssr')
136
+ ? undefined
137
+ : {
138
+ table: lazyTableView({
139
+ portalProviderAPI,
140
+ eventDispatcher,
141
+ getEditorContainerWidth,
142
+ getEditorFeatureFlags,
143
+ dispatchAnalyticsEvent,
144
+ pluginInjectionApi,
145
+ isCommentEditor,
146
+ isChromelessEditor,
147
+ }),
148
+ tableRow: lazyTableRowView({ eventDispatcher }),
149
+ tableCell: lazyTableCellView({ eventDispatcher, pluginInjectionApi }),
150
+ tableHeader: lazyTableHeaderView({ eventDispatcher, pluginInjectionApi }),
151
+ };
133
152
  return new SafePlugin({
134
153
  state: state,
135
154
  key: pluginKey,
@@ -380,21 +399,7 @@ export const createPlugin = (
380
399
  }
381
400
  return false;
382
401
  },
383
- nodeViews: {
384
- table: lazyTableView({
385
- portalProviderAPI,
386
- eventDispatcher,
387
- getEditorContainerWidth,
388
- getEditorFeatureFlags,
389
- dispatchAnalyticsEvent,
390
- pluginInjectionApi,
391
- isCommentEditor,
392
- isChromelessEditor,
393
- }),
394
- tableRow: lazyTableRowView({ eventDispatcher }),
395
- tableCell: lazyTableCellView({ eventDispatcher, pluginInjectionApi }),
396
- tableHeader: lazyTableHeaderView({ eventDispatcher, pluginInjectionApi }),
397
- },
402
+ nodeViews,
398
403
  handleDOMEvents: {
399
404
  focus: handleFocus,
400
405
  blur: handleBlur,