@atlaskit/editor-plugin-table 2.10.4 → 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 +6 -0
- package/dist/cjs/plugins/table/nodeviews/TableContainer.js +0 -19
- package/dist/cjs/plugins/table/nodeviews/TableResizer.js +2 -6
- package/dist/es2019/plugins/table/nodeviews/TableContainer.js +0 -19
- package/dist/es2019/plugins/table/nodeviews/TableResizer.js +2 -6
- package/dist/esm/plugins/table/nodeviews/TableContainer.js +0 -19
- package/dist/esm/plugins/table/nodeviews/TableResizer.js +2 -6
- package/dist/types/plugins/table/nodeviews/TableResizer.d.ts +1 -3
- package/dist/types-ts4.5/plugins/table/nodeviews/TableResizer.d.ts +1 -3
- package/package.json +3 -3
- package/src/plugins/table/nodeviews/TableContainer.tsx +0 -29
- package/src/plugins/table/nodeviews/TableResizer.tsx +1 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
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
|
+
|
|
3
9
|
## 2.10.4
|
|
4
10
|
|
|
5
11
|
### 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", {
|
|
@@ -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,
|
|
@@ -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", {
|
|
@@ -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 {};
|
|
@@ -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 {};
|
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",
|
|
@@ -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
|
|