@atlaskit/editor-plugin-table 9.2.0 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/nodeviews/TableCell.js +0 -2
- 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 +2 -8
- 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 +12 -10
- package/dist/cjs/ui/FloatingInsertButton/getPopupOptions.js +0 -6
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -4
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +1 -4
- package/dist/cjs/ui/TableFloatingControls/index.js +1 -4
- package/dist/cjs/ui/toolbar.js +3 -12
- package/dist/es2019/nodeviews/TableCell.js +0 -2
- 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 +2 -8
- 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 +12 -10
- package/dist/es2019/ui/FloatingInsertButton/getPopupOptions.js +0 -6
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -4
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +1 -4
- package/dist/es2019/ui/TableFloatingControls/index.js +1 -5
- 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/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 +2 -8
- 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 +12 -10
- package/dist/esm/ui/FloatingInsertButton/getPopupOptions.js +0 -6
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -4
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +1 -4
- package/dist/esm/ui/TableFloatingControls/index.js +1 -4
- package/dist/esm/ui/toolbar.js +3 -12
- package/dist/types/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
- package/package.json +11 -5
- package/src/nodeviews/TableCell.ts +0 -2
- package/src/nodeviews/TableComponent.tsx +1 -1
- 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 +0 -4
- 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 +7 -2
- package/src/ui/FloatingInsertButton/getPopupOptions.ts +0 -4
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +1 -3
- package/src/ui/TableFloatingColumnControls/index.tsx +1 -1
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +0 -2
- package/src/ui/TableFloatingControls/index.tsx +1 -5
- package/src/ui/event-handlers.ts +0 -2
- package/src/ui/toolbar.tsx +0 -18
|
@@ -38,10 +38,7 @@ var validateTableCellNodeAttrs = function validateTableCellNodeAttrs(_ref, repor
|
|
|
38
38
|
//
|
|
39
39
|
// This row only spans two columns, yet it contains widths for 3.
|
|
40
40
|
// We remove the third width here, assumed duplicate content.
|
|
41
|
-
export var removeExtraneousColumnWidths = function removeExtraneousColumnWidths(node, basePos, tr, reportInvalidTableCellSpanAttrs
|
|
42
|
-
// Ignored via go/ees005
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
44
|
-
) {
|
|
41
|
+
export var removeExtraneousColumnWidths = function removeExtraneousColumnWidths(node, basePos, tr, reportInvalidTableCellSpanAttrs) {
|
|
45
42
|
var hasProblems = false;
|
|
46
43
|
tr = replaceCells(tr, node, basePos, function (cell) {
|
|
47
44
|
var _cell$attrs = cell.attrs,
|
|
@@ -92,10 +89,7 @@ export var fixTables = function fixTables(tr, reportInvalidTableCellSpanAttrs) {
|
|
|
92
89
|
//
|
|
93
90
|
// We use this when migrating TinyMCE tables for Confluence, for example:
|
|
94
91
|
// https://pug.jira-dev.com/wiki/spaces/AEC/pages/3362882215/How+do+we+map+TinyMCE+tables+to+Fabric+tables
|
|
95
|
-
export var fixAutoSizedTable = function fixAutoSizedTable(view, tableNode, tableRef, tablePos, opts
|
|
96
|
-
// Ignored via go/ees005
|
|
97
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
98
|
-
) {
|
|
92
|
+
export var fixAutoSizedTable = function fixAutoSizedTable(view, tableNode, tableRef, tablePos, opts) {
|
|
99
93
|
var tr = view.state.tr;
|
|
100
94
|
var domAtPos = view.domAtPos.bind(view);
|
|
101
95
|
var tableStart = tablePos + 1;
|
|
@@ -138,9 +132,6 @@ var getLayoutBasedOnWidth = function getLayoutBasedOnWidth(totalWidth) {
|
|
|
138
132
|
return 'default';
|
|
139
133
|
}
|
|
140
134
|
};
|
|
141
|
-
|
|
142
|
-
// Ignored via go/ees005
|
|
143
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
144
135
|
function parseDOMColumnWidths(domAtPos, tableNode, tableStart, tableRef) {
|
|
145
136
|
var row = tableRef.querySelector('tr');
|
|
146
137
|
if (!row) {
|
|
@@ -165,10 +156,7 @@ function parseDOMColumnWidths(domAtPos, tableNode, tableStart, tableRef) {
|
|
|
165
156
|
}
|
|
166
157
|
|
|
167
158
|
// TODO: move to prosemirror-utils
|
|
168
|
-
var replaceCells = function replaceCells(tr, table, tablePos, modifyCell
|
|
169
|
-
// Ignored via go/ees005
|
|
170
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
171
|
-
) {
|
|
159
|
+
var replaceCells = function replaceCells(tr, table, tablePos, modifyCell) {
|
|
172
160
|
var rows = [];
|
|
173
161
|
var modifiedCells = 0;
|
|
174
162
|
for (var rowIndex = 0; rowIndex < table.childCount; rowIndex++) {
|
|
@@ -3,10 +3,7 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
5
5
|
import { getSelectedTableInfo } from '../utils/analytics';
|
|
6
|
-
export var replaceSelectedTable = function replaceSelectedTable(state, content, inputMethod, editorAnalyticsAPI
|
|
7
|
-
// Ignored via go/ees005
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
9
|
-
) {
|
|
6
|
+
export var replaceSelectedTable = function replaceSelectedTable(state, content, inputMethod, editorAnalyticsAPI) {
|
|
10
7
|
if (isTableSelected(state.selection)) {
|
|
11
8
|
var table = findTable(state.selection);
|
|
12
9
|
if (table) {
|
|
@@ -10,8 +10,6 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
10
10
|
* @param columnStart - Start of the rect included (rect.left)
|
|
11
11
|
* @param columnEnd - End of the rect not included (rect.right)
|
|
12
12
|
*/
|
|
13
|
-
// Ignored via go/ees005
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
15
13
|
export function splitCellsInColumns(tr, tablePos, columnStart, columnEnd) {
|
|
16
14
|
var mapStart = tr.mapping.maps.length;
|
|
17
15
|
var table = tr.doc.nodeAt(tablePos);
|
|
@@ -13,9 +13,6 @@ export var normaliseAlignment = function normaliseAlignment(layout) {
|
|
|
13
13
|
/**
|
|
14
14
|
* We don't want to switch alignment in Full-width editor
|
|
15
15
|
*/
|
|
16
|
-
export var shouldChangeAlignmentToCenterResized = function shouldChangeAlignmentToCenterResized(isTableAlignmentEnabled, tableNode, lineLength, updatedTableWidth
|
|
17
|
-
// Ignored via go/ees005
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
19
|
-
) {
|
|
16
|
+
export var shouldChangeAlignmentToCenterResized = function shouldChangeAlignmentToCenterResized(isTableAlignmentEnabled, tableNode, lineLength, updatedTableWidth) {
|
|
20
17
|
return Boolean(isTableAlignmentEnabled && tableNode && tableNode.attrs.layout === ALIGN_START && lineLength && updatedTableWidth > lineLength && lineLength < FULL_WIDTH_EDITOR_CONTENT_WIDTH);
|
|
21
18
|
};
|
|
@@ -33,10 +33,7 @@ export var createCellHoverDecoration = function createCellHoverDecoration(cells)
|
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
|
-
export var createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, tr, isDragAndDropEnable, hoveredIndexes, danger, selected
|
|
37
|
-
// Ignored via go/ees005
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
39
|
-
) {
|
|
36
|
+
export var createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, tr, isDragAndDropEnable, hoveredIndexes, danger, selected) {
|
|
40
37
|
var table = findTable(tr.selection);
|
|
41
38
|
if (!table) {
|
|
42
39
|
return [];
|
|
@@ -165,10 +162,7 @@ export var createColumnControlsDecoration = function createColumnControlsDecorat
|
|
|
165
162
|
});
|
|
166
163
|
});
|
|
167
164
|
};
|
|
168
|
-
export var updateDecorations = function updateDecorations(node, decorationSet, decorations, key
|
|
169
|
-
// Ignored via go/ees005
|
|
170
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
171
|
-
) {
|
|
165
|
+
export var updateDecorations = function updateDecorations(node, decorationSet, decorations, key) {
|
|
172
166
|
var filteredDecorations = filterDecorationByKey(key, decorationSet);
|
|
173
167
|
var decorationSetFiltered = decorationSet.remove(filteredDecorations);
|
|
174
168
|
return decorationSetFiltered.add(node, decorations);
|
|
@@ -259,10 +253,7 @@ var makeArray = function makeArray(n) {
|
|
|
259
253
|
export var createResizeHandleDecoration = function createResizeHandleDecoration(tr, rowIndexTarget, columnEndIndexTarget) {
|
|
260
254
|
var includeTooltip = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
261
255
|
var getIntl = arguments.length > 4 ? arguments[4] : undefined;
|
|
262
|
-
var nodeViewPortalProviderAPI
|
|
263
|
-
// Ignored via go/ees005
|
|
264
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
265
|
-
= arguments.length > 5 ? arguments[5] : undefined;
|
|
256
|
+
var nodeViewPortalProviderAPI = arguments.length > 5 ? arguments[5] : undefined;
|
|
266
257
|
var emptyResult = [[], []];
|
|
267
258
|
var table = findTable(tr.selection);
|
|
268
259
|
if (!table || !table.node) {
|
|
@@ -272,10 +263,7 @@ export var createResizeHandleDecoration = function createResizeHandleDecoration(
|
|
|
272
263
|
if (!map.width) {
|
|
273
264
|
return emptyResult;
|
|
274
265
|
}
|
|
275
|
-
var createResizerHandleDecoration = function createResizerHandleDecoration(cellColumnPositioning, columnIndex, rowIndex, cellPos, cellNode
|
|
276
|
-
// Ignored via go/ees005
|
|
277
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
278
|
-
) {
|
|
266
|
+
var createResizerHandleDecoration = function createResizerHandleDecoration(cellColumnPositioning, columnIndex, rowIndex, cellPos, cellNode) {
|
|
279
267
|
var decorationRenderKey = uuid();
|
|
280
268
|
var position = cellPos + cellNode.nodeSize - 1;
|
|
281
269
|
return Decoration.widget(position, function () {
|
|
@@ -39,10 +39,7 @@ import { getSelectedColumnIndexes, getSelectedRowIndexes } from './selection';
|
|
|
39
39
|
export var getTargetIndex = function getTargetIndex(selectedIndexes, direction) {
|
|
40
40
|
return Math[direction < 0 ? 'min' : 'max'].apply(Math, _toConsumableArray(selectedIndexes)) + direction;
|
|
41
41
|
};
|
|
42
|
-
export var canMove = function canMove(sourceType, direction, totalItemsOfSourceTypeCount, selection, selectionRect
|
|
43
|
-
// Ignored via go/ees005
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
45
|
-
) {
|
|
42
|
+
export var canMove = function canMove(sourceType, direction, totalItemsOfSourceTypeCount, selection, selectionRect) {
|
|
46
43
|
if (!selectionRect) {
|
|
47
44
|
return false;
|
|
48
45
|
}
|
|
@@ -73,9 +73,6 @@ export var tablesHaveDifferentNoOfRows = function tablesHaveDifferentNoOfRows(cu
|
|
|
73
73
|
var currentMap = TableMap.get(currentTable);
|
|
74
74
|
return prevMap.height !== currentMap.height;
|
|
75
75
|
};
|
|
76
|
-
|
|
77
|
-
// Ignored via go/ees005
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
79
76
|
function filterNearSelection(selection, findNode, predicate, defaultValue) {
|
|
80
77
|
var found = findNode(selection);
|
|
81
78
|
if (!found) {
|
|
@@ -6,6 +6,7 @@ import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
|
6
6
|
import { flatmap, mapChildren, mapSlice } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { Slice, Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
8
8
|
import { flatten, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
11
|
import { getPluginState } from '../plugin-factory';
|
|
11
12
|
|
|
@@ -22,6 +23,9 @@ export var unwrapContentFromTable = function unwrapContentFromTable(maybeTable)
|
|
|
22
23
|
content.push.apply(content, _toConsumableArray(flatten(maybeCell, false).map(function (child) {
|
|
23
24
|
return child.node;
|
|
24
25
|
})));
|
|
26
|
+
if (fg('platform_editor_nested_tables_paste_dupe_fix')) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
25
29
|
}
|
|
26
30
|
return true;
|
|
27
31
|
});
|
|
@@ -81,10 +81,7 @@ export var getRowsParams = function getRowsParams(rowsHeights) {
|
|
|
81
81
|
export var getRowClassNames = function getRowClassNames(index, selection) {
|
|
82
82
|
var hoveredRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
83
83
|
var isInDanger = arguments.length > 3 ? arguments[3] : undefined;
|
|
84
|
-
var isResizing
|
|
85
|
-
// Ignored via go/ees005
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
87
|
-
= arguments.length > 4 ? arguments[4] : undefined;
|
|
84
|
+
var isResizing = arguments.length > 4 ? arguments[4] : undefined;
|
|
88
85
|
var classNames = [];
|
|
89
86
|
if (isRowSelected(index)(selection) || hoveredRows.indexOf(index) > -1 && !isResizing) {
|
|
90
87
|
classNames.push(ClassName.HOVERED_CELL_ACTIVE);
|
package/dist/esm/tablePlugin.js
CHANGED
|
@@ -115,7 +115,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
115
115
|
actions: {
|
|
116
116
|
insertTable: function insertTable(analyticsPayload) {
|
|
117
117
|
return function (state, dispatch) {
|
|
118
|
-
|
|
118
|
+
var _options$tableOptions;
|
|
119
|
+
if (options !== null && options !== void 0 && (_options$tableOptions = options.tableOptions) !== null && _options$tableOptions !== void 0 && _options$tableOptions.allowNestedTables && fg('platform_editor_use_nested_table_pm_nodes')) {
|
|
119
120
|
return editorCommandToPMCommand(insertTableWithNestingSupport({
|
|
120
121
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
121
122
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
@@ -178,10 +179,11 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
178
179
|
} : insertTableWithSize(options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, options === null || options === void 0 ? void 0 : options.isCommentEditor)
|
|
179
180
|
},
|
|
180
181
|
nodes: function nodes() {
|
|
182
|
+
var _options$tableOptions2;
|
|
181
183
|
var _pluginConfig = pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions),
|
|
182
184
|
allowColumnResizing = _pluginConfig.allowColumnResizing;
|
|
183
185
|
// TODO: ED-25901 - We need to move this into a plugin config option so we don't accidentally enable nested nodes in Jira
|
|
184
|
-
var isNestingSupported = fg('platform_editor_use_nested_table_pm_nodes');
|
|
186
|
+
var isNestingSupported = (options === null || options === void 0 || (_options$tableOptions2 = options.tableOptions) === null || _options$tableOptions2 === void 0 ? void 0 : _options$tableOptions2.allowNestedTables) && fg('platform_editor_use_nested_table_pm_nodes');
|
|
185
187
|
return isNestingSupported ? [{
|
|
186
188
|
name: 'table',
|
|
187
189
|
node: tableNodeSpecWithFixedToDOM({
|
|
@@ -339,27 +341,27 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
339
341
|
}, {
|
|
340
342
|
name: 'tableWidth',
|
|
341
343
|
plugin: function plugin(_ref15) {
|
|
342
|
-
var _options$fullWidthEna, _options$isTableScali, _options$
|
|
344
|
+
var _options$fullWidthEna, _options$isTableScali, _options$tableOptions3, _options$isCommentEdi;
|
|
343
345
|
var dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent,
|
|
344
346
|
dispatch = _ref15.dispatch;
|
|
345
|
-
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$
|
|
347
|
+
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$tableOptions3 = options.tableOptions.allowTableResizing) !== null && _options$tableOptions3 !== void 0 ? _options$tableOptions3 : false, (_options$isCommentEdi = options.isCommentEditor) !== null && _options$isCommentEdi !== void 0 ? _options$isCommentEdi : false) : undefined;
|
|
346
348
|
}
|
|
347
349
|
}, {
|
|
348
350
|
name: 'tableWidthInCommentFix',
|
|
349
351
|
plugin: function plugin(_ref16) {
|
|
350
|
-
var _options$
|
|
352
|
+
var _options$tableOptions4;
|
|
351
353
|
var dispatch = _ref16.dispatch;
|
|
352
|
-
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing && options !== null && options !== void 0 && options.isCommentEditor ? createTableWidthInCommentFixPlugin(dispatch, (_options$
|
|
354
|
+
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing && options !== null && options !== void 0 && options.isCommentEditor ? createTableWidthInCommentFixPlugin(dispatch, (_options$tableOptions4 = options.tableOptions.allowTableAlignment) !== null && _options$tableOptions4 !== void 0 ? _options$tableOptions4 : false) : undefined;
|
|
353
355
|
}
|
|
354
356
|
},
|
|
355
357
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
356
358
|
{
|
|
357
359
|
name: 'tableOverflowAnalyticsPlugin',
|
|
358
360
|
plugin: function plugin(_ref17) {
|
|
359
|
-
var _options$
|
|
361
|
+
var _options$tableOptions5;
|
|
360
362
|
var dispatch = _ref17.dispatch,
|
|
361
363
|
dispatchAnalyticsEvent = _ref17.dispatchAnalyticsEvent;
|
|
362
|
-
return createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$
|
|
364
|
+
return createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$tableOptions5 = options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing) !== null && _options$tableOptions5 !== void 0 ? _options$tableOptions5 : false);
|
|
363
365
|
}
|
|
364
366
|
}, {
|
|
365
367
|
name: 'tableAnalyticsPlugin',
|
|
@@ -549,7 +551,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
549
551
|
return /*#__PURE__*/React.createElement(IconTable, null);
|
|
550
552
|
},
|
|
551
553
|
action: function action(insert, state) {
|
|
552
|
-
var _api$table;
|
|
554
|
+
var _api$table, _options$tableOptions6;
|
|
553
555
|
// see comment on tablesPlugin.getSharedState on usage
|
|
554
556
|
var tableState = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
|
|
555
557
|
var tableNodeProps = {
|
|
@@ -563,7 +565,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
563
565
|
var tableNode = createTableWithWidth(tableNodeProps)(state.schema);
|
|
564
566
|
var tr = state.tr;
|
|
565
567
|
// If the cursor is inside a table
|
|
566
|
-
if (hasParentNodeOfType(state.schema.nodes.table)(state.selection) && fg('platform_editor_use_nested_table_pm_nodes')) {
|
|
568
|
+
if (hasParentNodeOfType(state.schema.nodes.table)(state.selection) && options !== null && options !== void 0 && (_options$tableOptions6 = options.tableOptions) !== null && _options$tableOptions6 !== void 0 && _options$tableOptions6.allowNestedTables && fg('platform_editor_use_nested_table_pm_nodes')) {
|
|
567
569
|
// If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
|
|
568
570
|
if (editorExperiment('nested-tables-in-tables', false, {
|
|
569
571
|
exposure: true
|
|
@@ -32,9 +32,6 @@ function getRowOptions(index, isDragAndDropEnabled) {
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
// Ignored via go/ees005
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
38
35
|
function getColumnOptions(index, tableContainer, hasNumberedColumns, isDragAndDropEnabled) {
|
|
39
36
|
var options = {
|
|
40
37
|
alignX: 'end',
|
|
@@ -75,9 +72,6 @@ function getColumnOptions(index, tableContainer, hasNumberedColumns, isDragAndDr
|
|
|
75
72
|
}
|
|
76
73
|
return options;
|
|
77
74
|
}
|
|
78
|
-
|
|
79
|
-
// Ignored via go/ees005
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
81
75
|
function getPopupOptions(direction, index, hasNumberedColumns, isDragAndDropEnabled, tableContainer) {
|
|
82
76
|
switch (direction) {
|
|
83
77
|
case 'column':
|
|
@@ -128,10 +128,7 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
128
128
|
var _getScrollOffset;
|
|
129
129
|
columnControlsRef.current.scrollLeft = (_getScrollOffset = getScrollOffset === null || getScrollOffset === void 0 ? void 0 : getScrollOffset()) !== null && _getScrollOffset !== void 0 ? _getScrollOffset : 0;
|
|
130
130
|
}
|
|
131
|
-
var generateHandleByType = function generateHandleByType(type, appearance, gridColumn, indexes
|
|
132
|
-
// Ignored via go/ees005
|
|
133
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
134
|
-
) {
|
|
131
|
+
var generateHandleByType = function generateHandleByType(type, appearance, gridColumn, indexes) {
|
|
135
132
|
var _rowHeights$reduce, _colWidths$reduce;
|
|
136
133
|
var isHover = type === 'hover';
|
|
137
134
|
var isPlaceholder = appearance === 'placeholder';
|
|
@@ -131,10 +131,7 @@ export var DragControls = function DragControls(_ref) {
|
|
|
131
131
|
selectRows(selectedRowIndexes);
|
|
132
132
|
}
|
|
133
133
|
}, [rowIndex, selectRow, selectRows, selectedRowIndexes]);
|
|
134
|
-
var generateHandleByType = function generateHandleByType(type, appearance, gridRow, indexes
|
|
135
|
-
// Ignored via go/ees005
|
|
136
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
137
|
-
) {
|
|
134
|
+
var generateHandleByType = function generateHandleByType(type, appearance, gridRow, indexes) {
|
|
138
135
|
var isHover = type === 'hover';
|
|
139
136
|
var previewHeight = rowHeights.reduce(function (sum, v, i) {
|
|
140
137
|
return sum + v * (indexes.includes(i) ? 1 : 0);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
3
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
3
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
5
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -74,8 +73,6 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
|
74
73
|
hoverCell(rowIndex, 0)(state, dispatch);
|
|
75
74
|
}
|
|
76
75
|
}, [editorView, tableActive]);
|
|
77
|
-
var _useSharedPluginState = useSharedPluginState(api, ['featureFlags']),
|
|
78
|
-
featureFlagsState = _useSharedPluginState.featureFlagsState;
|
|
79
76
|
if (!tableRef) {
|
|
80
77
|
return null;
|
|
81
78
|
}
|
|
@@ -85,7 +82,7 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
|
85
82
|
// Ignored via go/ees005
|
|
86
83
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
87
84
|
var isNested = tablePos !== undefined && isTableNested(editorView.state, tablePos);
|
|
88
|
-
var shouldShowCornerControls =
|
|
85
|
+
var shouldShowCornerControls = isNested && !editorExperiment('nested-dnd', true);
|
|
89
86
|
return (
|
|
90
87
|
/*#__PURE__*/
|
|
91
88
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -543,10 +543,7 @@ var getColumnSettingItems = function getColumnSettingItems(editorState, editorVi
|
|
|
543
543
|
}
|
|
544
544
|
return items;
|
|
545
545
|
};
|
|
546
|
-
var getColorPicker = function getColorPicker(state, menu, _ref5, editorAnalyticsAPI, getEditorView
|
|
547
|
-
// Ignored via go/ees005
|
|
548
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
549
|
-
) {
|
|
546
|
+
var getColorPicker = function getColorPicker(state, menu, _ref5, editorAnalyticsAPI, getEditorView) {
|
|
550
547
|
var _node$attrs;
|
|
551
548
|
var formatMessage = _ref5.formatMessage;
|
|
552
549
|
var _getPluginState2 = getPluginState(state),
|
|
@@ -609,10 +606,7 @@ var highlightColumnsHandler = function highlightColumnsHandler(state, dispatch)
|
|
|
609
606
|
}
|
|
610
607
|
return false;
|
|
611
608
|
};
|
|
612
|
-
var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor, isCommentEditor
|
|
613
|
-
// Ignored via go/ees005
|
|
614
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
615
|
-
) {
|
|
609
|
+
var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor, isCommentEditor) {
|
|
616
610
|
var formatMessage = _ref6.formatMessage;
|
|
617
611
|
var tableObject = findTable(editorState.selection);
|
|
618
612
|
if (!tableObject) {
|
|
@@ -691,10 +685,7 @@ var getSelectedAlignmentIcon = function getSelectedAlignmentIcon(alignmentIcons,
|
|
|
691
685
|
return icon.value === normaliseAlignment(selectedAlignment);
|
|
692
686
|
});
|
|
693
687
|
};
|
|
694
|
-
var isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor
|
|
695
|
-
// Ignored via go/ees005
|
|
696
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
697
|
-
) {
|
|
688
|
+
var isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor) {
|
|
698
689
|
var _getEditorContainerWi = getEditorContainerWidth(),
|
|
699
690
|
lineLength = _getEditorContainerWi.lineLength;
|
|
700
691
|
var tableContainerWidth = getTableContainerWidth(selectedNode);
|
|
@@ -28,6 +28,7 @@ interface TableResizerProps {
|
|
|
28
28
|
isCommentEditor?: boolean;
|
|
29
29
|
onResizeStop?: () => void;
|
|
30
30
|
onResizeStart?: () => void;
|
|
31
|
+
disabled?: boolean;
|
|
31
32
|
}
|
|
32
|
-
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, lineLength, updateWidth, onResizeStop, onResizeStart, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, displayGapCursor, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, isWholeTableInDanger, shouldUseIncreasedScalingPercent, pluginInjectionApi, isFullWidthModeEnabled, isCommentEditor, }: PropsWithChildren<TableResizerProps>) => JSX.Element;
|
|
33
|
+
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, lineLength, updateWidth, onResizeStop, onResizeStart, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, displayGapCursor, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, isWholeTableInDanger, shouldUseIncreasedScalingPercent, pluginInjectionApi, isFullWidthModeEnabled, isCommentEditor, disabled, }: PropsWithChildren<TableResizerProps>) => JSX.Element;
|
|
33
34
|
export {};
|
|
@@ -28,6 +28,7 @@ interface TableResizerProps {
|
|
|
28
28
|
isCommentEditor?: boolean;
|
|
29
29
|
onResizeStop?: () => void;
|
|
30
30
|
onResizeStart?: () => void;
|
|
31
|
+
disabled?: boolean;
|
|
31
32
|
}
|
|
32
|
-
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, lineLength, updateWidth, onResizeStop, onResizeStart, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, displayGapCursor, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, isWholeTableInDanger, shouldUseIncreasedScalingPercent, pluginInjectionApi, isFullWidthModeEnabled, isCommentEditor, }: PropsWithChildren<TableResizerProps>) => JSX.Element;
|
|
33
|
+
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, lineLength, updateWidth, onResizeStop, onResizeStart, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, displayGapCursor, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, isWholeTableInDanger, shouldUseIncreasedScalingPercent, pluginInjectionApi, isFullWidthModeEnabled, isCommentEditor, disabled, }: PropsWithChildren<TableResizerProps>) => JSX.Element;
|
|
33
34
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.0",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
31
31
|
"@atlaskit/button": "^20.3.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.9.0",
|
|
33
|
-
"@atlaskit/editor-common": "^99.
|
|
33
|
+
"@atlaskit/editor-common": "^99.5.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.6.4",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
|
|
36
|
-
"@atlaskit/editor-plugin-analytics": "^1.
|
|
36
|
+
"@atlaskit/editor-plugin-analytics": "^1.11.0",
|
|
37
37
|
"@atlaskit/editor-plugin-batch-attribute-updates": "1.1.11",
|
|
38
38
|
"@atlaskit/editor-plugin-content-insertion": "^1.11.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
52
52
|
"@atlaskit/primitives": "^13.3.0",
|
|
53
53
|
"@atlaskit/theme": "^14.0.0",
|
|
54
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
54
|
+
"@atlaskit/tmp-editor-statsig": "^2.41.0",
|
|
55
55
|
"@atlaskit/toggle": "^14.0.0",
|
|
56
|
-
"@atlaskit/tokens": "^3.
|
|
56
|
+
"@atlaskit/tokens": "^3.2.0",
|
|
57
57
|
"@atlaskit/tooltip": "^19.0.0",
|
|
58
58
|
"@babel/runtime": "^7.0.0",
|
|
59
59
|
"@emotion/react": "^11.7.1",
|
|
@@ -137,6 +137,12 @@
|
|
|
137
137
|
},
|
|
138
138
|
"platform_editor_table_use_shared_state_hook_fg": {
|
|
139
139
|
"type": "boolean"
|
|
140
|
+
},
|
|
141
|
+
"platform_editor_live_page_prevent_table_recreation": {
|
|
142
|
+
"type": "boolean"
|
|
143
|
+
},
|
|
144
|
+
"platform_editor_nested_tables_paste_dupe_fix": {
|
|
145
|
+
"type": "boolean"
|
|
140
146
|
}
|
|
141
147
|
}
|
|
142
148
|
}
|
|
@@ -37,8 +37,6 @@ const cssVariablePattern = /^VAR\(--.*\)$/;
|
|
|
37
37
|
export default class TableCell extends TableNodeView<HTMLElement> implements NodeView {
|
|
38
38
|
private delayHandle: number | undefined;
|
|
39
39
|
|
|
40
|
-
// Ignored via go/ees005
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
42
40
|
constructor(
|
|
43
41
|
node: PMNode,
|
|
44
42
|
view: EditorView,
|
|
@@ -910,7 +910,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
910
910
|
const topShadowPadding = isDragAndDropEnabled ? 0 : shadowPadding;
|
|
911
911
|
const topOffset = fg('platform_editor_breakout_use_css')
|
|
912
912
|
? 0
|
|
913
|
-
:
|
|
913
|
+
: this.state.stickyHeader?.top ?? 0;
|
|
914
914
|
|
|
915
915
|
const topStickyShadowPosition =
|
|
916
916
|
this.state.stickyHeader && topOffset + this.state.stickyHeader.padding + topShadowPadding + 2;
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
akEditorGutterPaddingDynamic,
|
|
20
20
|
akEditorMobileBreakoutPoint,
|
|
21
21
|
} from '@atlaskit/editor-shared-styles';
|
|
22
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
23
|
|
|
23
24
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
|
|
24
25
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -360,7 +361,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
360
361
|
className={ClassName.TABLE_RESIZER_CONTAINER}
|
|
361
362
|
ref={containerRef}
|
|
362
363
|
>
|
|
363
|
-
{isLivePageViewMode ? (
|
|
364
|
+
{fg('platform_editor_live_page_prevent_table_recreation') ? null : isLivePageViewMode ? (
|
|
364
365
|
<InnerContainer
|
|
365
366
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
366
367
|
className={className}
|
|
@@ -380,6 +381,16 @@ export const ResizableTableContainer = React.memo(
|
|
|
380
381
|
</InnerContainer>
|
|
381
382
|
</TableResizer>
|
|
382
383
|
)}
|
|
384
|
+
{fg('platform_editor_live_page_prevent_table_recreation') ? (
|
|
385
|
+
// Ignored via go/ees005
|
|
386
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
387
|
+
<TableResizer {...tableResizerProps} disabled={isLivePageViewMode}>
|
|
388
|
+
{/* eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766 */}
|
|
389
|
+
<InnerContainer className={className} node={node}>
|
|
390
|
+
{children}
|
|
391
|
+
</InnerContainer>
|
|
392
|
+
</TableResizer>
|
|
393
|
+
) : null}
|
|
383
394
|
</div>
|
|
384
395
|
</AlignmentTableContainerWrapper>
|
|
385
396
|
);
|
|
@@ -7,8 +7,6 @@ export default abstract class TableNodeView<T extends HTMLElement> implements No
|
|
|
7
7
|
/**
|
|
8
8
|
* @constructor
|
|
9
9
|
*/
|
|
10
|
-
// Ignored via go/ees005
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
12
10
|
constructor(
|
|
13
11
|
protected node: PmNode,
|
|
14
12
|
protected readonly view: EditorView,
|
|
@@ -92,6 +92,7 @@ interface TableResizerProps {
|
|
|
92
92
|
isCommentEditor?: boolean;
|
|
93
93
|
onResizeStop?: () => void;
|
|
94
94
|
onResizeStart?: () => void;
|
|
95
|
+
disabled?: boolean;
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
type ResizerNextHandler = React.ElementRef<typeof ResizerNext>;
|
|
@@ -152,8 +153,6 @@ const getVisibleGuidelines = (
|
|
|
152
153
|
lineLength: number,
|
|
153
154
|
isTableScalingEnabled: boolean,
|
|
154
155
|
isFullWidthModeEnabled: boolean,
|
|
155
|
-
// Ignored via go/ees005
|
|
156
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
157
156
|
) => {
|
|
158
157
|
let guidelineVisibleAdjustment = TABLE_GUIDELINE_VISIBLE_ADJUSTMENT;
|
|
159
158
|
if (isTableScalingEnabled) {
|
|
@@ -205,6 +204,7 @@ export const TableResizer = ({
|
|
|
205
204
|
pluginInjectionApi,
|
|
206
205
|
isFullWidthModeEnabled,
|
|
207
206
|
isCommentEditor,
|
|
207
|
+
disabled,
|
|
208
208
|
}: PropsWithChildren<TableResizerProps>) => {
|
|
209
209
|
const currentGap = useRef(0);
|
|
210
210
|
// track resizing state - use ref over state to avoid re-render
|
|
@@ -325,8 +325,6 @@ export const TableResizer = ({
|
|
|
325
325
|
newWidth: any,
|
|
326
326
|
state: EditorState,
|
|
327
327
|
dispatch: ((tr: Transaction) => void) | undefined,
|
|
328
|
-
// Ignored via go/ees005
|
|
329
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
330
328
|
) => {
|
|
331
329
|
if (
|
|
332
330
|
shouldChangeAlignmentToCenterResized(isTableAlignmentEnabled, node, lineLength, newWidth) &&
|
|
@@ -793,7 +791,13 @@ export const TableResizer = ({
|
|
|
793
791
|
<>
|
|
794
792
|
<ResizerNext
|
|
795
793
|
ref={resizerRef}
|
|
796
|
-
enable={
|
|
794
|
+
enable={
|
|
795
|
+
fg('platform_editor_live_page_prevent_table_recreation')
|
|
796
|
+
? disabled
|
|
797
|
+
? {}
|
|
798
|
+
: handles
|
|
799
|
+
: handles
|
|
800
|
+
}
|
|
797
801
|
width={width}
|
|
798
802
|
handleAlignmentMethod="sticky"
|
|
799
803
|
handleSize={handleSize}
|
|
@@ -42,8 +42,6 @@ const HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200;
|
|
|
42
42
|
const HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT = 400;
|
|
43
43
|
|
|
44
44
|
export default class TableRow extends TableNodeView<HTMLTableRowElement> implements NodeView {
|
|
45
|
-
// Ignored via go/ees005
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
47
45
|
constructor(
|
|
48
46
|
node: PMNode,
|
|
49
47
|
view: EditorView,
|
|
@@ -55,8 +55,6 @@ export const lazyTableView = (options: TableViewOptions) => {
|
|
|
55
55
|
getPos: () => number | undefined,
|
|
56
56
|
decorations: readonly Decoration[],
|
|
57
57
|
getNodeViewOptions: () => TableViewOptions,
|
|
58
|
-
// Ignored via go/ees005
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
60
58
|
) => {
|
|
61
59
|
const {
|
|
62
60
|
portalProviderAPI,
|
|
@@ -122,8 +120,6 @@ export const lazyTableCellView = (options: TableCellViewOptions) => {
|
|
|
122
120
|
getPos: () => number | undefined,
|
|
123
121
|
decorations: readonly Decoration[],
|
|
124
122
|
getNodeViewOptions: () => TableCellViewOptions,
|
|
125
|
-
// Ignored via go/ees005
|
|
126
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
127
123
|
) => {
|
|
128
124
|
const { eventDispatcher, pluginInjectionApi } = getNodeViewOptions();
|
|
129
125
|
|
|
@@ -171,8 +167,6 @@ export const lazyTableHeaderView = (options: TableCellViewOptions) => {
|
|
|
171
167
|
getPos: () => number | undefined,
|
|
172
168
|
decorations: readonly Decoration[],
|
|
173
169
|
getNodeViewOptions: () => TableCellViewOptions,
|
|
174
|
-
// Ignored via go/ees005
|
|
175
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
176
170
|
) => {
|
|
177
171
|
const { eventDispatcher, pluginInjectionApi } = getNodeViewOptions();
|
|
178
172
|
|
|
@@ -214,8 +208,6 @@ export const lazyTableRowView = (options: TableCellViewOptions) => {
|
|
|
214
208
|
getPos: () => number | undefined,
|
|
215
209
|
decorations: readonly Decoration[],
|
|
216
210
|
getNodeViewOptions: () => TableCellViewOptions,
|
|
217
|
-
// Ignored via go/ees005
|
|
218
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
219
211
|
) => {
|
|
220
212
|
const { eventDispatcher } = getNodeViewOptions();
|
|
221
213
|
|
package/src/nodeviews/table.tsx
CHANGED
|
@@ -54,8 +54,6 @@ const getInlineWidth = (
|
|
|
54
54
|
state: EditorState,
|
|
55
55
|
pos: number | undefined,
|
|
56
56
|
allowTableResizing?: boolean,
|
|
57
|
-
// Ignored via go/ees005
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
59
57
|
): number | undefined => {
|
|
60
58
|
if (!node.attrs.width && options?.isCommentEditor && allowTableResizing) {
|
|
61
59
|
return;
|
|
@@ -398,8 +396,6 @@ export const createTableView = (
|
|
|
398
396
|
pluginInjectionApi?: PluginInjectionAPI,
|
|
399
397
|
isCommentEditor?: boolean,
|
|
400
398
|
isChromelessEditor?: boolean,
|
|
401
|
-
// Ignored via go/ees005
|
|
402
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
403
399
|
): NodeView => {
|
|
404
400
|
const {
|
|
405
401
|
pluginConfig,
|
|
@@ -59,8 +59,6 @@ const updateResizeHandleAndStatePosition =
|
|
|
59
59
|
columnIndex: number,
|
|
60
60
|
nextResizeHandlePos: number,
|
|
61
61
|
nodeViewPortalProviderAPI: PortalProviderAPI,
|
|
62
|
-
// Ignored via go/ees005
|
|
63
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
64
62
|
): Command =>
|
|
65
63
|
(state, dispatch) => {
|
|
66
64
|
let customTr = state.tr;
|