@atlaskit/editor-plugin-table 5.7.2 → 5.7.3
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 +9 -0
- package/dist/cjs/nodeviews/TableComponent.js +4 -1
- package/dist/cjs/plugin.js +2 -1
- package/dist/cjs/pm-plugins/main.js +5 -16
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +0 -4
- package/dist/cjs/types.js +0 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +5 -2
- package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +3 -3
- package/dist/cjs/ui/FloatingInsertButton/index.js +1 -1
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +39 -8
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +17 -8
- package/dist/cjs/ui/common-styles.js +1 -1
- package/dist/cjs/utils/decoration.js +48 -34
- package/dist/cjs/utils/dom.js +1 -19
- package/dist/cjs/utils/index.js +0 -6
- package/dist/es2019/nodeviews/TableComponent.js +5 -2
- package/dist/es2019/plugin.js +2 -1
- package/dist/es2019/pm-plugins/main.js +1 -12
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +1 -5
- package/dist/es2019/types.js +0 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +6 -3
- package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +3 -3
- package/dist/es2019/ui/FloatingInsertButton/index.js +2 -2
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +34 -4
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +18 -9
- package/dist/es2019/ui/common-styles.js +6 -1
- package/dist/es2019/utils/decoration.js +47 -33
- package/dist/es2019/utils/dom.js +0 -18
- package/dist/es2019/utils/index.js +1 -1
- package/dist/esm/nodeviews/TableComponent.js +5 -2
- package/dist/esm/plugin.js +2 -1
- package/dist/esm/pm-plugins/main.js +1 -12
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +1 -5
- package/dist/esm/types.js +0 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +6 -3
- package/dist/esm/ui/FloatingInsertButton/InsertButton.js +3 -3
- package/dist/esm/ui/FloatingInsertButton/index.js +2 -2
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +35 -4
- package/dist/esm/ui/TableFloatingColumnControls/index.js +18 -9
- package/dist/esm/ui/common-styles.js +2 -2
- package/dist/esm/utils/decoration.js +48 -34
- package/dist/esm/utils/dom.js +0 -18
- package/dist/esm/utils/index.js +1 -1
- package/dist/types/types.d.ts +0 -1
- package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -1
- package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +3 -1
- package/dist/types/ui/TableFloatingColumnControls/index.d.ts +2 -0
- package/dist/types/utils/dom.d.ts +0 -1
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +0 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -1
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +3 -1
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +2 -0
- package/dist/types-ts4.5/utils/dom.d.ts +0 -1
- package/dist/types-ts4.5/utils/index.d.ts +1 -1
- package/package.json +6 -6
- package/src/nodeviews/TableComponent.tsx +7 -2
- package/src/plugin.tsx +1 -0
- package/src/pm-plugins/main.ts +0 -18
- package/src/pm-plugins/table-resizing/event-handlers.ts +1 -8
- package/src/types.ts +0 -2
- package/src/ui/FloatingDragMenu/index.tsx +14 -2
- package/src/ui/FloatingInsertButton/InsertButton.tsx +6 -2
- package/src/ui/FloatingInsertButton/index.tsx +4 -2
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +48 -3
- package/src/ui/TableFloatingColumnControls/index.tsx +23 -11
- package/src/ui/common-styles.ts +6 -0
- package/src/utils/decoration.ts +41 -28
- package/src/utils/dom.ts +0 -23
- package/src/utils/index.ts +0 -1
package/dist/cjs/utils/dom.js
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.isTableControlsButton = exports.isTableContainerOrWrapper = exports.isRowControlsButton = exports.isResizeHandleDecoration = exports.isInsertRowButton = exports.isDragRowFloatingInsertDot = exports.isDragRowControlsButton = exports.isDragCornerButton = exports.isDragColumnFloatingInsertDot = exports.isCornerButton = exports.isColumnControlsDecorations = exports.isCell = exports.hasResizeHandler = exports.getTree = exports.getTop = exports.getMousePositionVerticalRelativeByElement = exports.getMousePositionHorizontalRelativeByElement = exports.getColumnOrRowIndex = exports.findNearestCellIndexToPoint = void 0;
|
|
7
7
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
8
8
|
var _types = require("../types");
|
|
9
|
-
var _consts = require("../ui/consts");
|
|
10
9
|
var SELECTOR_TABLE_LEAFS = ".".concat(_types.TableCssClassName.TABLE_CELL, ", .").concat(_types.TableCssClassName.TABLE_HEADER_CELL);
|
|
11
10
|
var isCell = exports.isCell = function isCell(node) {
|
|
12
11
|
return Boolean(node && (['TH', 'TD'].indexOf(node.tagName) > -1 || !!(0, _utils.closestElement)(node, ".".concat(_types.TableCssClassName.TABLE_HEADER_CELL)) || !!(0, _utils.closestElement)(node, ".".concat(_types.TableCssClassName.TABLE_CELL))));
|
|
@@ -146,23 +145,6 @@ var getMousePositionVerticalRelativeByElement = exports.getMousePositionVertical
|
|
|
146
145
|
}
|
|
147
146
|
return null;
|
|
148
147
|
};
|
|
149
|
-
|
|
150
|
-
// This function is deprecated
|
|
151
|
-
var updateResizeHandles = exports.updateResizeHandles = function updateResizeHandles(tableRef) {
|
|
152
|
-
if (!tableRef) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// see ED-7600
|
|
157
|
-
var nodes = Array.from(tableRef.querySelectorAll(".".concat(_types.TableCssClassName.RESIZE_HANDLE)));
|
|
158
|
-
if (!nodes || !nodes.length) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
var height = tableRef.offsetHeight + _consts.tableToolbarSize;
|
|
162
|
-
nodes.forEach(function (node) {
|
|
163
|
-
node.style.height = "".concat(height, "px");
|
|
164
|
-
});
|
|
165
|
-
};
|
|
166
148
|
var hasResizeHandler = exports.hasResizeHandler = function hasResizeHandler(_ref) {
|
|
167
149
|
var columnEndIndexTarget = _ref.columnEndIndexTarget,
|
|
168
150
|
target = _ref.target;
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -417,12 +417,6 @@ Object.defineProperty(exports, "updatePluginStateDecorations", {
|
|
|
417
417
|
return _updatePluginStateDecorations.updatePluginStateDecorations;
|
|
418
418
|
}
|
|
419
419
|
});
|
|
420
|
-
Object.defineProperty(exports, "updateResizeHandles", {
|
|
421
|
-
enumerable: true,
|
|
422
|
-
get: function get() {
|
|
423
|
-
return _dom.updateResizeHandles;
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
420
|
var _selection = require("./selection");
|
|
427
421
|
var _decoration = require("./decoration");
|
|
428
422
|
var _nodes = require("./nodes");
|
|
@@ -4,7 +4,7 @@ import classnames from 'classnames';
|
|
|
4
4
|
import memoizeOne from 'memoize-one';
|
|
5
5
|
import rafSchedule from 'raf-schd';
|
|
6
6
|
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
7
|
-
import { getParentNodeWidth } from '@atlaskit/editor-common/node-width';
|
|
7
|
+
import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
8
8
|
import { tableMarginSides } from '@atlaskit/editor-common/styles';
|
|
9
9
|
import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { MAX_BROWSER_SCROLLBAR_HEIGHT, akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
|
|
@@ -566,6 +566,7 @@ class TableComponent extends React.Component {
|
|
|
566
566
|
headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
|
|
567
567
|
stickyHeader: this.state.stickyHeader
|
|
568
568
|
});
|
|
569
|
+
const tableContainerWidth = getTableContainerWidth(node);
|
|
569
570
|
const colControls = isDragAndDropEnabled ? /*#__PURE__*/React.createElement(TableFloatingColumnControls, {
|
|
570
571
|
editorView: view,
|
|
571
572
|
tableRef: tableRef,
|
|
@@ -584,7 +585,9 @@ class TableComponent extends React.Component {
|
|
|
584
585
|
headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
|
|
585
586
|
stickyHeader: this.state.stickyHeader,
|
|
586
587
|
canDrag: canDrag,
|
|
587
|
-
getEditorFeatureFlags: getEditorFeatureFlags
|
|
588
|
+
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
589
|
+
tableContainerWidth: tableContainerWidth,
|
|
590
|
+
isNumberColumnEnabled: node.attrs.isNumberColumnEnabled
|
|
588
591
|
}) : null;
|
|
589
592
|
const shadowPadding = allowControls && tableActive ? -tableToolbarSize : tableMarginSides;
|
|
590
593
|
const shadowStyle = memoizeOne(visible => ({
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -353,7 +353,8 @@ const tablesPlugin = ({
|
|
|
353
353
|
isOpen: !!(dragAndDropState !== null && dragAndDropState !== void 0 && dragAndDropState.isDragMenuOpen) && !isResizing,
|
|
354
354
|
canDrag: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.canDrag,
|
|
355
355
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
356
|
-
editorAnalyticsAPI: editorAnalyticsAPI
|
|
356
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
357
|
+
stickyHeaders: stickyHeader
|
|
357
358
|
}), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
358
359
|
editorView: editorView,
|
|
359
360
|
selection: editorView.state.selection,
|
|
@@ -4,8 +4,6 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
4
4
|
import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes } from '@atlaskit/editor-common/transforms';
|
|
5
5
|
import { browser, closestElement } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
|
-
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
8
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
7
|
import { addBoldInEmptyHeaderCells, clearHoverSelection, setTableRef } from '../commands';
|
|
10
8
|
import { removeResizeHandleDecorations, transformSliceRemoveCellBackgroundColor, transformSliceToAddTableHeaders, transformSliceToRemoveColumnsWidths } from '../commands/misc';
|
|
11
9
|
import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseEnter, handleMouseLeave, handleMouseMove, handleMouseOut, handleMouseOver, handleTripleClick, whenTableInFocus, withCellTracking } from '../event-handlers';
|
|
@@ -15,7 +13,7 @@ import TableRow from '../nodeviews/TableRow';
|
|
|
15
13
|
import { pluginKey as decorationsPluginKey } from '../pm-plugins/decorations/plugin';
|
|
16
14
|
import { fixTables, replaceSelectedTable } from '../transforms';
|
|
17
15
|
import { TableCssClassName as ClassName } from '../types';
|
|
18
|
-
import { findControlsHoverDecoration, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, transformSliceToRemoveOpenTable
|
|
16
|
+
import { findControlsHoverDecoration, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, transformSliceToRemoveOpenTable } from '../utils';
|
|
19
17
|
import { isHeaderRowRequired } from '../utils/paste';
|
|
20
18
|
import { defaultHoveredCell, defaultTableSelection } from './default-table-selection';
|
|
21
19
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
@@ -103,24 +101,15 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
103
101
|
} = state;
|
|
104
102
|
const pluginState = getPluginState(state);
|
|
105
103
|
let tableRef;
|
|
106
|
-
let tableNode;
|
|
107
104
|
if (pluginState.editorHasFocus) {
|
|
108
105
|
const parent = findParentDomRefOfType(state.schema.nodes.table, domAtPos)(selection);
|
|
109
106
|
if (parent) {
|
|
110
107
|
tableRef = parent.querySelector('table') || undefined;
|
|
111
108
|
}
|
|
112
|
-
tableNode = findTable(state.selection);
|
|
113
109
|
}
|
|
114
110
|
if (pluginState.tableRef !== tableRef) {
|
|
115
111
|
setTableRef(tableRef)(state, dispatch);
|
|
116
112
|
}
|
|
117
|
-
|
|
118
|
-
// Removes updateResizeHandles
|
|
119
|
-
if (getBooleanFF('platform.editor.table-remove-update-resize-handles_djvab')) {} else {
|
|
120
|
-
if (pluginState.tableNode !== tableNode) {
|
|
121
|
-
updateResizeHandles(tableRef);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
113
|
if (pluginState.editorHasFocus && pluginState.tableRef) {
|
|
125
114
|
const {
|
|
126
115
|
$cursor
|
|
@@ -7,7 +7,7 @@ import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
|
7
7
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { updateResizeHandleDecorations } from '../../commands/misc';
|
|
9
9
|
import { updateColumnWidths } from '../../transforms';
|
|
10
|
-
import { getSelectedColumnIndexes
|
|
10
|
+
import { getSelectedColumnIndexes } from '../../utils';
|
|
11
11
|
import { META_KEYS } from '../table-analytics';
|
|
12
12
|
import { evenColumns, setDragging, stopResizing } from './commands';
|
|
13
13
|
import { getPluginState } from './plugin-factory';
|
|
@@ -161,10 +161,6 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
|
|
|
161
161
|
const colIndex = map.colCount($cell.pos - $cell.start(-1)) + $cell.nodeAfter.attrs.colspan - 1;
|
|
162
162
|
resizeColumn(resizeState, colIndex, clientX - dragging.startX, dom);
|
|
163
163
|
updateControls()(state);
|
|
164
|
-
// Remove updateResizeHandles
|
|
165
|
-
if (getBooleanFF('platform.editor.table-remove-update-resize-handles_djvab')) {} else {
|
|
166
|
-
updateResizeHandles(dom);
|
|
167
|
-
}
|
|
168
164
|
}
|
|
169
165
|
window.addEventListener('mouseup', finish);
|
|
170
166
|
window.addEventListener('mousemove', move);
|
package/dist/es2019/types.js
CHANGED
|
@@ -114,8 +114,6 @@ export const TableCssClassName = {
|
|
|
114
114
|
RESIZING_PLUGIN: `${tablePrefixSelector}-resizing-plugin`,
|
|
115
115
|
RESIZE_CURSOR: `${tablePrefixSelector}-resize-cursor`,
|
|
116
116
|
IS_RESIZING: `${tablePrefixSelector}-is-resizing`,
|
|
117
|
-
// Resize handle is going to be removed together with updateResizeHandles - table's utility function
|
|
118
|
-
RESIZE_HANDLE: `${tablePrefixSelector}-resize-handle`,
|
|
119
117
|
RESIZE_HANDLE_DECORATION: `${tablePrefixSelector}-resize-decoration`,
|
|
120
118
|
CONTEXTUAL_SUBMENU: `${tablePrefixSelector}-contextual-submenu`,
|
|
121
119
|
CONTEXTUAL_MENU_BUTTON_WRAP: `${tablePrefixSelector}-contextual-menu-button-wrap`,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
3
|
-
import { akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
3
|
+
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
5
|
import { dragMenuDropdownWidth } from '../consts';
|
|
6
6
|
import { DragMenu } from './DragMenu';
|
|
@@ -16,11 +16,13 @@ const FloatingDragMenu = ({
|
|
|
16
16
|
targetCellPosition,
|
|
17
17
|
getEditorContainerWidth,
|
|
18
18
|
canDrag,
|
|
19
|
-
editorAnalyticsAPI
|
|
19
|
+
editorAnalyticsAPI,
|
|
20
|
+
stickyHeaders
|
|
20
21
|
}) => {
|
|
21
22
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
22
23
|
return null;
|
|
23
24
|
}
|
|
25
|
+
const inStickyMode = stickyHeaders === null || stickyHeaders === void 0 ? void 0 : stickyHeaders.sticky;
|
|
24
26
|
const targetHandleRef = direction === 'row' ? document.querySelector('#drag-handle-button-row') : document.querySelector('#drag-handle-button-column');
|
|
25
27
|
if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
|
|
26
28
|
return null;
|
|
@@ -38,8 +40,9 @@ const FloatingDragMenu = ({
|
|
|
38
40
|
fitWidth: dragMenuDropdownWidth
|
|
39
41
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
40
42
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
43
|
+
// In sticky mode, we want to show the menu above the sticky header
|
|
41
44
|
,
|
|
42
|
-
zIndex: akEditorFloatingOverlapPanelZIndex,
|
|
45
|
+
zIndex: inStickyMode ? akEditorFloatingDialogZIndex : akEditorFloatingOverlapPanelZIndex,
|
|
43
46
|
forcePlacement: true,
|
|
44
47
|
offset: offset,
|
|
45
48
|
stick: true
|
|
@@ -11,12 +11,12 @@ import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
|
11
11
|
import Tooltip from '@atlaskit/tooltip';
|
|
12
12
|
import { TableCssClassName as ClassName } from '../../types';
|
|
13
13
|
import { tableToolbarSize } from '../consts';
|
|
14
|
-
const getInsertLineHeight = (tableRef, hasStickyHeaders) => {
|
|
14
|
+
const getInsertLineHeight = (tableRef, hasStickyHeaders, isDragAndDropEnabled) => {
|
|
15
15
|
// The line gets height 100% from the table,
|
|
16
16
|
// but since we have an overflow on the left,
|
|
17
17
|
// we should add an offset to make up for it.
|
|
18
18
|
const LINE_OFFSET = 3;
|
|
19
|
-
const ADDITIONAL_HEIGHT = hasStickyHeaders ? tableRef.getBoundingClientRect().top - tableMarginTop * 4 - LINE_OFFSET : tableToolbarSize + LINE_OFFSET;
|
|
19
|
+
const ADDITIONAL_HEIGHT = hasStickyHeaders ? tableRef.getBoundingClientRect().top - tableMarginTop * (isDragAndDropEnabled ? 3 : 4) - LINE_OFFSET : tableToolbarSize + LINE_OFFSET;
|
|
20
20
|
return tableRef.offsetHeight + ADDITIONAL_HEIGHT;
|
|
21
21
|
};
|
|
22
22
|
const getToolbarSize = tableRef => {
|
|
@@ -89,7 +89,7 @@ export const InsertButtonForDragAndDrop = ({
|
|
|
89
89
|
width: getInsertLineWidth(tableRef, true),
|
|
90
90
|
left: "var(--ds-space-150, 12px)"
|
|
91
91
|
} : {
|
|
92
|
-
height: getInsertLineHeight(tableRef, hasStickyHeaders) - 8,
|
|
92
|
+
height: getInsertLineHeight(tableRef, hasStickyHeaders, true) - 8,
|
|
93
93
|
top: '-3px'
|
|
94
94
|
}
|
|
95
95
|
})));
|
|
@@ -6,7 +6,7 @@ import { ACTION, ACTION_SUBJECT, CONTENT_COMPONENT, EVENT_TYPE, INPUT_METHOD } f
|
|
|
6
6
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
7
7
|
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
9
|
-
import {
|
|
9
|
+
import { akEditorTableInsertButtonOnStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
11
11
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
12
12
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
@@ -106,7 +106,7 @@ export class FloatingInsertButton extends React.Component {
|
|
|
106
106
|
// By setting the Popup z-index higher than the sticky header z-index ( common-styles.ts tr.sticky)
|
|
107
107
|
// Only when inserting a column, otherwise set to undefined
|
|
108
108
|
// Need to set z-index in the Popup, set z-index in the <InsertButton /> will not work
|
|
109
|
-
const zIndex = type === 'column' ?
|
|
109
|
+
const zIndex = type === 'column' ? akEditorTableInsertButtonOnStickyHeaderZIndex : undefined;
|
|
110
110
|
return /*#__PURE__*/React.createElement(Popup, _extends({
|
|
111
111
|
target: targetCellRef,
|
|
112
112
|
mountTo: tableContainerWrapper || mountPoint,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
2
2
|
|
|
3
|
-
import React, { useCallback, useMemo } from 'react';
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
5
|
+
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
6
|
+
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
5
7
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
6
8
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
7
9
|
import { clearHoverSelection, hoverCell, hoverColumns, selectColumn, selectColumns } from '../../../commands';
|
|
@@ -32,10 +34,16 @@ export const ColumnControls = ({
|
|
|
32
34
|
colWidths,
|
|
33
35
|
hasHeaderColumn,
|
|
34
36
|
isTableHovered,
|
|
35
|
-
canDrag
|
|
37
|
+
canDrag,
|
|
38
|
+
tableContainerWidth,
|
|
39
|
+
isNumberColumnEnabled
|
|
36
40
|
}) => {
|
|
37
41
|
var _colWidths$map$join, _rowHeights$;
|
|
38
|
-
const
|
|
42
|
+
const columnControlsRef = useRef(null);
|
|
43
|
+
const widths = (_colWidths$map$join = colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(width =>
|
|
44
|
+
// when there is sticky header, a `margin-right: -1px` applied to `tr.sticky th` so it causes colWidths to be 1px wider
|
|
45
|
+
// we need to reduce the width by 1px to avoid misalignment of column controls.
|
|
46
|
+
width ? stickyTop ? `${width - 2}px` : `${width - 1}px` : '0px').join(' ')) !== null && _colWidths$map$join !== void 0 ? _colWidths$map$join : '0px';
|
|
39
47
|
// TODO: reusing getRowsParams here because it's generic enough to work for columns -> rename
|
|
40
48
|
const columnParams = getRowsParams(colWidths !== null && colWidths !== void 0 ? colWidths : []);
|
|
41
49
|
const colIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex;
|
|
@@ -104,6 +112,24 @@ export const ColumnControls = ({
|
|
|
104
112
|
const colIndexes = useMemo(() => {
|
|
105
113
|
return [colIndex];
|
|
106
114
|
}, [colIndex]);
|
|
115
|
+
const tableWrapper = closestElement(tableRef, `.${ClassName.TABLE_NODE_WRAPPER}`);
|
|
116
|
+
const handleScroll = useCallback(event => {
|
|
117
|
+
if (stickyTop) {
|
|
118
|
+
if (columnControlsRef && columnControlsRef.current) {
|
|
119
|
+
var _tableWrapper$scrollL;
|
|
120
|
+
columnControlsRef.current.scrollLeft = (_tableWrapper$scrollL = tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.scrollLeft) !== null && _tableWrapper$scrollL !== void 0 ? _tableWrapper$scrollL : 0;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}, [stickyTop, tableWrapper]);
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
handleScroll();
|
|
126
|
+
}, [handleScroll]);
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.addEventListener('scroll', handleScroll);
|
|
129
|
+
return () => {
|
|
130
|
+
tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.removeEventListener('scroll', handleScroll);
|
|
131
|
+
};
|
|
132
|
+
}, [tableWrapper, handleScroll]);
|
|
107
133
|
const generateHandleByType = type => {
|
|
108
134
|
var _rowHeights$reduce, _colWidths;
|
|
109
135
|
if (!hoveredCell || !(colWidths !== null && colWidths !== void 0 && colWidths.length)) {
|
|
@@ -164,15 +190,19 @@ export const ColumnControls = ({
|
|
|
164
190
|
const sortedHandles = [generateHandleByType('hover'), generateHandleByType('selected')];
|
|
165
191
|
return hoveredCell.colIndex < selectedColIndexes[0] ? sortedHandles : sortedHandles.reverse();
|
|
166
192
|
};
|
|
193
|
+
const containerWidth = isNumberColumnEnabled && tableContainerWidth ? tableContainerWidth - akEditorTableNumberColumnWidth : tableContainerWidth;
|
|
167
194
|
return /*#__PURE__*/React.createElement("div", {
|
|
168
195
|
className: ClassName.DRAG_COLUMN_CONTROLS,
|
|
169
196
|
onMouseMove: handleMouseMove
|
|
170
197
|
}, /*#__PURE__*/React.createElement("div", {
|
|
198
|
+
ref: columnControlsRef,
|
|
171
199
|
className: ClassName.DRAG_COLUMN_CONTROLS_INNER,
|
|
172
200
|
"data-testid": "table-floating-column-controls",
|
|
173
201
|
style: {
|
|
174
202
|
gridTemplateColumns: widths,
|
|
175
|
-
marginTop
|
|
203
|
+
marginTop,
|
|
204
|
+
width: stickyTop ? containerWidth : undefined,
|
|
205
|
+
overflowX: stickyTop ? 'hidden' : 'visible'
|
|
176
206
|
}
|
|
177
207
|
}, !isResizing && columnParams.map(({
|
|
178
208
|
startIndex,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
|
|
3
3
|
import { TableCssClassName as ClassName } from '../../types';
|
|
4
4
|
import { containsHeaderColumn, getColumnsWidths, getRowHeights } from '../../utils';
|
|
@@ -16,16 +16,20 @@ export const TableFloatingColumnControls = ({
|
|
|
16
16
|
selection,
|
|
17
17
|
isInDanger,
|
|
18
18
|
isTableHovered,
|
|
19
|
-
canDrag
|
|
19
|
+
canDrag,
|
|
20
|
+
tableContainerWidth,
|
|
21
|
+
isNumberColumnEnabled
|
|
20
22
|
}) => {
|
|
21
23
|
const [tableRect, setTableRect] = useState({
|
|
22
24
|
width: 0,
|
|
23
25
|
height: 0
|
|
24
26
|
});
|
|
25
27
|
const [hasDropTargets, setHasDropTargets] = useState(false);
|
|
28
|
+
const containerRef = useRef(null);
|
|
26
29
|
const node = getNode();
|
|
27
30
|
const currentNodeLocalId = node === null || node === void 0 ? void 0 : node.attrs.localId;
|
|
28
31
|
const hasHeaderColumn = containsHeaderColumn(node);
|
|
32
|
+
const stickyTop = stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
|
|
29
33
|
useEffect(() => {
|
|
30
34
|
var _window;
|
|
31
35
|
if (tableRef && (_window = window) !== null && _window !== void 0 && _window.ResizeObserver) {
|
|
@@ -76,14 +80,17 @@ export const TableFloatingColumnControls = ({
|
|
|
76
80
|
return null;
|
|
77
81
|
}
|
|
78
82
|
const colWidths = getColumnsWidths(editorView);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
if (stickyTop) {
|
|
84
|
+
var _rowHeights$, _containerRef$current;
|
|
85
|
+
const headerRowHeight = hasHeaderRow && stickyTop !== undefined ? (_rowHeights$ = rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights[0]) !== null && _rowHeights$ !== void 0 ? _rowHeights$ : 0 : 0;
|
|
86
|
+
containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.style.setProperty('top', `${stickyTop - headerRowHeight + 33}px` // 33px is padding and margin applied on tr.sticky
|
|
87
|
+
);
|
|
88
|
+
} else {
|
|
89
|
+
var _containerRef$current2;
|
|
90
|
+
containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.style.removeProperty('top');
|
|
85
91
|
}
|
|
86
92
|
return /*#__PURE__*/React.createElement("div", {
|
|
93
|
+
ref: containerRef,
|
|
87
94
|
className: ClassName.DRAG_COLUMN_CONTROLS_WRAPPER,
|
|
88
95
|
"data-testid": "table-floating-column-controls-wrapper"
|
|
89
96
|
}, /*#__PURE__*/React.createElement(ColumnControls, {
|
|
@@ -99,7 +106,9 @@ export const TableFloatingColumnControls = ({
|
|
|
99
106
|
rowHeights: rowHeights,
|
|
100
107
|
colWidths: colWidths,
|
|
101
108
|
hasHeaderColumn: hasHeaderColumn,
|
|
102
|
-
canDrag: canDrag
|
|
109
|
+
canDrag: canDrag,
|
|
110
|
+
tableContainerWidth: tableContainerWidth,
|
|
111
|
+
isNumberColumnEnabled: isNumberColumnEnabled
|
|
103
112
|
}), hasDropTargets && /*#__PURE__*/React.createElement(ColumnDropTargets, {
|
|
104
113
|
tableRef: tableRef,
|
|
105
114
|
stickyTop: tableActive ? stickyTop : undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
4
|
-
import { akEditorSelectedNodeClassName, akEditorSmallZIndex, akEditorStickyHeaderZIndex, akEditorTableCellOnStickyHeaderZIndex, akEditorTableNumberColumnWidth, akEditorTableToolbarSize, akEditorUnitZIndex, getSelectionStyles, MAX_BROWSER_SCROLLBAR_HEIGHT, relativeFontSizeToBase16, SelectionStyle } from '@atlaskit/editor-shared-styles';
|
|
4
|
+
import { akEditorFloatingDialogZIndex, akEditorSelectedNodeClassName, akEditorSmallZIndex, akEditorStickyHeaderZIndex, akEditorTableCellOnStickyHeaderZIndex, akEditorTableNumberColumnWidth, akEditorTableToolbarSize, akEditorUnitZIndex, getSelectionStyles, MAX_BROWSER_SCROLLBAR_HEIGHT, relativeFontSizeToBase16, SelectionStyle } from '@atlaskit/editor-shared-styles';
|
|
5
5
|
import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
6
6
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { B300, N0, N20A, N300, N40A, R500 } from '@atlaskit/theme/colors';
|
|
@@ -940,6 +940,11 @@ export const tableStyles = props => css`
|
|
|
940
940
|
top: ${tableMarginTop}px;
|
|
941
941
|
}
|
|
942
942
|
|
|
943
|
+
.${ClassName.TABLE_STICKY} .${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER} {
|
|
944
|
+
position: fixed;
|
|
945
|
+
z-index: ${akEditorFloatingDialogZIndex};
|
|
946
|
+
}
|
|
947
|
+
|
|
943
948
|
${tableWrapperStyles()}
|
|
944
949
|
}
|
|
945
950
|
|
|
@@ -8,6 +8,7 @@ import { nonNullable } from '@atlaskit/editor-common/utils';
|
|
|
8
8
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
9
9
|
import { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
10
10
|
import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
11
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { TableCssClassName as ClassName, TableDecorations } from '../types';
|
|
12
13
|
import { ColumnResizeWidget } from '../ui/ColumnResizeWidget';
|
|
13
14
|
const filterDecorationByKey = (key, decorationSet) => decorationSet.find(undefined, undefined, spec => spec.key.indexOf(key) > -1);
|
|
@@ -43,40 +44,53 @@ export const createControlsHoverDecoration = (cells, type, tr, isDragAndDropEnab
|
|
|
43
44
|
// So If the table cells are in danger we want to create a "rectangle" selection
|
|
44
45
|
// to match the "clicked" selection
|
|
45
46
|
|
|
46
|
-
if (danger) {
|
|
47
|
-
|
|
48
|
-
// merged cells.
|
|
49
|
-
const {
|
|
50
|
-
recLeft,
|
|
51
|
-
recTop,
|
|
52
|
-
recRight,
|
|
53
|
-
recBottom
|
|
54
|
-
} = cells.reduce((acc, cell) => {
|
|
47
|
+
if (getBooleanFF('platform.editor.table.in-danger-hover-merged-cells-fix')) {
|
|
48
|
+
if (danger && type !== 'table') {
|
|
55
49
|
const {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
50
|
+
selection
|
|
51
|
+
} = tr;
|
|
52
|
+
const table = findTable(selection);
|
|
53
|
+
const rect = getSelectionRect(selection);
|
|
54
|
+
if (table && rect) {
|
|
55
|
+
updatedCells = map.cellsInRect(rect).map(x => x + table.start);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
if (danger) {
|
|
60
|
+
// Find the bounding rectangle of all the given cells, also considering
|
|
61
|
+
// merged cells.
|
|
62
|
+
const {
|
|
63
|
+
recLeft,
|
|
64
|
+
recTop,
|
|
65
|
+
recRight,
|
|
66
|
+
recBottom
|
|
67
|
+
} = cells.reduce((acc, cell) => {
|
|
68
|
+
const {
|
|
69
|
+
left,
|
|
70
|
+
right,
|
|
71
|
+
bottom,
|
|
72
|
+
top
|
|
73
|
+
} = map.findCell(cell.pos - table.start);
|
|
74
|
+
// Finding the bounding rect requires finding the min left and top positions,
|
|
75
|
+
// and the max right and bottom positions of the cells
|
|
76
|
+
return {
|
|
77
|
+
recLeft: Math.min(acc.recLeft, left),
|
|
78
|
+
recTop: Math.min(acc.recTop, top),
|
|
79
|
+
recRight: Math.max(acc.recRight, right),
|
|
80
|
+
recBottom: Math.max(acc.recBottom, bottom)
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
// +-Infinity as initialisation vars which will always be overwritten
|
|
84
|
+
// by smaller/larger values respectively
|
|
85
|
+
{
|
|
86
|
+
recLeft: Infinity,
|
|
87
|
+
recTop: Infinity,
|
|
88
|
+
recRight: -Infinity,
|
|
89
|
+
recBottom: -Infinity
|
|
90
|
+
});
|
|
91
|
+
const rect = new Rect(recLeft, recTop, recRight, recBottom);
|
|
92
|
+
updatedCells = map.cellsInRect(rect).map(x => x + table.start);
|
|
93
|
+
}
|
|
80
94
|
}
|
|
81
95
|
return updatedCells.map(pos => {
|
|
82
96
|
const cell = tr.doc.nodeAt(pos);
|
package/dist/es2019/utils/dom.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { closestElement, containsClassName } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { TableCssClassName as ClassName } from '../types';
|
|
3
|
-
import { tableToolbarSize } from '../ui/consts';
|
|
4
3
|
const SELECTOR_TABLE_LEAFS = `.${ClassName.TABLE_CELL}, .${ClassName.TABLE_HEADER_CELL}`;
|
|
5
4
|
export const isCell = node => {
|
|
6
5
|
return Boolean(node && (['TH', 'TD'].indexOf(node.tagName) > -1 || !!closestElement(node, `.${ClassName.TABLE_HEADER_CELL}`) || !!closestElement(node, `.${ClassName.TABLE_CELL}`)));
|
|
@@ -116,23 +115,6 @@ export const getMousePositionVerticalRelativeByElement = mouseEvent => {
|
|
|
116
115
|
}
|
|
117
116
|
return null;
|
|
118
117
|
};
|
|
119
|
-
|
|
120
|
-
// This function is deprecated
|
|
121
|
-
export const updateResizeHandles = tableRef => {
|
|
122
|
-
if (!tableRef) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// see ED-7600
|
|
127
|
-
const nodes = Array.from(tableRef.querySelectorAll(`.${ClassName.RESIZE_HANDLE}`));
|
|
128
|
-
if (!nodes || !nodes.length) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
const height = tableRef.offsetHeight + tableToolbarSize;
|
|
132
|
-
nodes.forEach(node => {
|
|
133
|
-
node.style.height = `${height}px`;
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
118
|
export const hasResizeHandler = ({
|
|
137
119
|
columnEndIndexTarget,
|
|
138
120
|
target
|
|
@@ -2,7 +2,7 @@ export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, is
|
|
|
2
2
|
export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnInsertLine, createColumnLineResize, createRowInsertLine } from './decoration';
|
|
3
3
|
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, isLayoutSupported, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow } from './nodes';
|
|
4
4
|
export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell } from './paste';
|
|
5
|
-
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement,
|
|
5
|
+
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, isResizeHandleDecoration, hasResizeHandler, findNearestCellIndexToPoint } from './dom';
|
|
6
6
|
export { convertHTMLCellIndexToColumnIndex, getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames, getColumnIndexMappedToColumnIndexInFirstRow } from './column-controls';
|
|
7
7
|
export { getRowHeights, isRowDeleteButtonVisible, getRowDeleteButtonParams, getRowsParams, getRowClassNames, copyPreviousRow } from './row-controls';
|
|
8
8
|
export { getSelectedTableInfo, getSelectedCellInfo } from './analytics';
|
|
@@ -14,7 +14,7 @@ import classnames from 'classnames';
|
|
|
14
14
|
import memoizeOne from 'memoize-one';
|
|
15
15
|
import rafSchedule from 'raf-schd';
|
|
16
16
|
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
17
|
-
import { getParentNodeWidth } from '@atlaskit/editor-common/node-width';
|
|
17
|
+
import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
18
18
|
import { tableMarginSides } from '@atlaskit/editor-common/styles';
|
|
19
19
|
import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
|
|
20
20
|
import { MAX_BROWSER_SCROLLBAR_HEIGHT, akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
|
|
@@ -554,6 +554,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
554
554
|
headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
|
|
555
555
|
stickyHeader: this.state.stickyHeader
|
|
556
556
|
});
|
|
557
|
+
var tableContainerWidth = getTableContainerWidth(node);
|
|
557
558
|
var colControls = isDragAndDropEnabled ? /*#__PURE__*/React.createElement(TableFloatingColumnControls, {
|
|
558
559
|
editorView: view,
|
|
559
560
|
tableRef: tableRef,
|
|
@@ -572,7 +573,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
572
573
|
headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
|
|
573
574
|
stickyHeader: this.state.stickyHeader,
|
|
574
575
|
canDrag: canDrag,
|
|
575
|
-
getEditorFeatureFlags: getEditorFeatureFlags
|
|
576
|
+
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
577
|
+
tableContainerWidth: tableContainerWidth,
|
|
578
|
+
isNumberColumnEnabled: node.attrs.isNumberColumnEnabled
|
|
576
579
|
}) : null;
|
|
577
580
|
var shadowPadding = allowControls && tableActive ? -tableToolbarSize : tableMarginSides;
|
|
578
581
|
var shadowStyle = memoizeOne(function (visible) {
|
package/dist/esm/plugin.js
CHANGED
|
@@ -352,7 +352,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
352
352
|
isOpen: !!(dragAndDropState !== null && dragAndDropState !== void 0 && dragAndDropState.isDragMenuOpen) && !isResizing,
|
|
353
353
|
canDrag: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.canDrag,
|
|
354
354
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
355
|
-
editorAnalyticsAPI: editorAnalyticsAPI
|
|
355
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
356
|
+
stickyHeaders: stickyHeader
|
|
356
357
|
}), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
357
358
|
editorView: editorView,
|
|
358
359
|
selection: editorView.state.selection,
|
|
@@ -7,8 +7,6 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
7
7
|
import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes } from '@atlaskit/editor-common/transforms';
|
|
8
8
|
import { browser, closestElement } from '@atlaskit/editor-common/utils';
|
|
9
9
|
import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
10
|
-
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
11
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
12
10
|
import { addBoldInEmptyHeaderCells, clearHoverSelection, setTableRef } from '../commands';
|
|
13
11
|
import { removeResizeHandleDecorations, transformSliceRemoveCellBackgroundColor, transformSliceToAddTableHeaders, transformSliceToRemoveColumnsWidths } from '../commands/misc';
|
|
14
12
|
import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseEnter, handleMouseLeave, handleMouseMove, handleMouseOut, handleMouseOver, handleTripleClick, whenTableInFocus, withCellTracking } from '../event-handlers';
|
|
@@ -18,7 +16,7 @@ import TableRow from '../nodeviews/TableRow';
|
|
|
18
16
|
import { pluginKey as decorationsPluginKey } from '../pm-plugins/decorations/plugin';
|
|
19
17
|
import { fixTables, replaceSelectedTable } from '../transforms';
|
|
20
18
|
import { TableCssClassName as ClassName } from '../types';
|
|
21
|
-
import { findControlsHoverDecoration, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, transformSliceToRemoveOpenTable
|
|
19
|
+
import { findControlsHoverDecoration, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, transformSliceToRemoveOpenTable } from '../utils';
|
|
22
20
|
import { isHeaderRowRequired } from '../utils/paste';
|
|
23
21
|
import { defaultHoveredCell, defaultTableSelection } from './default-table-selection';
|
|
24
22
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
@@ -107,24 +105,15 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
107
105
|
var selection = state.selection;
|
|
108
106
|
var pluginState = getPluginState(state);
|
|
109
107
|
var tableRef;
|
|
110
|
-
var tableNode;
|
|
111
108
|
if (pluginState.editorHasFocus) {
|
|
112
109
|
var parent = findParentDomRefOfType(state.schema.nodes.table, domAtPos)(selection);
|
|
113
110
|
if (parent) {
|
|
114
111
|
tableRef = parent.querySelector('table') || undefined;
|
|
115
112
|
}
|
|
116
|
-
tableNode = findTable(state.selection);
|
|
117
113
|
}
|
|
118
114
|
if (pluginState.tableRef !== tableRef) {
|
|
119
115
|
setTableRef(tableRef)(state, dispatch);
|
|
120
116
|
}
|
|
121
|
-
|
|
122
|
-
// Removes updateResizeHandles
|
|
123
|
-
if (getBooleanFF('platform.editor.table-remove-update-resize-handles_djvab')) {} else {
|
|
124
|
-
if (pluginState.tableNode !== tableNode) {
|
|
125
|
-
updateResizeHandles(tableRef);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
117
|
if (pluginState.editorHasFocus && pluginState.tableRef) {
|
|
129
118
|
var _ref = state.selection,
|
|
130
119
|
$cursor = _ref.$cursor;
|