@atlaskit/editor-plugin-table 7.11.4 → 7.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.11.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#96014](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/96014)
8
+ [`a24dcb2018ae`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a24dcb2018ae) -
9
+ Ensure tables in fixed mode always have explicit width set
10
+
3
11
  ## 7.11.4
4
12
 
5
13
  ### Patch Changes
@@ -543,9 +543,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
543
543
  shouldScale = true;
544
544
  shouldHandleColgroupUpdates = true;
545
545
  }
546
- if (isTableScalingEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.preserve-widths-with-lock-button') && getNode().attrs.displayMode !== this.node.attrs.displayMode) {
547
- shouldHandleColgroupUpdates = true;
548
- }
549
546
  if (shouldHandleColgroupUpdates) {
550
547
  this.handleColgroupUpdates();
551
548
  }
@@ -90,24 +90,12 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
90
90
  value: function getContentDOM() {
91
91
  var rendered = _model.DOMSerializer.renderSpec(document, toDOM(this.node, this.reactComponentProps));
92
92
  if (rendered.dom) {
93
+ var _this$options, _this$options2;
93
94
  this.table = rendered.dom;
94
- if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.preserve-widths-with-lock-button')) {
95
- var _this$options;
96
- if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled)) {
97
- // Preserve Table Width cannot have inline width set on the table
98
- var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos());
99
- if (tableInlineWidth) {
100
- handleInlineTableWidth(this.table, tableInlineWidth);
101
- }
102
- }
103
- } else {
104
- var _this$options2;
105
- if (!((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.isTableScalingEnabled) || this.node.attrs.displayMode === 'fixed') {
106
- // Preserve Table Width cannot have inline width set on the table
107
- var _tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos());
108
- if (_tableInlineWidth) {
109
- handleInlineTableWidth(this.table, _tableInlineWidth);
110
- }
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 && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.preserve-widths-with-lock-button') && this.node.attrs.displayMode === 'fixed') {
96
+ var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos());
97
+ if (tableInlineWidth) {
98
+ handleInlineTableWidth(this.table, tableInlineWidth);
111
99
  }
112
100
  }
113
101
  }
@@ -117,7 +105,8 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
117
105
  key: "setDomAttrs",
118
106
  value: function setDomAttrs(node) {
119
107
  var _this2 = this,
120
- _this$options3;
108
+ _this$options3,
109
+ _this$options4;
121
110
  if (!this.table) {
122
111
  return;
123
112
  }
@@ -127,7 +116,7 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
127
116
  });
128
117
 
129
118
  // Preserve Table Width cannot have inline width set on the table
130
- if (!((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.isTableScalingEnabled)) {
119
+ if (!((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.isTableScalingEnabled) || (_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.isTableScalingEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.preserve-widths-with-lock-button') && node.attrs.displayMode === 'fixed') {
131
120
  var _tableWidthPluginKey$;
132
121
  // handle inline style when table been resized
133
122
  var tableInlineWidth = getInlineWidth(node, this.reactComponentProps.options, this.view.state, this.getPos());
@@ -529,9 +529,6 @@ class TableComponent extends React.Component {
529
529
  shouldScale = true;
530
530
  shouldHandleColgroupUpdates = true;
531
531
  }
532
- if (isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && getNode().attrs.displayMode !== this.node.attrs.displayMode) {
533
- shouldHandleColgroupUpdates = true;
534
- }
535
532
  if (shouldHandleColgroupUpdates) {
536
533
  this.handleColgroupUpdates();
537
534
  }
@@ -65,31 +65,19 @@ export default class TableView extends ReactNodeView {
65
65
  getContentDOM() {
66
66
  const rendered = DOMSerializer.renderSpec(document, toDOM(this.node, this.reactComponentProps));
67
67
  if (rendered.dom) {
68
+ var _this$options, _this$options2;
68
69
  this.table = rendered.dom;
69
- if (!getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')) {
70
- var _this$options;
71
- if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled)) {
72
- // Preserve Table Width cannot have inline width set on the table
73
- const tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos());
74
- if (tableInlineWidth) {
75
- handleInlineTableWidth(this.table, tableInlineWidth);
76
- }
77
- }
78
- } else {
79
- var _this$options2;
80
- if (!((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.isTableScalingEnabled) || this.node.attrs.displayMode === 'fixed') {
81
- // Preserve Table Width cannot have inline width set on the table
82
- const tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos());
83
- if (tableInlineWidth) {
84
- handleInlineTableWidth(this.table, tableInlineWidth);
85
- }
70
+ 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 && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && this.node.attrs.displayMode === 'fixed') {
71
+ const tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos());
72
+ if (tableInlineWidth) {
73
+ handleInlineTableWidth(this.table, tableInlineWidth);
86
74
  }
87
75
  }
88
76
  }
89
77
  return rendered;
90
78
  }
91
79
  setDomAttrs(node) {
92
- var _this$options3;
80
+ var _this$options3, _this$options4;
93
81
  if (!this.table) {
94
82
  return;
95
83
  }
@@ -99,7 +87,7 @@ export default class TableView extends ReactNodeView {
99
87
  });
100
88
 
101
89
  // Preserve Table Width cannot have inline width set on the table
102
- if (!((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.isTableScalingEnabled)) {
90
+ if (!((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.isTableScalingEnabled) || (_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && node.attrs.displayMode === 'fixed') {
103
91
  var _tableWidthPluginKey$;
104
92
  // handle inline style when table been resized
105
93
  const tableInlineWidth = getInlineWidth(node, this.reactComponentProps.options, this.view.state, this.getPos());
@@ -536,9 +536,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
536
536
  shouldScale = true;
537
537
  shouldHandleColgroupUpdates = true;
538
538
  }
539
- if (isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && getNode().attrs.displayMode !== this.node.attrs.displayMode) {
540
- shouldHandleColgroupUpdates = true;
541
- }
542
539
  if (shouldHandleColgroupUpdates) {
543
540
  this.handleColgroupUpdates();
544
541
  }
@@ -83,24 +83,12 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
83
83
  value: function getContentDOM() {
84
84
  var rendered = DOMSerializer.renderSpec(document, toDOM(this.node, this.reactComponentProps));
85
85
  if (rendered.dom) {
86
+ var _this$options, _this$options2;
86
87
  this.table = rendered.dom;
87
- if (!getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')) {
88
- var _this$options;
89
- if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled)) {
90
- // Preserve Table Width cannot have inline width set on the table
91
- var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos());
92
- if (tableInlineWidth) {
93
- handleInlineTableWidth(this.table, tableInlineWidth);
94
- }
95
- }
96
- } else {
97
- var _this$options2;
98
- if (!((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.isTableScalingEnabled) || this.node.attrs.displayMode === 'fixed') {
99
- // Preserve Table Width cannot have inline width set on the table
100
- var _tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos());
101
- if (_tableInlineWidth) {
102
- handleInlineTableWidth(this.table, _tableInlineWidth);
103
- }
88
+ 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 && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && this.node.attrs.displayMode === 'fixed') {
89
+ var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos());
90
+ if (tableInlineWidth) {
91
+ handleInlineTableWidth(this.table, tableInlineWidth);
104
92
  }
105
93
  }
106
94
  }
@@ -110,7 +98,8 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
110
98
  key: "setDomAttrs",
111
99
  value: function setDomAttrs(node) {
112
100
  var _this2 = this,
113
- _this$options3;
101
+ _this$options3,
102
+ _this$options4;
114
103
  if (!this.table) {
115
104
  return;
116
105
  }
@@ -120,7 +109,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
120
109
  });
121
110
 
122
111
  // Preserve Table Width cannot have inline width set on the table
123
- if (!((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.isTableScalingEnabled)) {
112
+ if (!((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.isTableScalingEnabled) || (_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && node.attrs.displayMode === 'fixed') {
124
113
  var _tableWidthPluginKey$;
125
114
  // handle inline style when table been resized
126
115
  var tableInlineWidth = getInlineWidth(node, this.reactComponentProps.options, this.view.state, this.getPos());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.11.4",
3
+ "version": "7.11.5",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@atlaskit/adf-schema": "^35.12.1",
32
32
  "@atlaskit/custom-steps": "^0.1.0",
33
- "@atlaskit/editor-common": "^78.36.0",
33
+ "@atlaskit/editor-common": "^78.37.0",
34
34
  "@atlaskit/editor-palette": "1.6.0",
35
35
  "@atlaskit/editor-plugin-accessibility-utils": "^1.1.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.1.0",
@@ -490,14 +490,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
490
490
  shouldHandleColgroupUpdates = true;
491
491
  }
492
492
 
493
- if (
494
- isTableScalingEnabled &&
495
- getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') &&
496
- getNode().attrs.displayMode !== this.node.attrs.displayMode
497
- ) {
498
- shouldHandleColgroupUpdates = true;
499
- }
500
-
501
493
  if (shouldHandleColgroupUpdates) {
502
494
  this.handleColgroupUpdates();
503
495
  }
@@ -138,35 +138,21 @@ export default class TableView extends ReactNodeView<Props> {
138
138
  this.table = rendered.dom;
139
139
 
140
140
  if (
141
- !getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')
141
+ !this.options?.isTableScalingEnabled ||
142
+ (this.options?.isTableScalingEnabled &&
143
+ getBooleanFF(
144
+ 'platform.editor.table.preserve-widths-with-lock-button',
145
+ ) &&
146
+ this.node.attrs.displayMode === 'fixed')
142
147
  ) {
143
- if (!this.options?.isTableScalingEnabled) {
144
- // Preserve Table Width cannot have inline width set on the table
145
- const tableInlineWidth = getInlineWidth(
146
- this.node,
147
- this.reactComponentProps.options,
148
- this.reactComponentProps.view.state,
149
- this.reactComponentProps.getPos(),
150
- );
151
- if (tableInlineWidth) {
152
- handleInlineTableWidth(this.table, tableInlineWidth);
153
- }
154
- }
155
- } else {
156
- if (
157
- !this.options?.isTableScalingEnabled ||
158
- this.node.attrs.displayMode === 'fixed'
159
- ) {
160
- // Preserve Table Width cannot have inline width set on the table
161
- const tableInlineWidth = getInlineWidth(
162
- this.node,
163
- this.reactComponentProps.options,
164
- this.reactComponentProps.view.state,
165
- this.reactComponentProps.getPos(),
166
- );
167
- if (tableInlineWidth) {
168
- handleInlineTableWidth(this.table, tableInlineWidth);
169
- }
148
+ const tableInlineWidth = getInlineWidth(
149
+ this.node,
150
+ this.reactComponentProps.options,
151
+ this.reactComponentProps.view.state,
152
+ this.reactComponentProps.getPos(),
153
+ );
154
+ if (tableInlineWidth) {
155
+ handleInlineTableWidth(this.table, tableInlineWidth);
170
156
  }
171
157
  }
172
158
  }
@@ -184,7 +170,14 @@ export default class TableView extends ReactNodeView<Props> {
184
170
  });
185
171
 
186
172
  // Preserve Table Width cannot have inline width set on the table
187
- if (!this.options?.isTableScalingEnabled) {
173
+ if (
174
+ !this.options?.isTableScalingEnabled ||
175
+ (this.options?.isTableScalingEnabled &&
176
+ getBooleanFF(
177
+ 'platform.editor.table.preserve-widths-with-lock-button',
178
+ ) &&
179
+ node.attrs.displayMode === 'fixed')
180
+ ) {
188
181
  // handle inline style when table been resized
189
182
  const tableInlineWidth = getInlineWidth(
190
183
  node,