@atlaskit/editor-plugin-table 10.4.7 → 10.5.1
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/nodeviews/TableComponent.js +4 -3
- package/dist/cjs/pm-plugins/utils/drag-menu.js +99 -33
- package/dist/cjs/pm-plugins/utils/paste.js +2 -1
- package/dist/cjs/ui/toolbar.js +13 -12
- package/dist/es2019/nodeviews/TableComponent.js +4 -3
- package/dist/es2019/pm-plugins/utils/drag-menu.js +71 -33
- package/dist/es2019/pm-plugins/utils/paste.js +2 -1
- package/dist/es2019/ui/toolbar.js +8 -9
- package/dist/esm/nodeviews/TableComponent.js +4 -3
- package/dist/esm/pm-plugins/utils/drag-menu.js +99 -33
- package/dist/esm/pm-plugins/utils/paste.js +2 -1
- package/dist/esm/ui/toolbar.js +10 -9
- package/dist/types/pm-plugins/utils/drag-menu.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/utils/drag-menu.d.ts +1 -1
- package/package.json +5 -5
- package/src/nodeviews/TableComponent.tsx +3 -4
- package/src/pm-plugins/utils/{drag-menu.ts → drag-menu.tsx} +125 -58
- package/src/pm-plugins/utils/paste.ts +4 -2
- package/src/ui/toolbar.tsx +10 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 10.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#130002](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/130002)
|
|
8
|
+
[`e273880dffa90`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e273880dffa90) -
|
|
9
|
+
Clean up feature flag platform_editor_nested_table_in_nested_parent_fix
|
|
10
|
+
|
|
11
|
+
## 10.5.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#128788](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128788)
|
|
16
|
+
[`83a4d1ba203b0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/83a4d1ba203b0) -
|
|
17
|
+
[ux] update icons
|
|
18
|
+
|
|
3
19
|
## 10.4.7
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -170,7 +170,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
170
170
|
var prevAttrs = prevNode.attrs;
|
|
171
171
|
var isNested = (0, _nodes.isTableNested)(_this.props.view.state, _this.props.getPos());
|
|
172
172
|
var parentWidth = _this.getParentNodeWidth();
|
|
173
|
-
if (isNested && (0, _nodes.isTableNestedInMoreThanOneNode)(_this.props.view.state, _this.props.getPos())
|
|
173
|
+
if (isNested && (0, _nodes.isTableNestedInMoreThanOneNode)(_this.props.view.state, _this.props.getPos())) {
|
|
174
174
|
var resizeObsWrapperWidth = _this.wrapperWidth || 0;
|
|
175
175
|
var wrapperWidthDiffBetweenRerenders = Math.abs(resizeObsWrapperWidth - (_this.state.parentWidth || 0));
|
|
176
176
|
var isOusideOfThreshold = wrapperWidthDiffBetweenRerenders <= NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD || wrapperWidthDiffBetweenRerenders > NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD;
|
|
@@ -428,14 +428,15 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
428
428
|
if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
|
|
429
429
|
this.handleColgroupUpdates(true);
|
|
430
430
|
}
|
|
431
|
-
if (this.wrapper
|
|
431
|
+
if (this.wrapper) {
|
|
432
432
|
this.wrapperReisizeObserver = new ResizeObserver(function (entries) {
|
|
433
433
|
var _iterator2 = _createForOfIteratorHelper(entries),
|
|
434
434
|
_step2;
|
|
435
435
|
try {
|
|
436
436
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
437
|
+
var _entry$contentRect3;
|
|
437
438
|
var entry = _step2.value;
|
|
438
|
-
_this2.wrapperWidth = entry.contentRect.width;
|
|
439
|
+
_this2.wrapperWidth = (_entry$contentRect3 = entry.contentRect) === null || _entry$contentRect3 === void 0 ? void 0 : _entry$contentRect3.width;
|
|
439
440
|
}
|
|
440
441
|
} catch (err) {
|
|
441
442
|
_iterator2.e(err);
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.getTargetIndex = exports.getDragMenuConfig = exports.canMove = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
10
|
var _customSteps = require("@atlaskit/custom-steps");
|
|
10
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
12
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
@@ -98,32 +99,57 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
98
99
|
var addOptions = direction === 'row' ? [{
|
|
99
100
|
label: 'above',
|
|
100
101
|
offset: 0,
|
|
101
|
-
icon:
|
|
102
|
-
|
|
102
|
+
icon: function icon() {
|
|
103
|
+
return /*#__PURE__*/_react.default.createElement(_tableRowAddAbove.default, {
|
|
104
|
+
LEGACY_fallbackIcon: _AddRowAboveIcon.AddRowAboveIcon,
|
|
105
|
+
spacing: 'spacious',
|
|
106
|
+
label: ''
|
|
107
|
+
});
|
|
108
|
+
},
|
|
103
109
|
keymap: _keymaps.addRowBefore
|
|
104
110
|
}, {
|
|
105
111
|
label: 'below',
|
|
106
112
|
offset: 1,
|
|
107
|
-
icon:
|
|
108
|
-
|
|
113
|
+
icon: function icon() {
|
|
114
|
+
return /*#__PURE__*/_react.default.createElement(_tableRowAddBelow.default, {
|
|
115
|
+
LEGACY_fallbackIcon: _AddRowBelowIcon.AddRowBelowIcon,
|
|
116
|
+
spacing: 'spacious',
|
|
117
|
+
label: ''
|
|
118
|
+
});
|
|
119
|
+
},
|
|
109
120
|
keymap: _keymaps.addRowAfter
|
|
110
121
|
}] : [{
|
|
111
122
|
label: 'left',
|
|
112
123
|
offset: 0,
|
|
113
|
-
icon:
|
|
114
|
-
|
|
124
|
+
icon: function icon() {
|
|
125
|
+
return /*#__PURE__*/_react.default.createElement(_tableColumnAddLeft.default, {
|
|
126
|
+
LEGACY_fallbackIcon: _AddColLeftIcon.AddColLeftIcon,
|
|
127
|
+
spacing: 'spacious',
|
|
128
|
+
label: ''
|
|
129
|
+
});
|
|
130
|
+
},
|
|
115
131
|
keymap: _keymaps.addColumnBefore
|
|
116
132
|
}, {
|
|
117
133
|
label: 'right',
|
|
118
134
|
offset: 1,
|
|
119
|
-
icon:
|
|
120
|
-
|
|
135
|
+
icon: function icon() {
|
|
136
|
+
return /*#__PURE__*/_react.default.createElement(_tableColumnAddRight.default, {
|
|
137
|
+
LEGACY_fallbackIcon: _AddColRightIcon.AddColRightIcon,
|
|
138
|
+
spacing: 'spacious',
|
|
139
|
+
label: ''
|
|
140
|
+
});
|
|
141
|
+
},
|
|
121
142
|
keymap: _keymaps.addColumnAfter
|
|
122
143
|
}];
|
|
123
144
|
var moveOptions = direction === 'row' ? [{
|
|
124
145
|
label: 'up',
|
|
125
|
-
icon:
|
|
126
|
-
|
|
146
|
+
icon: function icon() {
|
|
147
|
+
return /*#__PURE__*/_react.default.createElement(_tableRowMoveUp.default, {
|
|
148
|
+
LEGACY_fallbackIcon: _arrowUp.default,
|
|
149
|
+
spacing: 'spacious',
|
|
150
|
+
label: ''
|
|
151
|
+
});
|
|
152
|
+
},
|
|
127
153
|
keymap: _keymaps.moveRowUp,
|
|
128
154
|
canMove: canMove('table-row', -1, (_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0, selection, selectionRect),
|
|
129
155
|
getOriginIndexes: _selection.getSelectedRowIndexes,
|
|
@@ -132,8 +158,13 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
132
158
|
}
|
|
133
159
|
}, {
|
|
134
160
|
label: 'down',
|
|
135
|
-
icon:
|
|
136
|
-
|
|
161
|
+
icon: function icon() {
|
|
162
|
+
return /*#__PURE__*/_react.default.createElement(_tableRowMoveDown.default, {
|
|
163
|
+
LEGACY_fallbackIcon: _arrowDown.default,
|
|
164
|
+
spacing: 'spacious',
|
|
165
|
+
label: ''
|
|
166
|
+
});
|
|
167
|
+
},
|
|
137
168
|
keymap: _keymaps.moveRowDown,
|
|
138
169
|
canMove: canMove('table-row', 1, (_tableMap$height2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height2 !== void 0 ? _tableMap$height2 : 0, selection, selectionRect),
|
|
139
170
|
getOriginIndexes: _selection.getSelectedRowIndexes,
|
|
@@ -142,8 +173,13 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
142
173
|
}
|
|
143
174
|
}] : [{
|
|
144
175
|
label: 'left',
|
|
145
|
-
icon:
|
|
146
|
-
|
|
176
|
+
icon: function icon() {
|
|
177
|
+
return /*#__PURE__*/_react.default.createElement(_tableColumnMoveLeft.default, {
|
|
178
|
+
LEGACY_fallbackIcon: _arrowLeft.default,
|
|
179
|
+
spacing: 'spacious',
|
|
180
|
+
label: ''
|
|
181
|
+
});
|
|
182
|
+
},
|
|
147
183
|
keymap: _keymaps.moveColumnLeft,
|
|
148
184
|
canMove: canMove('table-column', -1, (_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0, selection, selectionRect),
|
|
149
185
|
getOriginIndexes: _selection.getSelectedColumnIndexes,
|
|
@@ -152,8 +188,13 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
152
188
|
}
|
|
153
189
|
}, {
|
|
154
190
|
label: 'right',
|
|
155
|
-
icon:
|
|
156
|
-
|
|
191
|
+
icon: function icon() {
|
|
192
|
+
return /*#__PURE__*/_react.default.createElement(_tableColumnMoveRight.default, {
|
|
193
|
+
LEGACY_fallbackIcon: _arrowRight.default,
|
|
194
|
+
spacing: 'spacious',
|
|
195
|
+
label: ''
|
|
196
|
+
});
|
|
197
|
+
},
|
|
157
198
|
keymap: _keymaps.moveColumnRight,
|
|
158
199
|
canMove: canMove('table-column', 1, (_tableMap$width2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width2 !== void 0 ? _tableMap$width2 : 0, selection, selectionRect),
|
|
159
200
|
getOriginIndexes: _selection.getSelectedColumnIndexes,
|
|
@@ -164,25 +205,33 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
164
205
|
var sortOptions = direction === 'column' ? [{
|
|
165
206
|
label: 'increasing',
|
|
166
207
|
order: _customSteps.TableSortOrder.ASC,
|
|
167
|
-
icon:
|
|
168
|
-
|
|
208
|
+
icon: function icon() {
|
|
209
|
+
return /*#__PURE__*/_react.default.createElement(_sortAscending.default, {
|
|
210
|
+
LEGACY_fallbackIcon: _chevronDoubleUp.default,
|
|
211
|
+
spacing: 'spacious',
|
|
212
|
+
label: ''
|
|
213
|
+
});
|
|
214
|
+
}
|
|
169
215
|
}, {
|
|
170
216
|
label: 'decreasing',
|
|
171
217
|
order: _customSteps.TableSortOrder.DESC,
|
|
172
|
-
icon:
|
|
173
|
-
|
|
218
|
+
icon: function icon() {
|
|
219
|
+
return /*#__PURE__*/_react.default.createElement(_sortDescending.default, {
|
|
220
|
+
LEGACY_fallbackIcon: _chevronDoubleDown.default,
|
|
221
|
+
spacing: 'spacious',
|
|
222
|
+
label: ''
|
|
223
|
+
});
|
|
224
|
+
}
|
|
174
225
|
}] : [];
|
|
175
226
|
var sortConfigs = (0, _toConsumableArray2.default)(sortOptions.map(function (_ref) {
|
|
176
227
|
var label = _ref.label,
|
|
177
228
|
order = _ref.order,
|
|
178
|
-
icon = _ref.icon
|
|
179
|
-
iconFallback = _ref.iconFallback;
|
|
229
|
+
icon = _ref.icon;
|
|
180
230
|
return {
|
|
181
231
|
id: "sort_column_".concat(order),
|
|
182
232
|
title: "Sort ".concat(label),
|
|
183
233
|
disabled: hasMergedCellsInTable,
|
|
184
234
|
icon: icon,
|
|
185
|
-
iconFallback: iconFallback,
|
|
186
235
|
onClick: function onClick(state, dispatch) {
|
|
187
236
|
(0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, index !== null && index !== void 0 ? index : 0, order)(state, dispatch);
|
|
188
237
|
return true;
|
|
@@ -193,13 +242,11 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
193
242
|
var label = _ref2.label,
|
|
194
243
|
offset = _ref2.offset,
|
|
195
244
|
icon = _ref2.icon,
|
|
196
|
-
iconFallback = _ref2.iconFallback,
|
|
197
245
|
keymap = _ref2.keymap;
|
|
198
246
|
return {
|
|
199
247
|
id: "add_".concat(direction, "_").concat(label),
|
|
200
248
|
title: "Add ".concat(direction, " ").concat(label),
|
|
201
249
|
icon: icon,
|
|
202
|
-
iconFallback: iconFallback,
|
|
203
250
|
onClick: function onClick(state, dispatch) {
|
|
204
251
|
if (direction === 'row') {
|
|
205
252
|
(0, _commandsWithAnalytics.insertRowWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, {
|
|
@@ -229,8 +276,13 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
229
276
|
}
|
|
230
277
|
return false;
|
|
231
278
|
},
|
|
232
|
-
icon:
|
|
233
|
-
|
|
279
|
+
icon: function icon() {
|
|
280
|
+
return /*#__PURE__*/_react.default.createElement(_tableColumnsDistribute.default, {
|
|
281
|
+
LEGACY_fallbackIcon: _layoutThreeEqual.default,
|
|
282
|
+
spacing: 'spacious',
|
|
283
|
+
label: ''
|
|
284
|
+
});
|
|
285
|
+
}
|
|
234
286
|
} : undefined, {
|
|
235
287
|
id: 'clear_cells',
|
|
236
288
|
title: 'Clear cells',
|
|
@@ -238,8 +290,13 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
238
290
|
(0, _commandsWithAnalytics.emptyMultipleCellsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition)(state, dispatch);
|
|
239
291
|
return true;
|
|
240
292
|
},
|
|
241
|
-
icon:
|
|
242
|
-
|
|
293
|
+
icon: function icon() {
|
|
294
|
+
return /*#__PURE__*/_react.default.createElement(_tableCellClear.default, {
|
|
295
|
+
LEGACY_fallbackIcon: _crossCircle.default,
|
|
296
|
+
spacing: 'spacious',
|
|
297
|
+
label: ''
|
|
298
|
+
});
|
|
299
|
+
},
|
|
243
300
|
keymap: (0, _keymaps.tooltip)(_keymaps.backspace)
|
|
244
301
|
}, {
|
|
245
302
|
id: "delete_".concat(direction),
|
|
@@ -252,14 +309,24 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
252
309
|
}
|
|
253
310
|
return true;
|
|
254
311
|
},
|
|
255
|
-
icon: direction === 'row' ?
|
|
256
|
-
|
|
312
|
+
icon: direction === 'row' ? function () {
|
|
313
|
+
return /*#__PURE__*/_react.default.createElement(_tableRowDelete.default, {
|
|
314
|
+
LEGACY_fallbackIcon: _remove.default,
|
|
315
|
+
spacing: 'spacious',
|
|
316
|
+
label: ''
|
|
317
|
+
});
|
|
318
|
+
} : function () {
|
|
319
|
+
return /*#__PURE__*/_react.default.createElement(_tableColumnDelete.default, {
|
|
320
|
+
LEGACY_fallbackIcon: _remove.default,
|
|
321
|
+
spacing: 'spacious',
|
|
322
|
+
label: ''
|
|
323
|
+
});
|
|
324
|
+
},
|
|
257
325
|
keymap: direction === 'row' ? (0, _keymaps.tooltip)(_keymaps.deleteRow) : (0, _keymaps.tooltip)(_keymaps.deleteColumn)
|
|
258
326
|
}], (0, _toConsumableArray2.default)(moveOptions.map(function (_ref3) {
|
|
259
327
|
var label = _ref3.label,
|
|
260
328
|
canMove = _ref3.canMove,
|
|
261
329
|
icon = _ref3.icon,
|
|
262
|
-
iconFallback = _ref3.iconFallback,
|
|
263
330
|
keymap = _ref3.keymap,
|
|
264
331
|
getOriginIndexes = _ref3.getOriginIndexes,
|
|
265
332
|
getTargetIndex = _ref3.getTargetIndex;
|
|
@@ -268,7 +335,6 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
268
335
|
title: "Move ".concat(direction, " ").concat(label),
|
|
269
336
|
disabled: !canMove,
|
|
270
337
|
icon: icon,
|
|
271
|
-
iconFallback: iconFallback,
|
|
272
338
|
onClick: function onClick(state, dispatch) {
|
|
273
339
|
if (canMove) {
|
|
274
340
|
requestAnimationFrame(function () {
|
|
@@ -90,7 +90,8 @@ var transformSliceToRemoveNestedTables = exports.transformSliceToRemoveNestedTab
|
|
|
90
90
|
var _slice$content$firstC, _slice$content$lastCh;
|
|
91
91
|
var isPasteInTable = (0, _utils2.hasParentNodeOfType)([table, tableCell, tableHeader])(selection);
|
|
92
92
|
var isPasteInNestedTable = (0, _nesting.getParentOfTypeCount)(schema.nodes.table)(selection.$from) > 1;
|
|
93
|
-
var
|
|
93
|
+
var isPasteFullTableInsideEmptyCellEnabled = (0, _platformFeatureFlags.fg)('platform_editor_paste_full_table_inside_empty_cell');
|
|
94
|
+
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);
|
|
94
95
|
|
|
95
96
|
// if nesting is allowed we bump up the default nesting allowance to 2 to support
|
|
96
97
|
// two levels of nesting in nodes that support table nesting already such as layoutSection and expands
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -27,14 +27,12 @@ var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
|
27
27
|
var _alignImageCenter = _interopRequireDefault(require("@atlaskit/icon/core/align-image-center"));
|
|
28
28
|
var _alignImageLeft = _interopRequireDefault(require("@atlaskit/icon/core/align-image-left"));
|
|
29
29
|
var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
|
|
30
|
-
var
|
|
31
|
-
var
|
|
30
|
+
var _customizePreferences = _interopRequireDefault(require("@atlaskit/icon/core/migration/customize--preferences"));
|
|
31
|
+
var _deleteEditorRemove = _interopRequireDefault(require("@atlaskit/icon/core/migration/delete--editor-remove"));
|
|
32
32
|
var _tableColumnsDistribute = _interopRequireDefault(require("@atlaskit/icon/core/table-columns-distribute"));
|
|
33
33
|
var _alignImageCenter2 = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/align-image-center"));
|
|
34
34
|
var _alignImageLeft2 = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/align-image-left"));
|
|
35
35
|
var _layoutThreeEqual = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/layout-three-equal"));
|
|
36
|
-
var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
|
|
37
|
-
var _preferences = _interopRequireDefault(require("@atlaskit/icon/glyph/preferences"));
|
|
38
36
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
39
37
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
40
38
|
var _commands = require("../pm-plugins/commands");
|
|
@@ -117,9 +115,8 @@ var getToolbarMenuConfig = exports.getToolbarMenuConfig = function getToolbarMen
|
|
|
117
115
|
type: 'dropdown',
|
|
118
116
|
testId: 'table_options',
|
|
119
117
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
120
|
-
icon: (0, _platformFeatureFlags.fg)('platform-visual-refresh-icons') ? undefined :
|
|
121
|
-
|
|
122
|
-
iconBefore: (0, _platformFeatureFlags.fg)('platform-visual-refresh-icons') ? _customize.default : undefined,
|
|
118
|
+
icon: (0, _platformFeatureFlags.fg)('platform-visual-refresh-icons') ? undefined : _customizePreferences.default,
|
|
119
|
+
iconBefore: (0, _platformFeatureFlags.fg)('platform-visual-refresh-icons') ? _customizePreferences.default : undefined,
|
|
123
120
|
title: formatMessage(_messages.tableMessages.tableOptions),
|
|
124
121
|
hidden: options.every(function (option) {
|
|
125
122
|
return option.hidden;
|
|
@@ -432,8 +429,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
432
429
|
id: 'editor.table.delete',
|
|
433
430
|
type: 'button',
|
|
434
431
|
appearance: 'danger',
|
|
435
|
-
icon:
|
|
436
|
-
iconFallback: _remove.default,
|
|
432
|
+
icon: _deleteEditorRemove.default,
|
|
437
433
|
onClick: (0, _commandsWithAnalytics.deleteTableWithAnalytics)(editorAnalyticsAPI),
|
|
438
434
|
disabled: !!resizeState && !!resizeState.dragging,
|
|
439
435
|
onMouseEnter: (0, _commands.hoverTable)(true),
|
|
@@ -516,7 +512,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
516
512
|
}, {
|
|
517
513
|
title: intl.formatMessage(_messages.default.delete),
|
|
518
514
|
onClick: (0, _commandsWithAnalytics.deleteTableWithAnalytics)(editorAnalyticsAPI),
|
|
519
|
-
icon: (0, _react.jsx)(
|
|
515
|
+
icon: (0, _react.jsx)(_deleteEditorRemove.default, {
|
|
520
516
|
label: intl.formatMessage(_messages.default.delete)
|
|
521
517
|
})
|
|
522
518
|
}]
|
|
@@ -590,8 +586,13 @@ var getColumnSettingItems = function getColumnSettingItems(editorState, editorVi
|
|
|
590
586
|
id: 'editor.table.distributeColumns',
|
|
591
587
|
type: 'button',
|
|
592
588
|
title: formatMessage(_messages.tableMessages.distributeColumns),
|
|
593
|
-
icon:
|
|
594
|
-
|
|
589
|
+
icon: function icon() {
|
|
590
|
+
return (0, _react.jsx)(_tableColumnsDistribute.default, {
|
|
591
|
+
LEGACY_fallbackIcon: _layoutThreeEqual.default,
|
|
592
|
+
spacing: 'spacious',
|
|
593
|
+
label: ''
|
|
594
|
+
});
|
|
595
|
+
},
|
|
595
596
|
onClick: function onClick(state, dispatch, view) {
|
|
596
597
|
return getDistributeConfig(getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor)(state, dispatch, view);
|
|
597
598
|
},
|
|
@@ -158,7 +158,7 @@ class TableComponent extends React.Component {
|
|
|
158
158
|
const prevAttrs = prevNode.attrs;
|
|
159
159
|
const isNested = isTableNested(this.props.view.state, this.props.getPos());
|
|
160
160
|
let parentWidth = this.getParentNodeWidth();
|
|
161
|
-
if (isNested && isTableNestedInMoreThanOneNode(this.props.view.state, this.props.getPos())
|
|
161
|
+
if (isNested && isTableNestedInMoreThanOneNode(this.props.view.state, this.props.getPos())) {
|
|
162
162
|
const resizeObsWrapperWidth = this.wrapperWidth || 0;
|
|
163
163
|
const wrapperWidthDiffBetweenRerenders = Math.abs(resizeObsWrapperWidth - (this.state.parentWidth || 0));
|
|
164
164
|
const isOusideOfThreshold = wrapperWidthDiffBetweenRerenders <= NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD || wrapperWidthDiffBetweenRerenders > NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD;
|
|
@@ -411,10 +411,11 @@ class TableComponent extends React.Component {
|
|
|
411
411
|
if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
|
|
412
412
|
this.handleColgroupUpdates(true);
|
|
413
413
|
}
|
|
414
|
-
if (this.wrapper
|
|
414
|
+
if (this.wrapper) {
|
|
415
415
|
this.wrapperReisizeObserver = new ResizeObserver(entries => {
|
|
416
416
|
for (const entry of entries) {
|
|
417
|
-
|
|
417
|
+
var _entry$contentRect3;
|
|
418
|
+
this.wrapperWidth = (_entry$contentRect3 = entry.contentRect) === null || _entry$contentRect3 === void 0 ? void 0 : _entry$contentRect3.width;
|
|
418
419
|
}
|
|
419
420
|
});
|
|
420
421
|
this.wrapperReisizeObserver.observe(this.wrapper);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
2
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, deleteColumn, deleteRow, moveColumnLeft, moveColumnRight, moveRowDown, moveRowUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
@@ -86,56 +87,80 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
86
87
|
const addOptions = direction === 'row' ? [{
|
|
87
88
|
label: 'above',
|
|
88
89
|
offset: 0,
|
|
89
|
-
icon: TableRowAddAboveIcon,
|
|
90
|
-
|
|
90
|
+
icon: () => /*#__PURE__*/React.createElement(TableRowAddAboveIcon, {
|
|
91
|
+
LEGACY_fallbackIcon: AddRowAboveIcon,
|
|
92
|
+
spacing: 'spacious',
|
|
93
|
+
label: ''
|
|
94
|
+
}),
|
|
91
95
|
keymap: addRowBefore
|
|
92
96
|
}, {
|
|
93
97
|
label: 'below',
|
|
94
98
|
offset: 1,
|
|
95
|
-
icon: TableRowAddBelowIcon,
|
|
96
|
-
|
|
99
|
+
icon: () => /*#__PURE__*/React.createElement(TableRowAddBelowIcon, {
|
|
100
|
+
LEGACY_fallbackIcon: AddRowBelowIcon,
|
|
101
|
+
spacing: 'spacious',
|
|
102
|
+
label: ''
|
|
103
|
+
}),
|
|
97
104
|
keymap: addRowAfter
|
|
98
105
|
}] : [{
|
|
99
106
|
label: 'left',
|
|
100
107
|
offset: 0,
|
|
101
|
-
icon: TableColumnAddLeftIcon,
|
|
102
|
-
|
|
108
|
+
icon: () => /*#__PURE__*/React.createElement(TableColumnAddLeftIcon, {
|
|
109
|
+
LEGACY_fallbackIcon: AddColLeftIcon,
|
|
110
|
+
spacing: 'spacious',
|
|
111
|
+
label: ''
|
|
112
|
+
}),
|
|
103
113
|
keymap: addColumnBefore
|
|
104
114
|
}, {
|
|
105
115
|
label: 'right',
|
|
106
116
|
offset: 1,
|
|
107
|
-
icon: TableColumnAddRightIcon,
|
|
108
|
-
|
|
117
|
+
icon: () => /*#__PURE__*/React.createElement(TableColumnAddRightIcon, {
|
|
118
|
+
LEGACY_fallbackIcon: AddColRightIcon,
|
|
119
|
+
spacing: 'spacious',
|
|
120
|
+
label: ''
|
|
121
|
+
}),
|
|
109
122
|
keymap: addColumnAfter
|
|
110
123
|
}];
|
|
111
124
|
const moveOptions = direction === 'row' ? [{
|
|
112
125
|
label: 'up',
|
|
113
|
-
icon: TableRowMoveUpIcon,
|
|
114
|
-
|
|
126
|
+
icon: () => /*#__PURE__*/React.createElement(TableRowMoveUpIcon, {
|
|
127
|
+
LEGACY_fallbackIcon: ArrowUpIcon,
|
|
128
|
+
spacing: 'spacious',
|
|
129
|
+
label: ''
|
|
130
|
+
}),
|
|
115
131
|
keymap: moveRowUp,
|
|
116
132
|
canMove: canMove('table-row', -1, (_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0, selection, selectionRect),
|
|
117
133
|
getOriginIndexes: getSelectedRowIndexes,
|
|
118
134
|
getTargetIndex: selectionRect => selectionRect.top - 1
|
|
119
135
|
}, {
|
|
120
136
|
label: 'down',
|
|
121
|
-
icon: TableRowMoveDownIcon,
|
|
122
|
-
|
|
137
|
+
icon: () => /*#__PURE__*/React.createElement(TableRowMoveDownIcon, {
|
|
138
|
+
LEGACY_fallbackIcon: ArrowDownIcon,
|
|
139
|
+
spacing: 'spacious',
|
|
140
|
+
label: ''
|
|
141
|
+
}),
|
|
123
142
|
keymap: moveRowDown,
|
|
124
143
|
canMove: canMove('table-row', 1, (_tableMap$height2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height2 !== void 0 ? _tableMap$height2 : 0, selection, selectionRect),
|
|
125
144
|
getOriginIndexes: getSelectedRowIndexes,
|
|
126
145
|
getTargetIndex: selectionRect => selectionRect.bottom
|
|
127
146
|
}] : [{
|
|
128
147
|
label: 'left',
|
|
129
|
-
icon: TableColumnMoveLeftIcon,
|
|
130
|
-
|
|
148
|
+
icon: () => /*#__PURE__*/React.createElement(TableColumnMoveLeftIcon, {
|
|
149
|
+
LEGACY_fallbackIcon: ArrowLeftIcon,
|
|
150
|
+
spacing: 'spacious',
|
|
151
|
+
label: ''
|
|
152
|
+
}),
|
|
131
153
|
keymap: moveColumnLeft,
|
|
132
154
|
canMove: canMove('table-column', -1, (_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0, selection, selectionRect),
|
|
133
155
|
getOriginIndexes: getSelectedColumnIndexes,
|
|
134
156
|
getTargetIndex: selectionRect => selectionRect.left - 1
|
|
135
157
|
}, {
|
|
136
158
|
label: 'right',
|
|
137
|
-
icon: TableColumnMoveRightIcon,
|
|
138
|
-
|
|
159
|
+
icon: () => /*#__PURE__*/React.createElement(TableColumnMoveRightIcon, {
|
|
160
|
+
LEGACY_fallbackIcon: ArrowRightIcon,
|
|
161
|
+
spacing: 'spacious',
|
|
162
|
+
label: ''
|
|
163
|
+
}),
|
|
139
164
|
keymap: moveColumnRight,
|
|
140
165
|
canMove: canMove('table-column', 1, (_tableMap$width2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width2 !== void 0 ? _tableMap$width2 : 0, selection, selectionRect),
|
|
141
166
|
getOriginIndexes: getSelectedColumnIndexes,
|
|
@@ -144,25 +169,29 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
144
169
|
const sortOptions = direction === 'column' ? [{
|
|
145
170
|
label: 'increasing',
|
|
146
171
|
order: SortOrder.ASC,
|
|
147
|
-
icon: SortAscendingIcon,
|
|
148
|
-
|
|
172
|
+
icon: () => /*#__PURE__*/React.createElement(SortAscendingIcon, {
|
|
173
|
+
LEGACY_fallbackIcon: HipchatChevronDoubleUpIcon,
|
|
174
|
+
spacing: 'spacious',
|
|
175
|
+
label: ''
|
|
176
|
+
})
|
|
149
177
|
}, {
|
|
150
178
|
label: 'decreasing',
|
|
151
179
|
order: SortOrder.DESC,
|
|
152
|
-
icon: SortDescendingIcon,
|
|
153
|
-
|
|
180
|
+
icon: () => /*#__PURE__*/React.createElement(SortDescendingIcon, {
|
|
181
|
+
LEGACY_fallbackIcon: HipchatChevronDoubleDownIcon,
|
|
182
|
+
spacing: 'spacious',
|
|
183
|
+
label: ''
|
|
184
|
+
})
|
|
154
185
|
}] : [];
|
|
155
186
|
const sortConfigs = [...sortOptions.map(({
|
|
156
187
|
label,
|
|
157
188
|
order,
|
|
158
|
-
icon
|
|
159
|
-
iconFallback
|
|
189
|
+
icon
|
|
160
190
|
}) => ({
|
|
161
191
|
id: `sort_column_${order}`,
|
|
162
192
|
title: `Sort ${label}`,
|
|
163
193
|
disabled: hasMergedCellsInTable,
|
|
164
194
|
icon: icon,
|
|
165
|
-
iconFallback: iconFallback,
|
|
166
195
|
onClick: (state, dispatch) => {
|
|
167
196
|
sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, index !== null && index !== void 0 ? index : 0, order)(state, dispatch);
|
|
168
197
|
return true;
|
|
@@ -172,13 +201,11 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
172
201
|
label,
|
|
173
202
|
offset,
|
|
174
203
|
icon,
|
|
175
|
-
iconFallback,
|
|
176
204
|
keymap
|
|
177
205
|
}) => ({
|
|
178
206
|
id: `add_${direction}_${label}`,
|
|
179
207
|
title: `Add ${direction} ${label}`,
|
|
180
208
|
icon: icon,
|
|
181
|
-
iconFallback: iconFallback,
|
|
182
209
|
onClick: (state, dispatch) => {
|
|
183
210
|
if (direction === 'row') {
|
|
184
211
|
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
|
|
@@ -207,8 +234,11 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
207
234
|
}
|
|
208
235
|
return false;
|
|
209
236
|
},
|
|
210
|
-
icon: TableColumnsDistributeIcon,
|
|
211
|
-
|
|
237
|
+
icon: () => /*#__PURE__*/React.createElement(TableColumnsDistributeIcon, {
|
|
238
|
+
LEGACY_fallbackIcon: EditorLayoutThreeEqualIcon,
|
|
239
|
+
spacing: 'spacious',
|
|
240
|
+
label: ''
|
|
241
|
+
})
|
|
212
242
|
} : undefined, {
|
|
213
243
|
id: 'clear_cells',
|
|
214
244
|
title: 'Clear cells',
|
|
@@ -216,8 +246,11 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
216
246
|
emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition)(state, dispatch);
|
|
217
247
|
return true;
|
|
218
248
|
},
|
|
219
|
-
icon: TableCellClearIcon,
|
|
220
|
-
|
|
249
|
+
icon: () => /*#__PURE__*/React.createElement(TableCellClearIcon, {
|
|
250
|
+
LEGACY_fallbackIcon: CrossCircleIcon,
|
|
251
|
+
spacing: 'spacious',
|
|
252
|
+
label: ''
|
|
253
|
+
}),
|
|
221
254
|
keymap: tooltip(backspace)
|
|
222
255
|
}, {
|
|
223
256
|
id: `delete_${direction}`,
|
|
@@ -230,14 +263,20 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
230
263
|
}
|
|
231
264
|
return true;
|
|
232
265
|
},
|
|
233
|
-
icon: direction === 'row' ?
|
|
234
|
-
|
|
266
|
+
icon: direction === 'row' ? () => /*#__PURE__*/React.createElement(TableRowDeleteIcon, {
|
|
267
|
+
LEGACY_fallbackIcon: RemoveIcon,
|
|
268
|
+
spacing: 'spacious',
|
|
269
|
+
label: ''
|
|
270
|
+
}) : () => /*#__PURE__*/React.createElement(TableColumnDeleteIcon, {
|
|
271
|
+
LEGACY_fallbackIcon: RemoveIcon,
|
|
272
|
+
spacing: 'spacious',
|
|
273
|
+
label: ''
|
|
274
|
+
}),
|
|
235
275
|
keymap: direction === 'row' ? tooltip(deleteRow) : tooltip(deleteColumn)
|
|
236
276
|
}, ...moveOptions.map(({
|
|
237
277
|
label,
|
|
238
278
|
canMove,
|
|
239
279
|
icon,
|
|
240
|
-
iconFallback,
|
|
241
280
|
keymap,
|
|
242
281
|
getOriginIndexes,
|
|
243
282
|
getTargetIndex
|
|
@@ -246,7 +285,6 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
246
285
|
title: `Move ${direction} ${label}`,
|
|
247
286
|
disabled: !canMove,
|
|
248
287
|
icon: icon,
|
|
249
|
-
iconFallback: iconFallback,
|
|
250
288
|
onClick: (state, dispatch) => {
|
|
251
289
|
if (canMove) {
|
|
252
290
|
requestAnimationFrame(() => {
|
|
@@ -80,7 +80,8 @@ export const transformSliceToRemoveNestedTables = (slice, schema, selection) =>
|
|
|
80
80
|
var _slice$content$firstC, _slice$content$lastCh;
|
|
81
81
|
const isPasteInTable = hasParentNodeOfType([table, tableCell, tableHeader])(selection);
|
|
82
82
|
const isPasteInNestedTable = getParentOfTypeCount(schema.nodes.table)(selection.$from) > 1;
|
|
83
|
-
const
|
|
83
|
+
const isPasteFullTableInsideEmptyCellEnabled = fg('platform_editor_paste_full_table_inside_empty_cell');
|
|
84
|
+
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);
|
|
84
85
|
|
|
85
86
|
// if nesting is allowed we bump up the default nesting allowance to 2 to support
|
|
86
87
|
// two levels of nesting in nodes that support table nesting already such as layoutSection and expands
|