@atlaskit/editor-plugin-table 17.7.1 → 17.7.3
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 +19 -0
- package/dist/cjs/nodeviews/TableComponent.js +12 -1
- package/dist/cjs/nodeviews/TableContainer.js +3 -8
- package/dist/cjs/nodeviews/TableRow.js +7 -12
- package/dist/cjs/nodeviews/toDOM.js +10 -1
- package/dist/es2019/nodeviews/TableComponent.js +10 -1
- package/dist/es2019/nodeviews/TableContainer.js +3 -8
- package/dist/es2019/nodeviews/TableRow.js +7 -12
- package/dist/es2019/nodeviews/toDOM.js +10 -1
- package/dist/esm/nodeviews/TableComponent.js +12 -1
- package/dist/esm/nodeviews/TableContainer.js +3 -8
- package/dist/esm/nodeviews/TableRow.js +7 -12
- package/dist/esm/nodeviews/toDOM.js +10 -1
- package/package.json +5 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 17.7.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`477d48a3021a5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/477d48a3021a5) -
|
|
8
|
+
EDITOR-5818 fix to not send dispatch during render or in ref callback
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 17.7.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`1fd2b267eb592`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1fd2b267eb592) -
|
|
16
|
+
Cleanup `platform_editor_ai_aifc_patch_ga` flag
|
|
17
|
+
- [`ac4a428022f83`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ac4a428022f83) -
|
|
18
|
+
[EDITOR-5480] Removes data-borders-ready fix from table and adds border to prosemirror toDOM
|
|
19
|
+
instead
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 17.7.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -89,6 +89,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
89
89
|
tr.setMeta('mouseEnterTable', [tableId, node, pos]);
|
|
90
90
|
_this.props.view.dispatch(tr);
|
|
91
91
|
});
|
|
92
|
+
(0, _defineProperty2.default)(_this, "lastSetTableRef", null);
|
|
92
93
|
(0, _defineProperty2.default)(_this, "onStickyState", function (state) {
|
|
93
94
|
var pos = _this.props.getPos();
|
|
94
95
|
if (!(0, _utils.isValidPosition)(pos, _this.props.view.state)) {
|
|
@@ -379,6 +380,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
379
380
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
380
381
|
window.addEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
381
382
|
}
|
|
383
|
+
this.dispatchTableRefUpdate();
|
|
382
384
|
}
|
|
383
385
|
}, {
|
|
384
386
|
key: "initialiseEventListenersAfterMount",
|
|
@@ -744,6 +746,15 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
744
746
|
}
|
|
745
747
|
this.handleTableResizingDebounced();
|
|
746
748
|
}
|
|
749
|
+
this.dispatchTableRefUpdate();
|
|
750
|
+
}
|
|
751
|
+
}, {
|
|
752
|
+
key: "dispatchTableRefUpdate",
|
|
753
|
+
value: function dispatchTableRefUpdate() {
|
|
754
|
+
if (this.table && this.table !== this.lastSetTableRef && this.props.view && (0, _expValEquals.expValEquals)('platform_editor_fix_editor_unhandled_type_errors', 'isEnabled', true) && ((0, _expValEquals.expValEquals)('platform_editor_table_update_table_ref', 'isEnabled', true) || (0, _platformFeatureFlags.fg)('platform_editor_enable_table_update_ref_atlas'))) {
|
|
755
|
+
this.lastSetTableRef = this.table;
|
|
756
|
+
(0, _commands.setTableRef)(this.table)(this.props.view.state, this.props.view.dispatch);
|
|
757
|
+
}
|
|
747
758
|
}
|
|
748
759
|
}, {
|
|
749
760
|
key: "observeTable",
|
|
@@ -917,7 +928,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
917
928
|
|
|
918
929
|
// // Update tableRef in plugin state when table is properly mounted
|
|
919
930
|
// // At this point, both table and wrapper are in DOM with correct parent-child relationship
|
|
920
|
-
if (_this5.table && _this5.props.view && ((0, _expValEquals.expValEquals)('platform_editor_table_update_table_ref', 'isEnabled', true) || (0, _platformFeatureFlags.fg)('platform_editor_enable_table_update_ref_atlas'))) {
|
|
931
|
+
if (_this5.table && _this5.props.view && !(0, _expValEquals.expValEquals)('platform_editor_fix_editor_unhandled_type_errors', 'isEnabled', true) && ((0, _expValEquals.expValEquals)('platform_editor_table_update_table_ref', 'isEnabled', true) || (0, _platformFeatureFlags.fg)('platform_editor_enable_table_update_ref_atlas'))) {
|
|
921
932
|
(0, _commands.setTableRef)(_this5.table)(_this5.props.view.state, _this5.props.view.dispatch);
|
|
922
933
|
}
|
|
923
934
|
}
|
|
@@ -30,9 +30,7 @@ var InnerContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
30
30
|
var className = _ref.className,
|
|
31
31
|
style = _ref.style,
|
|
32
32
|
node = _ref.node,
|
|
33
|
-
children = _ref.children
|
|
34
|
-
tableWrapperHeight = _ref.tableWrapperHeight;
|
|
35
|
-
var bordersReady = (0, _expValEquals.expValEquals)('platform_editor_vc90_transition_table_border', 'isEnabled', true) ? tableWrapperHeight !== undefined && tableWrapperHeight > 0 : undefined;
|
|
33
|
+
children = _ref.children;
|
|
36
34
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
37
35
|
ref: ref
|
|
38
36
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -43,7 +41,6 @@ var InnerContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
43
41
|
className: className,
|
|
44
42
|
"data-number-column": node.attrs.isNumberColumnEnabled,
|
|
45
43
|
"data-layout": node.attrs.layout,
|
|
46
|
-
"data-borders-ready": bordersReady,
|
|
47
44
|
"data-testid": "table-container"
|
|
48
45
|
}, children);
|
|
49
46
|
});
|
|
@@ -345,8 +342,7 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
345
342
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
346
343
|
, {
|
|
347
344
|
className: className,
|
|
348
|
-
node: node
|
|
349
|
-
tableWrapperHeight: tableWrapperHeight
|
|
345
|
+
node: node
|
|
350
346
|
}, children))));
|
|
351
347
|
});
|
|
352
348
|
var TableContainer = exports.TableContainer = function TableContainer(_ref5) {
|
|
@@ -405,8 +401,7 @@ var TableContainer = exports.TableContainer = function TableContainer(_ref5) {
|
|
|
405
401
|
var isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
|
|
406
402
|
var resizableTableWidth = isFullPageAppearance ? (0, _misc.getTableResizerContainerForFullPageWidthInCSS)(node, isTableScalingEnabled) : "calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2))";
|
|
407
403
|
return /*#__PURE__*/_react.default.createElement(InnerContainer, {
|
|
408
|
-
node: node
|
|
409
|
-
tableWrapperHeight: tableWrapperHeight
|
|
404
|
+
node: node
|
|
410
405
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
411
406
|
,
|
|
412
407
|
className: (0, _classnames.default)(className, {
|
|
@@ -17,7 +17,6 @@ var _nesting = require("@atlaskit/editor-common/nesting");
|
|
|
17
17
|
var _nodeVisibility = require("@atlaskit/editor-common/node-visibility");
|
|
18
18
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
19
19
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
20
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
20
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
22
21
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
23
22
|
var _commands = require("../pm-plugins/sticky-headers/commands");
|
|
@@ -101,20 +100,16 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
101
100
|
}
|
|
102
101
|
var pos = _this.getPos();
|
|
103
102
|
_this.isInNestedTable = false;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
// E.g. when AI streaming brings in new content, this position brings back incorrect values that cannot be resolved
|
|
110
|
-
if (pos) {
|
|
111
|
-
_this.isInNestedTable = (0, _nesting.getParentOfTypeCount)(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
112
|
-
}
|
|
113
|
-
} catch (e) {}
|
|
114
|
-
} else {
|
|
103
|
+
try {
|
|
104
|
+
// We cannot trust that the value from getPos will be defined
|
|
105
|
+
// https://discuss.prosemirror.net/t/getpos-is-undefined-in-nodeview-constructor/1246/4
|
|
106
|
+
// There are also scenarios where the value it brings back does not tally with the current doc
|
|
107
|
+
// E.g. when AI streaming brings in new content, this position brings back incorrect values that cannot be resolved
|
|
115
108
|
if (pos) {
|
|
116
109
|
_this.isInNestedTable = (0, _nesting.getParentOfTypeCount)(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
117
110
|
}
|
|
111
|
+
} catch (_unused) {
|
|
112
|
+
// Intentionally swallowed — getPos can return stale positions during AI streaming
|
|
118
113
|
}
|
|
119
114
|
if (_this.isHeaderRow) {
|
|
120
115
|
_this.dom.setAttribute('data-vc-nvs', 'true');
|
|
@@ -62,7 +62,16 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
|
|
|
62
62
|
}, ['table', attrs, colgroup, ['tbody', 0]]], ['div', {
|
|
63
63
|
class: 'pm-table-sticky-sentinel-bottom',
|
|
64
64
|
'data-testid': 'sticky-sentinel-bottom'
|
|
65
|
-
}]]
|
|
65
|
+
}]].concat((0, _toConsumableArray2.default)((0, _expValEquals.expValEquals)('platform_editor_vc90_transition_table_border', 'isEnabled', true) ? [['div', {
|
|
66
|
+
contenteditable: 'false',
|
|
67
|
+
class: 'pm-table-left-border',
|
|
68
|
+
'data-with-numbered-table': node.attrs.isNumberColumnEnabled,
|
|
69
|
+
'data-testid': 'table-left-border'
|
|
70
|
+
}], ['div', {
|
|
71
|
+
contenteditable: 'false',
|
|
72
|
+
class: 'pm-table-right-border',
|
|
73
|
+
'data-testid': 'table-right-border'
|
|
74
|
+
}]] : []));
|
|
66
75
|
if (!config.tableResizingEnabled || config.isNested) {
|
|
67
76
|
return ['div', {
|
|
68
77
|
class: 'tableView-content-wrap',
|
|
@@ -68,6 +68,7 @@ class TableComponent extends React.Component {
|
|
|
68
68
|
tr.setMeta('mouseEnterTable', [tableId, node, pos]);
|
|
69
69
|
this.props.view.dispatch(tr);
|
|
70
70
|
});
|
|
71
|
+
_defineProperty(this, "lastSetTableRef", null);
|
|
71
72
|
_defineProperty(this, "onStickyState", state => {
|
|
72
73
|
const pos = this.props.getPos();
|
|
73
74
|
if (!isValidPosition(pos, this.props.view.state)) {
|
|
@@ -357,6 +358,7 @@ class TableComponent extends React.Component {
|
|
|
357
358
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
358
359
|
window.addEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
359
360
|
}
|
|
361
|
+
this.dispatchTableRefUpdate();
|
|
360
362
|
}
|
|
361
363
|
initialiseEventListenersAfterMount() {
|
|
362
364
|
var _this$table, _this$table2, _this$table3;
|
|
@@ -707,6 +709,13 @@ class TableComponent extends React.Component {
|
|
|
707
709
|
}
|
|
708
710
|
this.handleTableResizingDebounced();
|
|
709
711
|
}
|
|
712
|
+
this.dispatchTableRefUpdate();
|
|
713
|
+
}
|
|
714
|
+
dispatchTableRefUpdate() {
|
|
715
|
+
if (this.table && this.table !== this.lastSetTableRef && this.props.view && expValEquals('platform_editor_fix_editor_unhandled_type_errors', 'isEnabled', true) && (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) || fg('platform_editor_enable_table_update_ref_atlas'))) {
|
|
716
|
+
this.lastSetTableRef = this.table;
|
|
717
|
+
setTableRef(this.table)(this.props.view.state, this.props.view.dispatch);
|
|
718
|
+
}
|
|
710
719
|
}
|
|
711
720
|
observeTable(table) {
|
|
712
721
|
if (table) {
|
|
@@ -882,7 +891,7 @@ class TableComponent extends React.Component {
|
|
|
882
891
|
|
|
883
892
|
// // Update tableRef in plugin state when table is properly mounted
|
|
884
893
|
// // At this point, both table and wrapper are in DOM with correct parent-child relationship
|
|
885
|
-
if (this.table && this.props.view && (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) || fg('platform_editor_enable_table_update_ref_atlas'))) {
|
|
894
|
+
if (this.table && this.props.view && !expValEquals('platform_editor_fix_editor_unhandled_type_errors', 'isEnabled', true) && (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) || fg('platform_editor_enable_table_update_ref_atlas'))) {
|
|
886
895
|
setTableRef(this.table)(this.props.view.state, this.props.view.dispatch);
|
|
887
896
|
}
|
|
888
897
|
}
|
|
@@ -20,10 +20,8 @@ const InnerContainer = /*#__PURE__*/forwardRef(({
|
|
|
20
20
|
className,
|
|
21
21
|
style,
|
|
22
22
|
node,
|
|
23
|
-
children
|
|
24
|
-
tableWrapperHeight
|
|
23
|
+
children
|
|
25
24
|
}, ref) => {
|
|
26
|
-
const bordersReady = expValEquals('platform_editor_vc90_transition_table_border', 'isEnabled', true) ? tableWrapperHeight !== undefined && tableWrapperHeight > 0 : undefined;
|
|
27
25
|
return /*#__PURE__*/React.createElement("div", {
|
|
28
26
|
ref: ref
|
|
29
27
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -34,7 +32,6 @@ const InnerContainer = /*#__PURE__*/forwardRef(({
|
|
|
34
32
|
className: className,
|
|
35
33
|
"data-number-column": node.attrs.isNumberColumnEnabled,
|
|
36
34
|
"data-layout": node.attrs.layout,
|
|
37
|
-
"data-borders-ready": bordersReady,
|
|
38
35
|
"data-testid": "table-container"
|
|
39
36
|
}, children);
|
|
40
37
|
});
|
|
@@ -339,8 +336,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
339
336
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
340
337
|
, {
|
|
341
338
|
className: className,
|
|
342
|
-
node: node
|
|
343
|
-
tableWrapperHeight: tableWrapperHeight
|
|
339
|
+
node: node
|
|
344
340
|
}, children))));
|
|
345
341
|
});
|
|
346
342
|
export const TableContainer = ({
|
|
@@ -402,8 +398,7 @@ export const TableContainer = ({
|
|
|
402
398
|
const isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
|
|
403
399
|
const resizableTableWidth = isFullPageAppearance ? getTableResizerContainerForFullPageWidthInCSS(node, isTableScalingEnabled) : `calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2))`;
|
|
404
400
|
return /*#__PURE__*/React.createElement(InnerContainer, {
|
|
405
|
-
node: node
|
|
406
|
-
tableWrapperHeight: tableWrapperHeight
|
|
401
|
+
node: node
|
|
407
402
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
408
403
|
,
|
|
409
404
|
className: classNames(className, {
|
|
@@ -5,7 +5,6 @@ import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
|
5
5
|
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
6
6
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
7
7
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
10
9
|
import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
|
|
11
10
|
import { updateStickyState } from '../pm-plugins/sticky-headers/commands';
|
|
@@ -86,20 +85,16 @@ export default class TableRow extends TableNodeView {
|
|
|
86
85
|
}
|
|
87
86
|
const pos = this.getPos();
|
|
88
87
|
this.isInNestedTable = false;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
// E.g. when AI streaming brings in new content, this position brings back incorrect values that cannot be resolved
|
|
95
|
-
if (pos) {
|
|
96
|
-
this.isInNestedTable = getParentOfTypeCount(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
97
|
-
}
|
|
98
|
-
} catch (e) {}
|
|
99
|
-
} else {
|
|
88
|
+
try {
|
|
89
|
+
// We cannot trust that the value from getPos will be defined
|
|
90
|
+
// https://discuss.prosemirror.net/t/getpos-is-undefined-in-nodeview-constructor/1246/4
|
|
91
|
+
// There are also scenarios where the value it brings back does not tally with the current doc
|
|
92
|
+
// E.g. when AI streaming brings in new content, this position brings back incorrect values that cannot be resolved
|
|
100
93
|
if (pos) {
|
|
101
94
|
this.isInNestedTable = getParentOfTypeCount(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
102
95
|
}
|
|
96
|
+
} catch {
|
|
97
|
+
// Intentionally swallowed — getPos can return stale positions during AI streaming
|
|
103
98
|
}
|
|
104
99
|
if (this.isHeaderRow) {
|
|
105
100
|
this.dom.setAttribute('data-vc-nvs', 'true');
|
|
@@ -46,7 +46,16 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
46
46
|
}, ['table', attrs, colgroup, ['tbody', 0]]], ['div', {
|
|
47
47
|
class: 'pm-table-sticky-sentinel-bottom',
|
|
48
48
|
'data-testid': 'sticky-sentinel-bottom'
|
|
49
|
-
}]
|
|
49
|
+
}], ...(expValEquals('platform_editor_vc90_transition_table_border', 'isEnabled', true) ? [['div', {
|
|
50
|
+
contenteditable: 'false',
|
|
51
|
+
class: 'pm-table-left-border',
|
|
52
|
+
'data-with-numbered-table': node.attrs.isNumberColumnEnabled,
|
|
53
|
+
'data-testid': 'table-left-border'
|
|
54
|
+
}], ['div', {
|
|
55
|
+
contenteditable: 'false',
|
|
56
|
+
class: 'pm-table-right-border',
|
|
57
|
+
'data-testid': 'table-right-border'
|
|
58
|
+
}]] : [])];
|
|
50
59
|
if (!config.tableResizingEnabled || config.isNested) {
|
|
51
60
|
return ['div', {
|
|
52
61
|
class: 'tableView-content-wrap',
|
|
@@ -83,6 +83,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
83
83
|
tr.setMeta('mouseEnterTable', [tableId, node, pos]);
|
|
84
84
|
_this.props.view.dispatch(tr);
|
|
85
85
|
});
|
|
86
|
+
_defineProperty(_this, "lastSetTableRef", null);
|
|
86
87
|
_defineProperty(_this, "onStickyState", function (state) {
|
|
87
88
|
var pos = _this.props.getPos();
|
|
88
89
|
if (!isValidPosition(pos, _this.props.view.state)) {
|
|
@@ -373,6 +374,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
373
374
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
374
375
|
window.addEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
375
376
|
}
|
|
377
|
+
this.dispatchTableRefUpdate();
|
|
376
378
|
}
|
|
377
379
|
}, {
|
|
378
380
|
key: "initialiseEventListenersAfterMount",
|
|
@@ -738,6 +740,15 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
738
740
|
}
|
|
739
741
|
this.handleTableResizingDebounced();
|
|
740
742
|
}
|
|
743
|
+
this.dispatchTableRefUpdate();
|
|
744
|
+
}
|
|
745
|
+
}, {
|
|
746
|
+
key: "dispatchTableRefUpdate",
|
|
747
|
+
value: function dispatchTableRefUpdate() {
|
|
748
|
+
if (this.table && this.table !== this.lastSetTableRef && this.props.view && expValEquals('platform_editor_fix_editor_unhandled_type_errors', 'isEnabled', true) && (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) || fg('platform_editor_enable_table_update_ref_atlas'))) {
|
|
749
|
+
this.lastSetTableRef = this.table;
|
|
750
|
+
setTableRef(this.table)(this.props.view.state, this.props.view.dispatch);
|
|
751
|
+
}
|
|
741
752
|
}
|
|
742
753
|
}, {
|
|
743
754
|
key: "observeTable",
|
|
@@ -911,7 +922,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
911
922
|
|
|
912
923
|
// // Update tableRef in plugin state when table is properly mounted
|
|
913
924
|
// // At this point, both table and wrapper are in DOM with correct parent-child relationship
|
|
914
|
-
if (_this5.table && _this5.props.view && (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) || fg('platform_editor_enable_table_update_ref_atlas'))) {
|
|
925
|
+
if (_this5.table && _this5.props.view && !expValEquals('platform_editor_fix_editor_unhandled_type_errors', 'isEnabled', true) && (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) || fg('platform_editor_enable_table_update_ref_atlas'))) {
|
|
915
926
|
setTableRef(_this5.table)(_this5.props.view.state, _this5.props.view.dispatch);
|
|
916
927
|
}
|
|
917
928
|
}
|
|
@@ -21,9 +21,7 @@ var InnerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
21
21
|
var className = _ref.className,
|
|
22
22
|
style = _ref.style,
|
|
23
23
|
node = _ref.node,
|
|
24
|
-
children = _ref.children
|
|
25
|
-
tableWrapperHeight = _ref.tableWrapperHeight;
|
|
26
|
-
var bordersReady = expValEquals('platform_editor_vc90_transition_table_border', 'isEnabled', true) ? tableWrapperHeight !== undefined && tableWrapperHeight > 0 : undefined;
|
|
24
|
+
children = _ref.children;
|
|
27
25
|
return /*#__PURE__*/React.createElement("div", {
|
|
28
26
|
ref: ref
|
|
29
27
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -34,7 +32,6 @@ var InnerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
34
32
|
className: className,
|
|
35
33
|
"data-number-column": node.attrs.isNumberColumnEnabled,
|
|
36
34
|
"data-layout": node.attrs.layout,
|
|
37
|
-
"data-borders-ready": bordersReady,
|
|
38
35
|
"data-testid": "table-container"
|
|
39
36
|
}, children);
|
|
40
37
|
});
|
|
@@ -336,8 +333,7 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
336
333
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
337
334
|
, {
|
|
338
335
|
className: className,
|
|
339
|
-
node: node
|
|
340
|
-
tableWrapperHeight: tableWrapperHeight
|
|
336
|
+
node: node
|
|
341
337
|
}, children))));
|
|
342
338
|
});
|
|
343
339
|
export var TableContainer = function TableContainer(_ref5) {
|
|
@@ -396,8 +392,7 @@ export var TableContainer = function TableContainer(_ref5) {
|
|
|
396
392
|
var isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
|
|
397
393
|
var resizableTableWidth = isFullPageAppearance ? getTableResizerContainerForFullPageWidthInCSS(node, isTableScalingEnabled) : "calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2))";
|
|
398
394
|
return /*#__PURE__*/React.createElement(InnerContainer, {
|
|
399
|
-
node: node
|
|
400
|
-
tableWrapperHeight: tableWrapperHeight
|
|
395
|
+
node: node
|
|
401
396
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
402
397
|
,
|
|
403
398
|
className: classNames(className, {
|
|
@@ -12,7 +12,6 @@ import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
|
12
12
|
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
13
13
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
14
14
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
15
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
15
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
17
16
|
import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
|
|
18
17
|
import { updateStickyState } from '../pm-plugins/sticky-headers/commands';
|
|
@@ -94,20 +93,16 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
|
|
|
94
93
|
}
|
|
95
94
|
var pos = _this.getPos();
|
|
96
95
|
_this.isInNestedTable = false;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
// E.g. when AI streaming brings in new content, this position brings back incorrect values that cannot be resolved
|
|
103
|
-
if (pos) {
|
|
104
|
-
_this.isInNestedTable = getParentOfTypeCount(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
105
|
-
}
|
|
106
|
-
} catch (e) {}
|
|
107
|
-
} else {
|
|
96
|
+
try {
|
|
97
|
+
// We cannot trust that the value from getPos will be defined
|
|
98
|
+
// https://discuss.prosemirror.net/t/getpos-is-undefined-in-nodeview-constructor/1246/4
|
|
99
|
+
// There are also scenarios where the value it brings back does not tally with the current doc
|
|
100
|
+
// E.g. when AI streaming brings in new content, this position brings back incorrect values that cannot be resolved
|
|
108
101
|
if (pos) {
|
|
109
102
|
_this.isInNestedTable = getParentOfTypeCount(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
110
103
|
}
|
|
104
|
+
} catch (_unused) {
|
|
105
|
+
// Intentionally swallowed — getPos can return stale positions during AI streaming
|
|
111
106
|
}
|
|
112
107
|
if (_this.isHeaderRow) {
|
|
113
108
|
_this.dom.setAttribute('data-vc-nvs', 'true');
|
|
@@ -55,7 +55,16 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
55
55
|
}, ['table', attrs, colgroup, ['tbody', 0]]], ['div', {
|
|
56
56
|
class: 'pm-table-sticky-sentinel-bottom',
|
|
57
57
|
'data-testid': 'sticky-sentinel-bottom'
|
|
58
|
-
}]]
|
|
58
|
+
}]].concat(_toConsumableArray(expValEquals('platform_editor_vc90_transition_table_border', 'isEnabled', true) ? [['div', {
|
|
59
|
+
contenteditable: 'false',
|
|
60
|
+
class: 'pm-table-left-border',
|
|
61
|
+
'data-with-numbered-table': node.attrs.isNumberColumnEnabled,
|
|
62
|
+
'data-testid': 'table-left-border'
|
|
63
|
+
}], ['div', {
|
|
64
|
+
contenteditable: 'false',
|
|
65
|
+
class: 'pm-table-right-border',
|
|
66
|
+
'data-testid': 'table-right-border'
|
|
67
|
+
}]] : []));
|
|
59
68
|
if (!config.tableResizingEnabled || config.isNested) {
|
|
60
69
|
return ['div', {
|
|
61
70
|
class: 'tableView-content-wrap',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "17.7.
|
|
3
|
+
"version": "17.7.3",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@atlaskit/editor-plugin-guideline": "^7.0.0",
|
|
42
42
|
"@atlaskit/editor-plugin-interaction": "^14.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-limited-mode": "^4.0.0",
|
|
44
|
-
"@atlaskit/editor-plugin-selection": "^7.
|
|
44
|
+
"@atlaskit/editor-plugin-selection": "^7.1.0",
|
|
45
45
|
"@atlaskit/editor-plugin-toolbar": "^4.1.0",
|
|
46
46
|
"@atlaskit/editor-plugin-user-intent": "^5.0.0",
|
|
47
47
|
"@atlaskit/editor-plugin-width": "^8.1.0",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
58
58
|
"@atlaskit/primitives": "^18.0.0",
|
|
59
59
|
"@atlaskit/theme": "^22.0.0",
|
|
60
|
-
"@atlaskit/tmp-editor-statsig": "^35.
|
|
60
|
+
"@atlaskit/tmp-editor-statsig": "^35.8.0",
|
|
61
61
|
"@atlaskit/toggle": "^15.2.0",
|
|
62
|
-
"@atlaskit/tokens": "^11.
|
|
62
|
+
"@atlaskit/tokens": "^11.1.0",
|
|
63
63
|
"@atlaskit/tooltip": "^20.14.0",
|
|
64
64
|
"@babel/runtime": "^7.0.0",
|
|
65
65
|
"@emotion/react": "^11.7.1",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"uuid": "^3.1.0"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@atlaskit/editor-common": "^111.
|
|
73
|
+
"@atlaskit/editor-common": "^111.34.0",
|
|
74
74
|
"react": "^18.2.0",
|
|
75
75
|
"react-dom": "^18.2.0",
|
|
76
76
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -136,9 +136,6 @@
|
|
|
136
136
|
"platform_editor_table_height_analytics_event": {
|
|
137
137
|
"type": "boolean"
|
|
138
138
|
},
|
|
139
|
-
"platform_editor_ai_aifc_patch_ga": {
|
|
140
|
-
"type": "boolean"
|
|
141
|
-
},
|
|
142
139
|
"platform_editor_change_table_nesting_check": {
|
|
143
140
|
"type": "boolean"
|
|
144
141
|
},
|