@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
|
@@ -14,10 +14,7 @@ var getDecorations = function getDecorations(state) {
|
|
|
14
14
|
var updatePluginStateDecorations = function updatePluginStateDecorations(state, decorations, key) {
|
|
15
15
|
return updateDecorations(state.doc, getDecorations(state), decorations, key);
|
|
16
16
|
};
|
|
17
|
-
export var setDropTarget = function setDropTarget(type, index, hasMergedCells, tr
|
|
18
|
-
// Ignored via go/ees005
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
20
|
-
) {
|
|
17
|
+
export var setDropTarget = function setDropTarget(type, index, hasMergedCells, tr) {
|
|
21
18
|
return createCommand(function (state) {
|
|
22
19
|
var _getPluginState = getPluginState(state),
|
|
23
20
|
dropTargetType = _getPluginState.dropTargetType,
|
|
@@ -61,10 +58,7 @@ export var clearDropTarget = function clearDropTarget(tr) {
|
|
|
61
58
|
return (tr || originalTr).setMeta('addToHistory', false);
|
|
62
59
|
});
|
|
63
60
|
};
|
|
64
|
-
export var moveSource = function moveSource(sourceType, sourceIndexes, targetIndex, tr
|
|
65
|
-
// Ignored via go/ees005
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
67
|
-
) {
|
|
61
|
+
export var moveSource = function moveSource(sourceType, sourceIndexes, targetIndex, tr) {
|
|
68
62
|
return createCommand(function (state) {
|
|
69
63
|
return {
|
|
70
64
|
type: DragAndDropActionType.CLEAR_DROP_TARGET,
|
|
@@ -119,10 +113,7 @@ export var toggleDragMenu = function toggleDragMenu(isDragMenuOpen, direction, i
|
|
|
119
113
|
return tr.setMeta('addToHistory', false);
|
|
120
114
|
});
|
|
121
115
|
};
|
|
122
|
-
export var cloneSource = function cloneSource(sourceType, sourceIndexes, targetIndex, targetDirection, tr
|
|
123
|
-
// Ignored via go/ees005
|
|
124
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
125
|
-
) {
|
|
116
|
+
export var cloneSource = function cloneSource(sourceType, sourceIndexes, targetIndex, targetDirection, tr) {
|
|
126
117
|
return createCommand(function (state) {
|
|
127
118
|
return {
|
|
128
119
|
type: DragAndDropActionType.CLEAR_DROP_TARGET,
|
|
@@ -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
|
-
var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor
|
|
22
|
-
// Ignored via go/ees005
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
24
|
-
) {
|
|
21
|
+
var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor) {
|
|
25
22
|
var editorPageScrollContainer = document.querySelector('.fabric-editor-popup-scroll-parent');
|
|
26
23
|
var rowAutoScrollers = editorPageScrollContainer ? [monitorForElements({
|
|
27
24
|
canMonitor: function canMonitor(_ref) {
|
|
@@ -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) {
|
|
16
13
|
var _pluginInjectionApi$a;
|
|
17
14
|
var isTableScalingEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
@@ -24,10 +24,7 @@ import { fixTables } from './transforms/fix-tables';
|
|
|
24
24
|
import { replaceSelectedTable } from './transforms/replace-table';
|
|
25
25
|
import { findControlsHoverDecoration } from './utils/decoration';
|
|
26
26
|
import { transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, transformSliceToRemoveOpenTable, transformSliceToRemoveNestedTables, isHeaderRowRequired, transformSliceTableLayoutDefaultToCenter } from './utils/paste';
|
|
27
|
-
export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor
|
|
28
|
-
// Ignored via go/ees005
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
30
|
-
) {
|
|
27
|
+
export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor) {
|
|
31
28
|
var _accessibilityUtils;
|
|
32
29
|
var state = createPluginState(dispatch, _objectSpread(_objectSpread(_objectSpread({
|
|
33
30
|
pluginConfig: pluginConfig,
|
|
@@ -242,8 +239,6 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
242
239
|
var maybeTr = closestElement(domRef, 'tr');
|
|
243
240
|
return maybeTr ? maybeTr.classList.contains('sticky') : false;
|
|
244
241
|
},
|
|
245
|
-
// Ignored via go/ees005
|
|
246
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
247
242
|
handleTextInput: function handleTextInput(view, _from, _to, text) {
|
|
248
243
|
var state = view.state,
|
|
249
244
|
dispatch = view.dispatch;
|
|
@@ -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 var handleMouseDown = function 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 var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isCommentEditor) {
|
|
22
19
|
var _originalTable$attrs;
|
|
23
20
|
var state = view.state,
|
|
24
21
|
dispatch = view.dispatch;
|
|
@@ -8,9 +8,6 @@ import { handleMouseDown } from './event-handlers';
|
|
|
8
8
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
9
9
|
import { pluginKey } from './plugin-key';
|
|
10
10
|
import { getResizeCellPos } from './utils/dom';
|
|
11
|
-
|
|
12
|
-
// Ignored via go/ees005
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
14
11
|
export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled, isCommentEditor) {
|
|
15
12
|
var _ref$lastColumnResiza = _ref.lastColumnResizable,
|
|
16
13
|
lastColumnResizable = _ref$lastColumnResiza === void 0 ? true : _ref$lastColumnResiza;
|
|
@@ -14,10 +14,7 @@ import { getScalingPercentForTableWithoutWidth, getTableScalingPercent } from '.
|
|
|
14
14
|
export var getColWidthFix = function getColWidthFix(colwidth, tableColumnCount) {
|
|
15
15
|
return colwidth - 1 / tableColumnCount;
|
|
16
16
|
};
|
|
17
|
-
export var generateColgroup = function generateColgroup(table, tableRef, shouldUseIncreasedScalingPercent, isCommentEditor
|
|
18
|
-
// Ignored via go/ees005
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
20
|
-
) {
|
|
17
|
+
export var generateColgroup = function generateColgroup(table, tableRef, shouldUseIncreasedScalingPercent, isCommentEditor) {
|
|
21
18
|
var cols = [];
|
|
22
19
|
var map = TableMap.get(table);
|
|
23
20
|
|
|
@@ -108,9 +105,6 @@ export var isMinCellWidthTable = function isMinCellWidthTable(table) {
|
|
|
108
105
|
});
|
|
109
106
|
return isTableMinCellWidth;
|
|
110
107
|
};
|
|
111
|
-
|
|
112
|
-
// Ignored via go/ees005
|
|
113
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
114
108
|
function renderColgroupFromNode(table, maybeTableRef, shouldUseIncreasedScalingPercent, isCommentEditor) {
|
|
115
109
|
var rendered = DOMSerializer.renderSpec(document, ['colgroup', {}].concat(_toConsumableArray(generateColgroup(table, maybeTableRef, shouldUseIncreasedScalingPercent, isCommentEditor))));
|
|
116
110
|
|
|
@@ -20,10 +20,7 @@ export var getFreeSpace = function getFreeSpace(state) {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
// Returns DOM refs of all cells in a column by `columnIndex`
|
|
23
|
-
export var getCellsRefsInColumn = function getCellsRefsInColumn(columnIndex, table, tableStart, domAtPos
|
|
24
|
-
// Ignored via go/ees005
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
26
|
-
) {
|
|
23
|
+
export var getCellsRefsInColumn = function getCellsRefsInColumn(columnIndex, table, tableStart, domAtPos) {
|
|
27
24
|
var map = TableMap.get(table);
|
|
28
25
|
var cellsPositions = map.cellsInRect({
|
|
29
26
|
left: columnIndex,
|
|
@@ -1,16 +1,11 @@
|
|
|
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) {
|
|
7
5
|
var colWidths = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
8
6
|
var canvas = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document.createElement('canvas');
|
|
9
7
|
return calcContentWidth(elem, container || elem, canvas, colWidths);
|
|
10
8
|
}
|
|
11
|
-
|
|
12
|
-
// Ignored via go/ees005
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
14
9
|
function calcContentWidth(elem, container, canvas, colWidths) {
|
|
15
10
|
var flowWidths = [];
|
|
16
11
|
var curWidth = 0;
|
|
@@ -80,9 +75,6 @@ function measureText(canvas, text, font) {
|
|
|
80
75
|
}
|
|
81
76
|
return Math.round(ctx.measureText(text || '').width);
|
|
82
77
|
}
|
|
83
|
-
|
|
84
|
-
// Ignored via go/ees005
|
|
85
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
86
78
|
function handlePreText(canvas, node, textContent, font) {
|
|
87
79
|
var parent = node;
|
|
88
80
|
if (node.nodeName === 'CODE') {
|
|
@@ -4,10 +4,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
import { getFreeSpace } from './column-state';
|
|
6
6
|
import { bulkColumnsResize, getTotalWidth } from './resize-state';
|
|
7
|
-
export var growColumn = function growColumn(state, colIndex, amount, selectedColumns
|
|
8
|
-
// Ignored via go/ees005
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
10
|
-
) {
|
|
7
|
+
export var growColumn = function growColumn(state, colIndex, amount, selectedColumns) {
|
|
11
8
|
// can't grow if columns don't exist or it's the last column
|
|
12
9
|
if (!state.cols[colIndex] || !state.cols[colIndex + 1]) {
|
|
13
10
|
return state;
|
|
@@ -23,10 +20,7 @@ export var growColumn = function growColumn(state, colIndex, amount, selectedCol
|
|
|
23
20
|
}
|
|
24
21
|
return newState;
|
|
25
22
|
};
|
|
26
|
-
export var shrinkColumn = function shrinkColumn(state, colIndex, amount, selectedColumns
|
|
27
|
-
// Ignored via go/ees005
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
29
|
-
) {
|
|
23
|
+
export var shrinkColumn = function shrinkColumn(state, colIndex, amount, selectedColumns) {
|
|
30
24
|
// can't shrink if columns don't exist
|
|
31
25
|
if (!state.cols[colIndex]) {
|
|
32
26
|
return state;
|
|
@@ -99,8 +93,6 @@ var ColType = /*#__PURE__*/function (ColType) {
|
|
|
99
93
|
return ColType;
|
|
100
94
|
}(ColType || {}); // TODO: should handle when destIdx:
|
|
101
95
|
// - is beyond the range, and then not give it back
|
|
102
|
-
// Ignored via go/ees005
|
|
103
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
104
96
|
function moveSpaceFrom(state, srcIdx, destIdx, amount) {
|
|
105
97
|
var useFreeSpace = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
106
98
|
var srcCol = state.cols[srcIdx];
|
|
@@ -93,10 +93,7 @@ export var getResizeState = function getResizeState(_ref) {
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
// updates Colgroup DOM node with new widths
|
|
96
|
-
export var updateColgroup = function updateColgroup(state, tableRef, tableNode, isTableScalingEnabled, scalePercent
|
|
97
|
-
// Ignored via go/ees005
|
|
98
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
99
|
-
) {
|
|
96
|
+
export var updateColgroup = function updateColgroup(state, tableRef, tableNode, isTableScalingEnabled, scalePercent) {
|
|
100
97
|
var cols = tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll('col');
|
|
101
98
|
var columnsCount = cols === null || cols === void 0 ? void 0 : cols.length;
|
|
102
99
|
/**
|
|
@@ -17,10 +17,7 @@ import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorWideL
|
|
|
17
17
|
import { TABLE_MAX_WIDTH } from './table-resizing/utils/consts';
|
|
18
18
|
import { ALIGN_START } from './utils/alignment';
|
|
19
19
|
export var pluginKey = new PluginKey('tableWidthPlugin');
|
|
20
|
-
var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullWidthEnabled, isTableScalingEnabled, isTableAlignmentEnabled, isCommentEditor
|
|
21
|
-
// Ignored via go/ees005
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
23
|
-
) {
|
|
20
|
+
var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullWidthEnabled, isTableScalingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
24
21
|
return new SafePlugin({
|
|
25
22
|
key: pluginKey,
|
|
26
23
|
state: {
|
|
@@ -117,8 +114,6 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullW
|
|
|
117
114
|
}
|
|
118
115
|
if (referentialityTr) {
|
|
119
116
|
referentialityTr.steps.forEach(function (step) {
|
|
120
|
-
// Ignored via go/ees005
|
|
121
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
122
117
|
step.getMap().forEach(function (_, __, newStart, newEnd) {
|
|
123
118
|
newState.doc.nodesBetween(newStart, newEnd, function (node, pos) {
|
|
124
119
|
if (node.type === table) {
|
|
@@ -16,10 +16,7 @@ import { scaleTableTo } from '../table-resizing/utils/scale-table';
|
|
|
16
16
|
* @param start
|
|
17
17
|
* @returns
|
|
18
18
|
*/
|
|
19
|
-
export var updateColumnWidths = function updateColumnWidths(resizeState, table, start, api
|
|
20
|
-
// Ignored via go/ees005
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
22
|
-
) {
|
|
19
|
+
export var updateColumnWidths = function updateColumnWidths(resizeState, table, start, api) {
|
|
23
20
|
return function (tr) {
|
|
24
21
|
var map = TableMap.get(table);
|
|
25
22
|
var updatedCellsAttrs = {};
|
|
@@ -38,10 +38,7 @@ var validateTableCellNodeAttrs = function validateTableCellNodeAttrs(_ref, repor
|
|
|
38
38
|
//
|
|
39
39
|
// This row only spans two columns, yet it contains widths for 3.
|
|
40
40
|
// We remove the third width here, assumed duplicate content.
|
|
41
|
-
export var removeExtraneousColumnWidths = function removeExtraneousColumnWidths(node, basePos, tr, reportInvalidTableCellSpanAttrs
|
|
42
|
-
// Ignored via go/ees005
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
44
|
-
) {
|
|
41
|
+
export var removeExtraneousColumnWidths = function removeExtraneousColumnWidths(node, basePos, tr, reportInvalidTableCellSpanAttrs) {
|
|
45
42
|
var hasProblems = false;
|
|
46
43
|
tr = replaceCells(tr, node, basePos, function (cell) {
|
|
47
44
|
var _cell$attrs = cell.attrs,
|
|
@@ -92,10 +89,7 @@ export var fixTables = function 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 var fixAutoSizedTable = function fixAutoSizedTable(view, tableNode, tableRef, tablePos, opts
|
|
96
|
-
// Ignored via go/ees005
|
|
97
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
98
|
-
) {
|
|
92
|
+
export var fixAutoSizedTable = function fixAutoSizedTable(view, tableNode, tableRef, tablePos, opts) {
|
|
99
93
|
var tr = view.state.tr;
|
|
100
94
|
var domAtPos = view.domAtPos.bind(view);
|
|
101
95
|
var tableStart = tablePos + 1;
|
|
@@ -138,9 +132,6 @@ var getLayoutBasedOnWidth = function 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
|
var 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
|
-
var replaceCells = function replaceCells(tr, table, tablePos, modifyCell
|
|
169
|
-
// Ignored via go/ees005
|
|
170
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
171
|
-
) {
|
|
159
|
+
var replaceCells = function replaceCells(tr, table, tablePos, modifyCell) {
|
|
172
160
|
var rows = [];
|
|
173
161
|
var modifiedCells = 0;
|
|
174
162
|
for (var 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 var replaceSelectedTable = function replaceSelectedTable(state, content, inputMethod, editorAnalyticsAPI
|
|
7
|
-
// Ignored via go/ees005
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
9
|
-
) {
|
|
6
|
+
export var replaceSelectedTable = function replaceSelectedTable(state, content, inputMethod, editorAnalyticsAPI) {
|
|
10
7
|
if (isTableSelected(state.selection)) {
|
|
11
8
|
var table = findTable(state.selection);
|
|
12
9
|
if (table) {
|
|
@@ -10,8 +10,6 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
10
10
|
* @param columnStart - Start of the rect included (rect.left)
|
|
11
11
|
* @param columnEnd - End of the rect not included (rect.right)
|
|
12
12
|
*/
|
|
13
|
-
// Ignored via go/ees005
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
15
13
|
export function splitCellsInColumns(tr, tablePos, columnStart, columnEnd) {
|
|
16
14
|
var mapStart = tr.mapping.maps.length;
|
|
17
15
|
var table = tr.doc.nodeAt(tablePos);
|
|
@@ -13,9 +13,6 @@ export var normaliseAlignment = function normaliseAlignment(layout) {
|
|
|
13
13
|
/**
|
|
14
14
|
* We don't want to switch alignment in Full-width editor
|
|
15
15
|
*/
|
|
16
|
-
export var shouldChangeAlignmentToCenterResized = function shouldChangeAlignmentToCenterResized(isTableAlignmentEnabled, tableNode, lineLength, updatedTableWidth
|
|
17
|
-
// Ignored via go/ees005
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
19
|
-
) {
|
|
16
|
+
export var shouldChangeAlignmentToCenterResized = function shouldChangeAlignmentToCenterResized(isTableAlignmentEnabled, tableNode, lineLength, updatedTableWidth) {
|
|
20
17
|
return Boolean(isTableAlignmentEnabled && tableNode && tableNode.attrs.layout === ALIGN_START && lineLength && updatedTableWidth > lineLength && lineLength < FULL_WIDTH_EDITOR_CONTENT_WIDTH);
|
|
21
18
|
};
|
|
@@ -33,10 +33,7 @@ export var createCellHoverDecoration = function createCellHoverDecoration(cells)
|
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
|
-
export var createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, tr, isDragAndDropEnable, hoveredIndexes, danger, selected
|
|
37
|
-
// Ignored via go/ees005
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
39
|
-
) {
|
|
36
|
+
export var createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, tr, isDragAndDropEnable, hoveredIndexes, danger, selected) {
|
|
40
37
|
var table = findTable(tr.selection);
|
|
41
38
|
if (!table) {
|
|
42
39
|
return [];
|
|
@@ -165,10 +162,7 @@ export var createColumnControlsDecoration = function createColumnControlsDecorat
|
|
|
165
162
|
});
|
|
166
163
|
});
|
|
167
164
|
};
|
|
168
|
-
export var updateDecorations = function updateDecorations(node, decorationSet, decorations, key
|
|
169
|
-
// Ignored via go/ees005
|
|
170
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
171
|
-
) {
|
|
165
|
+
export var updateDecorations = function updateDecorations(node, decorationSet, decorations, key) {
|
|
172
166
|
var filteredDecorations = filterDecorationByKey(key, decorationSet);
|
|
173
167
|
var decorationSetFiltered = decorationSet.remove(filteredDecorations);
|
|
174
168
|
return decorationSetFiltered.add(node, decorations);
|
|
@@ -259,10 +253,7 @@ var makeArray = function makeArray(n) {
|
|
|
259
253
|
export var createResizeHandleDecoration = function createResizeHandleDecoration(tr, rowIndexTarget, columnEndIndexTarget) {
|
|
260
254
|
var includeTooltip = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
261
255
|
var getIntl = arguments.length > 4 ? arguments[4] : undefined;
|
|
262
|
-
var nodeViewPortalProviderAPI
|
|
263
|
-
// Ignored via go/ees005
|
|
264
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
265
|
-
= arguments.length > 5 ? arguments[5] : undefined;
|
|
256
|
+
var nodeViewPortalProviderAPI = arguments.length > 5 ? arguments[5] : undefined;
|
|
266
257
|
var emptyResult = [[], []];
|
|
267
258
|
var table = findTable(tr.selection);
|
|
268
259
|
if (!table || !table.node) {
|
|
@@ -272,10 +263,7 @@ export var createResizeHandleDecoration = function createResizeHandleDecoration(
|
|
|
272
263
|
if (!map.width) {
|
|
273
264
|
return emptyResult;
|
|
274
265
|
}
|
|
275
|
-
var createResizerHandleDecoration = function createResizerHandleDecoration(cellColumnPositioning, columnIndex, rowIndex, cellPos, cellNode
|
|
276
|
-
// Ignored via go/ees005
|
|
277
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
278
|
-
) {
|
|
266
|
+
var createResizerHandleDecoration = function createResizerHandleDecoration(cellColumnPositioning, columnIndex, rowIndex, cellPos, cellNode) {
|
|
279
267
|
var decorationRenderKey = uuid();
|
|
280
268
|
var position = cellPos + cellNode.nodeSize - 1;
|
|
281
269
|
return Decoration.widget(position, function () {
|
|
@@ -39,10 +39,7 @@ import { getSelectedColumnIndexes, getSelectedRowIndexes } from './selection';
|
|
|
39
39
|
export var getTargetIndex = function getTargetIndex(selectedIndexes, direction) {
|
|
40
40
|
return Math[direction < 0 ? 'min' : 'max'].apply(Math, _toConsumableArray(selectedIndexes)) + direction;
|
|
41
41
|
};
|
|
42
|
-
export var canMove = function canMove(sourceType, direction, totalItemsOfSourceTypeCount, selection, selectionRect
|
|
43
|
-
// Ignored via go/ees005
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
45
|
-
) {
|
|
42
|
+
export var canMove = function canMove(sourceType, direction, totalItemsOfSourceTypeCount, selection, selectionRect) {
|
|
46
43
|
if (!selectionRect) {
|
|
47
44
|
return false;
|
|
48
45
|
}
|
|
@@ -73,9 +73,6 @@ export var tablesHaveDifferentNoOfRows = function tablesHaveDifferentNoOfRows(cu
|
|
|
73
73
|
var currentMap = TableMap.get(currentTable);
|
|
74
74
|
return prevMap.height !== currentMap.height;
|
|
75
75
|
};
|
|
76
|
-
|
|
77
|
-
// Ignored via go/ees005
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
79
76
|
function filterNearSelection(selection, findNode, predicate, defaultValue) {
|
|
80
77
|
var found = findNode(selection);
|
|
81
78
|
if (!found) {
|
|
@@ -6,6 +6,7 @@ import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
|
6
6
|
import { flatmap, mapChildren, mapSlice } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { Slice, Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
8
8
|
import { flatten, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
11
|
import { getPluginState } from '../plugin-factory';
|
|
11
12
|
|
|
@@ -22,6 +23,9 @@ export var unwrapContentFromTable = function unwrapContentFromTable(maybeTable)
|
|
|
22
23
|
content.push.apply(content, _toConsumableArray(flatten(maybeCell, false).map(function (child) {
|
|
23
24
|
return child.node;
|
|
24
25
|
})));
|
|
26
|
+
if (fg('platform_editor_nested_tables_paste_dupe_fix')) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
25
29
|
}
|
|
26
30
|
return true;
|
|
27
31
|
});
|
|
@@ -81,10 +81,7 @@ export var getRowsParams = function getRowsParams(rowsHeights) {
|
|
|
81
81
|
export var getRowClassNames = function getRowClassNames(index, selection) {
|
|
82
82
|
var hoveredRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
83
83
|
var isInDanger = arguments.length > 3 ? arguments[3] : undefined;
|
|
84
|
-
var isResizing
|
|
85
|
-
// Ignored via go/ees005
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
87
|
-
= arguments.length > 4 ? arguments[4] : undefined;
|
|
84
|
+
var isResizing = arguments.length > 4 ? arguments[4] : undefined;
|
|
88
85
|
var classNames = [];
|
|
89
86
|
if (isRowSelected(index)(selection) || hoveredRows.indexOf(index) > -1 && !isResizing) {
|
|
90
87
|
classNames.push(ClassName.HOVERED_CELL_ACTIVE);
|
package/dist/esm/tablePlugin.js
CHANGED
|
@@ -102,6 +102,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
102
102
|
isTableResizing: tableWidthResizingPluginState === null || tableWidthResizingPluginState === void 0 ? void 0 : tableWidthResizingPluginState.resizing,
|
|
103
103
|
isInDanger: tablePluginState.isInDanger,
|
|
104
104
|
hoveredRows: tablePluginState.hoveredRows,
|
|
105
|
+
hoveredColumns: tablePluginState.hoveredColumns,
|
|
105
106
|
hoveredCell: tablePluginState.hoveredCell,
|
|
106
107
|
isTableHovered: tablePluginState.isTableHovered,
|
|
107
108
|
isWholeTableInDanger: tablePluginState.isWholeTableInDanger,
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
/* eslint-disable @atlaskit/design-system/no-html-button */
|
|
4
|
+
|
|
3
5
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
6
|
import classnames from 'classnames';
|
|
5
7
|
import ReactDOM from 'react-dom';
|
|
6
8
|
import { injectIntl } from 'react-intl-next';
|
|
7
9
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
10
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
8
11
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
9
12
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
13
|
import { findTable, TableMap } from '@atlaskit/editor-tables';
|
|
@@ -35,7 +38,9 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
35
38
|
hoveredCell = _ref.hoveredCell,
|
|
36
39
|
onClick = _ref.onClick,
|
|
37
40
|
editorView = _ref.editorView,
|
|
38
|
-
formatMessage = _ref.intl.formatMessage
|
|
41
|
+
formatMessage = _ref.intl.formatMessage,
|
|
42
|
+
hoveredColumns = _ref.hoveredColumns,
|
|
43
|
+
hoveredRows = _ref.hoveredRows;
|
|
39
44
|
var dragHandleDivRef = useRef(null);
|
|
40
45
|
var _useState = useState(null),
|
|
41
46
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -43,9 +48,13 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
43
48
|
setPreviewContainer = _useState2[1];
|
|
44
49
|
var state = editorView.state,
|
|
45
50
|
selection = editorView.state.selection;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
if (hoveredColumns === undefined || hoveredRows === undefined) {
|
|
52
|
+
var _getPluginState = getPluginState(state),
|
|
53
|
+
hoveredColumnsState = _getPluginState.hoveredColumns,
|
|
54
|
+
hoveredRowsState = _getPluginState.hoveredRows;
|
|
55
|
+
hoveredColumns = hoveredColumnsState;
|
|
56
|
+
hoveredRows = hoveredRowsState;
|
|
57
|
+
}
|
|
49
58
|
var _getDnDPluginState = getDnDPluginState(state),
|
|
50
59
|
_getDnDPluginState$is = _getDnDPluginState.isDragMenuOpen,
|
|
51
60
|
isDragMenuOpen = _getDnDPluginState$is === void 0 ? false : _getDnDPluginState$is;
|
|
@@ -234,4 +243,44 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
234
243
|
height: previewHeight
|
|
235
244
|
}), previewContainer));
|
|
236
245
|
};
|
|
237
|
-
|
|
246
|
+
var DragHandleComponentWithSharedState = function DragHandleComponentWithSharedState(_ref5) {
|
|
247
|
+
var isDragMenuTarget = _ref5.isDragMenuTarget,
|
|
248
|
+
tableLocalId = _ref5.tableLocalId,
|
|
249
|
+
direction = _ref5.direction,
|
|
250
|
+
appearance = _ref5.appearance,
|
|
251
|
+
indexes = _ref5.indexes,
|
|
252
|
+
forceDefaultHandle = _ref5.forceDefaultHandle,
|
|
253
|
+
previewHeight = _ref5.previewHeight,
|
|
254
|
+
previewWidth = _ref5.previewWidth,
|
|
255
|
+
onMouseOver = _ref5.onMouseOver,
|
|
256
|
+
onMouseOut = _ref5.onMouseOut,
|
|
257
|
+
toggleDragMenu = _ref5.toggleDragMenu,
|
|
258
|
+
hoveredCell = _ref5.hoveredCell,
|
|
259
|
+
onClick = _ref5.onClick,
|
|
260
|
+
editorView = _ref5.editorView,
|
|
261
|
+
intl = _ref5.intl,
|
|
262
|
+
api = _ref5.api;
|
|
263
|
+
var _ref6 = useSharedPluginState(api, ['table']),
|
|
264
|
+
tableState = _ref6.tableState;
|
|
265
|
+
return /*#__PURE__*/React.createElement(DragHandleComponent, {
|
|
266
|
+
isDragMenuTarget: isDragMenuTarget,
|
|
267
|
+
tableLocalId: tableLocalId,
|
|
268
|
+
direction: direction,
|
|
269
|
+
appearance: appearance,
|
|
270
|
+
indexes: indexes,
|
|
271
|
+
forceDefaultHandle: forceDefaultHandle,
|
|
272
|
+
previewWidth: previewWidth,
|
|
273
|
+
previewHeight: previewHeight,
|
|
274
|
+
onMouseOver: onMouseOver,
|
|
275
|
+
onMouseOut: onMouseOut,
|
|
276
|
+
toggleDragMenu: toggleDragMenu,
|
|
277
|
+
hoveredCell: hoveredCell,
|
|
278
|
+
onClick: onClick,
|
|
279
|
+
editorView: editorView,
|
|
280
|
+
intl: intl,
|
|
281
|
+
hoveredColumns: tableState === null || tableState === void 0 ? void 0 : tableState.hoveredColumns,
|
|
282
|
+
hoveredRows: tableState === null || tableState === void 0 ? void 0 : tableState.hoveredRows
|
|
283
|
+
});
|
|
284
|
+
};
|
|
285
|
+
export var DragHandle = injectIntl(DragHandleComponent);
|
|
286
|
+
export var DragHandleWithSharedState = injectIntl(DragHandleComponentWithSharedState);
|
|
@@ -32,9 +32,6 @@ function getRowOptions(index, isDragAndDropEnabled) {
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
// Ignored via go/ees005
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
38
35
|
function getColumnOptions(index, tableContainer, hasNumberedColumns, isDragAndDropEnabled) {
|
|
39
36
|
var options = {
|
|
40
37
|
alignX: 'end',
|
|
@@ -75,9 +72,6 @@ function getColumnOptions(index, tableContainer, hasNumberedColumns, isDragAndDr
|
|
|
75
72
|
}
|
|
76
73
|
return options;
|
|
77
74
|
}
|
|
78
|
-
|
|
79
|
-
// Ignored via go/ees005
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
81
75
|
function getPopupOptions(direction, index, hasNumberedColumns, isDragAndDropEnabled, tableContainer) {
|
|
82
76
|
switch (direction) {
|
|
83
77
|
case 'column':
|
|
@@ -12,7 +12,7 @@ import { toggleDragMenu } from '../../../pm-plugins/drag-and-drop/commands';
|
|
|
12
12
|
import { getRowsParams } from '../../../pm-plugins/utils/row-controls';
|
|
13
13
|
import { getSelectedColumnIndexes } from '../../../pm-plugins/utils/selection';
|
|
14
14
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
15
|
-
import { DragHandle } from '../../DragHandle';
|
|
15
|
+
import { DragHandle, DragHandleWithSharedState } from '../../DragHandle';
|
|
16
16
|
var getSelectedColumns = function getSelectedColumns(selection) {
|
|
17
17
|
if (selection instanceof CellSelection && selection.isColSelection()) {
|
|
18
18
|
var rect = getSelectionRect(selection);
|
|
@@ -34,7 +34,6 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
34
34
|
isInDanger = _ref.isInDanger,
|
|
35
35
|
rowHeights = _ref.rowHeights,
|
|
36
36
|
colWidths = _ref.colWidths,
|
|
37
|
-
hasHeaderColumn = _ref.hasHeaderColumn,
|
|
38
37
|
isTableHovered = _ref.isTableHovered,
|
|
39
38
|
tableContainerWidth = _ref.tableContainerWidth,
|
|
40
39
|
isNumberColumnEnabled = _ref.isNumberColumnEnabled,
|
|
@@ -129,10 +128,7 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
129
128
|
var _getScrollOffset;
|
|
130
129
|
columnControlsRef.current.scrollLeft = (_getScrollOffset = getScrollOffset === null || getScrollOffset === void 0 ? void 0 : getScrollOffset()) !== null && _getScrollOffset !== void 0 ? _getScrollOffset : 0;
|
|
131
130
|
}
|
|
132
|
-
var generateHandleByType = function generateHandleByType(type, appearance, gridColumn, indexes
|
|
133
|
-
// Ignored via go/ees005
|
|
134
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
135
|
-
) {
|
|
131
|
+
var generateHandleByType = function generateHandleByType(type, appearance, gridColumn, indexes) {
|
|
136
132
|
var _rowHeights$reduce, _colWidths$reduce;
|
|
137
133
|
var isHover = type === 'hover';
|
|
138
134
|
var isPlaceholder = appearance === 'placeholder';
|
|
@@ -167,7 +163,23 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
167
163
|
position: 'relative'
|
|
168
164
|
},
|
|
169
165
|
"data-testid": "table-floating-column-".concat(isHover ? colIndex : isPlaceholder ? appearance : selectedColIndexes[0], "-drag-handle")
|
|
170
|
-
}, /*#__PURE__*/React.createElement(
|
|
166
|
+
}, fg('platform_editor_table_use_shared_state_hook_fg') ? /*#__PURE__*/React.createElement(DragHandleWithSharedState, {
|
|
167
|
+
isDragMenuTarget: !isHover,
|
|
168
|
+
direction: "column",
|
|
169
|
+
tableLocalId: localId || '',
|
|
170
|
+
indexes: indexes,
|
|
171
|
+
hoveredCell: hoveredCell,
|
|
172
|
+
previewWidth: previewWidth,
|
|
173
|
+
forceDefaultHandle: !isHover,
|
|
174
|
+
previewHeight: previewHeight,
|
|
175
|
+
appearance: appearance,
|
|
176
|
+
onClick: handleClick,
|
|
177
|
+
onMouseOver: handleMouseOver,
|
|
178
|
+
onMouseOut: handleMouseOut,
|
|
179
|
+
toggleDragMenu: toggleDragMenuHandler,
|
|
180
|
+
editorView: editorView,
|
|
181
|
+
api: api
|
|
182
|
+
}) : /*#__PURE__*/React.createElement(DragHandle, {
|
|
171
183
|
isDragMenuTarget: !isHover,
|
|
172
184
|
direction: "column",
|
|
173
185
|
tableLocalId: localId || '',
|
|
@@ -2,7 +2,6 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
5
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
5
|
import { getColumnsWidths } from '../../pm-plugins/utils/column-controls';
|
|
7
6
|
import { containsHeaderColumn } from '../../pm-plugins/utils/nodes';
|
|
8
7
|
import { getRowHeights } from '../../pm-plugins/utils/row-controls';
|
|
@@ -99,7 +98,7 @@ var TableFloatingColumnControls = function TableFloatingColumnControls(_ref) {
|
|
|
99
98
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
100
99
|
isDragging: isDragging,
|
|
101
100
|
getScrollOffset: getScrollOffset,
|
|
102
|
-
api:
|
|
101
|
+
api: fg('platform_editor_table_use_shared_state_hook_fg') ? api : undefined
|
|
103
102
|
}), isDragging && /*#__PURE__*/React.createElement(ColumnDropTargets, {
|
|
104
103
|
tableRef: tableRef,
|
|
105
104
|
isHeaderSticky: (stickyHeader === null || stickyHeader === void 0 ? void 0 : stickyHeader.sticky) && hasHeaderRow,
|