@atlaskit/editor-plugin-table 7.16.14 → 7.16.16
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 +16 -0
- package/dist/cjs/commands/column-resize.js +6 -3
- package/dist/cjs/commands/delete.js +2 -1
- package/dist/cjs/commands/insert.js +8 -5
- package/dist/cjs/commands-with-analytics.js +6 -4
- package/dist/cjs/event-handlers.js +2 -1
- package/dist/cjs/nodeviews/TableComponent.js +21 -10
- package/dist/cjs/nodeviews/TableContainer.js +7 -3
- package/dist/cjs/nodeviews/TableResizer.js +3 -2
- package/dist/cjs/plugin.js +4 -3
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +4 -2
- package/dist/cjs/pm-plugins/keymap.js +5 -4
- package/dist/cjs/pm-plugins/main.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +12 -7
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +6 -5
- package/dist/cjs/pm-plugins/table-resizing/utils/consts.js +2 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/index.js +6 -0
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +6 -4
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +5 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +13 -8
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +17 -9
- package/dist/cjs/toolbar.js +7 -4
- package/dist/cjs/transforms/column-width.js +3 -1
- package/dist/cjs/transforms/delete-columns.js +2 -1
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +4 -2
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +4 -1
- package/dist/cjs/ui/FloatingInsertButton/index.js +3 -1
- package/dist/cjs/ui/TableFloatingControls/index.js +2 -2
- package/dist/cjs/utils/drag-menu.js +2 -1
- package/dist/es2019/commands/column-resize.js +6 -3
- package/dist/es2019/commands/delete.js +2 -2
- package/dist/es2019/commands/insert.js +8 -8
- package/dist/es2019/commands-with-analytics.js +6 -6
- package/dist/es2019/event-handlers.js +2 -2
- package/dist/es2019/nodeviews/TableComponent.js +21 -10
- package/dist/es2019/nodeviews/TableContainer.js +7 -3
- package/dist/es2019/nodeviews/TableResizer.js +3 -2
- package/dist/es2019/plugin.js +4 -3
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +4 -2
- package/dist/es2019/pm-plugins/keymap.js +5 -5
- package/dist/es2019/pm-plugins/main.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +12 -7
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +6 -6
- package/dist/es2019/pm-plugins/table-resizing/utils/consts.js +1 -0
- package/dist/es2019/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +7 -5
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +5 -5
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +12 -8
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +17 -12
- package/dist/es2019/toolbar.js +7 -7
- package/dist/es2019/transforms/column-width.js +3 -2
- package/dist/es2019/transforms/delete-columns.js +2 -2
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +4 -2
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +4 -1
- package/dist/es2019/ui/FloatingInsertButton/index.js +3 -1
- package/dist/es2019/ui/TableFloatingControls/index.js +2 -2
- package/dist/es2019/utils/drag-menu.js +2 -2
- package/dist/esm/commands/column-resize.js +6 -3
- package/dist/esm/commands/delete.js +2 -1
- package/dist/esm/commands/insert.js +8 -5
- package/dist/esm/commands-with-analytics.js +6 -4
- package/dist/esm/event-handlers.js +2 -1
- package/dist/esm/nodeviews/TableComponent.js +21 -10
- package/dist/esm/nodeviews/TableContainer.js +7 -3
- package/dist/esm/nodeviews/TableResizer.js +3 -2
- package/dist/esm/plugin.js +4 -3
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +4 -2
- package/dist/esm/pm-plugins/keymap.js +5 -4
- package/dist/esm/pm-plugins/main.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +12 -7
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +6 -5
- package/dist/esm/pm-plugins/table-resizing/utils/consts.js +1 -0
- package/dist/esm/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +7 -5
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +5 -3
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +13 -8
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +17 -9
- package/dist/esm/toolbar.js +7 -4
- package/dist/esm/transforms/column-width.js +3 -1
- package/dist/esm/transforms/delete-columns.js +2 -1
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +4 -2
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +4 -1
- package/dist/esm/ui/FloatingInsertButton/index.js +3 -1
- package/dist/esm/ui/TableFloatingControls/index.js +2 -2
- package/dist/esm/utils/drag-menu.js +2 -1
- package/dist/types/commands/delete.d.ts +1 -1
- package/dist/types/commands/insert.d.ts +4 -4
- package/dist/types/commands-with-analytics.d.ts +3 -3
- package/dist/types/event-handlers.d.ts +1 -1
- package/dist/types/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/colgroup.d.ts +2 -2
- package/dist/types/pm-plugins/table-resizing/utils/consts.d.ts +1 -0
- package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +2 -2
- package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -2
- package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +3 -2
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +3 -3
- package/dist/types/toolbar.d.ts +2 -2
- package/dist/types/transforms/column-width.d.ts +1 -1
- package/dist/types/transforms/delete-columns.d.ts +1 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
- package/dist/types/utils/drag-menu.d.ts +1 -1
- package/dist/types-ts4.5/commands/delete.d.ts +1 -1
- package/dist/types-ts4.5/commands/insert.d.ts +4 -4
- package/dist/types-ts4.5/commands-with-analytics.d.ts +3 -3
- package/dist/types-ts4.5/event-handlers.d.ts +1 -1
- 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/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/colgroup.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/consts.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +3 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +3 -3
- package/dist/types-ts4.5/toolbar.d.ts +2 -2
- package/dist/types-ts4.5/transforms/column-width.d.ts +1 -1
- package/dist/types-ts4.5/transforms/delete-columns.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
- package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
- package/package.json +8 -2
- package/src/commands/column-resize.ts +9 -3
- package/src/commands/delete.ts +2 -1
- package/src/commands/insert.ts +31 -12
- package/src/commands-with-analytics.ts +24 -8
- package/src/event-handlers.ts +2 -0
- package/src/nodeviews/TableComponent.tsx +41 -12
- package/src/nodeviews/TableContainer.tsx +6 -0
- package/src/nodeviews/TableResizer.tsx +4 -0
- package/src/plugin.tsx +9 -0
- package/src/pm-plugins/drag-and-drop/plugin.ts +13 -4
- package/src/pm-plugins/keymap.ts +17 -4
- package/src/pm-plugins/main.ts +2 -0
- package/src/pm-plugins/table-resizing/event-handlers.ts +21 -10
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +14 -4
- package/src/pm-plugins/table-resizing/utils/consts.ts +1 -0
- package/src/pm-plugins/table-resizing/utils/index.ts +1 -0
- package/src/pm-plugins/table-resizing/utils/misc.ts +24 -5
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +11 -4
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +17 -6
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +32 -9
- package/src/toolbar.tsx +15 -9
- package/src/transforms/column-width.ts +2 -1
- package/src/transforms/delete-columns.ts +11 -2
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +12 -5
- package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -0
- package/src/ui/FloatingDragMenu/index.tsx +7 -0
- package/src/ui/FloatingInsertButton/index.tsx +7 -0
- package/src/ui/TableFloatingControls/index.tsx +18 -16
- package/src/utils/drag-menu.ts +2 -0
package/dist/es2019/toolbar.js
CHANGED
|
@@ -100,7 +100,7 @@ export const getToolbarMenuConfig = (config, state, {
|
|
|
100
100
|
// with native widgets. It's enabled via a plugin config.
|
|
101
101
|
export const getToolbarCellOptionsConfig = (editorState, editorView, initialSelectionRect, {
|
|
102
102
|
formatMessage
|
|
103
|
-
}, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled = false) => {
|
|
103
|
+
}, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled = false, shouldUseIncreasedScalingPercent = false) => {
|
|
104
104
|
var _pluginState$pluginCo, _pluginState$pluginCo2;
|
|
105
105
|
const {
|
|
106
106
|
top,
|
|
@@ -118,7 +118,7 @@ export const getToolbarCellOptionsConfig = (editorState, editorView, initialSele
|
|
|
118
118
|
const selectionRect = getClosestSelectionRect(state);
|
|
119
119
|
const index = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.right;
|
|
120
120
|
if (index) {
|
|
121
|
-
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled)(INPUT_METHOD.FLOATING_TB, index)(state, dispatch, view);
|
|
121
|
+
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, shouldUseIncreasedScalingPercent)(INPUT_METHOD.FLOATING_TB, index)(state, dispatch, view);
|
|
122
122
|
}
|
|
123
123
|
return true;
|
|
124
124
|
},
|
|
@@ -154,7 +154,7 @@ export const getToolbarCellOptionsConfig = (editorState, editorView, initialSele
|
|
|
154
154
|
onClick: (state, dispatch, view) => {
|
|
155
155
|
const selectionRect = getClosestSelectionRect(state);
|
|
156
156
|
if (selectionRect) {
|
|
157
|
-
deleteColumnsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB, selectionRect)(state, dispatch, view);
|
|
157
|
+
deleteColumnsWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, shouldUseIncreasedScalingPercent)(INPUT_METHOD.FLOATING_TB, selectionRect)(state, dispatch, view);
|
|
158
158
|
}
|
|
159
159
|
return true;
|
|
160
160
|
},
|
|
@@ -305,7 +305,7 @@ export const getClosestSelectionOrTableRect = state => {
|
|
|
305
305
|
const tableRect = new Rect(0, 0, map.width, map.height);
|
|
306
306
|
return isSelectionType(selection, 'cell') ? getSelectionRect(selection) : tableRect;
|
|
307
307
|
};
|
|
308
|
-
export const getToolbarConfig = (getEditorContainerWidth, editorAnalyticsAPI, getEditorFeatureFlags, getEditorView, options) => config => (state, intl) => {
|
|
308
|
+
export const getToolbarConfig = (getEditorContainerWidth, editorAnalyticsAPI, getEditorFeatureFlags, getEditorView, options, shouldUseIncreasedScalingPercent = false) => config => (state, intl) => {
|
|
309
309
|
const tableObject = findTable(state.selection);
|
|
310
310
|
const pluginState = getPluginState(state);
|
|
311
311
|
const resizeState = tableResizingPluginKey.getState(state);
|
|
@@ -320,7 +320,7 @@ export const getToolbarConfig = (getEditorContainerWidth, editorAnalyticsAPI, ge
|
|
|
320
320
|
const isNested = pluginState.tablePos && isTableNested(state, pluginState.tablePos);
|
|
321
321
|
alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth) : [];
|
|
322
322
|
let cellItems;
|
|
323
|
-
cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled);
|
|
323
|
+
cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, shouldUseIncreasedScalingPercent);
|
|
324
324
|
let columnSettingsItems;
|
|
325
325
|
columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) : [];
|
|
326
326
|
const colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView);
|
|
@@ -414,12 +414,12 @@ const separator = hidden => {
|
|
|
414
414
|
};
|
|
415
415
|
const getCellItems = (state, view, {
|
|
416
416
|
formatMessage
|
|
417
|
-
}, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled = false) => {
|
|
417
|
+
}, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled = false, shouldUseIncreasedScalingPercent = false) => {
|
|
418
418
|
const initialSelectionRect = getClosestSelectionRect(state);
|
|
419
419
|
if (initialSelectionRect) {
|
|
420
420
|
const cellOptions = getToolbarCellOptionsConfig(state, view, initialSelectionRect, {
|
|
421
421
|
formatMessage
|
|
422
|
-
}, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled);
|
|
422
|
+
}, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled, shouldUseIncreasedScalingPercent);
|
|
423
423
|
return [cellOptions, separator(cellOptions.hidden)];
|
|
424
424
|
}
|
|
425
425
|
return [];
|
|
@@ -88,7 +88,7 @@ export const updateColumnWidths = (resizeState, table, start) => tr => {
|
|
|
88
88
|
* @param view
|
|
89
89
|
* @returns Updated transaction with rescaled columns for a given table
|
|
90
90
|
*/
|
|
91
|
-
export const rescaleColumns = (isTableScalingEnabled = false) => (table, view) => tr => {
|
|
91
|
+
export const rescaleColumns = (isTableScalingEnabled = false, shouldUseIncreasedScalingPercent = false) => (table, view) => tr => {
|
|
92
92
|
if (!view) {
|
|
93
93
|
return tr;
|
|
94
94
|
}
|
|
@@ -170,7 +170,8 @@ export const rescaleColumns = (isTableScalingEnabled = false) => (table, view) =
|
|
|
170
170
|
tableRef,
|
|
171
171
|
domAtPos,
|
|
172
172
|
maxSize: previousTableInfo.possibleMaxWidth,
|
|
173
|
-
isTableScalingEnabled: shouldScale
|
|
173
|
+
isTableScalingEnabled: shouldScale,
|
|
174
|
+
shouldUseIncreasedScalingPercent
|
|
174
175
|
});
|
|
175
176
|
|
|
176
177
|
// Two scenarios that require scaling:
|
|
@@ -192,7 +192,7 @@ function fixRowSpans(table) {
|
|
|
192
192
|
}
|
|
193
193
|
return table.type.createChecked(table.attrs, rows, table.marks);
|
|
194
194
|
}
|
|
195
|
-
export const deleteColumns = (rect, allowCustomStep, view, isTableScalingEnabled = false) => tr => {
|
|
195
|
+
export const deleteColumns = (rect, allowCustomStep, view, isTableScalingEnabled = false, shouldUseIncreasedScalingPercent = false) => tr => {
|
|
196
196
|
let updatedTr = tr;
|
|
197
197
|
updatedTr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
|
|
198
198
|
name: TABLE_OVERFLOW_CHANGE_TRIGGER.DELETED_COLUMN
|
|
@@ -204,7 +204,7 @@ export const deleteColumns = (rect, allowCustomStep, view, isTableScalingEnabled
|
|
|
204
204
|
}
|
|
205
205
|
const table = findTable(updatedTr.selection);
|
|
206
206
|
if (table) {
|
|
207
|
-
updatedTr = rescaleColumns(isTableScalingEnabled)(table, view)(updatedTr);
|
|
207
|
+
updatedTr = rescaleColumns(isTableScalingEnabled, shouldUseIncreasedScalingPercent)(table, view)(updatedTr);
|
|
208
208
|
}
|
|
209
209
|
return updatedTr;
|
|
210
210
|
};
|
|
@@ -18,6 +18,7 @@ import { splitCell } from '@atlaskit/editor-tables/utils';
|
|
|
18
18
|
import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
|
|
19
19
|
import EditorBackgroundColorIcon from '@atlaskit/icon/glyph/editor/background-color';
|
|
20
20
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
21
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
21
22
|
import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, toggleContextualMenu } from '../../commands';
|
|
22
23
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics } from '../../commands-with-analytics';
|
|
23
24
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
@@ -419,6 +420,7 @@ export class ContextualMenu extends Component {
|
|
|
419
420
|
const {
|
|
420
421
|
tableDuplicateCellColouring = false
|
|
421
422
|
} = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
423
|
+
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
422
424
|
switch (item.value.name) {
|
|
423
425
|
case 'sort_column_desc':
|
|
424
426
|
sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, selectionRect.left, SortOrder.DESC)(state, dispatch);
|
|
@@ -448,7 +450,7 @@ export class ContextualMenu extends Component {
|
|
|
448
450
|
this.toggleOpen();
|
|
449
451
|
break;
|
|
450
452
|
case 'insert_column':
|
|
451
|
-
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
|
|
453
|
+
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring, shouldUseIncreasedScalingPercent)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
|
|
452
454
|
this.toggleOpen();
|
|
453
455
|
break;
|
|
454
456
|
case 'insert_row':
|
|
@@ -459,7 +461,7 @@ export class ContextualMenu extends Component {
|
|
|
459
461
|
this.toggleOpen();
|
|
460
462
|
break;
|
|
461
463
|
case 'delete_column':
|
|
462
|
-
deleteColumnsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, selectionRect)(state, dispatch, editorView);
|
|
464
|
+
deleteColumnsWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, shouldUseIncreasedScalingPercent)(INPUT_METHOD.CONTEXT_MENU, selectionRect)(state, dispatch, editorView);
|
|
463
465
|
this.toggleOpen();
|
|
464
466
|
break;
|
|
465
467
|
case 'delete_row':
|
|
@@ -177,7 +177,8 @@ export const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
177
177
|
scrollableElement,
|
|
178
178
|
boundariesElement,
|
|
179
179
|
isTableScalingEnabled,
|
|
180
|
-
tableDuplicateCellColouring
|
|
180
|
+
tableDuplicateCellColouring,
|
|
181
|
+
shouldUseIncreasedScalingPercent
|
|
181
182
|
}) => {
|
|
182
183
|
var _pluginConfig$allowBa;
|
|
183
184
|
const {
|
|
@@ -205,7 +206,7 @@ export const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
205
206
|
hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
|
|
206
207
|
}
|
|
207
208
|
const allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
208
|
-
const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring);
|
|
209
|
+
const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, shouldUseIncreasedScalingPercent);
|
|
209
210
|
const {
|
|
210
211
|
menuItems,
|
|
211
212
|
menuCallback
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
3
3
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
|
|
6
7
|
import DragMenu from './DragMenu';
|
|
7
8
|
const FloatingDragMenu = ({
|
|
@@ -33,6 +34,7 @@ const FloatingDragMenu = ({
|
|
|
33
34
|
const {
|
|
34
35
|
tableDuplicateCellColouring = false
|
|
35
36
|
} = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
37
|
+
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
36
38
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
37
39
|
alignX: direction === 'row' ? 'right' : undefined,
|
|
38
40
|
alignY: direction === 'row' ? 'start' : undefined,
|
|
@@ -67,7 +69,8 @@ const FloatingDragMenu = ({
|
|
|
67
69
|
boundariesElement: boundariesElement,
|
|
68
70
|
scrollableElement: scrollableElement,
|
|
69
71
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
70
|
-
tableDuplicateCellColouring: tableDuplicateCellColouring
|
|
72
|
+
tableDuplicateCellColouring: tableDuplicateCellColouring,
|
|
73
|
+
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
|
|
71
74
|
}));
|
|
72
75
|
};
|
|
73
76
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
|
@@ -10,6 +10,7 @@ import { akEditorTableCellOnStickyHeaderZIndex } from '@atlaskit/editor-shared-s
|
|
|
10
10
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
11
11
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
12
12
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
13
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import { insertColumnWithAnalytics, insertRowWithAnalytics } from '../../commands-with-analytics';
|
|
14
15
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
15
16
|
import { TableCssClassName as ClassName } from '../../types';
|
|
@@ -184,6 +185,7 @@ export class FloatingInsertButton extends React.Component {
|
|
|
184
185
|
const {
|
|
185
186
|
isTableScalingEnabled = false
|
|
186
187
|
} = getPluginState(editorView.state);
|
|
188
|
+
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
187
189
|
const {
|
|
188
190
|
tableDuplicateCellColouring = false
|
|
189
191
|
} = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
@@ -191,7 +193,7 @@ export class FloatingInsertButton extends React.Component {
|
|
|
191
193
|
state,
|
|
192
194
|
dispatch
|
|
193
195
|
} = editorView;
|
|
194
|
-
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
|
|
196
|
+
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring, shouldUseIncreasedScalingPercent)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
|
|
195
197
|
}
|
|
196
198
|
}
|
|
197
199
|
}
|
|
@@ -95,7 +95,7 @@ export const TableFloatingControls = ({
|
|
|
95
95
|
updateCellHoverLocation: updateCellHoverLocation,
|
|
96
96
|
stickyTop: stickyTop,
|
|
97
97
|
isDragAndDropEnabled: isDragAndDropEnabled
|
|
98
|
-
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(React.Fragment, null, getBooleanFF('platform.editor.table.use-shared-state-hook') ? /*#__PURE__*/React.createElement(DragCornerControlsWithSelection, {
|
|
98
|
+
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(React.Fragment, null, !getBooleanFF('platform.editor.drag-and-drop_wmv9t') && (getBooleanFF('platform.editor.table.use-shared-state-hook') ? /*#__PURE__*/React.createElement(DragCornerControlsWithSelection, {
|
|
99
99
|
editorView: editorView,
|
|
100
100
|
tableRef: tableRef,
|
|
101
101
|
isInDanger: isInDanger,
|
|
@@ -106,7 +106,7 @@ export const TableFloatingControls = ({
|
|
|
106
106
|
tableRef: tableRef,
|
|
107
107
|
isInDanger: isInDanger,
|
|
108
108
|
isResizing: isResizing
|
|
109
|
-
}), /*#__PURE__*/React.createElement(DragControls, {
|
|
109
|
+
})), /*#__PURE__*/React.createElement(DragControls, {
|
|
110
110
|
tableRef: tableRef,
|
|
111
111
|
tableNode: tableNode,
|
|
112
112
|
hoveredCell: hoveredCell,
|
|
@@ -65,7 +65,7 @@ const defaultSelectionRect = {
|
|
|
65
65
|
right: 0,
|
|
66
66
|
bottom: 0
|
|
67
67
|
};
|
|
68
|
-
export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired, isTableScalingEnabled = false, tableDuplicateCellColouring = false) => {
|
|
68
|
+
export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired, isTableScalingEnabled = false, tableDuplicateCellColouring = false, shouldUseIncreasedScalingPercent = false) => {
|
|
69
69
|
var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
|
|
70
70
|
const addOptions = direction === 'row' ? [{
|
|
71
71
|
label: 'above',
|
|
@@ -145,7 +145,7 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, h
|
|
|
145
145
|
moveCursorToInsertedRow: true
|
|
146
146
|
})(state, dispatch);
|
|
147
147
|
} else {
|
|
148
|
-
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
|
|
148
|
+
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring, shouldUseIncreasedScalingPercent)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
|
|
149
149
|
}
|
|
150
150
|
return true;
|
|
151
151
|
},
|
|
@@ -205,9 +205,11 @@ export var changeColumnWidthByStep = function changeColumnWidthByStep(_ref4) {
|
|
|
205
205
|
getEditorContainerWidth: getEditorContainerWidth
|
|
206
206
|
});
|
|
207
207
|
var isTableScalingEnabledOnCurrentTable = isTableScalingEnabled;
|
|
208
|
-
|
|
208
|
+
var isTableScalingEnabledWithLockButton = isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
|
|
209
|
+
if (isTableScalingEnabledWithLockButton) {
|
|
209
210
|
isTableScalingEnabledOnCurrentTable = originalTable.attrs.displayMode !== 'fixed';
|
|
210
211
|
}
|
|
212
|
+
var shouldUseIncreasedScalingPercent = isTableScalingEnabledWithLockButton && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
211
213
|
var initialResizeState = getResizeState({
|
|
212
214
|
minWidth: tableCellMinWidth,
|
|
213
215
|
maxSize: maxSize,
|
|
@@ -215,14 +217,15 @@ export var changeColumnWidthByStep = function changeColumnWidthByStep(_ref4) {
|
|
|
215
217
|
tableRef: dom,
|
|
216
218
|
start: tableStartPosition,
|
|
217
219
|
domAtPos: domAtPos,
|
|
218
|
-
isTableScalingEnabled: isTableScalingEnabledOnCurrentTable
|
|
220
|
+
isTableScalingEnabled: isTableScalingEnabledOnCurrentTable,
|
|
221
|
+
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
|
|
219
222
|
});
|
|
220
223
|
updateControls()(state);
|
|
221
224
|
var selectionRect = getSelectionRect(state.selection);
|
|
222
225
|
var selectedColumns = selectionRect ? getSelectedColumnIndexes(selectionRect) : [];
|
|
223
226
|
// only selected (or selected - 1) columns should be distributed
|
|
224
227
|
var resizingSelectedColumns = selectedColumns.indexOf(colIndex) > -1 || selectedColumns.indexOf(colIndex + 1) > -1;
|
|
225
|
-
var newResizeState = resizeColumn(initialResizeState, colIndex, stepSize, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, isTableScalingEnabled);
|
|
228
|
+
var newResizeState = resizeColumn(initialResizeState, colIndex, stepSize, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, isTableScalingEnabled, shouldUseIncreasedScalingPercent);
|
|
226
229
|
customTr = updateColumnWidths(newResizeState, originalTable, tableStartPosition)(customTr);
|
|
227
230
|
if (dispatch) {
|
|
228
231
|
dispatch(customTr);
|
|
@@ -2,8 +2,9 @@ import { deleteColumns } from '../transforms/delete-columns';
|
|
|
2
2
|
import { getAllowAddColumnCustomStep } from '../utils/get-allow-add-column-custom-step';
|
|
3
3
|
export var deleteColumnsCommand = function deleteColumnsCommand(rect) {
|
|
4
4
|
var isTableScalingEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
5
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
5
6
|
return function (state, dispatch, view) {
|
|
6
|
-
var tr = deleteColumns(rect, getAllowAddColumnCustomStep(state), view, isTableScalingEnabled)(state.tr);
|
|
7
|
+
var tr = deleteColumns(rect, getAllowAddColumnCustomStep(state), view, isTableScalingEnabled, shouldUseIncreasedScalingPercent)(state.tr);
|
|
7
8
|
if (dispatch) {
|
|
8
9
|
dispatch(tr);
|
|
9
10
|
return true;
|
|
@@ -22,6 +22,7 @@ function addColumnAtCustomStep(column) {
|
|
|
22
22
|
export function addColumnAt() {
|
|
23
23
|
var isTableScalingEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
24
24
|
var isCellBackgroundDuplicated = arguments.length > 1 ? arguments[1] : undefined;
|
|
25
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 2 ? arguments[2] : undefined;
|
|
25
26
|
return function (column) {
|
|
26
27
|
var allowAddColumnCustomStep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
27
28
|
var view = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -35,7 +36,7 @@ export function addColumnAt() {
|
|
|
35
36
|
var table = findTable(updatedTr.selection);
|
|
36
37
|
if (table) {
|
|
37
38
|
// [ED-8288] Update colwidths manually to avoid multiple dispatch in TableComponent
|
|
38
|
-
updatedTr = rescaleColumns(isTableScalingEnabled)(table, view)(updatedTr);
|
|
39
|
+
updatedTr = rescaleColumns(isTableScalingEnabled, shouldUseIncreasedScalingPercent)(table, view)(updatedTr);
|
|
39
40
|
}
|
|
40
41
|
if (view) {
|
|
41
42
|
updatedTr = updateRowOrColumnMovedTransform({
|
|
@@ -54,6 +55,7 @@ export function addColumnAt() {
|
|
|
54
55
|
// Command to add a column before the column with the selection.
|
|
55
56
|
export var addColumnBefore = function addColumnBefore() {
|
|
56
57
|
var isTableScalingEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
58
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
57
59
|
return function (state, dispatch, view) {
|
|
58
60
|
var table = findTable(state.selection);
|
|
59
61
|
if (!table) {
|
|
@@ -61,7 +63,7 @@ export var addColumnBefore = function addColumnBefore() {
|
|
|
61
63
|
}
|
|
62
64
|
if (dispatch) {
|
|
63
65
|
var rect = selectedRect(state);
|
|
64
|
-
dispatch(addColumnAt(isTableScalingEnabled)(rect.left, getAllowAddColumnCustomStep(state), view)(state.tr));
|
|
66
|
+
dispatch(addColumnAt(isTableScalingEnabled, shouldUseIncreasedScalingPercent)(rect.left, getAllowAddColumnCustomStep(state), view)(state.tr));
|
|
65
67
|
}
|
|
66
68
|
return true;
|
|
67
69
|
};
|
|
@@ -69,7 +71,7 @@ export var addColumnBefore = function addColumnBefore() {
|
|
|
69
71
|
|
|
70
72
|
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
71
73
|
// Command to add a column after the column with the selection.
|
|
72
|
-
export var addColumnAfter = function addColumnAfter(isTableScalingEnabled) {
|
|
74
|
+
export var addColumnAfter = function addColumnAfter(isTableScalingEnabled, shouldUseIncreasedScalingPercent) {
|
|
73
75
|
return function (state, dispatch, view) {
|
|
74
76
|
var table = findTable(state.selection);
|
|
75
77
|
if (!table) {
|
|
@@ -77,7 +79,7 @@ export var addColumnAfter = function addColumnAfter(isTableScalingEnabled) {
|
|
|
77
79
|
}
|
|
78
80
|
if (dispatch) {
|
|
79
81
|
var rect = selectedRect(state);
|
|
80
|
-
dispatch(addColumnAt(isTableScalingEnabled)(rect.right, getAllowAddColumnCustomStep(state), view)(state.tr));
|
|
82
|
+
dispatch(addColumnAt(isTableScalingEnabled, shouldUseIncreasedScalingPercent)(rect.right, getAllowAddColumnCustomStep(state), view)(state.tr));
|
|
81
83
|
}
|
|
82
84
|
return true;
|
|
83
85
|
};
|
|
@@ -85,9 +87,10 @@ export var addColumnAfter = function addColumnAfter(isTableScalingEnabled) {
|
|
|
85
87
|
export var insertColumn = function insertColumn() {
|
|
86
88
|
var isTableScalingEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
87
89
|
var isCellBackgroundDuplicated = arguments.length > 1 ? arguments[1] : undefined;
|
|
90
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 2 ? arguments[2] : undefined;
|
|
88
91
|
return function (column) {
|
|
89
92
|
return function (state, dispatch, view) {
|
|
90
|
-
var tr = addColumnAt(isTableScalingEnabled, isCellBackgroundDuplicated)(column, getAllowAddColumnCustomStep(state), view)(state.tr);
|
|
93
|
+
var tr = addColumnAt(isTableScalingEnabled, isCellBackgroundDuplicated, shouldUseIncreasedScalingPercent)(column, getAllowAddColumnCustomStep(state), view)(state.tr);
|
|
91
94
|
var table = findTable(tr.selection);
|
|
92
95
|
if (!table) {
|
|
93
96
|
return false;
|
|
@@ -221,6 +221,7 @@ export var changeColumnWidthByStepWithAnalytics = function changeColumnWidthBySt
|
|
|
221
221
|
export var insertColumnWithAnalytics = function insertColumnWithAnalytics(editorAnalyticsAPI) {
|
|
222
222
|
var isTableScalingEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
223
223
|
var isCellbackgroundDuplicated = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
224
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
224
225
|
return function (inputMethod, position) {
|
|
225
226
|
return withEditorAnalyticsAPI(function (state) {
|
|
226
227
|
var _getSelectedTableInfo3 = getSelectedTableInfo(state.selection),
|
|
@@ -238,7 +239,7 @@ export var insertColumnWithAnalytics = function insertColumnWithAnalytics(editor
|
|
|
238
239
|
},
|
|
239
240
|
eventType: EVENT_TYPE.TRACK
|
|
240
241
|
};
|
|
241
|
-
})(editorAnalyticsAPI)(insertColumn(isTableScalingEnabled, isCellbackgroundDuplicated)(position));
|
|
242
|
+
})(editorAnalyticsAPI)(insertColumn(isTableScalingEnabled, isCellbackgroundDuplicated, shouldUseIncreasedScalingPercent)(position));
|
|
242
243
|
};
|
|
243
244
|
};
|
|
244
245
|
export var deleteRowsWithAnalytics = function deleteRowsWithAnalytics(editorAnalyticsAPI) {
|
|
@@ -271,6 +272,7 @@ export var deleteRowsWithAnalytics = function deleteRowsWithAnalytics(editorAnal
|
|
|
271
272
|
};
|
|
272
273
|
export var deleteColumnsWithAnalytics = function deleteColumnsWithAnalytics(editorAnalyticsAPI) {
|
|
273
274
|
var isTableScalingEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
275
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
274
276
|
return function (inputMethod, rect) {
|
|
275
277
|
return withEditorAnalyticsAPI(function (_ref6) {
|
|
276
278
|
var selection = _ref6.selection;
|
|
@@ -290,10 +292,10 @@ export var deleteColumnsWithAnalytics = function deleteColumnsWithAnalytics(edit
|
|
|
290
292
|
},
|
|
291
293
|
eventType: EVENT_TYPE.TRACK
|
|
292
294
|
};
|
|
293
|
-
})(editorAnalyticsAPI)(deleteColumnsCommand(rect, isTableScalingEnabled));
|
|
295
|
+
})(editorAnalyticsAPI)(deleteColumnsCommand(rect, isTableScalingEnabled, shouldUseIncreasedScalingPercent));
|
|
294
296
|
};
|
|
295
297
|
};
|
|
296
|
-
export var deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut = function deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI) {
|
|
298
|
+
export var deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut = function deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI, isTableScalingEnabled, shouldUseIncreasedScalingPercent) {
|
|
297
299
|
return function (state, dispatch) {
|
|
298
300
|
var selection = state.selection;
|
|
299
301
|
var isCellSelection = selection instanceof CellSelection;
|
|
@@ -311,7 +313,7 @@ export var deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut = function delete
|
|
|
311
313
|
var isHeaderRowRequired = pluginConfig.isHeaderRowRequired || false;
|
|
312
314
|
return deleteRowsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, rect, isHeaderRowRequired)(state, dispatch);
|
|
313
315
|
} else if (selectionType === 'column') {
|
|
314
|
-
return deleteColumnsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, rect)(state, dispatch);
|
|
316
|
+
return deleteColumnsWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, shouldUseIncreasedScalingPercent)(INPUT_METHOD.SHORTCUT, rect)(state, dispatch);
|
|
315
317
|
} else {
|
|
316
318
|
return false;
|
|
317
319
|
}
|
|
@@ -345,6 +345,7 @@ export function handleTripleClick(view, pos) {
|
|
|
345
345
|
}
|
|
346
346
|
export var handleCut = function handleCut(oldTr, oldState, newState, editorAnalyticsAPI, editorView) {
|
|
347
347
|
var isTableScalingEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
348
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
348
349
|
var oldSelection = oldState.tr.selection;
|
|
349
350
|
var tr = newState.tr;
|
|
350
351
|
if (oldSelection instanceof CellSelection) {
|
|
@@ -387,7 +388,7 @@ export var handleCut = function handleCut(oldTr, oldState, newState, editorAnaly
|
|
|
387
388
|
isHeaderRowRequired = _getPluginState9.pluginConfig.isHeaderRowRequired;
|
|
388
389
|
tr = deleteRows(rect, isHeaderRowRequired)(tr);
|
|
389
390
|
} else if (tr.selection.isColSelection()) {
|
|
390
|
-
tr = deleteColumns(rect, getAllowAddColumnCustomStep(oldState), editorView, isTableScalingEnabled)(tr);
|
|
391
|
+
tr = deleteColumns(rect, getAllowAddColumnCustomStep(oldState), editorView, isTableScalingEnabled, shouldUseIncreasedScalingPercent)(tr);
|
|
391
392
|
}
|
|
392
393
|
}
|
|
393
394
|
}
|
|
@@ -174,6 +174,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
174
174
|
_this.containerWidth = containerWidth;
|
|
175
175
|
_this.layoutSize = layoutSize;
|
|
176
176
|
});
|
|
177
|
+
// Function gets called when table is nested.
|
|
177
178
|
_defineProperty(_assertThisInitialized(_this), "scaleTable", function (scaleOptions) {
|
|
178
179
|
var _this$props2 = _this.props,
|
|
179
180
|
view = _this$props2.view,
|
|
@@ -197,7 +198,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
197
198
|
start: pos + 1,
|
|
198
199
|
containerWidth: width,
|
|
199
200
|
previousContainerWidth: _this.containerWidth.width || width
|
|
200
|
-
}, options), domAtPos, false
|
|
201
|
+
}, options), domAtPos, false,
|
|
202
|
+
// isTableScalingEnabled doesn't change the behavior of nested tables
|
|
203
|
+
false // shouldUseIncreasedScalingPercent set to false for nested tables
|
|
204
|
+
)(state.tr);
|
|
201
205
|
dispatch(tr);
|
|
202
206
|
});
|
|
203
207
|
_defineProperty(_assertThisInitialized(_this), "setTimerToSendInitialOverflowCaptured", function (isOverflowing) {
|
|
@@ -471,7 +475,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
471
475
|
var isNumberOfColumnsChanged = tablesHaveDifferentNoOfColumns(tableNode, this.node);
|
|
472
476
|
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth || isNumberColumnChanged || isNumberOfColumnsChanged;
|
|
473
477
|
if (force || maybeScale) {
|
|
474
|
-
var _this$containerWidth;
|
|
478
|
+
var _this$containerWidth, _this$props$options;
|
|
475
479
|
var containerWidthValue = containerWidth.width;
|
|
476
480
|
var isWidthChanged = ((_this$containerWidth = this.containerWidth) === null || _this$containerWidth === void 0 ? void 0 : _this$containerWidth.width) !== containerWidthValue;
|
|
477
481
|
var wasTableResized = hasTableBeenResized(this.node);
|
|
@@ -479,8 +483,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
479
483
|
var isColumnsDistributed = wasTableResized && !isTableResized;
|
|
480
484
|
var isTableDisplayModeChanged = this.node.attrs.displayMode !== tableNode.attrs.displayMode;
|
|
481
485
|
var shouldUpdateColgroup = isWidthChanged || isColumnsDistributed || isTableResizedFullWidth || isTableWidthChanged || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged;
|
|
486
|
+
var isTableScalingEnabledWithLockButton = ((_this$props$options = this.props.options) === null || _this$props$options === void 0 ? void 0 : _this$props$options.isTableScalingEnabled) && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
|
|
487
|
+
var shouldUseIncreasedScalingPercent = isTableScalingEnabledWithLockButton && getBooleanFF('platform.editor.table.use-increased-scaling-percent') || false;
|
|
482
488
|
if (force || !isResizing && shouldUpdateColgroup) {
|
|
483
|
-
var _this$props$
|
|
489
|
+
var _this$props$options2;
|
|
484
490
|
var resizeState = getResizeState({
|
|
485
491
|
minWidth: COLUMN_MIN_WIDTH,
|
|
486
492
|
maxSize: tableRenderWidth,
|
|
@@ -488,19 +494,20 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
488
494
|
tableRef: this.table,
|
|
489
495
|
start: start,
|
|
490
496
|
domAtPos: view.domAtPos.bind(view),
|
|
491
|
-
isTableScalingEnabled: true
|
|
497
|
+
isTableScalingEnabled: true,
|
|
498
|
+
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
|
|
492
499
|
});
|
|
493
500
|
var shouldScaleOnColgroupUpdate = false;
|
|
494
|
-
if ((_this$props$
|
|
501
|
+
if ((_this$props$options2 = this.props.options) !== null && _this$props$options2 !== void 0 && _this$props$options2.isTableScalingEnabled && !getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')) {
|
|
495
502
|
shouldScaleOnColgroupUpdate = true;
|
|
496
503
|
}
|
|
497
|
-
if (
|
|
504
|
+
if (isTableScalingEnabledWithLockButton && tableNode.attrs.displayMode !== 'fixed') {
|
|
498
505
|
shouldScaleOnColgroupUpdate = true;
|
|
499
506
|
}
|
|
500
507
|
|
|
501
508
|
// Request animation frame required for Firefox
|
|
502
509
|
requestAnimationFrame(function () {
|
|
503
|
-
updateColgroup(resizeState, _this2.table, tableNode, shouldScaleOnColgroupUpdate);
|
|
510
|
+
updateColgroup(resizeState, _this2.table, tableNode, shouldScaleOnColgroupUpdate, shouldUseIncreasedScalingPercent);
|
|
504
511
|
});
|
|
505
512
|
}
|
|
506
513
|
}
|
|
@@ -534,7 +541,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
534
541
|
shouldScale = true;
|
|
535
542
|
shouldHandleColgroupUpdates = true;
|
|
536
543
|
}
|
|
537
|
-
|
|
544
|
+
var isTableScalingEnabledWithLockButton = isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
|
|
545
|
+
var shouldUseIncreasedScalingPercent = isTableScalingEnabledWithLockButton && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
546
|
+
if (isTableScalingEnabledWithLockButton && getNode().attrs.displayMode !== 'fixed') {
|
|
538
547
|
shouldScale = true;
|
|
539
548
|
shouldHandleColgroupUpdates = true;
|
|
540
549
|
}
|
|
@@ -586,7 +595,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
586
595
|
var start = getPos() || 0;
|
|
587
596
|
var depth = _view.state.doc.resolve(start).depth;
|
|
588
597
|
shouldScale = depth === 0 && shouldScale;
|
|
589
|
-
insertColgroupFromNode(this.table, currentTable, shouldScale);
|
|
598
|
+
insertColgroupFromNode(this.table, currentTable, shouldScale, undefined, shouldUseIncreasedScalingPercent);
|
|
590
599
|
}
|
|
591
600
|
updateControls()(_view.state);
|
|
592
601
|
}
|
|
@@ -742,6 +751,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
742
751
|
var topStickyShadowPosition = isDragAndDropEnabled ? this.state.stickyHeader && this.state.stickyHeader.top + this.state.stickyHeader.padding + 2 : this.state.stickyHeader && this.state.stickyHeader.top + this.state.stickyHeader.padding + shadowPadding + 2;
|
|
743
752
|
var _getEditorFeatureFlag3 = getEditorFeatureFlags(),
|
|
744
753
|
stickyScrollbar = _getEditorFeatureFlag3.stickyScrollbar;
|
|
754
|
+
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
745
755
|
return /*#__PURE__*/React.createElement(TableContainer
|
|
746
756
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
747
757
|
, {
|
|
@@ -758,7 +768,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
758
768
|
isResizing: isResizing,
|
|
759
769
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
760
770
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
761
|
-
isTableAlignmentEnabled: isTableAlignmentEnabled
|
|
771
|
+
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
772
|
+
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
|
|
762
773
|
}, /*#__PURE__*/React.createElement("div", {
|
|
763
774
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
764
775
|
className: ClassName.TABLE_STICKY_SENTINEL_TOP,
|
|
@@ -114,7 +114,8 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
114
114
|
tableWrapperHeight = _ref4.tableWrapperHeight,
|
|
115
115
|
isWholeTableInDanger = _ref4.isWholeTableInDanger,
|
|
116
116
|
isTableScalingEnabled = _ref4.isTableScalingEnabled,
|
|
117
|
-
isTableAlignmentEnabled = _ref4.isTableAlignmentEnabled
|
|
117
|
+
isTableAlignmentEnabled = _ref4.isTableAlignmentEnabled,
|
|
118
|
+
shouldUseIncreasedScalingPercent = _ref4.shouldUseIncreasedScalingPercent;
|
|
118
119
|
var containerRef = useRef(null);
|
|
119
120
|
var tableWidthRef = useRef(akEditorDefaultLayoutWidth);
|
|
120
121
|
var _useState = useState(false),
|
|
@@ -221,6 +222,7 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
221
222
|
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
222
223
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
223
224
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
225
|
+
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
224
226
|
pluginInjectionApi: pluginInjectionApi,
|
|
225
227
|
onResizeStart: onResizeStart,
|
|
226
228
|
onResizeStop: onResizeStop
|
|
@@ -274,7 +276,8 @@ export var TableContainer = function TableContainer(_ref6) {
|
|
|
274
276
|
isWholeTableInDanger = _ref6.isWholeTableInDanger,
|
|
275
277
|
isTableResizingEnabled = _ref6.isTableResizingEnabled,
|
|
276
278
|
isTableScalingEnabled = _ref6.isTableScalingEnabled,
|
|
277
|
-
isTableAlignmentEnabled = _ref6.isTableAlignmentEnabled
|
|
279
|
+
isTableAlignmentEnabled = _ref6.isTableAlignmentEnabled,
|
|
280
|
+
shouldUseIncreasedScalingPercent = _ref6.shouldUseIncreasedScalingPercent;
|
|
278
281
|
if (isTableResizingEnabled && !isNested) {
|
|
279
282
|
return /*#__PURE__*/React.createElement(ResizableTableContainer
|
|
280
283
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -291,7 +294,8 @@ export var TableContainer = function TableContainer(_ref6) {
|
|
|
291
294
|
pluginInjectionApi: pluginInjectionApi,
|
|
292
295
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
293
296
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
294
|
-
isTableAlignmentEnabled: isTableAlignmentEnabled
|
|
297
|
+
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
298
|
+
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
|
|
295
299
|
}, children);
|
|
296
300
|
}
|
|
297
301
|
return /*#__PURE__*/React.createElement(InnerContainer, {
|
|
@@ -111,6 +111,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
111
111
|
isTableScalingEnabled = _ref.isTableScalingEnabled,
|
|
112
112
|
isTableAlignmentEnabled = _ref.isTableAlignmentEnabled,
|
|
113
113
|
isWholeTableInDanger = _ref.isWholeTableInDanger,
|
|
114
|
+
shouldUseIncreasedScalingPercent = _ref.shouldUseIncreasedScalingPercent,
|
|
114
115
|
pluginInjectionApi = _ref.pluginInjectionApi,
|
|
115
116
|
isFullWidthModeEnabled = _ref.isFullWidthModeEnabled;
|
|
116
117
|
var currentGap = useRef(0);
|
|
@@ -293,7 +294,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
293
294
|
prevNode: node,
|
|
294
295
|
start: pos + 1,
|
|
295
296
|
parentWidth: newWidth
|
|
296
|
-
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled)(tr);
|
|
297
|
+
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, shouldUseIncreasedScalingPercent || false)(tr);
|
|
297
298
|
var scaledNode = tr.doc.nodeAt(pos);
|
|
298
299
|
(_attachAnalyticsEvent2 = attachAnalyticsEvent(generateResizedPayload({
|
|
299
300
|
originalNode: node,
|
|
@@ -324,7 +325,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
324
325
|
onResizeStop();
|
|
325
326
|
}
|
|
326
327
|
return newWidth;
|
|
327
|
-
}, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure, onResizeStop, isTableScalingEnabled, widthToWidest, formatMessage, pluginInjectionApi]);
|
|
328
|
+
}, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure, onResizeStop, isTableScalingEnabled, shouldUseIncreasedScalingPercent, widthToWidest, formatMessage, pluginInjectionApi]);
|
|
328
329
|
var handleTableSizeChangeOnKeypress = useCallback(function (step) {
|
|
329
330
|
var newWidth = width + step;
|
|
330
331
|
if (newWidth > maxWidth || newWidth < resizerMinWidth) {
|
package/dist/esm/plugin.js
CHANGED
|
@@ -65,6 +65,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
67
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
68
|
+
var shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
68
69
|
return {
|
|
69
70
|
name: 'table',
|
|
70
71
|
// Use getSharedState to store fullWidthEnabled and wasFullWidthModeEnabled to guarantee access
|
|
@@ -156,7 +157,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
156
157
|
dragAndDropEnabled = _ref3.dragAndDropEnabled,
|
|
157
158
|
isTableScalingEnabled = _ref3.isTableScalingEnabled,
|
|
158
159
|
isTableAlignmentEnabled = _ref3.isTableAlignmentEnabled;
|
|
159
|
-
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled);
|
|
160
|
+
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent);
|
|
160
161
|
}
|
|
161
162
|
}, {
|
|
162
163
|
name: 'tablePMColResizing',
|
|
@@ -193,7 +194,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
193
194
|
isTableAlignmentEnabled = _ref7$isTableAlignmen === void 0 ? false : _ref7$isTableAlignmen,
|
|
194
195
|
_ref7$fullWidthEnable = _ref7.fullWidthEnabled,
|
|
195
196
|
fullWidthEnabled = _ref7$fullWidthEnable === void 0 ? false : _ref7$fullWidthEnable;
|
|
196
|
-
return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl);
|
|
197
|
+
return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, shouldUseIncreasedScalingPercent);
|
|
197
198
|
}
|
|
198
199
|
}, {
|
|
199
200
|
name: 'tableSelectionKeymap',
|
|
@@ -463,7 +464,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
463
464
|
},
|
|
464
465
|
floatingToolbar: getToolbarConfig(defaultGetEditorContainerWidth, editorAnalyticsAPI, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags, function () {
|
|
465
466
|
return editorViewRef.current;
|
|
466
|
-
}, options)(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
|
|
467
|
+
}, options, shouldUseIncreasedScalingPercent)(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
|
|
467
468
|
}
|
|
468
469
|
};
|
|
469
470
|
};
|