@atlaskit/editor-plugin-table 9.1.3 → 9.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/cjs/nodeviews/TableCell.js +0 -2
- package/dist/cjs/nodeviews/TableComponent.js +5 -5
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +6 -4
- package/dist/cjs/nodeviews/TableContainer.js +13 -2
- package/dist/cjs/nodeviews/TableNodeViewBase.js +0 -2
- package/dist/cjs/nodeviews/TableResizer.js +5 -10
- package/dist/cjs/nodeviews/TableRow.js +0 -2
- package/dist/cjs/nodeviews/lazy-node-views.js +4 -16
- package/dist/cjs/nodeviews/table.js +3 -10
- package/dist/cjs/pm-plugins/commands/column-resize.js +1 -4
- package/dist/cjs/pm-plugins/commands/commands-with-analytics.js +4 -16
- package/dist/cjs/pm-plugins/commands/insert.js +4 -19
- package/dist/cjs/pm-plugins/commands/misc.js +3 -12
- package/dist/cjs/pm-plugins/decorations/plugin.js +1 -6
- package/dist/cjs/pm-plugins/decorations/utils/column-resizing.js +1 -4
- package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -12
- package/dist/cjs/pm-plugins/drag-and-drop/commands.js +3 -12
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +1 -4
- package/dist/cjs/pm-plugins/keymap.js +0 -2
- package/dist/cjs/pm-plugins/main.js +1 -6
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +1 -4
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +0 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +1 -7
- package/dist/cjs/pm-plugins/table-resizing/utils/column-state.js +1 -4
- package/dist/cjs/pm-plugins/table-resizing/utils/content-width.js +0 -8
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-logic.js +2 -10
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +1 -4
- package/dist/cjs/pm-plugins/table-width.js +1 -6
- package/dist/cjs/pm-plugins/transforms/column-width.js +1 -4
- package/dist/cjs/pm-plugins/transforms/fix-tables.js +3 -15
- package/dist/cjs/pm-plugins/transforms/replace-table.js +1 -4
- package/dist/cjs/pm-plugins/transforms/split.js +0 -2
- package/dist/cjs/pm-plugins/utils/alignment.js +1 -4
- package/dist/cjs/pm-plugins/utils/decoration.js +4 -16
- package/dist/cjs/pm-plugins/utils/drag-menu.js +1 -4
- package/dist/cjs/pm-plugins/utils/nodes.js +0 -3
- package/dist/cjs/pm-plugins/utils/paste.js +4 -0
- package/dist/cjs/pm-plugins/utils/row-controls.js +1 -4
- package/dist/cjs/tablePlugin.js +1 -0
- package/dist/cjs/ui/DragHandle/index.js +55 -6
- package/dist/cjs/ui/FloatingInsertButton/getPopupOptions.js +0 -6
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +18 -6
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +1 -2
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +61 -11
- package/dist/cjs/ui/TableFloatingControls/index.js +25 -8
- package/dist/cjs/ui/toolbar.js +3 -12
- package/dist/es2019/nodeviews/TableCell.js +0 -2
- package/dist/es2019/nodeviews/TableComponent.js +5 -5
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +6 -4
- package/dist/es2019/nodeviews/TableContainer.js +13 -2
- package/dist/es2019/nodeviews/TableNodeViewBase.js +0 -2
- package/dist/es2019/nodeviews/TableResizer.js +5 -10
- package/dist/es2019/nodeviews/TableRow.js +0 -2
- package/dist/es2019/nodeviews/lazy-node-views.js +4 -16
- package/dist/es2019/nodeviews/table.js +3 -10
- package/dist/es2019/pm-plugins/commands/column-resize.js +1 -4
- package/dist/es2019/pm-plugins/commands/commands-with-analytics.js +6 -24
- package/dist/es2019/pm-plugins/commands/delete.js +1 -4
- package/dist/es2019/pm-plugins/commands/insert.js +5 -23
- package/dist/es2019/pm-plugins/commands/misc.js +3 -12
- package/dist/es2019/pm-plugins/decorations/plugin.js +1 -6
- package/dist/es2019/pm-plugins/decorations/utils/column-resizing.js +1 -4
- package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -12
- package/dist/es2019/pm-plugins/drag-and-drop/commands.js +4 -16
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +2 -8
- package/dist/es2019/pm-plugins/keymap.js +0 -3
- package/dist/es2019/pm-plugins/main.js +1 -6
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +1 -4
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +0 -3
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +2 -11
- package/dist/es2019/pm-plugins/table-resizing/utils/column-state.js +1 -4
- package/dist/es2019/pm-plugins/table-resizing/utils/content-width.js +0 -8
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +1 -4
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-logic.js +2 -10
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +2 -8
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +4 -16
- package/dist/es2019/pm-plugins/table-width.js +1 -6
- package/dist/es2019/pm-plugins/transforms/column-width.js +2 -8
- package/dist/es2019/pm-plugins/transforms/delete-columns.js +1 -4
- package/dist/es2019/pm-plugins/transforms/fix-tables.js +3 -15
- package/dist/es2019/pm-plugins/transforms/replace-table.js +1 -4
- package/dist/es2019/pm-plugins/transforms/split.js +0 -2
- package/dist/es2019/pm-plugins/utils/alignment.js +1 -4
- package/dist/es2019/pm-plugins/utils/decoration.js +4 -16
- package/dist/es2019/pm-plugins/utils/drag-menu.js +2 -8
- package/dist/es2019/pm-plugins/utils/nodes.js +0 -3
- package/dist/es2019/pm-plugins/utils/paste.js +5 -4
- package/dist/es2019/pm-plugins/utils/row-controls.js +1 -4
- package/dist/es2019/pm-plugins/utils/snapping.js +1 -4
- package/dist/es2019/tablePlugin.js +1 -0
- package/dist/es2019/ui/DragHandle/index.js +57 -6
- package/dist/es2019/ui/FloatingInsertButton/getPopupOptions.js +0 -6
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +19 -7
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +1 -2
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +63 -11
- package/dist/es2019/ui/TableFloatingControls/index.js +26 -10
- package/dist/es2019/ui/event-handlers.js +1 -4
- package/dist/es2019/ui/toolbar.js +9 -36
- package/dist/esm/nodeviews/TableCell.js +0 -2
- package/dist/esm/nodeviews/TableComponent.js +5 -5
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +6 -4
- package/dist/esm/nodeviews/TableContainer.js +13 -2
- package/dist/esm/nodeviews/TableNodeViewBase.js +0 -2
- package/dist/esm/nodeviews/TableResizer.js +5 -10
- package/dist/esm/nodeviews/TableRow.js +0 -2
- package/dist/esm/nodeviews/lazy-node-views.js +4 -16
- package/dist/esm/nodeviews/table.js +3 -10
- package/dist/esm/pm-plugins/commands/column-resize.js +1 -4
- package/dist/esm/pm-plugins/commands/commands-with-analytics.js +4 -16
- package/dist/esm/pm-plugins/commands/insert.js +4 -19
- package/dist/esm/pm-plugins/commands/misc.js +3 -12
- package/dist/esm/pm-plugins/decorations/plugin.js +1 -6
- package/dist/esm/pm-plugins/decorations/utils/column-resizing.js +1 -4
- package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -12
- package/dist/esm/pm-plugins/drag-and-drop/commands.js +3 -12
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +1 -4
- package/dist/esm/pm-plugins/keymap.js +0 -3
- package/dist/esm/pm-plugins/main.js +1 -6
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +1 -4
- package/dist/esm/pm-plugins/table-resizing/plugin.js +0 -3
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +1 -7
- package/dist/esm/pm-plugins/table-resizing/utils/column-state.js +1 -4
- package/dist/esm/pm-plugins/table-resizing/utils/content-width.js +0 -8
- package/dist/esm/pm-plugins/table-resizing/utils/resize-logic.js +2 -10
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +1 -4
- package/dist/esm/pm-plugins/table-width.js +1 -6
- package/dist/esm/pm-plugins/transforms/column-width.js +1 -4
- package/dist/esm/pm-plugins/transforms/fix-tables.js +3 -15
- package/dist/esm/pm-plugins/transforms/replace-table.js +1 -4
- package/dist/esm/pm-plugins/transforms/split.js +0 -2
- package/dist/esm/pm-plugins/utils/alignment.js +1 -4
- package/dist/esm/pm-plugins/utils/decoration.js +4 -16
- package/dist/esm/pm-plugins/utils/drag-menu.js +1 -4
- package/dist/esm/pm-plugins/utils/nodes.js +0 -3
- package/dist/esm/pm-plugins/utils/paste.js +4 -0
- package/dist/esm/pm-plugins/utils/row-controls.js +1 -4
- package/dist/esm/tablePlugin.js +1 -0
- package/dist/esm/ui/DragHandle/index.js +54 -5
- package/dist/esm/ui/FloatingInsertButton/getPopupOptions.js +0 -6
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +19 -7
- package/dist/esm/ui/TableFloatingColumnControls/index.js +1 -2
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +61 -11
- package/dist/esm/ui/TableFloatingControls/index.js +26 -9
- package/dist/esm/ui/toolbar.js +3 -12
- package/dist/types/nodeviews/TableComponent.d.ts +3 -1
- package/dist/types/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/ui/DragHandle/index.d.ts +21 -0
- package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -1
- package/dist/types/ui/TableFloatingControls/RowControls/DragControls.d.ts +8 -5
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +3 -1
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/types/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/DragHandle/index.d.ts +21 -0
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableFloatingControls/RowControls/DragControls.d.ts +8 -5
- package/package.json +15 -6
- package/src/nodeviews/TableCell.ts +0 -2
- package/src/nodeviews/TableComponent.tsx +8 -6
- package/src/nodeviews/TableComponentWithSharedState.tsx +4 -2
- package/src/nodeviews/TableContainer.tsx +12 -1
- package/src/nodeviews/TableNodeViewBase.ts +0 -2
- package/src/nodeviews/TableResizer.tsx +9 -5
- package/src/nodeviews/TableRow.ts +0 -2
- package/src/nodeviews/lazy-node-views.ts +0 -8
- package/src/nodeviews/table.tsx +1 -6
- package/src/pm-plugins/commands/column-resize.ts +0 -2
- package/src/pm-plugins/commands/commands-with-analytics.ts +0 -12
- package/src/pm-plugins/commands/delete.ts +0 -2
- package/src/pm-plugins/commands/insert.ts +0 -12
- package/src/pm-plugins/commands/misc.ts +0 -6
- package/src/pm-plugins/decorations/plugin.ts +0 -4
- package/src/pm-plugins/decorations/utils/column-resizing.ts +0 -2
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +0 -6
- package/src/pm-plugins/drag-and-drop/commands.ts +0 -8
- package/src/pm-plugins/drag-and-drop/plugin.ts +0 -4
- package/src/pm-plugins/keymap.ts +0 -2
- package/src/pm-plugins/main.ts +0 -4
- package/src/pm-plugins/table-resizing/event-handlers.ts +0 -2
- package/src/pm-plugins/table-resizing/plugin.ts +0 -2
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +0 -6
- package/src/pm-plugins/table-resizing/utils/column-state.ts +0 -2
- package/src/pm-plugins/table-resizing/utils/content-width.ts +0 -6
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +0 -2
- package/src/pm-plugins/table-resizing/utils/resize-logic.ts +0 -6
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +0 -4
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +0 -8
- package/src/pm-plugins/table-width.ts +0 -4
- package/src/pm-plugins/transforms/column-width.ts +0 -4
- package/src/pm-plugins/transforms/delete-columns.ts +0 -2
- package/src/pm-plugins/transforms/fix-tables.ts +0 -8
- package/src/pm-plugins/transforms/replace-table.ts +0 -2
- package/src/pm-plugins/transforms/split.ts +0 -2
- package/src/pm-plugins/utils/alignment.ts +0 -2
- package/src/pm-plugins/utils/decoration.ts +0 -8
- package/src/pm-plugins/utils/drag-menu.ts +0 -4
- package/src/pm-plugins/utils/nodes.ts +0 -2
- package/src/pm-plugins/utils/paste.ts +4 -2
- package/src/pm-plugins/utils/row-controls.ts +0 -2
- package/src/pm-plugins/utils/snapping.ts +0 -2
- package/src/tablePlugin.tsx +1 -0
- package/src/types/index.ts +1 -0
- package/src/ui/DragHandle/index.tsx +67 -2
- package/src/ui/FloatingInsertButton/getPopupOptions.ts +0 -4
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +37 -20
- package/src/ui/TableFloatingColumnControls/index.tsx +1 -4
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +86 -27
- package/src/ui/TableFloatingControls/index.tsx +55 -32
- package/src/ui/event-handlers.ts +0 -2
- package/src/ui/toolbar.tsx +0 -18
|
@@ -24,9 +24,6 @@ function addColumnAtCustomStep(column) {
|
|
|
24
24
|
return tr;
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
// Ignored via go/ees005
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
30
27
|
export function addColumnAt(api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor) {
|
|
31
28
|
return (column, allowAddColumnCustomStep = false, view) => {
|
|
32
29
|
return tr => {
|
|
@@ -56,10 +53,7 @@ export function addColumnAt(api, isTableScalingEnabled = false, isTableFixedColu
|
|
|
56
53
|
|
|
57
54
|
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
58
55
|
// Command to add a column before the column with the selection.
|
|
59
|
-
export const addColumnBefore = (api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
60
|
-
// Ignored via go/ees005
|
|
61
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
62
|
-
) => (state, dispatch, view) => {
|
|
56
|
+
export const addColumnBefore = (api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => (state, dispatch, view) => {
|
|
63
57
|
const table = findTable(state.selection);
|
|
64
58
|
if (!table) {
|
|
65
59
|
return false;
|
|
@@ -73,10 +67,7 @@ export const addColumnBefore = (api, isTableScalingEnabled = false, isTableFixed
|
|
|
73
67
|
|
|
74
68
|
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
75
69
|
// Command to add a column after the column with the selection.
|
|
76
|
-
export const addColumnAfter = (api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor
|
|
77
|
-
// Ignored via go/ees005
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
79
|
-
) => (state, dispatch, view) => {
|
|
70
|
+
export const addColumnAfter = (api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor) => (state, dispatch, view) => {
|
|
80
71
|
const table = findTable(state.selection);
|
|
81
72
|
if (!table) {
|
|
82
73
|
return false;
|
|
@@ -87,10 +78,7 @@ export const addColumnAfter = (api, isTableScalingEnabled, isTableFixedColumnWid
|
|
|
87
78
|
}
|
|
88
79
|
return true;
|
|
89
80
|
};
|
|
90
|
-
export const insertColumn = (api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor
|
|
91
|
-
// Ignored via go/ees005
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
93
|
-
) => column => (state, dispatch, view) => {
|
|
81
|
+
export const insertColumn = (api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor) => column => (state, dispatch, view) => {
|
|
94
82
|
const tr = addColumnAt(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(column, getAllowAddColumnCustomStep(state), view)(state.tr);
|
|
95
83
|
const table = findTable(tr.selection);
|
|
96
84
|
if (!table) {
|
|
@@ -142,10 +130,7 @@ export const insertRow = (row, moveCursorToTheNewRow) => (state, dispatch) => {
|
|
|
142
130
|
* @deprecated This function is deprecated - please use insertTableWithNestingSupport instead.
|
|
143
131
|
* (To be removed with feature gate: `platform_editor_use_nested_table_pm_nodes`)
|
|
144
132
|
*/
|
|
145
|
-
export const createTable = (isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor, isTableResizingEnabled
|
|
146
|
-
// Ignored via go/ees005
|
|
147
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
148
|
-
) => (state, dispatch) => {
|
|
133
|
+
export const createTable = (isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor, isTableResizingEnabled) => (state, dispatch) => {
|
|
149
134
|
const table = createTableWithWidth({
|
|
150
135
|
isTableScalingEnabled,
|
|
151
136
|
isTableAlignmentEnabled,
|
|
@@ -177,10 +162,7 @@ export const createTable = (isTableScalingEnabled, isTableAlignmentEnabled, isFu
|
|
|
177
162
|
* @deprecated This function is deprecated - please use insertTableWithNestingSupport instead.
|
|
178
163
|
* (To be removed with feature gate: `platform_editor_use_nested_table_pm_nodes`)
|
|
179
164
|
*/
|
|
180
|
-
export const insertTableWithSize = (isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor
|
|
181
|
-
// Ignored via go/ees005
|
|
182
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
183
|
-
) => (rowsCount, colsCount, inputMethod) => {
|
|
165
|
+
export const insertTableWithSize = (isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor) => (rowsCount, colsCount, inputMethod) => {
|
|
184
166
|
return ({
|
|
185
167
|
tr
|
|
186
168
|
}) => {
|
|
@@ -448,10 +448,7 @@ export const showInsertRowButton = rowIndex => createCommand(_ => rowIndex > -1
|
|
|
448
448
|
export const hideInsertColumnOrRowButton = () => createCommand({
|
|
449
449
|
type: 'HIDE_INSERT_COLUMN_OR_ROW_BUTTON'
|
|
450
450
|
}, tr => tr.setMeta('addToHistory', false));
|
|
451
|
-
export const addResizeHandleDecorations = (rowIndex, columnIndex, includeTooltip, nodeViewPortalProviderAPI, isKeyboardResize
|
|
452
|
-
// Ignored via go/ees005
|
|
453
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
454
|
-
) => createCommand(state => {
|
|
451
|
+
export const addResizeHandleDecorations = (rowIndex, columnIndex, includeTooltip, nodeViewPortalProviderAPI, isKeyboardResize) => createCommand(state => {
|
|
455
452
|
const tableNode = findTable(state.selection);
|
|
456
453
|
const {
|
|
457
454
|
pluginConfig: {
|
|
@@ -476,10 +473,7 @@ export const addResizeHandleDecorations = (rowIndex, columnIndex, includeTooltip
|
|
|
476
473
|
}
|
|
477
474
|
};
|
|
478
475
|
}, tr => tr.setMeta('addToHistory', false));
|
|
479
|
-
export const updateResizeHandleDecorations = (nodeViewPortalProviderAPI, rowIndex, columnIndex, includeTooltip
|
|
480
|
-
// Ignored via go/ees005
|
|
481
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
482
|
-
) => createCommand(state => {
|
|
476
|
+
export const updateResizeHandleDecorations = (nodeViewPortalProviderAPI, rowIndex, columnIndex, includeTooltip) => createCommand(state => {
|
|
483
477
|
const tableNode = findTable(state.selection);
|
|
484
478
|
const {
|
|
485
479
|
resizeHandleRowIndex,
|
|
@@ -521,10 +515,7 @@ export const removeResizeHandleDecorations = () => createCommand(state => ({
|
|
|
521
515
|
})
|
|
522
516
|
}
|
|
523
517
|
}), tr => tr.setMeta('addToHistory', false));
|
|
524
|
-
export const autoSizeTable = (view, node, table, basePos, opts
|
|
525
|
-
// Ignored via go/ees005
|
|
526
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
527
|
-
) => {
|
|
518
|
+
export const autoSizeTable = (view, node, table, basePos, opts) => {
|
|
528
519
|
if (typeof basePos !== 'number') {
|
|
529
520
|
return false;
|
|
530
521
|
}
|
|
@@ -7,10 +7,7 @@ import { pluginKey as tableWidthPluginKey } from '../table-width';
|
|
|
7
7
|
import { buildColumnControlsDecorations, maybeUpdateColumnControlsSelectedDecoration } from './utils/column-controls';
|
|
8
8
|
export const pluginKey = new PluginKey('tableDecorationsPlugin');
|
|
9
9
|
export const getDecorations = state => pluginKey.getState(state);
|
|
10
|
-
export const handleDocOrSelectionChanged = (tr, decorationSet, oldState, newState
|
|
11
|
-
// Ignored via go/ees005
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
13
|
-
) => {
|
|
10
|
+
export const handleDocOrSelectionChanged = (tr, decorationSet, oldState, newState) => {
|
|
14
11
|
var _tableWidthPluginKey$, _tableWidthPluginKey$2;
|
|
15
12
|
const isResizing = (_tableWidthPluginKey$ = tableWidthPluginKey.getState(newState)) === null || _tableWidthPluginKey$ === void 0 ? void 0 : _tableWidthPluginKey$.resizing;
|
|
16
13
|
const wasResizing = (_tableWidthPluginKey$2 = tableWidthPluginKey.getState(oldState)) === null || _tableWidthPluginKey$2 === void 0 ? void 0 : _tableWidthPluginKey$2.resizing;
|
|
@@ -45,8 +42,6 @@ export const createPlugin = () => {
|
|
|
45
42
|
return new SafePlugin({
|
|
46
43
|
state: {
|
|
47
44
|
init: () => DecorationSet.empty,
|
|
48
|
-
// Ignored via go/ees005
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
50
45
|
apply: (tr, decorationSet, oldState, newState) => {
|
|
51
46
|
let pluginState = decorationSet;
|
|
52
47
|
// main table plugin --->
|
|
@@ -10,10 +10,7 @@ const updateLastCellElement = lastCellElementsDecorations => ({
|
|
|
10
10
|
decorationSet,
|
|
11
11
|
tr
|
|
12
12
|
}) => updateDecorations(tr.doc, decorationSet, lastCellElementsDecorations, TableDecorations.LAST_CELL_ELEMENT);
|
|
13
|
-
export const buildColumnResizingDecorations = (rowEndIndex, columnEndIndex, includeTooltip, getIntl, nodeViewPortalProviderAPI
|
|
14
|
-
// Ignored via go/ees005
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
16
|
-
) => ({
|
|
13
|
+
export const buildColumnResizingDecorations = (rowEndIndex, columnEndIndex, includeTooltip, getIntl, nodeViewPortalProviderAPI) => ({
|
|
17
14
|
tr,
|
|
18
15
|
decorationSet
|
|
19
16
|
}) => {
|
|
@@ -6,10 +6,7 @@ import { getSelectedTableInfo, withEditorAnalyticsAPI } from '../utils/analytics
|
|
|
6
6
|
import { canMove, getTargetIndex } from '../utils/drag-menu';
|
|
7
7
|
import { getSelectedColumnIndexes, getSelectedRowIndexes } from '../utils/selection';
|
|
8
8
|
import { clearDropTarget, cloneSource, moveSource } from './commands';
|
|
9
|
-
export const clearDropTargetWithAnalytics = editorAnalyticsAPI => (inputMethod, sourceType, sourceIndexes, status, tr
|
|
10
|
-
// Ignored via go/ees005
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
12
|
-
) => {
|
|
9
|
+
export const clearDropTargetWithAnalytics = editorAnalyticsAPI => (inputMethod, sourceType, sourceIndexes, status, tr) => {
|
|
13
10
|
return withEditorAnalyticsAPI(({
|
|
14
11
|
selection
|
|
15
12
|
}) => {
|
|
@@ -39,10 +36,7 @@ export const clearDropTargetWithAnalytics = editorAnalyticsAPI => (inputMethod,
|
|
|
39
36
|
return true;
|
|
40
37
|
});
|
|
41
38
|
};
|
|
42
|
-
export const moveSourceWithAnalytics = (editorAnalyticsAPI, ariaNotify, getIntl) => (inputMethod, sourceType, sourceIndexes, targetIndex, tr
|
|
43
|
-
// Ignored via go/ees005
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
45
|
-
) => {
|
|
39
|
+
export const moveSourceWithAnalytics = (editorAnalyticsAPI, ariaNotify, getIntl) => (inputMethod, sourceType, sourceIndexes, targetIndex, tr) => {
|
|
46
40
|
return withEditorAnalyticsAPI(({
|
|
47
41
|
selection
|
|
48
42
|
}) => {
|
|
@@ -113,10 +107,7 @@ export const moveSourceWithAnalyticsViaShortcut = (editorAnalyticsAPI, ariaNotif
|
|
|
113
107
|
const targetIndex = getTargetIndex(selectedIndexes, direction);
|
|
114
108
|
return moveSourceWithAnalytics(editorAnalyticsAPI, ariaNotify, getIntl)(INPUT_METHOD.SHORTCUT, sourceType, selectedIndexes, targetIndex)(state, dispatch);
|
|
115
109
|
};
|
|
116
|
-
export const cloneSourceWithAnalytics = editorAnalyticsAPI => (inputMethod, sourceType, sourceIndexes, targetIndex, targetDirection, tr
|
|
117
|
-
// Ignored via go/ees005
|
|
118
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
119
|
-
) => {
|
|
110
|
+
export const cloneSourceWithAnalytics = editorAnalyticsAPI => (inputMethod, sourceType, sourceIndexes, targetIndex, targetDirection, tr) => {
|
|
120
111
|
return withEditorAnalyticsAPI(({
|
|
121
112
|
selection
|
|
122
113
|
}) => {
|
|
@@ -12,10 +12,7 @@ const getDecorations = state => {
|
|
|
12
12
|
return ((_pluginKey$getState = pluginKey.getState(state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.decorationSet) || DecorationSet.empty;
|
|
13
13
|
};
|
|
14
14
|
const updatePluginStateDecorations = (state, decorations, key) => updateDecorations(state.doc, getDecorations(state), decorations, key);
|
|
15
|
-
export const setDropTarget = (type, index, hasMergedCells, tr
|
|
16
|
-
// Ignored via go/ees005
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
18
|
-
) => createCommand(state => {
|
|
15
|
+
export const setDropTarget = (type, index, hasMergedCells, tr) => createCommand(state => {
|
|
19
16
|
const {
|
|
20
17
|
dropTargetType,
|
|
21
18
|
dropTargetIndex
|
|
@@ -53,10 +50,7 @@ export const clearDropTarget = tr => createCommand(state => {
|
|
|
53
50
|
}
|
|
54
51
|
};
|
|
55
52
|
}, originalTr => (tr || originalTr).setMeta('addToHistory', false));
|
|
56
|
-
export const moveSource = (sourceType, sourceIndexes, targetIndex, tr
|
|
57
|
-
// Ignored via go/ees005
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
59
|
-
) => createCommand(state => {
|
|
53
|
+
export const moveSource = (sourceType, sourceIndexes, targetIndex, tr) => createCommand(state => {
|
|
60
54
|
return {
|
|
61
55
|
type: DragAndDropActionType.CLEAR_DROP_TARGET,
|
|
62
56
|
data: {
|
|
@@ -73,10 +67,7 @@ export const moveSource = (sourceType, sourceIndexes, targetIndex, tr
|
|
|
73
67
|
selectAfterMove: true
|
|
74
68
|
})(nextTr);
|
|
75
69
|
});
|
|
76
|
-
export const toggleDragMenu = (isDragMenuOpen, direction, index, trigger = 'mouse'
|
|
77
|
-
// Ignored via go/ees005
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
79
|
-
) => createCommand(state => {
|
|
70
|
+
export const toggleDragMenu = (isDragMenuOpen, direction, index, trigger = 'mouse') => createCommand(state => {
|
|
80
71
|
const {
|
|
81
72
|
isDragMenuOpen: previousOpenState,
|
|
82
73
|
dragMenuDirection: previousDragMenuDirection,
|
|
@@ -110,10 +101,7 @@ export const toggleDragMenu = (isDragMenuOpen, direction, index, trigger = 'mous
|
|
|
110
101
|
}, tr => {
|
|
111
102
|
return tr.setMeta('addToHistory', false);
|
|
112
103
|
});
|
|
113
|
-
export const cloneSource = (sourceType, sourceIndexes, targetIndex, targetDirection, tr
|
|
114
|
-
// Ignored via go/ees005
|
|
115
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
116
|
-
) => createCommand(state => {
|
|
104
|
+
export const cloneSource = (sourceType, sourceIndexes, targetIndex, targetDirection, tr) => createCommand(state => {
|
|
117
105
|
return {
|
|
118
106
|
type: DragAndDropActionType.CLEAR_DROP_TARGET,
|
|
119
107
|
data: {
|
|
@@ -18,10 +18,7 @@ import { DropTargetType } from './consts';
|
|
|
18
18
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
19
19
|
import { pluginKey } from './plugin-key';
|
|
20
20
|
import { getDraggableDataFromEvent } from './utils/monitor';
|
|
21
|
-
const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor
|
|
22
|
-
// Ignored via go/ees005
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
24
|
-
) => {
|
|
21
|
+
const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor) => {
|
|
25
22
|
const editorPageScrollContainer = document.querySelector('.fabric-editor-popup-scroll-parent');
|
|
26
23
|
const rowAutoScrollers = editorPageScrollContainer ? [monitorForElements({
|
|
27
24
|
canMonitor({
|
|
@@ -194,10 +191,7 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
|
|
|
194
191
|
}
|
|
195
192
|
}));
|
|
196
193
|
};
|
|
197
|
-
export const createPlugin = (dispatch, editorAnalyticsAPI, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, isCommentEditor = false
|
|
198
|
-
// Ignored via go/ees005
|
|
199
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
200
|
-
) => {
|
|
194
|
+
export const createPlugin = (dispatch, editorAnalyticsAPI, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, isCommentEditor = false) => {
|
|
201
195
|
return new SafePlugin({
|
|
202
196
|
state: createPluginState(dispatch, state => ({
|
|
203
197
|
decorationSet: DecorationSet.empty,
|
|
@@ -9,9 +9,6 @@ import { goToNextCell, moveCursorBackward, setFocusToCellMenu } from './commands
|
|
|
9
9
|
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from './commands/column-resize';
|
|
10
10
|
import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from './commands/commands-with-analytics';
|
|
11
11
|
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand, createTable, insertTableWithNestingSupport } from './commands/insert';
|
|
12
|
-
|
|
13
|
-
// Ignored via go/ees005
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
15
12
|
export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled = false, isTableAlignmentEnabled = false, isFullWidthEnabled, pluginInjectionApi, getIntl, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, isTableResizingEnabled) {
|
|
16
13
|
var _pluginInjectionApi$a;
|
|
17
14
|
const list = {};
|
|
@@ -21,10 +21,7 @@ import { fixTables } from './transforms/fix-tables';
|
|
|
21
21
|
import { replaceSelectedTable } from './transforms/replace-table';
|
|
22
22
|
import { findControlsHoverDecoration } from './utils/decoration';
|
|
23
23
|
import { transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, transformSliceToRemoveOpenTable, transformSliceToRemoveNestedTables, isHeaderRowRequired, transformSliceTableLayoutDefaultToCenter } from './utils/paste';
|
|
24
|
-
export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor
|
|
25
|
-
// Ignored via go/ees005
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
27
|
-
) => {
|
|
24
|
+
export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor) => {
|
|
28
25
|
var _accessibilityUtils;
|
|
29
26
|
const state = createPluginState(dispatch, {
|
|
30
27
|
pluginConfig,
|
|
@@ -244,8 +241,6 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
244
241
|
const maybeTr = closestElement(domRef, 'tr');
|
|
245
242
|
return maybeTr ? maybeTr.classList.contains('sticky') : false;
|
|
246
243
|
},
|
|
247
|
-
// Ignored via go/ees005
|
|
248
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
249
244
|
handleTextInput: (view, _from, _to, text) => {
|
|
250
245
|
const {
|
|
251
246
|
state,
|
|
@@ -15,10 +15,7 @@ import { updateControls } from './utils/dom';
|
|
|
15
15
|
import { currentColWidth, getTableMaxWidth, pointsAtCell, getScalingPercentForTableWithoutWidth, getTableScalingPercent } from './utils/misc';
|
|
16
16
|
import { resizeColumn } from './utils/resize-column';
|
|
17
17
|
import { getResizeState } from './utils/resize-state';
|
|
18
|
-
export const handleMouseDown = (view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isCommentEditor
|
|
19
|
-
// Ignored via go/ees005
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
21
|
-
) => {
|
|
18
|
+
export const handleMouseDown = (view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isCommentEditor) => {
|
|
22
19
|
var _originalTable$attrs;
|
|
23
20
|
const {
|
|
24
21
|
state,
|
|
@@ -7,9 +7,6 @@ import { handleMouseDown } from './event-handlers';
|
|
|
7
7
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
8
8
|
import { pluginKey } from './plugin-key';
|
|
9
9
|
import { getResizeCellPos } from './utils/dom';
|
|
10
|
-
|
|
11
|
-
// Ignored via go/ees005
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
13
10
|
export function createPlugin(dispatch, {
|
|
14
11
|
lastColumnResizable = true
|
|
15
12
|
}, getEditorContainerWidth, getEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled, isCommentEditor) {
|
|
@@ -11,10 +11,7 @@ import { getScalingPercentForTableWithoutWidth, getTableScalingPercent } from '.
|
|
|
11
11
|
* overflow.
|
|
12
12
|
*/
|
|
13
13
|
export const getColWidthFix = (colwidth, tableColumnCount) => colwidth - 1 / tableColumnCount;
|
|
14
|
-
export const generateColgroup = (table, tableRef, shouldUseIncreasedScalingPercent, isCommentEditor
|
|
15
|
-
// Ignored via go/ees005
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
17
|
-
) => {
|
|
14
|
+
export const generateColgroup = (table, tableRef, shouldUseIncreasedScalingPercent, isCommentEditor) => {
|
|
18
15
|
const cols = [];
|
|
19
16
|
const map = TableMap.get(table);
|
|
20
17
|
|
|
@@ -62,10 +59,7 @@ export const generateColgroup = (table, tableRef, shouldUseIncreasedScalingPerce
|
|
|
62
59
|
});
|
|
63
60
|
return cols;
|
|
64
61
|
};
|
|
65
|
-
export const insertColgroupFromNode = (tableRef, table, isTableScalingEnabled = false, shouldRemove = true, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
66
|
-
// Ignored via go/ees005
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
68
|
-
) => {
|
|
62
|
+
export const insertColgroupFromNode = (tableRef, table, isTableScalingEnabled = false, shouldRemove = true, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => {
|
|
69
63
|
// Ignored via go/ees005
|
|
70
64
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
71
65
|
let colgroup = tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelector('colgroup');
|
|
@@ -100,9 +94,6 @@ export const isMinCellWidthTable = table => {
|
|
|
100
94
|
});
|
|
101
95
|
return isTableMinCellWidth;
|
|
102
96
|
};
|
|
103
|
-
|
|
104
|
-
// Ignored via go/ees005
|
|
105
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
106
97
|
function renderColgroupFromNode(table, maybeTableRef, shouldUseIncreasedScalingPercent, isCommentEditor) {
|
|
107
98
|
const rendered = DOMSerializer.renderSpec(document, ['colgroup', {}, ...generateColgroup(table, maybeTableRef, shouldUseIncreasedScalingPercent, isCommentEditor)]);
|
|
108
99
|
|
|
@@ -20,10 +20,7 @@ export const getFreeSpace = state => {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
// Returns DOM refs of all cells in a column by `columnIndex`
|
|
23
|
-
export const getCellsRefsInColumn = (columnIndex, table, tableStart, domAtPos
|
|
24
|
-
// Ignored via go/ees005
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
26
|
-
) => {
|
|
23
|
+
export const getCellsRefsInColumn = (columnIndex, table, tableStart, domAtPos) => {
|
|
27
24
|
const map = TableMap.get(table);
|
|
28
25
|
const cellsPositions = map.cellsInRect({
|
|
29
26
|
left: columnIndex,
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { unitToNumber } from './unit-to-number';
|
|
2
2
|
|
|
3
3
|
// calculates content width of a cell
|
|
4
|
-
// Ignored via go/ees005
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
6
4
|
export function contentWidth(elem, container, colWidths = [], canvas = document.createElement('canvas')) {
|
|
7
5
|
return calcContentWidth(elem, container || elem, canvas, colWidths);
|
|
8
6
|
}
|
|
9
|
-
|
|
10
|
-
// Ignored via go/ees005
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
12
7
|
function calcContentWidth(elem, container, canvas, colWidths) {
|
|
13
8
|
const flowWidths = [];
|
|
14
9
|
let curWidth = 0;
|
|
@@ -75,9 +70,6 @@ function measureText(canvas, text, font) {
|
|
|
75
70
|
}
|
|
76
71
|
return Math.round(ctx.measureText(text || '').width);
|
|
77
72
|
}
|
|
78
|
-
|
|
79
|
-
// Ignored via go/ees005
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
81
73
|
function handlePreText(canvas, node, textContent, font) {
|
|
82
74
|
let parent = node;
|
|
83
75
|
if (node.nodeName === 'CODE') {
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { growColumn, shrinkColumn } from './resize-logic';
|
|
4
4
|
import { updateColgroup } from './resize-state';
|
|
5
|
-
export const resizeColumn = (resizeState, colIndex, amount, tableRef, tableNode, selectedColumns, isTableScalingEnabled = false, scalePercent = 1
|
|
6
|
-
// Ignored via go/ees005
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
8
|
-
) => {
|
|
5
|
+
export const resizeColumn = (resizeState, colIndex, amount, tableRef, tableNode, selectedColumns, isTableScalingEnabled = false, scalePercent = 1) => {
|
|
9
6
|
let resizeAmount = amount;
|
|
10
7
|
if (isTableScalingEnabled) {
|
|
11
8
|
resizeAmount = amount / scalePercent;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { getFreeSpace } from './column-state';
|
|
2
2
|
import { bulkColumnsResize, getTotalWidth } from './resize-state';
|
|
3
|
-
export const growColumn = (state, colIndex, amount, selectedColumns
|
|
4
|
-
// Ignored via go/ees005
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
6
|
-
) => {
|
|
3
|
+
export const growColumn = (state, colIndex, amount, selectedColumns) => {
|
|
7
4
|
// can't grow if columns don't exist or it's the last column
|
|
8
5
|
if (!state.cols[colIndex] || !state.cols[colIndex + 1]) {
|
|
9
6
|
return state;
|
|
@@ -19,10 +16,7 @@ export const growColumn = (state, colIndex, amount, selectedColumns
|
|
|
19
16
|
}
|
|
20
17
|
return newState;
|
|
21
18
|
};
|
|
22
|
-
export const shrinkColumn = (state, colIndex, amount, selectedColumns
|
|
23
|
-
// Ignored via go/ees005
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
25
|
-
) => {
|
|
19
|
+
export const shrinkColumn = (state, colIndex, amount, selectedColumns) => {
|
|
26
20
|
// can't shrink if columns don't exist
|
|
27
21
|
if (!state.cols[colIndex]) {
|
|
28
22
|
return state;
|
|
@@ -91,8 +85,6 @@ var ColType = /*#__PURE__*/function (ColType) {
|
|
|
91
85
|
return ColType;
|
|
92
86
|
}(ColType || {}); // TODO: should handle when destIdx:
|
|
93
87
|
// - is beyond the range, and then not give it back
|
|
94
|
-
// Ignored via go/ees005
|
|
95
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
96
88
|
function moveSpaceFrom(state, srcIdx, destIdx, amount, useFreeSpace = true) {
|
|
97
89
|
const srcCol = state.cols[srcIdx];
|
|
98
90
|
const destCol = state.cols[destIdx];
|
|
@@ -78,10 +78,7 @@ export const getResizeState = ({
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
// updates Colgroup DOM node with new widths
|
|
81
|
-
export const updateColgroup = (state, tableRef, tableNode, isTableScalingEnabled, scalePercent
|
|
82
|
-
// Ignored via go/ees005
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
84
|
-
) => {
|
|
81
|
+
export const updateColgroup = (state, tableRef, tableNode, isTableScalingEnabled, scalePercent) => {
|
|
85
82
|
const cols = tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll('col');
|
|
86
83
|
const columnsCount = cols === null || cols === void 0 ? void 0 : cols.length;
|
|
87
84
|
/**
|
|
@@ -275,10 +272,7 @@ const normaliseTableLayout = input => {
|
|
|
275
272
|
return 'default';
|
|
276
273
|
}
|
|
277
274
|
};
|
|
278
|
-
export const getNewResizeStateFromSelectedColumns = (rect, state, domAtPos, getEditorContainerWidth, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, isCommentEditor = false
|
|
279
|
-
// Ignored via go/ees005
|
|
280
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
281
|
-
) => {
|
|
275
|
+
export const getNewResizeStateFromSelectedColumns = (rect, state, domAtPos, getEditorContainerWidth, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, isCommentEditor = false) => {
|
|
282
276
|
// Fail early so that we don't do complex calculations for no reason
|
|
283
277
|
const numColumnsSelected = rect.right - rect.left;
|
|
284
278
|
if (numColumnsSelected <= 1) {
|
|
@@ -10,10 +10,7 @@ import { hasTableBeenResized, insertColgroupFromNode } from './colgroup';
|
|
|
10
10
|
import { syncStickyRowToTable } from './dom';
|
|
11
11
|
// Base function to trigger the actual scale on a table node.
|
|
12
12
|
// Will only resize/scale if a table has been previously resized.
|
|
13
|
-
const scale = (tableRef, options, domAtPos, isTableScalingEnabledOnCurrentTable = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
14
|
-
// Ignored via go/ees005
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
16
|
-
) => {
|
|
13
|
+
const scale = (tableRef, options, domAtPos, isTableScalingEnabledOnCurrentTable = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => {
|
|
17
14
|
const {
|
|
18
15
|
node,
|
|
19
16
|
containerWidth,
|
|
@@ -57,10 +54,7 @@ const scale = (tableRef, options, domAtPos, isTableScalingEnabledOnCurrentTable
|
|
|
57
54
|
});
|
|
58
55
|
return scaleTableTo(resizeState, newWidth);
|
|
59
56
|
};
|
|
60
|
-
const scaleWithParent = (tableRef, parentWidth, table, start, domAtPos, isTableScalingEnabledOnCurrentTable = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
61
|
-
// Ignored via go/ees005
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
63
|
-
) => {
|
|
57
|
+
const scaleWithParent = (tableRef, parentWidth, table, start, domAtPos, isTableScalingEnabledOnCurrentTable = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => {
|
|
64
58
|
const resizeState = getResizeState({
|
|
65
59
|
minWidth: tableCellMinWidth,
|
|
66
60
|
maxSize: parentWidth,
|
|
@@ -105,10 +99,7 @@ export function scaleTableTo(state, maxSize) {
|
|
|
105
99
|
}
|
|
106
100
|
return adjustColumnsWidths(newState, maxSize);
|
|
107
101
|
}
|
|
108
|
-
export const previewScaleTable = (tableRef, options, domAtPos, isTableScalingEnabled = false, isTableWithFixedColumnWidthsOptionEnabled = false, isCommentEditor = false
|
|
109
|
-
// Ignored via go/ees005
|
|
110
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
111
|
-
) => {
|
|
102
|
+
export const previewScaleTable = (tableRef, options, domAtPos, isTableScalingEnabled = false, isTableWithFixedColumnWidthsOptionEnabled = false, isCommentEditor = false) => {
|
|
112
103
|
const {
|
|
113
104
|
node,
|
|
114
105
|
start,
|
|
@@ -143,10 +134,7 @@ export const previewScaleTable = (tableRef, options, domAtPos, isTableScalingEna
|
|
|
143
134
|
};
|
|
144
135
|
|
|
145
136
|
// Scale the table to meet new requirements (col, layout change etc)
|
|
146
|
-
export const scaleTable = (tableRef, options, domAtPos, api, isTableScalingEnabledOnCurrentTable = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
147
|
-
// Ignored via go/ees005
|
|
148
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
149
|
-
) => tr => {
|
|
137
|
+
export const scaleTable = (tableRef, options, domAtPos, api, isTableScalingEnabledOnCurrentTable = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => tr => {
|
|
150
138
|
if (!tableRef) {
|
|
151
139
|
return tr;
|
|
152
140
|
}
|
|
@@ -12,10 +12,7 @@ import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorWideL
|
|
|
12
12
|
import { TABLE_MAX_WIDTH } from './table-resizing/utils/consts';
|
|
13
13
|
import { ALIGN_START } from './utils/alignment';
|
|
14
14
|
export const pluginKey = new PluginKey('tableWidthPlugin');
|
|
15
|
-
const createPlugin = (dispatch, dispatchAnalyticsEvent, fullWidthEnabled, isTableScalingEnabled, isTableAlignmentEnabled, isCommentEditor
|
|
16
|
-
// Ignored via go/ees005
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
18
|
-
) => {
|
|
15
|
+
const createPlugin = (dispatch, dispatchAnalyticsEvent, fullWidthEnabled, isTableScalingEnabled, isTableAlignmentEnabled, isCommentEditor) => {
|
|
19
16
|
return new SafePlugin({
|
|
20
17
|
key: pluginKey,
|
|
21
18
|
state: {
|
|
@@ -117,8 +114,6 @@ const createPlugin = (dispatch, dispatchAnalyticsEvent, fullWidthEnabled, isTabl
|
|
|
117
114
|
}
|
|
118
115
|
if (referentialityTr) {
|
|
119
116
|
referentialityTr.steps.forEach(step => {
|
|
120
|
-
// Ignored via go/ees005
|
|
121
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
122
117
|
step.getMap().forEach((_, __, newStart, newEnd) => {
|
|
123
118
|
newState.doc.nodesBetween(newStart, newEnd, (node, pos) => {
|
|
124
119
|
if (node.type === table) {
|
|
@@ -13,10 +13,7 @@ import { scaleTableTo } from '../table-resizing/utils/scale-table';
|
|
|
13
13
|
* @param start
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
|
-
export const updateColumnWidths = (resizeState, table, start, api
|
|
17
|
-
// Ignored via go/ees005
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
19
|
-
) => tr => {
|
|
16
|
+
export const updateColumnWidths = (resizeState, table, start, api) => tr => {
|
|
20
17
|
const map = TableMap.get(table);
|
|
21
18
|
const updatedCellsAttrs = {};
|
|
22
19
|
const steps = [];
|
|
@@ -104,10 +101,7 @@ export const updateColumnWidths = (resizeState, table, start, api
|
|
|
104
101
|
* @param view
|
|
105
102
|
* @returns Updated transaction with rescaled columns for a given table
|
|
106
103
|
*/
|
|
107
|
-
export const rescaleColumns = (isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, api, isCommentEditor = false
|
|
108
|
-
// Ignored via go/ees005
|
|
109
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
110
|
-
) => (table, view) => tr => {
|
|
104
|
+
export const rescaleColumns = (isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, api, isCommentEditor = false) => (table, view) => tr => {
|
|
111
105
|
if (!view) {
|
|
112
106
|
return tr;
|
|
113
107
|
}
|
|
@@ -194,10 +194,7 @@ function fixRowSpans(table) {
|
|
|
194
194
|
}
|
|
195
195
|
return table.type.createChecked(table.attrs, rows, table.marks);
|
|
196
196
|
}
|
|
197
|
-
export const deleteColumns = (rect, allowCustomStep, api, view, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
198
|
-
// Ignored via go/ees005
|
|
199
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
200
|
-
) => tr => {
|
|
197
|
+
export const deleteColumns = (rect, allowCustomStep, api, view, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => tr => {
|
|
201
198
|
let updatedTr = tr;
|
|
202
199
|
updatedTr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
|
|
203
200
|
name: TABLE_OVERFLOW_CHANGE_TRIGGER.DELETED_COLUMN
|
|
@@ -36,10 +36,7 @@ const validateTableCellNodeAttrs = ({
|
|
|
36
36
|
//
|
|
37
37
|
// This row only spans two columns, yet it contains widths for 3.
|
|
38
38
|
// We remove the third width here, assumed duplicate content.
|
|
39
|
-
export const removeExtraneousColumnWidths = (node, basePos, tr, reportInvalidTableCellSpanAttrs
|
|
40
|
-
// Ignored via go/ees005
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
42
|
-
) => {
|
|
39
|
+
export const removeExtraneousColumnWidths = (node, basePos, tr, reportInvalidTableCellSpanAttrs) => {
|
|
43
40
|
let hasProblems = false;
|
|
44
41
|
tr = replaceCells(tr, node, basePos, cell => {
|
|
45
42
|
const {
|
|
@@ -92,10 +89,7 @@ export const fixTables = (tr, reportInvalidTableCellSpanAttrs) => {
|
|
|
92
89
|
//
|
|
93
90
|
// We use this when migrating TinyMCE tables for Confluence, for example:
|
|
94
91
|
// https://pug.jira-dev.com/wiki/spaces/AEC/pages/3362882215/How+do+we+map+TinyMCE+tables+to+Fabric+tables
|
|
95
|
-
export const fixAutoSizedTable = (view, tableNode, tableRef, tablePos, opts
|
|
96
|
-
// Ignored via go/ees005
|
|
97
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
98
|
-
) => {
|
|
92
|
+
export const fixAutoSizedTable = (view, tableNode, tableRef, tablePos, opts) => {
|
|
99
93
|
let {
|
|
100
94
|
tr
|
|
101
95
|
} = view.state;
|
|
@@ -138,9 +132,6 @@ const getLayoutBasedOnWidth = totalWidth => {
|
|
|
138
132
|
return 'default';
|
|
139
133
|
}
|
|
140
134
|
};
|
|
141
|
-
|
|
142
|
-
// Ignored via go/ees005
|
|
143
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
144
135
|
function parseDOMColumnWidths(domAtPos, tableNode, tableStart, tableRef) {
|
|
145
136
|
const row = tableRef.querySelector('tr');
|
|
146
137
|
if (!row) {
|
|
@@ -165,10 +156,7 @@ function parseDOMColumnWidths(domAtPos, tableNode, tableStart, tableRef) {
|
|
|
165
156
|
}
|
|
166
157
|
|
|
167
158
|
// TODO: move to prosemirror-utils
|
|
168
|
-
const replaceCells = (tr, table, tablePos, modifyCell
|
|
169
|
-
// Ignored via go/ees005
|
|
170
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
171
|
-
) => {
|
|
159
|
+
const replaceCells = (tr, table, tablePos, modifyCell) => {
|
|
172
160
|
const rows = [];
|
|
173
161
|
let modifiedCells = 0;
|
|
174
162
|
for (let rowIndex = 0; rowIndex < table.childCount; rowIndex++) {
|
|
@@ -3,10 +3,7 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
5
5
|
import { getSelectedTableInfo } from '../utils/analytics';
|
|
6
|
-
export const replaceSelectedTable = (state, content, inputMethod, editorAnalyticsAPI
|
|
7
|
-
// Ignored via go/ees005
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
9
|
-
) => {
|
|
6
|
+
export const replaceSelectedTable = (state, content, inputMethod, editorAnalyticsAPI) => {
|
|
10
7
|
if (isTableSelected(state.selection)) {
|
|
11
8
|
const table = findTable(state.selection);
|
|
12
9
|
if (table) {
|
|
@@ -7,8 +7,6 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
7
7
|
* @param columnStart - Start of the rect included (rect.left)
|
|
8
8
|
* @param columnEnd - End of the rect not included (rect.right)
|
|
9
9
|
*/
|
|
10
|
-
// Ignored via go/ees005
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
12
10
|
export function splitCellsInColumns(tr, tablePos, columnStart, columnEnd) {
|
|
13
11
|
const mapStart = tr.mapping.maps.length;
|
|
14
12
|
const table = tr.doc.nodeAt(tablePos);
|
|
@@ -11,7 +11,4 @@ export const normaliseAlignment = layout => layout === ALIGN_CENTER || layout ==
|
|
|
11
11
|
/**
|
|
12
12
|
* We don't want to switch alignment in Full-width editor
|
|
13
13
|
*/
|
|
14
|
-
export const shouldChangeAlignmentToCenterResized = (isTableAlignmentEnabled, tableNode, lineLength, updatedTableWidth
|
|
15
|
-
// Ignored via go/ees005
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
17
|
-
) => Boolean(isTableAlignmentEnabled && tableNode && tableNode.attrs.layout === ALIGN_START && lineLength && updatedTableWidth > lineLength && lineLength < FULL_WIDTH_EDITOR_CONTENT_WIDTH);
|
|
14
|
+
export const shouldChangeAlignmentToCenterResized = (isTableAlignmentEnabled, tableNode, lineLength, updatedTableWidth) => Boolean(isTableAlignmentEnabled && tableNode && tableNode.attrs.layout === ALIGN_START && lineLength && updatedTableWidth > lineLength && lineLength < FULL_WIDTH_EDITOR_CONTENT_WIDTH);
|