@atlaskit/editor-plugin-table 5.3.38 → 5.4.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 (28) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +5 -2
  3. package/dist/cjs/plugins/table/nodeviews/TableRow.js +158 -45
  4. package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.js +0 -6
  5. package/dist/cjs/plugins/table/ui/TableFloatingControls/RowDropTarget/index.js +3 -0
  6. package/dist/cjs/plugins/table/ui/common-styles.js +18 -7
  7. package/dist/cjs/plugins/table/ui/ui-styles.js +26 -21
  8. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +5 -2
  9. package/dist/es2019/plugins/table/nodeviews/TableRow.js +163 -50
  10. package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.js +1 -9
  11. package/dist/es2019/plugins/table/ui/TableFloatingControls/RowDropTarget/index.js +1 -0
  12. package/dist/es2019/plugins/table/ui/common-styles.js +17 -0
  13. package/dist/es2019/plugins/table/ui/ui-styles.js +36 -19
  14. package/dist/esm/plugins/table/nodeviews/TableComponent.js +5 -2
  15. package/dist/esm/plugins/table/nodeviews/TableRow.js +158 -46
  16. package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.js +1 -7
  17. package/dist/esm/plugins/table/ui/TableFloatingControls/RowDropTarget/index.js +3 -0
  18. package/dist/esm/plugins/table/ui/common-styles.js +18 -7
  19. package/dist/esm/plugins/table/ui/ui-styles.js +26 -21
  20. package/dist/types/plugins/table/nodeviews/TableRow.d.ts +3 -0
  21. package/dist/types-ts4.5/plugins/table/nodeviews/TableRow.d.ts +3 -0
  22. package/package.json +6 -3
  23. package/src/plugins/table/nodeviews/TableComponent.tsx +13 -12
  24. package/src/plugins/table/nodeviews/TableRow.ts +199 -52
  25. package/src/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +1 -7
  26. package/src/plugins/table/ui/TableFloatingControls/RowDropTarget/index.tsx +1 -0
  27. package/src/plugins/table/ui/common-styles.ts +23 -0
  28. package/src/plugins/table/ui/ui-styles.ts +40 -19
@@ -11,7 +11,7 @@ import {
11
11
  selectTable,
12
12
  } from '@atlaskit/editor-tables/utils';
13
13
 
14
- import { clearHoverSelection, hoverTable } from '../../../commands';
14
+ import { clearHoverSelection } from '../../../commands';
15
15
  import { TableCssClassName as ClassName } from '../../../types';
16
16
 
17
17
  import type { CornerControlProps } from './types';
@@ -26,11 +26,6 @@ const DragCornerControlsComponent = ({
26
26
  dispatch(selectTable(state.tr).setMeta('addToHistory', false));
27
27
  };
28
28
 
29
- const handleMouseOver = () => {
30
- const { state, dispatch } = editorView;
31
- hoverTable()(state, dispatch);
32
- };
33
-
34
29
  const handleMouseOut = () => {
35
30
  const { state, dispatch } = editorView;
36
31
  clearHoverSelection()(state, dispatch);
@@ -54,7 +49,6 @@ const DragCornerControlsComponent = ({
54
49
  aria-label={formatMessage(messages.cornerControl)}
55
50
  type="button"
56
51
  onClick={handleOnClick}
57
- onMouseOver={handleMouseOver}
58
52
  onMouseOut={handleMouseOut}
59
53
  contentEditable={false}
60
54
  >
@@ -33,6 +33,7 @@ const RowDropTarget = ({ index, localId, style }: RowDropTargetProps) => {
33
33
  data.indexes?.indexOf(index) === -1
34
34
  );
35
35
  },
36
+ getIsSticky: () => true,
36
37
  getData({ input, element }) {
37
38
  const data = {
38
39
  localId,
@@ -5,6 +5,7 @@ import {
5
5
  tableSharedStyle,
6
6
  } from '@atlaskit/editor-common/styles';
7
7
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
8
+ import { browser } from '@atlaskit/editor-common/utils';
8
9
  import {
9
10
  akEditorSelectedNodeClassName,
10
11
  akEditorSmallZIndex,
@@ -246,6 +247,26 @@ const tableStickyHeaderColumnControlsDecorationsStyle = (
246
247
  }
247
248
  };
248
249
 
250
+ const tableStickyHeaderFirefoxFixStyle = (
251
+ props: ThemeProps & { featureFlags?: FeatureFlags },
252
+ ) => {
253
+ /*
254
+ This is MAGIC!
255
+ This fixes a bug which occurs in firefox when the first row becomes sticky.
256
+ see https://product-fabric.atlassian.net/browse/ED-19177
257
+ */
258
+ if (
259
+ browser.gecko &&
260
+ getBooleanFF('platform.editor.table.alternative-sticky-header-logic')
261
+ ) {
262
+ return css`
263
+ .${ClassName.TABLE_STICKY} > tbody::before {
264
+ content: '';
265
+ }
266
+ `;
267
+ }
268
+ };
269
+
249
270
  const tableRowControlStyles = () => {
250
271
  return getBooleanFF('platform.editor.table.drag-and-drop')
251
272
  ? css`
@@ -402,6 +423,8 @@ export const tableStyles = (
402
423
 
403
424
  ${tableStickyHeaderColumnControlsDecorationsStyle(props)}
404
425
 
426
+ ${tableStickyHeaderFirefoxFixStyle(props)}
427
+
405
428
  .${ClassName.TABLE_STICKY}
406
429
  .${ClassName.ROW_CONTROLS}
407
430
  .${ClassName.ROW_CONTROLS_BUTTON_WRAP}.sticky {
@@ -222,16 +222,15 @@ export const dragInsertButtonWrapper = (props: ThemeProps) => css`
222
222
 
223
223
  export const dragCornerControlButton = (props: ThemeProps) => css`
224
224
  .${ClassName.DRAG_CORNER_BUTTON} {
225
- width: 12px;
226
- height: 12px;
225
+ width: 24px;
226
+ height: 24px;
227
227
  display: flex;
228
- justify-content: center;
229
- align-items: center;
228
+ justify-content: flex-end;
229
+ align-items: flex-end;
230
230
  position: absolute;
231
- top: ${token('space.negative.075', '-6px')};
232
- left: ${token('space.075', '6px')};
233
- background-color: ${token('elevation.surface', '#FFF')};
234
- border-radius: 50%;
231
+ top: ${token('space.negative.250', '-20px')};
232
+ left: ${token('space.negative.100', '-8px')};
233
+ background-color: transparent;
235
234
  border: none;
236
235
  padding: 0;
237
236
  outline: none;
@@ -239,24 +238,38 @@ export const dragCornerControlButton = (props: ThemeProps) => css`
239
238
 
240
239
  &.active .${ClassName.DRAG_CORNER_BUTTON_INNER} {
241
240
  background-color: ${token('color.border.selected', '#0C66E4')};
242
- border-color: ${token('color.border.selected', '#0C66E4')};
241
+ width: 10px;
242
+ height: 10px;
243
+ border-width: 2px;
244
+ border-radius: 4px;
245
+ top: ${token('space.075', '6px')};
246
+ left: ${token('space.075', '6px')};
243
247
  }
244
248
 
245
249
  &:hover {
246
250
  cursor: pointer;
247
251
 
248
252
  .${ClassName.DRAG_CORNER_BUTTON_INNER} {
249
- border-color: ${token('color.border.selected', '#0C66E4')};
253
+ width: 10px;
254
+ height: 10px;
255
+ border-width: 2px;
256
+ border-radius: 4px;
257
+ top: ${token('space.075', '6px')};
258
+ left: ${token('space.075', '6px')};
250
259
  }
251
260
  }
252
261
  }
253
262
 
254
263
  .${ClassName.DRAG_CORNER_BUTTON_INNER} {
255
- border: 1px solid
256
- ${token('color.background.accent.gray.subtler', '#DCDFE4')};
257
- border-radius: 50%;
258
- width: 6px;
259
- height: 6px;
264
+ border: 1px solid ${token('color.border.inverse', '#FFF')};
265
+ background-color: ${token(
266
+ 'color.background.accent.gray.subtler',
267
+ '#DCDFE4',
268
+ )};
269
+ border-radius: 2px;
270
+ width: 5px;
271
+ height: 5px;
272
+ position: relative;
260
273
  }
261
274
  `;
262
275
 
@@ -384,16 +397,24 @@ export const OverflowShadow = (props: ThemeProps) => css`
384
397
  }px)`};
385
398
  }
386
399
  .${ClassName.WITH_CONTROLS} {
387
- .${ClassName.TABLE_RIGHT_SHADOW}, .${ClassName.TABLE_LEFT_SHADOW} {
388
- height: calc(100% - ${tableMarginTopWithControl}px);
389
- top: ${tableMarginTopWithControl}px;
390
- }
400
+ ${overflowShadowWidhoutDnD()}
391
401
  .${ClassName.TABLE_LEFT_SHADOW} {
392
402
  border-left: 1px solid ${tableBorderColor(props)};
393
403
  }
394
404
  }
395
405
  `;
396
406
 
407
+ const overflowShadowWidhoutDnD = () => {
408
+ if (!getBooleanFF('platform.editor.table.drag-and-drop')) {
409
+ return css`
410
+ .${ClassName.TABLE_RIGHT_SHADOW}, .${ClassName.TABLE_LEFT_SHADOW} {
411
+ height: calc(100% - ${tableMarginTopWithControl}px);
412
+ top: ${tableMarginTopWithControl}px;
413
+ }
414
+ `;
415
+ }
416
+ };
417
+
397
418
  const columnHeaderButton = (props: ThemeProps, cssString?: string) => {
398
419
  if (getBooleanFF('platform.editor.table.column-controls-styles-updated')) {
399
420
  return css`