@atlaskit/editor-plugin-table 17.3.20 → 17.3.22
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 +16 -0
- package/dist/cjs/pm-plugins/commands/insert.js +2 -5
- package/dist/cjs/pm-plugins/utils/paste.js +32 -47
- package/dist/cjs/tablePlugin.js +2 -4
- package/dist/cjs/ui/DragHandle/index.js +10 -6
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/cjs/ui/FloatingDeleteButton/DeleteButton.js +6 -7
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +3 -0
- package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +6 -7
- package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +5 -6
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +22 -14
- package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +7 -6
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +2 -0
- package/dist/cjs/ui/TableFloatingControls/index.js +1 -0
- package/dist/es2019/pm-plugins/commands/insert.js +2 -5
- package/dist/es2019/pm-plugins/utils/paste.js +32 -47
- package/dist/es2019/tablePlugin.js +2 -4
- package/dist/es2019/ui/DragHandle/index.js +10 -6
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/es2019/ui/FloatingDeleteButton/DeleteButton.js +6 -7
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +3 -0
- package/dist/es2019/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +6 -7
- package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +5 -6
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +18 -14
- package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +5 -6
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +2 -0
- package/dist/es2019/ui/TableFloatingControls/index.js +1 -0
- package/dist/esm/pm-plugins/commands/insert.js +2 -5
- package/dist/esm/pm-plugins/utils/paste.js +32 -47
- package/dist/esm/tablePlugin.js +2 -4
- package/dist/esm/ui/DragHandle/index.js +10 -6
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/esm/ui/FloatingDeleteButton/DeleteButton.js +6 -7
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +3 -0
- package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +6 -7
- package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +5 -6
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +22 -14
- package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +7 -6
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +2 -0
- package/dist/esm/ui/TableFloatingControls/index.js +1 -0
- package/dist/types/ui/DragHandle/index.d.ts +3 -1
- package/dist/types-ts4.5/ui/DragHandle/index.d.ts +3 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 17.3.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`a040c03082274`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a040c03082274) -
|
|
8
|
+
[ux] EDITOR-507 Clean up main nested tables experiment `platform_editor_nested_tables`
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 17.3.21
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`dece098c3ab1f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dece098c3ab1f) -
|
|
16
|
+
[ux] ENGHEALTH-46818 Add focus and blur handlers to table buttons to fix a11y
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 17.3.20
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -15,7 +15,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
15
15
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
16
16
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
17
17
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
18
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
19
18
|
var _commands = require("../analytics/commands");
|
|
20
19
|
var _tableAnalytics = require("../table-analytics");
|
|
21
20
|
var _columnWidth = require("../transforms/column-width");
|
|
@@ -274,10 +273,8 @@ var insertTableWithNestingSupport = exports.insertTableWithNestingSupport = func
|
|
|
274
273
|
var insertAt;
|
|
275
274
|
var isNestedTable = false;
|
|
276
275
|
if ((0, _utils.hasParentNodeOfType)(schema.nodes.table)(tr.selection) && (0, _nesting.isNestedTablesSupported)(schema)) {
|
|
277
|
-
// If
|
|
278
|
-
if ((0,
|
|
279
|
-
exposure: true
|
|
280
|
-
}) || (0, _nesting.getParentOfTypeCount)(schema.nodes.table)(tr.selection.$from) > 1) {
|
|
276
|
+
// If trying to nest deeper than one level, we insert the table after the top table
|
|
277
|
+
if ((0, _nesting.getParentOfTypeCount)(schema.nodes.table)(tr.selection.$from) > 1) {
|
|
281
278
|
var positionAfterTopTable = (0, _nesting.getPositionAfterTopParentNodeOfType)(schema.nodes.table)(tr.selection.$from);
|
|
282
279
|
if (!positionAfterTopTable) {
|
|
283
280
|
return tr;
|
|
@@ -14,7 +14,6 @@ var _model = require("@atlaskit/editor-prosemirror/model");
|
|
|
14
14
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
15
15
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
16
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
18
17
|
var _pluginFactory = require("../plugin-factory");
|
|
19
18
|
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; }
|
|
20
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; }
|
|
@@ -75,17 +74,16 @@ var removeTableFromLastChild = exports.removeTableFromLastChild = function remov
|
|
|
75
74
|
return i === fragment.childCount - 1 ? unwrapContentFromTable(node) : node;
|
|
76
75
|
};
|
|
77
76
|
var transformSliceToRemoveNestedTables = exports.transformSliceToRemoveNestedTables = function transformSliceToRemoveNestedTables(slice, schema, selection) {
|
|
78
|
-
var isNestingAllowed = (0, _experiments.editorExperiment)('nested-tables-in-tables', true);
|
|
79
77
|
var _schema$nodes2 = schema.nodes,
|
|
80
78
|
table = _schema$nodes2.table,
|
|
81
79
|
tableCell = _schema$nodes2.tableCell,
|
|
82
80
|
tableHeader = _schema$nodes2.tableHeader;
|
|
83
81
|
var openEnd = slice.openEnd;
|
|
84
82
|
var newFragment = (0, _utils.flatmap)(slice.content, function (node, i, fragment) {
|
|
85
|
-
var _slice$content$firstC;
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
var allowedTableNesting =
|
|
83
|
+
var _slice$content$firstC, _slice$content$lastCh;
|
|
84
|
+
// We allow default nesting of 2 to support
|
|
85
|
+
// two levels of nesting in nodes that support table nesting already such as layoutSection and expands
|
|
86
|
+
var allowedTableNesting = 2;
|
|
89
87
|
var isCellSelection = selection instanceof _editorTables.CellSelection;
|
|
90
88
|
var isPasteInTable = (0, _utils2.hasParentNodeOfType)([table, tableCell, tableHeader])(selection);
|
|
91
89
|
var isPasteInNestedTable = (0, _nesting.getParentOfTypeCount)(schema.nodes.table)(selection.$from) > 1;
|
|
@@ -93,55 +91,42 @@ var transformSliceToRemoveNestedTables = exports.transformSliceToRemoveNestedTab
|
|
|
93
91
|
|
|
94
92
|
// Pasted content only contains a table and no other content
|
|
95
93
|
var isCellPaste = isPasteInTable && slice.content.childCount === 1 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === table && (!isPasteFullTableInsideEmptyCellEnabled || slice.openStart !== 0 && slice.openEnd !== 0);
|
|
96
|
-
if (isNestingAllowed) {
|
|
97
|
-
var _slice$content$lastCh;
|
|
98
|
-
// if nesting is allowed we bump up the default nesting allowance to 2 to support
|
|
99
|
-
// two levels of nesting in nodes that support table nesting already such as layoutSection and expands
|
|
100
|
-
allowedTableNesting = 2;
|
|
101
94
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
// if paste is inside a table, allow no further nesting
|
|
107
|
-
if (isPasteInTable) {
|
|
108
|
-
allowedTableNesting = 0;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// unless we are pasting inside a nested table, then bounce back to 1 level
|
|
112
|
-
// because editor-plugin-paste will lift the table to the parent table (just below it)
|
|
113
|
-
if (isPasteInNestedTable) {
|
|
114
|
-
allowedTableNesting = 1;
|
|
115
|
-
}
|
|
95
|
+
// however if pasted content is a table, allow just one level
|
|
96
|
+
if (node.type === schema.nodes.table) {
|
|
97
|
+
allowedTableNesting = 1;
|
|
116
98
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
allowedTableNesting = 1;
|
|
121
|
-
if (isPasteInNestedTable) {
|
|
122
|
-
allowedTableNesting = 0;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
99
|
+
// if paste is inside a table, allow no further nesting
|
|
100
|
+
if (isPasteInTable) {
|
|
101
|
+
allowedTableNesting = 0;
|
|
125
102
|
}
|
|
126
103
|
|
|
127
|
-
//
|
|
128
|
-
//
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if (slice.openEnd >= 7 &&
|
|
132
|
-
// depth of a nested table cell
|
|
133
|
-
slice.content.childCount > 1 && ((_slice$content$lastCh = slice.content.lastChild) === null || _slice$content$lastCh === void 0 ? void 0 : _slice$content$lastCh.type) === table && isPasteInTable) {
|
|
134
|
-
// re-point the slice's openEnd to non-nested table cell depth
|
|
135
|
-
openEnd = 4;
|
|
104
|
+
// unless we are pasting inside a nested table, then bounce back to 1 level
|
|
105
|
+
// because editor-plugin-paste will lift the table to the parent table (just below it)
|
|
106
|
+
if (isPasteInNestedTable) {
|
|
107
|
+
allowedTableNesting = 1;
|
|
136
108
|
}
|
|
137
|
-
} else {
|
|
138
|
-
// for layouts and expands, we start with 1 level of nesting as set above
|
|
139
109
|
|
|
140
|
-
//
|
|
141
|
-
|
|
142
|
-
|
|
110
|
+
// paste of table cells into a table cell - content is spread across multiple cells
|
|
111
|
+
// by editor-tables so needs to be treated a little differently
|
|
112
|
+
if (isCellPaste || isCellSelection) {
|
|
113
|
+
allowedTableNesting = 1;
|
|
114
|
+
if (isPasteInNestedTable) {
|
|
115
|
+
allowedTableNesting = 0;
|
|
116
|
+
}
|
|
143
117
|
}
|
|
144
118
|
}
|
|
119
|
+
|
|
120
|
+
// Prevent invalid openEnd after pasting tables with a selection that ends inside a nested table cell.
|
|
121
|
+
// If the slice ends with a selection that ends inside a nested table, and we paste inside a table we
|
|
122
|
+
// need to adjust the openEnd because it is no longer correct. If we don't, Prosemirror fires an exception
|
|
123
|
+
// because it iterates to a non-existent depth and the transform will not be applied
|
|
124
|
+
if (slice.openEnd >= 7 &&
|
|
125
|
+
// depth of a nested table cell
|
|
126
|
+
slice.content.childCount > 1 && ((_slice$content$lastCh = slice.content.lastChild) === null || _slice$content$lastCh === void 0 ? void 0 : _slice$content$lastCh.type) === table && isPasteInTable) {
|
|
127
|
+
// re-point the slice's openEnd to non-nested table cell depth
|
|
128
|
+
openEnd = 4;
|
|
129
|
+
}
|
|
145
130
|
if (isCellSelection && !isCellPaste) {
|
|
146
131
|
// if pasting into a cell selection, we need to flatten the parent table as well
|
|
147
132
|
return _unwrapNestedTables(_model.Fragment.fromArray([node]), schema, allowedTableNesting);
|
package/dist/cjs/tablePlugin.js
CHANGED
|
@@ -574,10 +574,8 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
574
574
|
var tr = state.tr;
|
|
575
575
|
// If the cursor is inside a table
|
|
576
576
|
if ((0, _utils.hasParentNodeOfType)(state.schema.nodes.table)(state.selection) && options !== null && options !== void 0 && (_options$tableOptions6 = options.tableOptions) !== null && _options$tableOptions6 !== void 0 && _options$tableOptions6.allowNestedTables) {
|
|
577
|
-
// If
|
|
578
|
-
if ((0,
|
|
579
|
-
exposure: true
|
|
580
|
-
}) || (0, _nesting.getParentOfTypeCount)(state.schema.nodes.table)(state.selection.$from) > 1) {
|
|
577
|
+
// If trying to nest deeper than one level, we insert the table after the top table
|
|
578
|
+
if ((0, _nesting.getParentOfTypeCount)(state.schema.nodes.table)(state.selection.$from) > 1) {
|
|
581
579
|
// Nesting is too deep insert table after the top parent table
|
|
582
580
|
var positionAfterTopTable = (0, _nesting.getPositionAfterTopParentNodeOfType)(state.schema.nodes.table)(state.selection.$from);
|
|
583
581
|
tr = (0, _utils.safeInsert)(tableNode, positionAfterTopTable)(tr);
|
|
@@ -42,6 +42,8 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
42
42
|
previewHeight = _ref.previewHeight,
|
|
43
43
|
_onMouseOver = _ref.onMouseOver,
|
|
44
44
|
_onMouseOut = _ref.onMouseOut,
|
|
45
|
+
onFocus = _ref.onFocus,
|
|
46
|
+
onBlur = _ref.onBlur,
|
|
45
47
|
toggleDragMenu = _ref.toggleDragMenu,
|
|
46
48
|
hoveredCell = _ref.hoveredCell,
|
|
47
49
|
onClick = _ref.onClick,
|
|
@@ -203,19 +205,21 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
203
205
|
"data-testid": "table-drag-handle-button",
|
|
204
206
|
"aria-label": formatMessage(isRow ? _messages.tableMessages.rowDragHandle : _messages.tableMessages.columnDragHandle),
|
|
205
207
|
"aria-expanded": isDragMenuOpen && isDragMenuTarget ? 'true' : 'false',
|
|
206
|
-
"aria-haspopup": "menu"
|
|
207
|
-
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
208
|
-
,
|
|
208
|
+
"aria-haspopup": "menu",
|
|
209
209
|
onMouseOver: function onMouseOver(e) {
|
|
210
210
|
setIsHovered(true);
|
|
211
211
|
_onMouseOver && _onMouseOver(e);
|
|
212
|
-
}
|
|
213
|
-
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
214
|
-
,
|
|
212
|
+
},
|
|
215
213
|
onMouseOut: function onMouseOut(e) {
|
|
216
214
|
setIsHovered(false);
|
|
217
215
|
_onMouseOut && _onMouseOut(e);
|
|
218
216
|
},
|
|
217
|
+
onFocus: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? function (e) {
|
|
218
|
+
onFocus && onFocus(e);
|
|
219
|
+
} : undefined,
|
|
220
|
+
onBlur: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? function (e) {
|
|
221
|
+
onBlur && onBlur(e);
|
|
222
|
+
} : undefined,
|
|
219
223
|
onMouseUp: function onMouseUp(e) {
|
|
220
224
|
// return focus to editor so copying table selections whilst still works, i cannot call e.preventDefault in a mousemove event as this stops dragstart events from firing
|
|
221
225
|
// -> this is bad for a11y but is the current standard new copy/paste keyboard shortcuts should be introduced instead
|
|
@@ -38,6 +38,7 @@ var _tableColumnsDistribute = _interopRequireDefault(require("@atlaskit/icon/cor
|
|
|
38
38
|
var _tableRowAddBelow = _interopRequireDefault(require("@atlaskit/icon/core/table-row-add-below"));
|
|
39
39
|
var _tableRowDelete = _interopRequireDefault(require("@atlaskit/icon/core/table-row-delete"));
|
|
40
40
|
var _primitives = require("@atlaskit/primitives");
|
|
41
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
41
42
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
42
43
|
var _commands = require("../../pm-plugins/commands");
|
|
43
44
|
var _commandsWithAnalytics = require("../../pm-plugins/commands/commands-with-analytics");
|
|
@@ -749,10 +750,9 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
749
750
|
userIntent: "tableContextualMenuPopupOpen",
|
|
750
751
|
api: api
|
|
751
752
|
}, (0, _react2.jsx)("div", {
|
|
752
|
-
"data-testid": "table-cell-contextual-menu"
|
|
753
|
-
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
754
|
-
,
|
|
753
|
+
"data-testid": "table-cell-contextual-menu",
|
|
755
754
|
onMouseLeave: this.closeSubmenu,
|
|
755
|
+
onBlur: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? this.closeSubmenu : undefined,
|
|
756
756
|
ref: this.dropdownMenuRef
|
|
757
757
|
}, (0, _react2.jsx)(_uiMenu.DropdownMenu
|
|
758
758
|
//This needs be removed when the a11y is completely handled
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
10
11
|
var _types = require("../../types");
|
|
11
12
|
var DeleteButton = function DeleteButton(_ref) {
|
|
12
13
|
var style = _ref.style,
|
|
@@ -20,13 +21,11 @@ var DeleteButton = function DeleteButton(_ref) {
|
|
|
20
21
|
className: _types.TableCssClassName.CONTROLS_DELETE_BUTTON_WRAP
|
|
21
22
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
22
23
|
,
|
|
23
|
-
style: style
|
|
24
|
-
|
|
25
|
-
,
|
|
26
|
-
onMouseEnter:
|
|
27
|
-
|
|
28
|
-
,
|
|
29
|
-
onMouseLeave: onMouseLeave
|
|
24
|
+
style: style,
|
|
25
|
+
onMouseEnter: onMouseEnter,
|
|
26
|
+
onMouseLeave: onMouseLeave,
|
|
27
|
+
onFocus: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? onMouseEnter : undefined,
|
|
28
|
+
onBlur: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? onMouseLeave : undefined
|
|
30
29
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
31
30
|
type: "button",
|
|
32
31
|
"aria-label": formatMessage(removeLabel, {
|
|
@@ -11,6 +11,7 @@ var _styles = require("@atlaskit/editor-common/styles");
|
|
|
11
11
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
12
12
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
13
13
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
14
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
15
|
var _commands = require("../../../pm-plugins/commands");
|
|
15
16
|
var _commandsWithAnalytics = require("../../../pm-plugins/drag-and-drop/commands-with-analytics");
|
|
16
17
|
var _rowControls = require("../../../pm-plugins/utils/row-controls");
|
|
@@ -189,6 +190,8 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
189
190
|
onClick: handleClick,
|
|
190
191
|
onMouseOver: handleMouseOver,
|
|
191
192
|
onMouseOut: handleMouseOut,
|
|
193
|
+
onBlur: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? handleMouseOut : undefined,
|
|
194
|
+
onFocus: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? handleMouseOver : undefined,
|
|
192
195
|
toggleDragMenu: toggleDragMenuHandler,
|
|
193
196
|
editorView: editorView
|
|
194
197
|
}));
|
|
@@ -18,6 +18,7 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
18
18
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
19
19
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
20
20
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
21
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
21
22
|
var _commands = require("../../../pm-plugins/commands");
|
|
22
23
|
var _types = require("../../../types");
|
|
23
24
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -98,13 +99,11 @@ var CornerControlComponent = /*#__PURE__*/function (_Component) {
|
|
|
98
99
|
className: (0, _classnames.default)(_types.TableCssClassName.CONTROLS_CORNER_BUTTON, {
|
|
99
100
|
danger: isActive && isInDanger
|
|
100
101
|
}),
|
|
101
|
-
onClick: this.selectTable
|
|
102
|
-
|
|
103
|
-
,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
,
|
|
107
|
-
onMouseOut: this.clearHoverSelection
|
|
102
|
+
onClick: this.selectTable,
|
|
103
|
+
onMouseOver: this.hoverTable,
|
|
104
|
+
onMouseOut: this.clearHoverSelection,
|
|
105
|
+
onFocus: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? this.hoverTable : undefined,
|
|
106
|
+
onBlur: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? this.clearHoverSelection : undefined
|
|
108
107
|
}), !isHeaderRowEnabled &&
|
|
109
108
|
/*#__PURE__*/
|
|
110
109
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -12,6 +12,7 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
12
12
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
14
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
15
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
16
|
var _commands = require("../../../pm-plugins/commands");
|
|
16
17
|
var _types = require("../../../types");
|
|
17
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -49,10 +50,9 @@ var DragCornerControlsComponent = function DragCornerControlsComponent(_ref) {
|
|
|
49
50
|
}),
|
|
50
51
|
"aria-label": formatMessage(_messages.tableMessages.cornerControl),
|
|
51
52
|
type: "button",
|
|
52
|
-
onClick: handleOnClick
|
|
53
|
-
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
54
|
-
,
|
|
53
|
+
onClick: handleOnClick,
|
|
55
54
|
onMouseOut: handleMouseOut,
|
|
55
|
+
onBlur: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? handleMouseOut : undefined,
|
|
56
56
|
contentEditable: false
|
|
57
57
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
58
58
|
className: _types.TableCssClassName.DRAG_CORNER_BUTTON_INNER
|
|
@@ -102,10 +102,9 @@ var DragCornerControlsComponentWithSelection = function DragCornerControlsCompon
|
|
|
102
102
|
}),
|
|
103
103
|
"aria-label": formatMessage(_messages.tableMessages.cornerControl),
|
|
104
104
|
type: "button",
|
|
105
|
-
onClick: handleOnClick
|
|
106
|
-
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
107
|
-
,
|
|
105
|
+
onClick: handleOnClick,
|
|
108
106
|
onMouseOut: handleMouseOut,
|
|
107
|
+
onBlur: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? handleMouseOut : undefined,
|
|
109
108
|
contentEditable: false
|
|
110
109
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
111
110
|
className: _types.TableCssClassName.DRAG_CORNER_BUTTON_INNER
|
|
@@ -17,6 +17,7 @@ var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
|
17
17
|
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
18
18
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
19
19
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
20
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
20
21
|
var _commands = require("../../../pm-plugins/commands");
|
|
21
22
|
var _rowControls = require("../../../pm-plugins/utils/row-controls");
|
|
22
23
|
var _types = require("../../../types");
|
|
@@ -150,18 +151,18 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
150
151
|
"data-index": index
|
|
151
152
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
152
153
|
,
|
|
153
|
-
style: _this2.getCellStyles(index, rowHeight)
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
style: _this2.getCellStyles(index, rowHeight),
|
|
155
|
+
onFocus: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? function () {
|
|
156
|
+
return updateCellHoverLocation(index);
|
|
157
|
+
} : undefined,
|
|
156
158
|
onMouseOver: function onMouseOver() {
|
|
157
159
|
return updateCellHoverLocation(index);
|
|
158
160
|
}
|
|
159
|
-
}, hasHeaderRow ? index > 0 ? index : null : index + 1) :
|
|
160
|
-
/*#__PURE__*/
|
|
161
|
-
// eslint-disable-next-line @atlassian/a11y/click-events-have-key-events, @atlassian/a11y/interactive-element-not-keyboard-focusable, @atlassian/a11y/no-static-element-interactions
|
|
162
|
-
_react.default.createElement("div", {
|
|
161
|
+
}, hasHeaderRow ? index > 0 ? index : null : index + 1) : /*#__PURE__*/_react.default.createElement("div", {
|
|
163
162
|
// Ignored via go/ees005
|
|
163
|
+
role: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? 'button' : undefined
|
|
164
164
|
// eslint-disable-next-line react/no-array-index-key
|
|
165
|
+
,
|
|
165
166
|
key: "wrapper-".concat(index)
|
|
166
167
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
167
168
|
,
|
|
@@ -172,15 +173,22 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
172
173
|
style: _this2.getCellStyles(index, rowHeight),
|
|
173
174
|
onClick: function onClick(event) {
|
|
174
175
|
return _this2.selectRow(index, event);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
},
|
|
177
|
+
onFocus: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? function () {
|
|
178
|
+
return _this2.hoverRows(index);
|
|
179
|
+
} : undefined,
|
|
178
180
|
onMouseOver: function onMouseOver() {
|
|
179
181
|
return _this2.hoverRows(index);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
,
|
|
183
|
-
|
|
182
|
+
},
|
|
183
|
+
tabIndex: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? 0 : undefined,
|
|
184
|
+
onKeyDown: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? function (event) {
|
|
185
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
186
|
+
event.preventDefault();
|
|
187
|
+
_this2.selectRow(index, event);
|
|
188
|
+
}
|
|
189
|
+
} : undefined,
|
|
190
|
+
onMouseOut: _this2.clearHoverSelection,
|
|
191
|
+
onBlur: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? _this2.clearHoverSelection : undefined
|
|
184
192
|
}, hasHeaderRow ? index > 0 ? index : null : index + 1);
|
|
185
193
|
}));
|
|
186
194
|
}
|
|
@@ -15,6 +15,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
15
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
16
|
var _reactIntlNext = require("react-intl-next");
|
|
17
17
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
18
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
19
|
var _commands = require("../../../pm-plugins/commands");
|
|
19
20
|
var _rowControls = require("../../../pm-plugins/utils/row-controls");
|
|
20
21
|
var _types = require("../../../types");
|
|
@@ -102,15 +103,15 @@ var RowControlsComponent = /*#__PURE__*/function (_Component) {
|
|
|
102
103
|
className: "".concat(_types.TableCssClassName.ROW_CONTROLS_BUTTON, " ").concat(_types.TableCssClassName.CONTROLS_BUTTON),
|
|
103
104
|
onClick: function onClick(event) {
|
|
104
105
|
return _this2.props.selectRow(startIndex, event.shiftKey);
|
|
105
|
-
}
|
|
106
|
-
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
107
|
-
,
|
|
106
|
+
},
|
|
108
107
|
onMouseOver: function onMouseOver() {
|
|
109
108
|
return _this2.props.hoverRows([startIndex]);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
},
|
|
110
|
+
onFocus: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? function () {
|
|
111
|
+
return _this2.props.hoverRows([startIndex]);
|
|
112
|
+
} : undefined,
|
|
113
113
|
onMouseOut: _this2.clearHoverSelection,
|
|
114
|
+
onBlur: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? _this2.clearHoverSelection : undefined,
|
|
114
115
|
"data-start-index": startIndex,
|
|
115
116
|
"data-end-index": endIndex
|
|
116
117
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -186,6 +186,8 @@ var DragControls = exports.DragControls = function DragControls(_ref) {
|
|
|
186
186
|
onClick: handleClick,
|
|
187
187
|
onMouseOver: handleMouseOver,
|
|
188
188
|
onMouseOut: handleMouseOut,
|
|
189
|
+
onBlur: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? handleMouseOut : undefined,
|
|
190
|
+
onFocus: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? handleMouseOver : undefined,
|
|
189
191
|
toggleDragMenu: toggleDragMenuHandler,
|
|
190
192
|
editorView: editorView
|
|
191
193
|
}));
|
|
@@ -108,6 +108,7 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
108
108
|
className: wrapperClassName,
|
|
109
109
|
css: [(0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') && !(0, _platformFeatureFlags.fg)('platform_editor_table_sticky_header_patch_7') && styles]
|
|
110
110
|
}, (0, _react2.jsx)("div", {
|
|
111
|
+
role: "none",
|
|
111
112
|
onMouseDown: function onMouseDown(e) {
|
|
112
113
|
return !isDragAndDropEnabled && e.preventDefault();
|
|
113
114
|
}
|
|
@@ -6,7 +6,6 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
6
6
|
import { hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
8
8
|
import { addColumnAt as addColumnAtPMUtils, addRowAt, findTable, selectedRect } from '@atlaskit/editor-tables/utils';
|
|
9
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
9
|
import { updateRowOrColumnMovedTransform } from '../analytics/commands';
|
|
11
10
|
import { META_KEYS } from '../table-analytics';
|
|
12
11
|
import { rescaleColumns } from '../transforms/column-width';
|
|
@@ -233,10 +232,8 @@ export const insertTableWithNestingSupport = ({
|
|
|
233
232
|
let insertAt;
|
|
234
233
|
let isNestedTable = false;
|
|
235
234
|
if (hasParentNodeOfType(schema.nodes.table)(tr.selection) && isNestedTablesSupported(schema)) {
|
|
236
|
-
// If
|
|
237
|
-
if (
|
|
238
|
-
exposure: true
|
|
239
|
-
}) || getParentOfTypeCount(schema.nodes.table)(tr.selection.$from) > 1) {
|
|
235
|
+
// If trying to nest deeper than one level, we insert the table after the top table
|
|
236
|
+
if (getParentOfTypeCount(schema.nodes.table)(tr.selection.$from) > 1) {
|
|
240
237
|
const positionAfterTopTable = getPositionAfterTopParentNodeOfType(schema.nodes.table)(tr.selection.$from);
|
|
241
238
|
if (!positionAfterTopTable) {
|
|
242
239
|
return tr;
|
|
@@ -4,7 +4,6 @@ import { Slice, Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
|
4
4
|
import { flatten, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
7
|
import { getPluginState } from '../plugin-factory';
|
|
9
8
|
|
|
10
9
|
// lifts up the content of each cell, returning an array of nodes
|
|
@@ -64,7 +63,6 @@ export const removeTableFromLastChild = (node, i, fragment) => {
|
|
|
64
63
|
return i === fragment.childCount - 1 ? unwrapContentFromTable(node) : node;
|
|
65
64
|
};
|
|
66
65
|
export const transformSliceToRemoveNestedTables = (slice, schema, selection) => {
|
|
67
|
-
const isNestingAllowed = editorExperiment('nested-tables-in-tables', true);
|
|
68
66
|
const {
|
|
69
67
|
table,
|
|
70
68
|
tableCell,
|
|
@@ -72,10 +70,10 @@ export const transformSliceToRemoveNestedTables = (slice, schema, selection) =>
|
|
|
72
70
|
} = schema.nodes;
|
|
73
71
|
let openEnd = slice.openEnd;
|
|
74
72
|
const newFragment = flatmap(slice.content, (node, i, fragment) => {
|
|
75
|
-
var _slice$content$firstC;
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
let allowedTableNesting =
|
|
73
|
+
var _slice$content$firstC, _slice$content$lastCh;
|
|
74
|
+
// We allow default nesting of 2 to support
|
|
75
|
+
// two levels of nesting in nodes that support table nesting already such as layoutSection and expands
|
|
76
|
+
let allowedTableNesting = 2;
|
|
79
77
|
const isCellSelection = selection instanceof CellSelection;
|
|
80
78
|
const isPasteInTable = hasParentNodeOfType([table, tableCell, tableHeader])(selection);
|
|
81
79
|
const isPasteInNestedTable = getParentOfTypeCount(schema.nodes.table)(selection.$from) > 1;
|
|
@@ -83,55 +81,42 @@ export const transformSliceToRemoveNestedTables = (slice, schema, selection) =>
|
|
|
83
81
|
|
|
84
82
|
// Pasted content only contains a table and no other content
|
|
85
83
|
const isCellPaste = isPasteInTable && slice.content.childCount === 1 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === table && (!isPasteFullTableInsideEmptyCellEnabled || slice.openStart !== 0 && slice.openEnd !== 0);
|
|
86
|
-
if (isNestingAllowed) {
|
|
87
|
-
var _slice$content$lastCh;
|
|
88
|
-
// if nesting is allowed we bump up the default nesting allowance to 2 to support
|
|
89
|
-
// two levels of nesting in nodes that support table nesting already such as layoutSection and expands
|
|
90
|
-
allowedTableNesting = 2;
|
|
91
84
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// if paste is inside a table, allow no further nesting
|
|
97
|
-
if (isPasteInTable) {
|
|
98
|
-
allowedTableNesting = 0;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// unless we are pasting inside a nested table, then bounce back to 1 level
|
|
102
|
-
// because editor-plugin-paste will lift the table to the parent table (just below it)
|
|
103
|
-
if (isPasteInNestedTable) {
|
|
104
|
-
allowedTableNesting = 1;
|
|
105
|
-
}
|
|
85
|
+
// however if pasted content is a table, allow just one level
|
|
86
|
+
if (node.type === schema.nodes.table) {
|
|
87
|
+
allowedTableNesting = 1;
|
|
106
88
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
allowedTableNesting = 1;
|
|
111
|
-
if (isPasteInNestedTable) {
|
|
112
|
-
allowedTableNesting = 0;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
89
|
+
// if paste is inside a table, allow no further nesting
|
|
90
|
+
if (isPasteInTable) {
|
|
91
|
+
allowedTableNesting = 0;
|
|
115
92
|
}
|
|
116
93
|
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (slice.openEnd >= 7 &&
|
|
122
|
-
// depth of a nested table cell
|
|
123
|
-
slice.content.childCount > 1 && ((_slice$content$lastCh = slice.content.lastChild) === null || _slice$content$lastCh === void 0 ? void 0 : _slice$content$lastCh.type) === table && isPasteInTable) {
|
|
124
|
-
// re-point the slice's openEnd to non-nested table cell depth
|
|
125
|
-
openEnd = 4;
|
|
94
|
+
// unless we are pasting inside a nested table, then bounce back to 1 level
|
|
95
|
+
// because editor-plugin-paste will lift the table to the parent table (just below it)
|
|
96
|
+
if (isPasteInNestedTable) {
|
|
97
|
+
allowedTableNesting = 1;
|
|
126
98
|
}
|
|
127
|
-
} else {
|
|
128
|
-
// for layouts and expands, we start with 1 level of nesting as set above
|
|
129
99
|
|
|
130
|
-
//
|
|
131
|
-
|
|
132
|
-
|
|
100
|
+
// paste of table cells into a table cell - content is spread across multiple cells
|
|
101
|
+
// by editor-tables so needs to be treated a little differently
|
|
102
|
+
if (isCellPaste || isCellSelection) {
|
|
103
|
+
allowedTableNesting = 1;
|
|
104
|
+
if (isPasteInNestedTable) {
|
|
105
|
+
allowedTableNesting = 0;
|
|
106
|
+
}
|
|
133
107
|
}
|
|
134
108
|
}
|
|
109
|
+
|
|
110
|
+
// Prevent invalid openEnd after pasting tables with a selection that ends inside a nested table cell.
|
|
111
|
+
// If the slice ends with a selection that ends inside a nested table, and we paste inside a table we
|
|
112
|
+
// need to adjust the openEnd because it is no longer correct. If we don't, Prosemirror fires an exception
|
|
113
|
+
// because it iterates to a non-existent depth and the transform will not be applied
|
|
114
|
+
if (slice.openEnd >= 7 &&
|
|
115
|
+
// depth of a nested table cell
|
|
116
|
+
slice.content.childCount > 1 && ((_slice$content$lastCh = slice.content.lastChild) === null || _slice$content$lastCh === void 0 ? void 0 : _slice$content$lastCh.type) === table && isPasteInTable) {
|
|
117
|
+
// re-point the slice's openEnd to non-nested table cell depth
|
|
118
|
+
openEnd = 4;
|
|
119
|
+
}
|
|
135
120
|
if (isCellSelection && !isCellPaste) {
|
|
136
121
|
// if pasting into a cell selection, we need to flatten the parent table as well
|
|
137
122
|
return unwrapNestedTables(Fragment.fromArray([node]), schema, allowedTableNesting);
|
|
@@ -560,10 +560,8 @@ const tablePlugin = ({
|
|
|
560
560
|
} = state;
|
|
561
561
|
// If the cursor is inside a table
|
|
562
562
|
if (hasParentNodeOfType(state.schema.nodes.table)(state.selection) && options !== null && options !== void 0 && (_options$tableOptions6 = options.tableOptions) !== null && _options$tableOptions6 !== void 0 && _options$tableOptions6.allowNestedTables) {
|
|
563
|
-
// If
|
|
564
|
-
if (
|
|
565
|
-
exposure: true
|
|
566
|
-
}) || getParentOfTypeCount(state.schema.nodes.table)(state.selection.$from) > 1) {
|
|
563
|
+
// If trying to nest deeper than one level, we insert the table after the top table
|
|
564
|
+
if (getParentOfTypeCount(state.schema.nodes.table)(state.selection.$from) > 1) {
|
|
567
565
|
// Nesting is too deep insert table after the top parent table
|
|
568
566
|
const positionAfterTopTable = getPositionAfterTopParentNodeOfType(state.schema.nodes.table)(state.selection.$from);
|
|
569
567
|
tr = safeInsert(tableNode, positionAfterTopTable)(tr);
|