@atlaskit/editor-plugin-table 5.4.14 → 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 +10 -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/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 +16 -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/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/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 +14 -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/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/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 +16 -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/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/TableFloatingColumnControls/ColumnControls/index.tsx +14 -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/utils/dom.ts +22 -0
- package/src/plugins/table/utils/index.ts +1 -0
|
@@ -137,16 +137,36 @@ export var hideResizeHandleLine = function hideResizeHandleLine() {
|
|
|
137
137
|
};
|
|
138
138
|
});
|
|
139
139
|
};
|
|
140
|
-
export var
|
|
140
|
+
export var setTableHovered = function setTableHovered(hovered) {
|
|
141
141
|
return createCommand(function () {
|
|
142
|
+
return {
|
|
143
|
+
type: 'TABLE_HOVERED',
|
|
144
|
+
data: {
|
|
145
|
+
isTableHovered: hovered
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}, function (tr) {
|
|
149
|
+
return tr.setMeta('addToHistory', false);
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
export var hoverCell = function hoverCell(rowIndex, colIndex) {
|
|
153
|
+
return createCommand(function (state) {
|
|
154
|
+
var _getPluginState4 = getPluginState(state),
|
|
155
|
+
prevHoveredCell = _getPluginState4.hoveredCell;
|
|
156
|
+
|
|
157
|
+
// If no arguments have been passed then the intention it to reset the hover cell data
|
|
158
|
+
var clear = rowIndex === undefined && colIndex === undefined;
|
|
159
|
+
var nextRowIndex = clear ? undefined : rowIndex !== null && rowIndex !== void 0 ? rowIndex : prevHoveredCell.rowIndex;
|
|
160
|
+
var nextColIndex = clear ? undefined : colIndex !== null && colIndex !== void 0 ? colIndex : prevHoveredCell.colIndex;
|
|
161
|
+
if (nextRowIndex === prevHoveredCell.rowIndex && nextColIndex === prevHoveredCell.colIndex) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
142
164
|
return {
|
|
143
165
|
type: 'HOVER_CELL',
|
|
144
166
|
data: {
|
|
145
167
|
hoveredCell: {
|
|
146
|
-
rowIndex:
|
|
147
|
-
colIndex:
|
|
148
|
-
colWidth: colWidth,
|
|
149
|
-
colHeight: colHeight
|
|
168
|
+
rowIndex: nextRowIndex,
|
|
169
|
+
colIndex: nextColIndex
|
|
150
170
|
}
|
|
151
171
|
}
|
|
152
172
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine } from './hover';
|
|
1
|
+
export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine, setTableHovered } from './hover';
|
|
2
2
|
export { insertColumn, insertRow, createTable } from './insert';
|
|
3
3
|
export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout } from './toggle';
|
|
4
4
|
export { clearMultipleCells } from './clear';
|
|
@@ -195,12 +195,17 @@ export var getTableElementMoveTypeBySlice = function getTableElementMoveTypeBySl
|
|
|
195
195
|
export var isInsideFirstCellOfRowOrColumn = function isInsideFirstCellOfRowOrColumn(selection, type) {
|
|
196
196
|
var table = findTable(selection);
|
|
197
197
|
if (!table || !type) {
|
|
198
|
-
return;
|
|
198
|
+
return false;
|
|
199
199
|
}
|
|
200
200
|
var map = TableMap.get(table.node);
|
|
201
|
-
var cell =
|
|
201
|
+
var cell = findCellClosestToPos(selection.$anchor);
|
|
202
|
+
if (!cell) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
var pos = cell.pos - table.pos - 1;
|
|
206
|
+
// cell positions in table map always start at 1, as they're offsets not positions
|
|
202
207
|
var index = map.map.findIndex(function (value) {
|
|
203
|
-
return value ===
|
|
208
|
+
return value === pos;
|
|
204
209
|
});
|
|
205
210
|
return type === 'row' ? index % map.width === 0 : index < map.width;
|
|
206
211
|
};
|
|
@@ -5,7 +5,7 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
5
5
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
6
6
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
7
7
|
import { cellAround, findCellRectClosestToPos, findTable, getSelectionRect, removeTable } from '@atlaskit/editor-tables/utils';
|
|
8
|
-
import { addResizeHandleDecorations, clearHoverSelection, hideInsertColumnOrRowButton, hideResizeHandleLine, hoverCell, hoverColumns, selectColumn, setEditorFocus, showInsertColumnButton, showInsertRowButton, showResizeHandleLine } from './commands';
|
|
8
|
+
import { addResizeHandleDecorations, clearHoverSelection, hideInsertColumnOrRowButton, hideResizeHandleLine, hoverCell, hoverColumns, selectColumn, setEditorFocus, setTableHovered, showInsertColumnButton, showInsertRowButton, showResizeHandleLine } from './commands';
|
|
9
9
|
import { getPluginState as getDragDropPluginState } from './pm-plugins/drag-and-drop/plugin-factory';
|
|
10
10
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
11
11
|
import { getPluginState as getResizePluginState } from './pm-plugins/table-resizing/plugin-factory';
|
|
@@ -98,7 +98,8 @@ export var handleMouseOver = function handleMouseOver(view, mouseEvent) {
|
|
|
98
98
|
var target = mouseEvent.target;
|
|
99
99
|
var _getPluginState = getPluginState(state),
|
|
100
100
|
insertColumnButtonIndex = _getPluginState.insertColumnButtonIndex,
|
|
101
|
-
insertRowButtonIndex = _getPluginState.insertRowButtonIndex
|
|
101
|
+
insertRowButtonIndex = _getPluginState.insertRowButtonIndex,
|
|
102
|
+
isTableHovered = _getPluginState.isTableHovered;
|
|
102
103
|
if (isInsertRowButton(target)) {
|
|
103
104
|
var _getColumnOrRowIndex3 = getColumnOrRowIndex(target),
|
|
104
105
|
_getColumnOrRowIndex4 = _slicedToArray(_getColumnOrRowIndex3, 2),
|
|
@@ -128,6 +129,9 @@ export var handleMouseOver = function handleMouseOver(view, mouseEvent) {
|
|
|
128
129
|
right: _endIndex
|
|
129
130
|
})(state, dispatch);
|
|
130
131
|
}
|
|
132
|
+
if (!isTableHovered) {
|
|
133
|
+
return setTableHovered(true)(state, dispatch);
|
|
134
|
+
}
|
|
131
135
|
return false;
|
|
132
136
|
};
|
|
133
137
|
|
|
@@ -160,26 +164,46 @@ export var handleMouseOut = function handleMouseOut(view, mouseEvent) {
|
|
|
160
164
|
}
|
|
161
165
|
return false;
|
|
162
166
|
};
|
|
167
|
+
export var handleMouseEnter = function handleMouseEnter(view, mouseEvent) {
|
|
168
|
+
var state = view.state,
|
|
169
|
+
dispatch = view.dispatch;
|
|
170
|
+
var _getPluginState2 = getPluginState(state),
|
|
171
|
+
isTableHovered = _getPluginState2.isTableHovered;
|
|
172
|
+
if (!isTableHovered) {
|
|
173
|
+
return setTableHovered(true)(state, dispatch);
|
|
174
|
+
}
|
|
175
|
+
return false;
|
|
176
|
+
};
|
|
163
177
|
export var handleMouseLeave = function handleMouseLeave(view, event) {
|
|
164
178
|
if (!(event.target instanceof HTMLElement)) {
|
|
165
179
|
return false;
|
|
166
180
|
}
|
|
167
181
|
var state = view.state,
|
|
168
182
|
dispatch = view.dispatch;
|
|
169
|
-
var
|
|
170
|
-
insertColumnButtonIndex =
|
|
171
|
-
insertRowButtonIndex =
|
|
172
|
-
isDragAndDropEnabled =
|
|
183
|
+
var _getPluginState3 = getPluginState(state),
|
|
184
|
+
insertColumnButtonIndex = _getPluginState3.insertColumnButtonIndex,
|
|
185
|
+
insertRowButtonIndex = _getPluginState3.insertRowButtonIndex,
|
|
186
|
+
isDragAndDropEnabled = _getPluginState3.isDragAndDropEnabled,
|
|
187
|
+
isTableHovered = _getPluginState3.isTableHovered;
|
|
188
|
+
if (isTableHovered) {
|
|
189
|
+
if (isDragAndDropEnabled) {
|
|
190
|
+
var _getDragDropPluginSta = getDragDropPluginState(state),
|
|
191
|
+
isDragMenuOpen = _getDragDropPluginSta.isDragMenuOpen;
|
|
192
|
+
!isDragMenuOpen && setTableHovered(false)(state, dispatch);
|
|
193
|
+
} else {
|
|
194
|
+
setTableHovered(false)(state, dispatch);
|
|
195
|
+
}
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// If this table doesn't have focus then we want to skip everything after this.
|
|
200
|
+
if (!isTableInFocus(view)) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
173
203
|
var target = event.target;
|
|
174
204
|
if (isTableControlsButton(target)) {
|
|
175
205
|
return true;
|
|
176
206
|
}
|
|
177
|
-
if (isDragAndDropEnabled) {
|
|
178
|
-
var _getDragDropPluginSta = getDragDropPluginState(state),
|
|
179
|
-
isDragMenuOpen = _getDragDropPluginSta.isDragMenuOpen;
|
|
180
|
-
// Only set hoveredCell colIndex and rowIndex to undefined if the drag menu is not open
|
|
181
|
-
!isDragMenuOpen && hoverCell()(state, dispatch);
|
|
182
|
-
}
|
|
183
207
|
if ((typeof insertColumnButtonIndex !== 'undefined' || typeof insertRowButtonIndex !== 'undefined') && hideInsertColumnOrRowButton()(state, dispatch)) {
|
|
184
208
|
return true;
|
|
185
209
|
}
|
|
@@ -193,9 +217,9 @@ export var handleMouseMove = function handleMouseMove(view, event, elementConten
|
|
|
193
217
|
if (isColumnControlsDecorations(element) || isDragColumnFloatingInsertDot(element)) {
|
|
194
218
|
var state = view.state,
|
|
195
219
|
dispatch = view.dispatch;
|
|
196
|
-
var
|
|
197
|
-
insertColumnButtonIndex =
|
|
198
|
-
isDragAndDropEnabled =
|
|
220
|
+
var _getPluginState4 = getPluginState(state),
|
|
221
|
+
insertColumnButtonIndex = _getPluginState4.insertColumnButtonIndex,
|
|
222
|
+
isDragAndDropEnabled = _getPluginState4.isDragAndDropEnabled;
|
|
199
223
|
var _getColumnOrRowIndex9 = getColumnOrRowIndex(element),
|
|
200
224
|
_getColumnOrRowIndex10 = _slicedToArray(_getColumnOrRowIndex9, 2),
|
|
201
225
|
startIndex = _getColumnOrRowIndex10[0],
|
|
@@ -208,8 +232,8 @@ export var handleMouseMove = function handleMouseMove(view, event, elementConten
|
|
|
208
232
|
if (isRowControlsButton(element) || isDragRowFloatingInsertDot(element)) {
|
|
209
233
|
var _state3 = view.state,
|
|
210
234
|
_dispatch4 = view.dispatch;
|
|
211
|
-
var
|
|
212
|
-
insertRowButtonIndex =
|
|
235
|
+
var _getPluginState5 = getPluginState(_state3),
|
|
236
|
+
insertRowButtonIndex = _getPluginState5.insertRowButtonIndex;
|
|
213
237
|
var _getColumnOrRowIndex11 = getColumnOrRowIndex(element),
|
|
214
238
|
_getColumnOrRowIndex12 = _slicedToArray(_getColumnOrRowIndex11, 2),
|
|
215
239
|
_startIndex3 = _getColumnOrRowIndex12[0],
|
|
@@ -224,9 +248,9 @@ export var handleMouseMove = function handleMouseMove(view, event, elementConten
|
|
|
224
248
|
if (_positionColumn !== null) {
|
|
225
249
|
var _state4 = view.state,
|
|
226
250
|
_dispatch5 = view.dispatch;
|
|
227
|
-
var
|
|
228
|
-
resizeHandleColumnIndex =
|
|
229
|
-
resizeHandleRowIndex =
|
|
251
|
+
var _getPluginState6 = getPluginState(_state4),
|
|
252
|
+
resizeHandleColumnIndex = _getPluginState6.resizeHandleColumnIndex,
|
|
253
|
+
resizeHandleRowIndex = _getPluginState6.resizeHandleRowIndex;
|
|
230
254
|
var tableCell = closestElement(element, 'td, th');
|
|
231
255
|
var cellStartPosition = view.posAtDOM(tableCell, 0);
|
|
232
256
|
var rect = findCellRectClosestToPos(_state4.doc.resolve(cellStartPosition));
|
|
@@ -301,8 +325,8 @@ export var handleCut = function handleCut(oldTr, oldState, newState, editorAnaly
|
|
|
301
325
|
if (isTableSelected) {
|
|
302
326
|
tr = removeTable(tr);
|
|
303
327
|
} else if (tr.selection.isRowSelection()) {
|
|
304
|
-
var
|
|
305
|
-
isHeaderRowRequired =
|
|
328
|
+
var _getPluginState7 = getPluginState(newState),
|
|
329
|
+
isHeaderRowRequired = _getPluginState7.pluginConfig.isHeaderRowRequired;
|
|
306
330
|
tr = deleteRows(rect, isHeaderRowRequired)(tr);
|
|
307
331
|
} else if (tr.selection.isColSelection()) {
|
|
308
332
|
tr = deleteColumns(rect, getAllowAddColumnCustomStep(oldState), editorView)(tr);
|
|
@@ -313,10 +337,13 @@ export var handleCut = function handleCut(oldTr, oldState, newState, editorAnaly
|
|
|
313
337
|
}
|
|
314
338
|
return tr;
|
|
315
339
|
};
|
|
340
|
+
export var isTableInFocus = function isTableInFocus(view) {
|
|
341
|
+
var _getPluginState8, _getResizePluginState;
|
|
342
|
+
return !!((_getPluginState8 = getPluginState(view.state)) !== null && _getPluginState8 !== void 0 && _getPluginState8.tableNode) && !((_getResizePluginState = getResizePluginState(view.state)) !== null && _getResizePluginState !== void 0 && _getResizePluginState.dragging);
|
|
343
|
+
};
|
|
316
344
|
export var whenTableInFocus = function whenTableInFocus(eventHandler, elementContentRects) {
|
|
317
345
|
return function (view, mouseEvent) {
|
|
318
|
-
|
|
319
|
-
if (!((_getPluginState7 = getPluginState(view.state)) !== null && _getPluginState7 !== void 0 && _getPluginState7.tableNode) || !!((_getResizePluginState = getResizePluginState(view.state)) !== null && _getResizePluginState !== void 0 && _getResizePluginState.dragging)) {
|
|
346
|
+
if (!isTableInFocus(view)) {
|
|
320
347
|
return false;
|
|
321
348
|
}
|
|
322
349
|
return eventHandler(view, mouseEvent, elementContentRects);
|
|
@@ -326,10 +353,9 @@ var trackCellLocation = function trackCellLocation(view, mouseEvent) {
|
|
|
326
353
|
var _tableElement$dataset;
|
|
327
354
|
var target = mouseEvent.target;
|
|
328
355
|
var maybeTableCell = isElementInTableCell(target);
|
|
329
|
-
var
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
tableNode = _getPluginState8.tableNode;
|
|
356
|
+
var _getPluginState9 = getPluginState(view.state),
|
|
357
|
+
tableNode = _getPluginState9.tableNode,
|
|
358
|
+
tableRef = _getPluginState9.tableRef;
|
|
333
359
|
var tableElement = closestElement(target, 'table');
|
|
334
360
|
|
|
335
361
|
// hover will only trigger if target localId is the same with selected localId
|
|
@@ -342,17 +368,13 @@ var trackCellLocation = function trackCellLocation(view, mouseEvent) {
|
|
|
342
368
|
var htmlColIndex = maybeTableCell.cellIndex;
|
|
343
369
|
var rowElement = closestElement(target, 'tr');
|
|
344
370
|
var htmlRowIndex = rowElement && rowElement.rowIndex;
|
|
345
|
-
var colHeight = tableRef.offsetHeight;
|
|
346
|
-
var colWidth = maybeTableCell.offsetWidth;
|
|
347
371
|
var tableMap = tableNode && TableMap.get(tableNode);
|
|
348
372
|
var colIndex = htmlColIndex;
|
|
349
373
|
if (tableMap) {
|
|
350
374
|
var convertedColIndex = convertHTMLCellIndexToColumnIndex(htmlColIndex, htmlRowIndex, tableMap);
|
|
351
375
|
colIndex = getColumnIndexMappedToColumnIndexInFirstRow(convertedColIndex, htmlRowIndex, tableMap);
|
|
352
376
|
}
|
|
353
|
-
|
|
354
|
-
hoverCell(htmlRowIndex, colIndex, colWidth, colHeight)(view.state, view.dispatch);
|
|
355
|
-
}
|
|
377
|
+
hoverCell(htmlRowIndex, colIndex)(view.state, view.dispatch);
|
|
356
378
|
};
|
|
357
379
|
export var withCellTracking = function withCellTracking(eventHandler, elementContentRects) {
|
|
358
380
|
return function (view, mouseEvent) {
|
|
@@ -520,7 +520,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
520
520
|
var _getPluginState2 = getPluginState(view.state),
|
|
521
521
|
isInDanger = _getPluginState2.isInDanger,
|
|
522
522
|
hoveredRows = _getPluginState2.hoveredRows,
|
|
523
|
-
hoveredCell = _getPluginState2.hoveredCell
|
|
523
|
+
hoveredCell = _getPluginState2.hoveredCell,
|
|
524
|
+
isTableHovered = _getPluginState2.isTableHovered;
|
|
524
525
|
var tableRef = this.table || undefined;
|
|
525
526
|
var headerRow = tableRef ? tableRef.querySelector('tr[data-header-row]') : undefined;
|
|
526
527
|
var hasHeaderRow = containsHeaderRow(node);
|
|
@@ -531,6 +532,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
531
532
|
tableActive: tableActive,
|
|
532
533
|
hoveredRows: hoveredRows,
|
|
533
534
|
hoveredCell: hoveredCell,
|
|
535
|
+
isTableHovered: isTableHovered,
|
|
534
536
|
isInDanger: isInDanger,
|
|
535
537
|
isResizing: isResizing,
|
|
536
538
|
isNumberColumnEnabled: node.attrs.isNumberColumnEnabled,
|
|
@@ -553,6 +555,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
553
555
|
isInDanger: isInDanger,
|
|
554
556
|
hoveredRows: hoveredRows,
|
|
555
557
|
hoveredCell: hoveredCell,
|
|
558
|
+
isTableHovered: isTableHovered,
|
|
556
559
|
isResizing: isResizing,
|
|
557
560
|
ordering: ordering,
|
|
558
561
|
hasHeaderRow: hasHeaderRow
|
|
@@ -61,7 +61,7 @@ export var clearDropTarget = function clearDropTarget(tr) {
|
|
|
61
61
|
return (tr || originalTr).setMeta('addToHistory', false);
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
|
-
export var moveSource = function moveSource(sourceType, sourceIndex, targetIndex) {
|
|
64
|
+
export var moveSource = function moveSource(sourceType, sourceIndex, targetIndex, tr) {
|
|
65
65
|
return createCommand(function (state) {
|
|
66
66
|
return {
|
|
67
67
|
type: DragAndDropActionType.CLEAR_DROP_TARGET,
|
|
@@ -69,19 +69,20 @@ export var moveSource = function moveSource(sourceType, sourceIndex, targetIndex
|
|
|
69
69
|
decorationSet: DecorationSet.empty
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
}, function (
|
|
72
|
+
}, function (originalTr) {
|
|
73
|
+
var nextTr = tr || originalTr;
|
|
73
74
|
if (sourceIndex === targetIndex) {
|
|
74
|
-
return
|
|
75
|
+
return nextTr.setMeta('addToHistory', false);
|
|
75
76
|
}
|
|
76
|
-
var anchor =
|
|
77
|
+
var anchor = nextTr.selection.anchor;
|
|
77
78
|
var selectStartOfTable = function selectStartOfTable(newTr) {
|
|
78
79
|
return newTr.setSelection(TextSelection.create(newTr.doc, anchor));
|
|
79
80
|
};
|
|
80
81
|
var isTableRow = sourceType === 'table-row';
|
|
81
82
|
if (isTableRow) {
|
|
82
|
-
return combineTransforms([moveRow(sourceIndex, targetIndex), selectStartOfTable, selectRow(targetIndex)],
|
|
83
|
+
return combineTransforms([moveRow(sourceIndex, targetIndex), selectStartOfTable, selectRow(targetIndex)], nextTr);
|
|
83
84
|
}
|
|
84
|
-
return combineTransforms([moveColumn(sourceIndex, targetIndex), selectStartOfTable, selectColumn(targetIndex)],
|
|
85
|
+
return combineTransforms([moveColumn(sourceIndex, targetIndex), selectStartOfTable, selectColumn(targetIndex)], nextTr);
|
|
85
86
|
});
|
|
86
87
|
};
|
|
87
88
|
export var toggleDragMenu = function toggleDragMenu(isDragMenuOpen, direction, index) {
|
|
@@ -4,8 +4,10 @@ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
5
|
import { getCellsInRow } from '@atlaskit/editor-tables/utils';
|
|
6
6
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
|
|
7
|
+
import { findNearestCellIndexToPoint } from '../../utils';
|
|
7
8
|
import { hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils/merged-cells';
|
|
8
9
|
import { getPluginState as getTablePluginState } from '../plugin-factory';
|
|
10
|
+
import { pluginKey as tablePluginKey } from '../plugin-key';
|
|
9
11
|
import { DragAndDropActionType } from './actions';
|
|
10
12
|
import { clearDropTarget, moveSource, setDropTarget, toggleDragMenu } from './commands';
|
|
11
13
|
import { DropTargetType } from './consts';
|
|
@@ -106,28 +108,58 @@ export var createPlugin = function createPlugin(dispatch, eventDispatcher) {
|
|
|
106
108
|
setDropTarget(dropTargetType, targetAdjustedIndex)(editorView.state, editorView.dispatch);
|
|
107
109
|
},
|
|
108
110
|
onDrop: function onDrop(event) {
|
|
111
|
+
var _cell$row, _cell$col;
|
|
109
112
|
var data = getDraggableDataFromEvent(event);
|
|
110
113
|
|
|
114
|
+
// On Drop we need to update the table main plugin hoveredCell value with the current row/col that the mouse is
|
|
115
|
+
// over. This is so the drag handles update their positions to correctly align with the users mouse. Unfortunately
|
|
116
|
+
// at this point in time and during the drag opertation, the drop targets are eating all the mouse events so
|
|
117
|
+
// it's not possible to know what row/col the mouse is over (via mouse events). This attempts to locate the nearest cell and
|
|
118
|
+
// then tries to update the main table hoveredCell value by piggy-backing the transaction onto the command
|
|
119
|
+
// triggered by this on drop event.
|
|
120
|
+
var _getTablePluginState4 = getTablePluginState(editorView.state),
|
|
121
|
+
hoveredCell = _getTablePluginState4.hoveredCell;
|
|
122
|
+
var cell = findNearestCellIndexToPoint(event.location.current.input.clientX, event.location.current.input.clientY);
|
|
123
|
+
var tr = editorView.state.tr;
|
|
124
|
+
var action = {
|
|
125
|
+
type: 'HOVER_CELL',
|
|
126
|
+
data: {
|
|
127
|
+
hoveredCell: {
|
|
128
|
+
rowIndex: (_cell$row = cell === null || cell === void 0 ? void 0 : cell.row) !== null && _cell$row !== void 0 ? _cell$row : hoveredCell.rowIndex,
|
|
129
|
+
colIndex: (_cell$col = cell === null || cell === void 0 ? void 0 : cell.col) !== null && _cell$col !== void 0 ? _cell$col : hoveredCell.colIndex
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
tr.setMeta(tablePluginKey, action);
|
|
134
|
+
|
|
111
135
|
// If no data can be found then it's most like we do not want to perform any drop action
|
|
112
136
|
if (!data) {
|
|
113
|
-
clearDropTarget()(editorView.state, editorView.dispatch);
|
|
137
|
+
clearDropTarget(tr)(editorView.state, editorView.dispatch);
|
|
114
138
|
return;
|
|
115
139
|
}
|
|
116
140
|
var sourceType = data.sourceType,
|
|
117
141
|
sourceIndexes = data.sourceIndexes,
|
|
142
|
+
targetIndex = data.targetIndex,
|
|
118
143
|
targetAdjustedIndex = data.targetAdjustedIndex,
|
|
119
144
|
direction = data.direction;
|
|
120
145
|
|
|
146
|
+
// When we drop on a target we will know the targets row/col index for certain,
|
|
147
|
+
if (sourceType === 'table-row') {
|
|
148
|
+
action.data.hoveredCell.rowIndex = targetIndex;
|
|
149
|
+
} else {
|
|
150
|
+
action.data.hoveredCell.colIndex = targetIndex;
|
|
151
|
+
}
|
|
152
|
+
|
|
121
153
|
// If the drop target index contains merged cells then we should not allow the drop to occur.
|
|
122
154
|
var hasMergedCells = sourceType === 'table-row' ? hasMergedCellsInRow : hasMergedCellsInColumn;
|
|
123
155
|
if (hasMergedCells(targetAdjustedIndex)(editorView.state.selection)) {
|
|
124
|
-
clearDropTarget()(editorView.state, editorView.dispatch);
|
|
156
|
+
clearDropTarget(tr)(editorView.state, editorView.dispatch);
|
|
125
157
|
return;
|
|
126
158
|
}
|
|
127
159
|
var _sourceIndexes = _slicedToArray(sourceIndexes, 1),
|
|
128
160
|
sourceIndex = _sourceIndexes[0];
|
|
129
161
|
requestAnimationFrame(function () {
|
|
130
|
-
moveSource(sourceType, sourceIndex, targetAdjustedIndex + (direction === -1 ? 0 : -1))(editorView.state, editorView.dispatch);
|
|
162
|
+
moveSource(sourceType, sourceIndex, targetAdjustedIndex + (direction === -1 ? 0 : -1), tr)(editorView.state, editorView.dispatch);
|
|
131
163
|
});
|
|
132
164
|
}
|
|
133
165
|
})
|
|
@@ -11,7 +11,7 @@ import { findTable } from '@atlaskit/editor-tables/utils';
|
|
|
11
11
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
import { addBoldInEmptyHeaderCells, clearHoverSelection, setTableRef } from '../commands';
|
|
13
13
|
import { removeResizeHandleDecorations, transformSliceRemoveCellBackgroundColor, transformSliceToAddTableHeaders, transformSliceToRemoveColumnsWidths } from '../commands/misc';
|
|
14
|
-
import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseLeave, handleMouseMove, handleMouseOut, handleMouseOver, handleTripleClick, whenTableInFocus, withCellTracking } from '../event-handlers';
|
|
14
|
+
import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseEnter, handleMouseLeave, handleMouseMove, handleMouseOut, handleMouseOver, handleTripleClick, whenTableInFocus, withCellTracking } from '../event-handlers';
|
|
15
15
|
import { createTableView } from '../nodeviews/table';
|
|
16
16
|
import TableCell from '../nodeviews/TableCell';
|
|
17
17
|
import TableRow from '../nodeviews/TableRow';
|
|
@@ -27,6 +27,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
27
27
|
var _window;
|
|
28
28
|
var state = createPluginState(dispatch, _objectSpread(_objectSpread(_objectSpread({
|
|
29
29
|
pluginConfig: pluginConfig,
|
|
30
|
+
isTableHovered: false,
|
|
30
31
|
insertColumnButtonIndex: undefined,
|
|
31
32
|
insertRowButtonIndex: undefined,
|
|
32
33
|
isFullWidthModeEnabled: fullWidthModeEnabled,
|
|
@@ -241,11 +242,12 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
241
242
|
focus: handleFocus,
|
|
242
243
|
blur: handleBlur,
|
|
243
244
|
mousedown: withCellTracking(handleMouseDown),
|
|
244
|
-
mouseover: whenTableInFocus(
|
|
245
|
-
mouseleave:
|
|
245
|
+
mouseover: withCellTracking(whenTableInFocus(handleMouseOver)),
|
|
246
|
+
mouseleave: handleMouseLeave,
|
|
246
247
|
mouseout: whenTableInFocus(handleMouseOut),
|
|
247
248
|
mousemove: whenTableInFocus(handleMouseMove, elementContentRects),
|
|
248
|
-
|
|
249
|
+
mouseenter: handleMouseEnter,
|
|
250
|
+
click: withCellTracking(whenTableInFocus(handleClick))
|
|
249
251
|
},
|
|
250
252
|
handleTripleClick: handleTripleClick
|
|
251
253
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
1
3
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
2
4
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
5
|
import { addColumnAfter, addRowAfter, backspace, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
@@ -85,7 +87,7 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
85
87
|
},
|
|
86
88
|
selected: false,
|
|
87
89
|
disabled: false,
|
|
88
|
-
elemAfter:
|
|
90
|
+
elemAfter: jsx("div", {
|
|
89
91
|
css: shortcutStyle
|
|
90
92
|
}, tooltip(addColumnAfter))
|
|
91
93
|
}, {
|
|
@@ -104,7 +106,7 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
104
106
|
},
|
|
105
107
|
selected: false,
|
|
106
108
|
disabled: false,
|
|
107
|
-
elemAfter:
|
|
109
|
+
elemAfter: jsx("div", {
|
|
108
110
|
css: shortcutStyle
|
|
109
111
|
}, tooltip(addRowAfter))
|
|
110
112
|
}, {
|
|
@@ -236,7 +238,7 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
236
238
|
},
|
|
237
239
|
selected: false,
|
|
238
240
|
disabled: false,
|
|
239
|
-
elemAfter:
|
|
241
|
+
elemAfter: jsx("div", {
|
|
240
242
|
css: shortcutStyle
|
|
241
243
|
}, tooltip(backspace))
|
|
242
244
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/** @jsx jsx */
|
|
2
3
|
import React from 'react';
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
3
5
|
import { useIntl } from 'react-intl-next';
|
|
4
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
7
|
import Tooltip from '@atlaskit/tooltip';
|
|
@@ -11,20 +13,20 @@ export var ColumnResizeWidget = function ColumnResizeWidget(_ref) {
|
|
|
11
13
|
var _useIntl = useIntl(),
|
|
12
14
|
formatMessage = _useIntl.formatMessage;
|
|
13
15
|
if (!includeTooltip) {
|
|
14
|
-
return
|
|
16
|
+
return jsx("div", {
|
|
15
17
|
className: TableCssClassName.RESIZE_HANDLE_DECORATION,
|
|
16
18
|
"data-start-index": startIndex,
|
|
17
19
|
"data-end-index": endIndex
|
|
18
20
|
});
|
|
19
21
|
}
|
|
20
|
-
return
|
|
22
|
+
return jsx(Tooltip, {
|
|
21
23
|
content: formatMessage(messages.adjustColumns),
|
|
22
24
|
hideTooltipOnClick: true,
|
|
23
25
|
hideTooltipOnMouseDown: true,
|
|
24
26
|
position: "mouse",
|
|
25
27
|
mousePosition: "auto-start"
|
|
26
28
|
}, function (tooltipProps) {
|
|
27
|
-
return
|
|
29
|
+
return jsx("div", _extends({
|
|
28
30
|
className: TableCssClassName.RESIZE_HANDLE_DECORATION,
|
|
29
31
|
"data-start-index": startIndex,
|
|
30
32
|
"data-end-index": endIndex
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
2
4
|
import { injectIntl } from 'react-intl-next';
|
|
3
5
|
import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
4
6
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
@@ -42,7 +44,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
42
44
|
return null;
|
|
43
45
|
}
|
|
44
46
|
var labelCellOptions = formatMessage(messages.cellOptions);
|
|
45
|
-
var button =
|
|
47
|
+
var button = jsx("div", {
|
|
46
48
|
css: function css(theme) {
|
|
47
49
|
return [tableFloatingCellButtonStyles({
|
|
48
50
|
theme: theme
|
|
@@ -50,19 +52,19 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
50
52
|
theme: theme
|
|
51
53
|
})];
|
|
52
54
|
}
|
|
53
|
-
},
|
|
55
|
+
}, jsx(ToolbarButton, {
|
|
54
56
|
className: ClassName.CONTEXTUAL_MENU_BUTTON,
|
|
55
57
|
selected: isContextualMenuOpen,
|
|
56
58
|
title: labelCellOptions,
|
|
57
59
|
onClick: handleClick,
|
|
58
|
-
iconBefore:
|
|
60
|
+
iconBefore: jsx(ExpandIcon, {
|
|
59
61
|
label: ""
|
|
60
62
|
}),
|
|
61
63
|
"aria-label": labelCellOptions
|
|
62
64
|
}));
|
|
63
65
|
var parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
|
|
64
66
|
if (stickyHeader && parentSticky && tableWrapper) {
|
|
65
|
-
return
|
|
67
|
+
return jsx(FixedButton, {
|
|
66
68
|
offset: BUTTON_OFFSET,
|
|
67
69
|
stickyHeader: stickyHeader,
|
|
68
70
|
tableWrapper: tableWrapper,
|
|
@@ -72,7 +74,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
72
74
|
isContextualMenuOpen: isContextualMenuOpen
|
|
73
75
|
}, button);
|
|
74
76
|
}
|
|
75
|
-
return
|
|
77
|
+
return jsx(Popup, {
|
|
76
78
|
alignX: "right",
|
|
77
79
|
alignY: "start",
|
|
78
80
|
target: targetCellRef,
|
|
@@ -87,9 +89,9 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
87
89
|
});
|
|
88
90
|
var FloatingContextualButton = injectIntl(FloatingContextualButtonInner);
|
|
89
91
|
export default function (props) {
|
|
90
|
-
return
|
|
92
|
+
return jsx(ErrorBoundary, {
|
|
91
93
|
component: ACTION_SUBJECT.FLOATING_CONTEXTUAL_BUTTON,
|
|
92
94
|
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
|
|
93
95
|
fallbackComponent: null
|
|
94
|
-
},
|
|
96
|
+
}, jsx(FloatingContextualButton, props));
|
|
95
97
|
}
|
|
@@ -9,7 +9,9 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
9
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
+
/** @jsx jsx */
|
|
12
13
|
import { Component } from 'react';
|
|
14
|
+
import { jsx } from '@emotion/react';
|
|
13
15
|
import { injectIntl } from 'react-intl-next';
|
|
14
16
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
15
17
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -80,15 +82,15 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
80
82
|
value: {
|
|
81
83
|
name: 'background'
|
|
82
84
|
},
|
|
83
|
-
elemAfter:
|
|
85
|
+
elemAfter: jsx("div", {
|
|
84
86
|
className: DropdownMenuSharedCssClassName.SUBMENU
|
|
85
|
-
},
|
|
87
|
+
}, jsx("div", {
|
|
86
88
|
css: cellColourPreviewStyles(background),
|
|
87
89
|
className: ClassName.CONTEXTUAL_MENU_ICON
|
|
88
|
-
}), isSubmenuOpen &&
|
|
90
|
+
}), isSubmenuOpen && jsx("div", {
|
|
89
91
|
className: ClassName.CONTEXTUAL_SUBMENU,
|
|
90
92
|
ref: _this.handleSubMenuRef
|
|
91
|
-
},
|
|
93
|
+
}, jsx(ColorPalette, {
|
|
92
94
|
cols: 7,
|
|
93
95
|
onClick: _this.setColor,
|
|
94
96
|
selectedColor: background,
|
|
@@ -105,7 +107,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
105
107
|
value: {
|
|
106
108
|
name: 'insert_column'
|
|
107
109
|
},
|
|
108
|
-
elemAfter:
|
|
110
|
+
elemAfter: jsx("div", {
|
|
109
111
|
css: shortcutStyle
|
|
110
112
|
}, tooltip(addColumnAfter))
|
|
111
113
|
});
|
|
@@ -114,7 +116,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
114
116
|
value: {
|
|
115
117
|
name: 'insert_row'
|
|
116
118
|
},
|
|
117
|
-
elemAfter:
|
|
119
|
+
elemAfter: jsx("div", {
|
|
118
120
|
css: shortcutStyle
|
|
119
121
|
}, tooltip(addRowAfter))
|
|
120
122
|
});
|
|
@@ -194,7 +196,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
194
196
|
value: {
|
|
195
197
|
name: 'clear'
|
|
196
198
|
},
|
|
197
|
-
elemAfter:
|
|
199
|
+
elemAfter: jsx("div", {
|
|
198
200
|
css: shortcutStyle
|
|
199
201
|
}, tooltip(backspace))
|
|
200
202
|
});
|
|
@@ -356,10 +358,10 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
356
358
|
if (!items) {
|
|
357
359
|
return null;
|
|
358
360
|
}
|
|
359
|
-
return
|
|
361
|
+
return jsx("div", {
|
|
360
362
|
"data-testid": "table-cell-contextual-menu",
|
|
361
363
|
onMouseLeave: this.closeSubmenu
|
|
362
|
-
},
|
|
364
|
+
}, jsx(DropdownMenu, {
|
|
363
365
|
mountTo: mountPoint
|
|
364
366
|
//This needs be removed when the a11y is completely handled
|
|
365
367
|
//Disabling key navigation now as it works only partially
|