@atlaskit/editor-plugin-table 26.0.10 → 26.2.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,34 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 26.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`da5eaf0bc37da`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/da5eaf0bc37da) -
8
+ Clean up the platform_editor_editor_ssr_streaming experiment. The SSR streaming code paths are now
9
+ permanent and the isSSRStreaming() utility has been removed from
10
+ @atlaskit/editor-common/core-utils.
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 26.1.0
17
+
18
+ ### Minor Changes
19
+
20
+ - [`2d23b40eed4f0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2d23b40eed4f0) -
21
+ Add gated content-visibility:auto to tables, expands and media singles to improve editor rendering
22
+ performance on large documents. Applied only to nodes whose rendered size can be estimated closely
23
+ — structurally (row/child counts) for tables and expands, and from the media's own dimensions and
24
+ the renderer's width calculation for media singles. Behind the
25
+ cc_editor_limited_mode_perf_improvements experiment and only active when limited mode is enabled
26
+ for the document (shared large-document detection with the limited-mode plugin).
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies
31
+
3
32
  ## 26.0.10
4
33
 
5
34
  ### Patch Changes
package/compass.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  configVersion: 1
2
2
  id: ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:component/c5751cc6-3513-4070-9deb-af31e86aed34/9be4f6fa-1e46-4040-9a16-090520d0a5db
3
3
  name: '@atlaskit/editor-plugin-table'
4
- ownerId: ari:cloud:identity::team/2484e1f6-f62c-4a70-95f1-8e5695c51b6b # Editor Jenga
4
+ ownerId: ari:cloud:identity::team/cf6a670b-5252-4c68-a769-9207de366beb # Editor Developers
5
5
  labels:
6
6
  - platform-code
7
7
  - platform-afm
@@ -16,14 +16,14 @@ links:
16
16
  url: https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master
17
17
  - name: Slack Channel
18
18
  type: CHAT_CHANNEL
19
- url: https://atlassian.enterprise.slack.com/archives/C061GUMN3NY # #team-cc-editor-exp-cloud-native
19
+ url: https://atlassian.enterprise.slack.com/archives/CFG3PSQ9E # #help-editor
20
20
  - name: Editor Plugin Table
21
21
  type: REPOSITORY
22
22
  url: https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/editor/editor-plugin-table
23
23
  customFields:
24
24
  - name: Department
25
25
  type: text
26
- value: Eng - Editor Autonomy - Jenga
26
+ value: Editor Developers
27
27
  - name: Trusted Reviewer Teams
28
28
  type: text
29
29
  value: ari:cloud:identity::team/cf6a670b-5252-4c68-a769-9207de366beb
@@ -11,7 +11,7 @@ var _coreUtils = require("@atlaskit/editor-common/core-utils");
11
11
  function TableSSRReactContextsProvider(_ref) {
12
12
  var children = _ref.children,
13
13
  intl = _ref.intl;
14
- if (!(0, _coreUtils.isSSR)() || !(0, _coreUtils.isSSRStreaming)()) {
14
+ if (!(0, _coreUtils.isSSR)()) {
15
15
  return children;
16
16
  }
17
17
  if (!intl) {
@@ -14,10 +14,10 @@ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
14
14
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
16
  var _react = _interopRequireDefault(require("react"));
17
- var _coreUtils = require("@atlaskit/editor-common/core-utils");
18
17
  var _nodeWidth = require("@atlaskit/editor-common/node-width");
19
18
  var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
20
19
  var _table = require("@atlaskit/editor-common/table");
20
+ var _contentVisibility = require("@atlaskit/editor-common/utils/content-visibility");
21
21
  var _model = require("@atlaskit/editor-prosemirror/model");
22
22
  var _state = require("@atlaskit/editor-prosemirror/state");
23
23
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
@@ -74,6 +74,7 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
74
74
  _this = _callSuper(this, TableView, [props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, undefined,
75
75
  // @portal-render-immediately
76
76
  true]);
77
+ (0, _defineProperty2.default)(_this, "isNestedTable", false);
77
78
  (0, _defineProperty2.default)(_this, "getNode", function () {
78
79
  return _this.node;
79
80
  });
@@ -115,6 +116,8 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
115
116
  var tableElement = rendered.dom.querySelector('table');
116
117
  this.table = tableElement ? tableElement : rendered.dom;
117
118
  this.renderedDOM = rendered.dom;
119
+ this.isNestedTable = isNested;
120
+ this.updateContentVisibility();
118
121
  var allowFixedColumnWidthOption = ((_this$reactComponentP5 = this.reactComponentProps) === null || _this$reactComponentP5 === void 0 ? void 0 : _this$reactComponentP5.allowFixedColumnWidthOption) || false;
119
122
  if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled) || (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.isTableScalingEnabled && allowFixedColumnWidthOption && this.node.attrs.displayMode === 'fixed') {
120
123
  var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos(), this.reactComponentProps.allowTableResizing);
@@ -174,11 +177,11 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
174
177
  }
175
178
 
176
179
  // Remove the ProseMirror table DOM structure to avoid duplication, as it's replaced with the React table node.
177
- // In SSR streaming the portal renders via `container.innerHTML = html` (portal/common.tsx), which detaches
180
+ // In SSR the portal renders via `container.innerHTML = html` (portal/common.tsx), which detaches
178
181
  // `renderedDOM` from `dom` before this runs; require it to still be a child so `removeChild` doesn't throw
179
182
  // `NotFoundError` (which would make EditorSSRRenderer fall back to the position-blind schema toDOM and lose
180
- // nested detection). CSR keeps the original condition unchanged.
181
- if (this.dom && this.renderedDOM && (!(0, _coreUtils.isSSRStreaming)() || this.renderedDOM.parentNode === this.dom)) {
183
+ // nested detection).
184
+ if (this.dom && this.renderedDOM && this.renderedDOM.parentNode === this.dom) {
182
185
  this.dom.removeChild(this.renderedDOM);
183
186
  }
184
187
  // Move the table from the ProseMirror table structure into the React rendered table node.
@@ -264,6 +267,35 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
264
267
  }
265
268
  }
266
269
  }
270
+ }, {
271
+ key: "updateContentVisibility",
272
+ value: function updateContentVisibility() {
273
+ var _this$reactComponentP9,
274
+ _limitedMode$sharedSt,
275
+ _this4 = this;
276
+ if (this.isNestedTable || !this.table) {
277
+ return;
278
+ }
279
+ // Read limited mode from the nodeView's own `this.view.state` via the plugin key exposed on
280
+ // the (already-typed) shared state, NOT `currentState().enabled`: during initial EditorView
281
+ // construction the injection API's editor state is undefined, so `.enabled` reads a stale false.
282
+ var limitedMode = (_this$reactComponentP9 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP9 === void 0 ? void 0 : _this$reactComponentP9.limitedMode;
283
+ var enabled = Boolean(limitedMode === null || limitedMode === void 0 || (_limitedMode$sharedSt = limitedMode.sharedState.currentState()) === null || _limitedMode$sharedSt === void 0 || (_limitedMode$sharedSt = _limitedMode$sharedSt.limitedModePluginKey) === null || _limitedMode$sharedSt === void 0 || (_limitedMode$sharedSt = _limitedMode$sharedSt.getState(this.view.state)) === null || _limitedMode$sharedSt === void 0 ? void 0 : _limitedMode$sharedSt.documentSizeBreachesThreshold);
284
+ var applied = (0, _contentVisibility.applyContentVisibility)(this.table, enabled, function () {
285
+ return {
286
+ // The `<table>` is content-sized (`display: table`), so it needs an explicit intrinsic
287
+ // width or it collapses to 0 wide while contained. `getTableContainerWidth` covers
288
+ // wide/full-width tables; explicit inline widths (resizable tables) simply override it.
289
+ width: (0, _nodeWidth.getTableContainerWidth)(_this4.node),
290
+ height: (0, _contentVisibility.estimateTableIntrinsicHeight)(_this4.node)
291
+ };
292
+ });
293
+ // Marker for the shared table CSS: when content-visibility (→ contain: paint) is actually
294
+ // applied, it pulls the `::after` outer-border overlay from `inset: -0.5px` to `inset: 0` so
295
+ // paint clipping doesn't shave the border. Keyed off the real applied style so it stays in
296
+ // sync with the gate inside applyContentVisibility.
297
+ this.table.toggleAttribute('data-content-visibility', applied);
298
+ }
267
299
  }, {
268
300
  key: "update",
269
301
  value: function update(node, decorations, innerDecorations, validUpdate) {
@@ -272,6 +304,9 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
272
304
  // Keep the rounded-corner edge attrs in sync with structural changes (rows/columns
273
305
  // added, removed, merged, or reordered via drag-and-drop) that the cells themselves
274
306
  // can miss.
307
+ if (didUpdate) {
308
+ this.updateContentVisibility();
309
+ }
275
310
  if (didUpdate && (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true)) {
276
311
  var _this$roundedTableEdg;
277
312
  (_this$roundedTableEdg = this.roundedTableEdges) === null || _this$roundedTableEdg === void 0 || _this$roundedTableEdg.handleUpdate(node);
@@ -11,7 +11,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
11
11
  var _classnames = _interopRequireDefault(require("classnames"));
12
12
  var _kebabCase = _interopRequireDefault(require("lodash/kebabCase"));
13
13
  var _adfSchema = require("@atlaskit/adf-schema");
14
- var _coreUtils = require("@atlaskit/editor-common/core-utils");
15
14
  var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
16
15
  var _table = require("@atlaskit/editor-common/table");
17
16
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
@@ -102,7 +101,7 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
102
101
  }].concat(roundedTableCornerMasks, [['table', attrs, colgroup, ['tbody', 0]]])].concat(overflowShadows, [['div', {
103
102
  class: 'pm-table-sticky-sentinel-bottom',
104
103
  'data-testid': 'sticky-sentinel-bottom'
105
- }]], (0, _toConsumableArray2.default)((0, _coreUtils.isSSRStreaming)() ? [['div', {
104
+ }], ['div', {
106
105
  contenteditable: 'false',
107
106
  class: 'pm-table-left-border',
108
107
  'data-with-numbered-table': node.attrs.isNumberColumnEnabled,
@@ -111,7 +110,7 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
111
110
  contenteditable: 'false',
112
111
  class: 'pm-table-right-border',
113
112
  'data-testid': 'table-right-border'
114
- }]] : []));
113
+ }]]);
115
114
  if (!config.tableResizingEnabled || config.isNested) {
116
115
  return ['div', {
117
116
  class: 'tableView-content-wrap',
@@ -68,7 +68,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
68
68
  }
69
69
  return editorView.state;
70
70
  };
71
- var intl = (0, _coreUtils.isSSRStreaming)() ? getIntl() : undefined;
71
+ var intl = getIntl();
72
72
  var getNodeView = function getNodeView() {
73
73
  return {
74
74
  table: (0, _tableNodeViews.tableView)({
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.isMinCellWidthTable = exports.insertColgroupFromNode = exports.hasTableColumnBeenResized = exports.hasTableBeenResized = exports.getResizerMinWidth = exports.getColgroupChildrenLength = exports.getColWidthFix = exports.generateColgroupFromNode = exports.generateColgroup = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
- var _coreUtils = require("@atlaskit/editor-common/core-utils");
10
9
  var _styles = require("@atlaskit/editor-common/styles");
11
10
  var _utils = require("@atlaskit/editor-common/utils");
12
11
  var _model = require("@atlaskit/editor-prosemirror/model");
@@ -33,7 +32,7 @@ var generateColStyle = function generateColStyle(fixedColWidth, tableWidth, isCo
33
32
  if (hasTableBeenResized) {
34
33
  return "width: max(".concat(fixedColWidth, "px, ").concat(_styles.tableCellMinWidth, "px)");
35
34
  }
36
- return (0, _coreUtils.isSSRStreaming)() ? "width: ".concat(_styles.tableCellMinWidth, "px") : "width: ".concat(_styles.tableCellMinWidth, "px)");
35
+ return "width: ".concat(_styles.tableCellMinWidth, "px");
37
36
  }
38
37
  if (isFullPageEditor || !isFullPageEditor && isTableHasWidth) {
39
38
  var scaledPercent = isNumberColumnEnabled ? "calc(calc(var(--ak-editor-table-width) - ".concat(_editorSharedStyles.akEditorTableNumberColumnWidth, "px - 1px)/").concat(tableWidth, ")") : "calc(calc(var(--ak-editor-table-width) - 1px)/".concat(tableWidth, ")");
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { RawIntlProvider } from 'react-intl';
3
- import { isSSR, isSSRStreaming } from '@atlaskit/editor-common/core-utils';
3
+ import { isSSR } from '@atlaskit/editor-common/core-utils';
4
4
  export function TableSSRReactContextsProvider({
5
5
  children,
6
6
  intl
7
7
  }) {
8
- if (!isSSR() || !isSSRStreaming()) {
8
+ if (!isSSR()) {
9
9
  return children;
10
10
  }
11
11
  if (!intl) {
@@ -1,9 +1,9 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
- import { isSSRStreaming } from '@atlaskit/editor-common/core-utils';
4
3
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
5
4
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
6
5
  import { isTableInContentMode } from '@atlaskit/editor-common/table';
6
+ import { applyContentVisibility, estimateTableIntrinsicHeight } from '@atlaskit/editor-common/utils/content-visibility';
7
7
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
8
8
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
9
9
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
@@ -55,6 +55,7 @@ export default class TableView extends ReactNodeView {
55
55
  super(props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, undefined,
56
56
  // @portal-render-immediately
57
57
  true);
58
+ _defineProperty(this, "isNestedTable", false);
58
59
  _defineProperty(this, "getNode", () => {
59
60
  return this.node;
60
61
  });
@@ -88,6 +89,8 @@ export default class TableView extends ReactNodeView {
88
89
  const tableElement = rendered.dom.querySelector('table');
89
90
  this.table = tableElement ? tableElement : rendered.dom;
90
91
  this.renderedDOM = rendered.dom;
92
+ this.isNestedTable = isNested;
93
+ this.updateContentVisibility();
91
94
  const allowFixedColumnWidthOption = ((_this$reactComponentP5 = this.reactComponentProps) === null || _this$reactComponentP5 === void 0 ? void 0 : _this$reactComponentP5.allowFixedColumnWidthOption) || false;
92
95
  if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled) || (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.isTableScalingEnabled && allowFixedColumnWidthOption && this.node.attrs.displayMode === 'fixed') {
93
96
  const tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos(), this.reactComponentProps.allowTableResizing);
@@ -146,11 +149,11 @@ export default class TableView extends ReactNodeView {
146
149
  }
147
150
 
148
151
  // Remove the ProseMirror table DOM structure to avoid duplication, as it's replaced with the React table node.
149
- // In SSR streaming the portal renders via `container.innerHTML = html` (portal/common.tsx), which detaches
152
+ // In SSR the portal renders via `container.innerHTML = html` (portal/common.tsx), which detaches
150
153
  // `renderedDOM` from `dom` before this runs; require it to still be a child so `removeChild` doesn't throw
151
154
  // `NotFoundError` (which would make EditorSSRRenderer fall back to the position-blind schema toDOM and lose
152
- // nested detection). CSR keeps the original condition unchanged.
153
- if (this.dom && this.renderedDOM && (!isSSRStreaming() || this.renderedDOM.parentNode === this.dom)) {
155
+ // nested detection).
156
+ if (this.dom && this.renderedDOM && this.renderedDOM.parentNode === this.dom) {
154
157
  this.dom.removeChild(this.renderedDOM);
155
158
  }
156
159
  // Move the table from the ProseMirror table structure into the React rendered table node.
@@ -229,12 +232,38 @@ export default class TableView extends ReactNodeView {
229
232
  }
230
233
  }
231
234
  }
235
+ updateContentVisibility() {
236
+ var _this$reactComponentP9, _limitedMode$sharedSt, _limitedMode$sharedSt2, _limitedMode$sharedSt3;
237
+ if (this.isNestedTable || !this.table) {
238
+ return;
239
+ }
240
+ // Read limited mode from the nodeView's own `this.view.state` via the plugin key exposed on
241
+ // the (already-typed) shared state, NOT `currentState().enabled`: during initial EditorView
242
+ // construction the injection API's editor state is undefined, so `.enabled` reads a stale false.
243
+ const limitedMode = (_this$reactComponentP9 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP9 === void 0 ? void 0 : _this$reactComponentP9.limitedMode;
244
+ const enabled = Boolean(limitedMode === null || limitedMode === void 0 ? void 0 : (_limitedMode$sharedSt = limitedMode.sharedState.currentState()) === null || _limitedMode$sharedSt === void 0 ? void 0 : (_limitedMode$sharedSt2 = _limitedMode$sharedSt.limitedModePluginKey) === null || _limitedMode$sharedSt2 === void 0 ? void 0 : (_limitedMode$sharedSt3 = _limitedMode$sharedSt2.getState(this.view.state)) === null || _limitedMode$sharedSt3 === void 0 ? void 0 : _limitedMode$sharedSt3.documentSizeBreachesThreshold);
245
+ const applied = applyContentVisibility(this.table, enabled, () => ({
246
+ // The `<table>` is content-sized (`display: table`), so it needs an explicit intrinsic
247
+ // width or it collapses to 0 wide while contained. `getTableContainerWidth` covers
248
+ // wide/full-width tables; explicit inline widths (resizable tables) simply override it.
249
+ width: getTableContainerWidth(this.node),
250
+ height: estimateTableIntrinsicHeight(this.node)
251
+ }));
252
+ // Marker for the shared table CSS: when content-visibility (→ contain: paint) is actually
253
+ // applied, it pulls the `::after` outer-border overlay from `inset: -0.5px` to `inset: 0` so
254
+ // paint clipping doesn't shave the border. Keyed off the real applied style so it stays in
255
+ // sync with the gate inside applyContentVisibility.
256
+ this.table.toggleAttribute('data-content-visibility', applied);
257
+ }
232
258
  update(node, decorations, innerDecorations, validUpdate) {
233
259
  const didUpdate = super.update(node, decorations, innerDecorations, validUpdate);
234
260
 
235
261
  // Keep the rounded-corner edge attrs in sync with structural changes (rows/columns
236
262
  // added, removed, merged, or reordered via drag-and-drop) that the cells themselves
237
263
  // can miss.
264
+ if (didUpdate) {
265
+ this.updateContentVisibility();
266
+ }
238
267
  if (didUpdate && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true)) {
239
268
  var _this$roundedTableEdg;
240
269
  (_this$roundedTableEdg = this.roundedTableEdges) === null || _this$roundedTableEdg === void 0 ? void 0 : _this$roundedTableEdg.handleUpdate(node);
@@ -1,7 +1,6 @@
1
1
  import classNames from 'classnames';
2
2
  import kebabCase from 'lodash/kebabCase';
3
3
  import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
4
- import { isSSRStreaming } from '@atlaskit/editor-common/core-utils';
5
4
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
6
5
  import { isTableInContentMode } from '@atlaskit/editor-common/table';
7
6
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -88,7 +87,7 @@ export const tableNodeSpecWithFixedToDOM = config => {
88
87
  }, ...roundedTableCornerMasks, ['table', attrs, colgroup, ['tbody', 0]]], ...overflowShadows, ['div', {
89
88
  class: 'pm-table-sticky-sentinel-bottom',
90
89
  'data-testid': 'sticky-sentinel-bottom'
91
- }], ...(isSSRStreaming() ? [['div', {
90
+ }], ['div', {
92
91
  contenteditable: 'false',
93
92
  class: 'pm-table-left-border',
94
93
  'data-with-numbered-table': node.attrs.isNumberColumnEnabled,
@@ -97,7 +96,7 @@ export const tableNodeSpecWithFixedToDOM = config => {
97
96
  contenteditable: 'false',
98
97
  class: 'pm-table-right-border',
99
98
  'data-testid': 'table-right-border'
100
- }]] : [])];
99
+ }]];
101
100
  if (!config.tableResizingEnabled || config.isNested) {
102
101
  return ['div', {
103
102
  class: 'tableView-content-wrap',
@@ -1,7 +1,7 @@
1
1
  import { bind } from 'bind-event-listener';
2
2
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import { getBrowserInfo } from '@atlaskit/editor-common/browser';
4
- import { insideTable, isSSRStreaming } from '@atlaskit/editor-common/core-utils';
4
+ import { insideTable } from '@atlaskit/editor-common/core-utils';
5
5
  import { isNestedTablesSupported } from '@atlaskit/editor-common/nesting';
6
6
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
7
  import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveOpenNestedExpand } from '@atlaskit/editor-common/transforms';
@@ -59,7 +59,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
59
59
  }
60
60
  return editorView.state;
61
61
  };
62
- const intl = isSSRStreaming() ? getIntl() : undefined;
62
+ const intl = getIntl();
63
63
  const getNodeView = () => {
64
64
  return {
65
65
  table: tableView({
@@ -1,4 +1,3 @@
1
- import { isSSRStreaming } from '@atlaskit/editor-common/core-utils';
2
1
  import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
3
2
  import { calcTableColumnWidths, getFragmentBackingArray } from '@atlaskit/editor-common/utils';
4
3
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
@@ -23,7 +22,7 @@ const generateColStyle = (fixedColWidth, tableWidth, isCommentEditor, isChromele
23
22
  if (hasTableBeenResized) {
24
23
  return `width: max(${fixedColWidth}px, ${tableCellMinWidth}px)`;
25
24
  }
26
- return isSSRStreaming() ? `width: ${tableCellMinWidth}px` : `width: ${tableCellMinWidth}px)`;
25
+ return `width: ${tableCellMinWidth}px`;
27
26
  }
28
27
  if (isFullPageEditor || !isFullPageEditor && isTableHasWidth) {
29
28
  const scaledPercent = isNumberColumnEnabled ? `calc(calc(var(--ak-editor-table-width) - ${akEditorTableNumberColumnWidth}px - 1px)/${tableWidth})` : `calc(calc(var(--ak-editor-table-width) - 1px)/${tableWidth})`;
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { RawIntlProvider } from 'react-intl';
3
- import { isSSR, isSSRStreaming } from '@atlaskit/editor-common/core-utils';
3
+ import { isSSR } from '@atlaskit/editor-common/core-utils';
4
4
  export function TableSSRReactContextsProvider(_ref) {
5
5
  var children = _ref.children,
6
6
  intl = _ref.intl;
7
- if (!isSSR() || !isSSRStreaming()) {
7
+ if (!isSSR()) {
8
8
  return children;
9
9
  }
10
10
  if (!intl) {
@@ -10,10 +10,10 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
10
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
11
  function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
12
12
  import React from 'react';
13
- import { isSSRStreaming } from '@atlaskit/editor-common/core-utils';
14
13
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
15
14
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
16
15
  import { isTableInContentMode } from '@atlaskit/editor-common/table';
16
+ import { applyContentVisibility, estimateTableIntrinsicHeight } from '@atlaskit/editor-common/utils/content-visibility';
17
17
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
18
18
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
19
19
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
@@ -67,6 +67,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
67
67
  _this = _callSuper(this, TableView, [props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, undefined,
68
68
  // @portal-render-immediately
69
69
  true]);
70
+ _defineProperty(_this, "isNestedTable", false);
70
71
  _defineProperty(_this, "getNode", function () {
71
72
  return _this.node;
72
73
  });
@@ -108,6 +109,8 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
108
109
  var tableElement = rendered.dom.querySelector('table');
109
110
  this.table = tableElement ? tableElement : rendered.dom;
110
111
  this.renderedDOM = rendered.dom;
112
+ this.isNestedTable = isNested;
113
+ this.updateContentVisibility();
111
114
  var allowFixedColumnWidthOption = ((_this$reactComponentP5 = this.reactComponentProps) === null || _this$reactComponentP5 === void 0 ? void 0 : _this$reactComponentP5.allowFixedColumnWidthOption) || false;
112
115
  if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled) || (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.isTableScalingEnabled && allowFixedColumnWidthOption && this.node.attrs.displayMode === 'fixed') {
113
116
  var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos(), this.reactComponentProps.allowTableResizing);
@@ -167,11 +170,11 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
167
170
  }
168
171
 
169
172
  // Remove the ProseMirror table DOM structure to avoid duplication, as it's replaced with the React table node.
170
- // In SSR streaming the portal renders via `container.innerHTML = html` (portal/common.tsx), which detaches
173
+ // In SSR the portal renders via `container.innerHTML = html` (portal/common.tsx), which detaches
171
174
  // `renderedDOM` from `dom` before this runs; require it to still be a child so `removeChild` doesn't throw
172
175
  // `NotFoundError` (which would make EditorSSRRenderer fall back to the position-blind schema toDOM and lose
173
- // nested detection). CSR keeps the original condition unchanged.
174
- if (this.dom && this.renderedDOM && (!isSSRStreaming() || this.renderedDOM.parentNode === this.dom)) {
176
+ // nested detection).
177
+ if (this.dom && this.renderedDOM && this.renderedDOM.parentNode === this.dom) {
175
178
  this.dom.removeChild(this.renderedDOM);
176
179
  }
177
180
  // Move the table from the ProseMirror table structure into the React rendered table node.
@@ -257,6 +260,35 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
257
260
  }
258
261
  }
259
262
  }
263
+ }, {
264
+ key: "updateContentVisibility",
265
+ value: function updateContentVisibility() {
266
+ var _this$reactComponentP9,
267
+ _limitedMode$sharedSt,
268
+ _this4 = this;
269
+ if (this.isNestedTable || !this.table) {
270
+ return;
271
+ }
272
+ // Read limited mode from the nodeView's own `this.view.state` via the plugin key exposed on
273
+ // the (already-typed) shared state, NOT `currentState().enabled`: during initial EditorView
274
+ // construction the injection API's editor state is undefined, so `.enabled` reads a stale false.
275
+ var limitedMode = (_this$reactComponentP9 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP9 === void 0 ? void 0 : _this$reactComponentP9.limitedMode;
276
+ var enabled = Boolean(limitedMode === null || limitedMode === void 0 || (_limitedMode$sharedSt = limitedMode.sharedState.currentState()) === null || _limitedMode$sharedSt === void 0 || (_limitedMode$sharedSt = _limitedMode$sharedSt.limitedModePluginKey) === null || _limitedMode$sharedSt === void 0 || (_limitedMode$sharedSt = _limitedMode$sharedSt.getState(this.view.state)) === null || _limitedMode$sharedSt === void 0 ? void 0 : _limitedMode$sharedSt.documentSizeBreachesThreshold);
277
+ var applied = applyContentVisibility(this.table, enabled, function () {
278
+ return {
279
+ // The `<table>` is content-sized (`display: table`), so it needs an explicit intrinsic
280
+ // width or it collapses to 0 wide while contained. `getTableContainerWidth` covers
281
+ // wide/full-width tables; explicit inline widths (resizable tables) simply override it.
282
+ width: getTableContainerWidth(_this4.node),
283
+ height: estimateTableIntrinsicHeight(_this4.node)
284
+ };
285
+ });
286
+ // Marker for the shared table CSS: when content-visibility (→ contain: paint) is actually
287
+ // applied, it pulls the `::after` outer-border overlay from `inset: -0.5px` to `inset: 0` so
288
+ // paint clipping doesn't shave the border. Keyed off the real applied style so it stays in
289
+ // sync with the gate inside applyContentVisibility.
290
+ this.table.toggleAttribute('data-content-visibility', applied);
291
+ }
260
292
  }, {
261
293
  key: "update",
262
294
  value: function update(node, decorations, innerDecorations, validUpdate) {
@@ -265,6 +297,9 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
265
297
  // Keep the rounded-corner edge attrs in sync with structural changes (rows/columns
266
298
  // added, removed, merged, or reordered via drag-and-drop) that the cells themselves
267
299
  // can miss.
300
+ if (didUpdate) {
301
+ this.updateContentVisibility();
302
+ }
268
303
  if (didUpdate && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true)) {
269
304
  var _this$roundedTableEdg;
270
305
  (_this$roundedTableEdg = this.roundedTableEdges) === null || _this$roundedTableEdg === void 0 || _this$roundedTableEdg.handleUpdate(node);
@@ -6,7 +6,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
6
6
  import classNames from 'classnames';
7
7
  import kebabCase from 'lodash/kebabCase';
8
8
  import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
9
- import { isSSRStreaming } from '@atlaskit/editor-common/core-utils';
10
9
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
11
10
  import { isTableInContentMode } from '@atlaskit/editor-common/table';
12
11
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -95,7 +94,7 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
95
94
  }].concat(roundedTableCornerMasks, [['table', attrs, colgroup, ['tbody', 0]]])].concat(overflowShadows, [['div', {
96
95
  class: 'pm-table-sticky-sentinel-bottom',
97
96
  'data-testid': 'sticky-sentinel-bottom'
98
- }]], _toConsumableArray(isSSRStreaming() ? [['div', {
97
+ }], ['div', {
99
98
  contenteditable: 'false',
100
99
  class: 'pm-table-left-border',
101
100
  'data-with-numbered-table': node.attrs.isNumberColumnEnabled,
@@ -104,7 +103,7 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
104
103
  contenteditable: 'false',
105
104
  class: 'pm-table-right-border',
106
105
  'data-testid': 'table-right-border'
107
- }]] : []));
106
+ }]]);
108
107
  if (!config.tableResizingEnabled || config.isNested) {
109
108
  return ['div', {
110
109
  class: 'tableView-content-wrap',
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { bind } from 'bind-event-listener';
5
5
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
6
6
  import { getBrowserInfo } from '@atlaskit/editor-common/browser';
7
- import { insideTable, isSSRStreaming } from '@atlaskit/editor-common/core-utils';
7
+ import { insideTable } from '@atlaskit/editor-common/core-utils';
8
8
  import { isNestedTablesSupported } from '@atlaskit/editor-common/nesting';
9
9
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
10
10
  import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveOpenNestedExpand } from '@atlaskit/editor-common/transforms';
@@ -61,7 +61,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
61
61
  }
62
62
  return editorView.state;
63
63
  };
64
- var intl = isSSRStreaming() ? getIntl() : undefined;
64
+ var intl = getIntl();
65
65
  var getNodeView = function getNodeView() {
66
66
  return {
67
67
  table: tableView({
@@ -1,5 +1,4 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import { isSSRStreaming } from '@atlaskit/editor-common/core-utils';
3
2
  import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
4
3
  import { calcTableColumnWidths, getFragmentBackingArray } from '@atlaskit/editor-common/utils';
5
4
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
@@ -26,7 +25,7 @@ var generateColStyle = function generateColStyle(fixedColWidth, tableWidth, isCo
26
25
  if (hasTableBeenResized) {
27
26
  return "width: max(".concat(fixedColWidth, "px, ").concat(tableCellMinWidth, "px)");
28
27
  }
29
- return isSSRStreaming() ? "width: ".concat(tableCellMinWidth, "px") : "width: ".concat(tableCellMinWidth, "px)");
28
+ return "width: ".concat(tableCellMinWidth, "px");
30
29
  }
31
30
  if (isFullPageEditor || !isFullPageEditor && isTableHasWidth) {
32
31
  var scaledPercent = isNumberColumnEnabled ? "calc(calc(var(--ak-editor-table-width) - ".concat(akEditorTableNumberColumnWidth, "px - 1px)/").concat(tableWidth, ")") : "calc(calc(var(--ak-editor-table-width) - 1px)/".concat(tableWidth, ")");
@@ -16,6 +16,7 @@ export default class TableView extends ReactNodeView<Props> {
16
16
  private resizeObserver?;
17
17
  private roundedTableEdges;
18
18
  private intl?;
19
+ private isNestedTable;
19
20
  eventDispatcher?: EventDispatcher;
20
21
  getPos: getPosHandlerNode;
21
22
  options: TableOptions | undefined;
@@ -35,6 +36,7 @@ export default class TableView extends ReactNodeView<Props> {
35
36
  private _handleTableRef;
36
37
  setDomAttrs(node: PmNode): void;
37
38
  getNode: () => PmNode;
39
+ private updateContentVisibility;
38
40
  update(node: PmNode, decorations: ReadonlyArray<Decoration>, innerDecorations?: DecorationSource, validUpdate?: (currentNode: PmNode, newNode: PmNode) => boolean): boolean;
39
41
  render(props: Props, forwardRef: ForwardRef): React.JSX.Element;
40
42
  private hasHoveredRows;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "26.0.10",
3
+ "version": "26.2.0",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,7 +29,7 @@
29
29
  "@atlaskit/editor-plugin-batch-attribute-updates": "^14.0.0",
30
30
  "@atlaskit/editor-plugin-content-insertion": "^14.0.0",
31
31
  "@atlaskit/editor-plugin-editor-viewmode": "^16.0.0",
32
- "@atlaskit/editor-plugin-extension": "17.1.1",
32
+ "@atlaskit/editor-plugin-extension": "17.2.0",
33
33
  "@atlaskit/editor-plugin-guideline": "^14.0.0",
34
34
  "@atlaskit/editor-plugin-interaction": "^25.0.0",
35
35
  "@atlaskit/editor-plugin-limited-mode": "^11.0.0",
@@ -45,7 +45,7 @@
45
45
  "@atlaskit/editor-ui-control-model": "^2.6.0",
46
46
  "@atlaskit/icon": "^37.3.0",
47
47
  "@atlaskit/icon-lab": "^7.5.0",
48
- "@atlaskit/insm": "^1.3.0",
48
+ "@atlaskit/insm": "^2.0.0",
49
49
  "@atlaskit/menu": "^10.0.0",
50
50
  "@atlaskit/platform-feature-experiments": "^0.3.0",
51
51
  "@atlaskit/platform-feature-flags": "^2.1.0",
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.0.0",
54
54
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^2.0.0",
55
55
  "@atlaskit/primitives": "^22.2.0",
56
- "@atlaskit/tmp-editor-statsig": "^147.0.0",
56
+ "@atlaskit/tmp-editor-statsig": "^147.1.0",
57
57
  "@atlaskit/toggle": "^17.1.0",
58
58
  "@atlaskit/tokens": "^16.7.0",
59
59
  "@atlaskit/tooltip": "^24.0.0",
@@ -68,7 +68,7 @@
68
68
  "uuid": "^3.1.0"
69
69
  },
70
70
  "peerDependencies": {
71
- "@atlaskit/editor-common": "^118.10.0",
71
+ "@atlaskit/editor-common": "^118.12.0",
72
72
  "react": "^18.2.0 || ^19.2.0",
73
73
  "react-dom": "^18.2.0 || ^19.2.0",
74
74
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"