@atlaskit/editor-plugin-table 7.30.2 → 7.31.1
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 +25 -0
- package/dist/cjs/commands/column-resize.js +10 -8
- package/dist/cjs/commands/misc.js +4 -4
- package/dist/cjs/event-handlers.js +69 -65
- package/dist/cjs/plugin.js +94 -53
- package/dist/cjs/pm-plugins/decorations/utils/column-resizing.js +2 -2
- package/dist/cjs/pm-plugins/keymap.js +18 -15
- package/dist/cjs/pm-plugins/main.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/cjs/pm-plugins/view-mode-sort/index.js +35 -10
- package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +1 -1
- package/dist/cjs/ui/common-styles.js +8 -18
- package/dist/cjs/utils/decoration.js +28 -8
- package/dist/es2019/commands/column-resize.js +10 -8
- package/dist/es2019/commands/misc.js +4 -4
- package/dist/es2019/event-handlers.js +4 -4
- package/dist/es2019/plugin.js +53 -9
- package/dist/es2019/pm-plugins/decorations/utils/column-resizing.js +2 -2
- package/dist/es2019/pm-plugins/keymap.js +7 -4
- package/dist/es2019/pm-plugins/main.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/es2019/pm-plugins/view-mode-sort/index.js +33 -10
- package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +1 -1
- package/dist/es2019/ui/common-styles.js +0 -15
- package/dist/es2019/utils/decoration.js +26 -9
- package/dist/esm/commands/column-resize.js +10 -8
- package/dist/esm/commands/misc.js +4 -4
- package/dist/esm/event-handlers.js +69 -65
- package/dist/esm/plugin.js +91 -50
- package/dist/esm/pm-plugins/decorations/utils/column-resizing.js +2 -2
- package/dist/esm/pm-plugins/keymap.js +18 -15
- package/dist/esm/pm-plugins/main.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/esm/pm-plugins/view-mode-sort/index.js +35 -10
- package/dist/esm/ui/FloatingContextualButton/FixedButton.js +1 -1
- package/dist/esm/ui/common-styles.js +8 -18
- package/dist/esm/utils/decoration.js +28 -8
- package/dist/types/commands/column-resize.d.ts +5 -2
- package/dist/types/commands/misc.d.ts +3 -2
- package/dist/types/commands/toggle.d.ts +1 -1
- package/dist/types/commands-with-analytics.d.ts +2 -2
- package/dist/types/event-handlers.d.ts +2 -1
- package/dist/types/pm-plugins/decorations/utils/column-resizing.d.ts +2 -1
- package/dist/types/pm-plugins/keymap.d.ts +2 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/event-handlers.d.ts +2 -1
- package/dist/types/pm-plugins/table-resizing/plugin.d.ts +2 -1
- package/dist/types/pm-plugins/view-mode-sort/index.d.ts +2 -1
- package/dist/types/toDOM.d.ts +1 -1
- package/dist/types/utils/decoration.d.ts +2 -1
- package/dist/types-ts4.5/commands/column-resize.d.ts +5 -2
- package/dist/types-ts4.5/commands/misc.d.ts +3 -2
- package/dist/types-ts4.5/commands/toggle.d.ts +1 -1
- package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -2
- package/dist/types-ts4.5/event-handlers.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/decorations/utils/column-resizing.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/event-handlers.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/plugin.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/view-mode-sort/index.d.ts +2 -1
- package/dist/types-ts4.5/toDOM.d.ts +1 -1
- package/dist/types-ts4.5/utils/decoration.d.ts +2 -1
- package/package.json +11 -7
- package/src/commands/column-resize.ts +18 -1
- package/src/commands/misc.ts +5 -0
- package/src/commands-with-analytics.ts +2 -2
- package/src/event-handlers.ts +22 -20
- package/src/plugin.tsx +63 -6
- package/src/pm-plugins/decorations/utils/column-resizing.ts +3 -0
- package/src/pm-plugins/keymap.ts +5 -0
- package/src/pm-plugins/main.ts +2 -1
- package/src/pm-plugins/table-resizing/event-handlers.ts +8 -1
- package/src/pm-plugins/table-resizing/plugin.ts +3 -0
- package/src/pm-plugins/view-mode-sort/index.ts +73 -34
- package/src/toDOM.ts +1 -1
- package/src/toolbar.tsx +1 -1
- package/src/ui/FloatingContextualButton/FixedButton.tsx +1 -1
- package/src/ui/common-styles.ts +0 -17
- package/src/utils/decoration.ts +39 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.31.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#165078](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165078)
|
|
8
|
+
[`770231c1e2f01`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/770231c1e2f01) -
|
|
9
|
+
ED-25611: migrates table plugin from reactdom to portalprovider
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 7.31.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#161296](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/161296)
|
|
17
|
+
[`9a6292ab637fa`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9a6292ab637fa) -
|
|
18
|
+
[ED-25521] Add experiment based gating to the insertion logic for nested tables, so we only allow
|
|
19
|
+
nesting tables one level deep when the experiment is active
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#163855](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/163855)
|
|
24
|
+
[`893dd8380fd30`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/893dd8380fd30) -
|
|
25
|
+
[ux] Cleaned up FF platform.confluence.frontend.narrow-full-page-editor-toolbar
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
|
|
3
28
|
## 7.30.2
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -25,7 +25,7 @@ var getTablePluginCommand = function getTablePluginCommand(actionPayload, origin
|
|
|
25
25
|
return (originalTr || tr).setMeta('addToHistory', false);
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
|
-
var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosition(rowIndex, columnIndex, nextResizeHandlePos) {
|
|
28
|
+
var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosition(rowIndex, columnIndex, nextResizeHandlePos, nodeViewPortalProviderAPI) {
|
|
29
29
|
return function (state, dispatch) {
|
|
30
30
|
var customTr = state.tr;
|
|
31
31
|
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
@@ -37,7 +37,7 @@ var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosi
|
|
|
37
37
|
if (!allowColumnResizing) {
|
|
38
38
|
return false;
|
|
39
39
|
}
|
|
40
|
-
var decorationsWithWidget = (0, _utils2.buildColumnResizingDecorations)(rowIndex, columnIndex, true, getIntl)({
|
|
40
|
+
var decorationsWithWidget = (0, _utils2.buildColumnResizingDecorations)(rowIndex, columnIndex, true, getIntl, nodeViewPortalProviderAPI)({
|
|
41
41
|
tr: customTr,
|
|
42
42
|
decorationSet: (0, _plugin.getDecorations)(state)
|
|
43
43
|
});
|
|
@@ -69,7 +69,8 @@ var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosi
|
|
|
69
69
|
};
|
|
70
70
|
var initiateKeyboardColumnResizing = exports.initiateKeyboardColumnResizing = function initiateKeyboardColumnResizing(_ref) {
|
|
71
71
|
var ariaNotify = _ref.ariaNotify,
|
|
72
|
-
getIntl = _ref.getIntl
|
|
72
|
+
getIntl = _ref.getIntl,
|
|
73
|
+
nodeViewPortalProviderAPI = _ref.nodeViewPortalProviderAPI;
|
|
73
74
|
return function (state, dispatch, view) {
|
|
74
75
|
var selection = state.selection;
|
|
75
76
|
var selectionRect = (0, _utils.isSelectionType)(selection, 'cell') ? (0, _utils.getSelectionRect)(selection) : (0, _utils.findCellRectClosestToPos)(selection.$from);
|
|
@@ -80,7 +81,7 @@ var initiateKeyboardColumnResizing = exports.initiateKeyboardColumnResizing = fu
|
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
if (selectionRect && cell && view) {
|
|
83
|
-
return updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos)(state, dispatch);
|
|
84
|
+
return updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos, nodeViewPortalProviderAPI)(state, dispatch);
|
|
84
85
|
}
|
|
85
86
|
return false;
|
|
86
87
|
};
|
|
@@ -88,7 +89,8 @@ var initiateKeyboardColumnResizing = exports.initiateKeyboardColumnResizing = fu
|
|
|
88
89
|
var activateNextResizeArea = exports.activateNextResizeArea = function activateNextResizeArea(_ref2) {
|
|
89
90
|
var direction = _ref2.direction,
|
|
90
91
|
ariaNotify = _ref2.ariaNotify,
|
|
91
|
-
getIntl = _ref2.getIntl
|
|
92
|
+
getIntl = _ref2.getIntl,
|
|
93
|
+
nodeViewPortalProviderAPI = _ref2.nodeViewPortalProviderAPI;
|
|
92
94
|
return function (state, dispatch, view) {
|
|
93
95
|
var _ref3 = (0, _pluginFactory2.getPluginState)(state) || {},
|
|
94
96
|
resizeHandlePos = _ref3.resizeHandlePos;
|
|
@@ -134,17 +136,17 @@ var activateNextResizeArea = exports.activateNextResizeArea = function activateN
|
|
|
134
136
|
// we are somewhere in between the side columns of the table
|
|
135
137
|
var offset = $nextCell.pos - $nextCell.start(-1);
|
|
136
138
|
var rectForNextCell = tableMap.findCell(offset);
|
|
137
|
-
return updateResizeHandleAndStatePosition(rectForNextCell.top, rectForNextCell.right, $nextCell.pos)(state, dispatch, view);
|
|
139
|
+
return updateResizeHandleAndStatePosition(rectForNextCell.top, rectForNextCell.right, $nextCell.pos, nodeViewPortalProviderAPI)(state, dispatch, view);
|
|
138
140
|
} else {
|
|
139
141
|
// current position is in the one of the side columns of the table(left or right)
|
|
140
142
|
if (currentCellRect.left === 0) {
|
|
141
143
|
var lastCellInCurrentRow = tableMap.positionAt(currentCellRect.top, tableMap.width - 1, tableNode) + closestTable.start;
|
|
142
144
|
var $lastCell = state.doc.resolve(lastCellInCurrentRow);
|
|
143
|
-
return updateResizeHandleAndStatePosition(currentCellRect.top, tableMap.width, $lastCell.pos)(state, dispatch, view);
|
|
145
|
+
return updateResizeHandleAndStatePosition(currentCellRect.top, tableMap.width, $lastCell.pos, nodeViewPortalProviderAPI)(state, dispatch, view);
|
|
144
146
|
} else if (tableMap.width === currentCellRect.right) {
|
|
145
147
|
var firsCellInCurrentRow = tableMap.positionAt(currentCellRect.top, 0, tableNode) + closestTable.start;
|
|
146
148
|
var _$nextCell = state.doc.resolve(firsCellInCurrentRow);
|
|
147
|
-
return updateResizeHandleAndStatePosition(currentCellRect.top, 1, _$nextCell.pos)(state, dispatch);
|
|
149
|
+
return updateResizeHandleAndStatePosition(currentCellRect.top, 1, _$nextCell.pos, nodeViewPortalProviderAPI)(state, dispatch);
|
|
148
150
|
}
|
|
149
151
|
}
|
|
150
152
|
return false;
|
|
@@ -469,7 +469,7 @@ var hideInsertColumnOrRowButton = exports.hideInsertColumnOrRowButton = function
|
|
|
469
469
|
return tr.setMeta('addToHistory', false);
|
|
470
470
|
});
|
|
471
471
|
};
|
|
472
|
-
var addResizeHandleDecorations = exports.addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex, includeTooltip, isKeyboardResize) {
|
|
472
|
+
var addResizeHandleDecorations = exports.addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex, includeTooltip, nodeViewPortalProviderAPI, isKeyboardResize) {
|
|
473
473
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
474
474
|
var tableNode = (0, _utils2.findTable)(state.selection);
|
|
475
475
|
var _getPluginState3 = (0, _pluginFactory.getPluginState)(state),
|
|
@@ -481,7 +481,7 @@ var addResizeHandleDecorations = exports.addResizeHandleDecorations = function a
|
|
|
481
481
|
return {
|
|
482
482
|
type: 'ADD_RESIZE_HANDLE_DECORATIONS',
|
|
483
483
|
data: {
|
|
484
|
-
decorationSet: (0, _utils3.buildColumnResizingDecorations)(rowIndex, columnIndex, includeTooltip, getIntl)({
|
|
484
|
+
decorationSet: (0, _utils3.buildColumnResizingDecorations)(rowIndex, columnIndex, includeTooltip, getIntl, nodeViewPortalProviderAPI)({
|
|
485
485
|
tr: state.tr,
|
|
486
486
|
decorationSet: (0, _plugin.getDecorations)(state)
|
|
487
487
|
}),
|
|
@@ -495,7 +495,7 @@ var addResizeHandleDecorations = exports.addResizeHandleDecorations = function a
|
|
|
495
495
|
return tr.setMeta('addToHistory', false);
|
|
496
496
|
});
|
|
497
497
|
};
|
|
498
|
-
var updateResizeHandleDecorations = exports.updateResizeHandleDecorations = function updateResizeHandleDecorations(rowIndex, columnIndex, includeTooltip) {
|
|
498
|
+
var updateResizeHandleDecorations = exports.updateResizeHandleDecorations = function updateResizeHandleDecorations(nodeViewPortalProviderAPI, rowIndex, columnIndex, includeTooltip) {
|
|
499
499
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
500
500
|
var tableNode = (0, _utils2.findTable)(state.selection);
|
|
501
501
|
var _getPluginState4 = (0, _pluginFactory.getPluginState)(state),
|
|
@@ -516,7 +516,7 @@ var updateResizeHandleDecorations = exports.updateResizeHandleDecorations = func
|
|
|
516
516
|
return {
|
|
517
517
|
type: 'UPDATE_RESIZE_HANDLE_DECORATIONS',
|
|
518
518
|
data: {
|
|
519
|
-
decorationSet: (0, _utils3.buildColumnResizingDecorations)(resolvedRowIndex, resolvedColumnIndex, resolvedIncludeTooltip, getIntl)({
|
|
519
|
+
decorationSet: (0, _utils3.buildColumnResizingDecorations)(resolvedRowIndex, resolvedColumnIndex, resolvedIncludeTooltip, getIntl, nodeViewPortalProviderAPI)({
|
|
520
520
|
tr: state.tr,
|
|
521
521
|
decorationSet: (0, _plugin.getDecorations)(state)
|
|
522
522
|
}),
|
|
@@ -254,78 +254,82 @@ var handleMouseLeave = exports.handleMouseLeave = function handleMouseLeave(view
|
|
|
254
254
|
|
|
255
255
|
// IMPORTANT: The mouse move handler has been setup with RAF schedule to avoid Reflows which will occur as some methods
|
|
256
256
|
// need to access the mouse event offset position and also the target clientWidth vallue.
|
|
257
|
-
var handleMouseMoveDebounce =
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
var element = event.target;
|
|
262
|
-
if ((0, _utils3.isColumnControlsDecorations)(element) || (0, _utils3.isDragColumnFloatingInsertDot)(element)) {
|
|
263
|
-
var state = view.state,
|
|
264
|
-
dispatch = view.dispatch;
|
|
265
|
-
var _getPluginState6 = (0, _pluginFactory2.getPluginState)(state),
|
|
266
|
-
insertColumnButtonIndex = _getPluginState6.insertColumnButtonIndex;
|
|
267
|
-
var _getColumnOrRowIndex9 = (0, _utils3.getColumnOrRowIndex)(element),
|
|
268
|
-
_getColumnOrRowIndex10 = (0, _slicedToArray2.default)(_getColumnOrRowIndex9, 2),
|
|
269
|
-
startIndex = _getColumnOrRowIndex10[0],
|
|
270
|
-
endIndex = _getColumnOrRowIndex10[1];
|
|
271
|
-
var positionColumn = (0, _utils3.getMousePositionHorizontalRelativeByElement)(event, offsetX, undefined) === 'right' ? endIndex : startIndex;
|
|
272
|
-
if (positionColumn !== insertColumnButtonIndex) {
|
|
273
|
-
return (0, _commands.showInsertColumnButton)(positionColumn)(state, dispatch);
|
|
257
|
+
var handleMouseMoveDebounce = function handleMouseMoveDebounce(nodeViewPortalProviderAPI) {
|
|
258
|
+
return (0, _rafSchd.default)(function (view, event, offsetX) {
|
|
259
|
+
if (!(event.target instanceof HTMLElement)) {
|
|
260
|
+
return false;
|
|
274
261
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
262
|
+
var element = event.target;
|
|
263
|
+
if ((0, _utils3.isColumnControlsDecorations)(element) || (0, _utils3.isDragColumnFloatingInsertDot)(element)) {
|
|
264
|
+
var state = view.state,
|
|
265
|
+
dispatch = view.dispatch;
|
|
266
|
+
var _getPluginState6 = (0, _pluginFactory2.getPluginState)(state),
|
|
267
|
+
insertColumnButtonIndex = _getPluginState6.insertColumnButtonIndex;
|
|
268
|
+
var _getColumnOrRowIndex9 = (0, _utils3.getColumnOrRowIndex)(element),
|
|
269
|
+
_getColumnOrRowIndex10 = (0, _slicedToArray2.default)(_getColumnOrRowIndex9, 2),
|
|
270
|
+
startIndex = _getColumnOrRowIndex10[0],
|
|
271
|
+
endIndex = _getColumnOrRowIndex10[1];
|
|
272
|
+
var positionColumn = (0, _utils3.getMousePositionHorizontalRelativeByElement)(event, offsetX, undefined) === 'right' ? endIndex : startIndex;
|
|
273
|
+
if (positionColumn !== insertColumnButtonIndex) {
|
|
274
|
+
return (0, _commands.showInsertColumnButton)(positionColumn)(state, dispatch);
|
|
275
|
+
}
|
|
288
276
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
var
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
277
|
+
if ((0, _utils3.isRowControlsButton)(element) || (0, _utils3.isDragRowFloatingInsertDot)(element)) {
|
|
278
|
+
var _state3 = view.state,
|
|
279
|
+
_dispatch4 = view.dispatch;
|
|
280
|
+
var _getPluginState7 = (0, _pluginFactory2.getPluginState)(_state3),
|
|
281
|
+
insertRowButtonIndex = _getPluginState7.insertRowButtonIndex;
|
|
282
|
+
var _getColumnOrRowIndex11 = (0, _utils3.getColumnOrRowIndex)(element),
|
|
283
|
+
_getColumnOrRowIndex12 = (0, _slicedToArray2.default)(_getColumnOrRowIndex11, 2),
|
|
284
|
+
_startIndex3 = _getColumnOrRowIndex12[0],
|
|
285
|
+
_endIndex2 = _getColumnOrRowIndex12[1];
|
|
286
|
+
var positionRow = (0, _utils3.getMousePositionVerticalRelativeByElement)(event) === 'bottom' ? _endIndex2 : _startIndex3;
|
|
287
|
+
if (positionRow !== insertRowButtonIndex) {
|
|
288
|
+
return (0, _commands.showInsertRowButton)(positionRow)(_state3, _dispatch4);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (!(0, _utils3.isResizeHandleDecoration)(element) && (0, _utils3.isCell)(element)) {
|
|
292
|
+
var _positionColumn = (0, _utils3.getMousePositionHorizontalRelativeByElement)(event, offsetX, _types.RESIZE_HANDLE_AREA_DECORATION_GAP);
|
|
293
|
+
if (_positionColumn !== null) {
|
|
294
|
+
var _state4 = view.state,
|
|
295
|
+
_dispatch5 = view.dispatch;
|
|
296
|
+
var _getPluginState8 = (0, _pluginFactory2.getPluginState)(_state4),
|
|
297
|
+
resizeHandleColumnIndex = _getPluginState8.resizeHandleColumnIndex,
|
|
298
|
+
resizeHandleRowIndex = _getPluginState8.resizeHandleRowIndex;
|
|
299
|
+
var isKeyboardResize = (0, _pluginFactory2.getPluginState)(_state4).isKeyboardResize;
|
|
300
|
+
var tableCell = (0, _utils.closestElement)(element, 'td, th');
|
|
301
|
+
var cellStartPosition = view.posAtDOM(tableCell, 0);
|
|
302
|
+
var rect = (0, _utils2.findCellRectClosestToPos)(_state4.doc.resolve(cellStartPosition));
|
|
303
|
+
if (rect) {
|
|
304
|
+
var columnEndIndexTarget = _positionColumn === 'left' ? rect.left : rect.right;
|
|
305
|
+
var rowIndexTarget = rect.top;
|
|
306
|
+
if ((columnEndIndexTarget !== resizeHandleColumnIndex || rowIndexTarget !== resizeHandleRowIndex || !(0, _utils3.hasResizeHandler)({
|
|
307
|
+
target: element,
|
|
308
|
+
columnEndIndexTarget: columnEndIndexTarget
|
|
309
|
+
})) && !isKeyboardResize // if initiated by keyboard don't need to react on hover for other resize sliders
|
|
310
|
+
) {
|
|
311
|
+
return (0, _commands.addResizeHandleDecorations)(rowIndexTarget, columnEndIndexTarget, true, nodeViewPortalProviderAPI)(_state4, _dispatch5);
|
|
312
|
+
}
|
|
311
313
|
}
|
|
312
314
|
}
|
|
313
315
|
}
|
|
314
|
-
}
|
|
315
|
-
return false;
|
|
316
|
-
});
|
|
317
|
-
var handleMouseMove = exports.handleMouseMove = function handleMouseMove(view, event) {
|
|
318
|
-
if (!(event.target instanceof HTMLElement)) {
|
|
319
316
|
return false;
|
|
320
|
-
}
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
var handleMouseMove = exports.handleMouseMove = function handleMouseMove(nodeViewPortalProviderAPI) {
|
|
320
|
+
return function (view, event) {
|
|
321
|
+
if (!(event.target instanceof HTMLElement)) {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
321
324
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
325
|
+
// NOTE: When accessing offsetX in gecko from a deferred callback, it will return 0. However it will be non-zero if accessed
|
|
326
|
+
// within the scope of it's initial mouse move handler. Also Chrome does return the correct value, however it could trigger
|
|
327
|
+
// a reflow. So for now this will just grab the offsetX value immediately for gecko and chrome will calculate later
|
|
328
|
+
// in the deferred callback handler.
|
|
329
|
+
// Bug Tracking: https://bugzilla.mozilla.org/show_bug.cgi?id=1882903
|
|
330
|
+
handleMouseMoveDebounce(nodeViewPortalProviderAPI)(view, event, _utils.browser.gecko ? event.offsetX : NaN);
|
|
331
|
+
return false;
|
|
332
|
+
};
|
|
329
333
|
};
|
|
330
334
|
function handleTripleClick(view, pos) {
|
|
331
335
|
var state = view.state,
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -14,11 +14,15 @@ var _errorBoundary = require("@atlaskit/editor-common/error-boundary");
|
|
|
14
14
|
var _icons = require("@atlaskit/editor-common/icons");
|
|
15
15
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
16
16
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
17
|
+
var _nesting = require("@atlaskit/editor-common/nesting");
|
|
17
18
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
18
19
|
var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
|
|
20
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
21
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
19
22
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
20
23
|
var _pmPlugins = require("@atlaskit/editor-tables/pm-plugins");
|
|
21
24
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
25
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
22
26
|
var _insert = require("./commands/insert");
|
|
23
27
|
var _createPluginConfig = require("./create-plugin-config");
|
|
24
28
|
var _plugin = require("./pm-plugins/analytics/plugin");
|
|
@@ -48,7 +52,7 @@ var _FloatingInsertButton = _interopRequireDefault(require("./ui/FloatingInsertB
|
|
|
48
52
|
var _FloatingToolbarLabel = require("./ui/FloatingToolbarLabel/FloatingToolbarLabel");
|
|
49
53
|
var _globalStyles = require("./ui/global-styles");
|
|
50
54
|
var _TableFullWidthLabel = require("./ui/TableFullWidthLabel");
|
|
51
|
-
var
|
|
55
|
+
var _utils2 = require("./utils");
|
|
52
56
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
53
57
|
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) { (0, _defineProperty2.default)(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; }
|
|
54
58
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
@@ -114,7 +118,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
114
118
|
insertTable: function insertTable(analyticsPayload) {
|
|
115
119
|
return function (state, dispatch) {
|
|
116
120
|
var _api$contentInsertion, _api$contentInsertion2;
|
|
117
|
-
var node = (0,
|
|
121
|
+
var node = (0, _utils2.createTableWithWidth)({
|
|
118
122
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
119
123
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
|
|
120
124
|
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
|
|
@@ -122,6 +126,21 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
122
126
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
123
127
|
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
|
|
124
128
|
})(state.schema);
|
|
129
|
+
|
|
130
|
+
// If the cursor is inside a table
|
|
131
|
+
var insertAt;
|
|
132
|
+
if ((0, _utils.hasParentNodeOfType)(state.schema.nodes.table)(state.selection) && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes')) {
|
|
133
|
+
// If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
|
|
134
|
+
if ((0, _experiments.editorExperiment)('nested-tables-in-tables', false, {
|
|
135
|
+
exposure: true
|
|
136
|
+
}) || (0, _nesting.getParentOfTypeCount)(state.schema.nodes.table)(state.selection) > 1) {
|
|
137
|
+
var positionAfterTopTable = (0, _nesting.getPositionAfterTopParentNodeOfType)(state.schema.nodes.table)(state.selection);
|
|
138
|
+
if (!positionAfterTopTable) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
insertAt = _state.TextSelection.create(state.doc, positionAfterTopTable);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
125
144
|
return (_api$contentInsertion = api === null || api === void 0 || (_api$contentInsertion2 = api.contentInsertion) === null || _api$contentInsertion2 === void 0 || (_api$contentInsertion2 = _api$contentInsertion2.actions) === null || _api$contentInsertion2 === void 0 ? void 0 : _api$contentInsertion2.insert({
|
|
126
145
|
state: state,
|
|
127
146
|
dispatch: dispatch,
|
|
@@ -132,7 +151,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
132
151
|
attributes: _objectSpread(_objectSpread({}, analyticsPayload.attributes), {}, {
|
|
133
152
|
localId: node.attrs.localId
|
|
134
153
|
})
|
|
135
|
-
})
|
|
154
|
+
}),
|
|
155
|
+
insertAt: insertAt
|
|
136
156
|
}
|
|
137
157
|
})) !== null && _api$contentInsertion !== void 0 ? _api$contentInsertion : false;
|
|
138
158
|
};
|
|
@@ -188,6 +208,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
188
208
|
var dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
189
209
|
dispatch = _ref2.dispatch,
|
|
190
210
|
portalProviderAPI = _ref2.portalProviderAPI,
|
|
211
|
+
nodeViewPortalProviderAPI = _ref2.nodeViewPortalProviderAPI,
|
|
191
212
|
eventDispatcher = _ref2.eventDispatcher,
|
|
192
213
|
getIntl = _ref2.getIntl;
|
|
193
214
|
var _ref3 = options || {},
|
|
@@ -201,12 +222,13 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
201
222
|
isTableAlignmentEnabled = _ref3.isTableAlignmentEnabled,
|
|
202
223
|
isCommentEditor = _ref3.isCommentEditor,
|
|
203
224
|
isChromelessEditor = _ref3.isChromelessEditor;
|
|
204
|
-
return (0, _main.createPlugin)(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, (0, _createPluginConfig.pluginConfig)(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor);
|
|
225
|
+
return (0, _main.createPlugin)(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, (0, _createPluginConfig.pluginConfig)(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor);
|
|
205
226
|
}
|
|
206
227
|
}, {
|
|
207
228
|
name: 'tablePMColResizing',
|
|
208
229
|
plugin: function plugin(_ref4) {
|
|
209
|
-
var dispatch = _ref4.dispatch
|
|
230
|
+
var dispatch = _ref4.dispatch,
|
|
231
|
+
nodeViewPortalProviderAPI = _ref4.nodeViewPortalProviderAPI;
|
|
210
232
|
var _ref5 = options || {},
|
|
211
233
|
fullWidthEnabled = _ref5.fullWidthEnabled,
|
|
212
234
|
tableOptions = _ref5.tableOptions,
|
|
@@ -218,7 +240,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
218
240
|
allowColumnResizing = _pluginConfig2.allowColumnResizing;
|
|
219
241
|
return allowColumnResizing ? (0, _tableResizing.createPlugin)(dispatch, {
|
|
220
242
|
lastColumnResizable: !fullWidthEnabled
|
|
221
|
-
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, api, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled, isTableAlignmentEnabled, !!(options !== null && options !== void 0 && options.isCommentEditor)) : undefined;
|
|
243
|
+
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled, isTableAlignmentEnabled, !!(options !== null && options !== void 0 && options.isCommentEditor)) : undefined;
|
|
222
244
|
}
|
|
223
245
|
}, {
|
|
224
246
|
name: 'tableEditing',
|
|
@@ -231,7 +253,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
231
253
|
{
|
|
232
254
|
name: 'tableKeymap',
|
|
233
255
|
plugin: function plugin(_ref6) {
|
|
234
|
-
var getIntl = _ref6.getIntl
|
|
256
|
+
var getIntl = _ref6.getIntl,
|
|
257
|
+
nodeViewPortalProviderAPI = _ref6.nodeViewPortalProviderAPI;
|
|
235
258
|
var _ref7 = options || {},
|
|
236
259
|
dragAndDropEnabled = _ref7.dragAndDropEnabled,
|
|
237
260
|
_ref7$isTableScalingE = _ref7.isTableScalingEnabled,
|
|
@@ -246,7 +269,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
246
269
|
isChromelessEditor = _ref7$isChromelessEdi === void 0 ? false : _ref7$isChromelessEdi,
|
|
247
270
|
_ref7$tableResizingEn = _ref7.tableResizingEnabled,
|
|
248
271
|
tableResizingEnabled = _ref7$tableResizingEn === void 0 ? false : _ref7$tableResizingEn;
|
|
249
|
-
return (0, _keymap.keymapPlugin)(defaultGetEditorContainerWidth, api, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableResizingEnabled);
|
|
272
|
+
return (0, _keymap.keymapPlugin)(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableResizingEnabled);
|
|
250
273
|
}
|
|
251
274
|
}, {
|
|
252
275
|
name: 'tableSelectionKeymap',
|
|
@@ -293,45 +316,46 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
293
316
|
}
|
|
294
317
|
}, {
|
|
295
318
|
name: 'tableViewModeSort',
|
|
296
|
-
plugin: function plugin() {
|
|
297
|
-
|
|
319
|
+
plugin: function plugin(_ref13) {
|
|
320
|
+
var nodeViewPortalProviderAPI = _ref13.nodeViewPortalProviderAPI;
|
|
321
|
+
return api !== null && api !== void 0 && api.editorViewMode ? (0, _viewModeSort.createPlugin)(api, nodeViewPortalProviderAPI) : undefined;
|
|
298
322
|
}
|
|
299
323
|
}, {
|
|
300
324
|
name: 'tableLocalId',
|
|
301
|
-
plugin: function plugin(
|
|
302
|
-
var dispatch =
|
|
325
|
+
plugin: function plugin(_ref14) {
|
|
326
|
+
var dispatch = _ref14.dispatch;
|
|
303
327
|
return (0, _tableLocalId.createPlugin)(dispatch);
|
|
304
328
|
}
|
|
305
329
|
}, {
|
|
306
330
|
name: 'tableWidth',
|
|
307
|
-
plugin: function plugin(
|
|
331
|
+
plugin: function plugin(_ref15) {
|
|
308
332
|
var _options$fullWidthEna, _options$isTableScali, _options$isTableAlign, _options$isCommentEdi;
|
|
309
|
-
var dispatchAnalyticsEvent =
|
|
310
|
-
dispatch =
|
|
333
|
+
var dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent,
|
|
334
|
+
dispatch = _ref15.dispatch;
|
|
311
335
|
return options !== null && options !== void 0 && options.tableResizingEnabled ? (0, _tableWidth.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$isTableAlign = options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled) !== null && _options$isTableAlign !== void 0 ? _options$isTableAlign : false, (_options$isCommentEdi = options === null || options === void 0 ? void 0 : options.isCommentEditor) !== null && _options$isCommentEdi !== void 0 ? _options$isCommentEdi : false) : undefined;
|
|
312
336
|
}
|
|
313
337
|
}, {
|
|
314
338
|
name: 'tableWidthInCommentFix',
|
|
315
|
-
plugin: function plugin(
|
|
339
|
+
plugin: function plugin(_ref16) {
|
|
316
340
|
var _options$isTableAlign2;
|
|
317
|
-
var dispatch =
|
|
341
|
+
var dispatch = _ref16.dispatch;
|
|
318
342
|
return options !== null && options !== void 0 && options.tableResizingEnabled && options !== null && options !== void 0 && options.isCommentEditor ? (0, _tableWidthInCommentFix.createPlugin)(dispatch, (_options$isTableAlign2 = options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled) !== null && _options$isTableAlign2 !== void 0 ? _options$isTableAlign2 : false) : undefined;
|
|
319
343
|
}
|
|
320
344
|
},
|
|
321
345
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
322
346
|
{
|
|
323
347
|
name: 'tableOverflowAnalyticsPlugin',
|
|
324
|
-
plugin: function plugin(
|
|
348
|
+
plugin: function plugin(_ref17) {
|
|
325
349
|
var _options$tableResizin;
|
|
326
|
-
var dispatch =
|
|
327
|
-
dispatchAnalyticsEvent =
|
|
350
|
+
var dispatch = _ref17.dispatch,
|
|
351
|
+
dispatchAnalyticsEvent = _ref17.dispatchAnalyticsEvent;
|
|
328
352
|
return (0, _tableAnalytics.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$tableResizin = options === null || options === void 0 ? void 0 : options.tableResizingEnabled) !== null && _options$tableResizin !== void 0 ? _options$tableResizin : false);
|
|
329
353
|
}
|
|
330
354
|
}, {
|
|
331
355
|
name: 'tableAnalyticsPlugin',
|
|
332
|
-
plugin: function plugin(
|
|
333
|
-
var dispatch =
|
|
334
|
-
dispatchAnalyticsEvent =
|
|
356
|
+
plugin: function plugin(_ref18) {
|
|
357
|
+
var dispatch = _ref18.dispatch,
|
|
358
|
+
dispatchAnalyticsEvent = _ref18.dispatchAnalyticsEvent;
|
|
335
359
|
return (0, _plugin.createPlugin)(dispatch, dispatchAnalyticsEvent);
|
|
336
360
|
}
|
|
337
361
|
}, {
|
|
@@ -362,13 +386,13 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
362
386
|
}
|
|
363
387
|
return plugins;
|
|
364
388
|
},
|
|
365
|
-
contentComponent: function contentComponent(
|
|
389
|
+
contentComponent: function contentComponent(_ref19) {
|
|
366
390
|
var _api$featureFlags;
|
|
367
|
-
var editorView =
|
|
368
|
-
popupsMountPoint =
|
|
369
|
-
popupsBoundariesElement =
|
|
370
|
-
popupsScrollableElement =
|
|
371
|
-
dispatchAnalyticsEvent =
|
|
391
|
+
var editorView = _ref19.editorView,
|
|
392
|
+
popupsMountPoint = _ref19.popupsMountPoint,
|
|
393
|
+
popupsBoundariesElement = _ref19.popupsBoundariesElement,
|
|
394
|
+
popupsScrollableElement = _ref19.popupsScrollableElement,
|
|
395
|
+
dispatchAnalyticsEvent = _ref19.dispatchAnalyticsEvent;
|
|
372
396
|
return /*#__PURE__*/_react.default.createElement(_errorBoundary.ErrorBoundary, {
|
|
373
397
|
component: _analytics.ACTION_SUBJECT.TABLES_PLUGIN,
|
|
374
398
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -384,32 +408,32 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
384
408
|
stickyHeadersState: _stickyHeaders.pluginKey,
|
|
385
409
|
dragAndDropState: _dragAndDrop.pluginKey
|
|
386
410
|
},
|
|
387
|
-
render: function render(
|
|
388
|
-
var resizingPluginState =
|
|
389
|
-
stickyHeadersState =
|
|
390
|
-
tablePluginState =
|
|
391
|
-
tableWidthPluginState =
|
|
392
|
-
dragAndDropState =
|
|
411
|
+
render: function render(_ref20) {
|
|
412
|
+
var resizingPluginState = _ref20.tableResizingPluginState,
|
|
413
|
+
stickyHeadersState = _ref20.stickyHeadersState,
|
|
414
|
+
tablePluginState = _ref20.tablePluginState,
|
|
415
|
+
tableWidthPluginState = _ref20.tableWidthPluginState,
|
|
416
|
+
dragAndDropState = _ref20.dragAndDropState;
|
|
393
417
|
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
394
418
|
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
395
419
|
var resizingTableLocalId = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableLocalId;
|
|
396
420
|
var resizingTableRef = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableRef;
|
|
397
421
|
var isResizing = isColumnResizing || isTableResizing;
|
|
398
422
|
var widthToWidest = tablePluginState === null || tablePluginState === void 0 ? void 0 : tablePluginState.widthToWidest;
|
|
399
|
-
var
|
|
400
|
-
tableNode =
|
|
401
|
-
tablePos =
|
|
402
|
-
targetCellPosition =
|
|
403
|
-
isContextualMenuOpen =
|
|
404
|
-
tableRef =
|
|
405
|
-
pluginConfig =
|
|
406
|
-
insertColumnButtonIndex =
|
|
407
|
-
insertRowButtonIndex =
|
|
408
|
-
isHeaderColumnEnabled =
|
|
409
|
-
isHeaderRowEnabled =
|
|
410
|
-
isDragAndDropEnabled =
|
|
411
|
-
tableWrapperTarget =
|
|
412
|
-
isCellMenuOpenByKeyboard =
|
|
423
|
+
var _ref21 = tablePluginState,
|
|
424
|
+
tableNode = _ref21.tableNode,
|
|
425
|
+
tablePos = _ref21.tablePos,
|
|
426
|
+
targetCellPosition = _ref21.targetCellPosition,
|
|
427
|
+
isContextualMenuOpen = _ref21.isContextualMenuOpen,
|
|
428
|
+
tableRef = _ref21.tableRef,
|
|
429
|
+
pluginConfig = _ref21.pluginConfig,
|
|
430
|
+
insertColumnButtonIndex = _ref21.insertColumnButtonIndex,
|
|
431
|
+
insertRowButtonIndex = _ref21.insertRowButtonIndex,
|
|
432
|
+
isHeaderColumnEnabled = _ref21.isHeaderColumnEnabled,
|
|
433
|
+
isHeaderRowEnabled = _ref21.isHeaderRowEnabled,
|
|
434
|
+
isDragAndDropEnabled = _ref21.isDragAndDropEnabled,
|
|
435
|
+
tableWrapperTarget = _ref21.tableWrapperTarget,
|
|
436
|
+
isCellMenuOpenByKeyboard = _ref21.isCellMenuOpenByKeyboard;
|
|
413
437
|
var allowControls = pluginConfig.allowControls;
|
|
414
438
|
var stickyHeader = stickyHeadersState ? (0, _stickyHeaders.findStickyHeaderForTable)(stickyHeadersState, tablePos) : undefined;
|
|
415
439
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, targetCellPosition && (tableRef || isCellMenuOpenByKeyboard) && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/_react.default.createElement(_FloatingContextualButton.default, {
|
|
@@ -502,8 +526,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
502
526
|
}));
|
|
503
527
|
},
|
|
504
528
|
pluginsOptions: {
|
|
505
|
-
quickInsert: function quickInsert(
|
|
506
|
-
var formatMessage =
|
|
529
|
+
quickInsert: function quickInsert(_ref22) {
|
|
530
|
+
var formatMessage = _ref22.formatMessage;
|
|
507
531
|
return [{
|
|
508
532
|
id: 'table',
|
|
509
533
|
title: formatMessage(_messages.toolbarInsertBlockMessages.table),
|
|
@@ -518,7 +542,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
518
542
|
var _api$table;
|
|
519
543
|
// see comment on tablesPlugin.getSharedState on usage
|
|
520
544
|
var tableState = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
|
|
521
|
-
var tableNode = (0,
|
|
545
|
+
var tableNode = (0, _utils2.createTableWithWidth)({
|
|
522
546
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
523
547
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
|
|
524
548
|
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
|
|
@@ -526,7 +550,24 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
526
550
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
527
551
|
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
|
|
528
552
|
})(state.schema);
|
|
529
|
-
var tr =
|
|
553
|
+
var tr = state.tr;
|
|
554
|
+
// If the cursor is inside a table
|
|
555
|
+
if ((0, _utils.hasParentNodeOfType)(state.schema.nodes.table)(state.selection) && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes')) {
|
|
556
|
+
// If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
|
|
557
|
+
if ((0, _experiments.editorExperiment)('nested-tables-in-tables', false, {
|
|
558
|
+
exposure: true
|
|
559
|
+
}) || (0, _nesting.getParentOfTypeCount)(state.schema.nodes.table)(state.selection) > 1) {
|
|
560
|
+
// Nesting is too deep insert table after the top parent table
|
|
561
|
+
var positionAfterTopTable = (0, _nesting.getPositionAfterTopParentNodeOfType)(state.schema.nodes.table)(state.selection);
|
|
562
|
+
tr = (0, _utils.safeInsert)(tableNode, positionAfterTopTable)(tr);
|
|
563
|
+
tr.scrollIntoView();
|
|
564
|
+
} else {
|
|
565
|
+
// Table can be nested in parent table
|
|
566
|
+
tr = insert(tableNode);
|
|
567
|
+
}
|
|
568
|
+
} else {
|
|
569
|
+
tr = insert(tableNode);
|
|
570
|
+
}
|
|
530
571
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
531
572
|
action: _analytics.ACTION.INSERTED,
|
|
532
573
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
@@ -24,13 +24,13 @@ var updateLastCellElement = function updateLastCellElement(lastCellElementsDecor
|
|
|
24
24
|
return (0, _decoration.updateDecorations)(tr.doc, decorationSet, lastCellElementsDecorations, _types.TableDecorations.LAST_CELL_ELEMENT);
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
-
var buildColumnResizingDecorations = exports.buildColumnResizingDecorations = function buildColumnResizingDecorations(rowEndIndex, columnEndIndex, includeTooltip, getIntl) {
|
|
27
|
+
var buildColumnResizingDecorations = exports.buildColumnResizingDecorations = function buildColumnResizingDecorations(rowEndIndex, columnEndIndex, includeTooltip, getIntl, nodeViewPortalProviderAPI) {
|
|
28
28
|
return function (_ref3) {
|
|
29
29
|
var tr = _ref3.tr,
|
|
30
30
|
decorationSet = _ref3.decorationSet;
|
|
31
31
|
var _ref4 = columnEndIndex < 0 ? emptyDecorations : (0, _decoration.createResizeHandleDecoration)(tr, rowEndIndex, {
|
|
32
32
|
right: columnEndIndex
|
|
33
|
-
}, includeTooltip, getIntl),
|
|
33
|
+
}, includeTooltip, getIntl, nodeViewPortalProviderAPI),
|
|
34
34
|
_ref5 = (0, _slicedToArray2.default)(_ref4, 2),
|
|
35
35
|
columnResizesDecorations = _ref5[0],
|
|
36
36
|
lastCellElementsDecorations = _ref5[1];
|