@atlaskit/editor-plugin-table 5.3.13 → 5.3.15
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 +16 -0
- package/dist/cjs/plugins/table/event-handlers.js +6 -3
- package/dist/cjs/plugins/table/index.js +6 -4
- package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +3 -7
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -3
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +11 -0
- package/dist/cjs/plugins/table/types.js +9 -2
- package/dist/cjs/plugins/table/ui/FloatingDragMenu/DragMenu.js +49 -11
- package/dist/cjs/plugins/table/ui/FloatingDragMenu/index.js +10 -5
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/InsertButton.js +57 -9
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +9 -7
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +13 -4
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +44 -5
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/index.js +6 -4
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +35 -13
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +2 -0
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/ui/icons/AddColLeftIcon.js +44 -0
- package/dist/cjs/plugins/table/ui/icons/AddColRightIcon.js +44 -0
- package/dist/cjs/plugins/table/ui/icons/AddRowAboveIcon.js +45 -0
- package/dist/cjs/plugins/table/ui/icons/AddRowBelowIcon.js +40 -0
- package/dist/cjs/plugins/table/ui/icons/index.js +29 -1
- package/dist/cjs/plugins/table/ui/ui-styles.js +27 -24
- package/dist/cjs/plugins/table/utils/dom.js +12 -4
- package/dist/cjs/plugins/table/utils/drag-menu.js +122 -10
- package/dist/cjs/plugins/table/utils/index.js +12 -0
- package/dist/es2019/plugins/table/event-handlers.js +5 -4
- package/dist/es2019/plugins/table/index.js +6 -4
- package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +3 -7
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -3
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +12 -0
- package/dist/es2019/plugins/table/types.js +9 -2
- package/dist/es2019/plugins/table/ui/FloatingDragMenu/DragMenu.js +52 -8
- package/dist/es2019/plugins/table/ui/FloatingDragMenu/index.js +10 -5
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/InsertButton.js +58 -7
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +9 -7
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +10 -4
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +46 -6
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/index.js +7 -5
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +35 -14
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +2 -0
- package/dist/es2019/plugins/table/ui/common-styles.js +51 -3
- package/dist/es2019/plugins/table/ui/icons/AddColLeftIcon.js +35 -0
- package/dist/es2019/plugins/table/ui/icons/AddColRightIcon.js +35 -0
- package/dist/es2019/plugins/table/ui/icons/AddRowAboveIcon.js +36 -0
- package/dist/es2019/plugins/table/ui/icons/AddRowBelowIcon.js +31 -0
- package/dist/es2019/plugins/table/ui/icons/index.js +5 -1
- package/dist/es2019/plugins/table/ui/ui-styles.js +23 -1
- package/dist/es2019/plugins/table/utils/dom.js +5 -1
- package/dist/es2019/plugins/table/utils/drag-menu.js +118 -8
- package/dist/es2019/plugins/table/utils/index.js +1 -1
- package/dist/esm/plugins/table/event-handlers.js +7 -4
- package/dist/esm/plugins/table/index.js +6 -4
- package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +3 -7
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -3
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +11 -0
- package/dist/esm/plugins/table/types.js +9 -2
- package/dist/esm/plugins/table/ui/FloatingDragMenu/DragMenu.js +46 -8
- package/dist/esm/plugins/table/ui/FloatingDragMenu/index.js +10 -5
- package/dist/esm/plugins/table/ui/FloatingInsertButton/InsertButton.js +56 -8
- package/dist/esm/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +9 -7
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +10 -4
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +45 -6
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/index.js +7 -5
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +36 -14
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +2 -0
- package/dist/esm/plugins/table/ui/common-styles.js +2 -2
- package/dist/esm/plugins/table/ui/icons/AddColLeftIcon.js +37 -0
- package/dist/esm/plugins/table/ui/icons/AddColRightIcon.js +37 -0
- package/dist/esm/plugins/table/ui/icons/AddRowAboveIcon.js +38 -0
- package/dist/esm/plugins/table/ui/icons/AddRowBelowIcon.js +33 -0
- package/dist/esm/plugins/table/ui/icons/index.js +5 -1
- package/dist/esm/plugins/table/ui/ui-styles.js +26 -23
- package/dist/esm/plugins/table/utils/dom.js +11 -3
- package/dist/esm/plugins/table/utils/drag-menu.js +120 -8
- package/dist/esm/plugins/table/utils/index.js +1 -1
- package/dist/types/plugins/table/types.d.ts +9 -2
- package/dist/types/plugins/table/ui/FloatingDragMenu/DragMenu.d.ts +5 -2
- package/dist/types/plugins/table/ui/FloatingDragMenu/index.d.ts +3 -1
- package/dist/types/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +5 -1
- package/dist/types/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +1 -1
- package/dist/types/plugins/table/ui/FloatingInsertButton/index.d.ts +1 -0
- package/dist/types/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -1
- package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +2 -0
- package/dist/types/plugins/table/ui/icons/AddColLeftIcon.d.ts +2 -0
- package/dist/types/plugins/table/ui/icons/AddColRightIcon.d.ts +2 -0
- package/dist/types/plugins/table/ui/icons/AddRowAboveIcon.d.ts +2 -0
- package/dist/types/plugins/table/ui/icons/AddRowBelowIcon.d.ts +2 -0
- package/dist/types/plugins/table/ui/icons/index.d.ts +4 -0
- package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -0
- package/dist/types/plugins/table/utils/dom.d.ts +4 -1
- package/dist/types/plugins/table/utils/drag-menu.d.ts +6 -3
- package/dist/types/plugins/table/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +9 -2
- package/dist/types-ts4.5/plugins/table/ui/FloatingDragMenu/DragMenu.d.ts +5 -2
- package/dist/types-ts4.5/plugins/table/ui/FloatingDragMenu/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +5 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/icons/AddColLeftIcon.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/icons/AddColRightIcon.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/icons/AddRowAboveIcon.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/icons/AddRowBelowIcon.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/icons/index.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +4 -1
- package/dist/types-ts4.5/plugins/table/utils/drag-menu.d.ts +6 -3
- package/dist/types-ts4.5/plugins/table/utils/index.d.ts +1 -1
- package/package.json +2 -1
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +40 -194
- package/src/__tests__/unit/ui/RowDragControls.tsx +9 -11
- package/src/plugins/table/event-handlers.ts +15 -3
- package/src/plugins/table/index.tsx +4 -2
- package/src/plugins/table/pm-plugins/decorations/plugin.ts +2 -9
- package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +1 -3
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +9 -0
- package/src/plugins/table/types.ts +12 -2
- package/src/plugins/table/ui/FloatingDragMenu/DragMenu.tsx +73 -6
- package/src/plugins/table/ui/FloatingDragMenu/index.tsx +15 -3
- package/src/plugins/table/ui/FloatingInsertButton/InsertButton.tsx +82 -8
- package/src/plugins/table/ui/FloatingInsertButton/getPopupOptions.ts +28 -5
- package/src/plugins/table/ui/FloatingInsertButton/index.tsx +19 -7
- package/src/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.tsx +47 -3
- package/src/plugins/table/ui/TableFloatingColumnControls/index.tsx +11 -4
- package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +49 -18
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +2 -0
- package/src/plugins/table/ui/common-styles.ts +57 -2
- package/src/plugins/table/ui/icons/AddColLeftIcon.tsx +43 -0
- package/src/plugins/table/ui/icons/AddColRightIcon.tsx +43 -0
- package/src/plugins/table/ui/icons/AddRowAboveIcon.tsx +42 -0
- package/src/plugins/table/ui/icons/AddRowBelowIcon.tsx +36 -0
- package/src/plugins/table/ui/icons/index.ts +4 -0
- package/src/plugins/table/ui/ui-styles.ts +27 -1
- package/src/plugins/table/utils/dom.ts +11 -4
- package/src/plugins/table/utils/drag-menu.ts +158 -5
- package/src/plugins/table/utils/index.ts +2 -0
- package/tsconfig.app.json +3 -0
|
@@ -7,7 +7,7 @@ import { B300, N0, N20A, N300, N40A, R500 } from '@atlaskit/theme/colors';
|
|
|
7
7
|
import { fontSize } from '@atlaskit/theme/constants';
|
|
8
8
|
import { TableCssClassName as ClassName } from '../types';
|
|
9
9
|
import { columnControlsDecorationHeight, resizeHandlerAreaWidth, resizeLineWidth, rowControlsZIndex, stickyHeaderBorderBottomWidth, stickyRowOffsetTop, tableBorderColor, tableBorderDeleteColor, tableBorderRadiusSize, tableBorderSelectedColor, tableCellBackgroundColor, tableCellDeleteColor, tableCellSelectedColor, tableControlsSpacing, tableHeaderCellBackgroundColor, tableInsertColumnButtonSize, tableOverflowShadowWidth, tablePadding, tableScrollbarOffset, tableTextColor, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
|
|
10
|
-
import { columnControlsDecoration, columnControlsLineMarker, DeleteButton, floatingColumnControls, HeaderButton, HeaderButtonDanger, HeaderButtonHover, hoveredCell, hoveredDeleteButton, hoveredWarningCell, insertColumnButtonWrapper, insertLine, InsertMarker, insertRowButtonWrapper, OverflowShadow, resizeHandle, rowControlsWrapperDotStyle } from './ui-styles';
|
|
10
|
+
import { columnControlsDecoration, columnControlsLineMarker, DeleteButton, dragInsertButtonWrapper, floatingColumnControls, HeaderButton, HeaderButtonDanger, HeaderButtonHover, hoveredCell, hoveredDeleteButton, hoveredWarningCell, insertColumnButtonWrapper, insertLine, InsertMarker, insertRowButtonWrapper, OverflowShadow, resizeHandle, rowControlsWrapperDotStyle } from './ui-styles';
|
|
11
11
|
const cornerControlHeight = tableToolbarSize + 1;
|
|
12
12
|
|
|
13
13
|
/*
|
|
@@ -270,6 +270,8 @@ export const tableStyles = props => {
|
|
|
270
270
|
${insertRowButtonWrapper(props)}
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
+
${dragInsertButtonWrapper(props)}
|
|
274
|
+
|
|
273
275
|
/* Delete button */
|
|
274
276
|
${DeleteButton(props)}
|
|
275
277
|
/* Ends Delete button */
|
|
@@ -602,12 +604,58 @@ export const tableStyles = props => {
|
|
|
602
604
|
`)}
|
|
603
605
|
}
|
|
604
606
|
|
|
605
|
-
.${ClassName.
|
|
607
|
+
.${ClassName.DRAG_ROW_CONTROLS} {
|
|
606
608
|
display: grid;
|
|
607
609
|
align-items: center;
|
|
608
610
|
position: absolute;
|
|
609
611
|
left: -4px;
|
|
610
612
|
z-index: ${akEditorUnitZIndex};
|
|
613
|
+
|
|
614
|
+
.${ClassName.DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER} {
|
|
615
|
+
align-self: end;
|
|
616
|
+
position: absolute;
|
|
617
|
+
height: 100%;
|
|
618
|
+
width: 24px;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.${ClassName.DRAG_ROW_FLOATING_INSERT_DOT} {
|
|
622
|
+
position: absolute;
|
|
623
|
+
bottom: -3px;
|
|
624
|
+
left: 6px;
|
|
625
|
+
background-color: ${"var(--ds-background-accent-gray-subtler, #C1C7D0)"};
|
|
626
|
+
height: 4px;
|
|
627
|
+
width: 4px;
|
|
628
|
+
border-radius: 50%;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
.${ClassName.DRAG_COLUMN_CONTROLS} {
|
|
633
|
+
.${ClassName.COLUMN_CONTROLS_INNER} {
|
|
634
|
+
height: 24px;
|
|
635
|
+
position: absolute;
|
|
636
|
+
top: ${"var(--ds-space-negative-150, -12px)"};
|
|
637
|
+
z-index: ${akEditorUnitZIndex};
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
.${ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER} {
|
|
641
|
+
position: absolute;
|
|
642
|
+
height: 24px;
|
|
643
|
+
width: 100%;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
.${ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT} {
|
|
647
|
+
background-color: ${"var(--ds-background-accent-gray-subtler, #C1C7D0)"};
|
|
648
|
+
height: 4px;
|
|
649
|
+
width: 4px;
|
|
650
|
+
border-radius: 50%;
|
|
651
|
+
position: absolute;
|
|
652
|
+
right: -2px;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
.${ClassName.CONTROLS_FLOATING_BUTTON_ROW}
|
|
657
|
+
.${ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER} {
|
|
658
|
+
bottom: -1px;
|
|
611
659
|
}
|
|
612
660
|
|
|
613
661
|
.${ClassName.DRAG_HANDLE_BUTTON_CONTAINER} {
|
|
@@ -621,10 +669,10 @@ export const tableStyles = props => {
|
|
|
621
669
|
display: flex;
|
|
622
670
|
justify-content: center;
|
|
623
671
|
align-items: center;
|
|
672
|
+
outline: none !important;
|
|
624
673
|
|
|
625
674
|
svg {
|
|
626
675
|
rect {
|
|
627
|
-
//
|
|
628
676
|
fill: ${"var(--ds-background-accent-gray-subtlest, #F1F2F4)"};
|
|
629
677
|
}
|
|
630
678
|
g {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const AddColLeftIcon = () => /*#__PURE__*/React.createElement("svg", {
|
|
3
|
+
width: "24",
|
|
4
|
+
height: "24",
|
|
5
|
+
viewBox: "0 0 24 24",
|
|
6
|
+
fill: "currentColor",
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
8
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
9
|
+
width: "24",
|
|
10
|
+
height: "24",
|
|
11
|
+
transform: "matrix(0 -1 1 0 0 24)",
|
|
12
|
+
fill: "none",
|
|
13
|
+
fillOpacity: "0.01"
|
|
14
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
15
|
+
x: "12",
|
|
16
|
+
y: "18",
|
|
17
|
+
width: "12",
|
|
18
|
+
height: "3",
|
|
19
|
+
rx: "0.5",
|
|
20
|
+
transform: "rotate(-90 12 18)",
|
|
21
|
+
fill: "currentColor"
|
|
22
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
23
|
+
x: "16",
|
|
24
|
+
y: "18",
|
|
25
|
+
width: "12",
|
|
26
|
+
height: "3",
|
|
27
|
+
rx: "0.5",
|
|
28
|
+
transform: "rotate(-90 16 18)",
|
|
29
|
+
fill: "currentColor"
|
|
30
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
31
|
+
fillRule: "evenodd",
|
|
32
|
+
clipRule: "evenodd",
|
|
33
|
+
d: "M7 11H5.99C5.72652 11.0026 5.47473 11.1092 5.28935 11.2964C5.10397 11.4837 4.99999 11.7365 5 12C5 12.556 5.444 13 5.99 13H7V14C7 14.2652 7.10536 14.5196 7.29289 14.7071C7.48043 14.8946 7.73478 15 8 15C8.26522 15 8.51957 14.8946 8.70711 14.7071C8.89464 14.5196 9 14.2652 9 14V13H10.01C10.2735 12.9974 10.5253 12.8908 10.7107 12.7036C10.896 12.5163 11 12.2635 11 12C11 11.444 10.556 11 10.01 11H9V10C9 9.73478 8.89464 9.48043 8.70711 9.29289C8.51957 9.10536 8.26522 9 8 9C7.73478 9 7.48043 9.10536 7.29289 9.29289C7.10536 9.48043 7 9.73478 7 10V11Z",
|
|
34
|
+
fill: "currentColor"
|
|
35
|
+
}));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const AddColRightIcon = () => /*#__PURE__*/React.createElement("svg", {
|
|
3
|
+
width: "24",
|
|
4
|
+
height: "24",
|
|
5
|
+
viewBox: "0 0 24 24",
|
|
6
|
+
fill: "none",
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
8
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
9
|
+
width: "24",
|
|
10
|
+
height: "24",
|
|
11
|
+
transform: "translate(0 24) rotate(-90)",
|
|
12
|
+
fill: "none",
|
|
13
|
+
fillOpacity: "0.01"
|
|
14
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
15
|
+
x: "9",
|
|
16
|
+
y: "18",
|
|
17
|
+
width: "12",
|
|
18
|
+
height: "3",
|
|
19
|
+
rx: "0.5",
|
|
20
|
+
transform: "rotate(-90 9 18)",
|
|
21
|
+
fill: "currentColor"
|
|
22
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
23
|
+
x: "5",
|
|
24
|
+
y: "18",
|
|
25
|
+
width: "12",
|
|
26
|
+
height: "3",
|
|
27
|
+
rx: "0.5",
|
|
28
|
+
transform: "rotate(-90 5 18)",
|
|
29
|
+
fill: "currentColor"
|
|
30
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
31
|
+
fillRule: "evenodd",
|
|
32
|
+
clipRule: "evenodd",
|
|
33
|
+
d: "M15 11L13.99 11C13.7265 11.0026 13.4747 11.1092 13.2893 11.2964C13.104 11.4837 13 11.7365 13 12C13 12.556 13.444 13 13.99 13L15 13L15 14C15 14.2652 15.1054 14.5196 15.2929 14.7071C15.4804 14.8946 15.7348 15 16 15C16.2652 15 16.5196 14.8946 16.7071 14.7071C16.8946 14.5196 17 14.2652 17 14L17 13L18.01 13C18.2735 12.9974 18.5253 12.8908 18.7107 12.7036C18.896 12.5163 19 12.2635 19 12C19 11.444 18.556 11 18.01 11L17 11L17 10C17 9.73478 16.8946 9.48043 16.7071 9.29289C16.5196 9.10536 16.2652 9 16 9C15.7348 9 15.4804 9.10536 15.2929 9.29289C15.1054 9.48043 15 9.73478 15 10L15 11Z",
|
|
34
|
+
fill: "currentColor"
|
|
35
|
+
}));
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const AddRowAboveIcon = () => /*#__PURE__*/React.createElement("svg", {
|
|
3
|
+
width: "24",
|
|
4
|
+
height: "24",
|
|
5
|
+
viewBox: "0 0 24 24",
|
|
6
|
+
fill: "none",
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
8
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
9
|
+
width: "24",
|
|
10
|
+
height: "24",
|
|
11
|
+
fill: "var(--ds-border-inverse, #FFFFFF)",
|
|
12
|
+
fillOpacity: "0.01"
|
|
13
|
+
}), /*#__PURE__*/React.createElement("mask", {
|
|
14
|
+
id: "path-1-inside-1_896_17822",
|
|
15
|
+
fill: "var(--ds-border-inverse, #FFFFFF)"
|
|
16
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
17
|
+
x: "6",
|
|
18
|
+
y: "12",
|
|
19
|
+
width: "12",
|
|
20
|
+
height: "8",
|
|
21
|
+
rx: "0.5"
|
|
22
|
+
})), /*#__PURE__*/React.createElement("rect", {
|
|
23
|
+
x: "6",
|
|
24
|
+
y: "12",
|
|
25
|
+
width: "12",
|
|
26
|
+
height: "8",
|
|
27
|
+
rx: "0.5",
|
|
28
|
+
stroke: "currentColor",
|
|
29
|
+
strokeWidth: "4",
|
|
30
|
+
mask: "url(#path-1-inside-1_896_17822)"
|
|
31
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
32
|
+
fillRule: "evenodd",
|
|
33
|
+
clipRule: "evenodd",
|
|
34
|
+
d: "M13 7V5.99C12.9974 5.72652 12.8908 5.47473 12.7036 5.28935C12.5163 5.10397 12.2635 4.99999 12 5C11.444 5 11 5.444 11 5.99V7H10C9.73478 7 9.48043 7.10536 9.29289 7.29289C9.10536 7.48043 9 7.73478 9 8C9 8.26522 9.10536 8.51957 9.29289 8.70711C9.48043 8.89464 9.73478 9 10 9H11V10.01C11.0026 10.2735 11.1092 10.5253 11.2964 10.7107C11.4837 10.896 11.7365 11 12 11C12.556 11 13 10.556 13 10.01V9H14C14.2652 9 14.5196 8.89464 14.7071 8.70711C14.8946 8.51957 15 8.26522 15 8C15 7.73478 14.8946 7.48043 14.7071 7.29289C14.5196 7.10536 14.2652 7 14 7H13Z",
|
|
35
|
+
fill: "currentColor"
|
|
36
|
+
}));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const AddRowBelowIcon = () => /*#__PURE__*/React.createElement("svg", {
|
|
3
|
+
width: "24",
|
|
4
|
+
height: "24",
|
|
5
|
+
viewBox: "0 0 24 24",
|
|
6
|
+
fill: "none",
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
8
|
+
}, /*#__PURE__*/React.createElement("mask", {
|
|
9
|
+
id: "path-1-inside-1_920_47112",
|
|
10
|
+
fill: "var(--ds-border-inverse, #FFFFFF)"
|
|
11
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
12
|
+
x: "6",
|
|
13
|
+
y: "4",
|
|
14
|
+
width: "12",
|
|
15
|
+
height: "8",
|
|
16
|
+
rx: "0.5"
|
|
17
|
+
})), /*#__PURE__*/React.createElement("rect", {
|
|
18
|
+
x: "6",
|
|
19
|
+
y: "4",
|
|
20
|
+
width: "12",
|
|
21
|
+
height: "8",
|
|
22
|
+
rx: "0.5",
|
|
23
|
+
stroke: "currentColor",
|
|
24
|
+
strokeWidth: "4",
|
|
25
|
+
mask: "url(#path-1-inside-1_920_47112)"
|
|
26
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
27
|
+
fillRule: "evenodd",
|
|
28
|
+
clipRule: "evenodd",
|
|
29
|
+
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",
|
|
30
|
+
fill: "currentColor"
|
|
31
|
+
}));
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export { DragHandleIcon } from './DragHandleIcon';
|
|
2
|
-
export { DragInMotionIcon } from './DragInMotionIcon';
|
|
2
|
+
export { DragInMotionIcon } from './DragInMotionIcon';
|
|
3
|
+
export { AddRowAboveIcon } from './AddRowAboveIcon';
|
|
4
|
+
export { AddRowBelowIcon } from './AddRowBelowIcon';
|
|
5
|
+
export { AddColLeftIcon } from './AddColLeftIcon';
|
|
6
|
+
export { AddColRightIcon } from './AddColRightIcon';
|
|
@@ -129,6 +129,28 @@ const InsertButtonHover = () => css`
|
|
|
129
129
|
cursor: pointer;
|
|
130
130
|
}
|
|
131
131
|
`;
|
|
132
|
+
export const dragInsertButtonWrapper = props => css`
|
|
133
|
+
.${ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER} {
|
|
134
|
+
position: absolute;
|
|
135
|
+
z-index: ${akEditorUnitZIndex + 10};
|
|
136
|
+
bottom: -5px;
|
|
137
|
+
left: 3px;
|
|
138
|
+
}
|
|
139
|
+
.${ClassName.DRAG_CONTROLS_INSERT_BUTTON} {
|
|
140
|
+
${Button(`
|
|
141
|
+
background: ${"var(--ds-surface-overlay, white)"};
|
|
142
|
+
color: ${`var(--ds-icon, ${N300})`};
|
|
143
|
+
border: 1px solid ${"var(--ds-background-accent-gray-subtler, #C1C7D0)"};
|
|
144
|
+
border-radius: 50%;
|
|
145
|
+
`)}
|
|
146
|
+
}
|
|
147
|
+
.${ClassName.DRAG_CONTROLS_INSERT_BUTTON}:hover {
|
|
148
|
+
background: ${`var(--ds-background-brand-bold, ${B300})`};
|
|
149
|
+
border: 1px solid ${`var(--ds-background-brand-bold, ${B300})`};
|
|
150
|
+
color: ${"var(--ds-icon-inverse, white)"};
|
|
151
|
+
cursor: pointer;
|
|
152
|
+
}
|
|
153
|
+
`;
|
|
132
154
|
export const insertColumnButtonWrapper = props => css`
|
|
133
155
|
${InsertButton()}
|
|
134
156
|
${InsertButtonHover()}
|
|
@@ -299,7 +321,7 @@ export const floatingColumnControls = props => {
|
|
|
299
321
|
}
|
|
300
322
|
}
|
|
301
323
|
|
|
302
|
-
.${ClassName.
|
|
324
|
+
.${ClassName.DRAG_COLUMN_CONTROLS} {
|
|
303
325
|
box-sizing: border-box;
|
|
304
326
|
|
|
305
327
|
.${ClassName.COLUMN_CONTROLS_INNER} {
|
|
@@ -10,11 +10,15 @@ export const isInsertRowButton = node => containsClassName(node, ClassName.CONTR
|
|
|
10
10
|
export const getColumnOrRowIndex = target => [parseInt(target.getAttribute('data-start-index') || '-1', 10), parseInt(target.getAttribute('data-end-index') || '-1', 10)];
|
|
11
11
|
export const isColumnControlsDecorations = node => containsClassName(node, ClassName.COLUMN_CONTROLS_DECORATIONS);
|
|
12
12
|
export const isRowControlsButton = node => containsClassName(node, ClassName.ROW_CONTROLS_BUTTON) || containsClassName(node, ClassName.NUMBERED_COLUMN_BUTTON);
|
|
13
|
-
export const isRowDragControlsButton = node => containsClassName(node, ClassName.ROW_CONTROLS_WITH_DRAG) || closestElement(node, `.${ClassName.ROW_CONTROLS_WITH_DRAG}`);
|
|
14
13
|
export const isResizeHandleDecoration = node => containsClassName(node, ClassName.RESIZE_HANDLE_DECORATION);
|
|
15
14
|
export const isTableControlsButton = node => containsClassName(node, ClassName.CONTROLS_BUTTON) || containsClassName(node, ClassName.ROW_CONTROLS_BUTTON_WRAP);
|
|
16
15
|
export const isTableContainerOrWrapper = node => containsClassName(node, ClassName.TABLE_CONTAINER) || containsClassName(node, ClassName.TABLE_NODE_WRAPPER);
|
|
17
16
|
|
|
17
|
+
/** drag-and-drop classes */
|
|
18
|
+
export const isRowDragControlsButton = node => containsClassName(node, ClassName.DRAG_ROW_CONTROLS) || closestElement(node, `.${ClassName.DRAG_ROW_CONTROLS}`);
|
|
19
|
+
export const isDragRowFloatingInsertDot = node => containsClassName(node, ClassName.DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER);
|
|
20
|
+
export const isDragColumnFloatingInsertDot = node => containsClassName(node, ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER);
|
|
21
|
+
|
|
18
22
|
/*
|
|
19
23
|
* This function returns which side of a given element the mouse cursor is,
|
|
20
24
|
* using as a base the half of the width by default, for example:
|
|
@@ -1,38 +1,136 @@
|
|
|
1
|
+
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
2
|
+
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
3
|
+
import ArrowDownIcon from '@atlaskit/icon/glyph/arrow-down';
|
|
4
|
+
import ArrowLeftIcon from '@atlaskit/icon/glyph/arrow-left';
|
|
5
|
+
import ArrowRightIcon from '@atlaskit/icon/glyph/arrow-right';
|
|
6
|
+
import ArrowUpIcon from '@atlaskit/icon/glyph/arrow-up';
|
|
7
|
+
import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
|
|
8
|
+
import EditorLayoutThreeEqualIcon from '@atlaskit/icon/glyph/editor/layout-three-equal';
|
|
9
|
+
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
10
|
+
import HipchatChevronDoubleDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-down';
|
|
11
|
+
import HipchatChevronDoubleUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-up';
|
|
12
|
+
import { clearMultipleCells, insertColumn, insertRow, sortByColumn } from '../commands';
|
|
13
|
+
import { deleteColumnsCommand } from '../commands/delete';
|
|
1
14
|
import { moveSource } from '../pm-plugins/drag-and-drop/commands';
|
|
15
|
+
import { deleteRows } from '../transforms';
|
|
16
|
+
import { AddColLeftIcon, AddColRightIcon, AddRowAboveIcon, AddRowBelowIcon } from '../ui/icons';
|
|
2
17
|
const canDecrease = (index, min = 0) => index !== undefined && index > min;
|
|
3
18
|
const canIncrease = (index, max = 0) => index !== undefined && index < max;
|
|
4
|
-
export const getDragMenuConfig = (direction, tableMap, index) => {
|
|
19
|
+
export const getDragMenuConfig = (direction, getEditorContainerWidth, tableMap, index, targetCellPosition, selectionRect) => {
|
|
20
|
+
const addOptions = direction === 'row' ? [{
|
|
21
|
+
label: 'above',
|
|
22
|
+
offset: 0,
|
|
23
|
+
icon: AddRowAboveIcon,
|
|
24
|
+
keymap: addRowBefore
|
|
25
|
+
}, {
|
|
26
|
+
label: 'below',
|
|
27
|
+
offset: 1,
|
|
28
|
+
icon: AddRowBelowIcon,
|
|
29
|
+
keymap: addRowAfter
|
|
30
|
+
}] : [{
|
|
31
|
+
label: 'left',
|
|
32
|
+
offset: 0,
|
|
33
|
+
icon: AddColLeftIcon,
|
|
34
|
+
keymap: addColumnBefore
|
|
35
|
+
}, {
|
|
36
|
+
label: 'right',
|
|
37
|
+
offset: 1,
|
|
38
|
+
icon: AddColRightIcon,
|
|
39
|
+
keymap: addColumnAfter
|
|
40
|
+
}];
|
|
5
41
|
const moveOptions = direction === 'row' ? [{
|
|
6
42
|
label: 'up',
|
|
7
43
|
offset: -1,
|
|
8
|
-
canMove: canDecrease
|
|
44
|
+
canMove: canDecrease,
|
|
45
|
+
icon: ArrowUpIcon
|
|
9
46
|
}, {
|
|
10
47
|
label: 'down',
|
|
11
48
|
offset: 1,
|
|
12
49
|
canMove: index => {
|
|
13
50
|
var _tableMap$height;
|
|
14
51
|
return canIncrease(index, ((_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0) - 1);
|
|
15
|
-
}
|
|
52
|
+
},
|
|
53
|
+
icon: ArrowDownIcon
|
|
16
54
|
}] : [{
|
|
17
55
|
label: 'left',
|
|
18
56
|
offset: -1,
|
|
19
|
-
canMove: canDecrease
|
|
57
|
+
canMove: canDecrease,
|
|
58
|
+
icon: ArrowLeftIcon
|
|
20
59
|
}, {
|
|
21
60
|
label: 'right',
|
|
22
61
|
offset: 1,
|
|
23
62
|
canMove: index => {
|
|
24
63
|
var _tableMap$width;
|
|
25
64
|
return canIncrease(index, ((_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0) - 1);
|
|
26
|
-
}
|
|
65
|
+
},
|
|
66
|
+
icon: ArrowRightIcon
|
|
27
67
|
}];
|
|
28
|
-
|
|
68
|
+
const sortOptions = direction === 'column' ? [{
|
|
69
|
+
label: 'increasing',
|
|
70
|
+
order: SortOrder.ASC,
|
|
71
|
+
icon: HipchatChevronDoubleUpIcon
|
|
72
|
+
}, {
|
|
73
|
+
label: 'decreasing',
|
|
74
|
+
order: SortOrder.DESC,
|
|
75
|
+
icon: HipchatChevronDoubleDownIcon
|
|
76
|
+
}] : [];
|
|
77
|
+
return [...addOptions.map(({
|
|
29
78
|
label,
|
|
30
79
|
offset,
|
|
31
|
-
|
|
80
|
+
icon,
|
|
81
|
+
keymap
|
|
82
|
+
}) => ({
|
|
83
|
+
id: `add_${direction}_${label}`,
|
|
84
|
+
title: `Add ${direction} ${label}`,
|
|
85
|
+
icon,
|
|
86
|
+
onClick: (state, dispatch) => {
|
|
87
|
+
if (direction === 'row') {
|
|
88
|
+
insertRow(index + offset, true)(state, dispatch);
|
|
89
|
+
} else {
|
|
90
|
+
insertColumn(getEditorContainerWidth)(index + offset)(state, dispatch);
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
93
|
+
},
|
|
94
|
+
keymap: keymap && tooltip(keymap)
|
|
95
|
+
})), direction === 'column' ? {
|
|
96
|
+
id: 'distribute_columns',
|
|
97
|
+
title: 'Distribute columns',
|
|
98
|
+
disabled: true,
|
|
99
|
+
onClick: () => {
|
|
100
|
+
return false;
|
|
101
|
+
},
|
|
102
|
+
icon: EditorLayoutThreeEqualIcon
|
|
103
|
+
} : undefined, {
|
|
104
|
+
id: 'clear_cells',
|
|
105
|
+
title: 'Clear cells',
|
|
106
|
+
onClick: (state, dispatch) => {
|
|
107
|
+
clearMultipleCells(targetCellPosition)(state, dispatch);
|
|
108
|
+
return true;
|
|
109
|
+
},
|
|
110
|
+
icon: CrossCircleIcon,
|
|
111
|
+
keymap: tooltip(backspace)
|
|
112
|
+
}, {
|
|
113
|
+
id: `delete_${direction}`,
|
|
114
|
+
title: `Delete ${direction}`,
|
|
115
|
+
onClick: (state, dispatch) => {
|
|
116
|
+
if (direction === 'row') {
|
|
117
|
+
dispatch === null || dispatch === void 0 ? void 0 : dispatch(deleteRows(selectionRect, false)(state.tr));
|
|
118
|
+
} else {
|
|
119
|
+
deleteColumnsCommand(selectionRect)(state, dispatch);
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
122
|
+
},
|
|
123
|
+
icon: RemoveIcon
|
|
124
|
+
}, ...moveOptions.map(({
|
|
125
|
+
label,
|
|
126
|
+
offset,
|
|
127
|
+
canMove,
|
|
128
|
+
icon
|
|
32
129
|
}) => ({
|
|
33
130
|
id: `move_${direction}_${label}`,
|
|
34
131
|
title: `Move ${direction} ${label}`,
|
|
35
132
|
disabled: !canMove(index),
|
|
133
|
+
icon,
|
|
36
134
|
onClick: (state, dispatch) => {
|
|
37
135
|
if (canMove(index)) {
|
|
38
136
|
moveSource(`table-${direction}`, index, index + offset)(state, dispatch);
|
|
@@ -40,5 +138,17 @@ export const getDragMenuConfig = (direction, tableMap, index) => {
|
|
|
40
138
|
}
|
|
41
139
|
return false;
|
|
42
140
|
}
|
|
43
|
-
}))
|
|
141
|
+
})), ...sortOptions.map(({
|
|
142
|
+
label,
|
|
143
|
+
order,
|
|
144
|
+
icon
|
|
145
|
+
}) => ({
|
|
146
|
+
id: `sort_column_${order}`,
|
|
147
|
+
title: `Sort ${label}`,
|
|
148
|
+
icon,
|
|
149
|
+
onClick: (state, dispatch) => {
|
|
150
|
+
sortByColumn(index, order)(state, dispatch);
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
}))].filter(Boolean);
|
|
44
154
|
};
|
|
@@ -2,7 +2,7 @@ export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, is
|
|
|
2
2
|
export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnInsertLine, createColumnLineResize, createRowInsertLine } from './decoration';
|
|
3
3
|
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, isLayoutSupported, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow } from './nodes';
|
|
4
4
|
export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell } from './paste';
|
|
5
|
-
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowDragControlsButton, isRowControlsButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler } from './dom';
|
|
5
|
+
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowDragControlsButton, isRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler } from './dom';
|
|
6
6
|
export { getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames } from './column-controls';
|
|
7
7
|
export { getRowHeights, isRowDeleteButtonVisible, getRowDeleteButtonParams, getRowsParams, getRowClassNames, copyPreviousRow } from './row-controls';
|
|
8
8
|
export { getSelectedTableInfo, getSelectedCellInfo } from './analytics';
|
|
@@ -10,7 +10,7 @@ import { getPluginState } from './pm-plugins/plugin-factory';
|
|
|
10
10
|
import { getPluginState as getResizePluginState } from './pm-plugins/table-resizing/plugin-factory';
|
|
11
11
|
import { deleteColumns, deleteRows } from './transforms';
|
|
12
12
|
import { RESIZE_HANDLE_AREA_DECORATION_GAP } from './types';
|
|
13
|
-
import { getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, getSelectedCellInfo, hasResizeHandler, isCell, isColumnControlsDecorations, isCornerButton, isInsertRowButton, isResizeHandleDecoration, isRowControlsButton, isTableContainerOrWrapper, isTableControlsButton } from './utils';
|
|
13
|
+
import { getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, getSelectedCellInfo, hasResizeHandler, isCell, isColumnControlsDecorations, isCornerButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isInsertRowButton, isResizeHandleDecoration, isRowControlsButton, isTableContainerOrWrapper, isTableControlsButton } from './utils';
|
|
14
14
|
import { getAllowAddColumnCustomStep } from './utils/get-allow-add-column-custom-step';
|
|
15
15
|
var isFocusingCalendar = function isFocusingCalendar(event) {
|
|
16
16
|
return event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && event.relatedTarget.getAttribute('aria-label') === 'calendar';
|
|
@@ -21,12 +21,15 @@ var isFocusingModal = function isFocusingModal(event) {
|
|
|
21
21
|
var isFocusingFloatingToolbar = function isFocusingFloatingToolbar(event) {
|
|
22
22
|
return event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('[role="toolbar"]');
|
|
23
23
|
};
|
|
24
|
+
var isFocusingDragHandles = function isFocusingDragHandles(event) {
|
|
25
|
+
return event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('button') && event.relatedTarget.getAttribute('draggable') === 'true';
|
|
26
|
+
};
|
|
24
27
|
export var handleBlur = function handleBlur(view, event) {
|
|
25
28
|
var state = view.state,
|
|
26
29
|
dispatch = view.dispatch;
|
|
27
30
|
// IE version check for ED-4665
|
|
28
31
|
// Calendar focus check for ED-10466
|
|
29
|
-
if (browser.ie_version !== 11 && !isFocusingCalendar(event) && !isFocusingModal(event) && !isFocusingFloatingToolbar(event)) {
|
|
32
|
+
if (browser.ie_version !== 11 && !isFocusingCalendar(event) && !isFocusingModal(event) && !isFocusingFloatingToolbar(event) && !isFocusingDragHandles(event)) {
|
|
30
33
|
setEditorFocus(false)(state, dispatch);
|
|
31
34
|
}
|
|
32
35
|
event.preventDefault();
|
|
@@ -183,7 +186,7 @@ export var handleMouseMove = function handleMouseMove(view, event, elementConten
|
|
|
183
186
|
return false;
|
|
184
187
|
}
|
|
185
188
|
var element = event.target;
|
|
186
|
-
if (isColumnControlsDecorations(element)) {
|
|
189
|
+
if (isColumnControlsDecorations(element) || isDragColumnFloatingInsertDot(element)) {
|
|
187
190
|
var state = view.state,
|
|
188
191
|
dispatch = view.dispatch;
|
|
189
192
|
var _getPluginState3 = getPluginState(state),
|
|
@@ -197,7 +200,7 @@ export var handleMouseMove = function handleMouseMove(view, event, elementConten
|
|
|
197
200
|
return showInsertColumnButton(positionColumn)(state, dispatch);
|
|
198
201
|
}
|
|
199
202
|
}
|
|
200
|
-
if (isRowControlsButton(element)) {
|
|
203
|
+
if (isRowControlsButton(element) || isDragRowFloatingInsertDot(element)) {
|
|
201
204
|
var _state3 = view.state,
|
|
202
205
|
_dispatch4 = view.dispatch;
|
|
203
206
|
var _getPluginState4 = getPluginState(_state3),
|
|
@@ -268,8 +268,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
268
268
|
insertRowButtonIndex = _ref14.insertRowButtonIndex,
|
|
269
269
|
isHeaderColumnEnabled = _ref14.isHeaderColumnEnabled,
|
|
270
270
|
isHeaderRowEnabled = _ref14.isHeaderRowEnabled,
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
isDragAndDropEnabled = _ref14.isDragAndDropEnabled,
|
|
272
|
+
tableWrapperTarget = _ref14.tableWrapperTarget;
|
|
273
273
|
var allowControls = pluginConfig.allowControls;
|
|
274
274
|
var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
|
|
275
275
|
var LayoutContent = options && !options.tableResizingEnabled && isLayoutSupported(state) && options.breakoutEnabled ? /*#__PURE__*/React.createElement(LayoutButton, {
|
|
@@ -302,6 +302,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
302
302
|
insertRowButtonIndex: insertRowButtonIndex,
|
|
303
303
|
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
304
304
|
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
305
|
+
isDragAndDropEnabled: isDragAndDropEnabled,
|
|
305
306
|
editorView: editorView,
|
|
306
307
|
mountPoint: popupsMountPoint,
|
|
307
308
|
boundariesElement: popupsBoundariesElement,
|
|
@@ -329,8 +330,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
329
330
|
targetCellPosition: targetCellPosition,
|
|
330
331
|
direction: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuDirection,
|
|
331
332
|
index: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuIndex,
|
|
332
|
-
isOpen: !!(dragAndDropState !== null && dragAndDropState !== void 0 && dragAndDropState.isDragMenuOpen) && !isResizing
|
|
333
|
-
|
|
333
|
+
isOpen: !!(dragAndDropState !== null && dragAndDropState !== void 0 && dragAndDropState.isDragMenuOpen) && !isResizing,
|
|
334
|
+
getEditorContainerWidth: defaultGetEditorContainerWidth
|
|
335
|
+
}), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
334
336
|
editorView: editorView,
|
|
335
337
|
selection: editorView.state.selection,
|
|
336
338
|
tableRef: tableRef,
|
|
@@ -11,7 +11,7 @@ export var getDecorations = function getDecorations(state) {
|
|
|
11
11
|
return pluginKey.getState(state);
|
|
12
12
|
};
|
|
13
13
|
export var handleDocOrSelectionChanged = function handleDocOrSelectionChanged(tr, decorationSet, oldState, newState) {
|
|
14
|
-
var _tableWidthPluginKey$, _tableWidthPluginKey$2
|
|
14
|
+
var _tableWidthPluginKey$, _tableWidthPluginKey$2;
|
|
15
15
|
var isResizing = (_tableWidthPluginKey$ = tableWidthPluginKey.getState(newState)) === null || _tableWidthPluginKey$ === void 0 ? void 0 : _tableWidthPluginKey$.resizing;
|
|
16
16
|
var wasResizing = (_tableWidthPluginKey$2 = tableWidthPluginKey.getState(oldState)) === null || _tableWidthPluginKey$2 === void 0 ? void 0 : _tableWidthPluginKey$2.resizing;
|
|
17
17
|
var changedResizing = isResizing !== wasResizing;
|
|
@@ -19,7 +19,7 @@ export var handleDocOrSelectionChanged = function handleDocOrSelectionChanged(tr
|
|
|
19
19
|
// Remove column controls when resizing and don't add column decoration controls when DnD enabled
|
|
20
20
|
if (isResizing || getBooleanFF('platform.editor.table.drag-and-drop')) {
|
|
21
21
|
return DecorationSet.empty;
|
|
22
|
-
} else if (tr.docChanged || tr.selection instanceof CellSelection || changedResizing
|
|
22
|
+
} else if (tr.docChanged || tr.selection instanceof CellSelection || changedResizing) {
|
|
23
23
|
return buildColumnControlsDecorations({
|
|
24
24
|
decorationSet: decorationSet,
|
|
25
25
|
tr: tr
|
|
@@ -42,16 +42,12 @@ export var createPlugin = function createPlugin() {
|
|
|
42
42
|
return DecorationSet.empty;
|
|
43
43
|
},
|
|
44
44
|
apply: function apply(tr, decorationSet, oldState, newState) {
|
|
45
|
-
var _tablePluginKey$getSt, _tablePluginKey$getSt2;
|
|
46
45
|
var pluginState = decorationSet;
|
|
47
46
|
var meta = tr.getMeta(tablePluginKey);
|
|
48
|
-
var previousHover = (_tablePluginKey$getSt = tablePluginKey.getState(oldState)) === null || _tablePluginKey$getSt === void 0 ? void 0 : _tablePluginKey$getSt.hoveredCell;
|
|
49
|
-
var newHover = (_tablePluginKey$getSt2 = tablePluginKey.getState(newState)) === null || _tablePluginKey$getSt2 === void 0 ? void 0 : _tablePluginKey$getSt2.hoveredCell;
|
|
50
|
-
var changedCellHover = (previousHover === null || previousHover === void 0 ? void 0 : previousHover.colIndex) !== (newHover === null || newHover === void 0 ? void 0 : newHover.colIndex) || (previousHover === null || previousHover === void 0 ? void 0 : previousHover.rowIndex) !== (newHover === null || newHover === void 0 ? void 0 : newHover.rowIndex);
|
|
51
47
|
if (meta && meta.data && meta.data.decorationSet) {
|
|
52
48
|
pluginState = meta.data.decorationSet;
|
|
53
49
|
}
|
|
54
|
-
if (tr.docChanged || tr.selectionSet || tr.getMeta(tableWidthPluginKey)
|
|
50
|
+
if (tr.docChanged || tr.selectionSet || tr.getMeta(tableWidthPluginKey)) {
|
|
55
51
|
pluginState = pluginState.map(tr.mapping, tr.doc);
|
|
56
52
|
return handleDocOrSelectionChanged(tr, pluginState, oldState, newState);
|
|
57
53
|
}
|
|
@@ -4,7 +4,6 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
|
4
4
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
5
5
|
import { TableDecorations } from '../../../types';
|
|
6
6
|
import { createColumnControlsDecoration, createColumnSelectedDecoration, findColumnControlSelectedDecoration, findControlsHoverDecoration, updateDecorations } from '../../../utils/decoration';
|
|
7
|
-
import { pluginKey as tablePluginKey } from '../../plugin-key';
|
|
8
7
|
import { composeDecorations } from './compose-decorations';
|
|
9
8
|
var isColumnSelected = function isColumnSelected(tr) {
|
|
10
9
|
return tr.selection instanceof CellSelection && tr.selection.isColSelection();
|
|
@@ -27,10 +26,9 @@ var maybeUpdateColumnControlsDecoration = function maybeUpdateColumnControlsDeco
|
|
|
27
26
|
var decorationSet = _ref3.decorationSet,
|
|
28
27
|
tr = _ref3.tr;
|
|
29
28
|
var table = findTable(tr.selection);
|
|
30
|
-
var meta = tr.getMeta(tablePluginKey);
|
|
31
29
|
|
|
32
30
|
// avoid re-drawing state if dnd decorations don't need to be updated
|
|
33
|
-
if (!table
|
|
31
|
+
if (!table) {
|
|
34
32
|
return decorationSet;
|
|
35
33
|
}
|
|
36
34
|
return updateDecorations(tr.doc, decorationSet, createColumnControlsDecoration(tr.selection), TableDecorations.COLUMN_CONTROLS_DECORATIONS);
|
|
@@ -2,6 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import { getCellsInRow } from '@atlaskit/editor-tables/utils';
|
|
5
|
+
import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
|
|
5
6
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
|
|
6
7
|
import { hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils/merged-cells';
|
|
7
8
|
import { getPluginState as getTablePluginState } from '../plugin-factory';
|
|
@@ -80,7 +81,16 @@ export var createPlugin = function createPlugin(dispatch, eventDispatcher) {
|
|
|
80
81
|
// watch for changes
|
|
81
82
|
return localId === (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.localId);
|
|
82
83
|
},
|
|
84
|
+
onDragStart: function onDragStart(_ref3) {
|
|
85
|
+
var location = _ref3.location;
|
|
86
|
+
autoScroller.start({
|
|
87
|
+
input: location.current.input
|
|
88
|
+
});
|
|
89
|
+
},
|
|
83
90
|
onDrag: function onDrag(event) {
|
|
91
|
+
autoScroller.updateInput({
|
|
92
|
+
input: event.location.current.input
|
|
93
|
+
});
|
|
84
94
|
var data = getDraggableDataFromEvent(event);
|
|
85
95
|
// If no data can be found then it's most like we do not want to perform any drag actions
|
|
86
96
|
if (!data) {
|
|
@@ -96,6 +106,7 @@ export var createPlugin = function createPlugin(dispatch, eventDispatcher) {
|
|
|
96
106
|
setDropTarget(dropTargetType, targetAdjustedIndex)(editorView.state, editorView.dispatch);
|
|
97
107
|
},
|
|
98
108
|
onDrop: function onDrop(event) {
|
|
109
|
+
autoScroller.stop();
|
|
99
110
|
var data = getDraggableDataFromEvent(event);
|
|
100
111
|
|
|
101
112
|
// If no data can be found then it's most like we do not want to perform any drop action
|