@atlaskit/editor-plugin-table 5.8.6 → 6.0.0

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 6.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#67764](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67764) [`392964912fad`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/392964912fad) - Fixed incorrectly imported dependencies from src in the editor-plugin-table
8
+
9
+ ### Patch Changes
10
+
11
+ - [#67255](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67255) [`f73d19be272d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f73d19be272d) - Set pointer events to none on column controls while dragging. Fixes issue where column controls prevent drop targets from showing.
12
+
3
13
  ## 5.8.6
4
14
 
5
15
  ### Patch Changes
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.initiateKeyboardColumnResizing = exports.changeColumnWidthByStep = exports.activateNextResizeArea = void 0;
7
7
  var _styles = require("@atlaskit/editor-common/styles");
8
8
  var _editorTables = require("@atlaskit/editor-tables");
9
- var _utils = require("@atlaskit/editor-tables/src/utils");
9
+ var _utils = require("@atlaskit/editor-tables/utils");
10
10
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
11
  var _pluginFactory = require("../pm-plugins/table-resizing/plugin-factory");
12
12
  var _utils2 = require("../pm-plugins/table-resizing/utils");
@@ -46,7 +46,8 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
46
46
  isTableHovered = _ref.isTableHovered,
47
47
  canDrag = _ref.canDrag,
48
48
  tableContainerWidth = _ref.tableContainerWidth,
49
- isNumberColumnEnabled = _ref.isNumberColumnEnabled;
49
+ isNumberColumnEnabled = _ref.isNumberColumnEnabled,
50
+ isDragging = _ref.isDragging;
50
51
  var columnControlsRef = (0, _react.useRef)(null);
51
52
  var widths = (_colWidths$map$join = colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(function (width) {
52
53
  return (
@@ -205,7 +206,8 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
205
206
  gridTemplateColumns: widths,
206
207
  marginTop: marginTop,
207
208
  width: stickyTop ? containerWidth : undefined,
208
- overflowX: stickyTop ? 'hidden' : 'visible'
209
+ overflowX: stickyTop ? 'hidden' : 'visible',
210
+ pointerEvents: isDragging ? 'none' : undefined
209
211
  }
210
212
  }, !isResizing && columnParams.map(function (_ref2, index) {
211
213
  var startIndex = _ref2.startIndex,
@@ -42,8 +42,8 @@ var TableFloatingColumnControls = exports.TableFloatingColumnControls = function
42
42
  setTableRect = _useState2[1];
43
43
  var _useState3 = (0, _react.useState)(false),
44
44
  _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
45
- hasDropTargets = _useState4[0],
46
- setHasDropTargets = _useState4[1];
45
+ isDragging = _useState4[0],
46
+ setIsDragging = _useState4[1];
47
47
  var containerRef = (0, _react.useRef)(null);
48
48
  var node = getNode();
49
49
  var currentNodeLocalId = node === null || node === void 0 ? void 0 : node.attrs.localId;
@@ -91,10 +91,10 @@ var TableFloatingColumnControls = exports.TableFloatingColumnControls = function
91
91
  return type === 'table-column' && !!(indexes !== null && indexes !== void 0 && indexes.length) && localId === currentNodeLocalId;
92
92
  },
93
93
  onDragStart: function onDragStart() {
94
- setHasDropTargets(true);
94
+ setIsDragging(true);
95
95
  },
96
96
  onDrop: function onDrop() {
97
- setHasDropTargets(false);
97
+ setIsDragging(false);
98
98
  }
99
99
  });
100
100
  }, [editorView, currentNodeLocalId]);
@@ -137,8 +137,9 @@ var TableFloatingColumnControls = exports.TableFloatingColumnControls = function
137
137
  hasHeaderColumn: hasHeaderColumn,
138
138
  canDrag: canDrag,
139
139
  tableContainerWidth: tableContainerWidth,
140
- isNumberColumnEnabled: isNumberColumnEnabled
141
- }), hasDropTargets && /*#__PURE__*/_react.default.createElement(_ColumnDropTargets.ColumnDropTargets, {
140
+ isNumberColumnEnabled: isNumberColumnEnabled,
141
+ isDragging: isDragging
142
+ }), isDragging && /*#__PURE__*/_react.default.createElement(_ColumnDropTargets.ColumnDropTargets, {
142
143
  tableRef: tableRef,
143
144
  stickyTop: tableActive ? stickyTop : undefined,
144
145
  tableHeight: tableRect.height,
@@ -1,6 +1,6 @@
1
1
  import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
2
2
  import { TableMap } from '@atlaskit/editor-tables';
3
- import { findCellClosestToPos, findCellRectClosestToPos, findTableClosestToPos, getSelectionRect, isSelectionType, nextCell } from '@atlaskit/editor-tables/src/utils';
3
+ import { findCellClosestToPos, findCellRectClosestToPos, findTableClosestToPos, getSelectionRect, isSelectionType, nextCell } from '@atlaskit/editor-tables/utils';
4
4
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
5
  import { getPluginState as getTableResizingPluginState, createCommand as tableResizingPluginCreateCommand } from '../pm-plugins/table-resizing/plugin-factory';
6
6
  import { currentColWidth, getResizeState, getTableMaxWidth, resizeColumn, updateControls } from '../pm-plugins/table-resizing/utils';
@@ -36,7 +36,8 @@ export const ColumnControls = ({
36
36
  isTableHovered,
37
37
  canDrag,
38
38
  tableContainerWidth,
39
- isNumberColumnEnabled
39
+ isNumberColumnEnabled,
40
+ isDragging
40
41
  }) => {
41
42
  var _colWidths$map$join, _rowHeights$;
42
43
  const columnControlsRef = useRef(null);
@@ -202,7 +203,8 @@ export const ColumnControls = ({
202
203
  gridTemplateColumns: widths,
203
204
  marginTop,
204
205
  width: stickyTop ? containerWidth : undefined,
205
- overflowX: stickyTop ? 'hidden' : 'visible'
206
+ overflowX: stickyTop ? 'hidden' : 'visible',
207
+ pointerEvents: isDragging ? 'none' : undefined
206
208
  }
207
209
  }, !isResizing && columnParams.map(({
208
210
  startIndex,
@@ -24,7 +24,7 @@ export const TableFloatingColumnControls = ({
24
24
  width: 0,
25
25
  height: 0
26
26
  });
27
- const [hasDropTargets, setHasDropTargets] = useState(false);
27
+ const [isDragging, setIsDragging] = useState(false);
28
28
  const containerRef = useRef(null);
29
29
  const node = getNode();
30
30
  const currentNodeLocalId = node === null || node === void 0 ? void 0 : node.attrs.localId;
@@ -62,10 +62,10 @@ export const TableFloatingColumnControls = ({
62
62
  return type === 'table-column' && !!(indexes !== null && indexes !== void 0 && indexes.length) && localId === currentNodeLocalId;
63
63
  },
64
64
  onDragStart() {
65
- setHasDropTargets(true);
65
+ setIsDragging(true);
66
66
  },
67
67
  onDrop() {
68
- setHasDropTargets(false);
68
+ setIsDragging(false);
69
69
  }
70
70
  });
71
71
  }, [editorView, currentNodeLocalId]);
@@ -108,8 +108,9 @@ export const TableFloatingColumnControls = ({
108
108
  hasHeaderColumn: hasHeaderColumn,
109
109
  canDrag: canDrag,
110
110
  tableContainerWidth: tableContainerWidth,
111
- isNumberColumnEnabled: isNumberColumnEnabled
112
- }), hasDropTargets && /*#__PURE__*/React.createElement(ColumnDropTargets, {
111
+ isNumberColumnEnabled: isNumberColumnEnabled,
112
+ isDragging: isDragging
113
+ }), isDragging && /*#__PURE__*/React.createElement(ColumnDropTargets, {
113
114
  tableRef: tableRef,
114
115
  stickyTop: tableActive ? stickyTop : undefined,
115
116
  tableHeight: tableRect.height,
@@ -1,6 +1,6 @@
1
1
  import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
2
2
  import { TableMap } from '@atlaskit/editor-tables';
3
- import { findCellClosestToPos, findCellRectClosestToPos, findTableClosestToPos, getSelectionRect, isSelectionType, nextCell } from '@atlaskit/editor-tables/src/utils';
3
+ import { findCellClosestToPos, findCellRectClosestToPos, findTableClosestToPos, getSelectionRect, isSelectionType, nextCell } from '@atlaskit/editor-tables/utils';
4
4
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
5
  import { getPluginState as getTableResizingPluginState, createCommand as tableResizingPluginCreateCommand } from '../pm-plugins/table-resizing/plugin-factory';
6
6
  import { currentColWidth, getResizeState, getTableMaxWidth, resizeColumn, updateControls } from '../pm-plugins/table-resizing/utils';
@@ -37,7 +37,8 @@ export var ColumnControls = function ColumnControls(_ref) {
37
37
  isTableHovered = _ref.isTableHovered,
38
38
  canDrag = _ref.canDrag,
39
39
  tableContainerWidth = _ref.tableContainerWidth,
40
- isNumberColumnEnabled = _ref.isNumberColumnEnabled;
40
+ isNumberColumnEnabled = _ref.isNumberColumnEnabled,
41
+ isDragging = _ref.isDragging;
41
42
  var columnControlsRef = useRef(null);
42
43
  var widths = (_colWidths$map$join = colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(function (width) {
43
44
  return (
@@ -196,7 +197,8 @@ export var ColumnControls = function ColumnControls(_ref) {
196
197
  gridTemplateColumns: widths,
197
198
  marginTop: marginTop,
198
199
  width: stickyTop ? containerWidth : undefined,
199
- overflowX: stickyTop ? 'hidden' : 'visible'
200
+ overflowX: stickyTop ? 'hidden' : 'visible',
201
+ pointerEvents: isDragging ? 'none' : undefined
200
202
  }
201
203
  }, !isResizing && columnParams.map(function (_ref2, index) {
202
204
  var startIndex = _ref2.startIndex,
@@ -32,8 +32,8 @@ export var TableFloatingColumnControls = function TableFloatingColumnControls(_r
32
32
  setTableRect = _useState2[1];
33
33
  var _useState3 = useState(false),
34
34
  _useState4 = _slicedToArray(_useState3, 2),
35
- hasDropTargets = _useState4[0],
36
- setHasDropTargets = _useState4[1];
35
+ isDragging = _useState4[0],
36
+ setIsDragging = _useState4[1];
37
37
  var containerRef = useRef(null);
38
38
  var node = getNode();
39
39
  var currentNodeLocalId = node === null || node === void 0 ? void 0 : node.attrs.localId;
@@ -81,10 +81,10 @@ export var TableFloatingColumnControls = function TableFloatingColumnControls(_r
81
81
  return type === 'table-column' && !!(indexes !== null && indexes !== void 0 && indexes.length) && localId === currentNodeLocalId;
82
82
  },
83
83
  onDragStart: function onDragStart() {
84
- setHasDropTargets(true);
84
+ setIsDragging(true);
85
85
  },
86
86
  onDrop: function onDrop() {
87
- setHasDropTargets(false);
87
+ setIsDragging(false);
88
88
  }
89
89
  });
90
90
  }, [editorView, currentNodeLocalId]);
@@ -127,8 +127,9 @@ export var TableFloatingColumnControls = function TableFloatingColumnControls(_r
127
127
  hasHeaderColumn: hasHeaderColumn,
128
128
  canDrag: canDrag,
129
129
  tableContainerWidth: tableContainerWidth,
130
- isNumberColumnEnabled: isNumberColumnEnabled
131
- }), hasDropTargets && /*#__PURE__*/React.createElement(ColumnDropTargets, {
130
+ isNumberColumnEnabled: isNumberColumnEnabled,
131
+ isDragging: isDragging
132
+ }), isDragging && /*#__PURE__*/React.createElement(ColumnDropTargets, {
132
133
  tableRef: tableRef,
133
134
  stickyTop: tableActive ? stickyTop : undefined,
134
135
  tableHeight: tableRect.height,
@@ -1,5 +1,5 @@
1
1
  import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
2
- import type { Direction } from '@atlaskit/editor-tables/src/types';
2
+ import type { Direction } from '@atlaskit/editor-tables/types';
3
3
  export declare const initiateKeyboardColumnResizing: Command;
4
4
  export declare const activateNextResizeArea: (direction: Direction) => Command;
5
5
  export declare const changeColumnWidthByStep: (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth) => Command;
@@ -17,6 +17,7 @@ export interface ColumnControlsProps {
17
17
  canDrag?: boolean;
18
18
  tableContainerWidth?: number;
19
19
  isNumberColumnEnabled?: boolean;
20
+ isDragging?: boolean;
20
21
  }
21
- export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, hasHeaderColumn, isTableHovered, canDrag, tableContainerWidth, isNumberColumnEnabled, }: ColumnControlsProps) => JSX.Element;
22
+ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, hasHeaderColumn, isTableHovered, canDrag, tableContainerWidth, isNumberColumnEnabled, isDragging, }: ColumnControlsProps) => JSX.Element;
22
23
  export default ColumnControls;
@@ -1,5 +1,5 @@
1
1
  import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
2
- import type { Direction } from '@atlaskit/editor-tables/src/types';
2
+ import type { Direction } from '@atlaskit/editor-tables/types';
3
3
  export declare const initiateKeyboardColumnResizing: Command;
4
4
  export declare const activateNextResizeArea: (direction: Direction) => Command;
5
5
  export declare const changeColumnWidthByStep: (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth) => Command;
@@ -17,6 +17,7 @@ export interface ColumnControlsProps {
17
17
  canDrag?: boolean;
18
18
  tableContainerWidth?: number;
19
19
  isNumberColumnEnabled?: boolean;
20
+ isDragging?: boolean;
20
21
  }
21
- export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, hasHeaderColumn, isTableHovered, canDrag, tableContainerWidth, isNumberColumnEnabled, }: ColumnControlsProps) => JSX.Element;
22
+ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, hasHeaderColumn, isTableHovered, canDrag, tableContainerWidth, isNumberColumnEnabled, isDragging, }: ColumnControlsProps) => JSX.Element;
22
23
  export default ColumnControls;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "5.8.6",
3
+ "version": "6.0.0",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -4,10 +4,7 @@ import type {
4
4
  GetEditorContainerWidth,
5
5
  } from '@atlaskit/editor-common/types';
6
6
  import { TableMap } from '@atlaskit/editor-tables';
7
- import type {
8
- CellAttributes,
9
- Direction,
10
- } from '@atlaskit/editor-tables/src/types';
7
+ import type { CellAttributes, Direction } from '@atlaskit/editor-tables/types';
11
8
  import {
12
9
  findCellClosestToPos,
13
10
  findCellRectClosestToPos,
@@ -15,7 +12,7 @@ import {
15
12
  getSelectionRect,
16
13
  isSelectionType,
17
14
  nextCell,
18
- } from '@atlaskit/editor-tables/src/utils';
15
+ } from '@atlaskit/editor-tables/utils';
19
16
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
20
17
 
21
18
  import {
@@ -39,6 +39,7 @@ export interface ColumnControlsProps {
39
39
  canDrag?: boolean;
40
40
  tableContainerWidth?: number;
41
41
  isNumberColumnEnabled?: boolean;
42
+ isDragging?: boolean;
42
43
  }
43
44
 
44
45
  const getSelectedColumns = (selection: Selection) => {
@@ -68,6 +69,7 @@ export const ColumnControls = ({
68
69
  canDrag,
69
70
  tableContainerWidth,
70
71
  isNumberColumnEnabled,
72
+ isDragging,
71
73
  }: ColumnControlsProps) => {
72
74
  const columnControlsRef = useRef<HTMLDivElement>(null);
73
75
  const widths =
@@ -300,6 +302,7 @@ export const ColumnControls = ({
300
302
  isNumberColumnEnabled && tableContainerWidth
301
303
  ? tableContainerWidth - akEditorTableNumberColumnWidth
302
304
  : tableContainerWidth;
305
+
303
306
  return (
304
307
  <div
305
308
  className={ClassName.DRAG_COLUMN_CONTROLS}
@@ -314,6 +317,7 @@ export const ColumnControls = ({
314
317
  marginTop,
315
318
  width: stickyTop ? containerWidth : undefined,
316
319
  overflowX: stickyTop ? 'hidden' : 'visible',
320
+ pointerEvents: isDragging ? 'none' : undefined,
317
321
  }}
318
322
  >
319
323
  {!isResizing &&
@@ -59,7 +59,7 @@ export const TableFloatingColumnControls: React.FC<Props> = ({
59
59
  const [tableRect, setTableRect] = useState<{ width: number; height: number }>(
60
60
  { width: 0, height: 0 },
61
61
  );
62
- const [hasDropTargets, setHasDropTargets] = useState(false);
62
+ const [isDragging, setIsDragging] = useState(false);
63
63
  const containerRef = useRef<HTMLDivElement>(null);
64
64
 
65
65
  const node = getNode();
@@ -105,10 +105,10 @@ export const TableFloatingColumnControls: React.FC<Props> = ({
105
105
  );
106
106
  },
107
107
  onDragStart() {
108
- setHasDropTargets(true);
108
+ setIsDragging(true);
109
109
  },
110
110
  onDrop() {
111
- setHasDropTargets(false);
111
+ setIsDragging(false);
112
112
  },
113
113
  });
114
114
  }, [editorView, currentNodeLocalId]);
@@ -160,8 +160,9 @@ export const TableFloatingColumnControls: React.FC<Props> = ({
160
160
  canDrag={canDrag}
161
161
  tableContainerWidth={tableContainerWidth}
162
162
  isNumberColumnEnabled={isNumberColumnEnabled}
163
+ isDragging={isDragging}
163
164
  />
164
- {hasDropTargets && (
165
+ {isDragging && (
165
166
  <ColumnDropTargets
166
167
  tableRef={tableRef}
167
168
  stickyTop={tableActive ? stickyTop : undefined}