@atlaskit/editor-plugin-table 2.10.3 → 2.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/plugins/table/nodeviews/TableContainer.js +0 -19
- package/dist/cjs/plugins/table/nodeviews/TableResizer.js +2 -6
- package/dist/cjs/plugins/table/pm-plugins/main.js +7 -2
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +4 -1
- package/dist/cjs/plugins/table/types.js +1 -0
- package/dist/cjs/plugins/table/utils/dom.js +4 -1
- package/dist/es2019/plugins/table/nodeviews/TableContainer.js +0 -19
- package/dist/es2019/plugins/table/nodeviews/TableResizer.js +2 -6
- package/dist/es2019/plugins/table/pm-plugins/main.js +7 -2
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +4 -1
- package/dist/es2019/plugins/table/types.js +1 -0
- package/dist/es2019/plugins/table/utils/dom.js +4 -1
- package/dist/esm/plugins/table/nodeviews/TableContainer.js +0 -19
- package/dist/esm/plugins/table/nodeviews/TableResizer.js +2 -6
- package/dist/esm/plugins/table/pm-plugins/main.js +7 -2
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +4 -1
- package/dist/esm/plugins/table/types.js +1 -0
- package/dist/esm/plugins/table/utils/dom.js +4 -1
- package/dist/types/plugins/table/nodeviews/TableResizer.d.ts +1 -3
- package/dist/types/plugins/table/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/table/ui/common-styles.d.ts +1 -1
- package/dist/types/plugins/table/utils/dom.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/nodeviews/TableResizer.d.ts +1 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/ui/common-styles.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +1 -1
- package/package.json +6 -3
- package/src/plugins/table/nodeviews/TableContainer.tsx +0 -29
- package/src/plugins/table/nodeviews/TableResizer.tsx +1 -16
- package/src/plugins/table/pm-plugins/main.ts +16 -7
- package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +7 -1
- package/src/plugins/table/types.ts +1 -0
- package/src/plugins/table/ui/common-styles.ts +1 -1
- package/src/plugins/table/utils/dom.ts +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 2.10.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e813382ff78`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e813382ff78) - Revert ED-19511 due to incorrect height calculations when sticky headers are enabled for tables
|
|
8
|
+
|
|
9
|
+
## 2.10.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`eefbc3c6065`](https://bitbucket.org/atlassian/atlassian-frontend/commits/eefbc3c6065) - [ED-19510] Applies performance tweaks for table
|
|
14
|
+
|
|
3
15
|
## 2.10.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -55,23 +55,6 @@ var ResizableTableContainer = function ResizableTableContainer(_ref2) {
|
|
|
55
55
|
var containerRef = (0, _react.useRef)(null);
|
|
56
56
|
var marginLeftRef = (0, _react.useRef)(0);
|
|
57
57
|
var tableWidthRef = (0, _react.useRef)(_editorSharedStyles.akEditorDefaultLayoutWidth);
|
|
58
|
-
var updateContainerHeight = (0, _react.useCallback)(function (height) {
|
|
59
|
-
var _containerRef$current;
|
|
60
|
-
(_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.style.setProperty('height', typeof height === 'number' ? "".concat(height + 29, "px") : 'auto');
|
|
61
|
-
}, []);
|
|
62
|
-
var resizeObserverRef = (0, _react.useRef)(new ResizeObserver(function (entries) {
|
|
63
|
-
updateContainerHeight(entries[entries.length - 1].contentRect.height);
|
|
64
|
-
}));
|
|
65
|
-
var onResizeStart = (0, _react.useCallback)(function () {
|
|
66
|
-
updateContainerHeight(tableRef === null || tableRef === void 0 ? void 0 : tableRef.clientHeight);
|
|
67
|
-
if (tableRef) {
|
|
68
|
-
resizeObserverRef.current.observe(tableRef);
|
|
69
|
-
}
|
|
70
|
-
}, [tableRef, updateContainerHeight]);
|
|
71
|
-
var onResizeStop = (0, _react.useCallback)(function () {
|
|
72
|
-
updateContainerHeight('auto');
|
|
73
|
-
resizeObserverRef.current.disconnect();
|
|
74
|
-
}, [updateContainerHeight]);
|
|
75
58
|
var updateWidth = (0, _react.useCallback)(function (width) {
|
|
76
59
|
if (!containerRef.current) {
|
|
77
60
|
return;
|
|
@@ -119,8 +102,6 @@ var ResizableTableContainer = function ResizableTableContainer(_ref2) {
|
|
|
119
102
|
className: _types.TableCssClassName.TABLE_RESIZER_CONTAINER,
|
|
120
103
|
ref: containerRef
|
|
121
104
|
}, /*#__PURE__*/_react.default.createElement(_TableResizer.TableResizer, {
|
|
122
|
-
onResizeStart: onResizeStart,
|
|
123
|
-
onResizeStop: onResizeStop,
|
|
124
105
|
width: width,
|
|
125
106
|
maxWidth: maxResizerWidth,
|
|
126
107
|
containerWidth: containerWidth,
|
|
@@ -78,8 +78,6 @@ var TableResizer = function TableResizer(_ref) {
|
|
|
78
78
|
maxWidth = _ref.maxWidth,
|
|
79
79
|
containerWidth = _ref.containerWidth,
|
|
80
80
|
updateWidth = _ref.updateWidth,
|
|
81
|
-
onResizeStop = _ref.onResizeStop,
|
|
82
|
-
onResizeStart = _ref.onResizeStart,
|
|
83
81
|
editorView = _ref.editorView,
|
|
84
82
|
getPos = _ref.getPos,
|
|
85
83
|
node = _ref.node,
|
|
@@ -122,8 +120,7 @@ var TableResizer = function TableResizer(_ref) {
|
|
|
122
120
|
}));
|
|
123
121
|
var visibleGuidelines = getVisibleGuidelines(_guidelines.defaultGuidelines, containerWidth);
|
|
124
122
|
setSnappingEnabled(displayGuideline(visibleGuidelines));
|
|
125
|
-
|
|
126
|
-
}, [displayGuideline, editorView, startMeasure, onResizeStart, containerWidth]);
|
|
123
|
+
}, [displayGuideline, editorView, startMeasure, containerWidth]);
|
|
127
124
|
var handleResize = (0, _react.useCallback)(function (originalState, delta) {
|
|
128
125
|
countFrames();
|
|
129
126
|
var newWidth = originalState.width + delta.width;
|
|
@@ -188,9 +185,8 @@ var TableResizer = function TableResizer(_ref) {
|
|
|
188
185
|
displayGuideline([]);
|
|
189
186
|
updateWidth(newWidth);
|
|
190
187
|
scheduleResize.cancel();
|
|
191
|
-
onResizeStop();
|
|
192
188
|
return newWidth;
|
|
193
|
-
}, [updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure
|
|
189
|
+
}, [updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure]);
|
|
194
190
|
var handleComponent = (0, _react.useMemo)(function () {
|
|
195
191
|
return {
|
|
196
192
|
left: /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -13,6 +13,7 @@ var _transforms = require("@atlaskit/editor-common/transforms");
|
|
|
13
13
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
14
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
15
15
|
var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _commands = require("../commands");
|
|
17
18
|
var _misc = require("../commands/misc");
|
|
18
19
|
var _eventHandlers = require("../event-handlers");
|
|
@@ -132,8 +133,12 @@ var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, porta
|
|
|
132
133
|
if (pluginState.tableRef !== tableRef) {
|
|
133
134
|
(0, _commands.setTableRef)(tableRef)(state, dispatch);
|
|
134
135
|
}
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
|
|
137
|
+
// Removes updateResizeHandles
|
|
138
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table-remove-update-resize-handles_djvab')) {} else {
|
|
139
|
+
if (pluginState.tableNode !== tableNode) {
|
|
140
|
+
(0, _utils4.updateResizeHandles)(tableRef);
|
|
141
|
+
}
|
|
137
142
|
}
|
|
138
143
|
if (pluginState.editorHasFocus && pluginState.tableRef) {
|
|
139
144
|
var _ref = state.selection,
|
|
@@ -140,7 +140,10 @@ var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos
|
|
|
140
140
|
var colIndex = map.colCount($cell.pos - $cell.start(-1)) + $cell.nodeAfter.attrs.colspan - 1;
|
|
141
141
|
(0, _utils3.resizeColumn)(resizeState, colIndex, clientX - dragging.startX, dom);
|
|
142
142
|
(0, _utils3.updateControls)()(state);
|
|
143
|
-
|
|
143
|
+
// Remove updateResizeHandles
|
|
144
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table-remove-update-resize-handles_djvab')) {} else {
|
|
145
|
+
(0, _utils2.updateResizeHandles)(dom);
|
|
146
|
+
}
|
|
144
147
|
}
|
|
145
148
|
window.addEventListener('mouseup', finish);
|
|
146
149
|
window.addEventListener('mousemove', move);
|
|
@@ -93,6 +93,7 @@ var TableCssClassName = _objectSpread(_objectSpread({}, _styles.TableSharedCssCl
|
|
|
93
93
|
RESIZING_PLUGIN: "".concat(_adfSchema.tablePrefixSelector, "-resizing-plugin"),
|
|
94
94
|
RESIZE_CURSOR: "".concat(_adfSchema.tablePrefixSelector, "-resize-cursor"),
|
|
95
95
|
IS_RESIZING: "".concat(_adfSchema.tablePrefixSelector, "-is-resizing"),
|
|
96
|
+
// Resize handle is going to be removed together with updateResizeHandles - table's utility function
|
|
96
97
|
RESIZE_HANDLE: "".concat(_adfSchema.tablePrefixSelector, "-resize-handle"),
|
|
97
98
|
RESIZE_HANDLE_DECORATION: "".concat(_adfSchema.tablePrefixSelector, "-resize-decoration"),
|
|
98
99
|
CONTEXTUAL_SUBMENU: "".concat(_adfSchema.tablePrefixSelector, "-contextual-submenu"),
|
|
@@ -135,17 +135,20 @@ var getMousePositionVerticalRelativeByElement = function getMousePositionVertica
|
|
|
135
135
|
}
|
|
136
136
|
return null;
|
|
137
137
|
};
|
|
138
|
+
|
|
139
|
+
// This function is deprecated
|
|
138
140
|
exports.getMousePositionVerticalRelativeByElement = getMousePositionVerticalRelativeByElement;
|
|
139
141
|
var updateResizeHandles = function updateResizeHandles(tableRef) {
|
|
140
142
|
if (!tableRef) {
|
|
141
143
|
return;
|
|
142
144
|
}
|
|
143
|
-
|
|
145
|
+
|
|
144
146
|
// see ED-7600
|
|
145
147
|
var nodes = Array.from(tableRef.querySelectorAll(".".concat(_types.TableCssClassName.RESIZE_HANDLE)));
|
|
146
148
|
if (!nodes || !nodes.length) {
|
|
147
149
|
return;
|
|
148
150
|
}
|
|
151
|
+
var height = tableRef.offsetHeight + _consts.tableToolbarSize;
|
|
149
152
|
nodes.forEach(function (node) {
|
|
150
153
|
node.style.height = "".concat(height, "px");
|
|
151
154
|
});
|
|
@@ -46,23 +46,6 @@ export const ResizableTableContainer = ({
|
|
|
46
46
|
const containerRef = useRef(null);
|
|
47
47
|
const marginLeftRef = useRef(0);
|
|
48
48
|
const tableWidthRef = useRef(akEditorDefaultLayoutWidth);
|
|
49
|
-
const updateContainerHeight = useCallback(height => {
|
|
50
|
-
var _containerRef$current;
|
|
51
|
-
(_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.style.setProperty('height', typeof height === 'number' ? `${height + 29}px` : 'auto');
|
|
52
|
-
}, []);
|
|
53
|
-
const resizeObserverRef = useRef(new ResizeObserver(entries => {
|
|
54
|
-
updateContainerHeight(entries[entries.length - 1].contentRect.height);
|
|
55
|
-
}));
|
|
56
|
-
const onResizeStart = useCallback(() => {
|
|
57
|
-
updateContainerHeight(tableRef === null || tableRef === void 0 ? void 0 : tableRef.clientHeight);
|
|
58
|
-
if (tableRef) {
|
|
59
|
-
resizeObserverRef.current.observe(tableRef);
|
|
60
|
-
}
|
|
61
|
-
}, [tableRef, updateContainerHeight]);
|
|
62
|
-
const onResizeStop = useCallback(() => {
|
|
63
|
-
updateContainerHeight('auto');
|
|
64
|
-
resizeObserverRef.current.disconnect();
|
|
65
|
-
}, [updateContainerHeight]);
|
|
66
49
|
const updateWidth = useCallback(width => {
|
|
67
50
|
if (!containerRef.current) {
|
|
68
51
|
return;
|
|
@@ -110,8 +93,6 @@ export const ResizableTableContainer = ({
|
|
|
110
93
|
className: ClassName.TABLE_RESIZER_CONTAINER,
|
|
111
94
|
ref: containerRef
|
|
112
95
|
}, /*#__PURE__*/React.createElement(TableResizer, {
|
|
113
|
-
onResizeStart: onResizeStart,
|
|
114
|
-
onResizeStop: onResizeStop,
|
|
115
96
|
width: width,
|
|
116
97
|
maxWidth: maxResizerWidth,
|
|
117
98
|
containerWidth: containerWidth,
|
|
@@ -63,8 +63,6 @@ export const TableResizer = ({
|
|
|
63
63
|
maxWidth,
|
|
64
64
|
containerWidth,
|
|
65
65
|
updateWidth,
|
|
66
|
-
onResizeStop,
|
|
67
|
-
onResizeStart,
|
|
68
66
|
editorView,
|
|
69
67
|
getPos,
|
|
70
68
|
node,
|
|
@@ -111,8 +109,7 @@ export const TableResizer = ({
|
|
|
111
109
|
}));
|
|
112
110
|
const visibleGuidelines = getVisibleGuidelines(defaultGuidelines, containerWidth);
|
|
113
111
|
setSnappingEnabled(displayGuideline(visibleGuidelines));
|
|
114
|
-
|
|
115
|
-
}, [displayGuideline, editorView, startMeasure, onResizeStart, containerWidth]);
|
|
112
|
+
}, [displayGuideline, editorView, startMeasure, containerWidth]);
|
|
116
113
|
const handleResize = useCallback((originalState, delta) => {
|
|
117
114
|
countFrames();
|
|
118
115
|
const newWidth = originalState.width + delta.width;
|
|
@@ -178,9 +175,8 @@ export const TableResizer = ({
|
|
|
178
175
|
displayGuideline([]);
|
|
179
176
|
updateWidth(newWidth);
|
|
180
177
|
scheduleResize.cancel();
|
|
181
|
-
onResizeStop();
|
|
182
178
|
return newWidth;
|
|
183
|
-
}, [updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure
|
|
179
|
+
}, [updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure]);
|
|
184
180
|
const handleComponent = useMemo(() => ({
|
|
185
181
|
left: /*#__PURE__*/React.createElement("div", {
|
|
186
182
|
className: resizerHandleShadowClassName,
|
|
@@ -5,6 +5,7 @@ import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenEx
|
|
|
5
5
|
import { browser, closestElement } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
8
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { addBoldInEmptyHeaderCells, clearHoverSelection, setTableRef } from '../commands';
|
|
9
10
|
import { transformSliceRemoveCellBackgroundColor, transformSliceToAddTableHeaders, transformSliceToRemoveColumnsWidths } from '../commands/misc';
|
|
10
11
|
import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseLeave, handleMouseMove, handleMouseOut, handleMouseOver, handleTripleClick, whenTableInFocus } from '../event-handlers';
|
|
@@ -117,8 +118,12 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
117
118
|
if (pluginState.tableRef !== tableRef) {
|
|
118
119
|
setTableRef(tableRef)(state, dispatch);
|
|
119
120
|
}
|
|
120
|
-
|
|
121
|
-
|
|
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
|
+
}
|
|
122
127
|
}
|
|
123
128
|
if (pluginState.editorHasFocus && pluginState.tableRef) {
|
|
124
129
|
const {
|
|
@@ -150,7 +150,10 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
|
|
|
150
150
|
const colIndex = map.colCount($cell.pos - $cell.start(-1)) + $cell.nodeAfter.attrs.colspan - 1;
|
|
151
151
|
resizeColumn(resizeState, colIndex, clientX - dragging.startX, dom);
|
|
152
152
|
updateControls()(state);
|
|
153
|
-
updateResizeHandles
|
|
153
|
+
// Remove updateResizeHandles
|
|
154
|
+
if (getBooleanFF('platform.editor.table-remove-update-resize-handles_djvab')) {} else {
|
|
155
|
+
updateResizeHandles(dom);
|
|
156
|
+
}
|
|
154
157
|
}
|
|
155
158
|
window.addEventListener('mouseup', finish);
|
|
156
159
|
window.addEventListener('mousemove', move);
|
|
@@ -83,6 +83,7 @@ export const TableCssClassName = {
|
|
|
83
83
|
RESIZING_PLUGIN: `${tablePrefixSelector}-resizing-plugin`,
|
|
84
84
|
RESIZE_CURSOR: `${tablePrefixSelector}-resize-cursor`,
|
|
85
85
|
IS_RESIZING: `${tablePrefixSelector}-is-resizing`,
|
|
86
|
+
// Resize handle is going to be removed together with updateResizeHandles - table's utility function
|
|
86
87
|
RESIZE_HANDLE: `${tablePrefixSelector}-resize-handle`,
|
|
87
88
|
RESIZE_HANDLE_DECORATION: `${tablePrefixSelector}-resize-decoration`,
|
|
88
89
|
CONTEXTUAL_SUBMENU: `${tablePrefixSelector}-contextual-submenu`,
|
|
@@ -104,16 +104,19 @@ export const getMousePositionVerticalRelativeByElement = mouseEvent => {
|
|
|
104
104
|
}
|
|
105
105
|
return null;
|
|
106
106
|
};
|
|
107
|
+
|
|
108
|
+
// This function is deprecated
|
|
107
109
|
export const updateResizeHandles = tableRef => {
|
|
108
110
|
if (!tableRef) {
|
|
109
111
|
return;
|
|
110
112
|
}
|
|
111
|
-
|
|
113
|
+
|
|
112
114
|
// see ED-7600
|
|
113
115
|
const nodes = Array.from(tableRef.querySelectorAll(`.${ClassName.RESIZE_HANDLE}`));
|
|
114
116
|
if (!nodes || !nodes.length) {
|
|
115
117
|
return;
|
|
116
118
|
}
|
|
119
|
+
const height = tableRef.offsetHeight + tableToolbarSize;
|
|
117
120
|
nodes.forEach(node => {
|
|
118
121
|
node.style.height = `${height}px`;
|
|
119
122
|
});
|
|
@@ -44,23 +44,6 @@ export var ResizableTableContainer = function ResizableTableContainer(_ref2) {
|
|
|
44
44
|
var containerRef = useRef(null);
|
|
45
45
|
var marginLeftRef = useRef(0);
|
|
46
46
|
var tableWidthRef = useRef(akEditorDefaultLayoutWidth);
|
|
47
|
-
var updateContainerHeight = useCallback(function (height) {
|
|
48
|
-
var _containerRef$current;
|
|
49
|
-
(_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.style.setProperty('height', typeof height === 'number' ? "".concat(height + 29, "px") : 'auto');
|
|
50
|
-
}, []);
|
|
51
|
-
var resizeObserverRef = useRef(new ResizeObserver(function (entries) {
|
|
52
|
-
updateContainerHeight(entries[entries.length - 1].contentRect.height);
|
|
53
|
-
}));
|
|
54
|
-
var onResizeStart = useCallback(function () {
|
|
55
|
-
updateContainerHeight(tableRef === null || tableRef === void 0 ? void 0 : tableRef.clientHeight);
|
|
56
|
-
if (tableRef) {
|
|
57
|
-
resizeObserverRef.current.observe(tableRef);
|
|
58
|
-
}
|
|
59
|
-
}, [tableRef, updateContainerHeight]);
|
|
60
|
-
var onResizeStop = useCallback(function () {
|
|
61
|
-
updateContainerHeight('auto');
|
|
62
|
-
resizeObserverRef.current.disconnect();
|
|
63
|
-
}, [updateContainerHeight]);
|
|
64
47
|
var updateWidth = useCallback(function (width) {
|
|
65
48
|
if (!containerRef.current) {
|
|
66
49
|
return;
|
|
@@ -108,8 +91,6 @@ export var ResizableTableContainer = function ResizableTableContainer(_ref2) {
|
|
|
108
91
|
className: ClassName.TABLE_RESIZER_CONTAINER,
|
|
109
92
|
ref: containerRef
|
|
110
93
|
}, /*#__PURE__*/React.createElement(TableResizer, {
|
|
111
|
-
onResizeStart: onResizeStart,
|
|
112
|
-
onResizeStop: onResizeStop,
|
|
113
94
|
width: width,
|
|
114
95
|
maxWidth: maxResizerWidth,
|
|
115
96
|
containerWidth: containerWidth,
|
|
@@ -68,8 +68,6 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
68
68
|
maxWidth = _ref.maxWidth,
|
|
69
69
|
containerWidth = _ref.containerWidth,
|
|
70
70
|
updateWidth = _ref.updateWidth,
|
|
71
|
-
onResizeStop = _ref.onResizeStop,
|
|
72
|
-
onResizeStart = _ref.onResizeStart,
|
|
73
71
|
editorView = _ref.editorView,
|
|
74
72
|
getPos = _ref.getPos,
|
|
75
73
|
node = _ref.node,
|
|
@@ -112,8 +110,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
112
110
|
}));
|
|
113
111
|
var visibleGuidelines = getVisibleGuidelines(defaultGuidelines, containerWidth);
|
|
114
112
|
setSnappingEnabled(displayGuideline(visibleGuidelines));
|
|
115
|
-
|
|
116
|
-
}, [displayGuideline, editorView, startMeasure, onResizeStart, containerWidth]);
|
|
113
|
+
}, [displayGuideline, editorView, startMeasure, containerWidth]);
|
|
117
114
|
var handleResize = useCallback(function (originalState, delta) {
|
|
118
115
|
countFrames();
|
|
119
116
|
var newWidth = originalState.width + delta.width;
|
|
@@ -178,9 +175,8 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
178
175
|
displayGuideline([]);
|
|
179
176
|
updateWidth(newWidth);
|
|
180
177
|
scheduleResize.cancel();
|
|
181
|
-
onResizeStop();
|
|
182
178
|
return newWidth;
|
|
183
|
-
}, [updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure
|
|
179
|
+
}, [updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure]);
|
|
184
180
|
var handleComponent = useMemo(function () {
|
|
185
181
|
return {
|
|
186
182
|
left: /*#__PURE__*/React.createElement("div", {
|
|
@@ -8,6 +8,7 @@ import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenEx
|
|
|
8
8
|
import { browser, closestElement } from '@atlaskit/editor-common/utils';
|
|
9
9
|
import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
10
10
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
11
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { addBoldInEmptyHeaderCells, clearHoverSelection, setTableRef } from '../commands';
|
|
12
13
|
import { transformSliceRemoveCellBackgroundColor, transformSliceToAddTableHeaders, transformSliceToRemoveColumnsWidths } from '../commands/misc';
|
|
13
14
|
import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseLeave, handleMouseMove, handleMouseOut, handleMouseOver, handleTripleClick, whenTableInFocus } from '../event-handlers';
|
|
@@ -125,8 +126,12 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
125
126
|
if (pluginState.tableRef !== tableRef) {
|
|
126
127
|
setTableRef(tableRef)(state, dispatch);
|
|
127
128
|
}
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
|
|
130
|
+
// Removes updateResizeHandles
|
|
131
|
+
if (getBooleanFF('platform.editor.table-remove-update-resize-handles_djvab')) {} else {
|
|
132
|
+
if (pluginState.tableNode !== tableNode) {
|
|
133
|
+
updateResizeHandles(tableRef);
|
|
134
|
+
}
|
|
130
135
|
}
|
|
131
136
|
if (pluginState.editorHasFocus && pluginState.tableRef) {
|
|
132
137
|
var _ref = state.selection,
|
|
@@ -134,7 +134,10 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
134
134
|
var colIndex = map.colCount($cell.pos - $cell.start(-1)) + $cell.nodeAfter.attrs.colspan - 1;
|
|
135
135
|
resizeColumn(resizeState, colIndex, clientX - dragging.startX, dom);
|
|
136
136
|
updateControls()(state);
|
|
137
|
-
updateResizeHandles
|
|
137
|
+
// Remove updateResizeHandles
|
|
138
|
+
if (getBooleanFF('platform.editor.table-remove-update-resize-handles_djvab')) {} else {
|
|
139
|
+
updateResizeHandles(dom);
|
|
140
|
+
}
|
|
138
141
|
}
|
|
139
142
|
window.addEventListener('mouseup', finish);
|
|
140
143
|
window.addEventListener('mousemove', move);
|
|
@@ -85,6 +85,7 @@ export var TableCssClassName = _objectSpread(_objectSpread({}, TableSharedCssCla
|
|
|
85
85
|
RESIZING_PLUGIN: "".concat(tablePrefixSelector, "-resizing-plugin"),
|
|
86
86
|
RESIZE_CURSOR: "".concat(tablePrefixSelector, "-resize-cursor"),
|
|
87
87
|
IS_RESIZING: "".concat(tablePrefixSelector, "-is-resizing"),
|
|
88
|
+
// Resize handle is going to be removed together with updateResizeHandles - table's utility function
|
|
88
89
|
RESIZE_HANDLE: "".concat(tablePrefixSelector, "-resize-handle"),
|
|
89
90
|
RESIZE_HANDLE_DECORATION: "".concat(tablePrefixSelector, "-resize-decoration"),
|
|
90
91
|
CONTEXTUAL_SUBMENU: "".concat(tablePrefixSelector, "-contextual-submenu"),
|
|
@@ -120,16 +120,19 @@ export var getMousePositionVerticalRelativeByElement = function getMousePosition
|
|
|
120
120
|
}
|
|
121
121
|
return null;
|
|
122
122
|
};
|
|
123
|
+
|
|
124
|
+
// This function is deprecated
|
|
123
125
|
export var updateResizeHandles = function updateResizeHandles(tableRef) {
|
|
124
126
|
if (!tableRef) {
|
|
125
127
|
return;
|
|
126
128
|
}
|
|
127
|
-
|
|
129
|
+
|
|
128
130
|
// see ED-7600
|
|
129
131
|
var nodes = Array.from(tableRef.querySelectorAll(".".concat(ClassName.RESIZE_HANDLE)));
|
|
130
132
|
if (!nodes || !nodes.length) {
|
|
131
133
|
return;
|
|
132
134
|
}
|
|
135
|
+
var height = tableRef.offsetHeight + tableToolbarSize;
|
|
133
136
|
nodes.forEach(function (node) {
|
|
134
137
|
node.style.height = "".concat(height, "px");
|
|
135
138
|
});
|
|
@@ -9,8 +9,6 @@ interface TableResizerProps {
|
|
|
9
9
|
maxWidth: number;
|
|
10
10
|
containerWidth: number;
|
|
11
11
|
updateWidth: (width: number) => void;
|
|
12
|
-
onResizeStop: () => void;
|
|
13
|
-
onResizeStart: () => void;
|
|
14
12
|
editorView: EditorView;
|
|
15
13
|
getPos: () => number | undefined;
|
|
16
14
|
node: PMNode;
|
|
@@ -18,5 +16,5 @@ interface TableResizerProps {
|
|
|
18
16
|
displayGuideline: (guideline: GuidelineConfig[]) => boolean;
|
|
19
17
|
attachAnalyticsEvent: (payload: TableEventPayload) => ((tr: Transaction) => boolean) | undefined;
|
|
20
18
|
}
|
|
21
|
-
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth,
|
|
19
|
+
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, }: PropsWithChildren<TableResizerProps>) => JSX.Element;
|
|
22
20
|
export {};
|
|
@@ -3,5 +3,5 @@ import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-di
|
|
|
3
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
5
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
6
|
-
import { PluginConfig, PluginInjectionAPI } from '../types';
|
|
6
|
+
import type { PluginConfig, PluginInjectionAPI } from '../types';
|
|
7
7
|
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, breakoutEnabled?: boolean, fullWidthModeEnabled?: boolean, tableResizingEnabled?: boolean, previousFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI) => SafePlugin<import("../types").TablePluginState>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
2
|
-
import { ThemeProps } from '@atlaskit/theme/types';
|
|
2
|
+
import type { ThemeProps } from '@atlaskit/theme/types';
|
|
3
3
|
export declare const insertColumnButtonOffset: number;
|
|
4
4
|
export declare const tableStyles: (props: ThemeProps & {
|
|
5
5
|
featureFlags?: FeatureFlags;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementContentRects } from '../types';
|
|
1
|
+
import type { ElementContentRects } from '../types';
|
|
2
2
|
export declare const isCell: (node: HTMLElement | null) => boolean;
|
|
3
3
|
export declare const isCornerButton: (node: HTMLElement | null) => boolean;
|
|
4
4
|
export declare const isInsertRowButton: (node: HTMLElement | null) => boolean | HTMLElement | null;
|
|
@@ -9,8 +9,6 @@ interface TableResizerProps {
|
|
|
9
9
|
maxWidth: number;
|
|
10
10
|
containerWidth: number;
|
|
11
11
|
updateWidth: (width: number) => void;
|
|
12
|
-
onResizeStop: () => void;
|
|
13
|
-
onResizeStart: () => void;
|
|
14
12
|
editorView: EditorView;
|
|
15
13
|
getPos: () => number | undefined;
|
|
16
14
|
node: PMNode;
|
|
@@ -18,5 +16,5 @@ interface TableResizerProps {
|
|
|
18
16
|
displayGuideline: (guideline: GuidelineConfig[]) => boolean;
|
|
19
17
|
attachAnalyticsEvent: (payload: TableEventPayload) => ((tr: Transaction) => boolean) | undefined;
|
|
20
18
|
}
|
|
21
|
-
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth,
|
|
19
|
+
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, }: PropsWithChildren<TableResizerProps>) => JSX.Element;
|
|
22
20
|
export {};
|
|
@@ -3,5 +3,5 @@ import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-di
|
|
|
3
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
5
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
6
|
-
import { PluginConfig, PluginInjectionAPI } from '../types';
|
|
6
|
+
import type { PluginConfig, PluginInjectionAPI } from '../types';
|
|
7
7
|
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, breakoutEnabled?: boolean, fullWidthModeEnabled?: boolean, tableResizingEnabled?: boolean, previousFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI) => SafePlugin<import("../types").TablePluginState>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
2
|
-
import { ThemeProps } from '@atlaskit/theme/types';
|
|
2
|
+
import type { ThemeProps } from '@atlaskit/theme/types';
|
|
3
3
|
export declare const insertColumnButtonOffset: number;
|
|
4
4
|
export declare const tableStyles: (props: ThemeProps & {
|
|
5
5
|
featureFlags?: FeatureFlags;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementContentRects } from '../types';
|
|
1
|
+
import type { ElementContentRects } from '../types';
|
|
2
2
|
export declare const isCell: (node: HTMLElement | null) => boolean;
|
|
3
3
|
export declare const isCornerButton: (node: HTMLElement | null) => boolean;
|
|
4
4
|
export declare const isInsertRowButton: (node: HTMLElement | null) => boolean | HTMLElement | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.5",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/adf-schema": "^28.1.0",
|
|
31
|
-
"@atlaskit/editor-common": "^74.
|
|
31
|
+
"@atlaskit/editor-common": "^74.51.0",
|
|
32
32
|
"@atlaskit/editor-palette": "1.5.1",
|
|
33
33
|
"@atlaskit/editor-plugin-analytics": "^0.1.0",
|
|
34
34
|
"@atlaskit/editor-plugin-content-insertion": "^0.0.8",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@atlaskit/editor-plugin-decorations": "^0.1.0",
|
|
59
59
|
"@atlaskit/editor-plugin-feature-flags": "^0.1.3",
|
|
60
60
|
"@atlaskit/editor-plugin-grid": "^0.1.0",
|
|
61
|
-
"@atlaskit/editor-plugin-guideline": "^0.
|
|
61
|
+
"@atlaskit/editor-plugin-guideline": "^0.4.0",
|
|
62
62
|
"@atlaskit/editor-plugin-hyperlink": "^0.3.0",
|
|
63
63
|
"@atlaskit/editor-plugin-width": "^0.1.0",
|
|
64
64
|
"@atlaskit/editor-test-helpers": "^18.11.0",
|
|
@@ -105,6 +105,9 @@
|
|
|
105
105
|
},
|
|
106
106
|
"platform.editor.update-table-cell-width-via-step": {
|
|
107
107
|
"type": "boolean"
|
|
108
|
+
},
|
|
109
|
+
"platform.editor.table-remove-update-resize-handles_djvab": {
|
|
110
|
+
"type": "boolean"
|
|
108
111
|
}
|
|
109
112
|
}
|
|
110
113
|
}
|
|
@@ -89,33 +89,6 @@ export const ResizableTableContainer = ({
|
|
|
89
89
|
const marginLeftRef = useRef<number | undefined>(0);
|
|
90
90
|
const tableWidthRef = useRef<number>(akEditorDefaultLayoutWidth);
|
|
91
91
|
|
|
92
|
-
const updateContainerHeight = useCallback((height: number | 'auto') => {
|
|
93
|
-
containerRef.current?.style.setProperty(
|
|
94
|
-
'height',
|
|
95
|
-
typeof height === 'number' ? `${height + 29}px` : 'auto',
|
|
96
|
-
);
|
|
97
|
-
}, []);
|
|
98
|
-
|
|
99
|
-
const resizeObserverRef = useRef(
|
|
100
|
-
new ResizeObserver((entries) => {
|
|
101
|
-
updateContainerHeight(entries[entries.length - 1].contentRect.height);
|
|
102
|
-
}),
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
const onResizeStart = useCallback(() => {
|
|
106
|
-
updateContainerHeight(tableRef?.clientHeight);
|
|
107
|
-
|
|
108
|
-
if (tableRef) {
|
|
109
|
-
resizeObserverRef.current.observe(tableRef);
|
|
110
|
-
}
|
|
111
|
-
}, [tableRef, updateContainerHeight]);
|
|
112
|
-
|
|
113
|
-
const onResizeStop = useCallback(() => {
|
|
114
|
-
updateContainerHeight('auto');
|
|
115
|
-
|
|
116
|
-
resizeObserverRef.current.disconnect();
|
|
117
|
-
}, [updateContainerHeight]);
|
|
118
|
-
|
|
119
92
|
const updateWidth = useCallback(
|
|
120
93
|
(width: number) => {
|
|
121
94
|
if (!containerRef.current) {
|
|
@@ -184,8 +157,6 @@ export const ResizableTableContainer = ({
|
|
|
184
157
|
ref={containerRef}
|
|
185
158
|
>
|
|
186
159
|
<TableResizer
|
|
187
|
-
onResizeStart={onResizeStart}
|
|
188
|
-
onResizeStop={onResizeStop}
|
|
189
160
|
width={width}
|
|
190
161
|
maxWidth={maxResizerWidth}
|
|
191
162
|
containerWidth={containerWidth}
|
|
@@ -43,8 +43,6 @@ interface TableResizerProps {
|
|
|
43
43
|
maxWidth: number;
|
|
44
44
|
containerWidth: number;
|
|
45
45
|
updateWidth: (width: number) => void;
|
|
46
|
-
onResizeStop: () => void;
|
|
47
|
-
onResizeStart: () => void;
|
|
48
46
|
editorView: EditorView;
|
|
49
47
|
getPos: () => number | undefined;
|
|
50
48
|
node: PMNode;
|
|
@@ -122,8 +120,6 @@ export const TableResizer = ({
|
|
|
122
120
|
maxWidth,
|
|
123
121
|
containerWidth,
|
|
124
122
|
updateWidth,
|
|
125
|
-
onResizeStop,
|
|
126
|
-
onResizeStart,
|
|
127
123
|
editorView,
|
|
128
124
|
getPos,
|
|
129
125
|
node,
|
|
@@ -186,15 +182,7 @@ export const TableResizer = ({
|
|
|
186
182
|
containerWidth,
|
|
187
183
|
);
|
|
188
184
|
setSnappingEnabled(displayGuideline(visibleGuidelines));
|
|
189
|
-
|
|
190
|
-
onResizeStart();
|
|
191
|
-
}, [
|
|
192
|
-
displayGuideline,
|
|
193
|
-
editorView,
|
|
194
|
-
startMeasure,
|
|
195
|
-
onResizeStart,
|
|
196
|
-
containerWidth,
|
|
197
|
-
]);
|
|
185
|
+
}, [displayGuideline, editorView, startMeasure, containerWidth]);
|
|
198
186
|
|
|
199
187
|
const handleResize = useCallback(
|
|
200
188
|
(originalState, delta) => {
|
|
@@ -298,8 +286,6 @@ export const TableResizer = ({
|
|
|
298
286
|
updateWidth(newWidth);
|
|
299
287
|
scheduleResize.cancel();
|
|
300
288
|
|
|
301
|
-
onResizeStop();
|
|
302
|
-
|
|
303
289
|
return newWidth;
|
|
304
290
|
},
|
|
305
291
|
[
|
|
@@ -312,7 +298,6 @@ export const TableResizer = ({
|
|
|
312
298
|
displayGuideline,
|
|
313
299
|
attachAnalyticsEvent,
|
|
314
300
|
endMeasure,
|
|
315
|
-
onResizeStop,
|
|
316
301
|
],
|
|
317
302
|
);
|
|
318
303
|
|
|
@@ -26,8 +26,8 @@ import type {
|
|
|
26
26
|
getPosHandler,
|
|
27
27
|
} from '@atlaskit/editor-common/types';
|
|
28
28
|
import { browser, closestElement } from '@atlaskit/editor-common/utils';
|
|
29
|
-
import { Node as ProseMirrorNode } from '@atlaskit/editor-prosemirror/model';
|
|
30
|
-
import {
|
|
29
|
+
import type { Node as ProseMirrorNode } from '@atlaskit/editor-prosemirror/model';
|
|
30
|
+
import type {
|
|
31
31
|
EditorState,
|
|
32
32
|
TextSelection,
|
|
33
33
|
Transaction,
|
|
@@ -36,8 +36,9 @@ import {
|
|
|
36
36
|
findParentDomRefOfType,
|
|
37
37
|
findParentNodeOfType,
|
|
38
38
|
} from '@atlaskit/editor-prosemirror/utils';
|
|
39
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
39
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
40
40
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
41
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
41
42
|
|
|
42
43
|
import {
|
|
43
44
|
addBoldInEmptyHeaderCells,
|
|
@@ -66,13 +67,13 @@ import { createTableView } from '../nodeviews/table';
|
|
|
66
67
|
import TableCellNodeView from '../nodeviews/tableCell';
|
|
67
68
|
import { pluginKey as decorationsPluginKey } from '../pm-plugins/decorations/plugin';
|
|
68
69
|
import { fixTables, replaceSelectedTable } from '../transforms';
|
|
69
|
-
import {
|
|
70
|
-
TableCssClassName as ClassName,
|
|
70
|
+
import type {
|
|
71
71
|
ElementContentRects,
|
|
72
72
|
InvalidNodeAttr,
|
|
73
73
|
PluginConfig,
|
|
74
74
|
PluginInjectionAPI,
|
|
75
75
|
} from '../types';
|
|
76
|
+
import { TableCssClassName as ClassName } from '../types';
|
|
76
77
|
import {
|
|
77
78
|
findControlsHoverDecoration,
|
|
78
79
|
transformSliceToCorrectEmptyTableCells,
|
|
@@ -230,8 +231,16 @@ export const createPlugin = (
|
|
|
230
231
|
setTableRef(tableRef)(state, dispatch);
|
|
231
232
|
}
|
|
232
233
|
|
|
233
|
-
|
|
234
|
-
|
|
234
|
+
// Removes updateResizeHandles
|
|
235
|
+
if (
|
|
236
|
+
getBooleanFF(
|
|
237
|
+
'platform.editor.table-remove-update-resize-handles_djvab',
|
|
238
|
+
)
|
|
239
|
+
) {
|
|
240
|
+
} else {
|
|
241
|
+
if (pluginState.tableNode !== tableNode) {
|
|
242
|
+
updateResizeHandles(tableRef);
|
|
243
|
+
}
|
|
235
244
|
}
|
|
236
245
|
|
|
237
246
|
if (pluginState.editorHasFocus && pluginState.tableRef) {
|
|
@@ -215,7 +215,13 @@ export const handleMouseDown = (
|
|
|
215
215
|
resizeColumn(resizeState, colIndex, clientX - dragging.startX, dom);
|
|
216
216
|
|
|
217
217
|
updateControls()(state);
|
|
218
|
-
updateResizeHandles
|
|
218
|
+
// Remove updateResizeHandles
|
|
219
|
+
if (
|
|
220
|
+
getBooleanFF('platform.editor.table-remove-update-resize-handles_djvab')
|
|
221
|
+
) {
|
|
222
|
+
} else {
|
|
223
|
+
updateResizeHandles(dom);
|
|
224
|
+
}
|
|
219
225
|
}
|
|
220
226
|
|
|
221
227
|
window.addEventListener('mouseup', finish);
|
|
@@ -282,6 +282,7 @@ export const TableCssClassName = {
|
|
|
282
282
|
RESIZE_CURSOR: `${tablePrefixSelector}-resize-cursor`,
|
|
283
283
|
IS_RESIZING: `${tablePrefixSelector}-is-resizing`,
|
|
284
284
|
|
|
285
|
+
// Resize handle is going to be removed together with updateResizeHandles - table's utility function
|
|
285
286
|
RESIZE_HANDLE: `${tablePrefixSelector}-resize-handle`,
|
|
286
287
|
RESIZE_HANDLE_DECORATION: `${tablePrefixSelector}-resize-decoration`,
|
|
287
288
|
|
|
@@ -21,7 +21,7 @@ import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
|
21
21
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import { B300, N0, N20A, N300, N40A, R500 } from '@atlaskit/theme/colors';
|
|
23
23
|
import { fontSize } from '@atlaskit/theme/constants';
|
|
24
|
-
import { ThemeProps } from '@atlaskit/theme/types';
|
|
24
|
+
import type { ThemeProps } from '@atlaskit/theme/types';
|
|
25
25
|
import { token } from '@atlaskit/tokens';
|
|
26
26
|
|
|
27
27
|
import { TableCssClassName as ClassName } from '../types';
|
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
containsClassName,
|
|
4
4
|
} from '@atlaskit/editor-common/utils';
|
|
5
5
|
|
|
6
|
-
import { TableCssClassName as ClassName
|
|
6
|
+
import { TableCssClassName as ClassName } from '../types';
|
|
7
|
+
import type { ElementContentRects } from '../types';
|
|
7
8
|
import { tableToolbarSize } from '../ui/consts';
|
|
8
9
|
|
|
9
10
|
const SELECTOR_TABLE_LEAFS = `.${ClassName.TABLE_CELL}, .${ClassName.TABLE_HEADER_CELL}`;
|
|
@@ -154,11 +155,12 @@ export const getMousePositionVerticalRelativeByElement = (
|
|
|
154
155
|
return null;
|
|
155
156
|
};
|
|
156
157
|
|
|
158
|
+
// This function is deprecated
|
|
157
159
|
export const updateResizeHandles = (tableRef?: HTMLElement) => {
|
|
158
160
|
if (!tableRef) {
|
|
159
161
|
return;
|
|
160
162
|
}
|
|
161
|
-
|
|
163
|
+
|
|
162
164
|
// see ED-7600
|
|
163
165
|
const nodes = Array.from(
|
|
164
166
|
tableRef.querySelectorAll(
|
|
@@ -169,6 +171,7 @@ export const updateResizeHandles = (tableRef?: HTMLElement) => {
|
|
|
169
171
|
return;
|
|
170
172
|
}
|
|
171
173
|
|
|
174
|
+
const height = tableRef.offsetHeight + tableToolbarSize;
|
|
172
175
|
nodes.forEach((node) => {
|
|
173
176
|
node.style.height = `${height}px`;
|
|
174
177
|
});
|