@atlaskit/editor-plugin-table 7.13.0 → 7.13.2
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 +18 -0
- package/dist/cjs/commands/insert.js +6 -4
- package/dist/cjs/commands-with-analytics.js +4 -2
- package/dist/cjs/plugin.js +4 -2
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +10 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/index.js +6 -0
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +8 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +51 -34
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +11 -7
- package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +7 -2
- package/dist/cjs/ui/FloatingInsertButton/index.js +10 -4
- package/dist/cjs/utils/drag-menu.js +3 -2
- package/dist/es2019/commands/insert.js +6 -6
- package/dist/es2019/commands-with-analytics.js +4 -4
- package/dist/es2019/plugin.js +4 -2
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +11 -4
- package/dist/es2019/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +7 -0
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +49 -34
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +7 -3
- package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +7 -2
- package/dist/es2019/ui/FloatingInsertButton/index.js +10 -4
- package/dist/es2019/utils/drag-menu.js +3 -3
- package/dist/esm/commands/insert.js +6 -4
- package/dist/esm/commands-with-analytics.js +4 -2
- package/dist/esm/plugin.js +4 -2
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +11 -4
- package/dist/esm/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +7 -0
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +50 -33
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +11 -7
- package/dist/esm/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +7 -2
- package/dist/esm/ui/FloatingInsertButton/index.js +10 -4
- package/dist/esm/utils/drag-menu.js +3 -2
- package/dist/types/commands/insert.d.ts +3 -3
- package/dist/types/commands-with-analytics.d.ts +2 -2
- package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +1 -0
- package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +1 -0
- package/dist/types/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
- package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types/ui/FloatingInsertButton/index.d.ts +2 -1
- package/dist/types/utils/drag-menu.d.ts +1 -1
- package/dist/types-ts4.5/commands/insert.d.ts +3 -3
- package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +1 -0
- package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +2 -1
- package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
- package/package.json +2 -2
- package/src/commands/insert.ts +16 -6
- package/src/commands-with-analytics.ts +13 -3
- package/src/plugin.tsx +8 -0
- package/src/pm-plugins/table-resizing/event-handlers.ts +43 -21
- package/src/pm-plugins/table-resizing/utils/index.ts +1 -1
- package/src/pm-plugins/table-resizing/utils/misc.ts +11 -0
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +85 -65
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +21 -8
- package/src/ui/FloatingContextualMenu/index.tsx +2 -0
- package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -0
- package/src/ui/FloatingDragMenu/index.tsx +11 -1
- package/src/ui/FloatingInsertButton/index.tsx +38 -11
- package/src/utils/drag-menu.ts +17 -11
|
@@ -365,7 +365,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
365
365
|
editorView = _this$props10.editorView,
|
|
366
366
|
selectionRect = _this$props10.selectionRect,
|
|
367
367
|
editorAnalyticsAPI = _this$props10.editorAnalyticsAPI,
|
|
368
|
-
getEditorContainerWidth = _this$props10.getEditorContainerWidth
|
|
368
|
+
getEditorContainerWidth = _this$props10.getEditorContainerWidth,
|
|
369
|
+
getEditorFeatureFlags = _this$props10.getEditorFeatureFlags;
|
|
369
370
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
370
371
|
var state = editorView.state,
|
|
371
372
|
dispatch = editorView.dispatch;
|
|
@@ -373,6 +374,9 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
373
374
|
targetCellPosition = _getPluginState11.targetCellPosition,
|
|
374
375
|
_getPluginState11$isT = _getPluginState11.isTableScalingEnabled,
|
|
375
376
|
isTableScalingEnabled = _getPluginState11$isT === void 0 ? false : _getPluginState11$isT;
|
|
377
|
+
var _ref2 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
378
|
+
_ref2$tableDuplicateC = _ref2.tableDuplicateCellColouring,
|
|
379
|
+
tableDuplicateCellColouring = _ref2$tableDuplicateC === void 0 ? false : _ref2$tableDuplicateC;
|
|
376
380
|
switch (item.value.name) {
|
|
377
381
|
case 'sort_column_desc':
|
|
378
382
|
sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, selectionRect.left, SortOrder.DESC)(state, dispatch);
|
|
@@ -402,11 +406,11 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
402
406
|
_this.toggleOpen();
|
|
403
407
|
break;
|
|
404
408
|
case 'insert_column':
|
|
405
|
-
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
|
|
409
|
+
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
|
|
406
410
|
_this.toggleOpen();
|
|
407
411
|
break;
|
|
408
412
|
case 'insert_row':
|
|
409
|
-
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, {
|
|
413
|
+
insertRowWithAnalytics(editorAnalyticsAPI, tableDuplicateCellColouring)(INPUT_METHOD.CONTEXT_MENU, {
|
|
410
414
|
index: selectionRect.bottom,
|
|
411
415
|
moveCursorToInsertedRow: true
|
|
412
416
|
})(state, dispatch);
|
|
@@ -446,8 +450,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
446
450
|
isSubmenuOpen: false
|
|
447
451
|
});
|
|
448
452
|
});
|
|
449
|
-
_defineProperty(_assertThisInitialized(_this), "handleItemMouseEnter", function (
|
|
450
|
-
var item =
|
|
453
|
+
_defineProperty(_assertThisInitialized(_this), "handleItemMouseEnter", function (_ref3) {
|
|
454
|
+
var item = _ref3.item;
|
|
451
455
|
var _this$props12 = _this.props,
|
|
452
456
|
_this$props12$editorV = _this$props12.editorView,
|
|
453
457
|
state = _this$props12$editorV.state,
|
|
@@ -470,8 +474,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
470
474
|
hoverMergedCells()(state, dispatch);
|
|
471
475
|
}
|
|
472
476
|
});
|
|
473
|
-
_defineProperty(_assertThisInitialized(_this), "handleItemMouseLeave", function (
|
|
474
|
-
var item =
|
|
477
|
+
_defineProperty(_assertThisInitialized(_this), "handleItemMouseLeave", function (_ref4) {
|
|
478
|
+
var item = _ref4.item;
|
|
475
479
|
var _this$props$editorVie2 = _this.props.editorView,
|
|
476
480
|
state = _this$props$editorVie2.state,
|
|
477
481
|
dispatch = _this$props$editorVie2.dispatch;
|
|
@@ -16,7 +16,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
16
16
|
isOpen = _ref.isOpen,
|
|
17
17
|
pluginConfig = _ref.pluginConfig,
|
|
18
18
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
19
|
-
getEditorContainerWidth = _ref.getEditorContainerWidth
|
|
19
|
+
getEditorContainerWidth = _ref.getEditorContainerWidth,
|
|
20
|
+
getEditorFeatureFlags = _ref.getEditorFeatureFlags;
|
|
20
21
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
21
22
|
var _getPluginState = getPluginState(editorView.state),
|
|
22
23
|
targetCellPosition = _getPluginState.targetCellPosition,
|
|
@@ -64,7 +65,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
64
65
|
selectionRect: selectionRect,
|
|
65
66
|
boundariesElement: boundariesElement,
|
|
66
67
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
67
|
-
getEditorContainerWidth: getEditorContainerWidth
|
|
68
|
+
getEditorContainerWidth: getEditorContainerWidth,
|
|
69
|
+
getEditorFeatureFlags: getEditorFeatureFlags
|
|
68
70
|
})));
|
|
69
71
|
};
|
|
70
72
|
FloatingContextualMenu.displayName = 'FloatingContextualMenu';
|
|
@@ -180,7 +180,8 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
180
180
|
mountPoint = _ref.mountPoint,
|
|
181
181
|
scrollableElement = _ref.scrollableElement,
|
|
182
182
|
boundariesElement = _ref.boundariesElement,
|
|
183
|
-
isTableScalingEnabled = _ref.isTableScalingEnabled
|
|
183
|
+
isTableScalingEnabled = _ref.isTableScalingEnabled,
|
|
184
|
+
tableDuplicateCellColouring = _ref.tableDuplicateCellColouring;
|
|
184
185
|
var state = editorView.state,
|
|
185
186
|
dispatch = editorView.dispatch;
|
|
186
187
|
var selection = state.selection;
|
|
@@ -204,7 +205,7 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
204
205
|
hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
|
|
205
206
|
}
|
|
206
207
|
var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
207
|
-
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled);
|
|
208
|
+
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring);
|
|
208
209
|
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect),
|
|
209
210
|
menuItems = _convertToDropdownIte.menuItems,
|
|
210
211
|
menuCallback = _convertToDropdownIte.menuCallback;
|
|
@@ -18,7 +18,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
18
18
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
19
19
|
stickyHeaders = _ref.stickyHeaders,
|
|
20
20
|
pluginConfig = _ref.pluginConfig,
|
|
21
|
-
isTableScalingEnabled = _ref.isTableScalingEnabled
|
|
21
|
+
isTableScalingEnabled = _ref.isTableScalingEnabled,
|
|
22
|
+
getEditorFeatureFlags = _ref.getEditorFeatureFlags;
|
|
22
23
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
23
24
|
return null;
|
|
24
25
|
}
|
|
@@ -28,6 +29,9 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
28
29
|
if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
|
|
29
30
|
return null;
|
|
30
31
|
}
|
|
32
|
+
var _ref2 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
33
|
+
_ref2$tableDuplicateC = _ref2.tableDuplicateCellColouring,
|
|
34
|
+
tableDuplicateCellColouring = _ref2$tableDuplicateC === void 0 ? false : _ref2$tableDuplicateC;
|
|
31
35
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
32
36
|
alignX: direction === 'row' ? 'right' : undefined,
|
|
33
37
|
alignY: direction === 'row' ? 'start' : undefined,
|
|
@@ -61,7 +65,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
61
65
|
mountPoint: mountPoint,
|
|
62
66
|
boundariesElement: boundariesElement,
|
|
63
67
|
scrollableElement: scrollableElement,
|
|
64
|
-
isTableScalingEnabled: isTableScalingEnabled
|
|
68
|
+
isTableScalingEnabled: isTableScalingEnabled,
|
|
69
|
+
tableDuplicateCellColouring: tableDuplicateCellColouring
|
|
65
70
|
}));
|
|
66
71
|
};
|
|
67
72
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
|
@@ -169,12 +169,14 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
|
|
|
169
169
|
var _this$props3 = this.props,
|
|
170
170
|
editorView = _this$props3.editorView,
|
|
171
171
|
insertRowButtonIndex = _this$props3.insertRowButtonIndex,
|
|
172
|
-
editorAnalyticsAPI = _this$props3.editorAnalyticsAPI
|
|
172
|
+
editorAnalyticsAPI = _this$props3.editorAnalyticsAPI,
|
|
173
|
+
getEditorFeatureFlags = _this$props3.getEditorFeatureFlags;
|
|
173
174
|
if (typeof insertRowButtonIndex !== 'undefined') {
|
|
174
175
|
event.preventDefault();
|
|
175
176
|
var state = editorView.state,
|
|
176
177
|
dispatch = editorView.dispatch;
|
|
177
|
-
|
|
178
|
+
var featureFlags = !!getEditorFeatureFlags && getEditorFeatureFlags();
|
|
179
|
+
insertRowWithAnalytics(editorAnalyticsAPI, featureFlags && featureFlags.tableDuplicateCellColouring)(INPUT_METHOD.BUTTON, {
|
|
178
180
|
index: insertRowButtonIndex,
|
|
179
181
|
moveCursorToInsertedRow: true
|
|
180
182
|
})(state, dispatch);
|
|
@@ -186,15 +188,19 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
|
|
|
186
188
|
var _this$props4 = this.props,
|
|
187
189
|
editorView = _this$props4.editorView,
|
|
188
190
|
insertColumnButtonIndex = _this$props4.insertColumnButtonIndex,
|
|
189
|
-
editorAnalyticsAPI = _this$props4.editorAnalyticsAPI
|
|
191
|
+
editorAnalyticsAPI = _this$props4.editorAnalyticsAPI,
|
|
192
|
+
getEditorFeatureFlags = _this$props4.getEditorFeatureFlags;
|
|
190
193
|
if (typeof insertColumnButtonIndex !== 'undefined') {
|
|
191
194
|
event.preventDefault();
|
|
192
195
|
var _getPluginState = getPluginState(editorView.state),
|
|
193
196
|
_getPluginState$isTab = _getPluginState.isTableScalingEnabled,
|
|
194
197
|
isTableScalingEnabled = _getPluginState$isTab === void 0 ? false : _getPluginState$isTab;
|
|
198
|
+
var _ref = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
199
|
+
_ref$tableDuplicateCe = _ref.tableDuplicateCellColouring,
|
|
200
|
+
tableDuplicateCellColouring = _ref$tableDuplicateCe === void 0 ? false : _ref$tableDuplicateCe;
|
|
195
201
|
var state = editorView.state,
|
|
196
202
|
dispatch = editorView.dispatch;
|
|
197
|
-
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
|
|
203
|
+
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
|
|
198
204
|
}
|
|
199
205
|
}
|
|
200
206
|
}]);
|
|
@@ -71,6 +71,7 @@ var defaultSelectionRect = {
|
|
|
71
71
|
export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired) {
|
|
72
72
|
var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
|
|
73
73
|
var isTableScalingEnabled = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : false;
|
|
74
|
+
var tableDuplicateCellColouring = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : false;
|
|
74
75
|
var addOptions = direction === 'row' ? [{
|
|
75
76
|
label: 'above',
|
|
76
77
|
offset: 0,
|
|
@@ -150,12 +151,12 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
150
151
|
icon: icon,
|
|
151
152
|
onClick: function onClick(state, dispatch) {
|
|
152
153
|
if (direction === 'row') {
|
|
153
|
-
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
|
|
154
|
+
insertRowWithAnalytics(editorAnalyticsAPI, tableDuplicateCellColouring)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
|
|
154
155
|
index: (index !== null && index !== void 0 ? index : 0) + offset,
|
|
155
156
|
moveCursorToInsertedRow: true
|
|
156
157
|
})(state, dispatch);
|
|
157
158
|
} else {
|
|
158
|
-
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
|
|
159
|
+
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
|
|
159
160
|
}
|
|
160
161
|
return true;
|
|
161
162
|
},
|
|
@@ -2,10 +2,10 @@ import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/a
|
|
|
2
2
|
import type { Command, EditorCommand } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
export declare function addColumnAt(isTableScalingEnabled?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
5
|
+
export declare function addColumnAt(isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
6
6
|
export declare const addColumnBefore: (isTableScalingEnabled?: boolean) => Command;
|
|
7
7
|
export declare const addColumnAfter: (isTableScalingEnabled?: boolean) => Command;
|
|
8
|
-
export declare const insertColumn: (isTableScalingEnabled?: boolean) => (column: number) => Command;
|
|
9
|
-
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean) => Command;
|
|
8
|
+
export declare const insertColumn: (isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean) => (column: number) => Command;
|
|
9
|
+
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean, isCellBackgroundDuplicated?: boolean) => Command;
|
|
10
10
|
export declare const createTable: (isTableScalingEnabled?: boolean, isFullWidthModeEnabled?: boolean) => Command;
|
|
11
11
|
export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
|
@@ -12,9 +12,9 @@ export declare const mergeCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyti
|
|
|
12
12
|
export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) => Command;
|
|
13
13
|
export declare const setColorWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, cellColor: string, targetCellPosition?: number, editorView?: EditorView | null) => Command;
|
|
14
14
|
export declare const addRowAroundSelection: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (side: RowInsertPosition) => Command;
|
|
15
|
-
export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
|
|
15
|
+
export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isCellbackgroundDuplicated?: boolean) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
|
|
16
16
|
export declare const changeColumnWidthByStepWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth, isTableScalingEnabled: boolean, inputMethod: INPUT_METHOD.SHORTCUT, ariaNotify?: ((message: string) => void) | undefined, getIntl?: () => IntlShape) => Command;
|
|
17
|
-
export declare const insertColumnWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
|
|
17
|
+
export declare const insertColumnWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isCellbackgroundDuplicated?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
|
|
18
18
|
export declare const deleteRowsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect, isHeaderRowRequired: boolean) => Command;
|
|
19
19
|
export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect) => Command;
|
|
20
20
|
export declare const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
|
|
@@ -9,5 +9,5 @@ export { updateControls, isClickNear, getResizeCellPos } from './dom';
|
|
|
9
9
|
export { scale, scaleWithParent, scaleTable, previewScaleTable, } from './scale-table';
|
|
10
10
|
export type { ScaleOptions } from './scale-table';
|
|
11
11
|
export type { ResizeState, ResizeStateWithAnalytics } from './types';
|
|
12
|
-
export { resizeColumn } from './resize-column';
|
|
12
|
+
export { resizeColumn, resizeColumnAndTable } from './resize-column';
|
|
13
13
|
export { COLUMN_MIN_WIDTH, TABLE_MAX_WIDTH, TABLE_DEFAULT_WIDTH, MAX_SCALING_PERCENT, } from './consts';
|
|
@@ -25,4 +25,5 @@ export declare const getTableMaxWidth: ({ table, tableStart, state, layout, getE
|
|
|
25
25
|
export declare const getTableElementWidth: (table: PMNode) => number;
|
|
26
26
|
export declare const getTableContainerElementWidth: (table: PMNode) => number;
|
|
27
27
|
export declare const getTableScalingPercent: (table: PMNode, tableRef: HTMLElement | null) => number;
|
|
28
|
+
export declare const getStaticTableScalingPercent: (table: PMNode, tableRenderWidth: number) => number;
|
|
28
29
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { ResizeState } from './types';
|
|
3
3
|
export declare const resizeColumn: (resizeState: ResizeState, colIndex: number, amount: number, tableRef: HTMLElement | null, tableNode: PmNode, selectedColumns?: number[], isTableScalingEnabled?: boolean) => ResizeState;
|
|
4
|
+
export declare const resizeColumnAndTable: (resizeState: ResizeState, colIndex: number, amount: number, tableRef: HTMLElement, tableNode: PmNode, selectedColumns?: number[], isTableScalingEnabled?: boolean, originalTableWidth?: number) => ResizeState;
|
|
@@ -17,7 +17,7 @@ export interface Props {
|
|
|
17
17
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
18
18
|
}
|
|
19
19
|
declare const FloatingContextualMenu: {
|
|
20
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, }: Props): jsx.JSX.Element | null;
|
|
20
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, }: Props): jsx.JSX.Element | null;
|
|
21
21
|
displayName: string;
|
|
22
22
|
};
|
|
23
23
|
export default FloatingContextualMenu;
|
|
@@ -25,8 +25,9 @@ type DragMenuProps = {
|
|
|
25
25
|
boundariesElement?: HTMLElement;
|
|
26
26
|
scrollableElement?: HTMLElement;
|
|
27
27
|
isTableScalingEnabled?: boolean;
|
|
28
|
+
tableDuplicateCellColouring?: boolean;
|
|
28
29
|
};
|
|
29
|
-
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
30
|
+
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, tableDuplicateCellColouring, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
30
31
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps>> & {
|
|
31
32
|
WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps>;
|
|
32
33
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
@@ -21,9 +21,10 @@ export interface Props {
|
|
|
21
21
|
stickyHeaders?: RowStickyState;
|
|
22
22
|
pluginConfig?: PluginConfig;
|
|
23
23
|
isTableScalingEnabled?: boolean;
|
|
24
|
+
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
24
25
|
}
|
|
25
26
|
declare const FloatingDragMenu: {
|
|
26
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, isTableScalingEnabled, }: Props): JSX.Element | null;
|
|
27
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, isTableScalingEnabled, getEditorFeatureFlags, }: Props): JSX.Element | null;
|
|
27
28
|
displayName: string;
|
|
28
29
|
};
|
|
29
30
|
export default FloatingDragMenu;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
export interface Props {
|
|
@@ -20,6 +20,7 @@ export interface Props {
|
|
|
20
20
|
hasStickyHeaders?: boolean;
|
|
21
21
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
22
22
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
23
|
+
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
23
24
|
}
|
|
24
25
|
export declare class FloatingInsertButton extends React.Component<Props & WrappedComponentProps, any> {
|
|
25
26
|
static displayName: string;
|
|
@@ -13,4 +13,4 @@ export interface DragMenuConfig extends DropdownOptionT<Command> {
|
|
|
13
13
|
icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
|
|
14
14
|
keymap?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean) => DragMenuConfig[];
|
|
16
|
+
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean) => DragMenuConfig[];
|
|
@@ -2,10 +2,10 @@ import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/a
|
|
|
2
2
|
import type { Command, EditorCommand } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
export declare function addColumnAt(isTableScalingEnabled?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
5
|
+
export declare function addColumnAt(isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
6
6
|
export declare const addColumnBefore: (isTableScalingEnabled?: boolean) => Command;
|
|
7
7
|
export declare const addColumnAfter: (isTableScalingEnabled?: boolean) => Command;
|
|
8
|
-
export declare const insertColumn: (isTableScalingEnabled?: boolean) => (column: number) => Command;
|
|
9
|
-
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean) => Command;
|
|
8
|
+
export declare const insertColumn: (isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean) => (column: number) => Command;
|
|
9
|
+
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean, isCellBackgroundDuplicated?: boolean) => Command;
|
|
10
10
|
export declare const createTable: (isTableScalingEnabled?: boolean, isFullWidthModeEnabled?: boolean) => Command;
|
|
11
11
|
export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
|
@@ -12,9 +12,9 @@ export declare const mergeCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyti
|
|
|
12
12
|
export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) => Command;
|
|
13
13
|
export declare const setColorWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, cellColor: string, targetCellPosition?: number, editorView?: EditorView | null) => Command;
|
|
14
14
|
export declare const addRowAroundSelection: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (side: RowInsertPosition) => Command;
|
|
15
|
-
export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
|
|
15
|
+
export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isCellbackgroundDuplicated?: boolean) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
|
|
16
16
|
export declare const changeColumnWidthByStepWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth, isTableScalingEnabled: boolean, inputMethod: INPUT_METHOD.SHORTCUT, ariaNotify?: ((message: string) => void) | undefined, getIntl?: () => IntlShape) => Command;
|
|
17
|
-
export declare const insertColumnWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
|
|
17
|
+
export declare const insertColumnWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isCellbackgroundDuplicated?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
|
|
18
18
|
export declare const deleteRowsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect, isHeaderRowRequired: boolean) => Command;
|
|
19
19
|
export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect) => Command;
|
|
20
20
|
export declare const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
|
|
@@ -9,5 +9,5 @@ export { updateControls, isClickNear, getResizeCellPos } from './dom';
|
|
|
9
9
|
export { scale, scaleWithParent, scaleTable, previewScaleTable, } from './scale-table';
|
|
10
10
|
export type { ScaleOptions } from './scale-table';
|
|
11
11
|
export type { ResizeState, ResizeStateWithAnalytics } from './types';
|
|
12
|
-
export { resizeColumn } from './resize-column';
|
|
12
|
+
export { resizeColumn, resizeColumnAndTable } from './resize-column';
|
|
13
13
|
export { COLUMN_MIN_WIDTH, TABLE_MAX_WIDTH, TABLE_DEFAULT_WIDTH, MAX_SCALING_PERCENT, } from './consts';
|
|
@@ -25,4 +25,5 @@ export declare const getTableMaxWidth: ({ table, tableStart, state, layout, getE
|
|
|
25
25
|
export declare const getTableElementWidth: (table: PMNode) => number;
|
|
26
26
|
export declare const getTableContainerElementWidth: (table: PMNode) => number;
|
|
27
27
|
export declare const getTableScalingPercent: (table: PMNode, tableRef: HTMLElement | null) => number;
|
|
28
|
+
export declare const getStaticTableScalingPercent: (table: PMNode, tableRenderWidth: number) => number;
|
|
28
29
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { ResizeState } from './types';
|
|
3
3
|
export declare const resizeColumn: (resizeState: ResizeState, colIndex: number, amount: number, tableRef: HTMLElement | null, tableNode: PmNode, selectedColumns?: number[], isTableScalingEnabled?: boolean) => ResizeState;
|
|
4
|
+
export declare const resizeColumnAndTable: (resizeState: ResizeState, colIndex: number, amount: number, tableRef: HTMLElement, tableNode: PmNode, selectedColumns?: number[], isTableScalingEnabled?: boolean, originalTableWidth?: number) => ResizeState;
|
|
@@ -17,7 +17,7 @@ export interface Props {
|
|
|
17
17
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
18
18
|
}
|
|
19
19
|
declare const FloatingContextualMenu: {
|
|
20
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, }: Props): jsx.JSX.Element | null;
|
|
20
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, }: Props): jsx.JSX.Element | null;
|
|
21
21
|
displayName: string;
|
|
22
22
|
};
|
|
23
23
|
export default FloatingContextualMenu;
|
|
@@ -25,8 +25,9 @@ type DragMenuProps = {
|
|
|
25
25
|
boundariesElement?: HTMLElement;
|
|
26
26
|
scrollableElement?: HTMLElement;
|
|
27
27
|
isTableScalingEnabled?: boolean;
|
|
28
|
+
tableDuplicateCellColouring?: boolean;
|
|
28
29
|
};
|
|
29
|
-
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
30
|
+
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, tableDuplicateCellColouring, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
30
31
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps>> & {
|
|
31
32
|
WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps>;
|
|
32
33
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
@@ -21,9 +21,10 @@ export interface Props {
|
|
|
21
21
|
stickyHeaders?: RowStickyState;
|
|
22
22
|
pluginConfig?: PluginConfig;
|
|
23
23
|
isTableScalingEnabled?: boolean;
|
|
24
|
+
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
24
25
|
}
|
|
25
26
|
declare const FloatingDragMenu: {
|
|
26
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, isTableScalingEnabled, }: Props): JSX.Element | null;
|
|
27
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, isTableScalingEnabled, getEditorFeatureFlags, }: Props): JSX.Element | null;
|
|
27
28
|
displayName: string;
|
|
28
29
|
};
|
|
29
30
|
export default FloatingDragMenu;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
export interface Props {
|
|
@@ -20,6 +20,7 @@ export interface Props {
|
|
|
20
20
|
hasStickyHeaders?: boolean;
|
|
21
21
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
22
22
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
23
|
+
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
23
24
|
}
|
|
24
25
|
export declare class FloatingInsertButton extends React.Component<Props & WrappedComponentProps, any> {
|
|
25
26
|
static displayName: string;
|
|
@@ -13,4 +13,4 @@ export interface DragMenuConfig extends DropdownOptionT<Command> {
|
|
|
13
13
|
icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
|
|
14
14
|
keymap?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean) => DragMenuConfig[];
|
|
16
|
+
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean) => DragMenuConfig[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.13.
|
|
3
|
+
"version": "7.13.2",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@atlaskit/primitives": "^6.1.0",
|
|
52
52
|
"@atlaskit/theme": "^12.8.0",
|
|
53
53
|
"@atlaskit/toggle": "^13.1.0",
|
|
54
|
-
"@atlaskit/tokens": "^1.
|
|
54
|
+
"@atlaskit/tokens": "^1.47.0",
|
|
55
55
|
"@atlaskit/tooltip": "^18.3.0",
|
|
56
56
|
"@babel/runtime": "^7.0.0",
|
|
57
57
|
"@emotion/react": "^11.7.1",
|
package/src/commands/insert.ts
CHANGED
|
@@ -44,7 +44,10 @@ function addColumnAtCustomStep(column: number) {
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export function addColumnAt(
|
|
47
|
+
export function addColumnAt(
|
|
48
|
+
isTableScalingEnabled = false,
|
|
49
|
+
isCellBackgroundDuplicated?: boolean,
|
|
50
|
+
) {
|
|
48
51
|
return (
|
|
49
52
|
column: number,
|
|
50
53
|
allowAddColumnCustomStep: boolean = false,
|
|
@@ -55,7 +58,10 @@ export function addColumnAt(isTableScalingEnabled = false) {
|
|
|
55
58
|
if (allowAddColumnCustomStep) {
|
|
56
59
|
updatedTr = addColumnAtCustomStep(column)(updatedTr);
|
|
57
60
|
} else {
|
|
58
|
-
updatedTr = addColumnAtPMUtils(
|
|
61
|
+
updatedTr = addColumnAtPMUtils(
|
|
62
|
+
column,
|
|
63
|
+
isCellBackgroundDuplicated,
|
|
64
|
+
)(updatedTr);
|
|
59
65
|
}
|
|
60
66
|
const table = findTable(updatedTr.selection);
|
|
61
67
|
if (table) {
|
|
@@ -126,10 +132,10 @@ export const addColumnAfter =
|
|
|
126
132
|
};
|
|
127
133
|
|
|
128
134
|
export const insertColumn =
|
|
129
|
-
(isTableScalingEnabled = false) =>
|
|
135
|
+
(isTableScalingEnabled = false, isCellBackgroundDuplicated?: boolean) =>
|
|
130
136
|
(column: number): Command =>
|
|
131
137
|
(state, dispatch, view) => {
|
|
132
|
-
let tr = addColumnAt(isTableScalingEnabled)(
|
|
138
|
+
let tr = addColumnAt(isTableScalingEnabled, isCellBackgroundDuplicated)(
|
|
133
139
|
column,
|
|
134
140
|
getAllowAddColumnCustomStep(state),
|
|
135
141
|
view,
|
|
@@ -150,7 +156,11 @@ export const insertColumn =
|
|
|
150
156
|
};
|
|
151
157
|
|
|
152
158
|
export const insertRow =
|
|
153
|
-
(
|
|
159
|
+
(
|
|
160
|
+
row: number,
|
|
161
|
+
moveCursorToTheNewRow: boolean,
|
|
162
|
+
isCellBackgroundDuplicated?: boolean,
|
|
163
|
+
): Command =>
|
|
154
164
|
(state, dispatch) => {
|
|
155
165
|
// Don't clone the header row
|
|
156
166
|
const headerRowEnabled = checkIfHeaderRowEnabled(state.selection);
|
|
@@ -165,7 +175,7 @@ export const insertRow =
|
|
|
165
175
|
|
|
166
176
|
const tr = clonePreviousRow
|
|
167
177
|
? copyPreviousRow(state.schema)(row)(state.tr)
|
|
168
|
-
: addRowAt(row)(state.tr);
|
|
178
|
+
: addRowAt(row, undefined, isCellBackgroundDuplicated)(state.tr);
|
|
169
179
|
|
|
170
180
|
const table = findTable(tr.selection);
|
|
171
181
|
if (!table) {
|
|
@@ -240,7 +240,10 @@ export const addRowAroundSelection =
|
|
|
240
240
|
};
|
|
241
241
|
|
|
242
242
|
export const insertRowWithAnalytics =
|
|
243
|
-
(
|
|
243
|
+
(
|
|
244
|
+
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
245
|
+
isCellbackgroundDuplicated = false,
|
|
246
|
+
) =>
|
|
244
247
|
(inputMethod: InsertRowMethods, options: InsertRowOptions) =>
|
|
245
248
|
withEditorAnalyticsAPI((state) => {
|
|
246
249
|
const { totalRowCount, totalColumnCount } = getSelectedTableInfo(
|
|
@@ -259,7 +262,11 @@ export const insertRowWithAnalytics =
|
|
|
259
262
|
eventType: EVENT_TYPE.TRACK,
|
|
260
263
|
};
|
|
261
264
|
})(editorAnalyticsAPI)(
|
|
262
|
-
insertRow(
|
|
265
|
+
insertRow(
|
|
266
|
+
options.index,
|
|
267
|
+
options.moveCursorToInsertedRow,
|
|
268
|
+
isCellbackgroundDuplicated,
|
|
269
|
+
),
|
|
263
270
|
);
|
|
264
271
|
|
|
265
272
|
export const changeColumnWidthByStepWithAnalytics =
|
|
@@ -308,6 +315,7 @@ export const insertColumnWithAnalytics =
|
|
|
308
315
|
(
|
|
309
316
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
310
317
|
isTableScalingEnabled = false,
|
|
318
|
+
isCellbackgroundDuplicated = false,
|
|
311
319
|
) =>
|
|
312
320
|
(
|
|
313
321
|
inputMethod:
|
|
@@ -334,7 +342,9 @@ export const insertColumnWithAnalytics =
|
|
|
334
342
|
},
|
|
335
343
|
eventType: EVENT_TYPE.TRACK,
|
|
336
344
|
};
|
|
337
|
-
})(editorAnalyticsAPI)(
|
|
345
|
+
})(editorAnalyticsAPI)(
|
|
346
|
+
insertColumn(isTableScalingEnabled, isCellbackgroundDuplicated)(position),
|
|
347
|
+
);
|
|
338
348
|
|
|
339
349
|
export const deleteRowsWithAnalytics =
|
|
340
350
|
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
package/src/plugin.tsx
CHANGED
|
@@ -552,6 +552,10 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
552
552
|
dispatchAnalyticsEvent={dispatchAnalyticsEvent}
|
|
553
553
|
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
554
554
|
getEditorContainerWidth={defaultGetEditorContainerWidth}
|
|
555
|
+
getEditorFeatureFlags={
|
|
556
|
+
options?.getEditorFeatureFlags ||
|
|
557
|
+
defaultGetEditorFeatureFlags
|
|
558
|
+
}
|
|
555
559
|
/>
|
|
556
560
|
)}
|
|
557
561
|
{options?.allowContextualMenu && (
|
|
@@ -586,6 +590,10 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
586
590
|
stickyHeaders={stickyHeader}
|
|
587
591
|
pluginConfig={pluginConfig}
|
|
588
592
|
isTableScalingEnabled={options?.isTableScalingEnabled}
|
|
593
|
+
getEditorFeatureFlags={
|
|
594
|
+
options?.getEditorFeatureFlags ||
|
|
595
|
+
defaultGetEditorFeatureFlags
|
|
596
|
+
}
|
|
589
597
|
/>
|
|
590
598
|
)}
|
|
591
599
|
{allowControls && !isDragAndDropEnabled && !isResizing && (
|