@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
|
@@ -5,12 +5,13 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.DragControls = void 0;
|
|
8
|
+
exports.DragControlsWithSelection = exports.DragControls = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var
|
|
11
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
12
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
13
13
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
15
16
|
var _commands = require("../../../pm-plugins/commands");
|
|
16
17
|
var _commands2 = require("../../../pm-plugins/drag-and-drop/commands");
|
|
@@ -35,7 +36,7 @@ var getSelectedRows = function getSelectedRows(selection) {
|
|
|
35
36
|
}
|
|
36
37
|
return [];
|
|
37
38
|
};
|
|
38
|
-
var
|
|
39
|
+
var DragControls = exports.DragControls = function DragControls(_ref) {
|
|
39
40
|
var _tableNode$attrs$loca, _tableNode$attrs;
|
|
40
41
|
var tableRef = _ref.tableRef,
|
|
41
42
|
tableNode = _ref.tableNode,
|
|
@@ -49,7 +50,9 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
49
50
|
hoverRows = _ref.hoverRows,
|
|
50
51
|
selectRow = _ref.selectRow,
|
|
51
52
|
selectRows = _ref.selectRows,
|
|
52
|
-
updateCellHoverLocation = _ref.updateCellHoverLocation
|
|
53
|
+
updateCellHoverLocation = _ref.updateCellHoverLocation,
|
|
54
|
+
api = _ref.api,
|
|
55
|
+
selection = _ref.selection;
|
|
53
56
|
var _useState = (0, _react.useState)(false),
|
|
54
57
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
55
58
|
isDragging = _useState2[0],
|
|
@@ -59,7 +62,7 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
59
62
|
var heights = rowHeights.map(function (height) {
|
|
60
63
|
return "".concat(height - 1, "px");
|
|
61
64
|
}).join(' ');
|
|
62
|
-
var selectedRowIndexes = getSelectedRows(editorView.state.selection);
|
|
65
|
+
var selectedRowIndexes = getSelectedRows(selection !== null && selection !== void 0 ? selection : editorView.state.selection);
|
|
63
66
|
var currentNodeLocalId = (_tableNode$attrs$loca = tableNode === null || tableNode === void 0 || (_tableNode$attrs = tableNode.attrs) === null || _tableNode$attrs === void 0 ? void 0 : _tableNode$attrs.localId) !== null && _tableNode$attrs$loca !== void 0 ? _tableNode$attrs$loca : '';
|
|
64
67
|
(0, _react.useEffect)(function () {
|
|
65
68
|
return (0, _adapter.monitorForElements)({
|
|
@@ -138,10 +141,7 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
138
141
|
selectRows(selectedRowIndexes);
|
|
139
142
|
}
|
|
140
143
|
}, [rowIndex, selectRow, selectRows, selectedRowIndexes]);
|
|
141
|
-
var generateHandleByType = function generateHandleByType(type, appearance, gridRow, indexes
|
|
142
|
-
// Ignored via go/ees005
|
|
143
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
144
|
-
) {
|
|
144
|
+
var generateHandleByType = function generateHandleByType(type, appearance, gridRow, indexes) {
|
|
145
145
|
var isHover = type === 'hover';
|
|
146
146
|
var previewHeight = rowHeights.reduce(function (sum, v, i) {
|
|
147
147
|
return sum + v * (indexes.includes(i) ? 1 : 0);
|
|
@@ -167,7 +167,23 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
167
167
|
pointerEvents: 'none'
|
|
168
168
|
},
|
|
169
169
|
"data-testid": "table-floating-row-".concat(isHover ? rowIndex : selectedRowIndexes[0], "-drag-handle")
|
|
170
|
-
}, /*#__PURE__*/_react.default.createElement(_DragHandle.
|
|
170
|
+
}, (0, _platformFeatureFlags.fg)('platform_editor_table_use_shared_state_hook_fg') ? /*#__PURE__*/_react.default.createElement(_DragHandle.DragHandleWithSharedState, {
|
|
171
|
+
isDragMenuTarget: !isHover,
|
|
172
|
+
direction: "row",
|
|
173
|
+
tableLocalId: currentNodeLocalId,
|
|
174
|
+
indexes: indexes,
|
|
175
|
+
forceDefaultHandle: !isHover,
|
|
176
|
+
previewWidth: tableWidth,
|
|
177
|
+
previewHeight: previewHeight,
|
|
178
|
+
appearance: appearance,
|
|
179
|
+
hoveredCell: hoveredCell,
|
|
180
|
+
onClick: handleClick,
|
|
181
|
+
onMouseOver: handleMouseOver,
|
|
182
|
+
onMouseOut: handleMouseOut,
|
|
183
|
+
toggleDragMenu: toggleDragMenuHandler,
|
|
184
|
+
editorView: editorView,
|
|
185
|
+
api: api
|
|
186
|
+
}) : /*#__PURE__*/_react.default.createElement(_DragHandle.DragHandle, {
|
|
171
187
|
isDragMenuTarget: !isHover,
|
|
172
188
|
direction: "row",
|
|
173
189
|
tableLocalId: currentNodeLocalId,
|
|
@@ -271,4 +287,38 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
271
287
|
}), rowHandles())
|
|
272
288
|
);
|
|
273
289
|
};
|
|
274
|
-
var
|
|
290
|
+
var DragControlsWithSelection = exports.DragControlsWithSelection = function DragControlsWithSelection(_ref5) {
|
|
291
|
+
var editorView = _ref5.editorView,
|
|
292
|
+
tableRef = _ref5.tableRef,
|
|
293
|
+
tableNode = _ref5.tableNode,
|
|
294
|
+
tableWidth = _ref5.tableWidth,
|
|
295
|
+
tableActive = _ref5.tableActive,
|
|
296
|
+
hoveredCell = _ref5.hoveredCell,
|
|
297
|
+
isInDanger = _ref5.isInDanger,
|
|
298
|
+
isTableHovered = _ref5.isTableHovered,
|
|
299
|
+
isResizing = _ref5.isResizing,
|
|
300
|
+
hoverRows = _ref5.hoverRows,
|
|
301
|
+
selectRow = _ref5.selectRow,
|
|
302
|
+
selectRows = _ref5.selectRows,
|
|
303
|
+
updateCellHoverLocation = _ref5.updateCellHoverLocation,
|
|
304
|
+
api = _ref5.api;
|
|
305
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['selection']),
|
|
306
|
+
selectionState = _useSharedPluginState.selectionState;
|
|
307
|
+
return /*#__PURE__*/_react.default.createElement(DragControls, {
|
|
308
|
+
editorView: editorView,
|
|
309
|
+
tableRef: tableRef,
|
|
310
|
+
tableNode: tableNode,
|
|
311
|
+
tableWidth: tableWidth,
|
|
312
|
+
tableActive: tableActive,
|
|
313
|
+
hoveredCell: hoveredCell,
|
|
314
|
+
isInDanger: isInDanger,
|
|
315
|
+
isTableHovered: isTableHovered,
|
|
316
|
+
isResizing: isResizing,
|
|
317
|
+
hoverRows: hoverRows,
|
|
318
|
+
selectRow: selectRow,
|
|
319
|
+
selectRows: selectRows,
|
|
320
|
+
updateCellHoverLocation: updateCellHoverLocation,
|
|
321
|
+
api: api,
|
|
322
|
+
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
323
|
+
});
|
|
324
|
+
};
|
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = exports.TableFloatingControls = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
11
|
-
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
11
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
13
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
14
14
|
var _commands = require("../../pm-plugins/commands");
|
|
15
15
|
var _nodes = require("../../pm-plugins/utils/nodes");
|
|
@@ -22,6 +22,7 @@ var _ClassicControls = require("./RowControls/ClassicControls");
|
|
|
22
22
|
var _DragControls = require("./RowControls/DragControls");
|
|
23
23
|
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); }
|
|
24
24
|
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; }
|
|
25
|
+
// Row controls
|
|
25
26
|
var TableFloatingControls = exports.TableFloatingControls = function TableFloatingControls(_ref) {
|
|
26
27
|
var _findTable;
|
|
27
28
|
var editorView = _ref.editorView,
|
|
@@ -82,8 +83,6 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
82
83
|
(0, _commands.hoverCell)(rowIndex, 0)(state, dispatch);
|
|
83
84
|
}
|
|
84
85
|
}, [editorView, tableActive]);
|
|
85
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['featureFlags']),
|
|
86
|
-
featureFlagsState = _useSharedPluginState.featureFlagsState;
|
|
87
86
|
if (!tableRef) {
|
|
88
87
|
return null;
|
|
89
88
|
}
|
|
@@ -93,7 +92,7 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
93
92
|
// Ignored via go/ees005
|
|
94
93
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
95
94
|
var isNested = tablePos !== undefined && (0, _nodes.isTableNested)(editorView.state, tablePos);
|
|
96
|
-
var shouldShowCornerControls =
|
|
95
|
+
var shouldShowCornerControls = isNested && !(0, _experiments.editorExperiment)('nested-dnd', true);
|
|
97
96
|
return (
|
|
98
97
|
/*#__PURE__*/
|
|
99
98
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -116,18 +115,36 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
116
115
|
updateCellHoverLocation: updateCellHoverLocation,
|
|
117
116
|
stickyTop: stickyTop,
|
|
118
117
|
isDragAndDropEnabled: isDragAndDropEnabled
|
|
119
|
-
}) : null, tableActive && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null,
|
|
118
|
+
}) : null, tableActive && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _platformFeatureFlags.fg)('platform_editor_table_use_shared_state_hook_fg') ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, shouldShowCornerControls && /*#__PURE__*/_react.default.createElement(_DragCornerControls.DragCornerControlsWithSelection, {
|
|
120
119
|
editorView: editorView,
|
|
121
120
|
tableRef: tableRef,
|
|
122
121
|
isInDanger: isInDanger,
|
|
123
122
|
isResizing: isResizing,
|
|
124
123
|
api: api
|
|
125
|
-
})
|
|
124
|
+
}), /*#__PURE__*/_react.default.createElement(_DragControls.DragControlsWithSelection, {
|
|
125
|
+
tableRef: tableRef,
|
|
126
|
+
tableNode: tableNode,
|
|
127
|
+
hoveredCell: hoveredCell,
|
|
128
|
+
isTableHovered: isTableHovered,
|
|
129
|
+
editorView: editorView,
|
|
130
|
+
tableActive: tableActive,
|
|
131
|
+
isInDanger: isInDanger,
|
|
132
|
+
isResizing: isResizing
|
|
133
|
+
// Ignored via go/ees005
|
|
134
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
135
|
+
,
|
|
136
|
+
tableWidth: tableWrapperWidth,
|
|
137
|
+
hoverRows: _hoverRows,
|
|
138
|
+
selectRow: _selectRow,
|
|
139
|
+
selectRows: _selectRows,
|
|
140
|
+
updateCellHoverLocation: updateCellHoverLocation,
|
|
141
|
+
api: api
|
|
142
|
+
})) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, shouldShowCornerControls && /*#__PURE__*/_react.default.createElement(_DragCornerControls.DragCornerControls, {
|
|
126
143
|
editorView: editorView,
|
|
127
144
|
tableRef: tableRef,
|
|
128
145
|
isInDanger: isInDanger,
|
|
129
146
|
isResizing: isResizing
|
|
130
|
-
})
|
|
147
|
+
}), /*#__PURE__*/_react.default.createElement(_DragControls.DragControls, {
|
|
131
148
|
tableRef: tableRef,
|
|
132
149
|
tableNode: tableNode,
|
|
133
150
|
hoveredCell: hoveredCell,
|
|
@@ -144,7 +161,7 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
144
161
|
selectRow: _selectRow,
|
|
145
162
|
selectRows: _selectRows,
|
|
146
163
|
updateCellHoverLocation: updateCellHoverLocation
|
|
147
|
-
})) : (0,
|
|
164
|
+
}))) : (0, _platformFeatureFlags.fg)('platform_editor_table_use_shared_state_hook_fg') ? /*#__PURE__*/_react.default.createElement(_FloatingControlsWithSelection.FloatingControlsWithSelection, {
|
|
148
165
|
editorView: editorView,
|
|
149
166
|
tableRef: tableRef,
|
|
150
167
|
isInDanger: isInDanger,
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -551,10 +551,7 @@ var getColumnSettingItems = function getColumnSettingItems(editorState, editorVi
|
|
|
551
551
|
}
|
|
552
552
|
return items;
|
|
553
553
|
};
|
|
554
|
-
var getColorPicker = function getColorPicker(state, menu, _ref5, editorAnalyticsAPI, getEditorView
|
|
555
|
-
// Ignored via go/ees005
|
|
556
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
557
|
-
) {
|
|
554
|
+
var getColorPicker = function getColorPicker(state, menu, _ref5, editorAnalyticsAPI, getEditorView) {
|
|
558
555
|
var _node$attrs;
|
|
559
556
|
var formatMessage = _ref5.formatMessage;
|
|
560
557
|
var _getPluginState2 = (0, _pluginFactory.getPluginState)(state),
|
|
@@ -617,10 +614,7 @@ var highlightColumnsHandler = function highlightColumnsHandler(state, dispatch)
|
|
|
617
614
|
}
|
|
618
615
|
return false;
|
|
619
616
|
};
|
|
620
|
-
var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor, isCommentEditor
|
|
621
|
-
// Ignored via go/ees005
|
|
622
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
623
|
-
) {
|
|
617
|
+
var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor, isCommentEditor) {
|
|
624
618
|
var formatMessage = _ref6.formatMessage;
|
|
625
619
|
var tableObject = (0, _utils3.findTable)(editorState.selection);
|
|
626
620
|
if (!tableObject) {
|
|
@@ -699,10 +693,7 @@ var getSelectedAlignmentIcon = function getSelectedAlignmentIcon(alignmentIcons,
|
|
|
699
693
|
return icon.value === (0, _alignment.normaliseAlignment)(selectedAlignment);
|
|
700
694
|
});
|
|
701
695
|
};
|
|
702
|
-
var isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor
|
|
703
|
-
// Ignored via go/ees005
|
|
704
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
705
|
-
) {
|
|
696
|
+
var isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor) {
|
|
706
697
|
var _getEditorContainerWi = getEditorContainerWidth(),
|
|
707
698
|
lineLength = _getEditorContainerWi.lineLength;
|
|
708
699
|
var tableContainerWidth = (0, _nodeWidth.getTableContainerWidth)(selectedNode);
|
|
@@ -26,8 +26,6 @@ function delayUntilIdle(cb) {
|
|
|
26
26
|
// eslint-disable-next-line require-unicode-regexp
|
|
27
27
|
const cssVariablePattern = /^VAR\(--.*\)$/;
|
|
28
28
|
export default class TableCell extends TableNodeView {
|
|
29
|
-
// Ignored via go/ees005
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
31
29
|
constructor(node, view, getPos, eventDispatcher, editorAnalyticsAPI) {
|
|
32
30
|
super(node, view, getPos, eventDispatcher);
|
|
33
31
|
|
|
@@ -13,7 +13,6 @@ import { akEditorTableNumberColumnWidth, akEditorTableToolbarSize as tableToolba
|
|
|
13
13
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
16
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
17
16
|
import { autoSizeTable, clearHoverSelection } from '../pm-plugins/commands';
|
|
18
17
|
import { autoScrollerFactory } from '../pm-plugins/drag-and-drop/utils/autoscrollers';
|
|
19
18
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -668,7 +667,7 @@ class TableComponent extends React.Component {
|
|
|
668
667
|
isInDanger
|
|
669
668
|
} = this.props;
|
|
670
669
|
const table = findTable(view.state.selection);
|
|
671
|
-
if (
|
|
670
|
+
if (!fg('platform_editor_table_use_shared_state_hook_fg')) {
|
|
672
671
|
const pluginState = getPluginState(view.state);
|
|
673
672
|
isInDanger = pluginState.isInDanger;
|
|
674
673
|
}
|
|
@@ -802,7 +801,8 @@ class TableComponent extends React.Component {
|
|
|
802
801
|
isTableScalingEnabled,
|
|
803
802
|
// here we can use options.isTableScalingEnabled
|
|
804
803
|
allowTableResizing,
|
|
805
|
-
allowTableAlignment
|
|
804
|
+
allowTableAlignment,
|
|
805
|
+
selection
|
|
806
806
|
} = this.props;
|
|
807
807
|
let {
|
|
808
808
|
isInDanger,
|
|
@@ -816,7 +816,7 @@ class TableComponent extends React.Component {
|
|
|
816
816
|
showAfterShadow
|
|
817
817
|
} = this.state;
|
|
818
818
|
const node = getNode();
|
|
819
|
-
if (
|
|
819
|
+
if (!fg('platform_editor_table_use_shared_state_hook_fg')) {
|
|
820
820
|
const pluginState = getPluginState(view.state);
|
|
821
821
|
isInDanger = pluginState.isInDanger;
|
|
822
822
|
hoveredRows = pluginState.hoveredRows;
|
|
@@ -912,7 +912,7 @@ class TableComponent extends React.Component {
|
|
|
912
912
|
[ClassName.WITH_CONTROLS]: allowControls && tableActive,
|
|
913
913
|
[ClassName.TABLE_STICKY]: this.state.stickyHeader && hasHeaderRow,
|
|
914
914
|
[ClassName.HOVERED_DELETE_BUTTON]: isInDanger,
|
|
915
|
-
[ClassName.TABLE_SELECTED]: isTableSelected(view.state.selection)
|
|
915
|
+
[ClassName.TABLE_SELECTED]: isTableSelected(selection !== null && selection !== void 0 ? selection : view.state.selection)
|
|
916
916
|
}),
|
|
917
917
|
editorView: view,
|
|
918
918
|
getPos: getPos,
|
|
@@ -27,8 +27,9 @@ export const TableComponentWithSharedState = ({
|
|
|
27
27
|
const {
|
|
28
28
|
widthState,
|
|
29
29
|
tableState,
|
|
30
|
-
mediaState
|
|
31
|
-
|
|
30
|
+
mediaState,
|
|
31
|
+
selectionState
|
|
32
|
+
} = useSharedPluginState(api, ['width', 'table', 'media', 'selection']);
|
|
32
33
|
if (!tableState) {
|
|
33
34
|
return null;
|
|
34
35
|
}
|
|
@@ -66,7 +67,7 @@ export const TableComponentWithSharedState = ({
|
|
|
66
67
|
getPos: getPos,
|
|
67
68
|
isMediaFullscreen: mediaState === null || mediaState === void 0 ? void 0 : mediaState.isFullscreen,
|
|
68
69
|
options: options,
|
|
69
|
-
allowControls:
|
|
70
|
+
allowControls: allowControls,
|
|
70
71
|
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
71
72
|
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
72
73
|
isDragAndDropEnabled: options === null || options === void 0 ? void 0 : options.isDragAndDropEnabled,
|
|
@@ -89,6 +90,7 @@ export const TableComponentWithSharedState = ({
|
|
|
89
90
|
hoveredRows: hoveredRows,
|
|
90
91
|
hoveredCell: hoveredCell,
|
|
91
92
|
isTableHovered: isTableHovered,
|
|
92
|
-
isWholeTableInDanger: isWholeTableInDanger
|
|
93
|
+
isWholeTableInDanger: isWholeTableInDanger,
|
|
94
|
+
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
93
95
|
});
|
|
94
96
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
3
|
import classNames from 'classnames';
|
|
3
4
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
5
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
5
6
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
6
7
|
import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
9
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
|
|
8
10
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
9
11
|
import { TABLE_MAX_WIDTH, TABLE_OFFSET_IN_COMMENT_EDITOR } from '../pm-plugins/table-resizing/utils/consts';
|
|
@@ -254,7 +256,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
254
256
|
,
|
|
255
257
|
className: ClassName.TABLE_RESIZER_CONTAINER,
|
|
256
258
|
ref: containerRef
|
|
257
|
-
}, isLivePageViewMode ? /*#__PURE__*/React.createElement(InnerContainer
|
|
259
|
+
}, fg('platform_editor_live_page_prevent_table_recreation') ? null : isLivePageViewMode ? /*#__PURE__*/React.createElement(InnerContainer
|
|
258
260
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
259
261
|
, {
|
|
260
262
|
className: className,
|
|
@@ -271,7 +273,16 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
271
273
|
React.createElement(TableResizer, tableResizerProps, /*#__PURE__*/React.createElement(InnerContainer, {
|
|
272
274
|
className: className,
|
|
273
275
|
node: node
|
|
274
|
-
}, children)))
|
|
276
|
+
}, children)), fg('platform_editor_live_page_prevent_table_recreation') ?
|
|
277
|
+
/*#__PURE__*/
|
|
278
|
+
// Ignored via go/ees005
|
|
279
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
280
|
+
React.createElement(TableResizer, _extends({}, tableResizerProps, {
|
|
281
|
+
disabled: isLivePageViewMode
|
|
282
|
+
}), /*#__PURE__*/React.createElement(InnerContainer, {
|
|
283
|
+
className: className,
|
|
284
|
+
node: node
|
|
285
|
+
}, children)) : null));
|
|
275
286
|
});
|
|
276
287
|
export const TableContainer = ({
|
|
277
288
|
children,
|
|
@@ -72,10 +72,7 @@ const getResizerMinWidth = node => {
|
|
|
72
72
|
* @param isTableScalingEnabled
|
|
73
73
|
* @param isFullWidthModeEnabled
|
|
74
74
|
*/
|
|
75
|
-
const getVisibleGuidelines = (guidelines, containerWidth, lineLength, isTableScalingEnabled, isFullWidthModeEnabled
|
|
76
|
-
// Ignored via go/ees005
|
|
77
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
78
|
-
) => {
|
|
75
|
+
const getVisibleGuidelines = (guidelines, containerWidth, lineLength, isTableScalingEnabled, isFullWidthModeEnabled) => {
|
|
79
76
|
let guidelineVisibleAdjustment = TABLE_GUIDELINE_VISIBLE_ADJUSTMENT;
|
|
80
77
|
if (isTableScalingEnabled) {
|
|
81
78
|
// Notes:
|
|
@@ -116,7 +113,8 @@ export const TableResizer = ({
|
|
|
116
113
|
shouldUseIncreasedScalingPercent,
|
|
117
114
|
pluginInjectionApi,
|
|
118
115
|
isFullWidthModeEnabled,
|
|
119
|
-
isCommentEditor
|
|
116
|
+
isCommentEditor,
|
|
117
|
+
disabled
|
|
120
118
|
}) => {
|
|
121
119
|
var _editorView$state, _pluginInjectionApi$a2;
|
|
122
120
|
const currentGap = useRef(0);
|
|
@@ -186,10 +184,7 @@ export const TableResizer = ({
|
|
|
186
184
|
// was hardcoded to 0, using PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
|
|
187
185
|
isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPaddingDynamic() : containerWidth, excludeGuidelineConfig) : defaultSnappingWidths
|
|
188
186
|
} : undefined, [snappingEnabled, isTableScalingEnabled, excludeGuidelineConfig, containerWidth, lineLength, isFullWidthModeEnabled]);
|
|
189
|
-
const switchToCenterAlignment = useCallback((pos, node, newWidth, state, dispatch
|
|
190
|
-
// Ignored via go/ees005
|
|
191
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
192
|
-
) => {
|
|
187
|
+
const switchToCenterAlignment = useCallback((pos, node, newWidth, state, dispatch) => {
|
|
193
188
|
if (shouldChangeAlignmentToCenterResized(isTableAlignmentEnabled, node, lineLength, newWidth) && isResizing.current) {
|
|
194
189
|
var _pluginInjectionApi$a;
|
|
195
190
|
const tableNodeWithPos = {
|
|
@@ -477,7 +472,7 @@ export const TableResizer = ({
|
|
|
477
472
|
const resizeRatio = !isTableAlignmentEnabled || isTableAlignmentEnabled && normaliseAlignment(node.attrs.layout) === ALIGN_CENTER ? 2 : 1;
|
|
478
473
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ResizerNext, {
|
|
479
474
|
ref: resizerRef,
|
|
480
|
-
enable: handles,
|
|
475
|
+
enable: fg('platform_editor_live_page_prevent_table_recreation') ? disabled ? {} : handles : handles,
|
|
481
476
|
width: width,
|
|
482
477
|
handleAlignmentMethod: "sticky",
|
|
483
478
|
handleSize: handleSize,
|
|
@@ -19,8 +19,6 @@ const HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200;
|
|
|
19
19
|
// if too short it would trigger too many dom updates.
|
|
20
20
|
const HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT = 400;
|
|
21
21
|
export default class TableRow extends TableNodeView {
|
|
22
|
-
// Ignored via go/ees005
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
24
22
|
constructor(node, view, getPos, eventDispatcher) {
|
|
25
23
|
super(node, view, getPos, eventDispatcher);
|
|
26
24
|
_defineProperty(this, "colControlsOffset", 0);
|
|
@@ -15,10 +15,7 @@ export const lazyTableView = options => {
|
|
|
15
15
|
'./table').then(({
|
|
16
16
|
createTableView
|
|
17
17
|
}) => {
|
|
18
|
-
return (node, view, getPos, decorations, getNodeViewOptions
|
|
19
|
-
// Ignored via go/ees005
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
21
|
-
) => {
|
|
18
|
+
return (node, view, getPos, decorations, getNodeViewOptions) => {
|
|
22
19
|
const {
|
|
23
20
|
portalProviderAPI,
|
|
24
21
|
eventDispatcher,
|
|
@@ -52,10 +49,7 @@ export const lazyTableCellView = options => {
|
|
|
52
49
|
'./TableCell').then(({
|
|
53
50
|
default: TableCell
|
|
54
51
|
}) => {
|
|
55
|
-
return (node, view, getPos, decorations, getNodeViewOptions
|
|
56
|
-
// Ignored via go/ees005
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
58
|
-
) => {
|
|
52
|
+
return (node, view, getPos, decorations, getNodeViewOptions) => {
|
|
59
53
|
var _pluginInjectionApi$a;
|
|
60
54
|
const {
|
|
61
55
|
eventDispatcher,
|
|
@@ -84,10 +78,7 @@ export const lazyTableHeaderView = options => {
|
|
|
84
78
|
'./TableCell').then(({
|
|
85
79
|
default: TableCell
|
|
86
80
|
}) => {
|
|
87
|
-
return (node, view, getPos, decorations, getNodeViewOptions
|
|
88
|
-
// Ignored via go/ees005
|
|
89
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
90
|
-
) => {
|
|
81
|
+
return (node, view, getPos, decorations, getNodeViewOptions) => {
|
|
91
82
|
var _pluginInjectionApi$a2;
|
|
92
83
|
const {
|
|
93
84
|
eventDispatcher,
|
|
@@ -115,10 +106,7 @@ export const lazyTableRowView = options => {
|
|
|
115
106
|
'./TableRow').then(({
|
|
116
107
|
default: TableRow
|
|
117
108
|
}) => {
|
|
118
|
-
return (node, view, getPos, decorations, getNodeViewOptions
|
|
119
|
-
// Ignored via go/ees005
|
|
120
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
121
|
-
) => {
|
|
109
|
+
return (node, view, getPos, decorations, getNodeViewOptions) => {
|
|
122
110
|
const {
|
|
123
111
|
eventDispatcher
|
|
124
112
|
} = getNodeViewOptions();
|
|
@@ -7,7 +7,6 @@ import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
|
7
7
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
8
8
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
10
|
import { pluginConfig as getPluginConfig } from '../pm-plugins/create-plugin-config';
|
|
12
11
|
import { pluginKey as tableDragAndDropPluginKey } from '../pm-plugins/drag-and-drop/plugin-key';
|
|
13
12
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -28,10 +27,7 @@ const tableAttributes = node => {
|
|
|
28
27
|
'data-table-display-mode': node.attrs.displayMode
|
|
29
28
|
};
|
|
30
29
|
};
|
|
31
|
-
const getInlineWidth = (node, options, state, pos, allowTableResizing
|
|
32
|
-
// Ignored via go/ees005
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
34
|
-
) => {
|
|
30
|
+
const getInlineWidth = (node, options, state, pos, allowTableResizing) => {
|
|
35
31
|
if (!node.attrs.width && options !== null && options !== void 0 && options.isCommentEditor && allowTableResizing) {
|
|
36
32
|
return;
|
|
37
33
|
}
|
|
@@ -109,7 +105,7 @@ export default class TableView extends ReactNodeView {
|
|
|
109
105
|
}
|
|
110
106
|
}
|
|
111
107
|
render(props, forwardRef) {
|
|
112
|
-
if (
|
|
108
|
+
if (fg('platform_editor_table_use_shared_state_hook_fg')) {
|
|
113
109
|
return /*#__PURE__*/React.createElement(TableComponentWithSharedState, {
|
|
114
110
|
forwardRef: forwardRef,
|
|
115
111
|
getNode: this.getNode,
|
|
@@ -294,10 +290,7 @@ export default class TableView extends ReactNodeView {
|
|
|
294
290
|
super.destroy();
|
|
295
291
|
}
|
|
296
292
|
}
|
|
297
|
-
export const createTableView = (node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isCommentEditor, isChromelessEditor
|
|
298
|
-
// Ignored via go/ees005
|
|
299
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
300
|
-
) => {
|
|
293
|
+
export const createTableView = (node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isCommentEditor, isChromelessEditor) => {
|
|
301
294
|
var _pluginInjectionApi$t;
|
|
302
295
|
const {
|
|
303
296
|
pluginConfig,
|
|
@@ -18,10 +18,7 @@ import { getSelectedColumnIndexes } from '../utils/selection';
|
|
|
18
18
|
const getTablePluginCommand = (actionPayload, originalTr) => {
|
|
19
19
|
return createCommand(() => actionPayload, tr => (originalTr || tr).setMeta('addToHistory', false));
|
|
20
20
|
};
|
|
21
|
-
const updateResizeHandleAndStatePosition = (rowIndex, columnIndex, nextResizeHandlePos, nodeViewPortalProviderAPI
|
|
22
|
-
// Ignored via go/ees005
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
24
|
-
) => (state, dispatch) => {
|
|
21
|
+
const updateResizeHandleAndStatePosition = (rowIndex, columnIndex, nextResizeHandlePos, nodeViewPortalProviderAPI) => (state, dispatch) => {
|
|
25
22
|
let customTr = state.tr;
|
|
26
23
|
const {
|
|
27
24
|
pluginConfig: {
|
|
@@ -167,10 +167,7 @@ export const insertRowWithAnalytics = editorAnalyticsAPI => (inputMethod, option
|
|
|
167
167
|
eventType: EVENT_TYPE.TRACK
|
|
168
168
|
};
|
|
169
169
|
})(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow));
|
|
170
|
-
export const changeColumnWidthByStepWithAnalytics = (editorAnalyticsAPI, api) => (stepSize, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor, inputMethod, ariaNotify, getIntl
|
|
171
|
-
// Ignored via go/ees005
|
|
172
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
173
|
-
) => withEditorAnalyticsAPI(state => {
|
|
170
|
+
export const changeColumnWidthByStepWithAnalytics = (editorAnalyticsAPI, api) => (stepSize, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor, inputMethod, ariaNotify, getIntl) => withEditorAnalyticsAPI(state => {
|
|
174
171
|
const {
|
|
175
172
|
table,
|
|
176
173
|
totalRowCount,
|
|
@@ -205,10 +202,7 @@ export const changeColumnWidthByStepWithAnalytics = (editorAnalyticsAPI, api) =>
|
|
|
205
202
|
getIntl: getIntl,
|
|
206
203
|
api
|
|
207
204
|
}));
|
|
208
|
-
export const insertColumnWithAnalytics = (api, editorAnalyticsAPI, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
209
|
-
// Ignored via go/ees005
|
|
210
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
211
|
-
) => (inputMethod, position) => withEditorAnalyticsAPI(state => {
|
|
205
|
+
export const insertColumnWithAnalytics = (api, editorAnalyticsAPI, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => (inputMethod, position) => withEditorAnalyticsAPI(state => {
|
|
212
206
|
const {
|
|
213
207
|
totalRowCount,
|
|
214
208
|
totalColumnCount
|
|
@@ -252,10 +246,7 @@ export const deleteRowsWithAnalytics = editorAnalyticsAPI => (inputMethod, rect,
|
|
|
252
246
|
}
|
|
253
247
|
return true;
|
|
254
248
|
});
|
|
255
|
-
export const deleteColumnsWithAnalytics = (editorAnalyticsAPI, api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
256
|
-
// Ignored via go/ees005
|
|
257
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
258
|
-
) => (inputMethod, rect) => withEditorAnalyticsAPI(({
|
|
249
|
+
export const deleteColumnsWithAnalytics = (editorAnalyticsAPI, api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => (inputMethod, rect) => withEditorAnalyticsAPI(({
|
|
259
250
|
selection
|
|
260
251
|
}) => {
|
|
261
252
|
const {
|
|
@@ -276,10 +267,7 @@ export const deleteColumnsWithAnalytics = (editorAnalyticsAPI, api, isTableScali
|
|
|
276
267
|
eventType: EVENT_TYPE.TRACK
|
|
277
268
|
};
|
|
278
269
|
})(editorAnalyticsAPI)(deleteColumnsCommand(rect, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor));
|
|
279
|
-
export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut = (editorAnalyticsAPI, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent
|
|
280
|
-
// Ignored via go/ees005
|
|
281
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
282
|
-
) => (state, dispatch) => {
|
|
270
|
+
export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut = (editorAnalyticsAPI, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent) => (state, dispatch) => {
|
|
283
271
|
const {
|
|
284
272
|
selection
|
|
285
273
|
} = state;
|
|
@@ -477,10 +465,7 @@ export const toggleFixedColumnWidthsOptionAnalytics = (editorAnalyticsAPI, input
|
|
|
477
465
|
eventType: EVENT_TYPE.TRACK
|
|
478
466
|
};
|
|
479
467
|
})(editorAnalyticsAPI)(editorCommandToPMCommand(setTableDisplayMode));
|
|
480
|
-
export const setTableAlignmentWithAnalytics = (editorAnalyticsAPI, isCommentEditor) => (newAlignment, previousAlignment, inputMethod, reason
|
|
481
|
-
// Ignored via go/ees005
|
|
482
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
483
|
-
) => withEditorAnalyticsAPI(state => {
|
|
468
|
+
export const setTableAlignmentWithAnalytics = (editorAnalyticsAPI, isCommentEditor) => (newAlignment, previousAlignment, inputMethod, reason) => withEditorAnalyticsAPI(state => {
|
|
484
469
|
const {
|
|
485
470
|
table,
|
|
486
471
|
totalRowCount,
|
|
@@ -502,10 +487,7 @@ export const setTableAlignmentWithAnalytics = (editorAnalyticsAPI, isCommentEdit
|
|
|
502
487
|
}
|
|
503
488
|
};
|
|
504
489
|
})(editorAnalyticsAPI)(editorCommandToPMCommand(setTableAlignment(newAlignment, isCommentEditor)));
|
|
505
|
-
export const setTableAlignmentWithTableContentWithPosWithAnalytics = editorAnalyticsAPI => (newAlignment, previousAlignment, tableNodeWithPos, inputMethod, reason
|
|
506
|
-
// Ignored via go/ees005
|
|
507
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
508
|
-
) => withEditorAnalyticsAPI(() => {
|
|
490
|
+
export const setTableAlignmentWithTableContentWithPosWithAnalytics = editorAnalyticsAPI => (newAlignment, previousAlignment, tableNodeWithPos, inputMethod, reason) => withEditorAnalyticsAPI(() => {
|
|
509
491
|
const map = TableMap.get(tableNodeWithPos.node);
|
|
510
492
|
const totalRowCount = map.height;
|
|
511
493
|
const totalColumnCount = map.width;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { deleteColumns } from '../transforms/delete-columns';
|
|
2
2
|
import { getAllowAddColumnCustomStep } from '../utils/get-allow-add-column-custom-step';
|
|
3
|
-
export const deleteColumnsCommand = (rect, api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
4
|
-
// Ignored via go/ees005
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
6
|
-
) => (state, dispatch, view) => {
|
|
3
|
+
export const deleteColumnsCommand = (rect, api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => (state, dispatch, view) => {
|
|
7
4
|
const tr = deleteColumns(rect, getAllowAddColumnCustomStep(state), api, view, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(state.tr);
|
|
8
5
|
if (dispatch) {
|
|
9
6
|
dispatch(tr);
|