@atlaskit/editor-plugin-table 7.5.0 → 7.5.2

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,17 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#79502](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/79502) [`be5350055f7a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/be5350055f7a) - [ux] Fix switch focused table cause a crash
8
+
9
+ ## 7.5.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#75947](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75947) [`43549c3789b1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/43549c3789b1) - Migrate @atlaskit/editor-core to use declarative entry points
14
+
3
15
  ## 7.5.0
4
16
 
5
17
  ### Minor Changes
@@ -234,8 +234,13 @@ var checkEdgeHasMergedCells = exports.checkEdgeHasMergedCells = function checkEd
234
234
  var maxIndex = Math.max.apply(Math, (0, _toConsumableArray2.default)(indexes));
235
235
  var isTopSideHaveMergedCells = false;
236
236
  var isBottomSideHaveMergedCells = false;
237
- var isOldMinIndex = !map[minIndex - 1] && !map[minIndex];
238
- var isOldMaxIndex = !map[maxIndex + 1] && !map[maxIndex];
237
+
238
+ /**
239
+ * this is to check if the cell position from last focused table is overflow. since if you selection from a cell in 6th row and 7th column cell in a 7x8 table to 3x3 table, the cell position will be overflow because new table dont have this cell at all.
240
+ TODO: ED-22335 this should better called only when hover over the drag handle.
241
+ */
242
+ var isOldMinIndex = !map[minIndex - 1] || !map[minIndex];
243
+ var isOldMaxIndex = !map[maxIndex + 1] || !map[maxIndex];
239
244
  if (minIndex > 0 && !isOldMinIndex) {
240
245
  var prevSelectionSet = map[minIndex - 1];
241
246
  var minSelectionSet = map[minIndex];
@@ -212,8 +212,13 @@ export const checkEdgeHasMergedCells = (indexes, tableMap, direction) => {
212
212
  let maxIndex = Math.max(...indexes);
213
213
  let isTopSideHaveMergedCells = false;
214
214
  let isBottomSideHaveMergedCells = false;
215
- let isOldMinIndex = !map[minIndex - 1] && !map[minIndex];
216
- let isOldMaxIndex = !map[maxIndex + 1] && !map[maxIndex];
215
+
216
+ /**
217
+ * this is to check if the cell position from last focused table is overflow. since if you selection from a cell in 6th row and 7th column cell in a 7x8 table to 3x3 table, the cell position will be overflow because new table dont have this cell at all.
218
+ TODO: ED-22335 this should better called only when hover over the drag handle.
219
+ */
220
+ let isOldMinIndex = !map[minIndex - 1] || !map[minIndex];
221
+ let isOldMaxIndex = !map[maxIndex + 1] || !map[maxIndex];
217
222
  if (minIndex > 0 && !isOldMinIndex) {
218
223
  const prevSelectionSet = map[minIndex - 1];
219
224
  const minSelectionSet = map[minIndex];
@@ -227,8 +227,13 @@ export var checkEdgeHasMergedCells = function checkEdgeHasMergedCells(indexes, t
227
227
  var maxIndex = Math.max.apply(Math, _toConsumableArray(indexes));
228
228
  var isTopSideHaveMergedCells = false;
229
229
  var isBottomSideHaveMergedCells = false;
230
- var isOldMinIndex = !map[minIndex - 1] && !map[minIndex];
231
- var isOldMaxIndex = !map[maxIndex + 1] && !map[maxIndex];
230
+
231
+ /**
232
+ * this is to check if the cell position from last focused table is overflow. since if you selection from a cell in 6th row and 7th column cell in a 7x8 table to 3x3 table, the cell position will be overflow because new table dont have this cell at all.
233
+ TODO: ED-22335 this should better called only when hover over the drag handle.
234
+ */
235
+ var isOldMinIndex = !map[minIndex - 1] || !map[minIndex];
236
+ var isOldMaxIndex = !map[maxIndex + 1] || !map[maxIndex];
232
237
  if (minIndex > 0 && !isOldMinIndex) {
233
238
  var prevSelectionSet = map[minIndex - 1];
234
239
  var minSelectionSet = map[minIndex];
package/docs/0-intro.tsx CHANGED
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
 
3
3
  import { AtlassianInternalWarning, code, md } from '@atlaskit/docs';
4
- import { createEditorUseOnlyNotice } from '@atlaskit/editor-core/docs/editor-use-only';
4
+ // eslint-disable-next-line @atlassian/tangerine/import/entry-points
5
+ import { createEditorUseOnlyNotice } from '@atlaskit/editor-common/doc-utils';
5
6
  import { token } from '@atlaskit/tokens';
6
7
 
7
8
  export default md`
@@ -23,7 +24,7 @@ ${createEditorUseOnlyNotice('Editor Plugin Table', [
23
24
  ---
24
25
 
25
26
  The \`dependencies\`, \`configuration\`, \`state\`, \`actions\`, and \`commands\` of the plugin are defined
26
- below:
27
+ below:
27
28
 
28
29
  ${code`
29
30
  type TablePlugin = NextEditorPlugin<
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.5.0",
3
+ "version": "7.5.2",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -145,4 +145,4 @@
145
145
  "type": "boolean"
146
146
  }
147
147
  }
148
- }
148
+ }
@@ -177,7 +177,7 @@ export const ResizableTableContainer = React.memo(
177
177
  );
178
178
 
179
179
  const displayGapCursor = useCallback(
180
- (toggle) => {
180
+ (toggle: boolean) => {
181
181
  return (
182
182
  pluginInjectionApi?.core?.actions.execute(
183
183
  pluginInjectionApi?.selection?.commands.displayGapCursor(toggle),
@@ -290,7 +290,7 @@ export const TableResizer = ({
290
290
  ]);
291
291
 
292
292
  const handleResize = useCallback(
293
- (originalState, delta) => {
293
+ (originalState: any, delta: any) => {
294
294
  countFrames();
295
295
  const newWidth = originalState.width + delta.width;
296
296
  let pos: number | undefined;
@@ -159,7 +159,10 @@ export const ColumnControls = ({
159
159
  }, [editorView, tableActive]);
160
160
 
161
161
  const toggleDragMenuHandler = useCallback(
162
- (trigger: TriggerType, event) => {
162
+ (
163
+ trigger: TriggerType,
164
+ event: MouseEvent<HTMLButtonElement, globalThis.MouseEvent> | undefined,
165
+ ) => {
163
166
  const { state, dispatch } = editorView;
164
167
  if (event?.shiftKey) {
165
168
  return;
@@ -114,7 +114,10 @@ const DragControlsComponent = ({
114
114
  }, [editorView]);
115
115
 
116
116
  const toggleDragMenuHandler = useCallback(
117
- (trigger: TriggerType, event) => {
117
+ (
118
+ trigger: TriggerType,
119
+ event: MouseEvent<HTMLButtonElement, globalThis.MouseEvent> | undefined,
120
+ ) => {
118
121
  if (event?.shiftKey) {
119
122
  return;
120
123
  }
@@ -259,13 +259,17 @@ export const checkEdgeHasMergedCells = (
259
259
  const { mapByRow, mapByColumn } = tableMap;
260
260
  const map = 'row' === direction ? mapByRow : mapByColumn;
261
261
  const lengthLimiter = direction === 'row' ? tableMap.width : tableMap.height;
262
-
263
262
  let minIndex = Math.min(...indexes);
264
263
  let maxIndex = Math.max(...indexes);
265
264
  let isTopSideHaveMergedCells = false;
266
265
  let isBottomSideHaveMergedCells = false;
267
- let isOldMinIndex = !map[minIndex - 1] && !map[minIndex];
268
- let isOldMaxIndex = !map[maxIndex + 1] && !map[maxIndex];
266
+
267
+ /**
268
+ * this is to check if the cell position from last focused table is overflow. since if you selection from a cell in 6th row and 7th column cell in a 7x8 table to 3x3 table, the cell position will be overflow because new table dont have this cell at all.
269
+ TODO: ED-22335 this should better called only when hover over the drag handle.
270
+ */
271
+ let isOldMinIndex = !map[minIndex - 1] || !map[minIndex];
272
+ let isOldMaxIndex = !map[maxIndex + 1] || !map[maxIndex];
269
273
 
270
274
  if (minIndex > 0 && !isOldMinIndex) {
271
275
  const prevSelectionSet = map[minIndex - 1];
package/tsconfig.dev.json CHANGED
@@ -40,7 +40,7 @@
40
40
  "path": "../../../build/website/docs/tsconfig.app.json"
41
41
  },
42
42
  {
43
- "path": "../editor-core/tsconfig.app.json"
43
+ "path": "../editor-common/tsconfig.app.json"
44
44
  },
45
45
  {
46
46
  "path": "../../design-system/tokens/tsconfig.app.json"