@atlaskit/editor-plugin-table 5.4.16 → 5.4.17

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,12 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 5.4.17
4
+
5
+ ### Patch Changes
6
+
7
+ - [#59009](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/59009) [`f7e9d874ff37`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f7e9d874ff37) - Fix table expand selection when `platform.editor.table-shift-click-selection-backward` FF is enabled
8
+ - [#58768](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58768) [`a300aa54a8e9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a300aa54a8e9) - [ux] Fixes resize handle state when column is in danger
9
+
3
10
  ## 5.4.16
4
11
 
5
12
  ### Patch Changes
@@ -106,7 +106,8 @@ var hoverTable = exports.hoverTable = function hoverTable(isInDanger, isSelected
106
106
  decorationSet: (0, _utils2.updatePluginStateDecorations)(state, decorations, _types.TableDecorations.TABLE_CONTROLS_HOVER),
107
107
  hoveredColumns: hoveredColumns,
108
108
  hoveredRows: hoveredRows,
109
- isInDanger: isInDanger
109
+ isInDanger: isInDanger,
110
+ isWholeTableInDanger: isInDanger
110
111
  }
111
112
  };
112
113
  }, function (tr) {
@@ -119,7 +120,8 @@ var clearHoverSelection = exports.clearHoverSelection = function clearHoverSelec
119
120
  type: 'CLEAR_HOVER_SELECTION',
120
121
  data: {
121
122
  decorationSet: (0, _utils2.updatePluginStateDecorations)(state, [], _types.TableDecorations.ALL_CONTROLS_HOVER),
122
- isInDanger: false
123
+ isInDanger: false,
124
+ isWholeTableInDanger: false
123
125
  }
124
126
  };
125
127
  });
@@ -286,7 +286,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
286
286
  _this.containerWidth = _containerWidth;
287
287
  _this.isInitialOverflowSent = false;
288
288
 
289
- // store table size using previous full-width mode so can detect if it has changed
289
+ // store table size using previous full-width mode so can detect if it has changed.
290
290
  var isFullWidthModeEnabled = _options ? _options.wasFullWidthModeEnabled : false;
291
291
  _this.layoutSize = _this.tableNodeLayoutSize(_this.node, _containerWidth.width, {
292
292
  isFullWidthModeEnabled: isFullWidthModeEnabled
@@ -105,7 +105,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
105
105
  var resizerMinWidth = getResizerMinWidth(node);
106
106
  var handleSize = getResizerHandleHeight(tableRef);
107
107
  var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
108
- isInDanger = _getPluginState.isInDanger;
108
+ isWholeTableInDanger = _getPluginState.isWholeTableInDanger;
109
109
  var _useMeasureFramerate = (0, _analytics2.useMeasureFramerate)(),
110
110
  startMeasure = _useMeasureFramerate.startMeasure,
111
111
  endMeasure = _useMeasureFramerate.endMeasure,
@@ -252,7 +252,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
252
252
  snap: guidelineSnaps,
253
253
  handlePositioning: "adjacent",
254
254
  isHandleVisible: isTableSelected,
255
- appearance: isInDanger && isTableSelected ? 'danger' : undefined,
255
+ appearance: isTableSelected && isWholeTableInDanger ? 'danger' : undefined,
256
256
  handleHighlight: "shadow",
257
257
  handleTooltipContent: formatMessage(_messages.tableMessages.resizeTable)
258
258
  }, children);
@@ -82,8 +82,8 @@ var DragMenu = exports.DragMenu = function DragMenu(_ref) {
82
82
  var selection = state.selection;
83
83
  var selectionRect = (0, _utils.isSelectionType)(selection, 'cell') ? (0, _utils.getSelectionRect)(selection) : (0, _utils.findCellRectClosestToPos)(selection.$from);
84
84
  var hasMergedCells = direction === 'row' ? _utils2.hasMergedCellsInRow : _utils2.hasMergedCellsInColumn;
85
- var mergedCells = index !== undefined && hasMergedCells(index)(selection);
86
- var dragMenuConfig = (0, _dragMenu.getDragMenuConfig)(direction, getEditorContainerWidth, mergedCells, tableMap, index, targetCellPosition, selectionRect);
85
+ var shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
86
+ var dragMenuConfig = (0, _dragMenu.getDragMenuConfig)(direction, getEditorContainerWidth, shouldMoveDisabled, tableMap, index, targetCellPosition, selectionRect);
87
87
  var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig),
88
88
  menuItems = _convertToDropdownIte.menuItems,
89
89
  menuCallback = _convertToDropdownIte.menuCallback;
@@ -85,7 +85,8 @@ export const hoverTable = (isInDanger, isSelected) => createCommand(state => {
85
85
  decorationSet: updatePluginStateDecorations(state, decorations, TableDecorations.TABLE_CONTROLS_HOVER),
86
86
  hoveredColumns,
87
87
  hoveredRows,
88
- isInDanger
88
+ isInDanger,
89
+ isWholeTableInDanger: isInDanger
89
90
  }
90
91
  };
91
92
  }, tr => tr.setMeta('addToHistory', false));
@@ -93,7 +94,8 @@ export const clearHoverSelection = () => createCommand(state => ({
93
94
  type: 'CLEAR_HOVER_SELECTION',
94
95
  data: {
95
96
  decorationSet: updatePluginStateDecorations(state, [], TableDecorations.ALL_CONTROLS_HOVER),
96
- isInDanger: false
97
+ isInDanger: false,
98
+ isWholeTableInDanger: false
97
99
  }
98
100
  }));
99
101
  export const showResizeHandleLine = cellColumnPositioning => createCommand(state => ({
@@ -284,7 +284,7 @@ class TableComponent extends React.Component {
284
284
  this.containerWidth = _containerWidth;
285
285
  this.isInitialOverflowSent = false;
286
286
 
287
- // store table size using previous full-width mode so can detect if it has changed
287
+ // store table size using previous full-width mode so can detect if it has changed.
288
288
  const isFullWidthModeEnabled = _options ? _options.wasFullWidthModeEnabled : false;
289
289
  this.layoutSize = this.tableNodeLayoutSize(this.node, _containerWidth.width, {
290
290
  isFullWidthModeEnabled
@@ -90,7 +90,7 @@ export const TableResizer = ({
90
90
  const resizerMinWidth = getResizerMinWidth(node);
91
91
  const handleSize = getResizerHandleHeight(tableRef);
92
92
  const {
93
- isInDanger
93
+ isWholeTableInDanger
94
94
  } = getPluginState(editorView.state);
95
95
  const {
96
96
  startMeasure,
@@ -247,7 +247,7 @@ export const TableResizer = ({
247
247
  snap: guidelineSnaps,
248
248
  handlePositioning: "adjacent",
249
249
  isHandleVisible: isTableSelected,
250
- appearance: isInDanger && isTableSelected ? 'danger' : undefined,
250
+ appearance: isTableSelected && isWholeTableInDanger ? 'danger' : undefined,
251
251
  handleHighlight: "shadow",
252
252
  handleTooltipContent: formatMessage(messages.resizeTable)
253
253
  }, children);
@@ -73,8 +73,8 @@ export const DragMenu = ({
73
73
  } = state;
74
74
  const selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
75
75
  const hasMergedCells = direction === 'row' ? hasMergedCellsInRow : hasMergedCellsInColumn;
76
- const mergedCells = index !== undefined && hasMergedCells(index)(selection);
77
- const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, mergedCells, tableMap, index, targetCellPosition, selectionRect);
76
+ const shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
77
+ const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, shouldMoveDisabled, tableMap, index, targetCellPosition, selectionRect);
78
78
  const {
79
79
  menuItems,
80
80
  menuCallback
@@ -99,7 +99,8 @@ export var hoverTable = function hoverTable(isInDanger, isSelected) {
99
99
  decorationSet: updatePluginStateDecorations(state, decorations, TableDecorations.TABLE_CONTROLS_HOVER),
100
100
  hoveredColumns: hoveredColumns,
101
101
  hoveredRows: hoveredRows,
102
- isInDanger: isInDanger
102
+ isInDanger: isInDanger,
103
+ isWholeTableInDanger: isInDanger
103
104
  }
104
105
  };
105
106
  }, function (tr) {
@@ -112,7 +113,8 @@ export var clearHoverSelection = function clearHoverSelection() {
112
113
  type: 'CLEAR_HOVER_SELECTION',
113
114
  data: {
114
115
  decorationSet: updatePluginStateDecorations(state, [], TableDecorations.ALL_CONTROLS_HOVER),
115
- isInDanger: false
116
+ isInDanger: false,
117
+ isWholeTableInDanger: false
116
118
  }
117
119
  };
118
120
  });
@@ -279,7 +279,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
279
279
  _this.containerWidth = _containerWidth;
280
280
  _this.isInitialOverflowSent = false;
281
281
 
282
- // store table size using previous full-width mode so can detect if it has changed
282
+ // store table size using previous full-width mode so can detect if it has changed.
283
283
  var isFullWidthModeEnabled = _options ? _options.wasFullWidthModeEnabled : false;
284
284
  _this.layoutSize = _this.tableNodeLayoutSize(_this.node, _containerWidth.width, {
285
285
  isFullWidthModeEnabled: isFullWidthModeEnabled
@@ -95,7 +95,7 @@ export var TableResizer = function TableResizer(_ref) {
95
95
  var resizerMinWidth = getResizerMinWidth(node);
96
96
  var handleSize = getResizerHandleHeight(tableRef);
97
97
  var _getPluginState = getPluginState(editorView.state),
98
- isInDanger = _getPluginState.isInDanger;
98
+ isWholeTableInDanger = _getPluginState.isWholeTableInDanger;
99
99
  var _useMeasureFramerate = useMeasureFramerate(),
100
100
  startMeasure = _useMeasureFramerate.startMeasure,
101
101
  endMeasure = _useMeasureFramerate.endMeasure,
@@ -242,7 +242,7 @@ export var TableResizer = function TableResizer(_ref) {
242
242
  snap: guidelineSnaps,
243
243
  handlePositioning: "adjacent",
244
244
  isHandleVisible: isTableSelected,
245
- appearance: isInDanger && isTableSelected ? 'danger' : undefined,
245
+ appearance: isTableSelected && isWholeTableInDanger ? 'danger' : undefined,
246
246
  handleHighlight: "shadow",
247
247
  handleTooltipContent: formatMessage(messages.resizeTable)
248
248
  }, children);
@@ -74,8 +74,8 @@ export var DragMenu = function DragMenu(_ref) {
74
74
  var selection = state.selection;
75
75
  var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
76
76
  var hasMergedCells = direction === 'row' ? hasMergedCellsInRow : hasMergedCellsInColumn;
77
- var mergedCells = index !== undefined && hasMergedCells(index)(selection);
78
- var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, mergedCells, tableMap, index, targetCellPosition, selectionRect);
77
+ var shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
78
+ var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, shouldMoveDisabled, tableMap, index, targetCellPosition, selectionRect);
79
79
  var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig),
80
80
  menuItems = _convertToDropdownIte.menuItems,
81
81
  menuCallback = _convertToDropdownIte.menuCallback;
@@ -64,6 +64,7 @@ export interface TablePluginState {
64
64
  tableWrapperTarget?: HTMLElement;
65
65
  isContextualMenuOpen?: boolean;
66
66
  isInDanger?: boolean;
67
+ isWholeTableInDanger?: boolean;
67
68
  insertColumnButtonIndex?: number;
68
69
  insertRowButtonIndex?: number;
69
70
  isFullWidthModeEnabled?: boolean;
@@ -64,6 +64,7 @@ export interface TablePluginState {
64
64
  tableWrapperTarget?: HTMLElement;
65
65
  isContextualMenuOpen?: boolean;
66
66
  isInDanger?: boolean;
67
+ isWholeTableInDanger?: boolean;
67
68
  insertColumnButtonIndex?: number;
68
69
  insertRowButtonIndex?: number;
69
70
  isFullWidthModeEnabled?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "5.4.16",
3
+ "version": "5.4.17",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -157,6 +157,7 @@ export const hoverTable = (isInDanger?: boolean, isSelected?: boolean) =>
157
157
  hoveredColumns,
158
158
  hoveredRows,
159
159
  isInDanger,
160
+ isWholeTableInDanger: isInDanger,
160
161
  },
161
162
  };
162
163
  },
@@ -173,6 +174,7 @@ export const clearHoverSelection = () =>
173
174
  TableDecorations.ALL_CONTROLS_HOVER,
174
175
  ),
175
176
  isInDanger: false,
177
+ isWholeTableInDanger: false,
176
178
  },
177
179
  }));
178
180
 
@@ -143,7 +143,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
143
143
  this.containerWidth = containerWidth;
144
144
  this.isInitialOverflowSent = false;
145
145
 
146
- // store table size using previous full-width mode so can detect if it has changed
146
+ // store table size using previous full-width mode so can detect if it has changed.
147
147
  const isFullWidthModeEnabled = options
148
148
  ? options.wasFullWidthModeEnabled
149
149
  : false;
@@ -155,7 +155,7 @@ export const TableResizer = ({
155
155
 
156
156
  const resizerMinWidth = getResizerMinWidth(node);
157
157
  const handleSize = getResizerHandleHeight(tableRef);
158
- const { isInDanger } = getPluginState(editorView.state);
158
+ const { isWholeTableInDanger } = getPluginState(editorView.state);
159
159
 
160
160
  const { startMeasure, endMeasure, countFrames } = useMeasureFramerate();
161
161
 
@@ -394,7 +394,9 @@ export const TableResizer = ({
394
394
  snap={guidelineSnaps}
395
395
  handlePositioning="adjacent"
396
396
  isHandleVisible={isTableSelected}
397
- appearance={isInDanger && isTableSelected ? 'danger' : undefined}
397
+ appearance={
398
+ isTableSelected && isWholeTableInDanger ? 'danger' : undefined
399
+ }
398
400
  handleHighlight="shadow"
399
401
  handleTooltipContent={formatMessage(messages.resizeTable)}
400
402
  >
@@ -109,6 +109,7 @@ export interface TablePluginState {
109
109
  tableWrapperTarget?: HTMLElement;
110
110
  isContextualMenuOpen?: boolean;
111
111
  isInDanger?: boolean;
112
+ isWholeTableInDanger?: boolean;
112
113
  insertColumnButtonIndex?: number;
113
114
  insertRowButtonIndex?: number;
114
115
  isFullWidthModeEnabled?: boolean;
@@ -131,12 +131,13 @@ export const DragMenu = ({
131
131
  const hasMergedCells =
132
132
  direction === 'row' ? hasMergedCellsInRow : hasMergedCellsInColumn;
133
133
 
134
- const mergedCells = index !== undefined && hasMergedCells(index)(selection);
134
+ const shouldMoveDisabled =
135
+ index !== undefined && hasMergedCells(index)(selection);
135
136
 
136
137
  const dragMenuConfig = getDragMenuConfig(
137
138
  direction,
138
139
  getEditorContainerWidth,
139
- mergedCells,
140
+ shouldMoveDisabled,
140
141
  tableMap,
141
142
  index,
142
143
  targetCellPosition,