@atlaskit/editor-plugin-table 9.1.3 → 9.2.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 +23 -0
- package/dist/cjs/nodeviews/TableCell.js +0 -2
- package/dist/cjs/nodeviews/TableComponent.js +5 -5
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +6 -4
- package/dist/cjs/nodeviews/TableContainer.js +13 -2
- package/dist/cjs/nodeviews/TableNodeViewBase.js +0 -2
- package/dist/cjs/nodeviews/TableResizer.js +5 -10
- package/dist/cjs/nodeviews/TableRow.js +0 -2
- package/dist/cjs/nodeviews/lazy-node-views.js +4 -16
- package/dist/cjs/nodeviews/table.js +3 -10
- package/dist/cjs/pm-plugins/commands/column-resize.js +1 -4
- package/dist/cjs/pm-plugins/commands/commands-with-analytics.js +4 -16
- package/dist/cjs/pm-plugins/commands/insert.js +4 -19
- package/dist/cjs/pm-plugins/commands/misc.js +3 -12
- package/dist/cjs/pm-plugins/decorations/plugin.js +1 -6
- package/dist/cjs/pm-plugins/decorations/utils/column-resizing.js +1 -4
- package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -12
- package/dist/cjs/pm-plugins/drag-and-drop/commands.js +3 -12
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +1 -4
- package/dist/cjs/pm-plugins/keymap.js +0 -2
- package/dist/cjs/pm-plugins/main.js +1 -6
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +1 -4
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +0 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +1 -7
- package/dist/cjs/pm-plugins/table-resizing/utils/column-state.js +1 -4
- package/dist/cjs/pm-plugins/table-resizing/utils/content-width.js +0 -8
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-logic.js +2 -10
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +1 -4
- package/dist/cjs/pm-plugins/table-width.js +1 -6
- package/dist/cjs/pm-plugins/transforms/column-width.js +1 -4
- package/dist/cjs/pm-plugins/transforms/fix-tables.js +3 -15
- package/dist/cjs/pm-plugins/transforms/replace-table.js +1 -4
- package/dist/cjs/pm-plugins/transforms/split.js +0 -2
- package/dist/cjs/pm-plugins/utils/alignment.js +1 -4
- package/dist/cjs/pm-plugins/utils/decoration.js +4 -16
- package/dist/cjs/pm-plugins/utils/drag-menu.js +1 -4
- package/dist/cjs/pm-plugins/utils/nodes.js +0 -3
- package/dist/cjs/pm-plugins/utils/paste.js +4 -0
- package/dist/cjs/pm-plugins/utils/row-controls.js +1 -4
- package/dist/cjs/tablePlugin.js +1 -0
- package/dist/cjs/ui/DragHandle/index.js +55 -6
- package/dist/cjs/ui/FloatingInsertButton/getPopupOptions.js +0 -6
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +18 -6
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +1 -2
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +61 -11
- package/dist/cjs/ui/TableFloatingControls/index.js +25 -8
- package/dist/cjs/ui/toolbar.js +3 -12
- package/dist/es2019/nodeviews/TableCell.js +0 -2
- package/dist/es2019/nodeviews/TableComponent.js +5 -5
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +6 -4
- package/dist/es2019/nodeviews/TableContainer.js +13 -2
- package/dist/es2019/nodeviews/TableNodeViewBase.js +0 -2
- package/dist/es2019/nodeviews/TableResizer.js +5 -10
- package/dist/es2019/nodeviews/TableRow.js +0 -2
- package/dist/es2019/nodeviews/lazy-node-views.js +4 -16
- package/dist/es2019/nodeviews/table.js +3 -10
- package/dist/es2019/pm-plugins/commands/column-resize.js +1 -4
- package/dist/es2019/pm-plugins/commands/commands-with-analytics.js +6 -24
- package/dist/es2019/pm-plugins/commands/delete.js +1 -4
- package/dist/es2019/pm-plugins/commands/insert.js +5 -23
- package/dist/es2019/pm-plugins/commands/misc.js +3 -12
- package/dist/es2019/pm-plugins/decorations/plugin.js +1 -6
- package/dist/es2019/pm-plugins/decorations/utils/column-resizing.js +1 -4
- package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -12
- package/dist/es2019/pm-plugins/drag-and-drop/commands.js +4 -16
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +2 -8
- package/dist/es2019/pm-plugins/keymap.js +0 -3
- package/dist/es2019/pm-plugins/main.js +1 -6
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +1 -4
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +0 -3
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +2 -11
- package/dist/es2019/pm-plugins/table-resizing/utils/column-state.js +1 -4
- package/dist/es2019/pm-plugins/table-resizing/utils/content-width.js +0 -8
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +1 -4
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-logic.js +2 -10
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +2 -8
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +4 -16
- package/dist/es2019/pm-plugins/table-width.js +1 -6
- package/dist/es2019/pm-plugins/transforms/column-width.js +2 -8
- package/dist/es2019/pm-plugins/transforms/delete-columns.js +1 -4
- package/dist/es2019/pm-plugins/transforms/fix-tables.js +3 -15
- package/dist/es2019/pm-plugins/transforms/replace-table.js +1 -4
- package/dist/es2019/pm-plugins/transforms/split.js +0 -2
- package/dist/es2019/pm-plugins/utils/alignment.js +1 -4
- package/dist/es2019/pm-plugins/utils/decoration.js +4 -16
- package/dist/es2019/pm-plugins/utils/drag-menu.js +2 -8
- package/dist/es2019/pm-plugins/utils/nodes.js +0 -3
- package/dist/es2019/pm-plugins/utils/paste.js +5 -4
- package/dist/es2019/pm-plugins/utils/row-controls.js +1 -4
- package/dist/es2019/pm-plugins/utils/snapping.js +1 -4
- package/dist/es2019/tablePlugin.js +1 -0
- package/dist/es2019/ui/DragHandle/index.js +57 -6
- package/dist/es2019/ui/FloatingInsertButton/getPopupOptions.js +0 -6
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +19 -7
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +1 -2
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +63 -11
- package/dist/es2019/ui/TableFloatingControls/index.js +26 -10
- package/dist/es2019/ui/event-handlers.js +1 -4
- package/dist/es2019/ui/toolbar.js +9 -36
- package/dist/esm/nodeviews/TableCell.js +0 -2
- package/dist/esm/nodeviews/TableComponent.js +5 -5
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +6 -4
- package/dist/esm/nodeviews/TableContainer.js +13 -2
- package/dist/esm/nodeviews/TableNodeViewBase.js +0 -2
- package/dist/esm/nodeviews/TableResizer.js +5 -10
- package/dist/esm/nodeviews/TableRow.js +0 -2
- package/dist/esm/nodeviews/lazy-node-views.js +4 -16
- package/dist/esm/nodeviews/table.js +3 -10
- package/dist/esm/pm-plugins/commands/column-resize.js +1 -4
- package/dist/esm/pm-plugins/commands/commands-with-analytics.js +4 -16
- package/dist/esm/pm-plugins/commands/insert.js +4 -19
- package/dist/esm/pm-plugins/commands/misc.js +3 -12
- package/dist/esm/pm-plugins/decorations/plugin.js +1 -6
- package/dist/esm/pm-plugins/decorations/utils/column-resizing.js +1 -4
- package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -12
- package/dist/esm/pm-plugins/drag-and-drop/commands.js +3 -12
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +1 -4
- package/dist/esm/pm-plugins/keymap.js +0 -3
- package/dist/esm/pm-plugins/main.js +1 -6
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +1 -4
- package/dist/esm/pm-plugins/table-resizing/plugin.js +0 -3
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +1 -7
- package/dist/esm/pm-plugins/table-resizing/utils/column-state.js +1 -4
- package/dist/esm/pm-plugins/table-resizing/utils/content-width.js +0 -8
- package/dist/esm/pm-plugins/table-resizing/utils/resize-logic.js +2 -10
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +1 -4
- package/dist/esm/pm-plugins/table-width.js +1 -6
- package/dist/esm/pm-plugins/transforms/column-width.js +1 -4
- package/dist/esm/pm-plugins/transforms/fix-tables.js +3 -15
- package/dist/esm/pm-plugins/transforms/replace-table.js +1 -4
- package/dist/esm/pm-plugins/transforms/split.js +0 -2
- package/dist/esm/pm-plugins/utils/alignment.js +1 -4
- package/dist/esm/pm-plugins/utils/decoration.js +4 -16
- package/dist/esm/pm-plugins/utils/drag-menu.js +1 -4
- package/dist/esm/pm-plugins/utils/nodes.js +0 -3
- package/dist/esm/pm-plugins/utils/paste.js +4 -0
- package/dist/esm/pm-plugins/utils/row-controls.js +1 -4
- package/dist/esm/tablePlugin.js +1 -0
- package/dist/esm/ui/DragHandle/index.js +54 -5
- package/dist/esm/ui/FloatingInsertButton/getPopupOptions.js +0 -6
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +19 -7
- package/dist/esm/ui/TableFloatingColumnControls/index.js +1 -2
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +61 -11
- package/dist/esm/ui/TableFloatingControls/index.js +26 -9
- package/dist/esm/ui/toolbar.js +3 -12
- package/dist/types/nodeviews/TableComponent.d.ts +3 -1
- package/dist/types/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/ui/DragHandle/index.d.ts +21 -0
- package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -1
- package/dist/types/ui/TableFloatingControls/RowControls/DragControls.d.ts +8 -5
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +3 -1
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/types/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/DragHandle/index.d.ts +21 -0
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableFloatingControls/RowControls/DragControls.d.ts +8 -5
- package/package.json +15 -6
- package/src/nodeviews/TableCell.ts +0 -2
- package/src/nodeviews/TableComponent.tsx +8 -6
- package/src/nodeviews/TableComponentWithSharedState.tsx +4 -2
- package/src/nodeviews/TableContainer.tsx +12 -1
- package/src/nodeviews/TableNodeViewBase.ts +0 -2
- package/src/nodeviews/TableResizer.tsx +9 -5
- package/src/nodeviews/TableRow.ts +0 -2
- package/src/nodeviews/lazy-node-views.ts +0 -8
- package/src/nodeviews/table.tsx +1 -6
- package/src/pm-plugins/commands/column-resize.ts +0 -2
- package/src/pm-plugins/commands/commands-with-analytics.ts +0 -12
- package/src/pm-plugins/commands/delete.ts +0 -2
- package/src/pm-plugins/commands/insert.ts +0 -12
- package/src/pm-plugins/commands/misc.ts +0 -6
- package/src/pm-plugins/decorations/plugin.ts +0 -4
- package/src/pm-plugins/decorations/utils/column-resizing.ts +0 -2
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +0 -6
- package/src/pm-plugins/drag-and-drop/commands.ts +0 -8
- package/src/pm-plugins/drag-and-drop/plugin.ts +0 -4
- package/src/pm-plugins/keymap.ts +0 -2
- package/src/pm-plugins/main.ts +0 -4
- package/src/pm-plugins/table-resizing/event-handlers.ts +0 -2
- package/src/pm-plugins/table-resizing/plugin.ts +0 -2
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +0 -6
- package/src/pm-plugins/table-resizing/utils/column-state.ts +0 -2
- package/src/pm-plugins/table-resizing/utils/content-width.ts +0 -6
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +0 -2
- package/src/pm-plugins/table-resizing/utils/resize-logic.ts +0 -6
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +0 -4
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +0 -8
- package/src/pm-plugins/table-width.ts +0 -4
- package/src/pm-plugins/transforms/column-width.ts +0 -4
- package/src/pm-plugins/transforms/delete-columns.ts +0 -2
- package/src/pm-plugins/transforms/fix-tables.ts +0 -8
- package/src/pm-plugins/transforms/replace-table.ts +0 -2
- package/src/pm-plugins/transforms/split.ts +0 -2
- package/src/pm-plugins/utils/alignment.ts +0 -2
- package/src/pm-plugins/utils/decoration.ts +0 -8
- package/src/pm-plugins/utils/drag-menu.ts +0 -4
- package/src/pm-plugins/utils/nodes.ts +0 -2
- package/src/pm-plugins/utils/paste.ts +4 -2
- package/src/pm-plugins/utils/row-controls.ts +0 -2
- package/src/pm-plugins/utils/snapping.ts +0 -2
- package/src/tablePlugin.tsx +1 -0
- package/src/types/index.ts +1 -0
- package/src/ui/DragHandle/index.tsx +67 -2
- package/src/ui/FloatingInsertButton/getPopupOptions.ts +0 -4
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +37 -20
- package/src/ui/TableFloatingColumnControls/index.tsx +1 -4
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +86 -27
- package/src/ui/TableFloatingControls/index.tsx +55 -32
- package/src/ui/event-handlers.ts +0 -2
- package/src/ui/toolbar.tsx +0 -18
|
@@ -21,10 +21,7 @@ var _dom = require("./utils/dom");
|
|
|
21
21
|
var _misc2 = require("./utils/misc");
|
|
22
22
|
var _resizeColumn = require("./utils/resize-column");
|
|
23
23
|
var _resizeState = require("./utils/resize-state");
|
|
24
|
-
var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isCommentEditor
|
|
25
|
-
// Ignored via go/ees005
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
27
|
-
) {
|
|
24
|
+
var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isCommentEditor) {
|
|
28
25
|
var _originalTable$attrs;
|
|
29
26
|
var state = view.state,
|
|
30
27
|
dispatch = view.dispatch;
|
|
@@ -15,8 +15,6 @@ var _eventHandlers = require("./event-handlers");
|
|
|
15
15
|
var _pluginFactory2 = require("./plugin-factory");
|
|
16
16
|
var _pluginKey = require("./plugin-key");
|
|
17
17
|
var _dom = require("./utils/dom");
|
|
18
|
-
// Ignored via go/ees005
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
20
18
|
function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled, isCommentEditor) {
|
|
21
19
|
var _ref$lastColumnResiza = _ref.lastColumnResizable,
|
|
22
20
|
lastColumnResizable = _ref$lastColumnResiza === void 0 ? true : _ref$lastColumnResiza;
|
|
@@ -21,10 +21,7 @@ var _misc = require("./misc");
|
|
|
21
21
|
var getColWidthFix = exports.getColWidthFix = function getColWidthFix(colwidth, tableColumnCount) {
|
|
22
22
|
return colwidth - 1 / tableColumnCount;
|
|
23
23
|
};
|
|
24
|
-
var generateColgroup = exports.generateColgroup = function generateColgroup(table, tableRef, shouldUseIncreasedScalingPercent, isCommentEditor
|
|
25
|
-
// Ignored via go/ees005
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
27
|
-
) {
|
|
24
|
+
var generateColgroup = exports.generateColgroup = function generateColgroup(table, tableRef, shouldUseIncreasedScalingPercent, isCommentEditor) {
|
|
28
25
|
var cols = [];
|
|
29
26
|
var map = _tableMap.TableMap.get(table);
|
|
30
27
|
|
|
@@ -115,9 +112,6 @@ var isMinCellWidthTable = exports.isMinCellWidthTable = function isMinCellWidthT
|
|
|
115
112
|
});
|
|
116
113
|
return isTableMinCellWidth;
|
|
117
114
|
};
|
|
118
|
-
|
|
119
|
-
// Ignored via go/ees005
|
|
120
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
121
115
|
function renderColgroupFromNode(table, maybeTableRef, shouldUseIncreasedScalingPercent, isCommentEditor) {
|
|
122
116
|
var rendered = _model.DOMSerializer.renderSpec(document, ['colgroup', {}].concat((0, _toConsumableArray2.default)(generateColgroup(table, maybeTableRef, shouldUseIncreasedScalingPercent, isCommentEditor))));
|
|
123
117
|
|
|
@@ -26,10 +26,7 @@ var getFreeSpace = exports.getFreeSpace = function getFreeSpace(state) {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
// Returns DOM refs of all cells in a column by `columnIndex`
|
|
29
|
-
var getCellsRefsInColumn = exports.getCellsRefsInColumn = function getCellsRefsInColumn(columnIndex, table, tableStart, domAtPos
|
|
30
|
-
// Ignored via go/ees005
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
32
|
-
) {
|
|
29
|
+
var getCellsRefsInColumn = exports.getCellsRefsInColumn = function getCellsRefsInColumn(columnIndex, table, tableStart, domAtPos) {
|
|
33
30
|
var map = _tableMap.TableMap.get(table);
|
|
34
31
|
var cellsPositions = map.cellsInRect({
|
|
35
32
|
left: columnIndex,
|
|
@@ -6,16 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.contentWidth = contentWidth;
|
|
7
7
|
var _unitToNumber = require("./unit-to-number");
|
|
8
8
|
// calculates content width of a cell
|
|
9
|
-
// Ignored via go/ees005
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
11
9
|
function contentWidth(elem, container) {
|
|
12
10
|
var colWidths = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
13
11
|
var canvas = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document.createElement('canvas');
|
|
14
12
|
return calcContentWidth(elem, container || elem, canvas, colWidths);
|
|
15
13
|
}
|
|
16
|
-
|
|
17
|
-
// Ignored via go/ees005
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
19
14
|
function calcContentWidth(elem, container, canvas, colWidths) {
|
|
20
15
|
var flowWidths = [];
|
|
21
16
|
var curWidth = 0;
|
|
@@ -85,9 +80,6 @@ function measureText(canvas, text, font) {
|
|
|
85
80
|
}
|
|
86
81
|
return Math.round(ctx.measureText(text || '').width);
|
|
87
82
|
}
|
|
88
|
-
|
|
89
|
-
// Ignored via go/ees005
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
91
83
|
function handlePreText(canvas, node, textContent, font) {
|
|
92
84
|
var parent = node;
|
|
93
85
|
if (node.nodeName === 'CODE') {
|
|
@@ -14,10 +14,7 @@ var _columnState = require("./column-state");
|
|
|
14
14
|
var _resizeState = require("./resize-state");
|
|
15
15
|
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; }
|
|
16
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
-
var growColumn = exports.growColumn = function growColumn(state, colIndex, amount, selectedColumns
|
|
18
|
-
// Ignored via go/ees005
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
20
|
-
) {
|
|
17
|
+
var growColumn = exports.growColumn = function growColumn(state, colIndex, amount, selectedColumns) {
|
|
21
18
|
// can't grow if columns don't exist or it's the last column
|
|
22
19
|
if (!state.cols[colIndex] || !state.cols[colIndex + 1]) {
|
|
23
20
|
return state;
|
|
@@ -33,10 +30,7 @@ var growColumn = exports.growColumn = function growColumn(state, colIndex, amoun
|
|
|
33
30
|
}
|
|
34
31
|
return newState;
|
|
35
32
|
};
|
|
36
|
-
var shrinkColumn = exports.shrinkColumn = function shrinkColumn(state, colIndex, amount, selectedColumns
|
|
37
|
-
// Ignored via go/ees005
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
39
|
-
) {
|
|
33
|
+
var shrinkColumn = exports.shrinkColumn = function shrinkColumn(state, colIndex, amount, selectedColumns) {
|
|
40
34
|
// can't shrink if columns don't exist
|
|
41
35
|
if (!state.cols[colIndex]) {
|
|
42
36
|
return state;
|
|
@@ -109,8 +103,6 @@ var ColType = /*#__PURE__*/function (ColType) {
|
|
|
109
103
|
return ColType;
|
|
110
104
|
}(ColType || {}); // TODO: should handle when destIdx:
|
|
111
105
|
// - is beyond the range, and then not give it back
|
|
112
|
-
// Ignored via go/ees005
|
|
113
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
114
106
|
function moveSpaceFrom(state, srcIdx, destIdx, amount) {
|
|
115
107
|
var useFreeSpace = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
116
108
|
var srcCol = state.cols[srcIdx];
|
|
@@ -100,10 +100,7 @@ var getResizeState = exports.getResizeState = function getResizeState(_ref) {
|
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
// updates Colgroup DOM node with new widths
|
|
103
|
-
var updateColgroup = exports.updateColgroup = function updateColgroup(state, tableRef, tableNode, isTableScalingEnabled, scalePercent
|
|
104
|
-
// Ignored via go/ees005
|
|
105
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
106
|
-
) {
|
|
103
|
+
var updateColgroup = exports.updateColgroup = function updateColgroup(state, tableRef, tableNode, isTableScalingEnabled, scalePercent) {
|
|
107
104
|
var cols = tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll('col');
|
|
108
105
|
var columnsCount = cols === null || cols === void 0 ? void 0 : cols.length;
|
|
109
106
|
/**
|
|
@@ -22,10 +22,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
22
22
|
* Also holds resizing state to hide / show table controls
|
|
23
23
|
*/
|
|
24
24
|
var pluginKey = exports.pluginKey = new _state.PluginKey('tableWidthPlugin');
|
|
25
|
-
var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullWidthEnabled, isTableScalingEnabled, isTableAlignmentEnabled, isCommentEditor
|
|
26
|
-
// Ignored via go/ees005
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
28
|
-
) {
|
|
25
|
+
var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullWidthEnabled, isTableScalingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
29
26
|
return new _safePlugin.SafePlugin({
|
|
30
27
|
key: pluginKey,
|
|
31
28
|
state: {
|
|
@@ -122,8 +119,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispat
|
|
|
122
119
|
}
|
|
123
120
|
if (referentialityTr) {
|
|
124
121
|
referentialityTr.steps.forEach(function (step) {
|
|
125
|
-
// Ignored via go/ees005
|
|
126
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
127
122
|
step.getMap().forEach(function (_, __, newStart, newEnd) {
|
|
128
123
|
newState.doc.nodesBetween(newStart, newEnd, function (node, pos) {
|
|
129
124
|
if (node.type === table) {
|
|
@@ -23,10 +23,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
23
23
|
* @param start
|
|
24
24
|
* @returns
|
|
25
25
|
*/
|
|
26
|
-
var updateColumnWidths = exports.updateColumnWidths = function updateColumnWidths(resizeState, table, start, api
|
|
27
|
-
// Ignored via go/ees005
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
29
|
-
) {
|
|
26
|
+
var updateColumnWidths = exports.updateColumnWidths = function updateColumnWidths(resizeState, table, start, api) {
|
|
30
27
|
return function (tr) {
|
|
31
28
|
var map = _tableMap.TableMap.get(table);
|
|
32
29
|
var updatedCellsAttrs = {};
|
|
@@ -45,10 +45,7 @@ var validateTableCellNodeAttrs = function validateTableCellNodeAttrs(_ref, repor
|
|
|
45
45
|
//
|
|
46
46
|
// This row only spans two columns, yet it contains widths for 3.
|
|
47
47
|
// We remove the third width here, assumed duplicate content.
|
|
48
|
-
var removeExtraneousColumnWidths = exports.removeExtraneousColumnWidths = function removeExtraneousColumnWidths(node, basePos, tr, reportInvalidTableCellSpanAttrs
|
|
49
|
-
// Ignored via go/ees005
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
51
|
-
) {
|
|
48
|
+
var removeExtraneousColumnWidths = exports.removeExtraneousColumnWidths = function removeExtraneousColumnWidths(node, basePos, tr, reportInvalidTableCellSpanAttrs) {
|
|
52
49
|
var hasProblems = false;
|
|
53
50
|
tr = replaceCells(tr, node, basePos, function (cell) {
|
|
54
51
|
var _cell$attrs = cell.attrs,
|
|
@@ -99,10 +96,7 @@ var fixTables = exports.fixTables = function fixTables(tr, reportInvalidTableCel
|
|
|
99
96
|
//
|
|
100
97
|
// We use this when migrating TinyMCE tables for Confluence, for example:
|
|
101
98
|
// https://pug.jira-dev.com/wiki/spaces/AEC/pages/3362882215/How+do+we+map+TinyMCE+tables+to+Fabric+tables
|
|
102
|
-
var fixAutoSizedTable = exports.fixAutoSizedTable = function fixAutoSizedTable(view, tableNode, tableRef, tablePos, opts
|
|
103
|
-
// Ignored via go/ees005
|
|
104
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
105
|
-
) {
|
|
99
|
+
var fixAutoSizedTable = exports.fixAutoSizedTable = function fixAutoSizedTable(view, tableNode, tableRef, tablePos, opts) {
|
|
106
100
|
var tr = view.state.tr;
|
|
107
101
|
var domAtPos = view.domAtPos.bind(view);
|
|
108
102
|
var tableStart = tablePos + 1;
|
|
@@ -145,9 +139,6 @@ var getLayoutBasedOnWidth = function getLayoutBasedOnWidth(totalWidth) {
|
|
|
145
139
|
return 'default';
|
|
146
140
|
}
|
|
147
141
|
};
|
|
148
|
-
|
|
149
|
-
// Ignored via go/ees005
|
|
150
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
151
142
|
function parseDOMColumnWidths(domAtPos, tableNode, tableStart, tableRef) {
|
|
152
143
|
var row = tableRef.querySelector('tr');
|
|
153
144
|
if (!row) {
|
|
@@ -172,10 +163,7 @@ function parseDOMColumnWidths(domAtPos, tableNode, tableStart, tableRef) {
|
|
|
172
163
|
}
|
|
173
164
|
|
|
174
165
|
// TODO: move to prosemirror-utils
|
|
175
|
-
var replaceCells = function replaceCells(tr, table, tablePos, modifyCell
|
|
176
|
-
// Ignored via go/ees005
|
|
177
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
178
|
-
) {
|
|
166
|
+
var replaceCells = function replaceCells(tr, table, tablePos, modifyCell) {
|
|
179
167
|
var rows = [];
|
|
180
168
|
var modifiedCells = 0;
|
|
181
169
|
for (var rowIndex = 0; rowIndex < table.childCount; rowIndex++) {
|
|
@@ -9,10 +9,7 @@ var _model = require("@atlaskit/editor-prosemirror/model");
|
|
|
9
9
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
10
10
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
11
11
|
var _analytics2 = require("../utils/analytics");
|
|
12
|
-
var replaceSelectedTable = exports.replaceSelectedTable = function replaceSelectedTable(state, content, inputMethod, editorAnalyticsAPI
|
|
13
|
-
// Ignored via go/ees005
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
15
|
-
) {
|
|
12
|
+
var replaceSelectedTable = exports.replaceSelectedTable = function replaceSelectedTable(state, content, inputMethod, editorAnalyticsAPI) {
|
|
16
13
|
if ((0, _utils.isTableSelected)(state.selection)) {
|
|
17
14
|
var table = (0, _utils.findTable)(state.selection);
|
|
18
15
|
if (table) {
|
|
@@ -16,8 +16,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
16
16
|
* @param columnStart - Start of the rect included (rect.left)
|
|
17
17
|
* @param columnEnd - End of the rect not included (rect.right)
|
|
18
18
|
*/
|
|
19
|
-
// Ignored via go/ees005
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
21
19
|
function splitCellsInColumns(tr, tablePos, columnStart, columnEnd) {
|
|
22
20
|
var mapStart = tr.mapping.maps.length;
|
|
23
21
|
var table = tr.doc.nodeAt(tablePos);
|
|
@@ -19,9 +19,6 @@ var normaliseAlignment = exports.normaliseAlignment = function normaliseAlignmen
|
|
|
19
19
|
/**
|
|
20
20
|
* We don't want to switch alignment in Full-width editor
|
|
21
21
|
*/
|
|
22
|
-
var shouldChangeAlignmentToCenterResized = exports.shouldChangeAlignmentToCenterResized = function shouldChangeAlignmentToCenterResized(isTableAlignmentEnabled, tableNode, lineLength, updatedTableWidth
|
|
23
|
-
// Ignored via go/ees005
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
25
|
-
) {
|
|
22
|
+
var shouldChangeAlignmentToCenterResized = exports.shouldChangeAlignmentToCenterResized = function shouldChangeAlignmentToCenterResized(isTableAlignmentEnabled, tableNode, lineLength, updatedTableWidth) {
|
|
26
23
|
return Boolean(isTableAlignmentEnabled && tableNode && tableNode.attrs.layout === ALIGN_START && lineLength && updatedTableWidth > lineLength && lineLength < _consts.FULL_WIDTH_EDITOR_CONTENT_WIDTH);
|
|
27
24
|
};
|
|
@@ -39,10 +39,7 @@ var createCellHoverDecoration = exports.createCellHoverDecoration = function cre
|
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
|
-
var createControlsHoverDecoration = exports.createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, tr, isDragAndDropEnable, hoveredIndexes, danger, selected
|
|
43
|
-
// Ignored via go/ees005
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
45
|
-
) {
|
|
42
|
+
var createControlsHoverDecoration = exports.createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, tr, isDragAndDropEnable, hoveredIndexes, danger, selected) {
|
|
46
43
|
var table = (0, _utils2.findTable)(tr.selection);
|
|
47
44
|
if (!table) {
|
|
48
45
|
return [];
|
|
@@ -171,10 +168,7 @@ var createColumnControlsDecoration = exports.createColumnControlsDecoration = fu
|
|
|
171
168
|
});
|
|
172
169
|
});
|
|
173
170
|
};
|
|
174
|
-
var updateDecorations = exports.updateDecorations = function updateDecorations(node, decorationSet, decorations, key
|
|
175
|
-
// Ignored via go/ees005
|
|
176
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
177
|
-
) {
|
|
171
|
+
var updateDecorations = exports.updateDecorations = function updateDecorations(node, decorationSet, decorations, key) {
|
|
178
172
|
var filteredDecorations = filterDecorationByKey(key, decorationSet);
|
|
179
173
|
var decorationSetFiltered = decorationSet.remove(filteredDecorations);
|
|
180
174
|
return decorationSetFiltered.add(node, decorations);
|
|
@@ -265,10 +259,7 @@ var makeArray = function makeArray(n) {
|
|
|
265
259
|
var createResizeHandleDecoration = exports.createResizeHandleDecoration = function createResizeHandleDecoration(tr, rowIndexTarget, columnEndIndexTarget) {
|
|
266
260
|
var includeTooltip = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
267
261
|
var getIntl = arguments.length > 4 ? arguments[4] : undefined;
|
|
268
|
-
var nodeViewPortalProviderAPI
|
|
269
|
-
// Ignored via go/ees005
|
|
270
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
271
|
-
= arguments.length > 5 ? arguments[5] : undefined;
|
|
262
|
+
var nodeViewPortalProviderAPI = arguments.length > 5 ? arguments[5] : undefined;
|
|
272
263
|
var emptyResult = [[], []];
|
|
273
264
|
var table = (0, _utils2.findTable)(tr.selection);
|
|
274
265
|
if (!table || !table.node) {
|
|
@@ -278,10 +269,7 @@ var createResizeHandleDecoration = exports.createResizeHandleDecoration = functi
|
|
|
278
269
|
if (!map.width) {
|
|
279
270
|
return emptyResult;
|
|
280
271
|
}
|
|
281
|
-
var createResizerHandleDecoration = function createResizerHandleDecoration(cellColumnPositioning, columnIndex, rowIndex, cellPos, cellNode
|
|
282
|
-
// Ignored via go/ees005
|
|
283
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
284
|
-
) {
|
|
272
|
+
var createResizerHandleDecoration = function createResizerHandleDecoration(cellColumnPositioning, columnIndex, rowIndex, cellPos, cellNode) {
|
|
285
273
|
var decorationRenderKey = (0, _v.default)();
|
|
286
274
|
var position = cellPos + cellNode.nodeSize - 1;
|
|
287
275
|
return _view.Decoration.widget(position, function () {
|
|
@@ -46,10 +46,7 @@ var _selection = require("./selection");
|
|
|
46
46
|
var getTargetIndex = exports.getTargetIndex = function getTargetIndex(selectedIndexes, direction) {
|
|
47
47
|
return Math[direction < 0 ? 'min' : 'max'].apply(Math, (0, _toConsumableArray2.default)(selectedIndexes)) + direction;
|
|
48
48
|
};
|
|
49
|
-
var canMove = exports.canMove = function canMove(sourceType, direction, totalItemsOfSourceTypeCount, selection, selectionRect
|
|
50
|
-
// Ignored via go/ees005
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
52
|
-
) {
|
|
49
|
+
var canMove = exports.canMove = function canMove(sourceType, direction, totalItemsOfSourceTypeCount, selection, selectionRect) {
|
|
53
50
|
if (!selectionRect) {
|
|
54
51
|
return false;
|
|
55
52
|
}
|
|
@@ -80,9 +80,6 @@ var tablesHaveDifferentNoOfRows = exports.tablesHaveDifferentNoOfRows = function
|
|
|
80
80
|
var currentMap = _tableMap.TableMap.get(currentTable);
|
|
81
81
|
return prevMap.height !== currentMap.height;
|
|
82
82
|
};
|
|
83
|
-
|
|
84
|
-
// Ignored via go/ees005
|
|
85
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
86
83
|
function filterNearSelection(selection, findNode, predicate, defaultValue) {
|
|
87
84
|
var found = findNode(selection);
|
|
88
85
|
if (!found) {
|
|
@@ -12,6 +12,7 @@ var _nesting = require("@atlaskit/editor-common/nesting");
|
|
|
12
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
13
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
14
14
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
16
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
17
|
var _pluginFactory = require("../plugin-factory");
|
|
17
18
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -29,6 +30,9 @@ var unwrapContentFromTable = exports.unwrapContentFromTable = function unwrapCon
|
|
|
29
30
|
content.push.apply(content, (0, _toConsumableArray2.default)((0, _utils2.flatten)(maybeCell, false).map(function (child) {
|
|
30
31
|
return child.node;
|
|
31
32
|
})));
|
|
33
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_nested_tables_paste_dupe_fix')) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
32
36
|
}
|
|
33
37
|
return true;
|
|
34
38
|
});
|
|
@@ -88,10 +88,7 @@ var getRowsParams = exports.getRowsParams = function getRowsParams(rowsHeights)
|
|
|
88
88
|
var getRowClassNames = exports.getRowClassNames = function getRowClassNames(index, selection) {
|
|
89
89
|
var hoveredRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
90
90
|
var isInDanger = arguments.length > 3 ? arguments[3] : undefined;
|
|
91
|
-
var isResizing
|
|
92
|
-
// Ignored via go/ees005
|
|
93
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
94
|
-
= arguments.length > 4 ? arguments[4] : undefined;
|
|
91
|
+
var isResizing = arguments.length > 4 ? arguments[4] : undefined;
|
|
95
92
|
var classNames = [];
|
|
96
93
|
if ((0, _utils3.isRowSelected)(index)(selection) || hoveredRows.indexOf(index) > -1 && !isResizing) {
|
|
97
94
|
classNames.push(_types.TableCssClassName.HOVERED_CELL_ACTIVE);
|
package/dist/cjs/tablePlugin.js
CHANGED
|
@@ -108,6 +108,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
108
108
|
isTableResizing: tableWidthResizingPluginState === null || tableWidthResizingPluginState === void 0 ? void 0 : tableWidthResizingPluginState.resizing,
|
|
109
109
|
isInDanger: tablePluginState.isInDanger,
|
|
110
110
|
hoveredRows: tablePluginState.hoveredRows,
|
|
111
|
+
hoveredColumns: tablePluginState.hoveredColumns,
|
|
111
112
|
hoveredCell: tablePluginState.hoveredCell,
|
|
112
113
|
isTableHovered: tablePluginState.isTableHovered,
|
|
113
114
|
isWholeTableInDanger: tablePluginState.isWholeTableInDanger,
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.DragHandle = void 0;
|
|
8
|
+
exports.DragHandleWithSharedState = exports.DragHandle = void 0;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -13,6 +13,7 @@ var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
14
14
|
var _reactIntlNext = require("react-intl-next");
|
|
15
15
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
16
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
16
17
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
17
18
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
18
19
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
@@ -27,6 +28,8 @@ var _DragPreview = require("../DragPreview");
|
|
|
27
28
|
var _HandleIconComponent = require("./HandleIconComponent");
|
|
28
29
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
29
30
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
31
|
+
/* eslint-disable @atlaskit/design-system/no-html-button */
|
|
32
|
+
|
|
30
33
|
var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
31
34
|
var isDragMenuTarget = _ref.isDragMenuTarget,
|
|
32
35
|
tableLocalId = _ref.tableLocalId,
|
|
@@ -45,7 +48,9 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
45
48
|
hoveredCell = _ref.hoveredCell,
|
|
46
49
|
onClick = _ref.onClick,
|
|
47
50
|
editorView = _ref.editorView,
|
|
48
|
-
formatMessage = _ref.intl.formatMessage
|
|
51
|
+
formatMessage = _ref.intl.formatMessage,
|
|
52
|
+
hoveredColumns = _ref.hoveredColumns,
|
|
53
|
+
hoveredRows = _ref.hoveredRows;
|
|
49
54
|
var dragHandleDivRef = (0, _react.useRef)(null);
|
|
50
55
|
var _useState = (0, _react.useState)(null),
|
|
51
56
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -53,9 +58,13 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
53
58
|
setPreviewContainer = _useState2[1];
|
|
54
59
|
var state = editorView.state,
|
|
55
60
|
selection = editorView.state.selection;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
if (hoveredColumns === undefined || hoveredRows === undefined) {
|
|
62
|
+
var _getPluginState = (0, _pluginFactory2.getPluginState)(state),
|
|
63
|
+
hoveredColumnsState = _getPluginState.hoveredColumns,
|
|
64
|
+
hoveredRowsState = _getPluginState.hoveredRows;
|
|
65
|
+
hoveredColumns = hoveredColumnsState;
|
|
66
|
+
hoveredRows = hoveredRowsState;
|
|
67
|
+
}
|
|
59
68
|
var _getDnDPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
60
69
|
_getDnDPluginState$is = _getDnDPluginState.isDragMenuOpen,
|
|
61
70
|
isDragMenuOpen = _getDnDPluginState$is === void 0 ? false : _getDnDPluginState$is;
|
|
@@ -244,4 +253,44 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
244
253
|
height: previewHeight
|
|
245
254
|
}), previewContainer));
|
|
246
255
|
};
|
|
247
|
-
var
|
|
256
|
+
var DragHandleComponentWithSharedState = function DragHandleComponentWithSharedState(_ref5) {
|
|
257
|
+
var isDragMenuTarget = _ref5.isDragMenuTarget,
|
|
258
|
+
tableLocalId = _ref5.tableLocalId,
|
|
259
|
+
direction = _ref5.direction,
|
|
260
|
+
appearance = _ref5.appearance,
|
|
261
|
+
indexes = _ref5.indexes,
|
|
262
|
+
forceDefaultHandle = _ref5.forceDefaultHandle,
|
|
263
|
+
previewHeight = _ref5.previewHeight,
|
|
264
|
+
previewWidth = _ref5.previewWidth,
|
|
265
|
+
onMouseOver = _ref5.onMouseOver,
|
|
266
|
+
onMouseOut = _ref5.onMouseOut,
|
|
267
|
+
toggleDragMenu = _ref5.toggleDragMenu,
|
|
268
|
+
hoveredCell = _ref5.hoveredCell,
|
|
269
|
+
onClick = _ref5.onClick,
|
|
270
|
+
editorView = _ref5.editorView,
|
|
271
|
+
intl = _ref5.intl,
|
|
272
|
+
api = _ref5.api;
|
|
273
|
+
var _ref6 = (0, _hooks.useSharedPluginState)(api, ['table']),
|
|
274
|
+
tableState = _ref6.tableState;
|
|
275
|
+
return /*#__PURE__*/_react.default.createElement(DragHandleComponent, {
|
|
276
|
+
isDragMenuTarget: isDragMenuTarget,
|
|
277
|
+
tableLocalId: tableLocalId,
|
|
278
|
+
direction: direction,
|
|
279
|
+
appearance: appearance,
|
|
280
|
+
indexes: indexes,
|
|
281
|
+
forceDefaultHandle: forceDefaultHandle,
|
|
282
|
+
previewWidth: previewWidth,
|
|
283
|
+
previewHeight: previewHeight,
|
|
284
|
+
onMouseOver: onMouseOver,
|
|
285
|
+
onMouseOut: onMouseOut,
|
|
286
|
+
toggleDragMenu: toggleDragMenu,
|
|
287
|
+
hoveredCell: hoveredCell,
|
|
288
|
+
onClick: onClick,
|
|
289
|
+
editorView: editorView,
|
|
290
|
+
intl: intl,
|
|
291
|
+
hoveredColumns: tableState === null || tableState === void 0 ? void 0 : tableState.hoveredColumns,
|
|
292
|
+
hoveredRows: tableState === null || tableState === void 0 ? void 0 : tableState.hoveredRows
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
var DragHandle = exports.DragHandle = (0, _reactIntlNext.injectIntl)(DragHandleComponent);
|
|
296
|
+
var DragHandleWithSharedState = exports.DragHandleWithSharedState = (0, _reactIntlNext.injectIntl)(DragHandleComponentWithSharedState);
|
|
@@ -39,9 +39,6 @@ function getRowOptions(index, isDragAndDropEnabled) {
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
// Ignored via go/ees005
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
45
42
|
function getColumnOptions(index, tableContainer, hasNumberedColumns, isDragAndDropEnabled) {
|
|
46
43
|
var options = {
|
|
47
44
|
alignX: 'end',
|
|
@@ -82,9 +79,6 @@ function getColumnOptions(index, tableContainer, hasNumberedColumns, isDragAndDr
|
|
|
82
79
|
}
|
|
83
80
|
return options;
|
|
84
81
|
}
|
|
85
|
-
|
|
86
|
-
// Ignored via go/ees005
|
|
87
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
88
82
|
function getPopupOptions(direction, index, hasNumberedColumns, isDragAndDropEnabled, tableContainer) {
|
|
89
83
|
switch (direction) {
|
|
90
84
|
case 'column':
|
|
@@ -43,7 +43,6 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
43
43
|
isInDanger = _ref.isInDanger,
|
|
44
44
|
rowHeights = _ref.rowHeights,
|
|
45
45
|
colWidths = _ref.colWidths,
|
|
46
|
-
hasHeaderColumn = _ref.hasHeaderColumn,
|
|
47
46
|
isTableHovered = _ref.isTableHovered,
|
|
48
47
|
tableContainerWidth = _ref.tableContainerWidth,
|
|
49
48
|
isNumberColumnEnabled = _ref.isNumberColumnEnabled,
|
|
@@ -138,10 +137,7 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
138
137
|
var _getScrollOffset;
|
|
139
138
|
columnControlsRef.current.scrollLeft = (_getScrollOffset = getScrollOffset === null || getScrollOffset === void 0 ? void 0 : getScrollOffset()) !== null && _getScrollOffset !== void 0 ? _getScrollOffset : 0;
|
|
140
139
|
}
|
|
141
|
-
var generateHandleByType = function generateHandleByType(type, appearance, gridColumn, indexes
|
|
142
|
-
// Ignored via go/ees005
|
|
143
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
144
|
-
) {
|
|
140
|
+
var generateHandleByType = function generateHandleByType(type, appearance, gridColumn, indexes) {
|
|
145
141
|
var _rowHeights$reduce, _colWidths$reduce;
|
|
146
142
|
var isHover = type === 'hover';
|
|
147
143
|
var isPlaceholder = appearance === 'placeholder';
|
|
@@ -176,7 +172,23 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
176
172
|
position: 'relative'
|
|
177
173
|
},
|
|
178
174
|
"data-testid": "table-floating-column-".concat(isHover ? colIndex : isPlaceholder ? appearance : selectedColIndexes[0], "-drag-handle")
|
|
179
|
-
}, /*#__PURE__*/_react.default.createElement(_DragHandle.
|
|
175
|
+
}, (0, _platformFeatureFlags.fg)('platform_editor_table_use_shared_state_hook_fg') ? /*#__PURE__*/_react.default.createElement(_DragHandle.DragHandleWithSharedState, {
|
|
176
|
+
isDragMenuTarget: !isHover,
|
|
177
|
+
direction: "column",
|
|
178
|
+
tableLocalId: localId || '',
|
|
179
|
+
indexes: indexes,
|
|
180
|
+
hoveredCell: hoveredCell,
|
|
181
|
+
previewWidth: previewWidth,
|
|
182
|
+
forceDefaultHandle: !isHover,
|
|
183
|
+
previewHeight: previewHeight,
|
|
184
|
+
appearance: appearance,
|
|
185
|
+
onClick: handleClick,
|
|
186
|
+
onMouseOver: handleMouseOver,
|
|
187
|
+
onMouseOut: handleMouseOut,
|
|
188
|
+
toggleDragMenu: toggleDragMenuHandler,
|
|
189
|
+
editorView: editorView,
|
|
190
|
+
api: api
|
|
191
|
+
}) : /*#__PURE__*/_react.default.createElement(_DragHandle.DragHandle, {
|
|
180
192
|
isDragMenuTarget: !isHover,
|
|
181
193
|
direction: "column",
|
|
182
194
|
tableLocalId: localId || '',
|
|
@@ -10,7 +10,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
12
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
13
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
14
13
|
var _columnControls = require("../../pm-plugins/utils/column-controls");
|
|
15
14
|
var _nodes = require("../../pm-plugins/utils/nodes");
|
|
16
15
|
var _rowControls = require("../../pm-plugins/utils/row-controls");
|
|
@@ -109,7 +108,7 @@ var TableFloatingColumnControls = function TableFloatingColumnControls(_ref) {
|
|
|
109
108
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
110
109
|
isDragging: isDragging,
|
|
111
110
|
getScrollOffset: getScrollOffset,
|
|
112
|
-
api: (0,
|
|
111
|
+
api: (0, _platformFeatureFlags.fg)('platform_editor_table_use_shared_state_hook_fg') ? api : undefined
|
|
113
112
|
}), isDragging && /*#__PURE__*/_react.default.createElement(_ColumnDropTargets.ColumnDropTargets, {
|
|
114
113
|
tableRef: tableRef,
|
|
115
114
|
isHeaderSticky: (stickyHeader === null || stickyHeader === void 0 ? void 0 : stickyHeader.sticky) && hasHeaderRow,
|