@atlaskit/editor-plugin-table 22.4.18 → 22.4.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/nodeviews/TableCell.js +9 -2
- package/dist/cjs/nodeviews/TableRowNativeStickyWithFallback.js +4 -4
- package/dist/cjs/pm-plugins/commands/active-table-menu.js +18 -21
- package/dist/cjs/pm-plugins/commands/commands-with-analytics.js +17 -10
- package/dist/cjs/pm-plugins/commands/index.js +6 -0
- package/dist/cjs/pm-plugins/commands/misc.js +37 -5
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +23 -12
- package/dist/cjs/tablePlugin.js +5 -4
- package/dist/cjs/ui/FloatingContextualButton/index.js +32 -9
- package/dist/cjs/ui/FloatingContextualMenu/CellMenuPopup.js +2 -2
- package/dist/cjs/ui/TableMenu/cell/getCellMenuComponents.js +76 -0
- package/dist/cjs/ui/TableMenu/cell/items/MergeCellsItem.js +2 -1
- package/dist/cjs/ui/TableMenu/cell/items/SplitCellItem.js +2 -1
- package/dist/cjs/ui/TableMenu/cell/items/VerticalAlignDropdownItem.js +62 -0
- package/dist/cjs/ui/TableMenu/cell/items/VerticalAlignNestedMenu.js +56 -0
- package/dist/cjs/ui/TableMenu/cell/items/verticalAlignUtils.js +20 -0
- package/dist/cjs/ui/TableMenu/cell/keys.js +24 -2
- package/dist/cjs/ui/TableMenu/column/items/AddColumnLeftItem.js +3 -0
- package/dist/cjs/ui/TableMenu/column/items/AddColumnRightItem.js +3 -0
- package/dist/cjs/ui/TableMenu/column/items/DeleteColumnItem.js +2 -0
- package/dist/cjs/ui/TableMenu/column/items/DistributeColumnsItem.js +3 -0
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnLeftItem.js +3 -0
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnRightItem.js +3 -0
- package/dist/cjs/ui/TableMenu/column/items/SortDecreasingItem.js +3 -0
- package/dist/cjs/ui/TableMenu/column/items/SortIncreasingItem.js +3 -0
- package/dist/cjs/ui/TableMenu/row/items/AddRowAboveItem.js +3 -0
- package/dist/cjs/ui/TableMenu/row/items/AddRowBelowItem.js +3 -0
- package/dist/cjs/ui/TableMenu/row/items/DeleteRowItem.js +2 -0
- package/dist/cjs/ui/TableMenu/row/items/MoveRowDownItem.js +3 -0
- package/dist/cjs/ui/TableMenu/row/items/MoveRowUpItem.js +3 -0
- package/dist/cjs/ui/TableMenu/shared/TableMenu.js +2 -11
- package/dist/cjs/ui/TableMenu/shared/items/BackgroundColorItem.js +4 -3
- package/dist/cjs/ui/TableMenu/shared/items/ClearCellsItem.js +2 -1
- package/dist/cjs/ui/toolbar.js +3 -2
- package/dist/es2019/nodeviews/TableCell.js +9 -2
- package/dist/es2019/pm-plugins/commands/active-table-menu.js +19 -18
- package/dist/es2019/pm-plugins/commands/commands-with-analytics.js +10 -2
- package/dist/es2019/pm-plugins/commands/index.js +1 -1
- package/dist/es2019/pm-plugins/commands/misc.js +31 -0
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +22 -10
- package/dist/es2019/tablePlugin.js +6 -5
- package/dist/es2019/ui/FloatingContextualButton/index.js +36 -9
- package/dist/es2019/ui/FloatingContextualMenu/CellMenuPopup.js +2 -2
- package/dist/es2019/ui/TableMenu/cell/getCellMenuComponents.js +67 -1
- package/dist/es2019/ui/TableMenu/cell/items/MergeCellsItem.js +2 -1
- package/dist/es2019/ui/TableMenu/cell/items/SplitCellItem.js +2 -1
- package/dist/es2019/ui/TableMenu/cell/items/VerticalAlignDropdownItem.js +57 -0
- package/dist/es2019/ui/TableMenu/cell/items/VerticalAlignNestedMenu.js +48 -0
- package/dist/es2019/ui/TableMenu/cell/items/verticalAlignUtils.js +15 -0
- package/dist/es2019/ui/TableMenu/cell/keys.js +31 -2
- package/dist/es2019/ui/TableMenu/column/items/AddColumnLeftItem.js +3 -0
- package/dist/es2019/ui/TableMenu/column/items/AddColumnRightItem.js +3 -0
- package/dist/es2019/ui/TableMenu/column/items/DeleteColumnItem.js +3 -1
- package/dist/es2019/ui/TableMenu/column/items/DistributeColumnsItem.js +3 -0
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnLeftItem.js +3 -0
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnRightItem.js +3 -0
- package/dist/es2019/ui/TableMenu/column/items/SortDecreasingItem.js +3 -0
- package/dist/es2019/ui/TableMenu/column/items/SortIncreasingItem.js +3 -0
- package/dist/es2019/ui/TableMenu/row/items/AddRowAboveItem.js +3 -0
- package/dist/es2019/ui/TableMenu/row/items/AddRowBelowItem.js +3 -0
- package/dist/es2019/ui/TableMenu/row/items/DeleteRowItem.js +3 -1
- package/dist/es2019/ui/TableMenu/row/items/MoveRowDownItem.js +3 -0
- package/dist/es2019/ui/TableMenu/row/items/MoveRowUpItem.js +3 -0
- package/dist/es2019/ui/TableMenu/shared/TableMenu.js +2 -11
- package/dist/es2019/ui/TableMenu/shared/items/BackgroundColorItem.js +4 -3
- package/dist/es2019/ui/TableMenu/shared/items/ClearCellsItem.js +2 -1
- package/dist/esm/nodeviews/TableCell.js +9 -2
- package/dist/esm/nodeviews/TableRowNativeStickyWithFallback.js +4 -4
- package/dist/esm/pm-plugins/commands/active-table-menu.js +18 -21
- package/dist/esm/pm-plugins/commands/commands-with-analytics.js +17 -10
- package/dist/esm/pm-plugins/commands/index.js +1 -1
- package/dist/esm/pm-plugins/commands/misc.js +36 -4
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +23 -12
- package/dist/esm/tablePlugin.js +6 -5
- package/dist/esm/ui/FloatingContextualButton/index.js +32 -9
- package/dist/esm/ui/FloatingContextualMenu/CellMenuPopup.js +2 -2
- package/dist/esm/ui/TableMenu/cell/getCellMenuComponents.js +77 -1
- package/dist/esm/ui/TableMenu/cell/items/MergeCellsItem.js +2 -1
- package/dist/esm/ui/TableMenu/cell/items/SplitCellItem.js +2 -1
- package/dist/esm/ui/TableMenu/cell/items/VerticalAlignDropdownItem.js +54 -0
- package/dist/esm/ui/TableMenu/cell/items/VerticalAlignNestedMenu.js +47 -0
- package/dist/esm/ui/TableMenu/cell/items/verticalAlignUtils.js +14 -0
- package/dist/esm/ui/TableMenu/cell/keys.js +23 -1
- package/dist/esm/ui/TableMenu/column/items/AddColumnLeftItem.js +3 -0
- package/dist/esm/ui/TableMenu/column/items/AddColumnRightItem.js +3 -0
- package/dist/esm/ui/TableMenu/column/items/DeleteColumnItem.js +3 -1
- package/dist/esm/ui/TableMenu/column/items/DistributeColumnsItem.js +3 -0
- package/dist/esm/ui/TableMenu/column/items/MoveColumnLeftItem.js +3 -0
- package/dist/esm/ui/TableMenu/column/items/MoveColumnRightItem.js +3 -0
- package/dist/esm/ui/TableMenu/column/items/SortDecreasingItem.js +3 -0
- package/dist/esm/ui/TableMenu/column/items/SortIncreasingItem.js +3 -0
- package/dist/esm/ui/TableMenu/row/items/AddRowAboveItem.js +3 -0
- package/dist/esm/ui/TableMenu/row/items/AddRowBelowItem.js +3 -0
- package/dist/esm/ui/TableMenu/row/items/DeleteRowItem.js +3 -1
- package/dist/esm/ui/TableMenu/row/items/MoveRowDownItem.js +3 -0
- package/dist/esm/ui/TableMenu/row/items/MoveRowUpItem.js +3 -0
- package/dist/esm/ui/TableMenu/shared/TableMenu.js +2 -11
- package/dist/esm/ui/TableMenu/shared/items/BackgroundColorItem.js +4 -3
- package/dist/esm/ui/TableMenu/shared/items/ClearCellsItem.js +2 -1
- package/dist/esm/ui/toolbar.js +3 -2
- package/dist/types/pm-plugins/commands/active-table-menu.d.ts +3 -3
- package/dist/types/pm-plugins/commands/index.d.ts +1 -1
- package/dist/types/pm-plugins/commands/misc.d.ts +4 -0
- package/dist/types/ui/TableMenu/cell/items/VerticalAlignDropdownItem.d.ts +12 -0
- package/dist/types/ui/TableMenu/cell/items/VerticalAlignNestedMenu.d.ts +4 -0
- package/dist/types/ui/TableMenu/cell/items/verticalAlignUtils.d.ts +3 -0
- package/dist/types/ui/TableMenu/cell/keys.d.ts +8 -1
- package/dist/types-ts4.5/pm-plugins/commands/active-table-menu.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/commands/index.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/commands/misc.d.ts +4 -0
- package/dist/types-ts4.5/ui/TableMenu/cell/items/VerticalAlignDropdownItem.d.ts +12 -0
- package/dist/types-ts4.5/ui/TableMenu/cell/items/VerticalAlignNestedMenu.d.ts +4 -0
- package/dist/types-ts4.5/ui/TableMenu/cell/items/verticalAlignUtils.d.ts +3 -0
- package/dist/types-ts4.5/ui/TableMenu/cell/keys.d.ts +8 -1
- package/package.json +7 -6
- package/dist/cjs/ui/TableMenu/shared/TableMenu.compiled.css +0 -4
- package/dist/es2019/ui/TableMenu/shared/TableMenu.compiled.css +0 -4
- package/dist/esm/ui/TableMenu/shared/TableMenu.compiled.css +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 22.4.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 22.4.19
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`304fee6127fd5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/304fee6127fd5) -
|
|
14
|
+
Add valign to table cell menu, support renderer.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 22.4.18
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -46,6 +46,13 @@ function delayUntilIdle(cb) {
|
|
|
46
46
|
// Ignored via go/ees005
|
|
47
47
|
// eslint-disable-next-line require-unicode-regexp
|
|
48
48
|
var cssVariablePattern = /^VAR\(--.*\)$/;
|
|
49
|
+
var getCellDomAttrsForTableMenuUpdates = function getCellDomAttrsForTableMenuUpdates(node) {
|
|
50
|
+
var attrs = (0, _adfSchema.getCellDomAttrs)(node);
|
|
51
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_table_menu_updates', 'isEnabled', true) && node.attrs.valign) {
|
|
52
|
+
attrs['data-valign'] = node.attrs.valign;
|
|
53
|
+
}
|
|
54
|
+
return attrs;
|
|
55
|
+
};
|
|
49
56
|
var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
50
57
|
function TableCell(node, view, getPos, eventDispatcher, editorAnalyticsAPI) {
|
|
51
58
|
var _this;
|
|
@@ -179,8 +186,8 @@ var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
179
186
|
if (this.node.type !== node.type) {
|
|
180
187
|
return false;
|
|
181
188
|
}
|
|
182
|
-
var attrs = (
|
|
183
|
-
var nextAttrs = (
|
|
189
|
+
var attrs = getCellDomAttrsForTableMenuUpdates(this.node);
|
|
190
|
+
var nextAttrs = getCellDomAttrsForTableMenuUpdates(node);
|
|
184
191
|
var _getCellAttrs = (0, _adfSchema.getCellAttrs)(this.dom),
|
|
185
192
|
colspan = _getCellAttrs.colspan,
|
|
186
193
|
rowspan = _getCellAttrs.rowspan;
|
|
@@ -39,7 +39,7 @@ var HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200;
|
|
|
39
39
|
// timeout for resetting the scroll class - if it's too long then users won't be able to click on the header cells,
|
|
40
40
|
// if too short it would trigger too many dom updates.
|
|
41
41
|
var HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT = 400;
|
|
42
|
-
var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
42
|
+
var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
43
43
|
function TableRowNativeStickyWithFallback(node, view, getPos, eventDispatcher, api) {
|
|
44
44
|
var _api$limitedMode;
|
|
45
45
|
var _this;
|
|
@@ -137,8 +137,8 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
137
137
|
}
|
|
138
138
|
if (_this.isHeaderRow && _this.isStickyHeaderEnabled && (0, _platformFeatureFlags.fg)('platform_editor_table_sticky_header_patch_4')) {
|
|
139
139
|
var _api$table;
|
|
140
|
-
_this.onEditorContentAreaHeightChange = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.onChange(function (
|
|
141
|
-
var nextSharedState =
|
|
140
|
+
_this.onEditorContentAreaHeightChange = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.onChange(function (_ref) {
|
|
141
|
+
var nextSharedState = _ref.nextSharedState;
|
|
142
142
|
if (nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.editorContentAreaHeight && (nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.editorContentAreaHeight) !== _this.editorContentAreaHeight) {
|
|
143
143
|
var _this$stickyRowHeight;
|
|
144
144
|
_this.editorContentAreaHeight = nextSharedState.editorContentAreaHeight;
|
|
@@ -148,7 +148,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
148
148
|
}
|
|
149
149
|
return _this;
|
|
150
150
|
}
|
|
151
|
-
(0, _inherits2.default)(TableRowNativeStickyWithFallback,
|
|
151
|
+
(0, _inherits2.default)(TableRowNativeStickyWithFallback, _TableNodeView);
|
|
152
152
|
return (0, _createClass2.default)(TableRowNativeStickyWithFallback, [{
|
|
153
153
|
key: "subscribeWhenRowVisible",
|
|
154
154
|
value: function subscribeWhenRowVisible() {
|
|
@@ -4,25 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.toggleActiveTableMenu = exports.closeActiveTableMenu = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _pluginKey = require("../plugin-key");
|
|
8
8
|
var closeActiveTableMenu = exports.closeActiveTableMenu = function closeActiveTableMenu() {
|
|
9
|
-
return
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
if (!activeTableMenu || activeTableMenu.type === 'none') {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
9
|
+
return function (_ref) {
|
|
10
|
+
var tr = _ref.tr;
|
|
11
|
+
tr.setMeta(_pluginKey.pluginKey, {
|
|
16
12
|
type: 'SET_ACTIVE_TABLE_MENU',
|
|
17
13
|
data: {
|
|
18
14
|
activeTableMenu: {
|
|
19
15
|
type: 'none'
|
|
20
16
|
}
|
|
21
17
|
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
});
|
|
19
|
+
if (!tr.docChanged) {
|
|
20
|
+
tr.setMeta('addToHistory', false);
|
|
21
|
+
}
|
|
22
|
+
return tr;
|
|
23
|
+
};
|
|
26
24
|
};
|
|
27
25
|
var isSameActiveTableMenu = function isSameActiveTableMenu(current, next) {
|
|
28
26
|
if (!current || current.type !== next.type) {
|
|
@@ -33,19 +31,18 @@ var isSameActiveTableMenu = function isSameActiveTableMenu(current, next) {
|
|
|
33
31
|
}
|
|
34
32
|
return true;
|
|
35
33
|
};
|
|
36
|
-
var toggleActiveTableMenu = exports.toggleActiveTableMenu = function toggleActiveTableMenu(activeTableMenu) {
|
|
37
|
-
return
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
return {
|
|
34
|
+
var toggleActiveTableMenu = exports.toggleActiveTableMenu = function toggleActiveTableMenu(activeTableMenu, currentActiveTableMenu) {
|
|
35
|
+
return function (_ref2) {
|
|
36
|
+
var tr = _ref2.tr;
|
|
37
|
+
tr.setMeta(_pluginKey.pluginKey, {
|
|
41
38
|
type: 'SET_ACTIVE_TABLE_MENU',
|
|
42
39
|
data: {
|
|
43
40
|
activeTableMenu: isSameActiveTableMenu(currentActiveTableMenu, activeTableMenu) ? {
|
|
44
41
|
type: 'none'
|
|
45
42
|
} : activeTableMenu
|
|
46
43
|
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
return tr
|
|
50
|
-
}
|
|
44
|
+
});
|
|
45
|
+
tr.setMeta('addToHistory', false);
|
|
46
|
+
return tr;
|
|
47
|
+
};
|
|
51
48
|
};
|
|
@@ -53,11 +53,18 @@ var toggleActiveTableMenuWithAnalytics = exports.toggleActiveTableMenuWithAnalyt
|
|
|
53
53
|
};
|
|
54
54
|
})(editorAnalyticsAPI)(function (state, dispatch) {
|
|
55
55
|
if (dispatch) {
|
|
56
|
-
(0,
|
|
56
|
+
var _getPluginState2 = (0, _pluginFactory.getPluginState)(state),
|
|
57
|
+
currentActiveTableMenu = _getPluginState2.activeTableMenu;
|
|
58
|
+
var newTr = (0, _activeTableMenu.toggleActiveTableMenu)({
|
|
57
59
|
type: direction,
|
|
58
60
|
index: index,
|
|
59
61
|
openedBy: trigger
|
|
60
|
-
}
|
|
62
|
+
}, currentActiveTableMenu)({
|
|
63
|
+
tr: state.tr
|
|
64
|
+
});
|
|
65
|
+
if (newTr) {
|
|
66
|
+
dispatch(newTr);
|
|
67
|
+
}
|
|
61
68
|
}
|
|
62
69
|
return true;
|
|
63
70
|
});
|
|
@@ -227,8 +234,8 @@ var changeColumnWidthByStepWithAnalytics = exports.changeColumnWidthByStepWithAn
|
|
|
227
234
|
table = _getSelectedTableInfo2.table,
|
|
228
235
|
totalRowCount = _getSelectedTableInfo2.totalRowCount,
|
|
229
236
|
totalColumnCount = _getSelectedTableInfo2.totalColumnCount;
|
|
230
|
-
var
|
|
231
|
-
colIndex =
|
|
237
|
+
var _getPluginState3 = (0, _pluginFactory.getPluginState)(state),
|
|
238
|
+
colIndex = _getPluginState3.hoveredCell.colIndex;
|
|
232
239
|
return {
|
|
233
240
|
action: _analytics.TABLE_ACTION.COLUMN_RESIZED,
|
|
234
241
|
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
@@ -348,8 +355,8 @@ var deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut = exports.deleteSelected
|
|
|
348
355
|
}
|
|
349
356
|
var selectionType = (0, _misc.getTableSelectionType)(selection);
|
|
350
357
|
if (selectionType === 'row') {
|
|
351
|
-
var
|
|
352
|
-
pluginConfig =
|
|
358
|
+
var _getPluginState4 = (0, _pluginFactory.getPluginState)(state),
|
|
359
|
+
pluginConfig = _getPluginState4.pluginConfig;
|
|
353
360
|
var isHeaderRowRequired = pluginConfig.isHeaderRowRequired || false;
|
|
354
361
|
return deleteRowsWithAnalytics(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT, rect, isHeaderRowRequired)(state, dispatch);
|
|
355
362
|
} else if (selectionType === 'column') {
|
|
@@ -393,8 +400,8 @@ var toggleHeaderRowWithAnalytics = exports.toggleHeaderRowWithAnalytics = functi
|
|
|
393
400
|
var _getSelectedTableInfo7 = (0, _analytics2.getSelectedTableInfo)(state.selection),
|
|
394
401
|
totalRowCount = _getSelectedTableInfo7.totalRowCount,
|
|
395
402
|
totalColumnCount = _getSelectedTableInfo7.totalColumnCount;
|
|
396
|
-
var
|
|
397
|
-
isHeaderRowEnabled =
|
|
403
|
+
var _getPluginState5 = (0, _pluginFactory.getPluginState)(state),
|
|
404
|
+
isHeaderRowEnabled = _getPluginState5.isHeaderRowEnabled;
|
|
398
405
|
return {
|
|
399
406
|
action: _analytics.TABLE_ACTION.TOGGLED_HEADER_ROW,
|
|
400
407
|
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
@@ -413,8 +420,8 @@ var toggleHeaderColumnWithAnalytics = exports.toggleHeaderColumnWithAnalytics =
|
|
|
413
420
|
var _getSelectedTableInfo8 = (0, _analytics2.getSelectedTableInfo)(state.selection),
|
|
414
421
|
totalRowCount = _getSelectedTableInfo8.totalRowCount,
|
|
415
422
|
totalColumnCount = _getSelectedTableInfo8.totalColumnCount;
|
|
416
|
-
var
|
|
417
|
-
isHeaderColumnEnabled =
|
|
423
|
+
var _getPluginState6 = (0, _pluginFactory.getPluginState)(state),
|
|
424
|
+
isHeaderColumnEnabled = _getPluginState6.isHeaderColumnEnabled;
|
|
418
425
|
return {
|
|
419
426
|
action: _analytics.TABLE_ACTION.TOGGLED_HEADER_COLUMN,
|
|
420
427
|
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
@@ -183,6 +183,12 @@ Object.defineProperty(exports, "setMultipleCellAttrs", {
|
|
|
183
183
|
return _misc.setMultipleCellAttrs;
|
|
184
184
|
}
|
|
185
185
|
});
|
|
186
|
+
Object.defineProperty(exports, "setMultipleCellAttrsEditorCommand", {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function get() {
|
|
189
|
+
return _misc.setMultipleCellAttrsEditorCommand;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
186
192
|
Object.defineProperty(exports, "setTableDisplayMode", {
|
|
187
193
|
enumerable: true,
|
|
188
194
|
get: function get() {
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.updateWidthToWidest = exports.updateResizeHandleDecorations = exports.triggerUnlessTableHeader = exports.transformSliceToRemoveColumnsWidths = exports.transformSliceToFixDarkModeDefaultBackgroundColor = exports.transformSliceToAddTableHeaders = exports.transformSliceRemoveCellBackgroundColor = exports.showInsertRowButton = exports.showInsertColumnButton = exports.setTableRef = exports.setTableAlignmentWithTableContentWithPos = exports.setTableAlignment = exports.setMultipleCellAttrs = exports.setFocusToCellMenu = exports.setEditorFocus = exports.setCellAttr = exports.selectRows = exports.selectRow = exports.selectColumns = exports.selectColumn = exports.removeResizeHandleDecorations = exports.moveCursorBackward = exports.isInsideFirstCellOfRowOrColumn = exports.hideInsertColumnOrRowButton = exports.getTableSelectionType = exports.getTableElementMoveTypeBySlice = exports.deleteTableIfSelected = exports.deleteTable = exports.countCellsInSlice = exports.convertFirstRowToHeader = exports.autoSizeTable = exports.addResizeHandleDecorations = exports.addBoldInEmptyHeaderCells = void 0;
|
|
7
|
+
exports.updateWidthToWidest = exports.updateResizeHandleDecorations = exports.triggerUnlessTableHeader = exports.transformSliceToRemoveColumnsWidths = exports.transformSliceToFixDarkModeDefaultBackgroundColor = exports.transformSliceToAddTableHeaders = exports.transformSliceRemoveCellBackgroundColor = exports.showInsertRowButton = exports.showInsertColumnButton = exports.setTableRef = exports.setTableAlignmentWithTableContentWithPos = exports.setTableAlignment = exports.setMultipleCellAttrsEditorCommand = exports.setMultipleCellAttrs = exports.setFocusToCellMenu = exports.setEditorFocus = exports.setCellAttr = exports.selectRows = exports.selectRow = exports.selectColumns = exports.selectColumn = exports.removeResizeHandleDecorations = exports.moveCursorBackward = exports.isInsideFirstCellOfRowOrColumn = exports.hideInsertColumnOrRowButton = exports.getTableSelectionType = exports.getTableElementMoveTypeBySlice = exports.deleteTableIfSelected = exports.deleteTable = exports.countCellsInSlice = exports.convertFirstRowToHeader = exports.autoSizeTable = exports.addResizeHandleDecorations = exports.addBoldInEmptyHeaderCells = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
@@ -365,6 +365,38 @@ var setMultipleCellAttrs = exports.setMultipleCellAttrs = function setMultipleCe
|
|
|
365
365
|
return false;
|
|
366
366
|
};
|
|
367
367
|
};
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* EditorCommand variant of `setMultipleCellAttrs`.
|
|
371
|
+
*/
|
|
372
|
+
var setMultipleCellAttrsEditorCommand = exports.setMultipleCellAttrsEditorCommand = function setMultipleCellAttrsEditorCommand(attrs, targetCellPosition) {
|
|
373
|
+
return function (_ref2) {
|
|
374
|
+
var tr = _ref2.tr;
|
|
375
|
+
var cursorPos;
|
|
376
|
+
if ((0, _utils2.isSelectionType)(tr.selection, 'cell')) {
|
|
377
|
+
// Ignored via go/ees005
|
|
378
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
379
|
+
var selection = tr.selection;
|
|
380
|
+
selection.forEachCell(function (_cell, pos) {
|
|
381
|
+
var $pos = tr.doc.resolve(tr.mapping.map(pos + 1));
|
|
382
|
+
// Ignored via go/ees005
|
|
383
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
384
|
+
(0, _utils2.setCellAttrs)((0, _utils2.findCellClosestToPos)($pos), attrs)(tr);
|
|
385
|
+
});
|
|
386
|
+
cursorPos = selection.$headCell.pos;
|
|
387
|
+
} else if (typeof targetCellPosition === 'number') {
|
|
388
|
+
// Ignored via go/ees005
|
|
389
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
390
|
+
var cell = (0, _utils2.findCellClosestToPos)(tr.doc.resolve(targetCellPosition + 1));
|
|
391
|
+
(0, _utils2.setCellAttrs)(cell, attrs)(tr);
|
|
392
|
+
cursorPos = cell.pos;
|
|
393
|
+
}
|
|
394
|
+
if (tr.docChanged && cursorPos !== undefined) {
|
|
395
|
+
return tr;
|
|
396
|
+
}
|
|
397
|
+
return null;
|
|
398
|
+
};
|
|
399
|
+
};
|
|
368
400
|
var selectColumn = exports.selectColumn = function selectColumn(column, expand) {
|
|
369
401
|
var triggeredByKeyboard = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
370
402
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
@@ -616,8 +648,8 @@ var updateWidthToWidest = exports.updateWidthToWidest = function updateWidthToWi
|
|
|
616
648
|
});
|
|
617
649
|
};
|
|
618
650
|
var setTableAlignment = exports.setTableAlignment = function setTableAlignment(newAlignment, isCommentEditor) {
|
|
619
|
-
return function (
|
|
620
|
-
var tr =
|
|
651
|
+
return function (_ref3) {
|
|
652
|
+
var tr = _ref3.tr;
|
|
621
653
|
var tableObject = (0, _utils2.findTable)(tr.selection);
|
|
622
654
|
if (!tableObject) {
|
|
623
655
|
return null;
|
|
@@ -639,8 +671,8 @@ var setTableAlignment = exports.setTableAlignment = function setTableAlignment(n
|
|
|
639
671
|
};
|
|
640
672
|
};
|
|
641
673
|
var setTableAlignmentWithTableContentWithPos = exports.setTableAlignmentWithTableContentWithPos = function setTableAlignmentWithTableContentWithPos(newAlignment, tableNodeWithPos) {
|
|
642
|
-
return function (
|
|
643
|
-
var tr =
|
|
674
|
+
return function (_ref4) {
|
|
675
|
+
var tr = _ref4.tr;
|
|
644
676
|
var table = tableNodeWithPos.node;
|
|
645
677
|
var nextTableAttrs = _objectSpread(_objectSpread({}, table.attrs), {}, {
|
|
646
678
|
layout: newAlignment
|
|
@@ -88,19 +88,30 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
|
|
|
88
88
|
return localId === (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.localId);
|
|
89
89
|
},
|
|
90
90
|
onDragStart: function onDragStart() {
|
|
91
|
-
var _api$userIntent;
|
|
92
91
|
if ((0, _expValEquals.expValEquals)('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
93
92
|
var _insm$session3;
|
|
94
93
|
(_insm$session3 = _insm.insm.session) === null || _insm$session3 === void 0 || _insm$session3.startFeature('tableDragAndDrop');
|
|
95
94
|
}
|
|
96
|
-
(0, _commands.toggleDragMenu)(false)(editorView.state, editorView.dispatch);
|
|
97
95
|
if ((0, _expValEquals.expValEquals)('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
98
|
-
|
|
96
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref7) {
|
|
97
|
+
var _api$userIntent;
|
|
98
|
+
var tr = _ref7.tr;
|
|
99
|
+
(0, _activeTableMenu.closeActiveTableMenu)()({
|
|
100
|
+
tr: tr
|
|
101
|
+
});
|
|
102
|
+
api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('dragging')({
|
|
103
|
+
tr: tr
|
|
104
|
+
});
|
|
105
|
+
return tr;
|
|
106
|
+
});
|
|
107
|
+
} else {
|
|
108
|
+
var _api$userIntent2;
|
|
109
|
+
(0, _commands.toggleDragMenu)(false)(editorView.state, editorView.dispatch);
|
|
110
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent('dragging'));
|
|
99
111
|
}
|
|
100
|
-
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('dragging'));
|
|
101
112
|
},
|
|
102
113
|
onDrag: function onDrag(event) {
|
|
103
|
-
var _api$
|
|
114
|
+
var _api$userIntent3;
|
|
104
115
|
var data = (0, _monitor.getDraggableDataFromEvent)(event);
|
|
105
116
|
// If no data can be found then it's most like we do not want to perform any drag actions
|
|
106
117
|
if (!data) {
|
|
@@ -115,10 +126,10 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
|
|
|
115
126
|
var dropTargetType = sourceType === 'table-row' ? _consts.DropTargetType.ROW : _consts.DropTargetType.COLUMN;
|
|
116
127
|
var hasMergedCells = (0, _mergedCells.hasMergedCellsInBetween)([targetAdjustedIndex - 1, targetAdjustedIndex], dropTargetType)(editorView.state.selection);
|
|
117
128
|
(0, _commands.setDropTarget)(dropTargetType, targetAdjustedIndex, hasMergedCells)(editorView.state, editorView.dispatch);
|
|
118
|
-
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$
|
|
129
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 ? void 0 : _api$userIntent3.commands.setCurrentUserIntent('dragging'));
|
|
119
130
|
},
|
|
120
131
|
onDrop: function onDrop(event) {
|
|
121
|
-
var _cell$row, _cell$col, _api$
|
|
132
|
+
var _cell$row, _cell$col, _api$userIntent4;
|
|
122
133
|
var data = (0, _monitor.getDraggableDataFromEvent)(event);
|
|
123
134
|
|
|
124
135
|
// On Drop we need to update the table main plugin hoveredCell value with the current row/col that the mouse is
|
|
@@ -141,9 +152,9 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
|
|
|
141
152
|
}
|
|
142
153
|
};
|
|
143
154
|
tr.setMeta(_pluginKey.pluginKey, action);
|
|
144
|
-
if ((api === null || api === void 0 || (_api$
|
|
145
|
-
var _api$
|
|
146
|
-
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$
|
|
155
|
+
if ((api === null || api === void 0 || (_api$userIntent4 = api.userIntent) === null || _api$userIntent4 === void 0 || (_api$userIntent4 = _api$userIntent4.sharedState.currentState()) === null || _api$userIntent4 === void 0 ? void 0 : _api$userIntent4.currentUserIntent) === 'dragging') {
|
|
156
|
+
var _api$userIntent5;
|
|
157
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent5 = api.userIntent) === null || _api$userIntent5 === void 0 ? void 0 : _api$userIntent5.commands.setCurrentUserIntent('default'));
|
|
147
158
|
}
|
|
148
159
|
// If no data can be found then it's most like we do not want to perform any drop action
|
|
149
160
|
if (!data) {
|
|
@@ -304,7 +315,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
|
|
|
304
315
|
return decorationSet;
|
|
305
316
|
},
|
|
306
317
|
handleKeyDown: function handleKeyDown(view, event) {
|
|
307
|
-
var
|
|
318
|
+
var _ref8;
|
|
308
319
|
var tr = view.state.tr;
|
|
309
320
|
var keysToTrapWhen = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
|
|
310
321
|
|
|
@@ -328,7 +339,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
|
|
|
328
339
|
var isDragHandleFocused = ['drag-handle-button-row', 'drag-handle-button-column'
|
|
329
340
|
// Ignored via go/ees005
|
|
330
341
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
331
|
-
].includes((
|
|
342
|
+
].includes((_ref8 = event.target || null) === null || _ref8 === void 0 ? void 0 : _ref8.id);
|
|
332
343
|
var keysToTrap = ['Enter', ' '];
|
|
333
344
|
var _getPluginState3 = (0, _pluginFactory2.getPluginState)(view.state),
|
|
334
345
|
_getPluginState3$isDr = _getPluginState3.isDragMenuOpen,
|
package/dist/cjs/tablePlugin.js
CHANGED
|
@@ -22,6 +22,7 @@ var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
|
22
22
|
var _pmPlugins = require("@atlaskit/editor-tables/pm-plugins");
|
|
23
23
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
24
24
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
25
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
25
26
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
26
27
|
var _toDOM = require("./nodeviews/toDOM");
|
|
27
28
|
var _plugin = require("./pm-plugins/active-cell-highlight/plugin");
|
|
@@ -258,13 +259,13 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
258
259
|
})
|
|
259
260
|
}, {
|
|
260
261
|
name: 'tableHeader',
|
|
261
|
-
node: (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? _adfSchema.tableHeaderWithNestedTableWithLocalId : _adfSchema.tableHeaderWithNestedTable
|
|
262
|
+
node: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_table_menu_updates', 'isEnabled', true) ? _adfSchema.tableHeaderWithNestedTableStage0 : (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? _adfSchema.tableHeaderWithNestedTableWithLocalId : _adfSchema.tableHeaderWithNestedTable
|
|
262
263
|
}, {
|
|
263
264
|
name: 'tableRow',
|
|
264
265
|
node: (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? _adfSchema.tableRowWithNestedTableWithLocalId : _adfSchema.tableRowWithNestedTable
|
|
265
266
|
}, {
|
|
266
267
|
name: 'tableCell',
|
|
267
|
-
node: (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? _adfSchema.tableCellWithNestedTableWithLocalId : _adfSchema.tableCellWithNestedTable
|
|
268
|
+
node: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_table_menu_updates', 'isEnabled', true) ? _adfSchema.tableCellWithNestedTableStage0 : (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? _adfSchema.tableCellWithNestedTableWithLocalId : _adfSchema.tableCellWithNestedTable
|
|
268
269
|
}] : [{
|
|
269
270
|
name: 'table',
|
|
270
271
|
node: (0, _toDOM.tableNodeSpecWithFixedToDOM)({
|
|
@@ -279,13 +280,13 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
279
280
|
})
|
|
280
281
|
}, {
|
|
281
282
|
name: 'tableHeader',
|
|
282
|
-
node: (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? _adfSchema.tableHeaderWithLocalId : _adfSchema.tableHeader
|
|
283
|
+
node: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_table_menu_updates', 'isEnabled', true) ? _adfSchema.tableHeaderStage0 : (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? _adfSchema.tableHeaderWithLocalId : _adfSchema.tableHeader
|
|
283
284
|
}, {
|
|
284
285
|
name: 'tableRow',
|
|
285
286
|
node: (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? _adfSchema.tableRowWithLocalId : _adfSchema.tableRow
|
|
286
287
|
}, {
|
|
287
288
|
name: 'tableCell',
|
|
288
|
-
node: (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? _adfSchema.tableCellWithLocalId : _adfSchema.tableCell
|
|
289
|
+
node: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_table_menu_updates', 'isEnabled', true) ? _adfSchema.tableCellStage0 : (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? _adfSchema.tableCellWithLocalId : _adfSchema.tableCell
|
|
289
290
|
}];
|
|
290
291
|
},
|
|
291
292
|
pmPlugins: function pmPlugins() {
|
|
@@ -22,6 +22,7 @@ var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-d
|
|
|
22
22
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
23
23
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
24
24
|
var _commands = require("../../pm-plugins/commands");
|
|
25
|
+
var _pluginFactory = require("../../pm-plugins/plugin-factory");
|
|
25
26
|
var _stickyHeader = require("../../pm-plugins/utils/sticky-header");
|
|
26
27
|
var _types = require("../../types");
|
|
27
28
|
var _FixedButton = _interopRequireDefault(require("./FixedButton"));
|
|
@@ -67,10 +68,21 @@ var FloatingContextualButtonInner = /*#__PURE__*/_react.default.memo(function (p
|
|
|
67
68
|
var state = editorView.state,
|
|
68
69
|
dispatch = editorView.dispatch;
|
|
69
70
|
if ((0, _expValEquals.expValEquals)('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
70
|
-
(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
if (!api) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
75
|
+
currentActiveTableMenu = _getPluginState.activeTableMenu;
|
|
76
|
+
api.core.actions.execute(function (_ref) {
|
|
77
|
+
var tr = _ref.tr;
|
|
78
|
+
(0, _commands.toggleActiveTableMenu)({
|
|
79
|
+
type: 'cell',
|
|
80
|
+
openedBy: 'mouse'
|
|
81
|
+
}, currentActiveTableMenu)({
|
|
82
|
+
tr: tr
|
|
83
|
+
});
|
|
84
|
+
return tr;
|
|
85
|
+
});
|
|
74
86
|
return;
|
|
75
87
|
}
|
|
76
88
|
|
|
@@ -91,15 +103,26 @@ var FloatingContextualButtonInner = /*#__PURE__*/_react.default.memo(function (p
|
|
|
91
103
|
dispatch = editorView.dispatch;
|
|
92
104
|
// open the menu when the keyboard shortcut is pressed
|
|
93
105
|
if ((0, _expValEquals.expValEquals)('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
94
|
-
(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
106
|
+
if (!api) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
var _getPluginState2 = (0, _pluginFactory.getPluginState)(state),
|
|
110
|
+
currentActiveTableMenu = _getPluginState2.activeTableMenu;
|
|
111
|
+
api.core.actions.execute(function (_ref2) {
|
|
112
|
+
var tr = _ref2.tr;
|
|
113
|
+
(0, _commands.toggleActiveTableMenu)({
|
|
114
|
+
type: 'cell',
|
|
115
|
+
openedBy: 'keyboard'
|
|
116
|
+
}, currentActiveTableMenu)({
|
|
117
|
+
tr: tr
|
|
118
|
+
});
|
|
119
|
+
return tr;
|
|
120
|
+
});
|
|
98
121
|
return;
|
|
99
122
|
}
|
|
100
123
|
(0, _commands.toggleContextualMenu)()(state, dispatch);
|
|
101
124
|
}
|
|
102
|
-
}, [isCellMenuOpenByKeyboard, isCellMenuOpen, editorView]);
|
|
125
|
+
}, [isCellMenuOpenByKeyboard, isCellMenuOpen, editorView, api]);
|
|
103
126
|
if (!targetCellRef || !(targetCellRef instanceof HTMLElement)) {
|
|
104
127
|
return null;
|
|
105
128
|
}
|
|
@@ -37,11 +37,11 @@ var CellMenuPopup = exports.CellMenuPopup = function CellMenuPopup(_ref) {
|
|
|
37
37
|
var closeCellMenu = (0, _react.useCallback)(function () {
|
|
38
38
|
var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
39
39
|
isCellMenuOpenByKeyboard = _getPluginState.isCellMenuOpenByKeyboard;
|
|
40
|
-
(0, _commands.closeActiveTableMenu)()
|
|
40
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
41
41
|
if (isCellMenuOpenByKeyboard) {
|
|
42
42
|
(0, _commands.setFocusToCellMenu)(false)(editorView.state, editorView.dispatch);
|
|
43
43
|
}
|
|
44
|
-
}, [editorView]);
|
|
44
|
+
}, [api === null || api === void 0 ? void 0 : api.core.actions, editorView]);
|
|
45
45
|
var isEventInsideCellMenu = (0, _react.useCallback)(function (event) {
|
|
46
46
|
var _popupContentRef$curr;
|
|
47
47
|
var target = event.target;
|
|
@@ -6,9 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.getCellMenuComponents = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
9
10
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
11
|
+
var _alignPositionBottom = _interopRequireDefault(require("@atlaskit/icon-lab/core/align-position-bottom"));
|
|
12
|
+
var _alignPositionCenterVertical = _interopRequireDefault(require("@atlaskit/icon-lab/core/align-position-center-vertical"));
|
|
13
|
+
var _alignPositionTop = _interopRequireDefault(require("@atlaskit/icon-lab/core/align-position-top"));
|
|
10
14
|
var _MergeCellsItem = require("./items/MergeCellsItem");
|
|
11
15
|
var _SplitCellItem = require("./items/SplitCellItem");
|
|
16
|
+
var _VerticalAlignDropdownItem = require("./items/VerticalAlignDropdownItem");
|
|
17
|
+
var _VerticalAlignNestedMenu = require("./items/VerticalAlignNestedMenu");
|
|
12
18
|
var _keys = require("./keys");
|
|
13
19
|
var getCellMenuComponents = exports.getCellMenuComponents = function getCellMenuComponents(_ref) {
|
|
14
20
|
var api = _ref.api;
|
|
@@ -30,6 +36,76 @@ var getCellMenuComponents = exports.getCellMenuComponents = function getCellMenu
|
|
|
30
36
|
component: function component(props) {
|
|
31
37
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, null, props.children);
|
|
32
38
|
}
|
|
39
|
+
}, {
|
|
40
|
+
type: _keys.VERTICAL_ALIGN_MENU.type,
|
|
41
|
+
key: _keys.VERTICAL_ALIGN_MENU.key,
|
|
42
|
+
parents: [{
|
|
43
|
+
type: _keys.CELL_ACTION_SECTION.type,
|
|
44
|
+
key: _keys.CELL_ACTION_SECTION.key,
|
|
45
|
+
rank: _keys.CELL_ACTION_SECTION_RANK[_keys.VERTICAL_ALIGN_MENU.key]
|
|
46
|
+
}],
|
|
47
|
+
component: function component(props) {
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement(_VerticalAlignNestedMenu.VerticalAlignNestedMenu, null, props.children);
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
type: _keys.VERTICAL_ALIGN_MENU_SECTION.type,
|
|
52
|
+
key: _keys.VERTICAL_ALIGN_MENU_SECTION.key,
|
|
53
|
+
parents: [{
|
|
54
|
+
type: _keys.VERTICAL_ALIGN_MENU.type,
|
|
55
|
+
key: _keys.VERTICAL_ALIGN_MENU.key,
|
|
56
|
+
rank: _keys.VERTICAL_ALIGN_MENU_RANK[_keys.VERTICAL_ALIGN_MENU_SECTION.key]
|
|
57
|
+
}],
|
|
58
|
+
component: function component(props) {
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, null, props.children);
|
|
60
|
+
}
|
|
61
|
+
}, {
|
|
62
|
+
type: _keys.VERTICAL_ALIGN_TOP_ITEM.type,
|
|
63
|
+
key: _keys.VERTICAL_ALIGN_TOP_ITEM.key,
|
|
64
|
+
parents: [{
|
|
65
|
+
type: _keys.VERTICAL_ALIGN_MENU_SECTION.type,
|
|
66
|
+
key: _keys.VERTICAL_ALIGN_MENU_SECTION.key,
|
|
67
|
+
rank: _keys.VERTICAL_ALIGN_MENU_SECTION_RANK[_keys.VERTICAL_ALIGN_TOP_ITEM.key]
|
|
68
|
+
}],
|
|
69
|
+
component: function component() {
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement(_VerticalAlignDropdownItem.VerticalAlignDropdownItem, {
|
|
71
|
+
api: api,
|
|
72
|
+
icon: _alignPositionTop.default,
|
|
73
|
+
label: _messages.tableMessages.cellAlignmentTop,
|
|
74
|
+
value: "top"
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
type: _keys.VERTICAL_ALIGN_MIDDLE_ITEM.type,
|
|
79
|
+
key: _keys.VERTICAL_ALIGN_MIDDLE_ITEM.key,
|
|
80
|
+
parents: [{
|
|
81
|
+
type: _keys.VERTICAL_ALIGN_MENU_SECTION.type,
|
|
82
|
+
key: _keys.VERTICAL_ALIGN_MENU_SECTION.key,
|
|
83
|
+
rank: _keys.VERTICAL_ALIGN_MENU_SECTION_RANK[_keys.VERTICAL_ALIGN_MIDDLE_ITEM.key]
|
|
84
|
+
}],
|
|
85
|
+
component: function component() {
|
|
86
|
+
return /*#__PURE__*/_react.default.createElement(_VerticalAlignDropdownItem.VerticalAlignDropdownItem, {
|
|
87
|
+
api: api,
|
|
88
|
+
icon: _alignPositionCenterVertical.default,
|
|
89
|
+
label: _messages.tableMessages.cellAlignmentMiddle,
|
|
90
|
+
value: "middle"
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
type: _keys.VERTICAL_ALIGN_BOTTOM_ITEM.type,
|
|
95
|
+
key: _keys.VERTICAL_ALIGN_BOTTOM_ITEM.key,
|
|
96
|
+
parents: [{
|
|
97
|
+
type: _keys.VERTICAL_ALIGN_MENU_SECTION.type,
|
|
98
|
+
key: _keys.VERTICAL_ALIGN_MENU_SECTION.key,
|
|
99
|
+
rank: _keys.VERTICAL_ALIGN_MENU_SECTION_RANK[_keys.VERTICAL_ALIGN_BOTTOM_ITEM.key]
|
|
100
|
+
}],
|
|
101
|
+
component: function component() {
|
|
102
|
+
return /*#__PURE__*/_react.default.createElement(_VerticalAlignDropdownItem.VerticalAlignDropdownItem, {
|
|
103
|
+
api: api,
|
|
104
|
+
icon: _alignPositionBottom.default,
|
|
105
|
+
label: _messages.tableMessages.cellAlignmentBottom,
|
|
106
|
+
value: "bottom"
|
|
107
|
+
});
|
|
108
|
+
}
|
|
33
109
|
}, {
|
|
34
110
|
type: _keys.MERGE_CELLS_ITEM.type,
|
|
35
111
|
key: _keys.MERGE_CELLS_ITEM.key,
|
|
@@ -33,7 +33,8 @@ var MergeCellsItem = exports.MergeCellsItem = function MergeCellsItem(_ref) {
|
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
(0, _commandsWithAnalytics.mergeCellsWithAnalytics)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(_analytics.INPUT_METHOD.CONTEXT_MENU)(editorView.state, editorView.dispatch);
|
|
36
|
-
(0, _commands.closeActiveTableMenu)()
|
|
36
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
37
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
37
38
|
};
|
|
38
39
|
if (!shouldShowMergeCells(tableMenuContext)) {
|
|
39
40
|
return null;
|
|
@@ -33,7 +33,8 @@ var SplitCellItem = exports.SplitCellItem = function SplitCellItem(_ref) {
|
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
(0, _commandsWithAnalytics.splitCellWithAnalytics)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(_analytics.INPUT_METHOD.CONTEXT_MENU)(editorView.state, editorView.dispatch);
|
|
36
|
-
(0, _commands.closeActiveTableMenu)()
|
|
36
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
37
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
37
38
|
};
|
|
38
39
|
if (!shouldShowSplitCell(tableMenuContext)) {
|
|
39
40
|
return null;
|