@atlaskit/editor-plugin-table 7.5.2 → 7.5.4
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 +13 -0
- package/dist/cjs/commands-with-analytics.js +65 -38
- package/dist/cjs/nodeviews/ExternalDropTargets.js +2 -2
- package/dist/cjs/nodeviews/TableCell.js +1 -1
- package/dist/cjs/nodeviews/TableComponent.js +1 -1
- package/dist/cjs/nodeviews/TableContainer.js +3 -3
- package/dist/cjs/nodeviews/TableResizer.js +10 -10
- package/dist/cjs/nodeviews/TableRow.js +1 -1
- package/dist/cjs/nodeviews/table.js +1 -1
- package/dist/cjs/pm-plugins/keymap.js +2 -2
- package/dist/cjs/pm-plugins/table-analytics.js +2 -2
- package/dist/cjs/pm-plugins/table-local-id.js +11 -11
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +16 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +0 -1
- package/dist/cjs/reducer.js +0 -2
- package/dist/cjs/toolbar.js +2 -2
- package/dist/cjs/ui/ColumnResizeWidget/index.js +4 -5
- package/dist/cjs/ui/DragHandle/index.js +2 -2
- package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +2 -2
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
- package/dist/cjs/ui/FloatingDeleteButton/index.js +3 -3
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +2 -2
- package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +2 -2
- package/dist/cjs/ui/FloatingInsertButton/index.js +3 -3
- package/dist/cjs/ui/LayoutButton/index.js +3 -3
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -2
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +2 -2
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +2 -2
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +2 -2
- package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +3 -3
- package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +2 -2
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +3 -3
- package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +3 -3
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +2 -2
- package/dist/cjs/ui/TableFloatingControls/RowDropTarget/index.js +2 -2
- package/dist/cjs/ui/TableFloatingControls/index.js +3 -3
- package/dist/cjs/utils/decoration.js +0 -4
- package/dist/cjs/utils/guidelines.js +5 -2
- package/dist/cjs/utils/merged-cells.js +0 -1
- package/dist/cjs/utils/snapping.js +14 -1
- package/dist/es2019/commands-with-analytics.js +27 -0
- package/dist/es2019/nodeviews/TableContainer.js +2 -2
- package/dist/es2019/nodeviews/TableResizer.js +10 -10
- package/dist/es2019/pm-plugins/keymap.js +4 -4
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +17 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +0 -1
- package/dist/es2019/reducer.js +0 -2
- package/dist/es2019/ui/ColumnResizeWidget/index.js +0 -1
- package/dist/es2019/utils/decoration.js +0 -4
- package/dist/es2019/utils/guidelines.js +3 -2
- package/dist/es2019/utils/merged-cells.js +0 -1
- package/dist/es2019/utils/snapping.js +12 -1
- package/dist/esm/commands-with-analytics.js +64 -37
- package/dist/esm/nodeviews/TableCell.js +1 -1
- package/dist/esm/nodeviews/TableComponent.js +1 -1
- package/dist/esm/nodeviews/TableContainer.js +2 -2
- package/dist/esm/nodeviews/TableResizer.js +10 -10
- package/dist/esm/nodeviews/TableRow.js +1 -1
- package/dist/esm/nodeviews/table.js +1 -1
- package/dist/esm/pm-plugins/keymap.js +4 -4
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +17 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +0 -1
- package/dist/esm/reducer.js +0 -2
- package/dist/esm/ui/ColumnResizeWidget/index.js +0 -1
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
- package/dist/esm/ui/FloatingDeleteButton/index.js +1 -1
- package/dist/esm/ui/FloatingInsertButton/index.js +1 -1
- package/dist/esm/ui/LayoutButton/index.js +1 -1
- package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -1
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +1 -1
- package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +1 -1
- package/dist/esm/ui/TableFloatingControls/index.js +1 -1
- package/dist/esm/utils/decoration.js +0 -4
- package/dist/esm/utils/guidelines.js +5 -2
- package/dist/esm/utils/merged-cells.js +0 -1
- package/dist/esm/utils/snapping.js +14 -1
- package/dist/types/commands-with-analytics.d.ts +1 -0
- package/dist/types/ui/ColumnResizeWidget/index.d.ts +2 -2
- package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +2 -2
- package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +2 -2
- package/dist/types/ui/TableFloatingColumnControls/index.d.ts +2 -2
- package/dist/types/utils/drag-menu.d.ts +1 -1
- package/dist/types/utils/guidelines.d.ts +1 -0
- package/dist/types/utils/snapping.d.ts +2 -0
- package/dist/types-ts4.5/commands-with-analytics.d.ts +1 -0
- package/dist/types-ts4.5/ui/ColumnResizeWidget/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +2 -2
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +2 -2
- package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
- package/dist/types-ts4.5/utils/guidelines.d.ts +1 -0
- package/dist/types-ts4.5/utils/snapping.d.ts +2 -0
- package/package.json +1 -1
- package/src/commands-with-analytics.ts +39 -0
- package/src/nodeviews/TableContainer.tsx +10 -1
- package/src/nodeviews/TableResizer.tsx +39 -19
- package/src/pm-plugins/keymap.ts +13 -3
- package/src/pm-plugins/table-resizing/event-handlers.ts +20 -1
- package/src/ui/ColumnResizeWidget/index.tsx +2 -4
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +2 -2
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +2 -2
- package/src/ui/TableFloatingColumnControls/index.tsx +2 -2
- package/src/utils/drag-menu.ts +1 -1
- package/src/utils/guidelines.ts +12 -1
- package/src/utils/snapping.ts +36 -0
|
@@ -6,7 +6,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
function _isNativeReflectConstruct() {
|
|
9
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
12
|
import React, { createRef } from 'react';
|
|
@@ -6,7 +6,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
function _isNativeReflectConstruct() {
|
|
9
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
10
|
import React, { Component } from 'react';
|
|
11
11
|
import classnames from 'classnames';
|
|
12
12
|
import { injectIntl } from 'react-intl-next';
|
|
@@ -6,7 +6,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
function _isNativeReflectConstruct() {
|
|
9
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
10
|
import React, { Component } from 'react';
|
|
11
11
|
import classnames from 'classnames';
|
|
12
12
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -6,7 +6,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
function _isNativeReflectConstruct() {
|
|
9
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
10
|
import React, { Component } from 'react';
|
|
11
11
|
import { injectIntl } from 'react-intl-next';
|
|
12
12
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
@@ -9,7 +9,7 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
|
|
|
9
9
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
function _isNativeReflectConstruct() {
|
|
12
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
13
|
import React, { Component } from 'react';
|
|
14
14
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
15
15
|
import { hoverCell, hoverRows, selectRow, selectRows } from '../../commands';
|
|
@@ -431,11 +431,9 @@ export var createColumnLineResize = function createColumnLineResize(selection, c
|
|
|
431
431
|
if (isLastColumn) {
|
|
432
432
|
return true; // If is the last column no filter applied
|
|
433
433
|
}
|
|
434
|
-
|
|
435
434
|
var nextPosition = map.map[map.width * rowIndex + columnIndex - 1];
|
|
436
435
|
return cellPosition !== nextPosition; // Removed it if next position is merged
|
|
437
436
|
});
|
|
438
|
-
|
|
439
437
|
var cells = cellPositions.map(function (pos) {
|
|
440
438
|
return {
|
|
441
439
|
pos: pos + table.start,
|
|
@@ -476,11 +474,9 @@ export var createColumnInsertLine = function createColumnInsertLine(columnIndex,
|
|
|
476
474
|
if (isLastColumn) {
|
|
477
475
|
return true; // If is the last column no filter applied
|
|
478
476
|
}
|
|
479
|
-
|
|
480
477
|
var nextPosition = map.map[map.width * rowIndex + columnIndex - 1];
|
|
481
478
|
return cellPosition !== nextPosition; // Removed it if next position is merged
|
|
482
479
|
});
|
|
483
|
-
|
|
484
480
|
var cells = cellPositions.map(function (pos) {
|
|
485
481
|
return {
|
|
486
482
|
pos: pos + table.start,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { createFixedGuidelinesFromLengths } from '@atlaskit/editor-common/guideline';
|
|
3
|
-
import { calculateDefaultSnappings } from './snapping';
|
|
3
|
+
import { calculateDefaultSnappings, calculateDefaultTablePreserveSnappings } from './snapping';
|
|
4
4
|
|
|
5
5
|
// NOTE: We have to take 1 pixel off every length due to the fact that the tbody is 1px smaller then the table container.
|
|
6
6
|
// If we don't do this then the guidelines will not align correctly to the edge of the table
|
|
7
|
-
export var defaultGuidelines = createFixedGuidelinesFromLengths([0].concat(_toConsumableArray(calculateDefaultSnappings(-1))));
|
|
7
|
+
export var defaultGuidelines = createFixedGuidelinesFromLengths([0].concat(_toConsumableArray(calculateDefaultSnappings(-1))));
|
|
8
|
+
export var defaultGuidelinesForPreserveTable = function defaultGuidelinesForPreserveTable(editorContainerWidth) {
|
|
9
|
+
return createFixedGuidelinesFromLengths([0].concat(_toConsumableArray(calculateDefaultTablePreserveSnappings(-1, editorContainerWidth))));
|
|
10
|
+
};
|
|
@@ -118,7 +118,6 @@ export var hasMergedCellsInBetween = function hasMergedCellsInBetween(indexes, t
|
|
|
118
118
|
return !cells.includes(nodePos) // cell exists in Rect but not show in the map.cellsInRect list => merged cell
|
|
119
119
|
? true : mergedCells.has(nodePos); // cell includes in mergedCells => merged cell
|
|
120
120
|
});
|
|
121
|
-
|
|
122
121
|
return _toConsumableArray(new Set(mergedCell));
|
|
123
122
|
};
|
|
124
123
|
var mergedCellsInRectArr = indexes.map(function (index) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { isVerticalPosition } from '@atlaskit/editor-common/guideline';
|
|
3
|
-
import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
3
|
+
import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorMediaResizeHandlerPaddingWide } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
var numberOfLanesInDefaultLayoutWidth = 12;
|
|
5
5
|
var calculateSubSnappingWidths = function calculateSubSnappingWidths(totalLanes, totalWidth) {
|
|
6
6
|
return new Array(Math.round(totalLanes / 2) - 1).fill(totalWidth / totalLanes).map(function (v, i) {
|
|
@@ -11,8 +11,21 @@ export var calculateDefaultSnappings = function calculateDefaultSnappings() {
|
|
|
11
11
|
var lengthOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
12
12
|
return [].concat(_toConsumableArray(calculateSubSnappingWidths(numberOfLanesInDefaultLayoutWidth, akEditorDefaultLayoutWidth + lengthOffset)), [akEditorDefaultLayoutWidth + lengthOffset, akEditorCalculatedWideLayoutWidth + lengthOffset, akEditorFullWidthLayoutWidth + lengthOffset]);
|
|
13
13
|
};
|
|
14
|
+
|
|
15
|
+
// FF TablePreserve for calculateDefaultSnappings
|
|
16
|
+
export var calculateDefaultTablePreserveSnappings = function calculateDefaultTablePreserveSnappings() {
|
|
17
|
+
var lengthOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
18
|
+
var editorContainerWith = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : akEditorFullWidthLayoutWidth;
|
|
19
|
+
var dynamicFullWidthLine = editorContainerWith - akEditorGutterPadding * 2 >= akEditorFullWidthLayoutWidth ? akEditorFullWidthLayoutWidth : editorContainerWith - akEditorGutterPadding * 2 - akEditorMediaResizeHandlerPaddingWide;
|
|
20
|
+
return [].concat(_toConsumableArray(calculateSubSnappingWidths(numberOfLanesInDefaultLayoutWidth, akEditorDefaultLayoutWidth + lengthOffset)), [akEditorDefaultLayoutWidth + lengthOffset, akEditorCalculatedWideLayoutWidth + lengthOffset, dynamicFullWidthLine - lengthOffset]);
|
|
21
|
+
};
|
|
14
22
|
export var defaultSnappingWidths = calculateDefaultSnappings();
|
|
15
23
|
|
|
24
|
+
// FF TablePreserve for defaultSnappingWidths
|
|
25
|
+
export var defaultTablePreserveSnappingWidths = function defaultTablePreserveSnappingWidths(editorContainerWidth) {
|
|
26
|
+
return editorContainerWidth - akEditorGutterPadding * 2 > akEditorFullWidthLayoutWidth ? calculateDefaultSnappings() : calculateDefaultTablePreserveSnappings(0, editorContainerWidth);
|
|
27
|
+
};
|
|
28
|
+
|
|
16
29
|
/**
|
|
17
30
|
* Returns keys of guidelines that are closest to the table and withthin the snapGap
|
|
18
31
|
*/
|
|
@@ -11,6 +11,7 @@ export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalytic
|
|
|
11
11
|
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) => Command;
|
|
12
12
|
export declare const addRowAroundSelection: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (side: RowInsertPosition) => Command;
|
|
13
13
|
export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
|
|
14
|
+
export declare const changeColumnWidthByStepWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth, tablePreserveWidth: boolean, inputMethod: INPUT_METHOD.SHORTCUT) => Command;
|
|
14
15
|
export declare const insertColumnWithAnalytics: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, tablePreserveWidth?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
|
|
15
16
|
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;
|
|
16
17
|
export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, tablePreserveWidth?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect) => Command;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
3
|
type Props = {
|
|
4
4
|
startIndex: number;
|
|
5
5
|
endIndex: number;
|
|
6
6
|
includeTooltip?: boolean;
|
|
7
7
|
};
|
|
8
|
-
export declare const ColumnResizeWidget:
|
|
8
|
+
export declare const ColumnResizeWidget: ({ startIndex, endIndex, includeTooltip, }: Props) => jsx.JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
export interface Props {
|
|
3
3
|
index: number;
|
|
4
4
|
localId?: string;
|
|
@@ -6,4 +6,4 @@ export interface Props {
|
|
|
6
6
|
height?: number;
|
|
7
7
|
marginTop?: number;
|
|
8
8
|
}
|
|
9
|
-
export declare const ColumnDropTarget:
|
|
9
|
+
export declare const ColumnDropTarget: ({ index, localId, width, height, marginTop, }: Props) => JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
export interface Props {
|
|
3
3
|
tableRef: HTMLTableElement;
|
|
4
4
|
tableHeight?: number;
|
|
@@ -7,4 +7,4 @@ export interface Props {
|
|
|
7
7
|
isHeaderSticky?: boolean;
|
|
8
8
|
getScrollOffset?: () => number;
|
|
9
9
|
}
|
|
10
|
-
export declare const ColumnDropTargets:
|
|
10
|
+
export declare const ColumnDropTargets: ({ tableRef, tableHeight, localId, colWidths, isHeaderSticky, getScrollOffset, }: Props) => JSX.Element | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import type { TableColumnOrdering } from '@atlaskit/custom-steps';
|
|
3
3
|
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -26,5 +26,5 @@ export interface Props {
|
|
|
26
26
|
isNumberColumnEnabled?: boolean;
|
|
27
27
|
getScrollOffset?: () => number;
|
|
28
28
|
}
|
|
29
|
-
export declare const TableFloatingColumnControls:
|
|
29
|
+
export declare const TableFloatingColumnControls: ({ editorView, tableRef, getNode, tableActive, hasHeaderRow, hoveredCell, isResizing, stickyHeader, selection, isInDanger, isTableHovered, tableContainerWidth, isNumberColumnEnabled, getScrollOffset, }: Props) => JSX.Element | null;
|
|
30
30
|
export default TableFloatingColumnControls;
|
|
@@ -10,7 +10,7 @@ export declare const canMove: (sourceType: DraggableType, direction: DraggableDa
|
|
|
10
10
|
export type DragMenuOptionIdType = 'add_row_above' | 'add_row_below' | 'add_column_left' | 'add_column_right' | 'distribute_columns' | 'clear_cells' | 'delete_row' | 'delete_column' | 'move_column_left' | 'move_column_right' | 'move_row_up' | 'move_row_down' | 'sort_column_asc' | 'sort_column_desc';
|
|
11
11
|
export interface DragMenuConfig extends DropdownOptionT<Command> {
|
|
12
12
|
id: DragMenuOptionIdType;
|
|
13
|
-
icon?: React.ComponentType<IconProps
|
|
13
|
+
icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
|
|
14
14
|
keymap?: string;
|
|
15
15
|
}
|
|
16
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, tablePreserveWidth?: boolean) => DragMenuConfig[];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { GuidelineConfig } from '@atlaskit/editor-common/guideline';
|
|
2
2
|
export declare const calculateDefaultSnappings: (lengthOffset?: number) => number[];
|
|
3
|
+
export declare const calculateDefaultTablePreserveSnappings: (lengthOffset?: number, editorContainerWith?: number) => number[];
|
|
3
4
|
export declare const defaultSnappingWidths: number[];
|
|
5
|
+
export declare const defaultTablePreserveSnappingWidths: (editorContainerWidth: number) => number[];
|
|
4
6
|
/**
|
|
5
7
|
* Returns keys of guidelines that are closest to the table and withthin the snapGap
|
|
6
8
|
*/
|
|
@@ -11,6 +11,7 @@ export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalytic
|
|
|
11
11
|
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) => Command;
|
|
12
12
|
export declare const addRowAroundSelection: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (side: RowInsertPosition) => Command;
|
|
13
13
|
export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
|
|
14
|
+
export declare const changeColumnWidthByStepWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth, tablePreserveWidth: boolean, inputMethod: INPUT_METHOD.SHORTCUT) => Command;
|
|
14
15
|
export declare const insertColumnWithAnalytics: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, tablePreserveWidth?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
|
|
15
16
|
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;
|
|
16
17
|
export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, tablePreserveWidth?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect) => Command;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
3
|
type Props = {
|
|
4
4
|
startIndex: number;
|
|
5
5
|
endIndex: number;
|
|
6
6
|
includeTooltip?: boolean;
|
|
7
7
|
};
|
|
8
|
-
export declare const ColumnResizeWidget:
|
|
8
|
+
export declare const ColumnResizeWidget: ({ startIndex, endIndex, includeTooltip, }: Props) => jsx.JSX.Element;
|
|
9
9
|
export {};
|
package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
export interface Props {
|
|
3
3
|
index: number;
|
|
4
4
|
localId?: string;
|
|
@@ -6,4 +6,4 @@ export interface Props {
|
|
|
6
6
|
height?: number;
|
|
7
7
|
marginTop?: number;
|
|
8
8
|
}
|
|
9
|
-
export declare const ColumnDropTarget:
|
|
9
|
+
export declare const ColumnDropTarget: ({ index, localId, width, height, marginTop, }: Props) => JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
export interface Props {
|
|
3
3
|
tableRef: HTMLTableElement;
|
|
4
4
|
tableHeight?: number;
|
|
@@ -7,4 +7,4 @@ export interface Props {
|
|
|
7
7
|
isHeaderSticky?: boolean;
|
|
8
8
|
getScrollOffset?: () => number;
|
|
9
9
|
}
|
|
10
|
-
export declare const ColumnDropTargets:
|
|
10
|
+
export declare const ColumnDropTargets: ({ tableRef, tableHeight, localId, colWidths, isHeaderSticky, getScrollOffset, }: Props) => JSX.Element | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import type { TableColumnOrdering } from '@atlaskit/custom-steps';
|
|
3
3
|
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -26,5 +26,5 @@ export interface Props {
|
|
|
26
26
|
isNumberColumnEnabled?: boolean;
|
|
27
27
|
getScrollOffset?: () => number;
|
|
28
28
|
}
|
|
29
|
-
export declare const TableFloatingColumnControls:
|
|
29
|
+
export declare const TableFloatingColumnControls: ({ editorView, tableRef, getNode, tableActive, hasHeaderRow, hoveredCell, isResizing, stickyHeader, selection, isInDanger, isTableHovered, tableContainerWidth, isNumberColumnEnabled, getScrollOffset, }: Props) => JSX.Element | null;
|
|
30
30
|
export default TableFloatingColumnControls;
|
|
@@ -10,7 +10,7 @@ export declare const canMove: (sourceType: DraggableType, direction: DraggableDa
|
|
|
10
10
|
export type DragMenuOptionIdType = 'add_row_above' | 'add_row_below' | 'add_column_left' | 'add_column_right' | 'distribute_columns' | 'clear_cells' | 'delete_row' | 'delete_column' | 'move_column_left' | 'move_column_right' | 'move_row_up' | 'move_row_down' | 'sort_column_asc' | 'sort_column_desc';
|
|
11
11
|
export interface DragMenuConfig extends DropdownOptionT<Command> {
|
|
12
12
|
id: DragMenuOptionIdType;
|
|
13
|
-
icon?: React.ComponentType<IconProps
|
|
13
|
+
icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
|
|
14
14
|
keymap?: string;
|
|
15
15
|
}
|
|
16
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, tablePreserveWidth?: boolean) => DragMenuConfig[];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { GuidelineConfig } from '@atlaskit/editor-common/guideline';
|
|
2
2
|
export declare const calculateDefaultSnappings: (lengthOffset?: number) => number[];
|
|
3
|
+
export declare const calculateDefaultTablePreserveSnappings: (lengthOffset?: number, editorContainerWith?: number) => number[];
|
|
3
4
|
export declare const defaultSnappingWidths: number[];
|
|
5
|
+
export declare const defaultTablePreserveSnappingWidths: (editorContainerWidth: number) => number[];
|
|
4
6
|
/**
|
|
5
7
|
* Returns keys of guidelines that are closest to the table and withthin the snapGap
|
|
6
8
|
*/
|
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
|
|
28
28
|
import { clearMultipleCells } from './commands/clear';
|
|
29
29
|
import { wrapTableInExpand } from './commands/collapse';
|
|
30
|
+
import { changeColumnWidthByStep } from './commands/column-resize';
|
|
30
31
|
import { deleteColumnsCommand } from './commands/delete';
|
|
31
32
|
import { insertColumn, insertRow } from './commands/insert';
|
|
32
33
|
import {
|
|
@@ -251,6 +252,44 @@ export const insertRowWithAnalytics =
|
|
|
251
252
|
insertRow(options.index, options.moveCursorToInsertedRow),
|
|
252
253
|
);
|
|
253
254
|
|
|
255
|
+
export const changeColumnWidthByStepWithAnalytics =
|
|
256
|
+
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
257
|
+
(
|
|
258
|
+
stepSize: number,
|
|
259
|
+
getEditorContainerWidth: GetEditorContainerWidth,
|
|
260
|
+
tablePreserveWidth: boolean,
|
|
261
|
+
inputMethod: INPUT_METHOD.SHORTCUT,
|
|
262
|
+
) =>
|
|
263
|
+
withEditorAnalyticsAPI((state) => {
|
|
264
|
+
const { table, totalRowCount, totalColumnCount } = getSelectedTableInfo(
|
|
265
|
+
state.selection,
|
|
266
|
+
);
|
|
267
|
+
const {
|
|
268
|
+
hoveredCell: { colIndex },
|
|
269
|
+
} = getPluginState(state);
|
|
270
|
+
|
|
271
|
+
return {
|
|
272
|
+
action: TABLE_ACTION.COLUMN_RESIZED,
|
|
273
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
274
|
+
eventType: EVENT_TYPE.TRACK,
|
|
275
|
+
attributes: {
|
|
276
|
+
colIndex,
|
|
277
|
+
resizedDelta: stepSize,
|
|
278
|
+
isLastColumn: colIndex === totalColumnCount - 1,
|
|
279
|
+
tableWidth: table?.node.attrs.width,
|
|
280
|
+
inputMethod,
|
|
281
|
+
totalRowCount,
|
|
282
|
+
totalColumnCount,
|
|
283
|
+
},
|
|
284
|
+
};
|
|
285
|
+
})(editorAnalyticsAPI)(
|
|
286
|
+
changeColumnWidthByStep(
|
|
287
|
+
stepSize,
|
|
288
|
+
getEditorContainerWidth,
|
|
289
|
+
tablePreserveWidth,
|
|
290
|
+
),
|
|
291
|
+
);
|
|
292
|
+
|
|
254
293
|
export const insertColumnWithAnalytics =
|
|
255
294
|
(
|
|
256
295
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
@@ -12,6 +12,8 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
12
12
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
13
13
|
import {
|
|
14
14
|
akEditorDefaultLayoutWidth,
|
|
15
|
+
akEditorGutterPadding,
|
|
16
|
+
akEditorMediaResizeHandlerPaddingWide,
|
|
15
17
|
akEditorMobileBreakoutPoint,
|
|
16
18
|
} from '@atlaskit/editor-shared-styles';
|
|
17
19
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -189,7 +191,14 @@ export const ResizableTableContainer = React.memo(
|
|
|
189
191
|
|
|
190
192
|
const tableWidth = getTableContainerWidth(node);
|
|
191
193
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
192
|
-
const responsiveContainerWidth =
|
|
194
|
+
const responsiveContainerWidth = tablePreserveWidth
|
|
195
|
+
? containerWidth -
|
|
196
|
+
akEditorGutterPadding * 2 -
|
|
197
|
+
akEditorMediaResizeHandlerPaddingWide / 2
|
|
198
|
+
: containerWidth -
|
|
199
|
+
akEditorGutterPadding * 2 -
|
|
200
|
+
akEditorMediaResizeHandlerPaddingWide;
|
|
201
|
+
|
|
193
202
|
const width = Math.min(tableWidth, responsiveContainerWidth);
|
|
194
203
|
|
|
195
204
|
if (!isResizing) {
|
|
@@ -51,8 +51,15 @@ import {
|
|
|
51
51
|
generateResizeFrameRatePayloads,
|
|
52
52
|
useMeasureFramerate,
|
|
53
53
|
} from '../utils/analytics';
|
|
54
|
-
import {
|
|
55
|
-
|
|
54
|
+
import {
|
|
55
|
+
defaultGuidelines,
|
|
56
|
+
defaultGuidelinesForPreserveTable,
|
|
57
|
+
} from '../utils/guidelines';
|
|
58
|
+
import {
|
|
59
|
+
defaultSnappingWidths,
|
|
60
|
+
defaultTablePreserveSnappingWidths,
|
|
61
|
+
findClosestSnap,
|
|
62
|
+
} from '../utils/snapping';
|
|
56
63
|
|
|
57
64
|
interface TableResizerProps {
|
|
58
65
|
width: number;
|
|
@@ -211,9 +218,12 @@ export const TableResizer = ({
|
|
|
211
218
|
if (gap !== currentGap.current) {
|
|
212
219
|
currentGap.current = gap;
|
|
213
220
|
const visibleGuidelines = getVisibleGuidelines(
|
|
214
|
-
|
|
221
|
+
tablePreserveWidth
|
|
222
|
+
? defaultGuidelinesForPreserveTable(containerWidth)
|
|
223
|
+
: defaultGuidelines,
|
|
215
224
|
containerWidth,
|
|
216
225
|
);
|
|
226
|
+
|
|
217
227
|
displayGuideline(
|
|
218
228
|
getGuidelinesWithHighlights(
|
|
219
229
|
gap,
|
|
@@ -224,17 +234,19 @@ export const TableResizer = ({
|
|
|
224
234
|
);
|
|
225
235
|
}
|
|
226
236
|
},
|
|
227
|
-
[
|
|
237
|
+
[tablePreserveWidth, containerWidth, displayGuideline],
|
|
228
238
|
);
|
|
229
239
|
|
|
230
240
|
const guidelineSnaps = useMemo(
|
|
231
241
|
() =>
|
|
232
242
|
snappingEnabled
|
|
233
243
|
? {
|
|
234
|
-
x:
|
|
244
|
+
x: tablePreserveWidth
|
|
245
|
+
? defaultTablePreserveSnappingWidths(containerWidth)
|
|
246
|
+
: defaultSnappingWidths,
|
|
235
247
|
}
|
|
236
248
|
: undefined,
|
|
237
|
-
[snappingEnabled],
|
|
249
|
+
[snappingEnabled, tablePreserveWidth, containerWidth],
|
|
238
250
|
);
|
|
239
251
|
|
|
240
252
|
useEffect(() => {
|
|
@@ -270,9 +282,12 @@ export const TableResizer = ({
|
|
|
270
282
|
dispatch(tr);
|
|
271
283
|
|
|
272
284
|
const visibleGuidelines = getVisibleGuidelines(
|
|
273
|
-
|
|
285
|
+
tablePreserveWidth
|
|
286
|
+
? defaultGuidelinesForPreserveTable(containerWidth)
|
|
287
|
+
: defaultGuidelines,
|
|
274
288
|
containerWidth,
|
|
275
289
|
);
|
|
290
|
+
|
|
276
291
|
setSnappingEnabled(displayGuideline(visibleGuidelines));
|
|
277
292
|
if (
|
|
278
293
|
getBooleanFF('platform.editor.resizing-table-height-improvement') &&
|
|
@@ -281,12 +296,13 @@ export const TableResizer = ({
|
|
|
281
296
|
onResizeStart();
|
|
282
297
|
}
|
|
283
298
|
}, [
|
|
299
|
+
startMeasure,
|
|
300
|
+
editorView,
|
|
284
301
|
displayGapCursor,
|
|
302
|
+
tablePreserveWidth,
|
|
303
|
+
containerWidth,
|
|
285
304
|
displayGuideline,
|
|
286
|
-
editorView,
|
|
287
|
-
startMeasure,
|
|
288
305
|
onResizeStart,
|
|
289
|
-
containerWidth,
|
|
290
306
|
]);
|
|
291
307
|
|
|
292
308
|
const handleResize = useCallback(
|
|
@@ -318,26 +334,30 @@ export const TableResizer = ({
|
|
|
318
334
|
updateActiveGuidelines(
|
|
319
335
|
findClosestSnap(
|
|
320
336
|
newWidth,
|
|
321
|
-
|
|
322
|
-
|
|
337
|
+
tablePreserveWidth
|
|
338
|
+
? defaultTablePreserveSnappingWidths(containerWidth)
|
|
339
|
+
: defaultSnappingWidths,
|
|
340
|
+
tablePreserveWidth
|
|
341
|
+
? defaultGuidelinesForPreserveTable(containerWidth)
|
|
342
|
+
: defaultGuidelines,
|
|
323
343
|
TABLE_HIGHLIGHT_GAP,
|
|
324
344
|
TABLE_HIGHLIGHT_TOLERANCE,
|
|
325
345
|
),
|
|
326
346
|
);
|
|
327
|
-
|
|
328
347
|
updateWidth(newWidth);
|
|
329
348
|
|
|
330
349
|
return newWidth;
|
|
331
350
|
},
|
|
332
351
|
[
|
|
333
|
-
editorView,
|
|
334
|
-
getPos,
|
|
335
|
-
node,
|
|
336
|
-
tableRef,
|
|
337
|
-
updateWidth,
|
|
338
|
-
updateActiveGuidelines,
|
|
339
352
|
countFrames,
|
|
340
353
|
tablePreserveWidth,
|
|
354
|
+
tableRef,
|
|
355
|
+
node,
|
|
356
|
+
editorView,
|
|
357
|
+
updateActiveGuidelines,
|
|
358
|
+
containerWidth,
|
|
359
|
+
updateWidth,
|
|
360
|
+
getPos,
|
|
341
361
|
],
|
|
342
362
|
);
|
|
343
363
|
|
package/src/pm-plugins/keymap.ts
CHANGED
|
@@ -41,13 +41,13 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
41
41
|
import { createTable, goToNextCell, moveCursorBackward } from '../commands';
|
|
42
42
|
import {
|
|
43
43
|
addRowAroundSelection,
|
|
44
|
+
changeColumnWidthByStepWithAnalytics,
|
|
44
45
|
deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut,
|
|
45
46
|
deleteTableIfSelectedWithAnalytics,
|
|
46
47
|
emptyMultipleCellsWithAnalytics,
|
|
47
48
|
} from '../commands-with-analytics';
|
|
48
49
|
import {
|
|
49
50
|
activateNextResizeArea,
|
|
50
|
-
changeColumnWidthByStep,
|
|
51
51
|
initiateKeyboardColumnResizing,
|
|
52
52
|
stopKeyboardColumnResizing,
|
|
53
53
|
} from '../commands/column-resize';
|
|
@@ -198,13 +198,23 @@ export function keymapPlugin(
|
|
|
198
198
|
|
|
199
199
|
bindKeymapWithCommand(
|
|
200
200
|
decreaseMediaSize.common!,
|
|
201
|
-
|
|
201
|
+
changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(
|
|
202
|
+
-10,
|
|
203
|
+
getEditorContainerWidth,
|
|
204
|
+
tablePreserveWidth,
|
|
205
|
+
INPUT_METHOD.SHORTCUT,
|
|
206
|
+
),
|
|
202
207
|
list,
|
|
203
208
|
);
|
|
204
209
|
|
|
205
210
|
bindKeymapWithCommand(
|
|
206
211
|
increaseMediaSize.common!,
|
|
207
|
-
|
|
212
|
+
changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(
|
|
213
|
+
10,
|
|
214
|
+
getEditorContainerWidth,
|
|
215
|
+
tablePreserveWidth,
|
|
216
|
+
INPUT_METHOD.SHORTCUT,
|
|
217
|
+
),
|
|
208
218
|
list,
|
|
209
219
|
);
|
|
210
220
|
bindKeymapWithCommand(escape.common!, stopKeyboardColumnResizing(), list);
|
|
@@ -2,6 +2,7 @@ import type { CellAttributes, TableLayout } from '@atlaskit/adf-schema';
|
|
|
2
2
|
import {
|
|
3
3
|
ACTION_SUBJECT,
|
|
4
4
|
EVENT_TYPE,
|
|
5
|
+
INPUT_METHOD,
|
|
5
6
|
TABLE_ACTION,
|
|
6
7
|
TABLE_OVERFLOW_CHANGE_TRIGGER,
|
|
7
8
|
} from '@atlaskit/editor-common/analytics';
|
|
@@ -211,6 +212,9 @@ export const handleMouseDown = (
|
|
|
211
212
|
resizingSelectedColumns ? selectedColumns : undefined,
|
|
212
213
|
tablePreserveWidth,
|
|
213
214
|
);
|
|
215
|
+
|
|
216
|
+
const resizedDelta = clientX - startX;
|
|
217
|
+
|
|
214
218
|
tr = updateColumnWidths(newResizeState, table, start)(tr);
|
|
215
219
|
if (colIndex === map.width - 1) {
|
|
216
220
|
const mouseUpTime = event.timeStamp;
|
|
@@ -223,11 +227,26 @@ export const handleMouseDown = (
|
|
|
223
227
|
type: 'table-border',
|
|
224
228
|
position: 'right',
|
|
225
229
|
duration: mouseUpTime - mouseDownTime,
|
|
226
|
-
delta: Math.abs(
|
|
230
|
+
delta: Math.abs(resizedDelta),
|
|
227
231
|
},
|
|
228
232
|
eventType: EVENT_TYPE.UI,
|
|
229
233
|
})(tr);
|
|
230
234
|
}
|
|
235
|
+
|
|
236
|
+
editorAnalyticsAPI?.attachAnalyticsEvent({
|
|
237
|
+
action: TABLE_ACTION.COLUMN_RESIZED,
|
|
238
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
239
|
+
eventType: EVENT_TYPE.TRACK,
|
|
240
|
+
attributes: {
|
|
241
|
+
colIndex: colIndex,
|
|
242
|
+
resizedDelta,
|
|
243
|
+
isLastColumn: colIndex === map.width - 1,
|
|
244
|
+
tableWidth: table.attrs.width,
|
|
245
|
+
inputMethod: INPUT_METHOD.MOUSE,
|
|
246
|
+
totalRowCount: map.height,
|
|
247
|
+
totalColumnCount: map.width,
|
|
248
|
+
},
|
|
249
|
+
})(tr);
|
|
231
250
|
}
|
|
232
251
|
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
233
252
|
if (isKeyboardResize || !isTableHovered) {
|