@atlaskit/editor-plugin-table 5.7.3 → 5.7.5
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 +14 -0
- package/dist/cjs/commands/insert.js +1 -1
- package/dist/cjs/nodeviews/TableComponent.js +4 -2
- package/dist/cjs/nodeviews/TableContainer.js +10 -5
- package/dist/cjs/nodeviews/TableResizer.js +7 -3
- package/dist/cjs/transforms/column-width.js +3 -105
- package/dist/cjs/transforms/delete-columns.js +2 -5
- package/dist/cjs/ui/common-styles.js +1 -1
- package/dist/cjs/utils/analytics.js +2 -1
- package/dist/es2019/commands/insert.js +1 -1
- package/dist/es2019/nodeviews/TableComponent.js +4 -2
- package/dist/es2019/nodeviews/TableContainer.js +10 -5
- package/dist/es2019/nodeviews/TableResizer.js +7 -3
- package/dist/es2019/transforms/column-width.js +4 -102
- package/dist/es2019/transforms/delete-columns.js +2 -5
- package/dist/es2019/ui/common-styles.js +1 -0
- package/dist/es2019/utils/analytics.js +2 -1
- package/dist/esm/commands/insert.js +1 -1
- package/dist/esm/nodeviews/TableComponent.js +4 -2
- package/dist/esm/nodeviews/TableContainer.js +10 -5
- package/dist/esm/nodeviews/TableResizer.js +7 -3
- package/dist/esm/transforms/column-width.js +4 -106
- package/dist/esm/transforms/delete-columns.js +2 -5
- package/dist/esm/ui/common-styles.js +1 -1
- package/dist/esm/utils/analytics.js +2 -1
- package/dist/types/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types/transforms/column-width.d.ts +1 -14
- package/dist/types/utils/analytics.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/transforms/column-width.d.ts +1 -14
- package/dist/types-ts4.5/utils/analytics.d.ts +1 -0
- package/package.json +2 -5
- package/src/__tests__/unit/commands/insert.ts +7 -0
- package/src/__tests__/unit/nodeviews/TableContainer.tsx +7 -0
- package/src/__tests__/unit/transforms/delete-columns.ts +147 -368
- package/src/commands/insert.ts +1 -3
- package/src/nodeviews/TableComponent.tsx +2 -1
- package/src/nodeviews/TableContainer.tsx +9 -0
- package/src/nodeviews/TableResizer.tsx +6 -0
- package/src/transforms/column-width.ts +4 -137
- package/src/transforms/delete-columns.ts +3 -9
- package/src/ui/common-styles.ts +1 -0
- package/src/utils/analytics.ts +2 -0
|
@@ -43,7 +43,8 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
43
43
|
getPos = _ref2.getPos,
|
|
44
44
|
tableRef = _ref2.tableRef,
|
|
45
45
|
isResizing = _ref2.isResizing,
|
|
46
|
-
pluginInjectionApi = _ref2.pluginInjectionApi
|
|
46
|
+
pluginInjectionApi = _ref2.pluginInjectionApi,
|
|
47
|
+
tableResizePerformance = _ref2.tableResizePerformance;
|
|
47
48
|
var containerRef = useRef(null);
|
|
48
49
|
var tableWidthRef = useRef(akEditorDefaultLayoutWidth);
|
|
49
50
|
var updateContainerHeight = useCallback(function (height) {
|
|
@@ -124,7 +125,8 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
124
125
|
tableRef: tableRef,
|
|
125
126
|
displayGuideline: displayGuideline,
|
|
126
127
|
attachAnalyticsEvent: attachAnalyticsEvent,
|
|
127
|
-
displayGapCursor: displayGapCursor
|
|
128
|
+
displayGapCursor: displayGapCursor,
|
|
129
|
+
tableResizePerformance: tableResizePerformance
|
|
128
130
|
};
|
|
129
131
|
if (getBooleanFF('platform.editor.resizing-table-height-improvement')) {
|
|
130
132
|
tableResizerProps = _objectSpread(_objectSpread({}, tableResizerProps), {}, {
|
|
@@ -136,7 +138,8 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
136
138
|
style: {
|
|
137
139
|
display: 'flex',
|
|
138
140
|
justifyContent: 'center'
|
|
139
|
-
}
|
|
141
|
+
},
|
|
142
|
+
contentEditable: tableResizePerformance && isResizing ? 'false' : undefined
|
|
140
143
|
}, /*#__PURE__*/React.createElement("div", {
|
|
141
144
|
style: {
|
|
142
145
|
width: tableWidthRef.current
|
|
@@ -162,7 +165,8 @@ export var TableContainer = function TableContainer(_ref3) {
|
|
|
162
165
|
tableRef = _ref3.tableRef,
|
|
163
166
|
isNested = _ref3.isNested,
|
|
164
167
|
isResizing = _ref3.isResizing,
|
|
165
|
-
pluginInjectionApi = _ref3.pluginInjectionApi
|
|
168
|
+
pluginInjectionApi = _ref3.pluginInjectionApi,
|
|
169
|
+
tableResizePerformance = _ref3.tableResizePerformance;
|
|
166
170
|
if (isTableResizingEnabled && !isNested) {
|
|
167
171
|
return /*#__PURE__*/React.createElement(ResizableTableContainer, {
|
|
168
172
|
className: className,
|
|
@@ -172,7 +176,8 @@ export var TableContainer = function TableContainer(_ref3) {
|
|
|
172
176
|
getPos: getPos,
|
|
173
177
|
tableRef: tableRef,
|
|
174
178
|
isResizing: isResizing,
|
|
175
|
-
pluginInjectionApi: pluginInjectionApi
|
|
179
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
180
|
+
tableResizePerformance: tableResizePerformance
|
|
176
181
|
}, children);
|
|
177
182
|
}
|
|
178
183
|
var tableWidth = isBreakoutEnabled ? calcTableWidth(node.attrs.layout, editorWidth) : 'inherit';
|
|
@@ -87,7 +87,8 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
87
87
|
tableRef = _ref.tableRef,
|
|
88
88
|
displayGuideline = _ref.displayGuideline,
|
|
89
89
|
attachAnalyticsEvent = _ref.attachAnalyticsEvent,
|
|
90
|
-
displayGapCursor = _ref.displayGapCursor
|
|
90
|
+
displayGapCursor = _ref.displayGapCursor,
|
|
91
|
+
tableResizePerformance = _ref.tableResizePerformance;
|
|
91
92
|
var currentGap = useRef(0);
|
|
92
93
|
// track resizing state - use ref over state to avoid re-render
|
|
93
94
|
var isResizing = useRef(false);
|
|
@@ -217,7 +218,10 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
217
218
|
var resizeFrameRatePayloads = generateResizeFrameRatePayloads({
|
|
218
219
|
docSize: state.doc.nodeSize,
|
|
219
220
|
frameRateSamples: frameRateSamples,
|
|
220
|
-
originalNode: node
|
|
221
|
+
originalNode: node,
|
|
222
|
+
experiments: {
|
|
223
|
+
tableResizePerformance: tableResizePerformance
|
|
224
|
+
}
|
|
221
225
|
});
|
|
222
226
|
resizeFrameRatePayloads.forEach(function (payload) {
|
|
223
227
|
var _attachAnalyticsEvent;
|
|
@@ -253,7 +257,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
253
257
|
onResizeStop();
|
|
254
258
|
}
|
|
255
259
|
return newWidth;
|
|
256
|
-
}, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure, onResizeStop]);
|
|
260
|
+
}, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure, onResizeStop, tableResizePerformance]);
|
|
257
261
|
var handleTableSizeChangeOnKeypress = useCallback(function (step) {
|
|
258
262
|
var newWidth = width + step;
|
|
259
263
|
if (newWidth > maxWidth || newWidth < resizerMinWidth) {
|
|
@@ -3,13 +3,11 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
6
|
-
import {
|
|
7
|
-
import { TableMap, tableNewColumnMinWidth } from '@atlaskit/editor-tables/table-map';
|
|
6
|
+
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
8
7
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils';
|
|
10
9
|
import { isMinCellWidthTable } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
11
|
-
import {
|
|
12
|
-
import { getResizeState, normaliseTableLayout } from '../pm-plugins/table-resizing/utils/resize-state';
|
|
10
|
+
import { getResizeState } from '../pm-plugins/table-resizing/utils/resize-state';
|
|
13
11
|
import { scaleTableTo } from '../pm-plugins/table-resizing/utils/scale-table';
|
|
14
12
|
import { insertColumnButtonOffset } from '../ui/common-styles';
|
|
15
13
|
|
|
@@ -89,7 +87,7 @@ export var updateColumnWidths = function updateColumnWidths(resizeState, table,
|
|
|
89
87
|
* @param view
|
|
90
88
|
* @returns Updated transaction with rescaled columns for a given table
|
|
91
89
|
*/
|
|
92
|
-
export var
|
|
90
|
+
export var rescaleColumns = function rescaleColumns() {
|
|
93
91
|
return function (table, view) {
|
|
94
92
|
return function (tr) {
|
|
95
93
|
var _tableRef$parentEleme, _tableRef$parentEleme2;
|
|
@@ -109,7 +107,7 @@ export var rescaleColumnsNew = function rescaleColumnsNew() {
|
|
|
109
107
|
// when table is resized the tableRef client width will be 1px larger than colGroup, which is used in calculations
|
|
110
108
|
width: isResized ? tableRef.clientWidth - 1 : tableRef.clientWidth,
|
|
111
109
|
/** the is the width the table can reach before overflowing */
|
|
112
|
-
possibleMaxWidth: getBooleanFF('platform.editor.custom-table-width') ? (tableRef === null || tableRef === void 0 || (_tableRef$parentEleme = tableRef.parentElement) === null || _tableRef$parentEleme === void 0 ? void 0 : _tableRef$parentEleme.clientWidth) || 0 : ((tableRef === null || tableRef === void 0 || (_tableRef$parentEleme2 = tableRef.parentElement) === null || _tableRef$parentEleme2 === void 0 ? void 0 : _tableRef$parentEleme2.clientWidth) || 0) - insertColumnButtonOffset
|
|
110
|
+
possibleMaxWidth: getBooleanFF('platform.editor.custom-table-width') ? (tableRef === null || tableRef === void 0 || (_tableRef$parentEleme = tableRef.parentElement) === null || _tableRef$parentEleme === void 0 ? void 0 : _tableRef$parentEleme.clientWidth) || 0 : ((tableRef === null || tableRef === void 0 || (_tableRef$parentEleme2 = tableRef.parentElement) === null || _tableRef$parentEleme2 === void 0 ? void 0 : _tableRef$parentEleme2.clientWidth) || 0) - insertColumnButtonOffset,
|
|
113
111
|
isResized: isResized
|
|
114
112
|
};
|
|
115
113
|
|
|
@@ -169,104 +167,4 @@ export var rescaleColumnsNew = function rescaleColumnsNew() {
|
|
|
169
167
|
return updateColumnWidths(resizeState, table.node, table.start)(tr);
|
|
170
168
|
};
|
|
171
169
|
};
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* This function is called when user inserts/deletes a column in a table to;
|
|
176
|
-
* - rescale all columns (if the table did not overflow before the insertion)
|
|
177
|
-
* - and update column widths.
|
|
178
|
-
*
|
|
179
|
-
* This is done manually to avoid a multi-dispatch in TableComponent. See [ED-8288].
|
|
180
|
-
* @param table
|
|
181
|
-
* @param view
|
|
182
|
-
* @returns Updated transaction with rescaled columns for a given table
|
|
183
|
-
*/
|
|
184
|
-
export var rescaleColumnsOld = function rescaleColumnsOld(getEditorContainerWidth) {
|
|
185
|
-
return function (table, view) {
|
|
186
|
-
return function (tr) {
|
|
187
|
-
var _tableRef$parentEleme3;
|
|
188
|
-
if (!view) {
|
|
189
|
-
return tr;
|
|
190
|
-
}
|
|
191
|
-
var pos = table.pos;
|
|
192
|
-
var newTable = tr.doc.nodeAt(pos);
|
|
193
|
-
var state = view.state;
|
|
194
|
-
var domAtPos = view.domAtPos.bind(view);
|
|
195
|
-
var maybeTable = domAtPos(table.start).node;
|
|
196
|
-
var tableRef = maybeTable.closest('table');
|
|
197
|
-
if (!tableRef || !newTable) {
|
|
198
|
-
return tr;
|
|
199
|
-
}
|
|
200
|
-
var layout = normaliseTableLayout(tableRef === null || tableRef === void 0 ? void 0 : tableRef.dataset.layout);
|
|
201
|
-
// The is the width the table can reach before overflowing
|
|
202
|
-
var maxSize = getTableMaxWidth({
|
|
203
|
-
table: table.node,
|
|
204
|
-
tableStart: table.start,
|
|
205
|
-
state: state,
|
|
206
|
-
layout: layout,
|
|
207
|
-
getEditorContainerWidth: getEditorContainerWidth
|
|
208
|
-
});
|
|
209
|
-
var tableWidth = tableRef.clientWidth || akEditorDefaultLayoutWidth;
|
|
210
|
-
var tableMaxWidth = (tableRef === null || tableRef === void 0 || (_tableRef$parentEleme3 = tableRef.parentElement) === null || _tableRef$parentEleme3 === void 0 ? void 0 : _tableRef$parentEleme3.clientWidth) || 0;
|
|
211
|
-
tableMaxWidth -= insertColumnButtonOffset;
|
|
212
|
-
var newTableMap = TableMap.get(newTable);
|
|
213
|
-
var noOfColumns = newTableMap.width;
|
|
214
|
-
if (!noOfColumns || noOfColumns <= 0) {
|
|
215
|
-
return tr;
|
|
216
|
-
}
|
|
217
|
-
var columnWidthUnresized = tableWidth / noOfColumns;
|
|
218
|
-
|
|
219
|
-
// If the table has not been resized, and the column width is bigger than the minimum column width
|
|
220
|
-
// we skip updating the size of columns here.
|
|
221
|
-
if (!hasTableBeenResized(table.node) && columnWidthUnresized > tableCellMinWidth) {
|
|
222
|
-
return tr;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// If the table has not been resized, and the column width is smaller than the minimum column width
|
|
226
|
-
// Or if the table has been resized, but each column width is either 48px or null
|
|
227
|
-
// we update the table to have 48px for each column
|
|
228
|
-
if (!hasTableBeenResized(table.node) && columnWidthUnresized <= tableCellMinWidth || hasTableBeenResized(table.node) && isMinCellWidthTable(table.node)) {
|
|
229
|
-
var widths = new Array(noOfColumns).fill(tableCellMinWidth);
|
|
230
|
-
var cols = widths.map(function (_, index) {
|
|
231
|
-
return {
|
|
232
|
-
width: tableCellMinWidth,
|
|
233
|
-
minWidth: tableCellMinWidth,
|
|
234
|
-
index: index
|
|
235
|
-
};
|
|
236
|
-
});
|
|
237
|
-
var overflow = tableWidth > maxSize;
|
|
238
|
-
var minWidthResizeState = {
|
|
239
|
-
cols: cols,
|
|
240
|
-
widths: widths,
|
|
241
|
-
maxSize: maxSize,
|
|
242
|
-
tableWidth: tableWidth,
|
|
243
|
-
overflow: overflow
|
|
244
|
-
};
|
|
245
|
-
return updateColumnWidths(minWidthResizeState, table.node, table.start)(tr);
|
|
246
|
-
}
|
|
247
|
-
var resizeState = getResizeState({
|
|
248
|
-
minWidth: tableCellMinWidth,
|
|
249
|
-
table: table.node,
|
|
250
|
-
start: table.start,
|
|
251
|
-
tableRef: tableRef,
|
|
252
|
-
domAtPos: domAtPos,
|
|
253
|
-
maxSize: maxSize
|
|
254
|
-
});
|
|
255
|
-
var previousTableWidth = resizeState.tableWidth - tableNewColumnMinWidth;
|
|
256
|
-
var tableDidntPreviouslyOverflow = previousTableWidth <= Math.max(maxSize, tableMaxWidth);
|
|
257
|
-
|
|
258
|
-
// If the new table width will result in the table going into an overflow state
|
|
259
|
-
// we resize the cells to avoid the overflow occuring
|
|
260
|
-
if (tableDidntPreviouslyOverflow && resizeState.overflow) {
|
|
261
|
-
resizeState = scaleTableTo(resizeState, maxSize);
|
|
262
|
-
}
|
|
263
|
-
return updateColumnWidths(resizeState, table.node, table.start)(tr);
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
};
|
|
267
|
-
export var rescaleColumns = function rescaleColumns(getEditorContainerWidth) {
|
|
268
|
-
if (getBooleanFF('platform.editor.table-update-colwidths-after-column-is-deleted')) {
|
|
269
|
-
return rescaleColumnsNew();
|
|
270
|
-
}
|
|
271
|
-
return rescaleColumnsOld(getEditorContainerWidth);
|
|
272
170
|
};
|
|
@@ -7,7 +7,6 @@ import { TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics
|
|
|
7
7
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
9
9
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
10
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { META_KEYS } from '../pm-plugins/table-analytics';
|
|
12
11
|
import { rescaleColumns } from './column-width';
|
|
13
12
|
import { splitCellsInColumns } from './split';
|
|
@@ -217,10 +216,8 @@ export var deleteColumns = function deleteColumns(rect, allowCustomStep, view) {
|
|
|
217
216
|
updatedTr = deleteColumnsLegacy(rect)(updatedTr);
|
|
218
217
|
}
|
|
219
218
|
var table = findTable(updatedTr.selection);
|
|
220
|
-
if (
|
|
221
|
-
|
|
222
|
-
updatedTr = rescaleColumns()(table, view)(updatedTr);
|
|
223
|
-
}
|
|
219
|
+
if (table) {
|
|
220
|
+
updatedTr = rescaleColumns()(table, view)(updatedTr);
|
|
224
221
|
}
|
|
225
222
|
return updatedTr;
|
|
226
223
|
};
|
|
@@ -23,7 +23,7 @@ export var tableRowHeight = 44;
|
|
|
23
23
|
var rangeSelectionStyles = "\n.".concat(ClassName.NODEVIEW_WRAPPER, ".").concat(akEditorSelectedNodeClassName, " table tbody tr {\n th,td {\n ").concat(getSelectionStyles([SelectionStyle.Blanket, SelectionStyle.Border]), "\n }\n}\n");
|
|
24
24
|
var sentinelStyles = ".".concat(ClassName.TABLE_CONTAINER, " {\n > .").concat(ClassName.TABLE_STICKY_SENTINEL_TOP, ", > .").concat(ClassName.TABLE_STICKY_SENTINEL_BOTTOM, " {\n position: absolute;\n width: 100%;\n height: 1px;\n margin-top: -1px;\n // need this to avoid sentinel being focused via keyboard\n // this still allows it to be detected by intersection observer\n visibility: hidden;\n }\n > .").concat(ClassName.TABLE_STICKY_SENTINEL_TOP, " {\n top: ").concat(columnControlsDecorationHeight, "px;\n }\n > .").concat(ClassName.TABLE_STICKY_SENTINEL_BOTTOM, " {\n bottom: ").concat(tableScrollbarOffset + stickyRowOffsetTop + tablePadding * 2 + 23, "px;\n }\n &.").concat(ClassName.WITH_CONTROLS, " {\n > .").concat(ClassName.TABLE_STICKY_SENTINEL_TOP, " {\n top: 0px;\n }\n > .").concat(ClassName.TABLE_STICKY_SENTINEL_BOTTOM, " {\n margin-bottom: ").concat(columnControlsDecorationHeight, "px;\n }\n }\n}");
|
|
25
25
|
var stickyScrollbarSentinelStyles = ".".concat(ClassName.TABLE_CONTAINER, " {\n > .").concat(ClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_BOTTOM, ",\n > .").concat(ClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_TOP, " {\n position: absolute;\n width: 100%;\n height: 1px;\n margin-top: -1px;\n // need this to avoid sentinel being focused via keyboard\n // this still allows it to be detected by intersection observer\n visibility: hidden;\n }\n > .").concat(ClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_TOP, " {\n top: ").concat(columnControlsDecorationHeight + tableRowHeight * 3, "px;\n }\n > .").concat(ClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_BOTTOM, " {\n bottom: ").concat(MAX_BROWSER_SCROLLBAR_HEIGHT, "px;\n }\n}");
|
|
26
|
-
var stickyScrollbarContainerStyles = ".".concat(ClassName.TABLE_CONTAINER, " {\n > .").concat(ClassName.TABLE_STICKY_SCROLLBAR_CONTAINER, " {\n width: 100%;\n display: none;\n overflow-x: auto;\n position: sticky;\n bottom: 0;\n }\n}");
|
|
26
|
+
var stickyScrollbarContainerStyles = ".".concat(ClassName.TABLE_CONTAINER, " {\n > .").concat(ClassName.TABLE_STICKY_SCROLLBAR_CONTAINER, " {\n width: 100%;\n display: none;\n overflow-x: auto;\n position: sticky;\n bottom: 0;\n z-index: 1;\n }\n}");
|
|
27
27
|
var stickyScrollbarStyles = function stickyScrollbarStyles(featureFlags) {
|
|
28
28
|
return featureFlags !== null && featureFlags !== void 0 && featureFlags.stickyScrollbar ? "".concat(stickyScrollbarContainerStyles, " ").concat(stickyScrollbarSentinelStyles) : '';
|
|
29
29
|
};
|
|
@@ -107,7 +107,8 @@ export var generateResizeFrameRatePayloads = function generateResizeFrameRatePay
|
|
|
107
107
|
frameRate: frameRateSample,
|
|
108
108
|
nodeSize: props.originalNode.nodeSize,
|
|
109
109
|
docSize: props.docSize,
|
|
110
|
-
isInitialSample: index === 0
|
|
110
|
+
isInitialSample: index === 0,
|
|
111
|
+
experiments: props.experiments
|
|
111
112
|
}
|
|
112
113
|
};
|
|
113
114
|
});
|
|
@@ -24,8 +24,9 @@ type ResizableTableContainerProps = {
|
|
|
24
24
|
tableRef: HTMLTableElement;
|
|
25
25
|
isResizing?: boolean;
|
|
26
26
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
27
|
+
tableResizePerformance?: boolean;
|
|
27
28
|
};
|
|
28
|
-
export declare const ResizableTableContainer: React.MemoExoticComponent<({ children, className, node, containerWidth, editorView, getPos, tableRef, isResizing, pluginInjectionApi, }: PropsWithChildren<ResizableTableContainerProps>) => JSX.Element>;
|
|
29
|
+
export declare const ResizableTableContainer: React.MemoExoticComponent<({ children, className, node, containerWidth, editorView, getPos, tableRef, isResizing, pluginInjectionApi, tableResizePerformance, }: PropsWithChildren<ResizableTableContainerProps>) => JSX.Element>;
|
|
29
30
|
type TableContainerProps = {
|
|
30
31
|
node: PMNode;
|
|
31
32
|
className: string;
|
|
@@ -38,6 +39,7 @@ type TableContainerProps = {
|
|
|
38
39
|
isNested: boolean;
|
|
39
40
|
isResizing?: boolean;
|
|
40
41
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
42
|
+
tableResizePerformance?: boolean;
|
|
41
43
|
};
|
|
42
|
-
export declare const TableContainer: ({ children, node, className, containerWidth: { lineLength, width: editorWidth }, isTableResizingEnabled, isBreakoutEnabled, editorView, getPos, tableRef, isNested, isResizing, pluginInjectionApi, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
|
|
44
|
+
export declare const TableContainer: ({ children, node, className, containerWidth: { lineLength, width: editorWidth }, isTableResizingEnabled, isBreakoutEnabled, editorView, getPos, tableRef, isNested, isResizing, pluginInjectionApi, tableResizePerformance, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
|
|
43
45
|
export {};
|
|
@@ -16,10 +16,11 @@ interface TableResizerProps {
|
|
|
16
16
|
displayGuideline: (guideline: GuidelineConfig[]) => boolean;
|
|
17
17
|
attachAnalyticsEvent: (payload: TableEventPayload) => ((tr: Transaction) => boolean) | undefined;
|
|
18
18
|
displayGapCursor: (toggle: boolean) => boolean;
|
|
19
|
+
tableResizePerformance?: boolean;
|
|
19
20
|
}
|
|
20
21
|
export interface TableResizerImprovementProps extends TableResizerProps {
|
|
21
22
|
onResizeStop?: () => void;
|
|
22
23
|
onResizeStart?: () => void;
|
|
23
24
|
}
|
|
24
|
-
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth, onResizeStop, onResizeStart, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, displayGapCursor, }: PropsWithChildren<TableResizerImprovementProps>) => JSX.Element;
|
|
25
|
+
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth, onResizeStop, onResizeStart, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, displayGapCursor, tableResizePerformance, }: PropsWithChildren<TableResizerImprovementProps>) => JSX.Element;
|
|
25
26
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
2
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
3
|
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -22,16 +21,4 @@ export declare const updateColumnWidths: (resizeState: ResizeState, table: PMNod
|
|
|
22
21
|
* @param view
|
|
23
22
|
* @returns Updated transaction with rescaled columns for a given table
|
|
24
23
|
*/
|
|
25
|
-
export declare const
|
|
26
|
-
/**
|
|
27
|
-
* This function is called when user inserts/deletes a column in a table to;
|
|
28
|
-
* - rescale all columns (if the table did not overflow before the insertion)
|
|
29
|
-
* - and update column widths.
|
|
30
|
-
*
|
|
31
|
-
* This is done manually to avoid a multi-dispatch in TableComponent. See [ED-8288].
|
|
32
|
-
* @param table
|
|
33
|
-
* @param view
|
|
34
|
-
* @returns Updated transaction with rescaled columns for a given table
|
|
35
|
-
*/
|
|
36
|
-
export declare const rescaleColumnsOld: (getEditorContainerWidth: GetEditorContainerWidth) => (table: ContentNodeWithPos, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
37
|
-
export declare const rescaleColumns: (getEditorContainerWidth?: GetEditorContainerWidth) => (table: ContentNodeWithPos, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
24
|
+
export declare const rescaleColumns: () => (table: ContentNodeWithPos, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
@@ -33,6 +33,7 @@ export declare const generateResizeFrameRatePayloads: (props: {
|
|
|
33
33
|
docSize: number;
|
|
34
34
|
frameRateSamples: number[];
|
|
35
35
|
originalNode: PMNode;
|
|
36
|
+
experiments?: Record<string, boolean | undefined>;
|
|
36
37
|
}) => TableEventPayload[];
|
|
37
38
|
/**
|
|
38
39
|
* Measures the framerate of a component over a given time period.
|
|
@@ -24,8 +24,9 @@ type ResizableTableContainerProps = {
|
|
|
24
24
|
tableRef: HTMLTableElement;
|
|
25
25
|
isResizing?: boolean;
|
|
26
26
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
27
|
+
tableResizePerformance?: boolean;
|
|
27
28
|
};
|
|
28
|
-
export declare const ResizableTableContainer: React.MemoExoticComponent<({ children, className, node, containerWidth, editorView, getPos, tableRef, isResizing, pluginInjectionApi, }: PropsWithChildren<ResizableTableContainerProps>) => JSX.Element>;
|
|
29
|
+
export declare const ResizableTableContainer: React.MemoExoticComponent<({ children, className, node, containerWidth, editorView, getPos, tableRef, isResizing, pluginInjectionApi, tableResizePerformance, }: PropsWithChildren<ResizableTableContainerProps>) => JSX.Element>;
|
|
29
30
|
type TableContainerProps = {
|
|
30
31
|
node: PMNode;
|
|
31
32
|
className: string;
|
|
@@ -38,6 +39,7 @@ type TableContainerProps = {
|
|
|
38
39
|
isNested: boolean;
|
|
39
40
|
isResizing?: boolean;
|
|
40
41
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
42
|
+
tableResizePerformance?: boolean;
|
|
41
43
|
};
|
|
42
|
-
export declare const TableContainer: ({ children, node, className, containerWidth: { lineLength, width: editorWidth }, isTableResizingEnabled, isBreakoutEnabled, editorView, getPos, tableRef, isNested, isResizing, pluginInjectionApi, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
|
|
44
|
+
export declare const TableContainer: ({ children, node, className, containerWidth: { lineLength, width: editorWidth }, isTableResizingEnabled, isBreakoutEnabled, editorView, getPos, tableRef, isNested, isResizing, pluginInjectionApi, tableResizePerformance, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
|
|
43
45
|
export {};
|
|
@@ -16,10 +16,11 @@ interface TableResizerProps {
|
|
|
16
16
|
displayGuideline: (guideline: GuidelineConfig[]) => boolean;
|
|
17
17
|
attachAnalyticsEvent: (payload: TableEventPayload) => ((tr: Transaction) => boolean) | undefined;
|
|
18
18
|
displayGapCursor: (toggle: boolean) => boolean;
|
|
19
|
+
tableResizePerformance?: boolean;
|
|
19
20
|
}
|
|
20
21
|
export interface TableResizerImprovementProps extends TableResizerProps {
|
|
21
22
|
onResizeStop?: () => void;
|
|
22
23
|
onResizeStart?: () => void;
|
|
23
24
|
}
|
|
24
|
-
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth, onResizeStop, onResizeStart, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, displayGapCursor, }: PropsWithChildren<TableResizerImprovementProps>) => JSX.Element;
|
|
25
|
+
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth, onResizeStop, onResizeStart, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, displayGapCursor, tableResizePerformance, }: PropsWithChildren<TableResizerImprovementProps>) => JSX.Element;
|
|
25
26
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
2
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
3
|
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -22,16 +21,4 @@ export declare const updateColumnWidths: (resizeState: ResizeState, table: PMNod
|
|
|
22
21
|
* @param view
|
|
23
22
|
* @returns Updated transaction with rescaled columns for a given table
|
|
24
23
|
*/
|
|
25
|
-
export declare const
|
|
26
|
-
/**
|
|
27
|
-
* This function is called when user inserts/deletes a column in a table to;
|
|
28
|
-
* - rescale all columns (if the table did not overflow before the insertion)
|
|
29
|
-
* - and update column widths.
|
|
30
|
-
*
|
|
31
|
-
* This is done manually to avoid a multi-dispatch in TableComponent. See [ED-8288].
|
|
32
|
-
* @param table
|
|
33
|
-
* @param view
|
|
34
|
-
* @returns Updated transaction with rescaled columns for a given table
|
|
35
|
-
*/
|
|
36
|
-
export declare const rescaleColumnsOld: (getEditorContainerWidth: GetEditorContainerWidth) => (table: ContentNodeWithPos, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
37
|
-
export declare const rescaleColumns: (getEditorContainerWidth?: GetEditorContainerWidth) => (table: ContentNodeWithPos, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
24
|
+
export declare const rescaleColumns: () => (table: ContentNodeWithPos, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
@@ -33,6 +33,7 @@ export declare const generateResizeFrameRatePayloads: (props: {
|
|
|
33
33
|
docSize: number;
|
|
34
34
|
frameRateSamples: number[];
|
|
35
35
|
originalNode: PMNode;
|
|
36
|
+
experiments?: Record<string, boolean | undefined>;
|
|
36
37
|
}) => TableEventPayload[];
|
|
37
38
|
/**
|
|
38
39
|
* Measures the framerate of a component over a given time period.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "5.7.
|
|
3
|
+
"version": "5.7.5",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^35.2.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.0.10",
|
|
33
|
-
"@atlaskit/editor-common": "^76.
|
|
33
|
+
"@atlaskit/editor-common": "^76.31.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.5.2",
|
|
35
35
|
"@atlaskit/editor-plugin-analytics": "^0.4.0",
|
|
36
36
|
"@atlaskit/editor-plugin-content-insertion": "^0.1.0",
|
|
@@ -125,9 +125,6 @@
|
|
|
125
125
|
"platform.editor.table.shift-arrowup-fix": {
|
|
126
126
|
"type": "boolean"
|
|
127
127
|
},
|
|
128
|
-
"platform.editor.table-update-colwidths-after-column-is-deleted": {
|
|
129
|
-
"type": "boolean"
|
|
130
|
-
},
|
|
131
128
|
"platform.editor.table.alternative-sticky-header-logic": {
|
|
132
129
|
"type": "boolean"
|
|
133
130
|
},
|
|
@@ -69,6 +69,11 @@ describe('table plugin: insert', () => {
|
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
it('does scale cells in tables which are not overflowing', () => {
|
|
72
|
+
jest
|
|
73
|
+
.spyOn(HTMLElement.prototype, 'clientWidth', 'get')
|
|
74
|
+
.mockImplementationOnce(() => 760)
|
|
75
|
+
.mockImplementationOnce(() => 770);
|
|
76
|
+
|
|
72
77
|
const { editorView } = editor(
|
|
73
78
|
doc(
|
|
74
79
|
table({ localId: TABLE_LOCAL_ID })(
|
|
@@ -97,6 +102,8 @@ describe('table plugin: insert', () => {
|
|
|
97
102
|
expect(updatedLastTableCellNode?.attrs.colwidth[0]).not.toBe(
|
|
98
103
|
lastTableCellNode?.attrs.colwidth[0],
|
|
99
104
|
);
|
|
105
|
+
|
|
106
|
+
jest.restoreAllMocks();
|
|
100
107
|
});
|
|
101
108
|
|
|
102
109
|
it('does not scale cells in tables which are overflowing', () => {
|
|
@@ -302,6 +302,7 @@ describe('table -> nodeviews -> TableContainer.tsx', () => {
|
|
|
302
302
|
analytics: { actions: { attachAnalyticsEvent: analyticsMock } },
|
|
303
303
|
} as any
|
|
304
304
|
}
|
|
305
|
+
tableResizePerformance={true}
|
|
305
306
|
/>,
|
|
306
307
|
);
|
|
307
308
|
|
|
@@ -326,6 +327,9 @@ describe('table -> nodeviews -> TableContainer.tsx', () => {
|
|
|
326
327
|
frameRate: 51,
|
|
327
328
|
isInitialSample: true,
|
|
328
329
|
nodeSize: 20,
|
|
330
|
+
experiments: {
|
|
331
|
+
tableResizePerformance: true,
|
|
332
|
+
},
|
|
329
333
|
},
|
|
330
334
|
});
|
|
331
335
|
|
|
@@ -338,6 +342,9 @@ describe('table -> nodeviews -> TableContainer.tsx', () => {
|
|
|
338
342
|
frameRate: 53,
|
|
339
343
|
isInitialSample: false,
|
|
340
344
|
nodeSize: 20,
|
|
345
|
+
experiments: {
|
|
346
|
+
tableResizePerformance: true,
|
|
347
|
+
},
|
|
341
348
|
},
|
|
342
349
|
});
|
|
343
350
|
|