@atlaskit/editor-plugin-table 12.2.6 → 12.2.7
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 +8 -0
- package/package.json +4 -4
- package/afm-cc/tsconfig.json +0 -123
- package/afm-dev-agents/tsconfig.json +0 -123
- package/afm-jira/tsconfig.json +0 -123
- package/afm-passionfruit/tsconfig.json +0 -123
- package/afm-post-office/tsconfig.json +0 -123
- package/afm-rovo-extension/tsconfig.json +0 -123
- package/afm-townsquare/tsconfig.json +0 -123
- package/afm-volt/tsconfig.json +0 -114
- package/build/tsconfig.json +0 -23
- package/docs/0-intro.tsx +0 -57
- package/src/index.ts +0 -21
- package/src/nodeviews/ExternalDropTargets.tsx +0 -91
- package/src/nodeviews/OverflowShadowsObserver.ts +0 -156
- package/src/nodeviews/TableCell.ts +0 -134
- package/src/nodeviews/TableComponent.tsx +0 -1590
- package/src/nodeviews/TableComponentWithSharedState.tsx +0 -278
- package/src/nodeviews/TableContainer.tsx +0 -926
- package/src/nodeviews/TableNodeViewBase.ts +0 -29
- package/src/nodeviews/TableResizer.tsx +0 -884
- package/src/nodeviews/TableRow.ts +0 -830
- package/src/nodeviews/TableStickyScrollbar.ts +0 -211
- package/src/nodeviews/__mocks__/OverflowShadowsObserver.ts +0 -15
- package/src/nodeviews/__mocks__/OverridableMock.ts +0 -26
- package/src/nodeviews/table-container-styles.ts +0 -9
- package/src/nodeviews/table-node-views.ts +0 -76
- package/src/nodeviews/table.tsx +0 -530
- package/src/nodeviews/toDOM.ts +0 -244
- package/src/nodeviews/types.ts +0 -36
- package/src/nodeviews/update-overflow-shadows.ts +0 -11
- package/src/pm-plugins/analytics/actions.ts +0 -21
- package/src/pm-plugins/analytics/commands.ts +0 -47
- package/src/pm-plugins/analytics/plugin-factory.ts +0 -9
- package/src/pm-plugins/analytics/plugin-key.ts +0 -5
- package/src/pm-plugins/analytics/plugin.ts +0 -80
- package/src/pm-plugins/analytics/reducer.ts +0 -27
- package/src/pm-plugins/analytics/types.ts +0 -20
- package/src/pm-plugins/analytics/utils/moved-event.ts +0 -51
- package/src/pm-plugins/commands/clear.ts +0 -43
- package/src/pm-plugins/commands/collapse.ts +0 -17
- package/src/pm-plugins/commands/column-resize.ts +0 -478
- package/src/pm-plugins/commands/commands-with-analytics.ts +0 -715
- package/src/pm-plugins/commands/delete.ts +0 -42
- package/src/pm-plugins/commands/display-mode.ts +0 -18
- package/src/pm-plugins/commands/go-to-next-cell.ts +0 -198
- package/src/pm-plugins/commands/hover.ts +0 -242
- package/src/pm-plugins/commands/index.ts +0 -51
- package/src/pm-plugins/commands/insert.ts +0 -438
- package/src/pm-plugins/commands/misc.ts +0 -811
- package/src/pm-plugins/commands/referentiality.ts +0 -15
- package/src/pm-plugins/commands/selection.ts +0 -537
- package/src/pm-plugins/commands/sort.ts +0 -102
- package/src/pm-plugins/commands/split-cell.ts +0 -28
- package/src/pm-plugins/commands/toggle.ts +0 -109
- package/src/pm-plugins/create-plugin-config.ts +0 -17
- package/src/pm-plugins/decorations/plugin.ts +0 -107
- package/src/pm-plugins/decorations/utils/column-controls.ts +0 -91
- package/src/pm-plugins/decorations/utils/column-resizing.ts +0 -71
- package/src/pm-plugins/decorations/utils/compose-decorations.ts +0 -9
- package/src/pm-plugins/decorations/utils/types.ts +0 -16
- package/src/pm-plugins/default-table-selection.ts +0 -14
- package/src/pm-plugins/drag-and-drop/actions.ts +0 -48
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +0 -222
- package/src/pm-plugins/drag-and-drop/commands.ts +0 -194
- package/src/pm-plugins/drag-and-drop/consts.ts +0 -7
- package/src/pm-plugins/drag-and-drop/plugin-factory.ts +0 -33
- package/src/pm-plugins/drag-and-drop/plugin-key.ts +0 -5
- package/src/pm-plugins/drag-and-drop/plugin.ts +0 -398
- package/src/pm-plugins/drag-and-drop/reducer.ts +0 -38
- package/src/pm-plugins/drag-and-drop/types.ts +0 -18
- package/src/pm-plugins/drag-and-drop/utils/autoscrollers.ts +0 -49
- package/src/pm-plugins/drag-and-drop/utils/getDragBehaviour.ts +0 -9
- package/src/pm-plugins/drag-and-drop/utils/monitor.ts +0 -73
- package/src/pm-plugins/handlers.ts +0 -161
- package/src/pm-plugins/keymap.ts +0 -436
- package/src/pm-plugins/main.ts +0 -433
- package/src/pm-plugins/plugin-factory.ts +0 -42
- package/src/pm-plugins/plugin-key.ts +0 -8
- package/src/pm-plugins/reducer.ts +0 -145
- package/src/pm-plugins/safari-delete-composition-text-issue-workaround.ts +0 -102
- package/src/pm-plugins/sticky-headers/commands.ts +0 -8
- package/src/pm-plugins/sticky-headers/plugin-key.ts +0 -5
- package/src/pm-plugins/sticky-headers/plugin-state.ts +0 -52
- package/src/pm-plugins/sticky-headers/plugin.ts +0 -12
- package/src/pm-plugins/sticky-headers/types.ts +0 -20
- package/src/pm-plugins/sticky-headers/util.ts +0 -18
- package/src/pm-plugins/table-analytics.ts +0 -100
- package/src/pm-plugins/table-local-id.ts +0 -213
- package/src/pm-plugins/table-resizing/commands.ts +0 -116
- package/src/pm-plugins/table-resizing/event-handlers.ts +0 -352
- package/src/pm-plugins/table-resizing/plugin-factory.ts +0 -29
- package/src/pm-plugins/table-resizing/plugin-key.ts +0 -5
- package/src/pm-plugins/table-resizing/plugin.ts +0 -94
- package/src/pm-plugins/table-resizing/reducer.ts +0 -37
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +0 -306
- package/src/pm-plugins/table-resizing/utils/column-state.ts +0 -120
- package/src/pm-plugins/table-resizing/utils/consts.ts +0 -11
- package/src/pm-plugins/table-resizing/utils/content-width.ts +0 -118
- package/src/pm-plugins/table-resizing/utils/dom.ts +0 -132
- package/src/pm-plugins/table-resizing/utils/misc.ts +0 -282
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +0 -34
- package/src/pm-plugins/table-resizing/utils/resize-logic.ts +0 -289
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +0 -417
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +0 -290
- package/src/pm-plugins/table-resizing/utils/types.ts +0 -25
- package/src/pm-plugins/table-resizing/utils/unit-to-number.ts +0 -1
- package/src/pm-plugins/table-selection-keymap.ts +0 -64
- package/src/pm-plugins/table-size-selector.ts +0 -39
- package/src/pm-plugins/table-width-in-comment-fix.ts +0 -113
- package/src/pm-plugins/table-width.ts +0 -153
- package/src/pm-plugins/transforms/column-width.ts +0 -249
- package/src/pm-plugins/transforms/delete-columns.ts +0 -281
- package/src/pm-plugins/transforms/delete-rows.ts +0 -154
- package/src/pm-plugins/transforms/fix-tables.ts +0 -249
- package/src/pm-plugins/transforms/merge.ts +0 -301
- package/src/pm-plugins/transforms/replace-table.ts +0 -38
- package/src/pm-plugins/transforms/split.ts +0 -90
- package/src/pm-plugins/utils/alignment.ts +0 -33
- package/src/pm-plugins/utils/analytics.ts +0 -238
- package/src/pm-plugins/utils/collapse.ts +0 -93
- package/src/pm-plugins/utils/column-controls.ts +0 -250
- package/src/pm-plugins/utils/create.ts +0 -64
- package/src/pm-plugins/utils/decoration.ts +0 -672
- package/src/pm-plugins/utils/dom.ts +0 -251
- package/src/pm-plugins/utils/drag-menu.tsx +0 -491
- package/src/pm-plugins/utils/get-allow-add-column-custom-step.ts +0 -10
- package/src/pm-plugins/utils/guidelines.ts +0 -30
- package/src/pm-plugins/utils/merged-cells.ts +0 -239
- package/src/pm-plugins/utils/nodes.ts +0 -162
- package/src/pm-plugins/utils/paste.ts +0 -386
- package/src/pm-plugins/utils/row-controls.ts +0 -211
- package/src/pm-plugins/utils/selection.ts +0 -17
- package/src/pm-plugins/utils/snapping.ts +0 -136
- package/src/pm-plugins/utils/table.ts +0 -60
- package/src/pm-plugins/utils/update-plugin-state-decorations.ts +0 -13
- package/src/pm-plugins/view-mode-sort/consts.ts +0 -3
- package/src/pm-plugins/view-mode-sort/index.ts +0 -291
- package/src/pm-plugins/view-mode-sort/plugin-key.ts +0 -7
- package/src/pm-plugins/view-mode-sort/types.ts +0 -23
- package/src/pm-plugins/view-mode-sort/utils.ts +0 -136
- package/src/tablePlugin.tsx +0 -971
- package/src/tablePluginType.ts +0 -102
- package/src/types/index.ts +0 -592
- package/src/ui/ColumnResizeWidget/index.tsx +0 -61
- package/src/ui/ContentComponent.tsx +0 -311
- package/src/ui/DragHandle/HandleIconComponent.tsx +0 -21
- package/src/ui/DragHandle/index.tsx +0 -391
- package/src/ui/DragPreview/index.tsx +0 -51
- package/src/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.tsx +0 -59
- package/src/ui/FloatingContextualButton/FixedButton.tsx +0 -203
- package/src/ui/FloatingContextualButton/index.tsx +0 -168
- package/src/ui/FloatingContextualButton/styles.ts +0 -69
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +0 -931
- package/src/ui/FloatingContextualMenu/index.tsx +0 -141
- package/src/ui/FloatingContextualMenu/styles.ts +0 -77
- package/src/ui/FloatingDeleteButton/DeleteButton.tsx +0 -54
- package/src/ui/FloatingDeleteButton/getPopUpOptions.ts +0 -65
- package/src/ui/FloatingDeleteButton/index.tsx +0 -383
- package/src/ui/FloatingDeleteButton/types.ts +0 -3
- package/src/ui/FloatingDragMenu/DragMenu.tsx +0 -668
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +0 -221
- package/src/ui/FloatingDragMenu/index.tsx +0 -136
- package/src/ui/FloatingDragMenu/styles.ts +0 -83
- package/src/ui/FloatingInsertButton/InsertButton.tsx +0 -263
- package/src/ui/FloatingInsertButton/getPopupOptions.ts +0 -131
- package/src/ui/FloatingInsertButton/index.tsx +0 -314
- package/src/ui/FloatingToolbarLabel/FloatingToolbarLabel.tsx +0 -31
- package/src/ui/SizeSelector/index.tsx +0 -74
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +0 -397
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +0 -105
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +0 -63
- package/src/ui/TableFloatingColumnControls/index.tsx +0 -151
- package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +0 -106
- package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +0 -143
- package/src/ui/TableFloatingControls/CornerControls/types.ts +0 -12
- package/src/ui/TableFloatingControls/FloatingControlsWithSelection.tsx +0 -88
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +0 -175
- package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +0 -131
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +0 -429
- package/src/ui/TableFloatingControls/RowDropTarget/index.tsx +0 -96
- package/src/ui/TableFloatingControls/index.tsx +0 -275
- package/src/ui/TableFullWidthLabel/index.tsx +0 -38
- package/src/ui/common-styles.ts +0 -1218
- package/src/ui/consts.ts +0 -109
- package/src/ui/event-handlers.ts +0 -662
- package/src/ui/global-styles.tsx +0 -55
- package/src/ui/hooks/useInternalTablePluginStateSelector.ts +0 -38
- package/src/ui/icons/AddColLeftIcon.tsx +0 -37
- package/src/ui/icons/AddColRightIcon.tsx +0 -37
- package/src/ui/icons/AddRowAboveIcon.tsx +0 -22
- package/src/ui/icons/AddRowBelowIcon.tsx +0 -39
- package/src/ui/icons/DragHandleDisabledIcon.tsx +0 -25
- package/src/ui/icons/DragHandleIcon.tsx +0 -16
- package/src/ui/icons/DragInMotionIcon.tsx +0 -54
- package/src/ui/icons/MergeCellsIcon.tsx +0 -26
- package/src/ui/icons/MinimisedHandle.tsx +0 -15
- package/src/ui/icons/SortingIconWrapper.tsx +0 -43
- package/src/ui/icons/SplitCellIcon.tsx +0 -34
- package/src/ui/toolbar.tsx +0 -1153
- package/src/ui/ui-styles.ts +0 -960
- package/tsconfig.app.json +0 -135
- package/tsconfig.dev.json +0 -54
- package/tsconfig.json +0 -18
package/src/pm-plugins/main.ts
DELETED
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl-next';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
ACTION,
|
|
5
|
-
ACTION_SUBJECT,
|
|
6
|
-
EVENT_TYPE,
|
|
7
|
-
INPUT_METHOD,
|
|
8
|
-
} from '@atlaskit/editor-common/analytics';
|
|
9
|
-
import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
10
|
-
import { insideTable, isSSR } from '@atlaskit/editor-common/core-utils';
|
|
11
|
-
import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
12
|
-
import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
13
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
14
|
-
import {
|
|
15
|
-
transformSliceToRemoveOpenBodiedExtension,
|
|
16
|
-
transformSliceToRemoveOpenExpand,
|
|
17
|
-
transformSliceToRemoveOpenLayoutNodes,
|
|
18
|
-
transformSliceToRemoveOpenMultiBodiedExtension,
|
|
19
|
-
transformSliceToRemoveOpenNestedExpand,
|
|
20
|
-
} from '@atlaskit/editor-common/transforms';
|
|
21
|
-
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
22
|
-
import { browser, closestElement } from '@atlaskit/editor-common/utils';
|
|
23
|
-
import type { EditorState, TextSelection, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
24
|
-
import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
25
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
26
|
-
import { TableMap } from '@atlaskit/editor-tables';
|
|
27
|
-
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
28
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
29
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
30
|
-
|
|
31
|
-
import {
|
|
32
|
-
tableCellView,
|
|
33
|
-
tableHeaderView,
|
|
34
|
-
tableRowView,
|
|
35
|
-
tableView,
|
|
36
|
-
} from '../nodeviews/table-node-views';
|
|
37
|
-
import { pluginKey as decorationsPluginKey } from '../pm-plugins/decorations/plugin';
|
|
38
|
-
import type {
|
|
39
|
-
InvalidNodeAttr,
|
|
40
|
-
PluginConfig,
|
|
41
|
-
PluginInjectionAPI,
|
|
42
|
-
PluginInjectionAPIWithA11y,
|
|
43
|
-
} from '../types';
|
|
44
|
-
import { TableCssClassName as ClassName } from '../types';
|
|
45
|
-
import {
|
|
46
|
-
handleBlur,
|
|
47
|
-
handleClick,
|
|
48
|
-
handleCut,
|
|
49
|
-
handleFocus,
|
|
50
|
-
handleMouseDown,
|
|
51
|
-
handleMouseEnter,
|
|
52
|
-
handleMouseLeave,
|
|
53
|
-
handleMouseMove,
|
|
54
|
-
handleMouseUp,
|
|
55
|
-
handleTripleClick,
|
|
56
|
-
whenTableInFocus,
|
|
57
|
-
withCellTracking,
|
|
58
|
-
} from '../ui/event-handlers';
|
|
59
|
-
|
|
60
|
-
import { addBoldInEmptyHeaderCells, clearHoverSelection, setTableRef } from './commands';
|
|
61
|
-
import { stopKeyboardColumnResizing } from './commands/column-resize';
|
|
62
|
-
import {
|
|
63
|
-
removeResizeHandleDecorations,
|
|
64
|
-
transformSliceRemoveCellBackgroundColor,
|
|
65
|
-
transformSliceToAddTableHeaders,
|
|
66
|
-
transformSliceToRemoveColumnsWidths,
|
|
67
|
-
} from './commands/misc';
|
|
68
|
-
import { defaultHoveredCell, defaultTableSelection } from './default-table-selection';
|
|
69
|
-
import { createPluginState, getPluginState } from './plugin-factory';
|
|
70
|
-
import { pluginKey } from './plugin-key';
|
|
71
|
-
import { fixTables } from './transforms/fix-tables';
|
|
72
|
-
import { replaceSelectedTable } from './transforms/replace-table';
|
|
73
|
-
import { findControlsHoverDecoration } from './utils/decoration';
|
|
74
|
-
import {
|
|
75
|
-
transformSliceToCorrectEmptyTableCells,
|
|
76
|
-
transformSliceToFixHardBreakProblemOnCopyFromCell,
|
|
77
|
-
transformSliceToRemoveOpenTable,
|
|
78
|
-
transformSliceToRemoveNestedTables,
|
|
79
|
-
isHeaderRowRequired,
|
|
80
|
-
transformSliceTableLayoutDefaultToCenter,
|
|
81
|
-
} from './utils/paste';
|
|
82
|
-
|
|
83
|
-
export const createPlugin = (
|
|
84
|
-
dispatchAnalyticsEvent: DispatchAnalyticsEvent,
|
|
85
|
-
dispatch: Dispatch,
|
|
86
|
-
portalProviderAPI: PortalProviderAPI,
|
|
87
|
-
nodeViewPortalProviderAPI: PortalProviderAPI,
|
|
88
|
-
eventDispatcher: EventDispatcher,
|
|
89
|
-
pluginConfig: PluginConfig,
|
|
90
|
-
getEditorContainerWidth: GetEditorContainerWidth,
|
|
91
|
-
getEditorFeatureFlags: GetEditorFeatureFlags,
|
|
92
|
-
getIntl: () => IntlShape,
|
|
93
|
-
fullWidthModeEnabled?: boolean,
|
|
94
|
-
previousFullWidthModeEnabled?: boolean,
|
|
95
|
-
dragAndDropEnabled?: boolean,
|
|
96
|
-
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
97
|
-
pluginInjectionApi?: PluginInjectionAPI,
|
|
98
|
-
isTableScalingEnabled?: boolean,
|
|
99
|
-
shouldUseIncreasedScalingPercent?: boolean,
|
|
100
|
-
isCommentEditor?: boolean,
|
|
101
|
-
isChromelessEditor?: boolean,
|
|
102
|
-
) => {
|
|
103
|
-
const state = createPluginState(dispatch, {
|
|
104
|
-
pluginConfig,
|
|
105
|
-
isTableHovered: false,
|
|
106
|
-
insertColumnButtonIndex: undefined,
|
|
107
|
-
insertRowButtonIndex: undefined,
|
|
108
|
-
isFullWidthModeEnabled: fullWidthModeEnabled,
|
|
109
|
-
wasFullWidthModeEnabled: previousFullWidthModeEnabled,
|
|
110
|
-
isHeaderRowEnabled: !!pluginConfig.allowHeaderRow,
|
|
111
|
-
isHeaderColumnEnabled: false,
|
|
112
|
-
isDragAndDropEnabled: dragAndDropEnabled,
|
|
113
|
-
isTableScalingEnabled: isTableScalingEnabled,
|
|
114
|
-
...defaultHoveredCell,
|
|
115
|
-
...defaultTableSelection,
|
|
116
|
-
getIntl,
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
// Used to prevent invalid table cell spans being reported more than once per editor/document
|
|
120
|
-
const invalidTableIds: string[] = [];
|
|
121
|
-
let editorViewRef: EditorView | null = null;
|
|
122
|
-
|
|
123
|
-
const ariaNotifyPlugin = (pluginInjectionApi as PluginInjectionAPIWithA11y)?.accessibilityUtils
|
|
124
|
-
?.actions.ariaNotify;
|
|
125
|
-
|
|
126
|
-
const getCurrentEditorState = (): EditorState | null => {
|
|
127
|
-
const editorView = editorViewRef;
|
|
128
|
-
if (!editorView) {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return editorView.state;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
const getNodeView = () => {
|
|
136
|
-
// Because the layout shift issues has been fixed under experiment platform_editor_tables_scaling_css, so still want to load nodeview on SSR if experiment is enabled
|
|
137
|
-
if (expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)) {
|
|
138
|
-
return {
|
|
139
|
-
table: tableView({
|
|
140
|
-
portalProviderAPI,
|
|
141
|
-
eventDispatcher,
|
|
142
|
-
getEditorContainerWidth,
|
|
143
|
-
getEditorFeatureFlags,
|
|
144
|
-
dispatchAnalyticsEvent,
|
|
145
|
-
pluginInjectionApi,
|
|
146
|
-
isCommentEditor,
|
|
147
|
-
isChromelessEditor,
|
|
148
|
-
}),
|
|
149
|
-
tableRow: tableRowView({ eventDispatcher, pluginInjectionApi }),
|
|
150
|
-
tableCell: tableCellView({ eventDispatcher, pluginInjectionApi }),
|
|
151
|
-
tableHeader: tableHeaderView({ eventDispatcher, pluginInjectionApi }),
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
if (isSSR() && fg('platform_editor_table_fallback_to_dom_on_ssr')) {
|
|
155
|
-
return undefined;
|
|
156
|
-
}
|
|
157
|
-
return {
|
|
158
|
-
table: tableView({
|
|
159
|
-
portalProviderAPI,
|
|
160
|
-
eventDispatcher,
|
|
161
|
-
getEditorContainerWidth,
|
|
162
|
-
getEditorFeatureFlags,
|
|
163
|
-
dispatchAnalyticsEvent,
|
|
164
|
-
pluginInjectionApi,
|
|
165
|
-
isCommentEditor,
|
|
166
|
-
isChromelessEditor,
|
|
167
|
-
}),
|
|
168
|
-
tableRow: tableRowView({ eventDispatcher, pluginInjectionApi }),
|
|
169
|
-
tableCell: tableCellView({ eventDispatcher, pluginInjectionApi }),
|
|
170
|
-
tableHeader: tableHeaderView({ eventDispatcher, pluginInjectionApi }),
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
const nodeViews = getNodeView();
|
|
175
|
-
return new SafePlugin({
|
|
176
|
-
state: state,
|
|
177
|
-
key: pluginKey,
|
|
178
|
-
appendTransaction: (
|
|
179
|
-
transactions: readonly Transaction[],
|
|
180
|
-
oldState: EditorState,
|
|
181
|
-
newState: EditorState,
|
|
182
|
-
) => {
|
|
183
|
-
const tr = transactions.find((tr) => tr.getMeta('uiEvent') === 'cut');
|
|
184
|
-
|
|
185
|
-
function reportInvalidTableCellSpanAttrs(invalidNodeAttr: InvalidNodeAttr) {
|
|
186
|
-
if (invalidTableIds.find((id) => id === invalidNodeAttr.tableLocalId)) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
invalidTableIds.push(invalidNodeAttr.tableLocalId);
|
|
191
|
-
|
|
192
|
-
dispatchAnalyticsEvent({
|
|
193
|
-
action: ACTION.INVALID_DOCUMENT_ENCOUNTERED,
|
|
194
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
195
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
196
|
-
attributes: {
|
|
197
|
-
nodeType: invalidNodeAttr.nodeType,
|
|
198
|
-
reason: `${invalidNodeAttr.attribute}: ${invalidNodeAttr.reason}`,
|
|
199
|
-
tableLocalId: invalidNodeAttr.tableLocalId,
|
|
200
|
-
spanValue: invalidNodeAttr.spanValue,
|
|
201
|
-
},
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (tr) {
|
|
206
|
-
const { tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags();
|
|
207
|
-
// "fixTables" removes empty rows as we don't allow that in schema
|
|
208
|
-
const updatedTr = handleCut(
|
|
209
|
-
tr,
|
|
210
|
-
oldState,
|
|
211
|
-
newState,
|
|
212
|
-
pluginInjectionApi,
|
|
213
|
-
editorAnalyticsAPI,
|
|
214
|
-
editorViewRef || undefined,
|
|
215
|
-
isTableScalingEnabled,
|
|
216
|
-
tableWithFixedColumnWidthsOption,
|
|
217
|
-
shouldUseIncreasedScalingPercent,
|
|
218
|
-
);
|
|
219
|
-
return fixTables(updatedTr) || updatedTr;
|
|
220
|
-
}
|
|
221
|
-
if (transactions.find((tr) => tr.docChanged)) {
|
|
222
|
-
return fixTables(newState.tr, reportInvalidTableCellSpanAttrs);
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
view: (editorView: EditorView) => {
|
|
226
|
-
const domAtPos = editorView.domAtPos.bind(editorView);
|
|
227
|
-
editorViewRef = editorView;
|
|
228
|
-
|
|
229
|
-
return {
|
|
230
|
-
update: (view: EditorView, prevState: EditorState) => {
|
|
231
|
-
const { state, dispatch } = view;
|
|
232
|
-
const { selection } = state;
|
|
233
|
-
const pluginState = getPluginState(state);
|
|
234
|
-
let tableRef: HTMLTableElement | undefined;
|
|
235
|
-
if (pluginState.editorHasFocus) {
|
|
236
|
-
const parent = findParentDomRefOfType(state.schema.nodes.table, domAtPos)(selection);
|
|
237
|
-
if (parent) {
|
|
238
|
-
tableRef =
|
|
239
|
-
// Ignored via go/ees005
|
|
240
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
241
|
-
(parent as HTMLElement).querySelector<HTMLTableElement>('table') || undefined;
|
|
242
|
-
}
|
|
243
|
-
const tableNode = findTable(state.selection);
|
|
244
|
-
// when keyboard cursor leaves the table we need to stop column resizing
|
|
245
|
-
const pluginPrevState = getPluginState(prevState);
|
|
246
|
-
const isStopKeyboardColumResizing =
|
|
247
|
-
pluginPrevState.isResizeHandleWidgetAdded && pluginPrevState.isKeyboardResize;
|
|
248
|
-
if (isStopKeyboardColumResizing) {
|
|
249
|
-
const isTableNodesDifferent = pluginPrevState?.tableNode !== tableNode?.node;
|
|
250
|
-
if (pluginPrevState?.tableNode && tableNode && isTableNodesDifferent) {
|
|
251
|
-
const oldRowsNumber = TableMap.get(pluginPrevState.tableNode).height;
|
|
252
|
-
const newRowsNumber = TableMap.get(tableNode.node).height;
|
|
253
|
-
if (
|
|
254
|
-
oldRowsNumber !== newRowsNumber || // Add/delete row
|
|
255
|
-
tableNode.node.attrs.localId !== pluginPrevState.tableNode.attrs.localId
|
|
256
|
-
) {
|
|
257
|
-
// Jump to another table
|
|
258
|
-
stopKeyboardColumnResizing({
|
|
259
|
-
ariaNotify: ariaNotifyPlugin,
|
|
260
|
-
getIntl: getIntl,
|
|
261
|
-
})(state, dispatch);
|
|
262
|
-
}
|
|
263
|
-
} else if (!tableNode) {
|
|
264
|
-
// selection outside of table
|
|
265
|
-
stopKeyboardColumnResizing({
|
|
266
|
-
ariaNotify: ariaNotifyPlugin,
|
|
267
|
-
getIntl: getIntl,
|
|
268
|
-
})(state, dispatch);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
if (pluginState.tableRef !== tableRef) {
|
|
274
|
-
setTableRef(tableRef)(state, dispatch);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (pluginState.editorHasFocus && pluginState.tableRef) {
|
|
278
|
-
const { $cursor } = state.selection as TextSelection;
|
|
279
|
-
if ($cursor) {
|
|
280
|
-
// Only update bold when it's a cursor
|
|
281
|
-
const tableCellHeader = findParentNodeOfType(state.schema.nodes.tableHeader)(
|
|
282
|
-
state.selection,
|
|
283
|
-
);
|
|
284
|
-
|
|
285
|
-
if (tableCellHeader) {
|
|
286
|
-
addBoldInEmptyHeaderCells(tableCellHeader)(state, dispatch);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
} else if (pluginState.isResizeHandleWidgetAdded) {
|
|
290
|
-
removeResizeHandleDecorations()(state, dispatch);
|
|
291
|
-
}
|
|
292
|
-
},
|
|
293
|
-
};
|
|
294
|
-
},
|
|
295
|
-
props: {
|
|
296
|
-
transformPasted(slice) {
|
|
297
|
-
const editorState = getCurrentEditorState();
|
|
298
|
-
if (!editorState) {
|
|
299
|
-
return slice;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
const { schema } = editorState;
|
|
303
|
-
|
|
304
|
-
// if we're pasting to outside a table or outside a table
|
|
305
|
-
// header, ensure that we apply any table headers to the first
|
|
306
|
-
// row of content we see, if required
|
|
307
|
-
if (!insideTable(editorState) && isHeaderRowRequired(editorState)) {
|
|
308
|
-
slice = transformSliceToAddTableHeaders(slice, schema);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// This fixes pasting a table with default layout into comment editor
|
|
312
|
-
// table lose width and expand to full width
|
|
313
|
-
if (
|
|
314
|
-
!insideTable(editorState) &&
|
|
315
|
-
isCommentEditor &&
|
|
316
|
-
pluginConfig.allowTableAlignment &&
|
|
317
|
-
isTableScalingEnabled
|
|
318
|
-
) {
|
|
319
|
-
slice = transformSliceTableLayoutDefaultToCenter(slice, schema);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
slice = transformSliceToFixHardBreakProblemOnCopyFromCell(slice, schema);
|
|
323
|
-
|
|
324
|
-
// We do this separately, so it also applies to drag/drop events
|
|
325
|
-
// This needs to go before `transformSliceToRemoveOpenExpand`
|
|
326
|
-
slice = transformSliceToRemoveOpenLayoutNodes(slice, schema);
|
|
327
|
-
|
|
328
|
-
// If a partial paste of expand, paste only the content
|
|
329
|
-
// This needs to go before `transformSliceToRemoveOpenTable`
|
|
330
|
-
slice = transformSliceToRemoveOpenExpand(slice, schema);
|
|
331
|
-
|
|
332
|
-
// transformSliceToRemoveOpenTable() transforms based on the depth of the root node, assuming that the tables will be at the root
|
|
333
|
-
// Bodied extensions will contribute to the depth of the table selection so we need to remove them first
|
|
334
|
-
/** If a partial paste of bodied extension, paste only text */
|
|
335
|
-
slice = transformSliceToRemoveOpenBodiedExtension(slice, schema);
|
|
336
|
-
|
|
337
|
-
/** If a partial paste of table, paste only table's content */
|
|
338
|
-
slice = transformSliceToRemoveOpenTable(slice, schema);
|
|
339
|
-
|
|
340
|
-
/** If a partial paste of multi bodied extension, paste only children */
|
|
341
|
-
slice = transformSliceToRemoveOpenMultiBodiedExtension(slice, schema);
|
|
342
|
-
|
|
343
|
-
slice = transformSliceToCorrectEmptyTableCells(slice, schema);
|
|
344
|
-
|
|
345
|
-
if (!pluginConfig.allowColumnResizing) {
|
|
346
|
-
slice = transformSliceToRemoveColumnsWidths(slice, schema);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
// If we don't allow background on cells, we need to remove it
|
|
350
|
-
// from the paste slice
|
|
351
|
-
if (!pluginConfig.allowBackgroundColor) {
|
|
352
|
-
slice = transformSliceRemoveCellBackgroundColor(slice, schema);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
slice = transformSliceToRemoveOpenNestedExpand(slice, schema);
|
|
356
|
-
|
|
357
|
-
if (fg('platform_editor_use_nested_table_pm_nodes')) {
|
|
358
|
-
slice = transformSliceToRemoveNestedTables(slice, schema, editorState.selection);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
return slice;
|
|
362
|
-
},
|
|
363
|
-
handleClick: ({ state, dispatch }, _pos, event: MouseEvent) => {
|
|
364
|
-
const decorationSet = decorationsPluginKey.getState(state);
|
|
365
|
-
if (findControlsHoverDecoration(decorationSet).length) {
|
|
366
|
-
clearHoverSelection()(state, dispatch);
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
// ED-6069: workaround for Chrome given a regression introduced in prosemirror-view@1.6.8
|
|
370
|
-
// Returning true prevents that updateSelection() is getting called in the commit below:
|
|
371
|
-
// @see https://github.com/ProseMirror/prosemirror-view/commit/33fe4a8b01584f6b4103c279033dcd33e8047b95
|
|
372
|
-
if (browser.chrome && event.target) {
|
|
373
|
-
// Ignored via go/ees005
|
|
374
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
375
|
-
const targetClassList = (event.target as HTMLElement).classList;
|
|
376
|
-
|
|
377
|
-
if (
|
|
378
|
-
targetClassList.contains(ClassName.CONTROLS_BUTTON) ||
|
|
379
|
-
targetClassList.contains(ClassName.CONTEXTUAL_MENU_BUTTON) ||
|
|
380
|
-
targetClassList.contains(ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE) ||
|
|
381
|
-
targetClassList.contains(ClassName.DRAG_HANDLE_BUTTON_CONTAINER)
|
|
382
|
-
) {
|
|
383
|
-
return true;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
return false;
|
|
388
|
-
},
|
|
389
|
-
handleScrollToSelection: (view: EditorView) => {
|
|
390
|
-
// when typing into a sticky header cell, we don't want to scroll
|
|
391
|
-
// back to the top of the table if the user has already scrolled down
|
|
392
|
-
const { tableHeader } = view.state.schema.nodes;
|
|
393
|
-
const domRef = findParentDomRefOfType(
|
|
394
|
-
tableHeader,
|
|
395
|
-
view.domAtPos.bind(view),
|
|
396
|
-
)(view.state.selection);
|
|
397
|
-
|
|
398
|
-
const maybeTr = closestElement(domRef as HTMLElement | undefined, 'tr');
|
|
399
|
-
return maybeTr ? maybeTr.classList.contains('sticky') : false;
|
|
400
|
-
},
|
|
401
|
-
handleTextInput: (view, _from, _to, text) => {
|
|
402
|
-
const { state, dispatch } = view;
|
|
403
|
-
const { isKeyboardResize } = getPluginState(state);
|
|
404
|
-
if (isKeyboardResize) {
|
|
405
|
-
stopKeyboardColumnResizing({
|
|
406
|
-
ariaNotify: ariaNotifyPlugin,
|
|
407
|
-
getIntl: getIntl,
|
|
408
|
-
})(state, dispatch);
|
|
409
|
-
return false;
|
|
410
|
-
}
|
|
411
|
-
const tr = replaceSelectedTable(state, text, INPUT_METHOD.KEYBOARD, editorAnalyticsAPI);
|
|
412
|
-
if (tr.selectionSet) {
|
|
413
|
-
dispatch(tr);
|
|
414
|
-
return true;
|
|
415
|
-
}
|
|
416
|
-
return false;
|
|
417
|
-
},
|
|
418
|
-
nodeViews,
|
|
419
|
-
handleDOMEvents: {
|
|
420
|
-
focus: handleFocus,
|
|
421
|
-
blur: handleBlur,
|
|
422
|
-
mousedown: withCellTracking(handleMouseDown),
|
|
423
|
-
mouseleave: handleMouseLeave,
|
|
424
|
-
mousemove: whenTableInFocus(handleMouseMove(nodeViewPortalProviderAPI), pluginInjectionApi),
|
|
425
|
-
mouseenter: handleMouseEnter,
|
|
426
|
-
mouseup: whenTableInFocus(handleMouseUp),
|
|
427
|
-
click: withCellTracking(whenTableInFocus(handleClick)),
|
|
428
|
-
},
|
|
429
|
-
|
|
430
|
-
handleTripleClick,
|
|
431
|
-
},
|
|
432
|
-
});
|
|
433
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
2
|
-
|
|
3
|
-
import { handleDocOrSelectionChanged } from './handlers';
|
|
4
|
-
import { pluginKey } from './plugin-key';
|
|
5
|
-
import reducer from './reducer';
|
|
6
|
-
|
|
7
|
-
export const { createPluginState, createCommand, getPluginState } = pluginFactory(
|
|
8
|
-
pluginKey,
|
|
9
|
-
reducer,
|
|
10
|
-
{
|
|
11
|
-
mapping: (tr, pluginState) => {
|
|
12
|
-
if (tr.docChanged) {
|
|
13
|
-
let updatedTargetCell = {};
|
|
14
|
-
if (pluginState.targetCellPosition) {
|
|
15
|
-
const { pos, deleted } = tr.mapping.mapResult(pluginState.targetCellPosition);
|
|
16
|
-
|
|
17
|
-
updatedTargetCell = {
|
|
18
|
-
targetCellPosition: deleted ? undefined : pos,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
let updatedTablePos = {};
|
|
23
|
-
if (pluginState.tablePos) {
|
|
24
|
-
const { pos, deleted } = tr.mapping.mapResult(pluginState.tablePos, -1);
|
|
25
|
-
|
|
26
|
-
updatedTablePos = {
|
|
27
|
-
tablePos: deleted ? undefined : pos,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
...pluginState,
|
|
33
|
-
...updatedTargetCell,
|
|
34
|
-
...updatedTablePos,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
return pluginState;
|
|
38
|
-
},
|
|
39
|
-
onDocChanged: handleDocOrSelectionChanged,
|
|
40
|
-
onSelectionChanged: handleDocOrSelectionChanged,
|
|
41
|
-
},
|
|
42
|
-
);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
2
|
-
// Entry file in package.json
|
|
3
|
-
|
|
4
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
|
|
6
|
-
import type { TablePluginState } from '../types';
|
|
7
|
-
|
|
8
|
-
export const pluginKey = new PluginKey<TablePluginState>('tablePlugin');
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import type { TablePluginAction, TablePluginState } from '../types';
|
|
2
|
-
|
|
3
|
-
import { defaultTableSelection } from './default-table-selection';
|
|
4
|
-
|
|
5
|
-
export default (pluginState: TablePluginState, action: TablePluginAction): TablePluginState => {
|
|
6
|
-
switch (action.type) {
|
|
7
|
-
case 'TOGGLE_HEADER_COLUMN':
|
|
8
|
-
return {
|
|
9
|
-
...pluginState,
|
|
10
|
-
isHeaderColumnEnabled: !pluginState.isHeaderColumnEnabled,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
case 'TOGGLE_HEADER_ROW':
|
|
14
|
-
return {
|
|
15
|
-
...pluginState,
|
|
16
|
-
isHeaderRowEnabled: !pluginState.isHeaderRowEnabled,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
case 'CLEAR_HOVER_SELECTION':
|
|
20
|
-
return { ...pluginState, ...action.data, ...defaultTableSelection };
|
|
21
|
-
|
|
22
|
-
case 'SELECT_COLUMN':
|
|
23
|
-
return { ...pluginState, ...action.data, isContextualMenuOpen: false };
|
|
24
|
-
|
|
25
|
-
case 'SET_TARGET_CELL_POSITION':
|
|
26
|
-
return { ...pluginState, ...action.data, isContextualMenuOpen: false };
|
|
27
|
-
|
|
28
|
-
case 'TOGGLE_CONTEXTUAL_MENU':
|
|
29
|
-
return {
|
|
30
|
-
...pluginState,
|
|
31
|
-
isContextualMenuOpen: !pluginState.isContextualMenuOpen,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
case 'SHOW_INSERT_ROW_BUTTON':
|
|
35
|
-
if (action.data.insertRowButtonIndex === pluginState.insertRowButtonIndex) {
|
|
36
|
-
return pluginState;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
...pluginState,
|
|
41
|
-
...action.data,
|
|
42
|
-
insertColumnButtonIndex: undefined, // We need to assure that column is not shown
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
case 'SHOW_INSERT_COLUMN_BUTTON':
|
|
46
|
-
if (action.data.insertColumnButtonIndex === pluginState.insertColumnButtonIndex) {
|
|
47
|
-
return pluginState;
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
...pluginState,
|
|
51
|
-
...action.data,
|
|
52
|
-
insertRowButtonIndex: undefined, // We need to assure that row is not shown
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
case 'HIDE_INSERT_COLUMN_OR_ROW_BUTTON':
|
|
56
|
-
if (
|
|
57
|
-
pluginState.insertRowButtonIndex !== undefined ||
|
|
58
|
-
pluginState.insertColumnButtonIndex !== undefined
|
|
59
|
-
) {
|
|
60
|
-
return {
|
|
61
|
-
...pluginState,
|
|
62
|
-
insertRowButtonIndex: undefined,
|
|
63
|
-
insertColumnButtonIndex: undefined,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
return pluginState;
|
|
67
|
-
|
|
68
|
-
case 'HIDE_RESIZE_HANDLE_LINE':
|
|
69
|
-
return {
|
|
70
|
-
...pluginState,
|
|
71
|
-
...action.data,
|
|
72
|
-
resizeHandleColumnIndex: undefined,
|
|
73
|
-
resizeHandleRowIndex: undefined,
|
|
74
|
-
};
|
|
75
|
-
case 'START_KEYBOARD_COLUMN_RESIZE':
|
|
76
|
-
case 'ADD_RESIZE_HANDLE_DECORATIONS':
|
|
77
|
-
if (
|
|
78
|
-
action.data.resizeHandleColumnIndex === pluginState.resizeHandleColumnIndex &&
|
|
79
|
-
action.data.resizeHandleRowIndex === pluginState.resizeHandleRowIndex &&
|
|
80
|
-
action.data.resizeHandleIncludeTooltip === pluginState.resizeHandleIncludeTooltip &&
|
|
81
|
-
action.data.isKeyboardResize === pluginState.isKeyboardResize
|
|
82
|
-
) {
|
|
83
|
-
return pluginState;
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
...pluginState,
|
|
87
|
-
...action.data,
|
|
88
|
-
isResizeHandleWidgetAdded: true,
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
case 'UPDATE_RESIZE_HANDLE_DECORATIONS':
|
|
92
|
-
const { resizeHandleColumnIndex, resizeHandleRowIndex, resizeHandleIncludeTooltip } =
|
|
93
|
-
action.data;
|
|
94
|
-
|
|
95
|
-
if (
|
|
96
|
-
(resizeHandleColumnIndex === pluginState.resizeHandleColumnIndex ||
|
|
97
|
-
!Number.isFinite(resizeHandleColumnIndex)) &&
|
|
98
|
-
(resizeHandleRowIndex === pluginState.resizeHandleRowIndex ||
|
|
99
|
-
!Number.isFinite(resizeHandleRowIndex)) &&
|
|
100
|
-
(resizeHandleIncludeTooltip === pluginState.resizeHandleIncludeTooltip ||
|
|
101
|
-
resizeHandleIncludeTooltip === undefined)
|
|
102
|
-
) {
|
|
103
|
-
return pluginState;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return {
|
|
107
|
-
...pluginState,
|
|
108
|
-
resizeHandleColumnIndex: resizeHandleColumnIndex ?? pluginState.resizeHandleColumnIndex,
|
|
109
|
-
resizeHandleRowIndex: resizeHandleRowIndex ?? pluginState.resizeHandleRowIndex,
|
|
110
|
-
resizeHandleIncludeTooltip:
|
|
111
|
-
resizeHandleIncludeTooltip ?? pluginState.resizeHandleIncludeTooltip,
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
case 'STOP_KEYBOARD_COLUMN_RESIZE':
|
|
115
|
-
case 'REMOVE_RESIZE_HANDLE_DECORATIONS':
|
|
116
|
-
if (!pluginState.isResizeHandleWidgetAdded) {
|
|
117
|
-
return pluginState;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return {
|
|
121
|
-
...pluginState,
|
|
122
|
-
...action.data,
|
|
123
|
-
resizeHandleColumnIndex: undefined,
|
|
124
|
-
resizeHandleRowIndex: undefined,
|
|
125
|
-
isResizeHandleWidgetAdded: false,
|
|
126
|
-
isKeyboardResize: undefined,
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
case 'UPDATE_TABLE_WIDTH_TO_WIDEST':
|
|
130
|
-
case 'SET_TABLE_REF':
|
|
131
|
-
case 'HOVER_ROWS':
|
|
132
|
-
case 'HOVER_COLUMNS':
|
|
133
|
-
case 'HOVER_TABLE':
|
|
134
|
-
case 'TABLE_HOVERED':
|
|
135
|
-
case 'HOVER_MERGED_CELLS':
|
|
136
|
-
case 'HOVER_CELL':
|
|
137
|
-
case 'SHOW_RESIZE_HANDLE_LINE':
|
|
138
|
-
case 'SET_EDITOR_FOCUS':
|
|
139
|
-
case 'SET_CELL_MENU_OPEN':
|
|
140
|
-
return { ...pluginState, ...action.data };
|
|
141
|
-
|
|
142
|
-
default:
|
|
143
|
-
return pluginState;
|
|
144
|
-
}
|
|
145
|
-
};
|