@atlaskit/editor-plugin-table 7.0.2 → 7.1.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/nodeviews/TableComponent.js +22 -12
  3. package/dist/cjs/pm-plugins/drag-and-drop/commands.js +1 -1
  4. package/dist/cjs/pm-plugins/keymap.js +1 -1
  5. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +1 -1
  6. package/dist/cjs/ui/icons/AddRowAboveIcon.js +8 -12
  7. package/dist/cjs/ui/icons/AddRowBelowIcon.js +19 -15
  8. package/dist/es2019/nodeviews/TableComponent.js +10 -1
  9. package/dist/es2019/pm-plugins/drag-and-drop/commands.js +1 -1
  10. package/dist/es2019/pm-plugins/keymap.js +2 -2
  11. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +1 -1
  12. package/dist/es2019/ui/icons/AddRowAboveIcon.js +8 -12
  13. package/dist/es2019/ui/icons/AddRowBelowIcon.js +19 -15
  14. package/dist/esm/nodeviews/TableComponent.js +22 -12
  15. package/dist/esm/pm-plugins/drag-and-drop/commands.js +1 -1
  16. package/dist/esm/pm-plugins/keymap.js +2 -2
  17. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +1 -1
  18. package/dist/esm/ui/icons/AddRowAboveIcon.js +8 -12
  19. package/dist/esm/ui/icons/AddRowBelowIcon.js +19 -15
  20. package/dist/types/index.d.ts +1 -1
  21. package/dist/types-ts4.5/index.d.ts +1 -1
  22. package/package.json +5 -5
  23. package/src/index.ts +1 -1
  24. package/src/nodeviews/TableComponent.tsx +18 -5
  25. package/src/pm-plugins/drag-and-drop/commands.ts +1 -1
  26. package/src/pm-plugins/keymap.ts +2 -7
  27. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +1 -0
  28. package/src/ui/icons/AddRowAboveIcon.tsx +2 -16
  29. package/src/ui/icons/AddRowBelowIcon.tsx +21 -12
  30. package/tsconfig.json +596 -3
@@ -300,11 +300,24 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
300
300
  this.table &&
301
301
  !this.overflowShadowsObserver
302
302
  ) {
303
- this.overflowShadowsObserver = new OverflowShadowsObserver(
304
- this.updateShadowState,
305
- this.table,
306
- this.wrapper,
307
- );
303
+ if (this.props.isDragAndDropEnabled) {
304
+ // requestAnimationFrame is used here to fix a race condition issue
305
+ // that happens when a table is nested in expand and expand's width is
306
+ // changed via breakout button
307
+ window.requestAnimationFrame(() => {
308
+ this.overflowShadowsObserver = new OverflowShadowsObserver(
309
+ this.updateShadowState,
310
+ this.table as HTMLElement,
311
+ this.wrapper as HTMLDivElement,
312
+ );
313
+ });
314
+ } else {
315
+ this.overflowShadowsObserver = new OverflowShadowsObserver(
316
+ this.updateShadowState,
317
+ this.table,
318
+ this.wrapper,
319
+ );
320
+ }
308
321
  }
309
322
 
310
323
  if (this.overflowShadowsObserver) {
@@ -137,7 +137,7 @@ export const moveSource = (
137
137
 
138
138
  return combineTransforms(
139
139
  [
140
- moveColumn(sourceIndexes, targetIndex),
140
+ moveColumn(state, sourceIndexes, targetIndex),
141
141
  selectStartOfTable,
142
142
  selectColumn(targetIndex),
143
143
  ],
@@ -34,12 +34,7 @@ import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
34
34
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
35
35
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
36
36
 
37
- import {
38
- createTable,
39
- goToNextCell,
40
- moveCursorBackward,
41
- triggerUnlessTableHeader,
42
- } from '../commands';
37
+ import { createTable, goToNextCell, moveCursorBackward } from '../commands';
43
38
  import {
44
39
  addRowAroundSelection,
45
40
  deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut,
@@ -120,7 +115,7 @@ export function keymapPlugin(
120
115
 
121
116
  bindKeymapWithCommand(
122
117
  addColumnBefore.common!,
123
- triggerUnlessTableHeader(addColumnBeforeCommand(getEditorContainerWidth)),
118
+ addColumnBeforeCommand(getEditorContainerWidth),
124
119
  list,
125
120
  );
126
121
 
@@ -194,6 +194,7 @@ const DragControlsComponent = ({
194
194
  !selectedRowIndexes.includes(rowIndex!) &&
195
195
  Number.isFinite(hoveredCell?.colIndex)
196
196
  : selectedRowIndexes.length < rowHeights.length &&
197
+ rowIndex! < rowHeights.length &&
197
198
  Number.isFinite(hoveredCell?.colIndex);
198
199
 
199
200
  if (!showCondition) {
@@ -16,22 +16,8 @@ export const AddRowAboveIcon = () => (
16
16
  fill={token('color.border.inverse', '#FFFFFF')}
17
17
  fillOpacity="0.01"
18
18
  />
19
- <mask
20
- id="path-1-inside-1_896_17822"
21
- fill={token('color.border.inverse', '#FFFFFF')}
22
- >
23
- <rect x="6" y="12" width="12" height="8" rx="0.5" />
24
- </mask>
25
- <rect
26
- x="6"
27
- y="12"
28
- width="12"
29
- height="8"
30
- rx="0.5"
31
- stroke="currentColor"
32
- strokeWidth="4"
33
- mask="url(#path-1-inside-1_896_17822)"
34
- />
19
+ <rect x="6" y="12" width="12" height="3" rx="0.5" fill="currentColor" />
20
+ <rect x="6" y="16" width="12" height="3" rx="0.5" fill="currentColor" />
35
21
  <path
36
22
  fillRule="evenodd"
37
23
  clipRule="evenodd"
@@ -10,26 +10,35 @@ export const AddRowBelowIcon = () => (
10
10
  fill="none"
11
11
  xmlns="http://www.w3.org/2000/svg"
12
12
  >
13
- <mask
14
- id="path-1-inside-1_920_47112"
13
+ <rect
14
+ width="24"
15
+ height="24"
16
+ transform="matrix(-1 0 0 -1 24 24)"
15
17
  fill={token('color.border.inverse', '#FFFFFF')}
16
- >
17
- <rect x="6" y="4" width="12" height="8" rx="0.5" />
18
- </mask>
18
+ fillOpacity="0.01"
19
+ />
20
+ <rect
21
+ x="18"
22
+ y="12"
23
+ width="12"
24
+ height="3"
25
+ rx="0.5"
26
+ transform="rotate(-180 18 12)"
27
+ fill="currentColor"
28
+ />
19
29
  <rect
20
- x="6"
21
- y="4"
30
+ x="18"
31
+ y="8"
22
32
  width="12"
23
- height="8"
33
+ height="3"
24
34
  rx="0.5"
25
- stroke="currentColor"
26
- strokeWidth="4"
27
- mask="url(#path-1-inside-1_920_47112)"
35
+ transform="rotate(-180 18 8)"
36
+ fill="currentColor"
28
37
  />
29
38
  <path
30
39
  fillRule="evenodd"
31
40
  clipRule="evenodd"
32
- d="M13 15V13.99C12.9974 13.7265 12.8908 13.4747 12.7036 13.2893C12.5163 13.104 12.2635 13 12 13C11.444 13 11 13.444 11 13.99V15H10C9.73478 15 9.48043 15.1054 9.29289 15.2929C9.10536 15.4804 9 15.7348 9 16C9 16.2652 9.10536 16.5196 9.29289 16.7071C9.48043 16.8946 9.73478 17 10 17H11V18.01C11.0026 18.2735 11.1092 18.5253 11.2964 18.7107C11.4837 18.896 11.7365 19 12 19C12.556 19 13 18.556 13 18.01V17H14C14.2652 17 14.5196 16.8946 14.7071 16.7071C14.8946 16.5196 15 16.2652 15 16C15 15.7348 14.8946 15.4804 14.7071 15.2929C14.5196 15.1054 14.2652 15 14 15H13Z"
41
+ d="M11 17V18.01C11.0026 18.2735 11.1092 18.5253 11.2964 18.7107C11.4837 18.896 11.7365 19 12 19C12.556 19 13 18.556 13 18.01V17H14C14.2652 17 14.5196 16.8946 14.7071 16.7071C14.8946 16.5196 15 16.2652 15 16C15 15.7348 14.8946 15.4804 14.7071 15.2929C14.5196 15.1054 14.2652 15 14 15H13V13.99C12.9974 13.7265 12.8908 13.4747 12.7036 13.2893C12.5163 13.104 12.2635 13 12 13C11.444 13 11 13.444 11 13.99V15H10C9.73478 15 9.48043 15.1054 9.29289 15.2929C9.10536 15.4804 9 15.7348 9 16C9 16.2652 9.10536 16.5196 9.29289 16.7071C9.48043 16.8946 9.73478 17 10 17H11Z"
33
42
  fill="currentColor"
34
43
  />
35
44
  </svg>