@atlaskit/editor-plugin-table 5.3.15 → 5.3.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 +14 -0
- package/dist/cjs/plugins/table/event-handlers.js +4 -3
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +1 -0
- package/dist/cjs/plugins/table/types.js +5 -3
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +5 -0
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +3 -11
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +2 -2
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/index.js +1 -1
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +114 -0
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.js +60 -0
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +11 -112
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/types.js +5 -0
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +1 -7
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +7 -2
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/ui/messages.js +5 -0
- package/dist/cjs/plugins/table/ui/ui-styles.js +28 -25
- package/dist/cjs/plugins/table/utils/dom.js +16 -7
- package/dist/cjs/plugins/table/utils/index.js +12 -6
- package/dist/es2019/plugins/table/event-handlers.js +5 -4
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +2 -1
- package/dist/es2019/plugins/table/types.js +5 -3
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +5 -0
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +3 -11
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +2 -2
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/index.js +1 -1
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +93 -0
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.js +61 -0
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -99
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/types.js +1 -0
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +1 -7
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +8 -3
- package/dist/es2019/plugins/table/ui/common-styles.js +8 -6
- package/dist/es2019/plugins/table/ui/messages.js +5 -0
- package/dist/es2019/plugins/table/ui/ui-styles.js +44 -3
- package/dist/es2019/plugins/table/utils/dom.js +13 -6
- package/dist/es2019/plugins/table/utils/index.js +1 -1
- package/dist/esm/plugins/table/event-handlers.js +5 -4
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +2 -1
- package/dist/esm/plugins/table/types.js +5 -3
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +5 -0
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +3 -11
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +2 -2
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/index.js +1 -1
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +104 -0
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.js +50 -0
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -110
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/types.js +1 -0
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +1 -7
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +8 -3
- package/dist/esm/plugins/table/ui/common-styles.js +2 -2
- package/dist/esm/plugins/table/ui/messages.js +5 -0
- package/dist/esm/plugins/table/ui/ui-styles.js +27 -24
- package/dist/esm/plugins/table/utils/dom.js +15 -6
- package/dist/esm/plugins/table/utils/index.js +1 -1
- package/dist/types/plugins/table/types.d.ts +5 -3
- package/dist/types/plugins/table/ui/TableFloatingControls/CornerControls/ClassicCornerControls.d.ts +6 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +6 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +2 -16
- package/dist/types/plugins/table/ui/TableFloatingControls/CornerControls/types.d.ts +11 -0
- package/dist/types/plugins/table/ui/messages.d.ts +5 -0
- package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -0
- package/dist/types/plugins/table/utils/dom.d.ts +3 -2
- package/dist/types/plugins/table/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +5 -3
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/ClassicCornerControls.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +2 -16
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/types.d.ts +11 -0
- package/dist/types-ts4.5/plugins/table/ui/messages.d.ts +5 -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 +3 -2
- package/dist/types-ts4.5/plugins/table/utils/index.d.ts +1 -1
- package/package.json +4 -4
- package/src/plugins/table/event-handlers.ts +7 -2
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +7 -1
- package/src/plugins/table/types.ts +7 -4
- package/src/plugins/table/ui/FloatingInsertButton/index.tsx +8 -0
- package/src/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.tsx +5 -7
- package/src/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +2 -2
- package/src/plugins/table/ui/TableFloatingColumnControls/index.tsx +1 -1
- package/src/plugins/table/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +107 -0
- package/src/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +66 -0
- package/src/plugins/table/ui/TableFloatingControls/CornerControls/index.tsx +2 -125
- package/src/plugins/table/ui/TableFloatingControls/CornerControls/types.ts +12 -0
- package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +3 -3
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +22 -14
- package/src/plugins/table/ui/common-styles.ts +8 -5
- package/src/plugins/table/ui/messages.ts +6 -0
- package/src/plugins/table/ui/ui-styles.ts +45 -3
- package/src/plugins/table/utils/dom.ts +16 -4
- package/src/plugins/table/utils/index.ts +2 -1
|
@@ -35,6 +35,11 @@ export class FloatingInsertButton extends React.Component {
|
|
|
35
35
|
isDragAndDropEnabled,
|
|
36
36
|
dispatchAnalyticsEvent
|
|
37
37
|
} = this.props;
|
|
38
|
+
|
|
39
|
+
// TODO: temporarily disable insert button for first column and row https://atlassian.slack.com/archives/C05U8HRQM50/p1698363744682219?thread_ts=1698209039.104909&cid=C05U8HRQM50
|
|
40
|
+
if (isDragAndDropEnabled && (insertColumnButtonIndex === 0 || insertRowButtonIndex === 0)) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
38
43
|
const type = typeof insertColumnButtonIndex !== 'undefined' ? 'column' : typeof insertRowButtonIndex !== 'undefined' ? 'row' : null;
|
|
39
44
|
if (!tableNode || !tableRef || !type) {
|
|
40
45
|
return null;
|
|
@@ -78,7 +78,7 @@ export const ColumnControls = ({
|
|
|
78
78
|
return /*#__PURE__*/React.createElement("div", {
|
|
79
79
|
className: ClassName.DRAG_COLUMN_CONTROLS
|
|
80
80
|
}, /*#__PURE__*/React.createElement("div", {
|
|
81
|
-
className: ClassName.
|
|
81
|
+
className: ClassName.DRAG_COLUMN_CONTROLS_INNER,
|
|
82
82
|
"data-testid": "table-floating-column-controls",
|
|
83
83
|
style: {
|
|
84
84
|
gridTemplateColumns: widths,
|
|
@@ -96,13 +96,7 @@ export const ColumnControls = ({
|
|
|
96
96
|
className: ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER,
|
|
97
97
|
contentEditable: false,
|
|
98
98
|
key: index
|
|
99
|
-
},
|
|
100
|
-
style: {
|
|
101
|
-
left: '0px',
|
|
102
|
-
right: 'unset'
|
|
103
|
-
},
|
|
104
|
-
className: ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT
|
|
105
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
106
100
|
className: ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT,
|
|
107
101
|
style: columnParams.length - 1 === index ? {
|
|
108
102
|
right: '0'
|
|
@@ -110,12 +104,10 @@ export const ColumnControls = ({
|
|
|
110
104
|
}))), tableActive && !isResizing && !!hoveredCell && Number.isFinite(hoveredCell.colIndex) && /*#__PURE__*/React.createElement("div", {
|
|
111
105
|
style: {
|
|
112
106
|
gridColumn: gridColumnPosition,
|
|
113
|
-
zIndex: 99,
|
|
114
107
|
display: 'flex',
|
|
115
|
-
width: '100%',
|
|
116
108
|
justifyContent: 'center',
|
|
117
109
|
alignItems: 'center',
|
|
118
|
-
|
|
110
|
+
zIndex: 99
|
|
119
111
|
},
|
|
120
112
|
"data-column-control-index": hoveredCell.colIndex,
|
|
121
113
|
"data-testid": "table-floating-column-control"
|
|
@@ -17,10 +17,10 @@ export const ColumnDropTargets = ({
|
|
|
17
17
|
const hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
|
|
18
18
|
const marginTop = hasHeaderRow && stickyTop !== undefined ? (_rowHeights$ = rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights[0]) !== null && _rowHeights$ !== void 0 ? _rowHeights$ : 0 : 0;
|
|
19
19
|
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
-
className: ClassName.
|
|
20
|
+
className: ClassName.DRAG_COLUMN_DROP_TARGET_CONTROLS,
|
|
21
21
|
contentEditable: false
|
|
22
22
|
}, /*#__PURE__*/React.createElement("div", {
|
|
23
|
-
className: ClassName.
|
|
23
|
+
className: ClassName.DRAG_COLUMN_CONTROLS_INNER,
|
|
24
24
|
"data-testid": "table-floating-column-controls-drop-targets"
|
|
25
25
|
}, colWidths === null || colWidths === void 0 ? void 0 : colWidths.map((width, index) => {
|
|
26
26
|
return /*#__PURE__*/React.createElement(ColumnDropTarget, {
|
|
@@ -81,7 +81,7 @@ export const TableFloatingColumnControls = ({
|
|
|
81
81
|
return null;
|
|
82
82
|
}
|
|
83
83
|
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement("div", {
|
|
84
|
-
className: ClassName.
|
|
84
|
+
className: ClassName.DRAG_COLUMN_CONTROLS_WRAPPER,
|
|
85
85
|
"data-testid": "table-floating-column-controls-wrapper"
|
|
86
86
|
}, /*#__PURE__*/React.createElement(ColumnControls, {
|
|
87
87
|
editorView: editorView,
|
package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import React, { Component } from 'react';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import { injectIntl } from 'react-intl-next';
|
|
5
|
+
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
6
|
+
import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
|
|
7
|
+
import { clearHoverSelection, hoverTable } from '../../../commands';
|
|
8
|
+
import { TableCssClassName as ClassName } from '../../../types';
|
|
9
|
+
import messages from '../../messages';
|
|
10
|
+
class CornerControlComponent extends Component {
|
|
11
|
+
constructor(...args) {
|
|
12
|
+
super(...args);
|
|
13
|
+
_defineProperty(this, "isActive", () => {
|
|
14
|
+
const {
|
|
15
|
+
editorView,
|
|
16
|
+
hoveredRows,
|
|
17
|
+
isResizing
|
|
18
|
+
} = this.props;
|
|
19
|
+
const {
|
|
20
|
+
selection
|
|
21
|
+
} = editorView.state;
|
|
22
|
+
const table = findTable(selection);
|
|
23
|
+
if (!table) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return isTableSelected(selection) || hoveredRows && hoveredRows.length === TableMap.get(table.node).height && !isResizing;
|
|
27
|
+
});
|
|
28
|
+
_defineProperty(this, "clearHoverSelection", () => {
|
|
29
|
+
const {
|
|
30
|
+
state,
|
|
31
|
+
dispatch
|
|
32
|
+
} = this.props.editorView;
|
|
33
|
+
clearHoverSelection()(state, dispatch);
|
|
34
|
+
});
|
|
35
|
+
_defineProperty(this, "selectTable", () => {
|
|
36
|
+
const {
|
|
37
|
+
state,
|
|
38
|
+
dispatch
|
|
39
|
+
} = this.props.editorView;
|
|
40
|
+
dispatch(selectTable(state.tr).setMeta('addToHistory', false));
|
|
41
|
+
});
|
|
42
|
+
_defineProperty(this, "hoverTable", () => {
|
|
43
|
+
const {
|
|
44
|
+
state,
|
|
45
|
+
dispatch
|
|
46
|
+
} = this.props.editorView;
|
|
47
|
+
hoverTable()(state, dispatch);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
render() {
|
|
51
|
+
const {
|
|
52
|
+
isInDanger,
|
|
53
|
+
tableRef,
|
|
54
|
+
isHeaderColumnEnabled,
|
|
55
|
+
isHeaderRowEnabled,
|
|
56
|
+
intl: {
|
|
57
|
+
formatMessage
|
|
58
|
+
}
|
|
59
|
+
} = this.props;
|
|
60
|
+
if (!tableRef) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const isActive = this.isActive();
|
|
64
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
65
|
+
className: classnames(ClassName.CORNER_CONTROLS, {
|
|
66
|
+
active: isActive,
|
|
67
|
+
sticky: this.props.stickyTop !== undefined
|
|
68
|
+
}),
|
|
69
|
+
style: {
|
|
70
|
+
top: this.props.stickyTop !== undefined ? `${this.props.stickyTop}px` : undefined
|
|
71
|
+
},
|
|
72
|
+
contentEditable: false
|
|
73
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
74
|
+
"aria-label": formatMessage(messages.cornerControl),
|
|
75
|
+
type: "button",
|
|
76
|
+
className: classnames(ClassName.CONTROLS_CORNER_BUTTON, {
|
|
77
|
+
danger: isActive && isInDanger
|
|
78
|
+
}),
|
|
79
|
+
onClick: this.selectTable,
|
|
80
|
+
onMouseOver: this.hoverTable,
|
|
81
|
+
onMouseOut: this.clearHoverSelection
|
|
82
|
+
}), !isHeaderRowEnabled && /*#__PURE__*/React.createElement("div", {
|
|
83
|
+
className: ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER
|
|
84
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
85
|
+
className: ClassName.CONTROLS_INSERT_MARKER
|
|
86
|
+
})), !isHeaderColumnEnabled && /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
className: ClassName.CORNER_CONTROLS_INSERT_COLUMN_MARKER
|
|
88
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
className: ClassName.CONTROLS_INSERT_MARKER
|
|
90
|
+
})));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export const CornerControls = injectIntl(CornerControlComponent);
|
package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { injectIntl } from 'react-intl-next';
|
|
4
|
+
import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
|
|
5
|
+
import { clearHoverSelection, hoverTable } from '../../../commands';
|
|
6
|
+
import { TableCssClassName as ClassName } from '../../../types';
|
|
7
|
+
import messages from '../../messages';
|
|
8
|
+
const DragCornerControlsComponent = ({
|
|
9
|
+
editorView,
|
|
10
|
+
isInDanger,
|
|
11
|
+
intl: {
|
|
12
|
+
formatMessage
|
|
13
|
+
}
|
|
14
|
+
}) => {
|
|
15
|
+
const handleOnClick = () => {
|
|
16
|
+
const {
|
|
17
|
+
state,
|
|
18
|
+
dispatch
|
|
19
|
+
} = editorView;
|
|
20
|
+
dispatch(selectTable(state.tr).setMeta('addToHistory', false));
|
|
21
|
+
};
|
|
22
|
+
const handleMouseOver = () => {
|
|
23
|
+
const {
|
|
24
|
+
state,
|
|
25
|
+
dispatch
|
|
26
|
+
} = editorView;
|
|
27
|
+
hoverTable()(state, dispatch);
|
|
28
|
+
};
|
|
29
|
+
const handleMouseOut = () => {
|
|
30
|
+
const {
|
|
31
|
+
state,
|
|
32
|
+
dispatch
|
|
33
|
+
} = editorView;
|
|
34
|
+
clearHoverSelection()(state, dispatch);
|
|
35
|
+
};
|
|
36
|
+
const isActive = useMemo(() => {
|
|
37
|
+
const {
|
|
38
|
+
selection
|
|
39
|
+
} = editorView.state;
|
|
40
|
+
const table = findTable(selection);
|
|
41
|
+
if (!table) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
return isTableSelected(selection);
|
|
45
|
+
}, [editorView.state]);
|
|
46
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
47
|
+
className: classnames(ClassName.DRAG_CORNER_BUTTON, {
|
|
48
|
+
active: isActive,
|
|
49
|
+
danger: isActive && isInDanger
|
|
50
|
+
}),
|
|
51
|
+
"aria-label": formatMessage(messages.cornerControl),
|
|
52
|
+
type: "button",
|
|
53
|
+
onClick: handleOnClick,
|
|
54
|
+
onMouseOver: handleMouseOver,
|
|
55
|
+
onMouseOut: handleMouseOut,
|
|
56
|
+
contentEditable: false
|
|
57
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: ClassName.DRAG_CORNER_BUTTON_INNER
|
|
59
|
+
}));
|
|
60
|
+
};
|
|
61
|
+
export const DragCornerControls = injectIntl(DragCornerControlsComponent);
|
|
@@ -1,99 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import classnames from 'classnames';
|
|
4
|
-
import { defineMessages, injectIntl } from 'react-intl-next';
|
|
5
|
-
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
6
|
-
import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
|
|
7
|
-
import { clearHoverSelection, hoverTable } from '../../../commands';
|
|
8
|
-
import { TableCssClassName as ClassName } from '../../../types';
|
|
9
|
-
const messages = defineMessages({
|
|
10
|
-
cornerControl: {
|
|
11
|
-
id: 'fabric.editor.cornerControl',
|
|
12
|
-
defaultMessage: 'Highlight table',
|
|
13
|
-
description: 'A button on the upper left corner of the table that shows up when the table is in focus. Clicking on it will select the entire table.'
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
class CornerControlComponent extends Component {
|
|
17
|
-
constructor(...args) {
|
|
18
|
-
super(...args);
|
|
19
|
-
_defineProperty(this, "isActive", () => {
|
|
20
|
-
const {
|
|
21
|
-
editorView,
|
|
22
|
-
hoveredRows,
|
|
23
|
-
isResizing
|
|
24
|
-
} = this.props;
|
|
25
|
-
const {
|
|
26
|
-
selection
|
|
27
|
-
} = editorView.state;
|
|
28
|
-
const table = findTable(selection);
|
|
29
|
-
if (!table) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
return isTableSelected(selection) || hoveredRows && hoveredRows.length === TableMap.get(table.node).height && !isResizing;
|
|
33
|
-
});
|
|
34
|
-
_defineProperty(this, "clearHoverSelection", () => {
|
|
35
|
-
const {
|
|
36
|
-
state,
|
|
37
|
-
dispatch
|
|
38
|
-
} = this.props.editorView;
|
|
39
|
-
clearHoverSelection()(state, dispatch);
|
|
40
|
-
});
|
|
41
|
-
_defineProperty(this, "selectTable", () => {
|
|
42
|
-
const {
|
|
43
|
-
state,
|
|
44
|
-
dispatch
|
|
45
|
-
} = this.props.editorView;
|
|
46
|
-
dispatch(selectTable(state.tr).setMeta('addToHistory', false));
|
|
47
|
-
});
|
|
48
|
-
_defineProperty(this, "hoverTable", () => {
|
|
49
|
-
const {
|
|
50
|
-
state,
|
|
51
|
-
dispatch
|
|
52
|
-
} = this.props.editorView;
|
|
53
|
-
hoverTable()(state, dispatch);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
render() {
|
|
57
|
-
const {
|
|
58
|
-
isInDanger,
|
|
59
|
-
tableRef,
|
|
60
|
-
isHeaderColumnEnabled,
|
|
61
|
-
isHeaderRowEnabled,
|
|
62
|
-
intl: {
|
|
63
|
-
formatMessage
|
|
64
|
-
}
|
|
65
|
-
} = this.props;
|
|
66
|
-
if (!tableRef) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
const isActive = this.isActive();
|
|
70
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
71
|
-
className: classnames(ClassName.CORNER_CONTROLS, {
|
|
72
|
-
active: isActive,
|
|
73
|
-
sticky: this.props.stickyTop !== undefined
|
|
74
|
-
}),
|
|
75
|
-
style: {
|
|
76
|
-
top: this.props.stickyTop !== undefined ? `${this.props.stickyTop}px` : undefined
|
|
77
|
-
},
|
|
78
|
-
contentEditable: false
|
|
79
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
80
|
-
"aria-label": formatMessage(messages.cornerControl),
|
|
81
|
-
type: "button",
|
|
82
|
-
className: classnames(ClassName.CONTROLS_CORNER_BUTTON, {
|
|
83
|
-
danger: isActive && isInDanger
|
|
84
|
-
}),
|
|
85
|
-
onClick: this.selectTable,
|
|
86
|
-
onMouseOver: this.hoverTable,
|
|
87
|
-
onMouseOut: this.clearHoverSelection
|
|
88
|
-
}), !isHeaderRowEnabled && /*#__PURE__*/React.createElement("div", {
|
|
89
|
-
className: ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER
|
|
90
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
91
|
-
className: ClassName.CONTROLS_INSERT_MARKER
|
|
92
|
-
})), !isHeaderColumnEnabled && /*#__PURE__*/React.createElement("div", {
|
|
93
|
-
className: ClassName.CORNER_CONTROLS_INSERT_COLUMN_MARKER
|
|
94
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
95
|
-
className: ClassName.CONTROLS_INSERT_MARKER
|
|
96
|
-
})));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
export const CornerControls = injectIntl(CornerControlComponent);
|
|
1
|
+
export { CornerControls } from './ClassicCornerControls';
|
|
2
|
+
export { DragCornerControls } from './DragCornerControls';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -90,13 +90,7 @@ const DragControlsComponent = ({
|
|
|
90
90
|
className: ClassName.DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER,
|
|
91
91
|
contentEditable: false,
|
|
92
92
|
key: index
|
|
93
|
-
},
|
|
94
|
-
style: {
|
|
95
|
-
top: '0px',
|
|
96
|
-
left: "var(--ds-space-075, 6px)"
|
|
97
|
-
},
|
|
98
|
-
className: ClassName.DRAG_ROW_FLOATING_INSERT_DOT
|
|
99
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
93
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
100
94
|
className: ClassName.DRAG_ROW_FLOATING_INSERT_DOT
|
|
101
95
|
}))), !isResizing && Number.isFinite(rowIndex) && /*#__PURE__*/React.createElement("div", {
|
|
102
96
|
style: {
|
|
@@ -4,7 +4,7 @@ import { browser } from '@atlaskit/editor-common/utils';
|
|
|
4
4
|
import { hoverCell, hoverRows, selectRow } from '../../commands';
|
|
5
5
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
6
6
|
import { isSelectionUpdated } from '../../utils';
|
|
7
|
-
import { CornerControls } from './CornerControls';
|
|
7
|
+
import { CornerControls, DragCornerControls } from './CornerControls';
|
|
8
8
|
import NumberColumn from './NumberColumn';
|
|
9
9
|
import { DragControls, RowControls } from './RowControls';
|
|
10
10
|
export default class TableFloatingControls extends Component {
|
|
@@ -137,7 +137,12 @@ export default class TableFloatingControls extends Component {
|
|
|
137
137
|
updateCellHoverLocation: this.updateCellHoverLocation,
|
|
138
138
|
stickyTop: stickyTop,
|
|
139
139
|
isDragAndDropEnabled: isDragAndDropEnabled
|
|
140
|
-
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(
|
|
140
|
+
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DragCornerControls, {
|
|
141
|
+
editorView: editorView,
|
|
142
|
+
tableRef: tableRef,
|
|
143
|
+
isInDanger: isInDanger,
|
|
144
|
+
isResizing: isResizing
|
|
145
|
+
}), /*#__PURE__*/React.createElement(DragControls, {
|
|
141
146
|
tableRef: tableRef,
|
|
142
147
|
tableNode: tableNode,
|
|
143
148
|
hoveredCell: hoveredCell,
|
|
@@ -149,7 +154,7 @@ export default class TableFloatingControls extends Component {
|
|
|
149
154
|
hoverRows: this.hoverRows,
|
|
150
155
|
selectRow: this.selectRow,
|
|
151
156
|
updateCellHoverLocation: this.updateCellHoverLocation
|
|
152
|
-
}) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CornerControls, {
|
|
157
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CornerControls, {
|
|
153
158
|
editorView: editorView,
|
|
154
159
|
tableRef: tableRef,
|
|
155
160
|
isInDanger: isInDanger,
|
|
@@ -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, dragInsertButtonWrapper, floatingColumnControls, HeaderButton, HeaderButtonDanger, HeaderButtonHover, hoveredCell, hoveredDeleteButton, hoveredWarningCell, insertColumnButtonWrapper, insertLine, InsertMarker, insertRowButtonWrapper, OverflowShadow, resizeHandle, rowControlsWrapperDotStyle } from './ui-styles';
|
|
10
|
+
import { columnControlsDecoration, columnControlsLineMarker, DeleteButton, dragCornerControlButton, 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
|
/*
|
|
@@ -272,6 +272,8 @@ export const tableStyles = props => {
|
|
|
272
272
|
|
|
273
273
|
${dragInsertButtonWrapper(props)}
|
|
274
274
|
|
|
275
|
+
${dragCornerControlButton(props)}
|
|
276
|
+
|
|
275
277
|
/* Delete button */
|
|
276
278
|
${DeleteButton(props)}
|
|
277
279
|
/* Ends Delete button */
|
|
@@ -455,7 +457,7 @@ export const tableStyles = props => {
|
|
|
455
457
|
}
|
|
456
458
|
}
|
|
457
459
|
|
|
458
|
-
.${ClassName.
|
|
460
|
+
.${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER} {
|
|
459
461
|
padding: 0 ${tablePadding}px;
|
|
460
462
|
}
|
|
461
463
|
|
|
@@ -630,11 +632,11 @@ export const tableStyles = props => {
|
|
|
630
632
|
}
|
|
631
633
|
|
|
632
634
|
.${ClassName.DRAG_COLUMN_CONTROLS} {
|
|
633
|
-
.${ClassName.
|
|
635
|
+
.${ClassName.DRAG_COLUMN_CONTROLS_INNER} {
|
|
634
636
|
height: 24px;
|
|
635
637
|
position: absolute;
|
|
636
638
|
top: ${"var(--ds-space-negative-150, -12px)"};
|
|
637
|
-
z-index: ${akEditorUnitZIndex};
|
|
639
|
+
z-index: ${akEditorUnitZIndex * 13};
|
|
638
640
|
}
|
|
639
641
|
|
|
640
642
|
.${ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER} {
|
|
@@ -917,9 +919,9 @@ export const tableStyles = props => {
|
|
|
917
919
|
z-index: ${akEditorUnitZIndex};
|
|
918
920
|
}
|
|
919
921
|
|
|
920
|
-
.${ClassName.
|
|
922
|
+
.${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER} {
|
|
921
923
|
position: absolute;
|
|
922
|
-
top: ${tableMarginTop
|
|
924
|
+
top: ${tableMarginTop}px;
|
|
923
925
|
}
|
|
924
926
|
|
|
925
927
|
${tableWrapperStyles()}
|
|
@@ -59,5 +59,10 @@ export default defineMessages({
|
|
|
59
59
|
id: 'fabric.editor.tables.adjustColumn',
|
|
60
60
|
defaultMessage: 'Adjust column',
|
|
61
61
|
description: 'Tooltip displayed on table column resize handle'
|
|
62
|
+
},
|
|
63
|
+
cornerControl: {
|
|
64
|
+
id: 'fabric.editor.cornerControl',
|
|
65
|
+
defaultMessage: 'Highlight table',
|
|
66
|
+
description: 'A button on the upper left corner of the table that shows up when the table is in focus. Clicking on it will select the entire table.'
|
|
62
67
|
}
|
|
63
68
|
});
|
|
@@ -136,6 +136,7 @@ export const dragInsertButtonWrapper = props => css`
|
|
|
136
136
|
bottom: -5px;
|
|
137
137
|
left: 3px;
|
|
138
138
|
}
|
|
139
|
+
|
|
139
140
|
.${ClassName.DRAG_CONTROLS_INSERT_BUTTON} {
|
|
140
141
|
${Button(`
|
|
141
142
|
background: ${"var(--ds-surface-overlay, white)"};
|
|
@@ -144,6 +145,7 @@ export const dragInsertButtonWrapper = props => css`
|
|
|
144
145
|
border-radius: 50%;
|
|
145
146
|
`)}
|
|
146
147
|
}
|
|
148
|
+
|
|
147
149
|
.${ClassName.DRAG_CONTROLS_INSERT_BUTTON}:hover {
|
|
148
150
|
background: ${`var(--ds-background-brand-bold, ${B300})`};
|
|
149
151
|
border: 1px solid ${`var(--ds-background-brand-bold, ${B300})`};
|
|
@@ -151,6 +153,45 @@ export const dragInsertButtonWrapper = props => css`
|
|
|
151
153
|
cursor: pointer;
|
|
152
154
|
}
|
|
153
155
|
`;
|
|
156
|
+
export const dragCornerControlButton = props => css`
|
|
157
|
+
.${ClassName.DRAG_CORNER_BUTTON} {
|
|
158
|
+
width: 12px;
|
|
159
|
+
height: 12px;
|
|
160
|
+
display: flex;
|
|
161
|
+
justify-content: center;
|
|
162
|
+
align-items: center;
|
|
163
|
+
position: absolute;
|
|
164
|
+
top: ${"var(--ds-space-negative-075, -6px)"};
|
|
165
|
+
left: ${"var(--ds-space-075, 6px)"};
|
|
166
|
+
background-color: ${"var(--ds-surface, #FFF)"};
|
|
167
|
+
border-radius: 50%;
|
|
168
|
+
border: none;
|
|
169
|
+
padding: 0;
|
|
170
|
+
outline: none;
|
|
171
|
+
z-index: ${akEditorUnitZIndex * 99};
|
|
172
|
+
|
|
173
|
+
&.active .${ClassName.DRAG_CORNER_BUTTON_INNER} {
|
|
174
|
+
background-color: ${"var(--ds-border-selected, #0C66E4)"};
|
|
175
|
+
border-color: ${"var(--ds-border-selected, #0C66E4)"};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&:hover {
|
|
179
|
+
cursor: pointer;
|
|
180
|
+
|
|
181
|
+
.${ClassName.DRAG_CORNER_BUTTON_INNER} {
|
|
182
|
+
border-color: ${"var(--ds-border-selected, #0C66E4)"};
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.${ClassName.DRAG_CORNER_BUTTON_INNER} {
|
|
188
|
+
border: 1px solid
|
|
189
|
+
${"var(--ds-background-accent-gray-subtler, #DCDFE4)"};
|
|
190
|
+
border-radius: 50%;
|
|
191
|
+
width: 6px;
|
|
192
|
+
height: 6px;
|
|
193
|
+
}
|
|
194
|
+
`;
|
|
154
195
|
export const insertColumnButtonWrapper = props => css`
|
|
155
196
|
${InsertButton()}
|
|
156
197
|
${InsertButtonHover()}
|
|
@@ -310,12 +351,12 @@ const getFloatingDotOverrides = props => {
|
|
|
310
351
|
};
|
|
311
352
|
export const floatingColumnControls = props => {
|
|
312
353
|
return css`
|
|
313
|
-
.${ClassName.
|
|
354
|
+
.${ClassName.DRAG_COLUMN_DROP_TARGET_CONTROLS} {
|
|
314
355
|
box-sizing: border-box;
|
|
315
356
|
position: absolute;
|
|
316
357
|
top: 0;
|
|
317
358
|
|
|
318
|
-
.${ClassName.
|
|
359
|
+
.${ClassName.DRAG_COLUMN_CONTROLS_INNER} {
|
|
319
360
|
display: flex;
|
|
320
361
|
flex-direction: row;
|
|
321
362
|
}
|
|
@@ -324,7 +365,7 @@ export const floatingColumnControls = props => {
|
|
|
324
365
|
.${ClassName.DRAG_COLUMN_CONTROLS} {
|
|
325
366
|
box-sizing: border-box;
|
|
326
367
|
|
|
327
|
-
.${ClassName.
|
|
368
|
+
.${ClassName.DRAG_COLUMN_CONTROLS_INNER} {
|
|
328
369
|
display: grid;
|
|
329
370
|
justify-items: center;
|
|
330
371
|
}
|
|
@@ -15,9 +15,10 @@ export const isTableControlsButton = node => containsClassName(node, ClassName.C
|
|
|
15
15
|
export const isTableContainerOrWrapper = node => containsClassName(node, ClassName.TABLE_CONTAINER) || containsClassName(node, ClassName.TABLE_NODE_WRAPPER);
|
|
16
16
|
|
|
17
17
|
/** drag-and-drop classes */
|
|
18
|
-
export const
|
|
18
|
+
export const isDragRowControlsButton = node => containsClassName(node, ClassName.DRAG_ROW_CONTROLS) || closestElement(node, `.${ClassName.DRAG_ROW_CONTROLS}`);
|
|
19
19
|
export const isDragRowFloatingInsertDot = node => containsClassName(node, ClassName.DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER);
|
|
20
20
|
export const isDragColumnFloatingInsertDot = node => containsClassName(node, ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER);
|
|
21
|
+
export const isDragCornerButton = node => containsClassName(node, ClassName.DRAG_CORNER_BUTTON) || containsClassName(node, ClassName.DRAG_CORNER_BUTTON_INNER);
|
|
21
22
|
|
|
22
23
|
/*
|
|
23
24
|
* This function returns which side of a given element the mouse cursor is,
|
|
@@ -73,14 +74,20 @@ export const isDragColumnFloatingInsertDot = node => containsClassName(node, Cla
|
|
|
73
74
|
* the same is valid to the right side.
|
|
74
75
|
*/
|
|
75
76
|
|
|
76
|
-
export const getMousePositionHorizontalRelativeByElement = (mouseEvent, elementContentRects, gapInPixels) => {
|
|
77
|
+
export const getMousePositionHorizontalRelativeByElement = (mouseEvent, elementContentRects, gapInPixels, isDragAndDropEnabled) => {
|
|
77
78
|
const element = mouseEvent.target;
|
|
78
79
|
if (element instanceof HTMLElement) {
|
|
79
|
-
var _closestCell$id, _elementContentRects$, _elementContentRects$2;
|
|
80
80
|
let width, x;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
if (isDragAndDropEnabled) {
|
|
82
|
+
// mouse event fires for new overlapping column controls, so the cell can not get detected. Get width
|
|
83
|
+
// directly from element that will be .pm-table-drag-columns-floating-insert-dot-wrapper
|
|
84
|
+
width = element.clientWidth;
|
|
85
|
+
} else {
|
|
86
|
+
var _closestCell$id, _elementContentRects$, _elementContentRects$2;
|
|
87
|
+
const closestCell = element.closest(SELECTOR_TABLE_LEAFS);
|
|
88
|
+
const id = (_closestCell$id = closestCell === null || closestCell === void 0 ? void 0 : closestCell.id) !== null && _closestCell$id !== void 0 ? _closestCell$id : '';
|
|
89
|
+
width = (_elementContentRects$ = elementContentRects === null || elementContentRects === void 0 ? void 0 : (_elementContentRects$2 = elementContentRects[id]) === null || _elementContentRects$2 === void 0 ? void 0 : _elementContentRects$2.width) !== null && _elementContentRects$ !== void 0 ? _elementContentRects$ : 0;
|
|
90
|
+
}
|
|
84
91
|
x = mouseEvent.offsetX;
|
|
85
92
|
if (width <= 0) {
|
|
86
93
|
return null;
|
|
@@ -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,
|
|
5
|
+
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, 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, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isInsertRowButton, isResizeHandleDecoration, isRowControlsButton, isTableContainerOrWrapper, isTableControlsButton } from './utils';
|
|
13
|
+
import { getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, getSelectedCellInfo, hasResizeHandler, isCell, isColumnControlsDecorations, isCornerButton, isDragColumnFloatingInsertDot, isDragCornerButton, 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';
|
|
@@ -133,7 +133,7 @@ export var handleMouseOver = function handleMouseOver(view, mouseEvent) {
|
|
|
133
133
|
// Ignore any `mousedown` `event` from control and numbered column buttons
|
|
134
134
|
// PM end up changing selection during shift selection if not prevented
|
|
135
135
|
export var handleMouseDown = function handleMouseDown(_, event) {
|
|
136
|
-
var isControl = !!(event.target && event.target instanceof HTMLElement && (isTableContainerOrWrapper(event.target) || isColumnControlsDecorations(event.target) || isRowControlsButton(event.target)));
|
|
136
|
+
var isControl = !!(event.target && event.target instanceof HTMLElement && (isTableContainerOrWrapper(event.target) || isColumnControlsDecorations(event.target) || isRowControlsButton(event.target) || isDragCornerButton(event.target)));
|
|
137
137
|
if (isControl) {
|
|
138
138
|
event.preventDefault();
|
|
139
139
|
}
|
|
@@ -190,12 +190,13 @@ export var handleMouseMove = function handleMouseMove(view, event, elementConten
|
|
|
190
190
|
var state = view.state,
|
|
191
191
|
dispatch = view.dispatch;
|
|
192
192
|
var _getPluginState3 = getPluginState(state),
|
|
193
|
-
insertColumnButtonIndex = _getPluginState3.insertColumnButtonIndex
|
|
193
|
+
insertColumnButtonIndex = _getPluginState3.insertColumnButtonIndex,
|
|
194
|
+
isDragAndDropEnabled = _getPluginState3.isDragAndDropEnabled;
|
|
194
195
|
var _getColumnOrRowIndex9 = getColumnOrRowIndex(element),
|
|
195
196
|
_getColumnOrRowIndex10 = _slicedToArray(_getColumnOrRowIndex9, 2),
|
|
196
197
|
startIndex = _getColumnOrRowIndex10[0],
|
|
197
198
|
endIndex = _getColumnOrRowIndex10[1];
|
|
198
|
-
var positionColumn = getMousePositionHorizontalRelativeByElement(event, elementContentRects) === 'right' ? endIndex : startIndex;
|
|
199
|
+
var positionColumn = getMousePositionHorizontalRelativeByElement(event, elementContentRects, undefined, isDragAndDropEnabled) === 'right' ? endIndex : startIndex;
|
|
199
200
|
if (positionColumn !== insertColumnButtonIndex) {
|
|
200
201
|
return showInsertColumnButton(positionColumn)(state, dispatch);
|
|
201
202
|
}
|
|
@@ -7,7 +7,7 @@ import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/el
|
|
|
7
7
|
import { hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils/merged-cells';
|
|
8
8
|
import { getPluginState as getTablePluginState } from '../plugin-factory';
|
|
9
9
|
import { DragAndDropActionType } from './actions';
|
|
10
|
-
import { clearDropTarget, moveSource, setDropTarget } from './commands';
|
|
10
|
+
import { clearDropTarget, moveSource, setDropTarget, toggleDragMenu } from './commands';
|
|
11
11
|
import { DropTargetType } from './consts';
|
|
12
12
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
13
13
|
import { pluginKey } from './plugin-key';
|
|
@@ -86,6 +86,7 @@ export var createPlugin = function createPlugin(dispatch, eventDispatcher) {
|
|
|
86
86
|
autoScroller.start({
|
|
87
87
|
input: location.current.input
|
|
88
88
|
});
|
|
89
|
+
toggleDragMenu(false)(editorView.state, editorView.dispatch);
|
|
89
90
|
},
|
|
90
91
|
onDrag: function onDrag(event) {
|
|
91
92
|
autoScroller.updateInput({
|