@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
|
@@ -22,14 +22,12 @@ import { findCellRectClosestToPos, findTable, getSelectionRect, isSelectionType,
|
|
|
22
22
|
import AlignImageCenterIcon from '@atlaskit/icon/core/align-image-center';
|
|
23
23
|
import AlignImageLeftIcon from '@atlaskit/icon/core/align-image-left';
|
|
24
24
|
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
25
|
-
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
26
|
-
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
25
|
+
import CustomizeIcon from '@atlaskit/icon/core/migration/customize--preferences';
|
|
26
|
+
import DeleteIcon from '@atlaskit/icon/core/migration/delete--editor-remove';
|
|
27
27
|
import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
|
|
28
28
|
import EditorAlignImageCenter from '@atlaskit/icon/glyph/editor/align-image-center';
|
|
29
29
|
import EditorAlignImageLeft from '@atlaskit/icon/glyph/editor/align-image-left';
|
|
30
30
|
import DistributeColumnIcon from '@atlaskit/icon/glyph/editor/layout-three-equal';
|
|
31
|
-
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
32
|
-
import TableOptionsIcon from '@atlaskit/icon/glyph/preferences';
|
|
33
31
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
34
32
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
35
33
|
import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, hoverTable, removeDescendantNodes } from '../pm-plugins/commands';
|
|
@@ -104,8 +102,7 @@ export const getToolbarMenuConfig = (config, state, {
|
|
|
104
102
|
type: 'dropdown',
|
|
105
103
|
testId: 'table_options',
|
|
106
104
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
107
|
-
icon: fg('platform-visual-refresh-icons') ? undefined :
|
|
108
|
-
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
105
|
+
icon: fg('platform-visual-refresh-icons') ? undefined : CustomizeIcon,
|
|
109
106
|
iconBefore: fg('platform-visual-refresh-icons') ? CustomizeIcon : undefined,
|
|
110
107
|
title: formatMessage(messages.tableOptions),
|
|
111
108
|
hidden: options.every(option => option.hidden),
|
|
@@ -405,7 +402,6 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
|
|
|
405
402
|
type: 'button',
|
|
406
403
|
appearance: 'danger',
|
|
407
404
|
icon: DeleteIcon,
|
|
408
|
-
iconFallback: RemoveIcon,
|
|
409
405
|
onClick: deleteTableWithAnalytics(editorAnalyticsAPI),
|
|
410
406
|
disabled: !!resizeState && !!resizeState.dragging,
|
|
411
407
|
onMouseEnter: hoverTable(true),
|
|
@@ -550,8 +546,11 @@ const getColumnSettingItems = (editorState, editorView, {
|
|
|
550
546
|
id: 'editor.table.distributeColumns',
|
|
551
547
|
type: 'button',
|
|
552
548
|
title: formatMessage(messages.distributeColumns),
|
|
553
|
-
icon: TableColumnsDistributeIcon,
|
|
554
|
-
|
|
549
|
+
icon: () => jsx(TableColumnsDistributeIcon, {
|
|
550
|
+
LEGACY_fallbackIcon: DistributeColumnIcon,
|
|
551
|
+
spacing: 'spacious',
|
|
552
|
+
label: ''
|
|
553
|
+
}),
|
|
555
554
|
onClick: (state, dispatch, view) => getDistributeConfig(getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor)(state, dispatch, view),
|
|
556
555
|
disabled: !wouldChange
|
|
557
556
|
});
|
|
@@ -164,7 +164,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
164
164
|
var prevAttrs = prevNode.attrs;
|
|
165
165
|
var isNested = isTableNested(_this.props.view.state, _this.props.getPos());
|
|
166
166
|
var parentWidth = _this.getParentNodeWidth();
|
|
167
|
-
if (isNested && isTableNestedInMoreThanOneNode(_this.props.view.state, _this.props.getPos())
|
|
167
|
+
if (isNested && isTableNestedInMoreThanOneNode(_this.props.view.state, _this.props.getPos())) {
|
|
168
168
|
var resizeObsWrapperWidth = _this.wrapperWidth || 0;
|
|
169
169
|
var wrapperWidthDiffBetweenRerenders = Math.abs(resizeObsWrapperWidth - (_this.state.parentWidth || 0));
|
|
170
170
|
var isOusideOfThreshold = wrapperWidthDiffBetweenRerenders <= NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD || wrapperWidthDiffBetweenRerenders > NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD;
|
|
@@ -422,14 +422,15 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
422
422
|
if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
|
|
423
423
|
this.handleColgroupUpdates(true);
|
|
424
424
|
}
|
|
425
|
-
if (this.wrapper
|
|
425
|
+
if (this.wrapper) {
|
|
426
426
|
this.wrapperReisizeObserver = new ResizeObserver(function (entries) {
|
|
427
427
|
var _iterator2 = _createForOfIteratorHelper(entries),
|
|
428
428
|
_step2;
|
|
429
429
|
try {
|
|
430
430
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
431
|
+
var _entry$contentRect3;
|
|
431
432
|
var entry = _step2.value;
|
|
432
|
-
_this2.wrapperWidth = entry.contentRect.width;
|
|
433
|
+
_this2.wrapperWidth = (_entry$contentRect3 = entry.contentRect) === null || _entry$contentRect3 === void 0 ? void 0 : _entry$contentRect3.width;
|
|
433
434
|
}
|
|
434
435
|
} catch (err) {
|
|
435
436
|
_iterator2.e(err);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import React from 'react';
|
|
2
3
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
3
4
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
5
|
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, deleteColumn, deleteRow, moveColumnLeft, moveColumnRight, moveRowDown, moveRowUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
@@ -91,32 +92,57 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
91
92
|
var addOptions = direction === 'row' ? [{
|
|
92
93
|
label: 'above',
|
|
93
94
|
offset: 0,
|
|
94
|
-
icon:
|
|
95
|
-
|
|
95
|
+
icon: function icon() {
|
|
96
|
+
return /*#__PURE__*/React.createElement(TableRowAddAboveIcon, {
|
|
97
|
+
LEGACY_fallbackIcon: AddRowAboveIcon,
|
|
98
|
+
spacing: 'spacious',
|
|
99
|
+
label: ''
|
|
100
|
+
});
|
|
101
|
+
},
|
|
96
102
|
keymap: addRowBefore
|
|
97
103
|
}, {
|
|
98
104
|
label: 'below',
|
|
99
105
|
offset: 1,
|
|
100
|
-
icon:
|
|
101
|
-
|
|
106
|
+
icon: function icon() {
|
|
107
|
+
return /*#__PURE__*/React.createElement(TableRowAddBelowIcon, {
|
|
108
|
+
LEGACY_fallbackIcon: AddRowBelowIcon,
|
|
109
|
+
spacing: 'spacious',
|
|
110
|
+
label: ''
|
|
111
|
+
});
|
|
112
|
+
},
|
|
102
113
|
keymap: addRowAfter
|
|
103
114
|
}] : [{
|
|
104
115
|
label: 'left',
|
|
105
116
|
offset: 0,
|
|
106
|
-
icon:
|
|
107
|
-
|
|
117
|
+
icon: function icon() {
|
|
118
|
+
return /*#__PURE__*/React.createElement(TableColumnAddLeftIcon, {
|
|
119
|
+
LEGACY_fallbackIcon: AddColLeftIcon,
|
|
120
|
+
spacing: 'spacious',
|
|
121
|
+
label: ''
|
|
122
|
+
});
|
|
123
|
+
},
|
|
108
124
|
keymap: addColumnBefore
|
|
109
125
|
}, {
|
|
110
126
|
label: 'right',
|
|
111
127
|
offset: 1,
|
|
112
|
-
icon:
|
|
113
|
-
|
|
128
|
+
icon: function icon() {
|
|
129
|
+
return /*#__PURE__*/React.createElement(TableColumnAddRightIcon, {
|
|
130
|
+
LEGACY_fallbackIcon: AddColRightIcon,
|
|
131
|
+
spacing: 'spacious',
|
|
132
|
+
label: ''
|
|
133
|
+
});
|
|
134
|
+
},
|
|
114
135
|
keymap: addColumnAfter
|
|
115
136
|
}];
|
|
116
137
|
var moveOptions = direction === 'row' ? [{
|
|
117
138
|
label: 'up',
|
|
118
|
-
icon:
|
|
119
|
-
|
|
139
|
+
icon: function icon() {
|
|
140
|
+
return /*#__PURE__*/React.createElement(TableRowMoveUpIcon, {
|
|
141
|
+
LEGACY_fallbackIcon: ArrowUpIcon,
|
|
142
|
+
spacing: 'spacious',
|
|
143
|
+
label: ''
|
|
144
|
+
});
|
|
145
|
+
},
|
|
120
146
|
keymap: moveRowUp,
|
|
121
147
|
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),
|
|
122
148
|
getOriginIndexes: getSelectedRowIndexes,
|
|
@@ -125,8 +151,13 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
125
151
|
}
|
|
126
152
|
}, {
|
|
127
153
|
label: 'down',
|
|
128
|
-
icon:
|
|
129
|
-
|
|
154
|
+
icon: function icon() {
|
|
155
|
+
return /*#__PURE__*/React.createElement(TableRowMoveDownIcon, {
|
|
156
|
+
LEGACY_fallbackIcon: ArrowDownIcon,
|
|
157
|
+
spacing: 'spacious',
|
|
158
|
+
label: ''
|
|
159
|
+
});
|
|
160
|
+
},
|
|
130
161
|
keymap: moveRowDown,
|
|
131
162
|
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),
|
|
132
163
|
getOriginIndexes: getSelectedRowIndexes,
|
|
@@ -135,8 +166,13 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
135
166
|
}
|
|
136
167
|
}] : [{
|
|
137
168
|
label: 'left',
|
|
138
|
-
icon:
|
|
139
|
-
|
|
169
|
+
icon: function icon() {
|
|
170
|
+
return /*#__PURE__*/React.createElement(TableColumnMoveLeftIcon, {
|
|
171
|
+
LEGACY_fallbackIcon: ArrowLeftIcon,
|
|
172
|
+
spacing: 'spacious',
|
|
173
|
+
label: ''
|
|
174
|
+
});
|
|
175
|
+
},
|
|
140
176
|
keymap: moveColumnLeft,
|
|
141
177
|
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),
|
|
142
178
|
getOriginIndexes: getSelectedColumnIndexes,
|
|
@@ -145,8 +181,13 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
145
181
|
}
|
|
146
182
|
}, {
|
|
147
183
|
label: 'right',
|
|
148
|
-
icon:
|
|
149
|
-
|
|
184
|
+
icon: function icon() {
|
|
185
|
+
return /*#__PURE__*/React.createElement(TableColumnMoveRightIcon, {
|
|
186
|
+
LEGACY_fallbackIcon: ArrowRightIcon,
|
|
187
|
+
spacing: 'spacious',
|
|
188
|
+
label: ''
|
|
189
|
+
});
|
|
190
|
+
},
|
|
150
191
|
keymap: moveColumnRight,
|
|
151
192
|
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),
|
|
152
193
|
getOriginIndexes: getSelectedColumnIndexes,
|
|
@@ -157,25 +198,33 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
157
198
|
var sortOptions = direction === 'column' ? [{
|
|
158
199
|
label: 'increasing',
|
|
159
200
|
order: SortOrder.ASC,
|
|
160
|
-
icon:
|
|
161
|
-
|
|
201
|
+
icon: function icon() {
|
|
202
|
+
return /*#__PURE__*/React.createElement(SortAscendingIcon, {
|
|
203
|
+
LEGACY_fallbackIcon: HipchatChevronDoubleUpIcon,
|
|
204
|
+
spacing: 'spacious',
|
|
205
|
+
label: ''
|
|
206
|
+
});
|
|
207
|
+
}
|
|
162
208
|
}, {
|
|
163
209
|
label: 'decreasing',
|
|
164
210
|
order: SortOrder.DESC,
|
|
165
|
-
icon:
|
|
166
|
-
|
|
211
|
+
icon: function icon() {
|
|
212
|
+
return /*#__PURE__*/React.createElement(SortDescendingIcon, {
|
|
213
|
+
LEGACY_fallbackIcon: HipchatChevronDoubleDownIcon,
|
|
214
|
+
spacing: 'spacious',
|
|
215
|
+
label: ''
|
|
216
|
+
});
|
|
217
|
+
}
|
|
167
218
|
}] : [];
|
|
168
219
|
var sortConfigs = _toConsumableArray(sortOptions.map(function (_ref) {
|
|
169
220
|
var label = _ref.label,
|
|
170
221
|
order = _ref.order,
|
|
171
|
-
icon = _ref.icon
|
|
172
|
-
iconFallback = _ref.iconFallback;
|
|
222
|
+
icon = _ref.icon;
|
|
173
223
|
return {
|
|
174
224
|
id: "sort_column_".concat(order),
|
|
175
225
|
title: "Sort ".concat(label),
|
|
176
226
|
disabled: hasMergedCellsInTable,
|
|
177
227
|
icon: icon,
|
|
178
|
-
iconFallback: iconFallback,
|
|
179
228
|
onClick: function onClick(state, dispatch) {
|
|
180
229
|
sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, index !== null && index !== void 0 ? index : 0, order)(state, dispatch);
|
|
181
230
|
return true;
|
|
@@ -186,13 +235,11 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
186
235
|
var label = _ref2.label,
|
|
187
236
|
offset = _ref2.offset,
|
|
188
237
|
icon = _ref2.icon,
|
|
189
|
-
iconFallback = _ref2.iconFallback,
|
|
190
238
|
keymap = _ref2.keymap;
|
|
191
239
|
return {
|
|
192
240
|
id: "add_".concat(direction, "_").concat(label),
|
|
193
241
|
title: "Add ".concat(direction, " ").concat(label),
|
|
194
242
|
icon: icon,
|
|
195
|
-
iconFallback: iconFallback,
|
|
196
243
|
onClick: function onClick(state, dispatch) {
|
|
197
244
|
if (direction === 'row') {
|
|
198
245
|
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
|
|
@@ -222,8 +269,13 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
222
269
|
}
|
|
223
270
|
return false;
|
|
224
271
|
},
|
|
225
|
-
icon:
|
|
226
|
-
|
|
272
|
+
icon: function icon() {
|
|
273
|
+
return /*#__PURE__*/React.createElement(TableColumnsDistributeIcon, {
|
|
274
|
+
LEGACY_fallbackIcon: EditorLayoutThreeEqualIcon,
|
|
275
|
+
spacing: 'spacious',
|
|
276
|
+
label: ''
|
|
277
|
+
});
|
|
278
|
+
}
|
|
227
279
|
} : undefined, {
|
|
228
280
|
id: 'clear_cells',
|
|
229
281
|
title: 'Clear cells',
|
|
@@ -231,8 +283,13 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
231
283
|
emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition)(state, dispatch);
|
|
232
284
|
return true;
|
|
233
285
|
},
|
|
234
|
-
icon:
|
|
235
|
-
|
|
286
|
+
icon: function icon() {
|
|
287
|
+
return /*#__PURE__*/React.createElement(TableCellClearIcon, {
|
|
288
|
+
LEGACY_fallbackIcon: CrossCircleIcon,
|
|
289
|
+
spacing: 'spacious',
|
|
290
|
+
label: ''
|
|
291
|
+
});
|
|
292
|
+
},
|
|
236
293
|
keymap: tooltip(backspace)
|
|
237
294
|
}, {
|
|
238
295
|
id: "delete_".concat(direction),
|
|
@@ -245,14 +302,24 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
245
302
|
}
|
|
246
303
|
return true;
|
|
247
304
|
},
|
|
248
|
-
icon: direction === 'row' ?
|
|
249
|
-
|
|
305
|
+
icon: direction === 'row' ? function () {
|
|
306
|
+
return /*#__PURE__*/React.createElement(TableRowDeleteIcon, {
|
|
307
|
+
LEGACY_fallbackIcon: RemoveIcon,
|
|
308
|
+
spacing: 'spacious',
|
|
309
|
+
label: ''
|
|
310
|
+
});
|
|
311
|
+
} : function () {
|
|
312
|
+
return /*#__PURE__*/React.createElement(TableColumnDeleteIcon, {
|
|
313
|
+
LEGACY_fallbackIcon: RemoveIcon,
|
|
314
|
+
spacing: 'spacious',
|
|
315
|
+
label: ''
|
|
316
|
+
});
|
|
317
|
+
},
|
|
250
318
|
keymap: direction === 'row' ? tooltip(deleteRow) : tooltip(deleteColumn)
|
|
251
319
|
}], _toConsumableArray(moveOptions.map(function (_ref3) {
|
|
252
320
|
var label = _ref3.label,
|
|
253
321
|
canMove = _ref3.canMove,
|
|
254
322
|
icon = _ref3.icon,
|
|
255
|
-
iconFallback = _ref3.iconFallback,
|
|
256
323
|
keymap = _ref3.keymap,
|
|
257
324
|
getOriginIndexes = _ref3.getOriginIndexes,
|
|
258
325
|
getTargetIndex = _ref3.getTargetIndex;
|
|
@@ -261,7 +328,6 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
261
328
|
title: "Move ".concat(direction, " ").concat(label),
|
|
262
329
|
disabled: !canMove,
|
|
263
330
|
icon: icon,
|
|
264
|
-
iconFallback: iconFallback,
|
|
265
331
|
onClick: function onClick(state, dispatch) {
|
|
266
332
|
if (canMove) {
|
|
267
333
|
requestAnimationFrame(function () {
|
|
@@ -83,7 +83,8 @@ export var transformSliceToRemoveNestedTables = function transformSliceToRemoveN
|
|
|
83
83
|
var _slice$content$firstC, _slice$content$lastCh;
|
|
84
84
|
var isPasteInTable = hasParentNodeOfType([table, tableCell, tableHeader])(selection);
|
|
85
85
|
var isPasteInNestedTable = getParentOfTypeCount(schema.nodes.table)(selection.$from) > 1;
|
|
86
|
-
var
|
|
86
|
+
var isPasteFullTableInsideEmptyCellEnabled = fg('platform_editor_paste_full_table_inside_empty_cell');
|
|
87
|
+
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);
|
|
87
88
|
|
|
88
89
|
// if nesting is allowed we bump up the default nesting allowance to 2 to support
|
|
89
90
|
// two levels of nesting in nodes that support table nesting already such as layoutSection and expands
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -26,14 +26,12 @@ import { findCellRectClosestToPos, findTable, getSelectionRect, isSelectionType,
|
|
|
26
26
|
import AlignImageCenterIcon from '@atlaskit/icon/core/align-image-center';
|
|
27
27
|
import AlignImageLeftIcon from '@atlaskit/icon/core/align-image-left';
|
|
28
28
|
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
29
|
-
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
30
|
-
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
29
|
+
import CustomizeIcon from '@atlaskit/icon/core/migration/customize--preferences';
|
|
30
|
+
import DeleteIcon from '@atlaskit/icon/core/migration/delete--editor-remove';
|
|
31
31
|
import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
|
|
32
32
|
import EditorAlignImageCenter from '@atlaskit/icon/glyph/editor/align-image-center';
|
|
33
33
|
import EditorAlignImageLeft from '@atlaskit/icon/glyph/editor/align-image-left';
|
|
34
34
|
import DistributeColumnIcon from '@atlaskit/icon/glyph/editor/layout-three-equal';
|
|
35
|
-
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
36
|
-
import TableOptionsIcon from '@atlaskit/icon/glyph/preferences';
|
|
37
35
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
38
36
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
39
37
|
import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, hoverTable, removeDescendantNodes } from '../pm-plugins/commands';
|
|
@@ -109,8 +107,7 @@ export var getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _
|
|
|
109
107
|
type: 'dropdown',
|
|
110
108
|
testId: 'table_options',
|
|
111
109
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
112
|
-
icon: fg('platform-visual-refresh-icons') ? undefined :
|
|
113
|
-
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
110
|
+
icon: fg('platform-visual-refresh-icons') ? undefined : CustomizeIcon,
|
|
114
111
|
iconBefore: fg('platform-visual-refresh-icons') ? CustomizeIcon : undefined,
|
|
115
112
|
title: formatMessage(messages.tableOptions),
|
|
116
113
|
hidden: options.every(function (option) {
|
|
@@ -425,7 +422,6 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
425
422
|
type: 'button',
|
|
426
423
|
appearance: 'danger',
|
|
427
424
|
icon: DeleteIcon,
|
|
428
|
-
iconFallback: RemoveIcon,
|
|
429
425
|
onClick: deleteTableWithAnalytics(editorAnalyticsAPI),
|
|
430
426
|
disabled: !!resizeState && !!resizeState.dragging,
|
|
431
427
|
onMouseEnter: hoverTable(true),
|
|
@@ -582,8 +578,13 @@ var getColumnSettingItems = function getColumnSettingItems(editorState, editorVi
|
|
|
582
578
|
id: 'editor.table.distributeColumns',
|
|
583
579
|
type: 'button',
|
|
584
580
|
title: formatMessage(messages.distributeColumns),
|
|
585
|
-
icon:
|
|
586
|
-
|
|
581
|
+
icon: function icon() {
|
|
582
|
+
return jsx(TableColumnsDistributeIcon, {
|
|
583
|
+
LEGACY_fallbackIcon: DistributeColumnIcon,
|
|
584
|
+
spacing: 'spacious',
|
|
585
|
+
label: ''
|
|
586
|
+
});
|
|
587
|
+
},
|
|
587
588
|
onClick: function onClick(state, dispatch, view) {
|
|
588
589
|
return getDistributeConfig(getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor)(state, dispatch, view);
|
|
589
590
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { Command, DropdownOptionT, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { Command, DropdownOptionT, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.5.1",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
33
33
|
"@atlaskit/button": "^21.1.0",
|
|
34
34
|
"@atlaskit/custom-steps": "^0.11.0",
|
|
35
|
-
"@atlaskit/editor-common": "^102.
|
|
35
|
+
"@atlaskit/editor-common": "^102.12.0",
|
|
36
36
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
@@ -116,9 +116,6 @@
|
|
|
116
116
|
"platform_editor_batch_steps_table": {
|
|
117
117
|
"type": "boolean"
|
|
118
118
|
},
|
|
119
|
-
"platform_editor_nested_table_in_nested_parent_fix": {
|
|
120
|
-
"type": "boolean"
|
|
121
|
-
},
|
|
122
119
|
"platform-visual-refresh-icons": {
|
|
123
120
|
"type": "boolean"
|
|
124
121
|
},
|
|
@@ -194,6 +191,9 @@
|
|
|
194
191
|
},
|
|
195
192
|
"platform_editor_scroll_table_flickering_fix": {
|
|
196
193
|
"type": "boolean"
|
|
194
|
+
},
|
|
195
|
+
"platform_editor_paste_full_table_inside_empty_cell": {
|
|
196
|
+
"type": "boolean"
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
}
|
|
@@ -286,10 +286,10 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
286
286
|
this.handleColgroupUpdates(true);
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
if (this.wrapper
|
|
289
|
+
if (this.wrapper) {
|
|
290
290
|
this.wrapperReisizeObserver = new ResizeObserver((entries) => {
|
|
291
291
|
for (const entry of entries) {
|
|
292
|
-
this.wrapperWidth = entry.contentRect
|
|
292
|
+
this.wrapperWidth = entry.contentRect?.width;
|
|
293
293
|
}
|
|
294
294
|
});
|
|
295
295
|
|
|
@@ -1193,8 +1193,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
1193
1193
|
|
|
1194
1194
|
if (
|
|
1195
1195
|
isNested &&
|
|
1196
|
-
isTableNestedInMoreThanOneNode(this.props.view.state, this.props.getPos())
|
|
1197
|
-
fg('platform_editor_nested_table_in_nested_parent_fix')
|
|
1196
|
+
isTableNestedInMoreThanOneNode(this.props.view.state, this.props.getPos())
|
|
1198
1197
|
) {
|
|
1199
1198
|
const resizeObsWrapperWidth = this.wrapperWidth || 0;
|
|
1200
1199
|
|