@atlaskit/editor-plugin-table 5.4.13 → 5.4.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/afm-cc/tsconfig.json +70 -0
- package/dist/cjs/plugins/table/commands/hover.js +26 -6
- package/dist/cjs/plugins/table/commands/index.js +6 -0
- package/dist/cjs/plugins/table/commands/misc.js +8 -3
- package/dist/cjs/plugins/table/event-handlers.js +56 -34
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +4 -1
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +7 -6
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +39 -7
- package/dist/cjs/plugins/table/pm-plugins/main.js +5 -3
- package/dist/cjs/plugins/table/reducer.js +1 -0
- package/dist/cjs/plugins/table/toolbar.js +6 -3
- package/dist/cjs/plugins/table/ui/ColumnResizeWidget/index.js +6 -3
- package/dist/cjs/plugins/table/ui/DragHandle/index.js +7 -5
- package/dist/cjs/plugins/table/ui/DragPreview/index.js +0 -2
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +10 -7
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +11 -10
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +6 -3
- package/dist/cjs/plugins/table/ui/FloatingDragMenu/DragMenu.js +7 -4
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +18 -8
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/index.js +3 -1
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +2 -1
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +12 -8
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/utils/dom.js +16 -1
- package/dist/cjs/plugins/table/utils/index.js +6 -0
- package/dist/es2019/plugins/table/commands/hover.js +22 -5
- package/dist/es2019/plugins/table/commands/index.js +1 -1
- package/dist/es2019/plugins/table/commands/misc.js +8 -3
- package/dist/es2019/plugins/table/event-handlers.js +45 -20
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +4 -1
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +7 -6
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +36 -3
- package/dist/es2019/plugins/table/pm-plugins/main.js +6 -4
- package/dist/es2019/plugins/table/reducer.js +1 -0
- package/dist/es2019/plugins/table/toolbar.js +5 -3
- package/dist/es2019/plugins/table/ui/ColumnResizeWidget/index.js +5 -3
- package/dist/es2019/plugins/table/ui/DragHandle/index.js +8 -6
- package/dist/es2019/plugins/table/ui/DragPreview/index.js +0 -2
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +9 -7
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +11 -9
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +5 -3
- package/dist/es2019/plugins/table/ui/FloatingDragMenu/DragMenu.js +6 -4
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +16 -8
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/index.js +3 -1
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +2 -1
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +12 -9
- package/dist/es2019/plugins/table/ui/common-styles.js +6 -4
- package/dist/es2019/plugins/table/utils/dom.js +13 -0
- package/dist/es2019/plugins/table/utils/index.js +1 -1
- package/dist/esm/plugins/table/commands/hover.js +25 -5
- package/dist/esm/plugins/table/commands/index.js +1 -1
- package/dist/esm/plugins/table/commands/misc.js +8 -3
- package/dist/esm/plugins/table/event-handlers.js +55 -33
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +4 -1
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +7 -6
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +35 -3
- package/dist/esm/plugins/table/pm-plugins/main.js +6 -4
- package/dist/esm/plugins/table/reducer.js +1 -0
- package/dist/esm/plugins/table/toolbar.js +5 -3
- package/dist/esm/plugins/table/ui/ColumnResizeWidget/index.js +5 -3
- package/dist/esm/plugins/table/ui/DragHandle/index.js +7 -5
- package/dist/esm/plugins/table/ui/DragPreview/index.js +0 -2
- package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +9 -7
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +11 -9
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +5 -3
- package/dist/esm/plugins/table/ui/FloatingDragMenu/DragMenu.js +6 -4
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +18 -8
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/index.js +3 -1
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +2 -1
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +12 -8
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/table/utils/dom.js +15 -0
- package/dist/esm/plugins/table/utils/index.js +1 -1
- package/dist/types/plugins/table/commands/hover.d.ts +2 -1
- package/dist/types/plugins/table/commands/index.d.ts +1 -1
- package/dist/types/plugins/table/commands/misc.d.ts +1 -1
- package/dist/types/plugins/table/event-handlers.d.ts +2 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +1 -1
- package/dist/types/plugins/table/types.d.ts +6 -2
- package/dist/types/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -1
- package/dist/types/plugins/table/ui/TableFloatingColumnControls/index.d.ts +1 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +1 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/index.d.ts +1 -0
- package/dist/types/plugins/table/utils/dom.d.ts +4 -0
- package/dist/types/plugins/table/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/commands/hover.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/commands/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/commands/misc.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +6 -2
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/utils/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/__tests__/unit/event-handlers.ts +2 -2
- package/src/__tests__/unit/ui/RowDragControls.tsx +1 -0
- package/src/plugins/table/commands/hover.ts +37 -7
- package/src/plugins/table/commands/index.ts +1 -0
- package/src/plugins/table/commands/misc.ts +9 -3
- package/src/plugins/table/event-handlers.ts +47 -29
- package/src/plugins/table/nodeviews/TableComponent.tsx +4 -1
- package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +7 -5
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +37 -2
- package/src/plugins/table/pm-plugins/main.ts +6 -3
- package/src/plugins/table/reducer.ts +1 -0
- package/src/plugins/table/types.ts +7 -2
- package/src/plugins/table/ui/DragHandle/index.tsx +7 -7
- package/src/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.tsx +16 -5
- package/src/plugins/table/ui/TableFloatingColumnControls/index.tsx +3 -0
- package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +3 -1
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +12 -5
- package/src/plugins/table/ui/common-styles.ts +6 -4
- package/src/plugins/table/utils/dom.ts +22 -0
- package/src/plugins/table/utils/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 5.4.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#59147](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/59147) [`f12e489f23b0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f12e489f23b0) - Re-build and deploy packages to NPM to resolve React/Compiled not found error (HOT-106483).
|
|
8
|
+
- [#59075](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/59075) [`f149e1b3253c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f149e1b3253c) - Fixed the apperance of a globe icon which occurs when dragging a column which generates a preview with 0px area. The preview width and height are now calculate when needed, rather then using the cached hovered cell value.
|
|
9
|
+
- [#58846](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58846) [`99f05f5ee5b5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/99f05f5ee5b5) - normalise cell positions as table maps are offsets for rowOrColumMoved event
|
|
10
|
+
- [#58451](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58451) [`174737fc3054`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/174737fc3054) - The table drag handles will now correctly display after dropping a row/column when previously the handle would disappear
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 5.4.14
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#58816](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58816) [`ce6fd55ca7ec`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ce6fd55ca7ec) - Disable pointer events for SVG file in drag handle which fixes an issue where the selection would move outside of table
|
|
18
|
+
|
|
3
19
|
## 5.4.13
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.confluence.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"target": "es5",
|
|
6
|
+
"composite": true,
|
|
7
|
+
"outDir": "../dist",
|
|
8
|
+
"rootDir": "../",
|
|
9
|
+
"baseUrl": "../"
|
|
10
|
+
},
|
|
11
|
+
"include": [
|
|
12
|
+
"../src/**/*.ts",
|
|
13
|
+
"../src/**/*.tsx"
|
|
14
|
+
],
|
|
15
|
+
"exclude": [
|
|
16
|
+
"../src/**/__tests__/*",
|
|
17
|
+
"../src/**/*.test.*",
|
|
18
|
+
"../src/**/test.*"
|
|
19
|
+
],
|
|
20
|
+
"references": [
|
|
21
|
+
{
|
|
22
|
+
"path": "../../custom-steps/afm-cc/tsconfig.json"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"path": "../../editor-common/afm-cc/tsconfig.json"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"path": "../../editor-palette/afm-cc/tsconfig.json"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"path": "../../editor-plugin-analytics/afm-cc/tsconfig.json"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"path": "../../editor-plugin-content-insertion/afm-cc/tsconfig.json"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"path": "../../editor-plugin-guideline/afm-cc/tsconfig.json"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"path": "../../editor-plugin-selection/afm-cc/tsconfig.json"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"path": "../../editor-plugin-width/afm-cc/tsconfig.json"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"path": "../../editor-shared-styles/afm-cc/tsconfig.json"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"path": "../../editor-tables/afm-cc/tsconfig.json"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"path": "../../../design-system/icon/afm-cc/tsconfig.json"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"path": "../../../platform/feature-flags/afm-cc/tsconfig.json"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"path": "../../../design-system/primitives/afm-cc/tsconfig.json"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"path": "../../../design-system/theme/afm-cc/tsconfig.json"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"path": "../../../design-system/tokens/afm-cc/tsconfig.json"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"path": "../../../design-system/tooltip/afm-cc/tsconfig.json"
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.showResizeHandleLine = exports.hoverTable = exports.hoverRows = exports.hoverMergedCells = exports.hoverColumns = exports.hoverCell = exports.hideResizeHandleLine = exports.clearHoverSelection = void 0;
|
|
6
|
+
exports.showResizeHandleLine = exports.setTableHovered = exports.hoverTable = exports.hoverRows = exports.hoverMergedCells = exports.hoverColumns = exports.hoverCell = exports.hideResizeHandleLine = exports.clearHoverSelection = void 0;
|
|
7
7
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
8
8
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
9
9
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
@@ -144,16 +144,36 @@ var hideResizeHandleLine = exports.hideResizeHandleLine = function hideResizeHan
|
|
|
144
144
|
};
|
|
145
145
|
});
|
|
146
146
|
};
|
|
147
|
-
var
|
|
147
|
+
var setTableHovered = exports.setTableHovered = function setTableHovered(hovered) {
|
|
148
148
|
return (0, _pluginFactory.createCommand)(function () {
|
|
149
|
+
return {
|
|
150
|
+
type: 'TABLE_HOVERED',
|
|
151
|
+
data: {
|
|
152
|
+
isTableHovered: hovered
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}, function (tr) {
|
|
156
|
+
return tr.setMeta('addToHistory', false);
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
var hoverCell = exports.hoverCell = function hoverCell(rowIndex, colIndex) {
|
|
160
|
+
return (0, _pluginFactory.createCommand)(function (state) {
|
|
161
|
+
var _getPluginState4 = (0, _pluginFactory.getPluginState)(state),
|
|
162
|
+
prevHoveredCell = _getPluginState4.hoveredCell;
|
|
163
|
+
|
|
164
|
+
// If no arguments have been passed then the intention it to reset the hover cell data
|
|
165
|
+
var clear = rowIndex === undefined && colIndex === undefined;
|
|
166
|
+
var nextRowIndex = clear ? undefined : rowIndex !== null && rowIndex !== void 0 ? rowIndex : prevHoveredCell.rowIndex;
|
|
167
|
+
var nextColIndex = clear ? undefined : colIndex !== null && colIndex !== void 0 ? colIndex : prevHoveredCell.colIndex;
|
|
168
|
+
if (nextRowIndex === prevHoveredCell.rowIndex && nextColIndex === prevHoveredCell.colIndex) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
149
171
|
return {
|
|
150
172
|
type: 'HOVER_CELL',
|
|
151
173
|
data: {
|
|
152
174
|
hoveredCell: {
|
|
153
|
-
rowIndex:
|
|
154
|
-
colIndex:
|
|
155
|
-
colWidth: colWidth,
|
|
156
|
-
colHeight: colHeight
|
|
175
|
+
rowIndex: nextRowIndex,
|
|
176
|
+
colIndex: nextColIndex
|
|
157
177
|
}
|
|
158
178
|
}
|
|
159
179
|
};
|
|
@@ -159,6 +159,12 @@ Object.defineProperty(exports, "setMultipleCellAttrs", {
|
|
|
159
159
|
return _misc.setMultipleCellAttrs;
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
|
+
Object.defineProperty(exports, "setTableHovered", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function get() {
|
|
165
|
+
return _hover.setTableHovered;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
162
168
|
Object.defineProperty(exports, "setTableRef", {
|
|
163
169
|
enumerable: true,
|
|
164
170
|
get: function get() {
|
|
@@ -202,12 +202,17 @@ var getTableElementMoveTypeBySlice = exports.getTableElementMoveTypeBySlice = fu
|
|
|
202
202
|
var isInsideFirstCellOfRowOrColumn = exports.isInsideFirstCellOfRowOrColumn = function isInsideFirstCellOfRowOrColumn(selection, type) {
|
|
203
203
|
var table = (0, _utils2.findTable)(selection);
|
|
204
204
|
if (!table || !type) {
|
|
205
|
-
return;
|
|
205
|
+
return false;
|
|
206
206
|
}
|
|
207
207
|
var map = _tableMap.TableMap.get(table.node);
|
|
208
|
-
var cell = (0, _utils2.
|
|
208
|
+
var cell = (0, _utils2.findCellClosestToPos)(selection.$anchor);
|
|
209
|
+
if (!cell) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
var pos = cell.pos - table.pos - 1;
|
|
213
|
+
// cell positions in table map always start at 1, as they're offsets not positions
|
|
209
214
|
var index = map.map.findIndex(function (value) {
|
|
210
|
-
return value ===
|
|
215
|
+
return value === pos;
|
|
211
216
|
});
|
|
212
217
|
return type === 'row' ? index % map.width === 0 : index < map.width;
|
|
213
218
|
};
|
|
@@ -4,9 +4,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.handleMouseOver = exports.handleMouseOut = exports.handleMouseMove = exports.handleMouseLeave = exports.handleMouseDown = exports.handleFocus = exports.handleCut = exports.handleClick = exports.handleBlur = void 0;
|
|
7
|
+
exports.handleMouseOver = exports.handleMouseOut = exports.handleMouseMove = exports.handleMouseLeave = exports.handleMouseEnter = exports.handleMouseDown = exports.handleFocus = exports.handleCut = exports.handleClick = exports.handleBlur = void 0;
|
|
8
8
|
exports.handleTripleClick = handleTripleClick;
|
|
9
|
-
exports.withCellTracking = exports.whenTableInFocus = void 0;
|
|
9
|
+
exports.withCellTracking = exports.whenTableInFocus = exports.isTableInFocus = void 0;
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
@@ -107,7 +107,8 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, m
|
|
|
107
107
|
var target = mouseEvent.target;
|
|
108
108
|
var _getPluginState = (0, _pluginFactory2.getPluginState)(state),
|
|
109
109
|
insertColumnButtonIndex = _getPluginState.insertColumnButtonIndex,
|
|
110
|
-
insertRowButtonIndex = _getPluginState.insertRowButtonIndex
|
|
110
|
+
insertRowButtonIndex = _getPluginState.insertRowButtonIndex,
|
|
111
|
+
isTableHovered = _getPluginState.isTableHovered;
|
|
111
112
|
if ((0, _utils3.isInsertRowButton)(target)) {
|
|
112
113
|
var _getColumnOrRowIndex3 = (0, _utils3.getColumnOrRowIndex)(target),
|
|
113
114
|
_getColumnOrRowIndex4 = (0, _slicedToArray2.default)(_getColumnOrRowIndex3, 2),
|
|
@@ -137,6 +138,9 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, m
|
|
|
137
138
|
right: _endIndex
|
|
138
139
|
})(state, dispatch);
|
|
139
140
|
}
|
|
141
|
+
if (!isTableHovered) {
|
|
142
|
+
return (0, _commands.setTableHovered)(true)(state, dispatch);
|
|
143
|
+
}
|
|
140
144
|
return false;
|
|
141
145
|
};
|
|
142
146
|
|
|
@@ -169,26 +173,46 @@ var handleMouseOut = exports.handleMouseOut = function handleMouseOut(view, mous
|
|
|
169
173
|
}
|
|
170
174
|
return false;
|
|
171
175
|
};
|
|
176
|
+
var handleMouseEnter = exports.handleMouseEnter = function handleMouseEnter(view, mouseEvent) {
|
|
177
|
+
var state = view.state,
|
|
178
|
+
dispatch = view.dispatch;
|
|
179
|
+
var _getPluginState2 = (0, _pluginFactory2.getPluginState)(state),
|
|
180
|
+
isTableHovered = _getPluginState2.isTableHovered;
|
|
181
|
+
if (!isTableHovered) {
|
|
182
|
+
return (0, _commands.setTableHovered)(true)(state, dispatch);
|
|
183
|
+
}
|
|
184
|
+
return false;
|
|
185
|
+
};
|
|
172
186
|
var handleMouseLeave = exports.handleMouseLeave = function handleMouseLeave(view, event) {
|
|
173
187
|
if (!(event.target instanceof HTMLElement)) {
|
|
174
188
|
return false;
|
|
175
189
|
}
|
|
176
190
|
var state = view.state,
|
|
177
191
|
dispatch = view.dispatch;
|
|
178
|
-
var
|
|
179
|
-
insertColumnButtonIndex =
|
|
180
|
-
insertRowButtonIndex =
|
|
181
|
-
isDragAndDropEnabled =
|
|
192
|
+
var _getPluginState3 = (0, _pluginFactory2.getPluginState)(state),
|
|
193
|
+
insertColumnButtonIndex = _getPluginState3.insertColumnButtonIndex,
|
|
194
|
+
insertRowButtonIndex = _getPluginState3.insertRowButtonIndex,
|
|
195
|
+
isDragAndDropEnabled = _getPluginState3.isDragAndDropEnabled,
|
|
196
|
+
isTableHovered = _getPluginState3.isTableHovered;
|
|
197
|
+
if (isTableHovered) {
|
|
198
|
+
if (isDragAndDropEnabled) {
|
|
199
|
+
var _getDragDropPluginSta = (0, _pluginFactory.getPluginState)(state),
|
|
200
|
+
isDragMenuOpen = _getDragDropPluginSta.isDragMenuOpen;
|
|
201
|
+
!isDragMenuOpen && (0, _commands.setTableHovered)(false)(state, dispatch);
|
|
202
|
+
} else {
|
|
203
|
+
(0, _commands.setTableHovered)(false)(state, dispatch);
|
|
204
|
+
}
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// If this table doesn't have focus then we want to skip everything after this.
|
|
209
|
+
if (!isTableInFocus(view)) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
182
212
|
var target = event.target;
|
|
183
213
|
if ((0, _utils3.isTableControlsButton)(target)) {
|
|
184
214
|
return true;
|
|
185
215
|
}
|
|
186
|
-
if (isDragAndDropEnabled) {
|
|
187
|
-
var _getDragDropPluginSta = (0, _pluginFactory.getPluginState)(state),
|
|
188
|
-
isDragMenuOpen = _getDragDropPluginSta.isDragMenuOpen;
|
|
189
|
-
// Only set hoveredCell colIndex and rowIndex to undefined if the drag menu is not open
|
|
190
|
-
!isDragMenuOpen && (0, _commands.hoverCell)()(state, dispatch);
|
|
191
|
-
}
|
|
192
216
|
if ((typeof insertColumnButtonIndex !== 'undefined' || typeof insertRowButtonIndex !== 'undefined') && (0, _commands.hideInsertColumnOrRowButton)()(state, dispatch)) {
|
|
193
217
|
return true;
|
|
194
218
|
}
|
|
@@ -202,9 +226,9 @@ var handleMouseMove = exports.handleMouseMove = function handleMouseMove(view, e
|
|
|
202
226
|
if ((0, _utils3.isColumnControlsDecorations)(element) || (0, _utils3.isDragColumnFloatingInsertDot)(element)) {
|
|
203
227
|
var state = view.state,
|
|
204
228
|
dispatch = view.dispatch;
|
|
205
|
-
var
|
|
206
|
-
insertColumnButtonIndex =
|
|
207
|
-
isDragAndDropEnabled =
|
|
229
|
+
var _getPluginState4 = (0, _pluginFactory2.getPluginState)(state),
|
|
230
|
+
insertColumnButtonIndex = _getPluginState4.insertColumnButtonIndex,
|
|
231
|
+
isDragAndDropEnabled = _getPluginState4.isDragAndDropEnabled;
|
|
208
232
|
var _getColumnOrRowIndex9 = (0, _utils3.getColumnOrRowIndex)(element),
|
|
209
233
|
_getColumnOrRowIndex10 = (0, _slicedToArray2.default)(_getColumnOrRowIndex9, 2),
|
|
210
234
|
startIndex = _getColumnOrRowIndex10[0],
|
|
@@ -217,8 +241,8 @@ var handleMouseMove = exports.handleMouseMove = function handleMouseMove(view, e
|
|
|
217
241
|
if ((0, _utils3.isRowControlsButton)(element) || (0, _utils3.isDragRowFloatingInsertDot)(element)) {
|
|
218
242
|
var _state3 = view.state,
|
|
219
243
|
_dispatch4 = view.dispatch;
|
|
220
|
-
var
|
|
221
|
-
insertRowButtonIndex =
|
|
244
|
+
var _getPluginState5 = (0, _pluginFactory2.getPluginState)(_state3),
|
|
245
|
+
insertRowButtonIndex = _getPluginState5.insertRowButtonIndex;
|
|
222
246
|
var _getColumnOrRowIndex11 = (0, _utils3.getColumnOrRowIndex)(element),
|
|
223
247
|
_getColumnOrRowIndex12 = (0, _slicedToArray2.default)(_getColumnOrRowIndex11, 2),
|
|
224
248
|
_startIndex3 = _getColumnOrRowIndex12[0],
|
|
@@ -233,9 +257,9 @@ var handleMouseMove = exports.handleMouseMove = function handleMouseMove(view, e
|
|
|
233
257
|
if (_positionColumn !== null) {
|
|
234
258
|
var _state4 = view.state,
|
|
235
259
|
_dispatch5 = view.dispatch;
|
|
236
|
-
var
|
|
237
|
-
resizeHandleColumnIndex =
|
|
238
|
-
resizeHandleRowIndex =
|
|
260
|
+
var _getPluginState6 = (0, _pluginFactory2.getPluginState)(_state4),
|
|
261
|
+
resizeHandleColumnIndex = _getPluginState6.resizeHandleColumnIndex,
|
|
262
|
+
resizeHandleRowIndex = _getPluginState6.resizeHandleRowIndex;
|
|
239
263
|
var tableCell = (0, _utils.closestElement)(element, 'td, th');
|
|
240
264
|
var cellStartPosition = view.posAtDOM(tableCell, 0);
|
|
241
265
|
var rect = (0, _utils2.findCellRectClosestToPos)(_state4.doc.resolve(cellStartPosition));
|
|
@@ -310,8 +334,8 @@ var handleCut = exports.handleCut = function handleCut(oldTr, oldState, newState
|
|
|
310
334
|
if (isTableSelected) {
|
|
311
335
|
tr = (0, _utils2.removeTable)(tr);
|
|
312
336
|
} else if (tr.selection.isRowSelection()) {
|
|
313
|
-
var
|
|
314
|
-
isHeaderRowRequired =
|
|
337
|
+
var _getPluginState7 = (0, _pluginFactory2.getPluginState)(newState),
|
|
338
|
+
isHeaderRowRequired = _getPluginState7.pluginConfig.isHeaderRowRequired;
|
|
315
339
|
tr = (0, _transforms.deleteRows)(rect, isHeaderRowRequired)(tr);
|
|
316
340
|
} else if (tr.selection.isColSelection()) {
|
|
317
341
|
tr = (0, _transforms.deleteColumns)(rect, (0, _getAllowAddColumnCustomStep.getAllowAddColumnCustomStep)(oldState), editorView)(tr);
|
|
@@ -322,10 +346,13 @@ var handleCut = exports.handleCut = function handleCut(oldTr, oldState, newState
|
|
|
322
346
|
}
|
|
323
347
|
return tr;
|
|
324
348
|
};
|
|
349
|
+
var isTableInFocus = exports.isTableInFocus = function isTableInFocus(view) {
|
|
350
|
+
var _getPluginState8, _getResizePluginState;
|
|
351
|
+
return !!((_getPluginState8 = (0, _pluginFactory2.getPluginState)(view.state)) !== null && _getPluginState8 !== void 0 && _getPluginState8.tableNode) && !((_getResizePluginState = (0, _pluginFactory3.getPluginState)(view.state)) !== null && _getResizePluginState !== void 0 && _getResizePluginState.dragging);
|
|
352
|
+
};
|
|
325
353
|
var whenTableInFocus = exports.whenTableInFocus = function whenTableInFocus(eventHandler, elementContentRects) {
|
|
326
354
|
return function (view, mouseEvent) {
|
|
327
|
-
|
|
328
|
-
if (!((_getPluginState7 = (0, _pluginFactory2.getPluginState)(view.state)) !== null && _getPluginState7 !== void 0 && _getPluginState7.tableNode) || !!((_getResizePluginState = (0, _pluginFactory3.getPluginState)(view.state)) !== null && _getResizePluginState !== void 0 && _getResizePluginState.dragging)) {
|
|
355
|
+
if (!isTableInFocus(view)) {
|
|
329
356
|
return false;
|
|
330
357
|
}
|
|
331
358
|
return eventHandler(view, mouseEvent, elementContentRects);
|
|
@@ -335,10 +362,9 @@ var trackCellLocation = function trackCellLocation(view, mouseEvent) {
|
|
|
335
362
|
var _tableElement$dataset;
|
|
336
363
|
var target = mouseEvent.target;
|
|
337
364
|
var maybeTableCell = (0, _utils.isElementInTableCell)(target);
|
|
338
|
-
var
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
tableNode = _getPluginState8.tableNode;
|
|
365
|
+
var _getPluginState9 = (0, _pluginFactory2.getPluginState)(view.state),
|
|
366
|
+
tableNode = _getPluginState9.tableNode,
|
|
367
|
+
tableRef = _getPluginState9.tableRef;
|
|
342
368
|
var tableElement = (0, _utils.closestElement)(target, 'table');
|
|
343
369
|
|
|
344
370
|
// hover will only trigger if target localId is the same with selected localId
|
|
@@ -351,17 +377,13 @@ var trackCellLocation = function trackCellLocation(view, mouseEvent) {
|
|
|
351
377
|
var htmlColIndex = maybeTableCell.cellIndex;
|
|
352
378
|
var rowElement = (0, _utils.closestElement)(target, 'tr');
|
|
353
379
|
var htmlRowIndex = rowElement && rowElement.rowIndex;
|
|
354
|
-
var colHeight = tableRef.offsetHeight;
|
|
355
|
-
var colWidth = maybeTableCell.offsetWidth;
|
|
356
380
|
var tableMap = tableNode && _tableMap.TableMap.get(tableNode);
|
|
357
381
|
var colIndex = htmlColIndex;
|
|
358
382
|
if (tableMap) {
|
|
359
383
|
var convertedColIndex = (0, _utils3.convertHTMLCellIndexToColumnIndex)(htmlColIndex, htmlRowIndex, tableMap);
|
|
360
384
|
colIndex = (0, _utils3.getColumnIndexMappedToColumnIndexInFirstRow)(convertedColIndex, htmlRowIndex, tableMap);
|
|
361
385
|
}
|
|
362
|
-
|
|
363
|
-
(0, _commands.hoverCell)(htmlRowIndex, colIndex, colWidth, colHeight)(view.state, view.dispatch);
|
|
364
|
-
}
|
|
386
|
+
(0, _commands.hoverCell)(htmlRowIndex, colIndex)(view.state, view.dispatch);
|
|
365
387
|
};
|
|
366
388
|
var withCellTracking = exports.withCellTracking = function withCellTracking(eventHandler, elementContentRects) {
|
|
367
389
|
return function (view, mouseEvent) {
|
|
@@ -527,7 +527,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
527
527
|
var _getPluginState2 = (0, _pluginFactory.getPluginState)(view.state),
|
|
528
528
|
isInDanger = _getPluginState2.isInDanger,
|
|
529
529
|
hoveredRows = _getPluginState2.hoveredRows,
|
|
530
|
-
hoveredCell = _getPluginState2.hoveredCell
|
|
530
|
+
hoveredCell = _getPluginState2.hoveredCell,
|
|
531
|
+
isTableHovered = _getPluginState2.isTableHovered;
|
|
531
532
|
var tableRef = this.table || undefined;
|
|
532
533
|
var headerRow = tableRef ? tableRef.querySelector('tr[data-header-row]') : undefined;
|
|
533
534
|
var hasHeaderRow = (0, _utils4.containsHeaderRow)(node);
|
|
@@ -538,6 +539,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
538
539
|
tableActive: tableActive,
|
|
539
540
|
hoveredRows: hoveredRows,
|
|
540
541
|
hoveredCell: hoveredCell,
|
|
542
|
+
isTableHovered: isTableHovered,
|
|
541
543
|
isInDanger: isInDanger,
|
|
542
544
|
isResizing: isResizing,
|
|
543
545
|
isNumberColumnEnabled: node.attrs.isNumberColumnEnabled,
|
|
@@ -560,6 +562,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
560
562
|
isInDanger: isInDanger,
|
|
561
563
|
hoveredRows: hoveredRows,
|
|
562
564
|
hoveredCell: hoveredCell,
|
|
565
|
+
isTableHovered: isTableHovered,
|
|
563
566
|
isResizing: isResizing,
|
|
564
567
|
ordering: ordering,
|
|
565
568
|
hasHeaderRow: hasHeaderRow
|
|
@@ -66,7 +66,7 @@ var clearDropTarget = exports.clearDropTarget = function clearDropTarget(tr) {
|
|
|
66
66
|
return (tr || originalTr).setMeta('addToHistory', false);
|
|
67
67
|
});
|
|
68
68
|
};
|
|
69
|
-
var moveSource = exports.moveSource = function moveSource(sourceType, sourceIndex, targetIndex) {
|
|
69
|
+
var moveSource = exports.moveSource = function moveSource(sourceType, sourceIndex, targetIndex, tr) {
|
|
70
70
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
71
71
|
return {
|
|
72
72
|
type: _actions.DragAndDropActionType.CLEAR_DROP_TARGET,
|
|
@@ -74,19 +74,20 @@ var moveSource = exports.moveSource = function moveSource(sourceType, sourceInde
|
|
|
74
74
|
decorationSet: _view.DecorationSet.empty
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
-
}, function (
|
|
77
|
+
}, function (originalTr) {
|
|
78
|
+
var nextTr = tr || originalTr;
|
|
78
79
|
if (sourceIndex === targetIndex) {
|
|
79
|
-
return
|
|
80
|
+
return nextTr.setMeta('addToHistory', false);
|
|
80
81
|
}
|
|
81
|
-
var anchor =
|
|
82
|
+
var anchor = nextTr.selection.anchor;
|
|
82
83
|
var selectStartOfTable = function selectStartOfTable(newTr) {
|
|
83
84
|
return newTr.setSelection(_state.TextSelection.create(newTr.doc, anchor));
|
|
84
85
|
};
|
|
85
86
|
var isTableRow = sourceType === 'table-row';
|
|
86
87
|
if (isTableRow) {
|
|
87
|
-
return (0, _transforms.combineTransforms)([(0, _utils.moveRow)(sourceIndex, targetIndex), selectStartOfTable, (0, _utils.selectRow)(targetIndex)],
|
|
88
|
+
return (0, _transforms.combineTransforms)([(0, _utils.moveRow)(sourceIndex, targetIndex), selectStartOfTable, (0, _utils.selectRow)(targetIndex)], nextTr);
|
|
88
89
|
}
|
|
89
|
-
return (0, _transforms.combineTransforms)([(0, _utils.moveColumn)(sourceIndex, targetIndex), selectStartOfTable, (0, _utils.selectColumn)(targetIndex)],
|
|
90
|
+
return (0, _transforms.combineTransforms)([(0, _utils.moveColumn)(sourceIndex, targetIndex), selectStartOfTable, (0, _utils.selectColumn)(targetIndex)], nextTr);
|
|
90
91
|
});
|
|
91
92
|
};
|
|
92
93
|
var toggleDragMenu = exports.toggleDragMenu = function toggleDragMenu(isDragMenuOpen, direction, index) {
|
|
@@ -11,13 +11,15 @@ var _view = require("@atlaskit/editor-prosemirror/view");
|
|
|
11
11
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
12
12
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
13
13
|
var _element = require("@atlaskit/pragmatic-drag-and-drop/adapter/element");
|
|
14
|
+
var _utils2 = require("../../utils");
|
|
14
15
|
var _mergedCells = require("../../utils/merged-cells");
|
|
15
16
|
var _pluginFactory = require("../plugin-factory");
|
|
17
|
+
var _pluginKey = require("../plugin-key");
|
|
16
18
|
var _actions = require("./actions");
|
|
17
19
|
var _commands = require("./commands");
|
|
18
20
|
var _consts = require("./consts");
|
|
19
21
|
var _pluginFactory2 = require("./plugin-factory");
|
|
20
|
-
var
|
|
22
|
+
var _pluginKey2 = require("./plugin-key");
|
|
21
23
|
var _monitor = require("./utils/monitor");
|
|
22
24
|
var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventDispatcher) {
|
|
23
25
|
return new _safePlugin.SafePlugin({
|
|
@@ -31,7 +33,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventD
|
|
|
31
33
|
isDragging: false
|
|
32
34
|
};
|
|
33
35
|
}),
|
|
34
|
-
key:
|
|
36
|
+
key: _pluginKey2.pluginKey,
|
|
35
37
|
appendTransaction: function appendTransaction(transactions, oldState, newState) {
|
|
36
38
|
var _getTablePluginState = (0, _pluginFactory.getPluginState)(oldState),
|
|
37
39
|
oldTargetCellPosition = _getTablePluginState.targetCellPosition;
|
|
@@ -62,10 +64,10 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventD
|
|
|
62
64
|
// should not close the drag menu.
|
|
63
65
|
var isCellSelection = tr.selection instanceof _cellSelection.CellSelection;
|
|
64
66
|
if (cells && cells.length && cells[0].node !== tr.doc.nodeAt(newTargetCellPosition) && !isCellSelection) {
|
|
65
|
-
return tr.setMeta(
|
|
67
|
+
return tr.setMeta(_pluginKey2.pluginKey, action);
|
|
66
68
|
} // else NOP
|
|
67
69
|
} else {
|
|
68
|
-
return tr.setMeta(
|
|
70
|
+
return tr.setMeta(_pluginKey2.pluginKey, action);
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
}
|
|
@@ -113,28 +115,58 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventD
|
|
|
113
115
|
(0, _commands.setDropTarget)(dropTargetType, targetAdjustedIndex)(editorView.state, editorView.dispatch);
|
|
114
116
|
},
|
|
115
117
|
onDrop: function onDrop(event) {
|
|
118
|
+
var _cell$row, _cell$col;
|
|
116
119
|
var data = (0, _monitor.getDraggableDataFromEvent)(event);
|
|
117
120
|
|
|
121
|
+
// On Drop we need to update the table main plugin hoveredCell value with the current row/col that the mouse is
|
|
122
|
+
// over. This is so the drag handles update their positions to correctly align with the users mouse. Unfortunately
|
|
123
|
+
// at this point in time and during the drag opertation, the drop targets are eating all the mouse events so
|
|
124
|
+
// it's not possible to know what row/col the mouse is over (via mouse events). This attempts to locate the nearest cell and
|
|
125
|
+
// then tries to update the main table hoveredCell value by piggy-backing the transaction onto the command
|
|
126
|
+
// triggered by this on drop event.
|
|
127
|
+
var _getTablePluginState4 = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
128
|
+
hoveredCell = _getTablePluginState4.hoveredCell;
|
|
129
|
+
var cell = (0, _utils2.findNearestCellIndexToPoint)(event.location.current.input.clientX, event.location.current.input.clientY);
|
|
130
|
+
var tr = editorView.state.tr;
|
|
131
|
+
var action = {
|
|
132
|
+
type: 'HOVER_CELL',
|
|
133
|
+
data: {
|
|
134
|
+
hoveredCell: {
|
|
135
|
+
rowIndex: (_cell$row = cell === null || cell === void 0 ? void 0 : cell.row) !== null && _cell$row !== void 0 ? _cell$row : hoveredCell.rowIndex,
|
|
136
|
+
colIndex: (_cell$col = cell === null || cell === void 0 ? void 0 : cell.col) !== null && _cell$col !== void 0 ? _cell$col : hoveredCell.colIndex
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
tr.setMeta(_pluginKey.pluginKey, action);
|
|
141
|
+
|
|
118
142
|
// If no data can be found then it's most like we do not want to perform any drop action
|
|
119
143
|
if (!data) {
|
|
120
|
-
(0, _commands.clearDropTarget)()(editorView.state, editorView.dispatch);
|
|
144
|
+
(0, _commands.clearDropTarget)(tr)(editorView.state, editorView.dispatch);
|
|
121
145
|
return;
|
|
122
146
|
}
|
|
123
147
|
var sourceType = data.sourceType,
|
|
124
148
|
sourceIndexes = data.sourceIndexes,
|
|
149
|
+
targetIndex = data.targetIndex,
|
|
125
150
|
targetAdjustedIndex = data.targetAdjustedIndex,
|
|
126
151
|
direction = data.direction;
|
|
127
152
|
|
|
153
|
+
// When we drop on a target we will know the targets row/col index for certain,
|
|
154
|
+
if (sourceType === 'table-row') {
|
|
155
|
+
action.data.hoveredCell.rowIndex = targetIndex;
|
|
156
|
+
} else {
|
|
157
|
+
action.data.hoveredCell.colIndex = targetIndex;
|
|
158
|
+
}
|
|
159
|
+
|
|
128
160
|
// If the drop target index contains merged cells then we should not allow the drop to occur.
|
|
129
161
|
var hasMergedCells = sourceType === 'table-row' ? _mergedCells.hasMergedCellsInRow : _mergedCells.hasMergedCellsInColumn;
|
|
130
162
|
if (hasMergedCells(targetAdjustedIndex)(editorView.state.selection)) {
|
|
131
|
-
(0, _commands.clearDropTarget)()(editorView.state, editorView.dispatch);
|
|
163
|
+
(0, _commands.clearDropTarget)(tr)(editorView.state, editorView.dispatch);
|
|
132
164
|
return;
|
|
133
165
|
}
|
|
134
166
|
var _sourceIndexes = (0, _slicedToArray2.default)(sourceIndexes, 1),
|
|
135
167
|
sourceIndex = _sourceIndexes[0];
|
|
136
168
|
requestAnimationFrame(function () {
|
|
137
|
-
(0, _commands.moveSource)(sourceType, sourceIndex, targetAdjustedIndex + (direction === -1 ? 0 : -1))(editorView.state, editorView.dispatch);
|
|
169
|
+
(0, _commands.moveSource)(sourceType, sourceIndex, targetAdjustedIndex + (direction === -1 ? 0 : -1), tr)(editorView.state, editorView.dispatch);
|
|
138
170
|
});
|
|
139
171
|
}
|
|
140
172
|
})
|
|
@@ -34,6 +34,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
34
34
|
var _window;
|
|
35
35
|
var state = (0, _pluginFactory.createPluginState)(dispatch, _objectSpread(_objectSpread(_objectSpread({
|
|
36
36
|
pluginConfig: pluginConfig,
|
|
37
|
+
isTableHovered: false,
|
|
37
38
|
insertColumnButtonIndex: undefined,
|
|
38
39
|
insertRowButtonIndex: undefined,
|
|
39
40
|
isFullWidthModeEnabled: fullWidthModeEnabled,
|
|
@@ -248,11 +249,12 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
248
249
|
focus: _eventHandlers.handleFocus,
|
|
249
250
|
blur: _eventHandlers.handleBlur,
|
|
250
251
|
mousedown: (0, _eventHandlers.withCellTracking)(_eventHandlers.handleMouseDown),
|
|
251
|
-
mouseover: (0, _eventHandlers.
|
|
252
|
-
mouseleave:
|
|
252
|
+
mouseover: (0, _eventHandlers.withCellTracking)((0, _eventHandlers.whenTableInFocus)(_eventHandlers.handleMouseOver)),
|
|
253
|
+
mouseleave: _eventHandlers.handleMouseLeave,
|
|
253
254
|
mouseout: (0, _eventHandlers.whenTableInFocus)(_eventHandlers.handleMouseOut),
|
|
254
255
|
mousemove: (0, _eventHandlers.whenTableInFocus)(_eventHandlers.handleMouseMove, elementContentRects),
|
|
255
|
-
|
|
256
|
+
mouseenter: _eventHandlers.handleMouseEnter,
|
|
257
|
+
click: (0, _eventHandlers.withCellTracking)((0, _eventHandlers.whenTableInFocus)(_eventHandlers.handleClick))
|
|
256
258
|
},
|
|
257
259
|
handleTripleClick: _eventHandlers.handleTripleClick
|
|
258
260
|
}
|
|
@@ -97,6 +97,7 @@ var _default = exports.default = function _default(pluginState, action) {
|
|
|
97
97
|
case 'HOVER_ROWS':
|
|
98
98
|
case 'HOVER_COLUMNS':
|
|
99
99
|
case 'HOVER_TABLE':
|
|
100
|
+
case 'TABLE_HOVERED':
|
|
100
101
|
case 'HOVER_MERGED_CELLS':
|
|
101
102
|
case 'HOVER_CELL':
|
|
102
103
|
case 'SHOW_RESIZE_HANDLE_LINE':
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.getToolbarMenuConfig = exports.getToolbarConfig = exports.getToolbarCellOptionsConfig = exports.getClosestSelectionRect = void 0;
|
|
9
|
+
var _react = require("@emotion/react");
|
|
9
10
|
var _customSteps = require("@atlaskit/custom-steps");
|
|
10
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
12
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
@@ -29,6 +30,8 @@ var _types = require("./types");
|
|
|
29
30
|
var _utils4 = require("./utils");
|
|
30
31
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
+
/** @jsx jsx */
|
|
34
|
+
|
|
32
35
|
var getToolbarMenuConfig = exports.getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _ref, editorAnalyticsAPI) {
|
|
33
36
|
var formatMessage = _ref.formatMessage;
|
|
34
37
|
var options = [{
|
|
@@ -95,7 +98,7 @@ var getToolbarCellOptionsConfig = exports.getToolbarCellOptionsConfig = function
|
|
|
95
98
|
},
|
|
96
99
|
selected: false,
|
|
97
100
|
disabled: false,
|
|
98
|
-
elemAfter:
|
|
101
|
+
elemAfter: (0, _react.jsx)("div", {
|
|
99
102
|
css: _shortcut.shortcutStyle
|
|
100
103
|
}, (0, _keymaps.tooltip)(_keymaps.addColumnAfter))
|
|
101
104
|
}, {
|
|
@@ -114,7 +117,7 @@ var getToolbarCellOptionsConfig = exports.getToolbarCellOptionsConfig = function
|
|
|
114
117
|
},
|
|
115
118
|
selected: false,
|
|
116
119
|
disabled: false,
|
|
117
|
-
elemAfter:
|
|
120
|
+
elemAfter: (0, _react.jsx)("div", {
|
|
118
121
|
css: _shortcut.shortcutStyle
|
|
119
122
|
}, (0, _keymaps.tooltip)(_keymaps.addRowAfter))
|
|
120
123
|
}, {
|
|
@@ -246,7 +249,7 @@ var getToolbarCellOptionsConfig = exports.getToolbarCellOptionsConfig = function
|
|
|
246
249
|
},
|
|
247
250
|
selected: false,
|
|
248
251
|
disabled: false,
|
|
249
|
-
elemAfter:
|
|
252
|
+
elemAfter: (0, _react.jsx)("div", {
|
|
250
253
|
css: _shortcut.shortcutStyle
|
|
251
254
|
}, (0, _keymaps.tooltip)(_keymaps.backspace))
|
|
252
255
|
});
|
|
@@ -7,10 +7,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.ColumnResizeWidget = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _react2 = require("@emotion/react");
|
|
10
11
|
var _reactIntlNext = require("react-intl-next");
|
|
11
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
13
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
13
14
|
var _types = require("../../types");
|
|
15
|
+
/** @jsx jsx */
|
|
16
|
+
|
|
14
17
|
var ColumnResizeWidget = exports.ColumnResizeWidget = function ColumnResizeWidget(_ref) {
|
|
15
18
|
var startIndex = _ref.startIndex,
|
|
16
19
|
endIndex = _ref.endIndex,
|
|
@@ -18,20 +21,20 @@ var ColumnResizeWidget = exports.ColumnResizeWidget = function ColumnResizeWidge
|
|
|
18
21
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
19
22
|
formatMessage = _useIntl.formatMessage;
|
|
20
23
|
if (!includeTooltip) {
|
|
21
|
-
return
|
|
24
|
+
return (0, _react2.jsx)("div", {
|
|
22
25
|
className: _types.TableCssClassName.RESIZE_HANDLE_DECORATION,
|
|
23
26
|
"data-start-index": startIndex,
|
|
24
27
|
"data-end-index": endIndex
|
|
25
28
|
});
|
|
26
29
|
}
|
|
27
|
-
return
|
|
30
|
+
return (0, _react2.jsx)(_tooltip.default, {
|
|
28
31
|
content: formatMessage(_messages.tableMessages.adjustColumns),
|
|
29
32
|
hideTooltipOnClick: true,
|
|
30
33
|
hideTooltipOnMouseDown: true,
|
|
31
34
|
position: "mouse",
|
|
32
35
|
mousePosition: "auto-start"
|
|
33
36
|
}, function (tooltipProps) {
|
|
34
|
-
return
|
|
37
|
+
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
35
38
|
className: _types.TableCssClassName.RESIZE_HANDLE_DECORATION,
|
|
36
39
|
"data-start-index": startIndex,
|
|
37
40
|
"data-end-index": endIndex
|