@atlaskit/editor-plugin-table 7.5.3 → 7.5.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/column-resize.js +3 -3
- package/dist/cjs/commands/delete.js +2 -2
- package/dist/cjs/commands/insert.js +15 -15
- package/dist/cjs/commands-with-analytics.js +7 -7
- package/dist/cjs/event-handlers.js +2 -2
- package/dist/cjs/nodeviews/TableComponent.js +46 -59
- package/dist/cjs/nodeviews/TableContainer.js +5 -5
- package/dist/cjs/nodeviews/TableResizer.js +12 -12
- package/dist/cjs/nodeviews/table.js +9 -9
- package/dist/cjs/plugin.js +58 -56
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +13 -13
- package/dist/cjs/pm-plugins/keymap.js +6 -8
- package/dist/cjs/pm-plugins/main.js +4 -6
- package/dist/cjs/pm-plugins/sticky-headers/plugin.js +2 -3
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +12 -12
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/consts.js +4 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/index.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +3 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +3 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +11 -12
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +13 -13
- package/dist/cjs/pm-plugins/table-width.js +6 -2
- package/dist/cjs/toolbar.js +21 -21
- package/dist/cjs/transforms/column-width.js +4 -4
- package/dist/cjs/transforms/delete-columns.js +2 -2
- package/dist/cjs/ui/ColumnResizeWidget/index.js +4 -5
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +53 -55
- package/dist/cjs/ui/FloatingContextualMenu/index.js +2 -4
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +2 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +6 -6
- package/dist/cjs/ui/FloatingInsertButton/index.js +6 -7
- package/dist/cjs/utils/create.js +2 -5
- package/dist/cjs/utils/drag-menu.js +4 -4
- package/dist/cjs/utils/guidelines.js +5 -2
- package/dist/cjs/utils/snapping.js +14 -1
- package/dist/es2019/commands/column-resize.js +3 -3
- package/dist/es2019/commands/delete.js +2 -2
- package/dist/es2019/commands/insert.js +12 -12
- package/dist/es2019/commands-with-analytics.js +6 -6
- package/dist/es2019/event-handlers.js +2 -2
- package/dist/es2019/nodeviews/TableComponent.js +25 -36
- package/dist/es2019/nodeviews/TableContainer.js +6 -6
- package/dist/es2019/nodeviews/TableResizer.js +14 -14
- package/dist/es2019/nodeviews/table.js +9 -9
- package/dist/es2019/plugin.js +17 -17
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +6 -6
- package/dist/es2019/pm-plugins/keymap.js +5 -8
- package/dist/es2019/pm-plugins/main.js +3 -5
- package/dist/es2019/pm-plugins/sticky-headers/plugin.js +1 -1
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +5 -5
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/consts.js +3 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +3 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +12 -13
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +13 -13
- package/dist/es2019/pm-plugins/table-width.js +6 -2
- package/dist/es2019/toolbar.js +15 -15
- package/dist/es2019/transforms/column-width.js +5 -5
- package/dist/es2019/transforms/delete-columns.js +2 -2
- package/dist/es2019/ui/ColumnResizeWidget/index.js +0 -1
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +9 -12
- package/dist/es2019/ui/FloatingContextualMenu/index.js +2 -4
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +2 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +5 -5
- package/dist/es2019/ui/FloatingInsertButton/index.js +5 -6
- package/dist/es2019/utils/create.js +2 -5
- package/dist/es2019/utils/drag-menu.js +4 -4
- package/dist/es2019/utils/guidelines.js +3 -2
- package/dist/es2019/utils/snapping.js +12 -1
- package/dist/esm/commands/column-resize.js +3 -3
- package/dist/esm/commands/delete.js +2 -2
- package/dist/esm/commands/insert.js +15 -15
- package/dist/esm/commands-with-analytics.js +7 -7
- package/dist/esm/event-handlers.js +2 -2
- package/dist/esm/nodeviews/TableComponent.js +45 -58
- package/dist/esm/nodeviews/TableContainer.js +6 -6
- package/dist/esm/nodeviews/TableResizer.js +14 -14
- package/dist/esm/nodeviews/table.js +9 -9
- package/dist/esm/plugin.js +58 -56
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +13 -13
- package/dist/esm/pm-plugins/keymap.js +6 -8
- package/dist/esm/pm-plugins/main.js +4 -6
- package/dist/esm/pm-plugins/sticky-headers/plugin.js +2 -3
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +12 -12
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/utils/consts.js +3 -1
- package/dist/esm/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +4 -3
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +13 -14
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +13 -13
- package/dist/esm/pm-plugins/table-width.js +6 -2
- package/dist/esm/toolbar.js +21 -21
- package/dist/esm/transforms/column-width.js +5 -5
- package/dist/esm/transforms/delete-columns.js +2 -2
- package/dist/esm/ui/ColumnResizeWidget/index.js +0 -1
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +53 -55
- package/dist/esm/ui/FloatingContextualMenu/index.js +2 -4
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +2 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +6 -6
- package/dist/esm/ui/FloatingInsertButton/index.js +6 -7
- package/dist/esm/utils/create.js +2 -5
- package/dist/esm/utils/drag-menu.js +4 -4
- package/dist/esm/utils/guidelines.js +5 -2
- package/dist/esm/utils/snapping.js +14 -1
- package/dist/types/commands/column-resize.d.ts +1 -1
- package/dist/types/commands/delete.d.ts +1 -1
- package/dist/types/commands/insert.d.ts +7 -7
- package/dist/types/commands-with-analytics.d.ts +3 -3
- package/dist/types/event-handlers.d.ts +1 -1
- package/dist/types/nodeviews/TableComponent.d.ts +2 -3
- package/dist/types/nodeviews/TableContainer.d.ts +4 -4
- package/dist/types/nodeviews/TableResizer.d.ts +2 -2
- package/dist/types/nodeviews/table.d.ts +1 -1
- package/dist/types/nodeviews/types.d.ts +1 -0
- package/dist/types/plugin.d.ts +1 -0
- package/dist/types/pm-plugins/drag-and-drop/plugin.d.ts +1 -2
- package/dist/types/pm-plugins/keymap.d.ts +2 -2
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/sticky-headers/plugin.d.ts +2 -3
- package/dist/types/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -1
- 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 +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -1
- package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +4 -4
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +4 -4
- package/dist/types/pm-plugins/table-width.d.ts +1 -2
- 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/types.d.ts +1 -0
- package/dist/types/ui/ColumnResizeWidget/index.d.ts +2 -2
- package/dist/types/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -2
- package/dist/types/ui/FloatingDragMenu/index.d.ts +2 -3
- package/dist/types/ui/FloatingInsertButton/index.d.ts +1 -2
- package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +2 -2
- package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +2 -2
- package/dist/types/ui/TableFloatingColumnControls/index.d.ts +2 -2
- package/dist/types/utils/create.d.ts +1 -2
- package/dist/types/utils/drag-menu.d.ts +2 -2
- package/dist/types/utils/guidelines.d.ts +1 -0
- package/dist/types/utils/snapping.d.ts +2 -0
- package/dist/types-ts4.5/commands/column-resize.d.ts +1 -1
- package/dist/types-ts4.5/commands/delete.d.ts +1 -1
- package/dist/types-ts4.5/commands/insert.d.ts +7 -7
- 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/TableComponent.d.ts +2 -3
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -4
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -2
- package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/types.d.ts +1 -0
- package/dist/types-ts4.5/plugin.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin.d.ts +1 -2
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/sticky-headers/plugin.d.ts +2 -3
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -1
- 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 +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +4 -4
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +4 -4
- package/dist/types-ts4.5/pm-plugins/table-width.d.ts +1 -2
- 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/types.d.ts +1 -0
- package/dist/types-ts4.5/ui/ColumnResizeWidget/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +2 -3
- package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +1 -2
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +2 -2
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +2 -2
- package/dist/types-ts4.5/utils/create.d.ts +1 -2
- package/dist/types-ts4.5/utils/drag-menu.d.ts +2 -2
- package/dist/types-ts4.5/utils/guidelines.d.ts +1 -0
- package/dist/types-ts4.5/utils/snapping.d.ts +2 -0
- package/package.json +2 -2
- package/src/commands/column-resize.ts +4 -3
- package/src/commands/delete.ts +2 -2
- package/src/commands/insert.ts +15 -27
- package/src/commands-with-analytics.ts +6 -9
- package/src/event-handlers.ts +2 -2
- package/src/nodeviews/TableComponent.tsx +31 -46
- package/src/nodeviews/TableContainer.tsx +16 -7
- package/src/nodeviews/TableResizer.tsx +44 -24
- package/src/nodeviews/table.tsx +6 -5
- package/src/nodeviews/types.ts +1 -0
- package/src/plugin.tsx +12 -28
- package/src/pm-plugins/drag-and-drop/plugin.ts +10 -15
- package/src/pm-plugins/keymap.ts +6 -13
- package/src/pm-plugins/main.ts +3 -3
- package/src/pm-plugins/sticky-headers/plugin.ts +2 -11
- package/src/pm-plugins/table-resizing/event-handlers.ts +6 -4
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +2 -2
- package/src/pm-plugins/table-resizing/utils/consts.ts +2 -0
- package/src/pm-plugins/table-resizing/utils/index.ts +1 -1
- package/src/pm-plugins/table-resizing/utils/misc.ts +2 -2
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +5 -2
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +18 -13
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +14 -14
- package/src/pm-plugins/table-width.ts +4 -6
- package/src/toolbar.tsx +16 -19
- package/src/transforms/column-width.ts +7 -6
- package/src/transforms/delete-columns.ts +2 -2
- package/src/types.ts +1 -0
- package/src/ui/ColumnResizeWidget/index.tsx +2 -4
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +11 -16
- package/src/ui/FloatingContextualMenu/index.tsx +0 -2
- package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -3
- package/src/ui/FloatingDragMenu/index.tsx +4 -8
- package/src/ui/FloatingInsertButton/index.tsx +11 -22
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +2 -2
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +2 -2
- package/src/ui/TableFloatingColumnControls/index.tsx +2 -2
- package/src/utils/create.ts +2 -5
- package/src/utils/drag-menu.ts +8 -13
- package/src/utils/guidelines.ts +12 -1
- package/src/utils/snapping.ts +36 -0
package/src/commands/insert.ts
CHANGED
|
@@ -11,12 +11,7 @@ import {
|
|
|
11
11
|
EVENT_TYPE,
|
|
12
12
|
TABLE_OVERFLOW_CHANGE_TRIGGER,
|
|
13
13
|
} from '@atlaskit/editor-common/analytics';
|
|
14
|
-
import type {
|
|
15
|
-
Command,
|
|
16
|
-
EditorCommand,
|
|
17
|
-
GetEditorContainerWidth,
|
|
18
|
-
GetEditorFeatureFlags,
|
|
19
|
-
} from '@atlaskit/editor-common/types';
|
|
14
|
+
import type { Command, EditorCommand } from '@atlaskit/editor-common/types';
|
|
20
15
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
21
16
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
22
17
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -50,10 +45,7 @@ function addColumnAtCustomStep(column: number) {
|
|
|
50
45
|
};
|
|
51
46
|
}
|
|
52
47
|
|
|
53
|
-
export function addColumnAt(
|
|
54
|
-
getEditorContainerWidth: GetEditorContainerWidth,
|
|
55
|
-
tablePreserveWidth = false,
|
|
56
|
-
) {
|
|
48
|
+
export function addColumnAt(isTableScalingEnabled = false) {
|
|
57
49
|
return (
|
|
58
50
|
column: number,
|
|
59
51
|
allowAddColumnCustomStep: boolean = false,
|
|
@@ -69,7 +61,9 @@ export function addColumnAt(
|
|
|
69
61
|
const table = findTable(updatedTr.selection);
|
|
70
62
|
if (table) {
|
|
71
63
|
// [ED-8288] Update colwidths manually to avoid multiple dispatch in TableComponent
|
|
72
|
-
updatedTr = rescaleColumns(
|
|
64
|
+
updatedTr = rescaleColumns(isTableScalingEnabled)(table, view)(
|
|
65
|
+
updatedTr,
|
|
66
|
+
);
|
|
73
67
|
}
|
|
74
68
|
|
|
75
69
|
if (
|
|
@@ -94,10 +88,7 @@ export function addColumnAt(
|
|
|
94
88
|
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
95
89
|
// Command to add a column before the column with the selection.
|
|
96
90
|
export const addColumnBefore =
|
|
97
|
-
(
|
|
98
|
-
getEditorContainerWidth: GetEditorContainerWidth,
|
|
99
|
-
tablePreserveWidth = false,
|
|
100
|
-
): Command =>
|
|
91
|
+
(isTableScalingEnabled = false): Command =>
|
|
101
92
|
(state, dispatch, view) => {
|
|
102
93
|
const table = findTable(state.selection);
|
|
103
94
|
if (!table) {
|
|
@@ -106,7 +97,7 @@ export const addColumnBefore =
|
|
|
106
97
|
if (dispatch) {
|
|
107
98
|
let rect = selectedRect(state);
|
|
108
99
|
dispatch(
|
|
109
|
-
addColumnAt(
|
|
100
|
+
addColumnAt(isTableScalingEnabled)(
|
|
110
101
|
rect.left,
|
|
111
102
|
getAllowAddColumnCustomStep(state),
|
|
112
103
|
view,
|
|
@@ -119,7 +110,7 @@ export const addColumnBefore =
|
|
|
119
110
|
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
120
111
|
// Command to add a column after the column with the selection.
|
|
121
112
|
export const addColumnAfter =
|
|
122
|
-
(
|
|
113
|
+
(isTableScalingEnabled?: boolean): Command =>
|
|
123
114
|
(state, dispatch, view) => {
|
|
124
115
|
const table = findTable(state.selection);
|
|
125
116
|
if (!table) {
|
|
@@ -128,7 +119,7 @@ export const addColumnAfter =
|
|
|
128
119
|
if (dispatch) {
|
|
129
120
|
let rect = selectedRect(state);
|
|
130
121
|
dispatch(
|
|
131
|
-
addColumnAt(
|
|
122
|
+
addColumnAt(isTableScalingEnabled)(
|
|
132
123
|
rect.right,
|
|
133
124
|
getAllowAddColumnCustomStep(state),
|
|
134
125
|
view,
|
|
@@ -139,13 +130,10 @@ export const addColumnAfter =
|
|
|
139
130
|
};
|
|
140
131
|
|
|
141
132
|
export const insertColumn =
|
|
142
|
-
(
|
|
143
|
-
getEditorContainerWidth: GetEditorContainerWidth,
|
|
144
|
-
tablePreserveWidth = false,
|
|
145
|
-
) =>
|
|
133
|
+
(isTableScalingEnabled = false) =>
|
|
146
134
|
(column: number): Command =>
|
|
147
135
|
(state, dispatch, view) => {
|
|
148
|
-
let tr = addColumnAt(
|
|
136
|
+
let tr = addColumnAt(isTableScalingEnabled)(
|
|
149
137
|
column,
|
|
150
138
|
getAllowAddColumnCustomStep(state),
|
|
151
139
|
view,
|
|
@@ -213,13 +201,13 @@ export const insertRow =
|
|
|
213
201
|
|
|
214
202
|
export const createTable =
|
|
215
203
|
(
|
|
204
|
+
isTableScalingEnabled?: boolean,
|
|
216
205
|
isFullWidthModeEnabled?: boolean,
|
|
217
|
-
getEditorFeatureFlags?: GetEditorFeatureFlags,
|
|
218
206
|
): Command =>
|
|
219
207
|
(state, dispatch) => {
|
|
220
208
|
const table = createTableWithWidth(
|
|
209
|
+
isTableScalingEnabled,
|
|
221
210
|
isFullWidthModeEnabled,
|
|
222
|
-
getEditorFeatureFlags,
|
|
223
211
|
)(state.schema);
|
|
224
212
|
|
|
225
213
|
if (dispatch) {
|
|
@@ -231,7 +219,7 @@ export const createTable =
|
|
|
231
219
|
export const insertTableWithSize =
|
|
232
220
|
(
|
|
233
221
|
isFullWidthModeEnabled?: boolean,
|
|
234
|
-
|
|
222
|
+
isTableScalingEnabled?: boolean,
|
|
235
223
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
236
224
|
) =>
|
|
237
225
|
(
|
|
@@ -241,8 +229,8 @@ export const insertTableWithSize =
|
|
|
241
229
|
): EditorCommand => {
|
|
242
230
|
return ({ tr }) => {
|
|
243
231
|
const tableNode = createTableWithWidth(
|
|
232
|
+
isTableScalingEnabled,
|
|
244
233
|
isFullWidthModeEnabled,
|
|
245
|
-
getEditorFeatureFlags,
|
|
246
234
|
{
|
|
247
235
|
rowsCount: rowsCount,
|
|
248
236
|
colsCount: colsCount,
|
|
@@ -257,7 +257,7 @@ export const changeColumnWidthByStepWithAnalytics =
|
|
|
257
257
|
(
|
|
258
258
|
stepSize: number,
|
|
259
259
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
260
|
-
|
|
260
|
+
isTableScalingEnabled: boolean,
|
|
261
261
|
inputMethod: INPUT_METHOD.SHORTCUT,
|
|
262
262
|
) =>
|
|
263
263
|
withEditorAnalyticsAPI((state) => {
|
|
@@ -286,15 +286,14 @@ export const changeColumnWidthByStepWithAnalytics =
|
|
|
286
286
|
changeColumnWidthByStep(
|
|
287
287
|
stepSize,
|
|
288
288
|
getEditorContainerWidth,
|
|
289
|
-
|
|
289
|
+
isTableScalingEnabled,
|
|
290
290
|
),
|
|
291
291
|
);
|
|
292
292
|
|
|
293
293
|
export const insertColumnWithAnalytics =
|
|
294
294
|
(
|
|
295
|
-
getEditorContainerWidth: GetEditorContainerWidth,
|
|
296
295
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
297
|
-
|
|
296
|
+
isTableScalingEnabled = false,
|
|
298
297
|
) =>
|
|
299
298
|
(
|
|
300
299
|
inputMethod:
|
|
@@ -321,9 +320,7 @@ export const insertColumnWithAnalytics =
|
|
|
321
320
|
},
|
|
322
321
|
eventType: EVENT_TYPE.TRACK,
|
|
323
322
|
};
|
|
324
|
-
})(editorAnalyticsAPI)(
|
|
325
|
-
insertColumn(getEditorContainerWidth, tablePreserveWidth)(position),
|
|
326
|
-
);
|
|
323
|
+
})(editorAnalyticsAPI)(insertColumn(isTableScalingEnabled)(position));
|
|
327
324
|
|
|
328
325
|
export const deleteRowsWithAnalytics =
|
|
329
326
|
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
@@ -364,7 +361,7 @@ export const deleteRowsWithAnalytics =
|
|
|
364
361
|
export const deleteColumnsWithAnalytics =
|
|
365
362
|
(
|
|
366
363
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
367
|
-
|
|
364
|
+
isTableScalingEnabled = false,
|
|
368
365
|
) =>
|
|
369
366
|
(
|
|
370
367
|
inputMethod:
|
|
@@ -392,7 +389,7 @@ export const deleteColumnsWithAnalytics =
|
|
|
392
389
|
},
|
|
393
390
|
eventType: EVENT_TYPE.TRACK,
|
|
394
391
|
};
|
|
395
|
-
})(editorAnalyticsAPI)(deleteColumnsCommand(rect,
|
|
392
|
+
})(editorAnalyticsAPI)(deleteColumnsCommand(rect, isTableScalingEnabled));
|
|
396
393
|
|
|
397
394
|
export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut =
|
|
398
395
|
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null): Command =>
|
package/src/event-handlers.ts
CHANGED
|
@@ -538,7 +538,7 @@ export const handleCut = (
|
|
|
538
538
|
newState: EditorState,
|
|
539
539
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
540
540
|
editorView?: EditorView,
|
|
541
|
-
|
|
541
|
+
isTableScalingEnabled = false,
|
|
542
542
|
): Transaction => {
|
|
543
543
|
const oldSelection = oldState.tr.selection;
|
|
544
544
|
let { tr } = newState;
|
|
@@ -595,7 +595,7 @@ export const handleCut = (
|
|
|
595
595
|
rect,
|
|
596
596
|
getAllowAddColumnCustomStep(oldState),
|
|
597
597
|
editorView,
|
|
598
|
-
|
|
598
|
+
isTableScalingEnabled,
|
|
599
599
|
)(tr);
|
|
600
600
|
}
|
|
601
601
|
}
|
|
@@ -22,11 +22,7 @@ import type {
|
|
|
22
22
|
EditorContainerWidth,
|
|
23
23
|
GetEditorFeatureFlags,
|
|
24
24
|
} from '@atlaskit/editor-common/types';
|
|
25
|
-
import {
|
|
26
|
-
browser,
|
|
27
|
-
calcTableColumnWidths,
|
|
28
|
-
isValidPosition,
|
|
29
|
-
} from '@atlaskit/editor-common/utils';
|
|
25
|
+
import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
|
|
30
26
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
31
27
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
32
28
|
import {
|
|
@@ -59,6 +55,7 @@ import {
|
|
|
59
55
|
updateColgroup,
|
|
60
56
|
} from '../pm-plugins/table-resizing/utils';
|
|
61
57
|
import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
58
|
+
import { TABLE_EDITOR_MARGIN } from '../pm-plugins/table-resizing/utils/consts';
|
|
62
59
|
import { updateControls } from '../pm-plugins/table-resizing/utils/dom';
|
|
63
60
|
import type { PluginInjectionAPI } from '../types';
|
|
64
61
|
import { TableCssClassName as ClassName, ShadowEvent } from '../types';
|
|
@@ -102,13 +99,13 @@ export interface ComponentProps {
|
|
|
102
99
|
isHeaderColumnEnabled: boolean;
|
|
103
100
|
isMediaFullscreen?: boolean;
|
|
104
101
|
isDragAndDropEnabled?: boolean;
|
|
102
|
+
isTableScalingEnabled?: boolean;
|
|
105
103
|
tableActive: boolean;
|
|
106
104
|
ordering: TableColumnOrdering;
|
|
107
105
|
isResizing?: boolean;
|
|
108
106
|
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
109
107
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
110
108
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
111
|
-
tableRef?: HTMLElement | undefined;
|
|
112
109
|
}
|
|
113
110
|
|
|
114
111
|
interface TableState {
|
|
@@ -142,8 +139,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
142
139
|
|
|
143
140
|
private dragAndDropCleanupFn?: CleanupFn;
|
|
144
141
|
|
|
145
|
-
private tableColumnWidths?: number[];
|
|
146
|
-
|
|
147
142
|
constructor(props: ComponentProps) {
|
|
148
143
|
super(props);
|
|
149
144
|
const { options, containerWidth, getNode } = props;
|
|
@@ -182,8 +177,13 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
182
177
|
isDragAndDropEnabled,
|
|
183
178
|
getNode,
|
|
184
179
|
getEditorFeatureFlags,
|
|
180
|
+
isTableScalingEnabled,
|
|
185
181
|
} = this.props;
|
|
186
182
|
|
|
183
|
+
if (isTableScalingEnabled) {
|
|
184
|
+
this.handleColgroupUpdates(true);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
187
|
if (allowColumnResizing && this.wrapper && !isIE11) {
|
|
188
188
|
this.wrapper.addEventListener('scroll', this.handleScrollDebounced, {
|
|
189
189
|
passive: true,
|
|
@@ -288,20 +288,17 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
handleColgroupUpdates() {
|
|
292
|
-
const { getNode, containerWidth, isResizing, view, getPos
|
|
293
|
-
this.props;
|
|
291
|
+
handleColgroupUpdates(force = false) {
|
|
292
|
+
const { getNode, containerWidth, isResizing, view, getPos } = this.props;
|
|
294
293
|
|
|
295
|
-
if (!
|
|
294
|
+
if (!this.table) {
|
|
296
295
|
return;
|
|
297
296
|
}
|
|
298
297
|
|
|
299
|
-
const TABLE_MARGIN = 76;
|
|
300
|
-
|
|
301
298
|
// Remove any widths styles after resizing preview is completed
|
|
302
|
-
|
|
299
|
+
this.table.style.width = '';
|
|
303
300
|
|
|
304
|
-
const tableRenderWidth = containerWidth.width -
|
|
301
|
+
const tableRenderWidth = containerWidth.width - TABLE_EDITOR_MARGIN;
|
|
305
302
|
const tableNode = getNode();
|
|
306
303
|
const start = getPos() || 0;
|
|
307
304
|
const depth = view.state.doc.resolve(start).depth;
|
|
@@ -312,39 +309,25 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
312
309
|
}
|
|
313
310
|
|
|
314
311
|
const { width: tableNodeWidth } = tableNode.attrs;
|
|
315
|
-
const tableColumnWidths = calcTableColumnWidths(tableNode);
|
|
316
312
|
const shouldTableScale = tableRenderWidth < tableNodeWidth;
|
|
317
|
-
|
|
318
|
-
if (this.tableColumnWidths) {
|
|
319
|
-
isTableColumnWidthsSame = tableColumnWidths?.every(
|
|
320
|
-
(width, index) => width === this.tableColumnWidths![index],
|
|
321
|
-
);
|
|
322
|
-
}
|
|
313
|
+
|
|
323
314
|
const { width: containerWidthValue } = containerWidth;
|
|
324
315
|
const isWidthChanged = this.containerWidth?.width !== containerWidthValue;
|
|
325
316
|
|
|
326
|
-
if (
|
|
327
|
-
shouldTableScale &&
|
|
328
|
-
!isResizing &&
|
|
329
|
-
(!isTableColumnWidthsSame || isWidthChanged)
|
|
330
|
-
) {
|
|
317
|
+
if (force || (shouldTableScale && !isResizing && isWidthChanged)) {
|
|
331
318
|
const resizeState = getResizeState({
|
|
332
319
|
minWidth: COLUMN_MIN_WIDTH,
|
|
333
320
|
maxSize: tableRenderWidth,
|
|
334
321
|
table: tableNode,
|
|
335
|
-
tableRef: this.table
|
|
322
|
+
tableRef: this.table,
|
|
336
323
|
start,
|
|
337
324
|
domAtPos: view.domAtPos,
|
|
338
|
-
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
requestAnimationFrame(() => {
|
|
342
|
-
updateColgroup(resizeState, this.table!, true);
|
|
325
|
+
isTableScalingEnabled: true,
|
|
343
326
|
});
|
|
344
327
|
|
|
345
|
-
this.
|
|
346
|
-
this.containerWidth = containerWidth;
|
|
328
|
+
updateColgroup(resizeState, this.table!, tableNode, true);
|
|
347
329
|
}
|
|
330
|
+
this.containerWidth = containerWidth;
|
|
348
331
|
}
|
|
349
332
|
|
|
350
333
|
componentDidUpdate(_: any, prevState: TableState) {
|
|
@@ -355,13 +338,12 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
355
338
|
allowColumnResizing,
|
|
356
339
|
isResizing,
|
|
357
340
|
options,
|
|
358
|
-
|
|
341
|
+
isTableScalingEnabled,
|
|
359
342
|
} = this.props;
|
|
360
343
|
const { isInDanger } = getPluginState(view.state);
|
|
361
|
-
const { tablePreserveWidth = false } = getEditorFeatureFlags();
|
|
362
344
|
const table = findTable(view.state.selection);
|
|
363
345
|
|
|
364
|
-
if (
|
|
346
|
+
if (isTableScalingEnabled) {
|
|
365
347
|
this.handleColgroupUpdates();
|
|
366
348
|
}
|
|
367
349
|
|
|
@@ -424,7 +406,11 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
424
406
|
isResizing);
|
|
425
407
|
|
|
426
408
|
if (shouldRecreateResizeCols) {
|
|
427
|
-
insertColgroupFromNode(
|
|
409
|
+
insertColgroupFromNode(
|
|
410
|
+
this.table,
|
|
411
|
+
currentTable,
|
|
412
|
+
isTableScalingEnabled,
|
|
413
|
+
);
|
|
428
414
|
}
|
|
429
415
|
|
|
430
416
|
updateControls()(view.state);
|
|
@@ -517,6 +503,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
517
503
|
pluginInjectionApi,
|
|
518
504
|
isDragAndDropEnabled,
|
|
519
505
|
getEditorFeatureFlags,
|
|
506
|
+
isTableScalingEnabled,
|
|
520
507
|
} = this.props;
|
|
521
508
|
|
|
522
509
|
const { showBeforeShadow, showAfterShadow } = this.state;
|
|
@@ -610,7 +597,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
610
597
|
shadowPadding +
|
|
611
598
|
2;
|
|
612
599
|
|
|
613
|
-
const { stickyScrollbar
|
|
600
|
+
const { stickyScrollbar } = getEditorFeatureFlags();
|
|
614
601
|
|
|
615
602
|
return (
|
|
616
603
|
<TableContainer
|
|
@@ -630,7 +617,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
630
617
|
pluginInjectionApi={pluginInjectionApi}
|
|
631
618
|
isTableResizingEnabled={options?.isTableResizingEnabled}
|
|
632
619
|
isResizing={isResizing}
|
|
633
|
-
|
|
620
|
+
isTableScalingEnabled={isTableScalingEnabled}
|
|
634
621
|
>
|
|
635
622
|
<div
|
|
636
623
|
className={ClassName.TABLE_STICKY_SENTINEL_TOP}
|
|
@@ -860,7 +847,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
860
847
|
getPos,
|
|
861
848
|
containerWidth,
|
|
862
849
|
options,
|
|
863
|
-
|
|
850
|
+
isTableScalingEnabled,
|
|
864
851
|
} = this.props;
|
|
865
852
|
const node = getNode();
|
|
866
853
|
const { state, dispatch } = view;
|
|
@@ -874,8 +861,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
874
861
|
|
|
875
862
|
this.scaleTableDebounced.cancel();
|
|
876
863
|
|
|
877
|
-
const { tablePreserveWidth = false } = getEditorFeatureFlags();
|
|
878
|
-
|
|
879
864
|
const tr = scaleTable(
|
|
880
865
|
this.table,
|
|
881
866
|
{
|
|
@@ -888,7 +873,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
888
873
|
...options,
|
|
889
874
|
},
|
|
890
875
|
domAtPos,
|
|
891
|
-
|
|
876
|
+
isTableScalingEnabled,
|
|
892
877
|
)(state.tr);
|
|
893
878
|
|
|
894
879
|
dispatch(tr);
|
|
@@ -12,6 +12,8 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
12
12
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
13
13
|
import {
|
|
14
14
|
akEditorDefaultLayoutWidth,
|
|
15
|
+
akEditorGutterPadding,
|
|
16
|
+
akEditorMediaResizeHandlerPaddingWide,
|
|
15
17
|
akEditorMobileBreakoutPoint,
|
|
16
18
|
} from '@atlaskit/editor-shared-styles';
|
|
17
19
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -75,7 +77,7 @@ type ResizableTableContainerProps = {
|
|
|
75
77
|
tableRef: HTMLTableElement;
|
|
76
78
|
isResizing?: boolean;
|
|
77
79
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
78
|
-
|
|
80
|
+
isTableScalingEnabled?: boolean;
|
|
79
81
|
};
|
|
80
82
|
|
|
81
83
|
export const ResizableTableContainer = React.memo(
|
|
@@ -89,7 +91,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
89
91
|
tableRef,
|
|
90
92
|
isResizing,
|
|
91
93
|
pluginInjectionApi,
|
|
92
|
-
|
|
94
|
+
isTableScalingEnabled,
|
|
93
95
|
}: PropsWithChildren<ResizableTableContainerProps>) => {
|
|
94
96
|
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
95
97
|
const tableWidthRef = useRef<number>(akEditorDefaultLayoutWidth);
|
|
@@ -189,7 +191,14 @@ export const ResizableTableContainer = React.memo(
|
|
|
189
191
|
|
|
190
192
|
const tableWidth = getTableContainerWidth(node);
|
|
191
193
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
192
|
-
const responsiveContainerWidth =
|
|
194
|
+
const responsiveContainerWidth = isTableScalingEnabled
|
|
195
|
+
? containerWidth -
|
|
196
|
+
akEditorGutterPadding * 2 -
|
|
197
|
+
akEditorMediaResizeHandlerPaddingWide / 2
|
|
198
|
+
: containerWidth -
|
|
199
|
+
akEditorGutterPadding * 2 -
|
|
200
|
+
akEditorMediaResizeHandlerPaddingWide;
|
|
201
|
+
|
|
193
202
|
const width = Math.min(tableWidth, responsiveContainerWidth);
|
|
194
203
|
|
|
195
204
|
if (!isResizing) {
|
|
@@ -209,7 +218,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
209
218
|
displayGuideline,
|
|
210
219
|
attachAnalyticsEvent,
|
|
211
220
|
displayGapCursor,
|
|
212
|
-
|
|
221
|
+
isTableScalingEnabled,
|
|
213
222
|
};
|
|
214
223
|
|
|
215
224
|
if (getBooleanFF('platform.editor.resizing-table-height-improvement')) {
|
|
@@ -257,7 +266,7 @@ type TableContainerProps = {
|
|
|
257
266
|
isNested: boolean;
|
|
258
267
|
isResizing?: boolean;
|
|
259
268
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
260
|
-
|
|
269
|
+
isTableScalingEnabled?: boolean;
|
|
261
270
|
};
|
|
262
271
|
|
|
263
272
|
export const TableContainer = ({
|
|
@@ -273,7 +282,7 @@ export const TableContainer = ({
|
|
|
273
282
|
isNested,
|
|
274
283
|
isResizing,
|
|
275
284
|
pluginInjectionApi,
|
|
276
|
-
|
|
285
|
+
isTableScalingEnabled,
|
|
277
286
|
}: PropsWithChildren<TableContainerProps>) => {
|
|
278
287
|
if (isTableResizingEnabled && !isNested) {
|
|
279
288
|
return (
|
|
@@ -286,7 +295,7 @@ export const TableContainer = ({
|
|
|
286
295
|
tableRef={tableRef}
|
|
287
296
|
isResizing={isResizing}
|
|
288
297
|
pluginInjectionApi={pluginInjectionApi}
|
|
289
|
-
|
|
298
|
+
isTableScalingEnabled={isTableScalingEnabled}
|
|
290
299
|
>
|
|
291
300
|
{children}
|
|
292
301
|
</ResizableTableContainer>
|
|
@@ -51,8 +51,15 @@ import {
|
|
|
51
51
|
generateResizeFrameRatePayloads,
|
|
52
52
|
useMeasureFramerate,
|
|
53
53
|
} from '../utils/analytics';
|
|
54
|
-
import {
|
|
55
|
-
|
|
54
|
+
import {
|
|
55
|
+
defaultGuidelines,
|
|
56
|
+
defaultGuidelinesForPreserveTable,
|
|
57
|
+
} from '../utils/guidelines';
|
|
58
|
+
import {
|
|
59
|
+
defaultSnappingWidths,
|
|
60
|
+
defaultTablePreserveSnappingWidths,
|
|
61
|
+
findClosestSnap,
|
|
62
|
+
} from '../utils/snapping';
|
|
56
63
|
|
|
57
64
|
interface TableResizerProps {
|
|
58
65
|
width: number;
|
|
@@ -68,7 +75,7 @@ interface TableResizerProps {
|
|
|
68
75
|
payload: TableEventPayload,
|
|
69
76
|
) => ((tr: Transaction) => boolean) | undefined;
|
|
70
77
|
displayGapCursor: (toggle: boolean) => boolean;
|
|
71
|
-
|
|
78
|
+
isTableScalingEnabled?: boolean;
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
export interface TableResizerImprovementProps extends TableResizerProps {
|
|
@@ -163,7 +170,7 @@ export const TableResizer = ({
|
|
|
163
170
|
displayGuideline,
|
|
164
171
|
attachAnalyticsEvent,
|
|
165
172
|
displayGapCursor,
|
|
166
|
-
|
|
173
|
+
isTableScalingEnabled,
|
|
167
174
|
}: PropsWithChildren<TableResizerImprovementProps>) => {
|
|
168
175
|
const currentGap = useRef(0);
|
|
169
176
|
// track resizing state - use ref over state to avoid re-render
|
|
@@ -211,9 +218,12 @@ export const TableResizer = ({
|
|
|
211
218
|
if (gap !== currentGap.current) {
|
|
212
219
|
currentGap.current = gap;
|
|
213
220
|
const visibleGuidelines = getVisibleGuidelines(
|
|
214
|
-
|
|
221
|
+
isTableScalingEnabled
|
|
222
|
+
? defaultGuidelinesForPreserveTable(containerWidth)
|
|
223
|
+
: defaultGuidelines,
|
|
215
224
|
containerWidth,
|
|
216
225
|
);
|
|
226
|
+
|
|
217
227
|
displayGuideline(
|
|
218
228
|
getGuidelinesWithHighlights(
|
|
219
229
|
gap,
|
|
@@ -224,17 +234,19 @@ export const TableResizer = ({
|
|
|
224
234
|
);
|
|
225
235
|
}
|
|
226
236
|
},
|
|
227
|
-
[
|
|
237
|
+
[isTableScalingEnabled, containerWidth, displayGuideline],
|
|
228
238
|
);
|
|
229
239
|
|
|
230
240
|
const guidelineSnaps = useMemo(
|
|
231
241
|
() =>
|
|
232
242
|
snappingEnabled
|
|
233
243
|
? {
|
|
234
|
-
x:
|
|
244
|
+
x: isTableScalingEnabled
|
|
245
|
+
? defaultTablePreserveSnappingWidths(containerWidth)
|
|
246
|
+
: defaultSnappingWidths,
|
|
235
247
|
}
|
|
236
248
|
: undefined,
|
|
237
|
-
[snappingEnabled],
|
|
249
|
+
[snappingEnabled, isTableScalingEnabled, containerWidth],
|
|
238
250
|
);
|
|
239
251
|
|
|
240
252
|
useEffect(() => {
|
|
@@ -270,9 +282,12 @@ export const TableResizer = ({
|
|
|
270
282
|
dispatch(tr);
|
|
271
283
|
|
|
272
284
|
const visibleGuidelines = getVisibleGuidelines(
|
|
273
|
-
|
|
285
|
+
isTableScalingEnabled
|
|
286
|
+
? defaultGuidelinesForPreserveTable(containerWidth)
|
|
287
|
+
: defaultGuidelines,
|
|
274
288
|
containerWidth,
|
|
275
289
|
);
|
|
290
|
+
|
|
276
291
|
setSnappingEnabled(displayGuideline(visibleGuidelines));
|
|
277
292
|
if (
|
|
278
293
|
getBooleanFF('platform.editor.resizing-table-height-improvement') &&
|
|
@@ -281,12 +296,13 @@ export const TableResizer = ({
|
|
|
281
296
|
onResizeStart();
|
|
282
297
|
}
|
|
283
298
|
}, [
|
|
299
|
+
startMeasure,
|
|
300
|
+
editorView,
|
|
284
301
|
displayGapCursor,
|
|
302
|
+
isTableScalingEnabled,
|
|
303
|
+
containerWidth,
|
|
285
304
|
displayGuideline,
|
|
286
|
-
editorView,
|
|
287
|
-
startMeasure,
|
|
288
305
|
onResizeStart,
|
|
289
|
-
containerWidth,
|
|
290
306
|
]);
|
|
291
307
|
|
|
292
308
|
const handleResize = useCallback(
|
|
@@ -312,32 +328,36 @@ export const TableResizer = ({
|
|
|
312
328
|
parentWidth: newWidth,
|
|
313
329
|
},
|
|
314
330
|
editorView.domAtPos.bind(editorView),
|
|
315
|
-
|
|
331
|
+
isTableScalingEnabled,
|
|
316
332
|
);
|
|
317
333
|
|
|
318
334
|
updateActiveGuidelines(
|
|
319
335
|
findClosestSnap(
|
|
320
336
|
newWidth,
|
|
321
|
-
|
|
322
|
-
|
|
337
|
+
isTableScalingEnabled
|
|
338
|
+
? defaultTablePreserveSnappingWidths(containerWidth)
|
|
339
|
+
: defaultSnappingWidths,
|
|
340
|
+
isTableScalingEnabled
|
|
341
|
+
? defaultGuidelinesForPreserveTable(containerWidth)
|
|
342
|
+
: defaultGuidelines,
|
|
323
343
|
TABLE_HIGHLIGHT_GAP,
|
|
324
344
|
TABLE_HIGHLIGHT_TOLERANCE,
|
|
325
345
|
),
|
|
326
346
|
);
|
|
327
|
-
|
|
328
347
|
updateWidth(newWidth);
|
|
329
348
|
|
|
330
349
|
return newWidth;
|
|
331
350
|
},
|
|
332
351
|
[
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
node,
|
|
352
|
+
countFrames,
|
|
353
|
+
isTableScalingEnabled,
|
|
336
354
|
tableRef,
|
|
337
|
-
|
|
355
|
+
node,
|
|
356
|
+
editorView,
|
|
338
357
|
updateActiveGuidelines,
|
|
339
|
-
|
|
340
|
-
|
|
358
|
+
containerWidth,
|
|
359
|
+
updateWidth,
|
|
360
|
+
getPos,
|
|
341
361
|
],
|
|
342
362
|
);
|
|
343
363
|
|
|
@@ -380,7 +400,7 @@ export const TableResizer = ({
|
|
|
380
400
|
parentWidth: newWidth,
|
|
381
401
|
},
|
|
382
402
|
editorView.domAtPos.bind(editorView),
|
|
383
|
-
|
|
403
|
+
isTableScalingEnabled,
|
|
384
404
|
)(tr);
|
|
385
405
|
|
|
386
406
|
const scaledNode = tr.doc.nodeAt(pos)!;
|
|
@@ -421,7 +441,7 @@ export const TableResizer = ({
|
|
|
421
441
|
attachAnalyticsEvent,
|
|
422
442
|
endMeasure,
|
|
423
443
|
onResizeStop,
|
|
424
|
-
|
|
444
|
+
isTableScalingEnabled,
|
|
425
445
|
],
|
|
426
446
|
);
|
|
427
447
|
|