@atlaskit/editor-plugin-table 22.2.14 → 22.2.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 +8 -0
- package/dist/cjs/nodeviews/TableComponent.js +3 -4
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +1 -1
- package/dist/cjs/nodeviews/TableContainer.js +1 -4
- package/dist/cjs/nodeviews/table.js +0 -2
- package/dist/cjs/pm-plugins/main.js +1 -2
- package/dist/cjs/ui/ContentComponent.js +14 -30
- package/dist/cjs/ui/FloatingInsertButton/index.js +5 -14
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +1 -2
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +16 -85
- package/dist/cjs/ui/TableFloatingControls/index.js +1 -1
- package/dist/cjs/ui/event-handlers.js +5 -10
- package/dist/cjs/ui/toolbar.js +27 -60
- package/dist/es2019/nodeviews/TableComponent.js +3 -4
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +1 -1
- package/dist/es2019/nodeviews/TableContainer.js +1 -5
- package/dist/es2019/nodeviews/table.js +0 -2
- package/dist/es2019/pm-plugins/main.js +1 -2
- package/dist/es2019/ui/ContentComponent.js +14 -30
- package/dist/es2019/ui/FloatingInsertButton/index.js +5 -12
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +1 -2
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +1 -69
- package/dist/es2019/ui/TableFloatingControls/index.js +1 -1
- package/dist/es2019/ui/event-handlers.js +5 -10
- package/dist/es2019/ui/toolbar.js +13 -40
- package/dist/esm/nodeviews/TableComponent.js +3 -4
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +1 -1
- package/dist/esm/nodeviews/TableContainer.js +1 -4
- package/dist/esm/nodeviews/table.js +0 -2
- package/dist/esm/pm-plugins/main.js +1 -2
- package/dist/esm/ui/ContentComponent.js +14 -30
- package/dist/esm/ui/FloatingInsertButton/index.js +5 -12
- package/dist/esm/ui/TableFloatingColumnControls/index.js +1 -2
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +16 -85
- package/dist/esm/ui/TableFloatingControls/index.js +1 -1
- package/dist/esm/ui/event-handlers.js +5 -10
- package/dist/esm/ui/toolbar.js +27 -60
- package/dist/types/nodeviews/table-node-views.d.ts +0 -1
- package/dist/types/nodeviews/types.d.ts +0 -1
- package/dist/types/ui/FloatingDragMenu/index.d.ts +4 -3
- package/dist/types/ui/FloatingInsertButton/index.d.ts +0 -1
- package/dist/types/ui/TableFloatingColumnControls/index.d.ts +1 -2
- package/dist/types/ui/TableFloatingControls/NumberColumn/index.d.ts +0 -3
- package/dist/types/ui/TableFloatingControls/index.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/table-node-views.d.ts +0 -1
- package/dist/types-ts4.5/nodeviews/types.d.ts +0 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +4 -3
- package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +1 -2
- package/dist/types-ts4.5/ui/TableFloatingControls/NumberColumn/index.d.ts +0 -3
- package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 22.2.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`d3badff484206`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d3badff484206) -
|
|
8
|
+
Remove isDragAndDropEnabled dead code from nodeviews and floating controls UI (EDITOR-6296)
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 22.2.14
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -495,9 +495,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
495
495
|
allowColumnResizing = _this$props7.allowColumnResizing,
|
|
496
496
|
allowTableResizing = _this$props7.allowTableResizing,
|
|
497
497
|
eventDispatcher = _this$props7.eventDispatcher,
|
|
498
|
-
isDragAndDropEnabled = _this$props7.isDragAndDropEnabled,
|
|
499
498
|
view = _this$props7.view,
|
|
500
|
-
isInDanger = _this$props7.isInDanger
|
|
499
|
+
isInDanger = _this$props7.isInDanger,
|
|
500
|
+
isDragAndDropEnabled = _this$props7.isDragAndDropEnabled;
|
|
501
501
|
var browser = (0, _browser.getBrowserInfo)();
|
|
502
502
|
var isIE11 = browser.ie_version === 11;
|
|
503
503
|
if (this.wrapper && !isIE11) {
|
|
@@ -889,8 +889,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
889
889
|
},
|
|
890
890
|
tableWrapperHeight: this.state.tableWrapperHeight,
|
|
891
891
|
api: pluginInjectionApi,
|
|
892
|
-
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor
|
|
893
|
-
isDragAndDropEnabled: isDragAndDropEnabled
|
|
892
|
+
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor
|
|
894
893
|
}) : null;
|
|
895
894
|
|
|
896
895
|
/**
|
|
@@ -100,9 +100,9 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
|
|
|
100
100
|
isMediaFullscreen: isFullscreen,
|
|
101
101
|
options: options,
|
|
102
102
|
allowControls: allowControls,
|
|
103
|
+
isDragAndDropEnabled: !isLivePageViewMode,
|
|
103
104
|
isHeaderRowEnabled: isHeaderRowEnabled !== null && isHeaderRowEnabled !== void 0 ? isHeaderRowEnabled : false,
|
|
104
105
|
isHeaderColumnEnabled: isHeaderColumnEnabled !== null && isHeaderColumnEnabled !== void 0 ? isHeaderColumnEnabled : false,
|
|
105
|
-
isDragAndDropEnabled: (options === null || options === void 0 ? void 0 : options.isDragAndDropEnabled) && !isLivePageViewMode,
|
|
106
106
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
107
107
|
allowTableAlignment: allowTableAlignment,
|
|
108
108
|
allowTableResizing: allowTableResizing,
|
|
@@ -18,7 +18,6 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
18
18
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
19
19
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
20
20
|
var _commandsWithAnalytics = require("../pm-plugins/commands/commands-with-analytics");
|
|
21
|
-
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
22
21
|
var _consts = require("../pm-plugins/table-resizing/utils/consts");
|
|
23
22
|
var _misc = require("../pm-plugins/table-resizing/utils/misc");
|
|
24
23
|
var _alignment = require("../pm-plugins/utils/alignment");
|
|
@@ -400,8 +399,6 @@ var TableContainer = exports.TableContainer = function TableContainer(_ref5) {
|
|
|
400
399
|
isChromelessEditor: isChromelessEditor
|
|
401
400
|
}, children);
|
|
402
401
|
}
|
|
403
|
-
var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
404
|
-
isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
|
|
405
402
|
var isFullPageAppearance = !isCommentEditor && !isChromelessEditor;
|
|
406
403
|
var resizableTableWidth = isFullPageAppearance ? (0, _misc.getTableResizerContainerForFullPageWidthInCSS)(node, isTableScalingEnabled) : "calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2))";
|
|
407
404
|
return /*#__PURE__*/_react.default.createElement(InnerContainer, {
|
|
@@ -409,7 +406,7 @@ var TableContainer = exports.TableContainer = function TableContainer(_ref5) {
|
|
|
409
406
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
410
407
|
,
|
|
411
408
|
className: (0, _classnames.default)(className, {
|
|
412
|
-
'less-padding': editorWidth < _editorSharedStyles.akEditorMobileBreakoutPoint && !isNested && !
|
|
409
|
+
'less-padding': editorWidth < _editorSharedStyles.akEditorMobileBreakoutPoint && !isNested && !isChromelessEditor
|
|
413
410
|
}),
|
|
414
411
|
style:
|
|
415
412
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
@@ -337,7 +337,6 @@ var createTableView = exports.createTableView = function createTableView(node, v
|
|
|
337
337
|
var _pluginInjectionApi$t;
|
|
338
338
|
var _getPluginState2 = (0, _pluginFactory.getPluginState)(view.state),
|
|
339
339
|
pluginConfig = _getPluginState2.pluginConfig,
|
|
340
|
-
isDragAndDropEnabled = _getPluginState2.isDragAndDropEnabled,
|
|
341
340
|
isTableScalingEnabled = _getPluginState2.isTableScalingEnabled;
|
|
342
341
|
|
|
343
342
|
// Use shared state for isFullWidthModeEnabled and wasFullWidthModeEnabled for most up-to-date values
|
|
@@ -362,7 +361,6 @@ var createTableView = exports.createTableView = function createTableView(node, v
|
|
|
362
361
|
options: {
|
|
363
362
|
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
|
|
364
363
|
wasFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.wasFullWidthModeEnabled,
|
|
365
|
-
isDragAndDropEnabled: isDragAndDropEnabled,
|
|
366
364
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
367
365
|
// same as options.isTableScalingEnabled
|
|
368
366
|
isCommentEditor: isCommentEditor,
|
|
@@ -81,8 +81,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
81
81
|
}),
|
|
82
82
|
tableRow: (0, _tableNodeViews.tableRowView)({
|
|
83
83
|
eventDispatcher: eventDispatcher,
|
|
84
|
-
pluginInjectionApi: pluginInjectionApi
|
|
85
|
-
isDragAndDropEnabled: true
|
|
84
|
+
pluginInjectionApi: pluginInjectionApi
|
|
86
85
|
}),
|
|
87
86
|
tableCell: (0, _tableNodeViews.tableCellView)({
|
|
88
87
|
eventDispatcher: eventDispatcher,
|
|
@@ -15,7 +15,6 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
15
15
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
16
|
var _FloatingContextualButton = _interopRequireDefault(require("./FloatingContextualButton"));
|
|
17
17
|
var _FloatingContextualMenu = _interopRequireDefault(require("./FloatingContextualMenu"));
|
|
18
|
-
var _FloatingDeleteButton = _interopRequireDefault(require("./FloatingDeleteButton"));
|
|
19
18
|
var _FloatingDragMenu = _interopRequireDefault(require("./FloatingDragMenu"));
|
|
20
19
|
var _FloatingInsertButton = _interopRequireDefault(require("./FloatingInsertButton"));
|
|
21
20
|
var _FloatingToolbarLabel = require("./FloatingToolbarLabel/FloatingToolbarLabel");
|
|
@@ -26,7 +25,7 @@ var _TableFullWidthLabel = require("./TableFullWidthLabel");
|
|
|
26
25
|
// eslint-disable-next-line import/no-named-as-default
|
|
27
26
|
|
|
28
27
|
var selector = function selector(states) {
|
|
29
|
-
var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$tableState10, _states$tableState11, _states$tableState12, _states$tableState13, _states$tableState14, _states$tableState15, _states$tableState16, _states$tableState17, _states$tableState18, _states$tableState19, _states$tableState20, _states$tableState21, _states$tableState22, _states$tableState23
|
|
28
|
+
var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$tableState10, _states$tableState11, _states$tableState12, _states$tableState13, _states$tableState14, _states$tableState15, _states$tableState16, _states$tableState17, _states$tableState18, _states$tableState19, _states$tableState20, _states$tableState21, _states$tableState22, _states$tableState23;
|
|
30
29
|
return {
|
|
31
30
|
resizingTableLocalId: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.resizingTableLocalId,
|
|
32
31
|
resizingTableRef: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.resizingTableRef,
|
|
@@ -42,19 +41,18 @@ var selector = function selector(states) {
|
|
|
42
41
|
insertRowButtonIndex: (_states$tableState10 = states.tableState) === null || _states$tableState10 === void 0 ? void 0 : _states$tableState10.insertRowButtonIndex,
|
|
43
42
|
isHeaderColumnEnabled: (_states$tableState11 = states.tableState) === null || _states$tableState11 === void 0 ? void 0 : _states$tableState11.isHeaderColumnEnabled,
|
|
44
43
|
isHeaderRowEnabled: (_states$tableState12 = states.tableState) === null || _states$tableState12 === void 0 ? void 0 : _states$tableState12.isHeaderRowEnabled,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
sizeSelectorTargetRef: (_states$tableState21 = states.tableState) === null || _states$tableState21 === void 0 ? void 0 : _states$tableState21.sizeSelectorTargetRef,
|
|
44
|
+
tableWrapperTarget: (_states$tableState13 = states.tableState) === null || _states$tableState13 === void 0 ? void 0 : _states$tableState13.tableWrapperTarget,
|
|
45
|
+
isCellMenuOpenByKeyboard: (_states$tableState14 = states.tableState) === null || _states$tableState14 === void 0 ? void 0 : _states$tableState14.isCellMenuOpenByKeyboard,
|
|
46
|
+
stickyHeader: (_states$tableState15 = states.tableState) === null || _states$tableState15 === void 0 ? void 0 : _states$tableState15.stickyHeader,
|
|
47
|
+
dragMenuDirection: (_states$tableState16 = states.tableState) === null || _states$tableState16 === void 0 ? void 0 : _states$tableState16.dragMenuDirection,
|
|
48
|
+
dragMenuIndex: (_states$tableState17 = states.tableState) === null || _states$tableState17 === void 0 ? void 0 : _states$tableState17.dragMenuIndex,
|
|
49
|
+
isDragMenuOpen: (_states$tableState18 = states.tableState) === null || _states$tableState18 === void 0 ? void 0 : _states$tableState18.isDragMenuOpen,
|
|
50
|
+
isSizeSelectorOpen: (_states$tableState19 = states.tableState) === null || _states$tableState19 === void 0 ? void 0 : _states$tableState19.isSizeSelectorOpen,
|
|
51
|
+
sizeSelectorTargetRef: (_states$tableState20 = states.tableState) === null || _states$tableState20 === void 0 ? void 0 : _states$tableState20.sizeSelectorTargetRef,
|
|
54
52
|
// IMPORTANT: hovered states are used by FloatingDragMenu component to render popup in the correct location
|
|
55
|
-
hoveredRows: (_states$
|
|
56
|
-
hoveredColumns: (_states$
|
|
57
|
-
hoveredCell: (_states$
|
|
53
|
+
hoveredRows: (_states$tableState21 = states.tableState) === null || _states$tableState21 === void 0 ? void 0 : _states$tableState21.hoveredRows,
|
|
54
|
+
hoveredColumns: (_states$tableState22 = states.tableState) === null || _states$tableState22 === void 0 ? void 0 : _states$tableState22.hoveredColumns,
|
|
55
|
+
hoveredCell: (_states$tableState23 = states.tableState) === null || _states$tableState23 === void 0 ? void 0 : _states$tableState23.hoveredCell
|
|
58
56
|
};
|
|
59
57
|
};
|
|
60
58
|
var ContentComponentInternal = function ContentComponentInternal(_ref) {
|
|
@@ -86,7 +84,6 @@ var ContentComponentInternal = function ContentComponentInternal(_ref) {
|
|
|
86
84
|
insertRowButtonIndex = _useSharedPluginState.insertRowButtonIndex,
|
|
87
85
|
isHeaderColumnEnabled = _useSharedPluginState.isHeaderColumnEnabled,
|
|
88
86
|
isHeaderRowEnabled = _useSharedPluginState.isHeaderRowEnabled,
|
|
89
|
-
isDragAndDropEnabled = _useSharedPluginState.isDragAndDropEnabled,
|
|
90
87
|
tableWrapperTarget = _useSharedPluginState.tableWrapperTarget,
|
|
91
88
|
isCellMenuOpenByKeyboard = _useSharedPluginState.isCellMenuOpenByKeyboard,
|
|
92
89
|
stickyHeader = _useSharedPluginState.stickyHeader,
|
|
@@ -111,8 +108,7 @@ var ContentComponentInternal = function ContentComponentInternal(_ref) {
|
|
|
111
108
|
isContextualMenuOpen: isContextualMenuOpen,
|
|
112
109
|
stickyHeader: stickyHeader,
|
|
113
110
|
tableWrapper: tableWrapperTarget,
|
|
114
|
-
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard
|
|
115
|
-
isDragAndDropEnabled: isDragAndDropEnabled
|
|
111
|
+
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard
|
|
116
112
|
}), allowControls && /*#__PURE__*/_react.default.createElement(_FloatingInsertButton.default, {
|
|
117
113
|
tableNode: tableNode,
|
|
118
114
|
tableRef: tableRef,
|
|
@@ -120,7 +116,6 @@ var ContentComponentInternal = function ContentComponentInternal(_ref) {
|
|
|
120
116
|
insertRowButtonIndex: insertRowButtonIndex,
|
|
121
117
|
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
122
118
|
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
123
|
-
isDragAndDropEnabled: isDragAndDropEnabled,
|
|
124
119
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
125
120
|
editorView: editorView,
|
|
126
121
|
mountPoint: popupsMountPoint,
|
|
@@ -148,7 +143,7 @@ var ContentComponentInternal = function ContentComponentInternal(_ref) {
|
|
|
148
143
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
149
144
|
api: api,
|
|
150
145
|
isDragMenuOpen: isDragMenuOpen
|
|
151
|
-
}),
|
|
146
|
+
}), /*#__PURE__*/_react.default.createElement(_FloatingDragMenu.default, {
|
|
152
147
|
editorView: editorView,
|
|
153
148
|
mountPoint: popupsMountPoint,
|
|
154
149
|
boundariesElement: popupsBoundariesElement,
|
|
@@ -168,17 +163,6 @@ var ContentComponentInternal = function ContentComponentInternal(_ref) {
|
|
|
168
163
|
api: api,
|
|
169
164
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
170
165
|
tableWrapper: tableWrapperTarget
|
|
171
|
-
}), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/_react.default.createElement(_FloatingDeleteButton.default, {
|
|
172
|
-
editorView: editorView,
|
|
173
|
-
selection: editorView.state.selection,
|
|
174
|
-
tableRef: tableRef,
|
|
175
|
-
mountPoint: popupsMountPoint,
|
|
176
|
-
boundariesElement: popupsBoundariesElement,
|
|
177
|
-
scrollableElement: popupsScrollableElement,
|
|
178
|
-
stickyHeaders: stickyHeader,
|
|
179
|
-
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
180
|
-
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
181
|
-
api: api
|
|
182
166
|
}), ((options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) || (options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing) && options.isCommentEditor) && isTableResizing && widthToWidest && resizingTableLocalId && resizingTableRef && widthToWidest[resizingTableLocalId] && /*#__PURE__*/_react.default.createElement(_FloatingToolbarLabel.FloatingToolbarLabel, {
|
|
183
167
|
target: resizingTableRef,
|
|
184
168
|
content: (0, _experiments.editorExperiment)('single_column_layouts', true) ? /*#__PURE__*/_react.default.createElement(_resizer.ResizerBreakoutModeLabel, {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -28,8 +27,7 @@ var _commandsWithAnalytics = require("../../pm-plugins/commands/commands-with-an
|
|
|
28
27
|
var _nodes = require("../../pm-plugins/utils/nodes");
|
|
29
28
|
var _types = require("../../types");
|
|
30
29
|
var _getPopupOptions = _interopRequireDefault(require("./getPopupOptions"));
|
|
31
|
-
var _InsertButton =
|
|
32
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
30
|
+
var _InsertButton = require("./InsertButton");
|
|
33
31
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
34
32
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
35
33
|
// Ignored via go/ees005
|
|
@@ -57,12 +55,10 @@ var FloatingInsertButton = exports.FloatingInsertButton = /*#__PURE__*/function
|
|
|
57
55
|
boundariesElement = _this$props.boundariesElement,
|
|
58
56
|
isHeaderColumnEnabled = _this$props.isHeaderColumnEnabled,
|
|
59
57
|
isHeaderRowEnabled = _this$props.isHeaderRowEnabled,
|
|
60
|
-
isDragAndDropEnabled = _this$props.isDragAndDropEnabled,
|
|
61
58
|
dispatchAnalyticsEvent = _this$props.dispatchAnalyticsEvent,
|
|
62
59
|
isChromelessEditor = _this$props.isChromelessEditor;
|
|
63
|
-
|
|
64
60
|
// TODO: ED-26961 - temporarily disable insert button for first column and row https://atlassian.slack.com/archives/C05U8HRQM50/p1698363744682219?thread_ts=1698209039.104909&cid=C05U8HRQM50
|
|
65
|
-
if (
|
|
61
|
+
if (insertColumnButtonIndex === 0 || insertRowButtonIndex === 0) {
|
|
66
62
|
return null;
|
|
67
63
|
}
|
|
68
64
|
var type = typeof insertColumnButtonIndex !== 'undefined' ? 'column' : typeof insertRowButtonIndex !== 'undefined' ? 'row' : null;
|
|
@@ -134,7 +130,7 @@ var FloatingInsertButton = exports.FloatingInsertButton = /*#__PURE__*/function
|
|
|
134
130
|
// Fixed the 'add column button' not visible issue when sticky header is enabled
|
|
135
131
|
// By setting the Popup z-index higher than the sticky header z-index ( common-styles.ts tr.sticky)
|
|
136
132
|
// Only when inserting a column, otherwise set to undefined
|
|
137
|
-
// Need to set z-index in the Popup, set z-index in the <
|
|
133
|
+
// Need to set z-index in the Popup, set z-index in the <DragAndDropInsertButton /> will not work
|
|
138
134
|
var zIndex = (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') || type === 'column' ? _editorSharedStyles.akEditorTableCellOnStickyHeaderZIndex : undefined;
|
|
139
135
|
return /*#__PURE__*/_react.default.createElement(_ui.Popup, (0, _extends2.default)({
|
|
140
136
|
target: targetCellRef,
|
|
@@ -148,19 +144,14 @@ var FloatingInsertButton = exports.FloatingInsertButton = /*#__PURE__*/function
|
|
|
148
144
|
allowOutOfBounds: true
|
|
149
145
|
// Ignored via go/ees005
|
|
150
146
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
151
|
-
}, (0, _getPopupOptions.default)(type, index, hasNumberedColumns,
|
|
147
|
+
}, (0, _getPopupOptions.default)(type, index, hasNumberedColumns, true, tableContainerWrapper), {
|
|
152
148
|
zIndex: zIndex
|
|
153
|
-
}),
|
|
149
|
+
}), /*#__PURE__*/_react.default.createElement(_InsertButton.DragAndDropInsertButton, {
|
|
154
150
|
type: type,
|
|
155
151
|
tableRef: tableRef,
|
|
156
152
|
onMouseDown: type === 'column' ? this.insertColumn : this.insertRow,
|
|
157
153
|
hasStickyHeaders: this.props.hasStickyHeaders || false,
|
|
158
154
|
isChromelessEditor: isChromelessEditor
|
|
159
|
-
}) : /*#__PURE__*/_react.default.createElement(_InsertButton.default, {
|
|
160
|
-
type: type,
|
|
161
|
-
tableRef: tableRef,
|
|
162
|
-
onMouseDown: type === 'column' ? this.insertColumn : this.insertRow,
|
|
163
|
-
hasStickyHeaders: this.props.hasStickyHeaders || false
|
|
164
155
|
}));
|
|
165
156
|
}
|
|
166
157
|
}, {
|
|
@@ -35,8 +35,7 @@ var TableFloatingColumnControls = function TableFloatingColumnControls(_ref) {
|
|
|
35
35
|
getScrollOffset = _ref.getScrollOffset,
|
|
36
36
|
tableWrapperHeight = _ref.tableWrapperHeight,
|
|
37
37
|
api = _ref.api,
|
|
38
|
-
isChromelessEditor = _ref.isChromelessEditor
|
|
39
|
-
isDragAndDropEnabled = _ref.isDragAndDropEnabled;
|
|
38
|
+
isChromelessEditor = _ref.isChromelessEditor;
|
|
40
39
|
var _useState = (0, _react.useState)(false),
|
|
41
40
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
42
41
|
isDragging = _useState2[0],
|
|
@@ -15,10 +15,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
15
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
16
|
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
17
17
|
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
18
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
19
18
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
20
19
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
21
|
-
var _commands = require("../../../pm-plugins/commands");
|
|
22
20
|
var _rowControls = require("../../../pm-plugins/utils/row-controls");
|
|
23
21
|
var _types = require("../../../types");
|
|
24
22
|
var _consts = require("../../consts");
|
|
@@ -35,46 +33,10 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
35
33
|
args[_key] = arguments[_key];
|
|
36
34
|
}
|
|
37
35
|
_this = _callSuper(this, NumberColumn, [].concat(args));
|
|
38
|
-
(0, _defineProperty2.default)(_this, "hoverRows", function (index) {
|
|
39
|
-
return _this.props.tableActive ? _this.props.hoverRows([index]) : null;
|
|
40
|
-
});
|
|
41
|
-
(0, _defineProperty2.default)(_this, "selectRow", function (index, event) {
|
|
42
|
-
var _this$props = _this.props,
|
|
43
|
-
tableActive = _this$props.tableActive,
|
|
44
|
-
editorView = _this$props.editorView,
|
|
45
|
-
selectRow = _this$props.selectRow;
|
|
46
|
-
// If selection is outside the table then first reset the selection inside table
|
|
47
|
-
if (!tableActive && event.target && event.target instanceof Node) {
|
|
48
|
-
var _editorView$state = editorView.state,
|
|
49
|
-
doc = _editorView$state.doc,
|
|
50
|
-
selection = _editorView$state.selection,
|
|
51
|
-
tr = _editorView$state.tr;
|
|
52
|
-
var pos = editorView.posAtDOM(event.target, 1);
|
|
53
|
-
var $pos = doc.resolve(pos);
|
|
54
|
-
var newPos = selection.head > pos ?
|
|
55
|
-
// Selection is after table
|
|
56
|
-
// nodeSize - 3 will move the position inside last table cell
|
|
57
|
-
_state.Selection.near(doc.resolve(pos + ($pos.parent.nodeSize - 3)), -1) :
|
|
58
|
-
// Selection is before table
|
|
59
|
-
_state.Selection.near($pos);
|
|
60
|
-
editorView.dispatch(tr.setSelection(newPos));
|
|
61
|
-
}
|
|
62
|
-
selectRow(index, event.shiftKey);
|
|
63
|
-
});
|
|
64
|
-
(0, _defineProperty2.default)(_this, "clearHoverSelection", function () {
|
|
65
|
-
var _this$props2 = _this.props,
|
|
66
|
-
tableActive = _this$props2.tableActive,
|
|
67
|
-
editorView = _this$props2.editorView;
|
|
68
|
-
if (tableActive) {
|
|
69
|
-
var state = editorView.state,
|
|
70
|
-
dispatch = editorView.dispatch;
|
|
71
|
-
(0, _commands.clearHoverSelection)()(state, dispatch);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
36
|
(0, _defineProperty2.default)(_this, "getCellStyles", function (index, rowHeight) {
|
|
75
|
-
var _this$
|
|
76
|
-
stickyTop = _this$
|
|
77
|
-
hasHeaderRow = _this$
|
|
37
|
+
var _this$props = _this.props,
|
|
38
|
+
stickyTop = _this$props.stickyTop,
|
|
39
|
+
hasHeaderRow = _this$props.hasHeaderRow;
|
|
78
40
|
if (stickyTop && hasHeaderRow && index === 0) {
|
|
79
41
|
var topOffset = 0;
|
|
80
42
|
return {
|
|
@@ -88,12 +50,12 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
88
50
|
});
|
|
89
51
|
(0, _defineProperty2.default)(_this, "getClassNames", function (index) {
|
|
90
52
|
var isButtonDisabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
91
|
-
var _this$
|
|
92
|
-
hoveredRows = _this$
|
|
93
|
-
editorView = _this$
|
|
94
|
-
isInDanger = _this$
|
|
95
|
-
isResizing = _this$
|
|
96
|
-
tableActive = _this$
|
|
53
|
+
var _this$props2 = _this.props,
|
|
54
|
+
hoveredRows = _this$props2.hoveredRows,
|
|
55
|
+
editorView = _this$props2.editorView,
|
|
56
|
+
isInDanger = _this$props2.isInDanger,
|
|
57
|
+
isResizing = _this$props2.isResizing,
|
|
58
|
+
tableActive = _this$props2.tableActive;
|
|
97
59
|
var isActive = (0, _utils.isRowSelected)(index)(editorView.state.selection) || (hoveredRows || []).indexOf(index) !== -1 && !isResizing;
|
|
98
60
|
return (0, _classnames2.default)(_types.TableCssClassName.NUMBERED_COLUMN_BUTTON, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON_DISABLED, isButtonDisabled), _types.TableCssClassName.HOVERED_CELL_IN_DANGER, tableActive && isActive && isInDanger), _types.TableCssClassName.HOVERED_CELL_ACTIVE, tableActive && isActive));
|
|
99
61
|
});
|
|
@@ -104,12 +66,12 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
104
66
|
key: "render",
|
|
105
67
|
value: function render() {
|
|
106
68
|
var _this2 = this;
|
|
107
|
-
var _this$
|
|
108
|
-
tableRef = _this$
|
|
109
|
-
hasHeaderRow = _this$
|
|
110
|
-
isDragAndDropEnabled = _this$
|
|
111
|
-
tableActive = _this$
|
|
112
|
-
updateCellHoverLocation = _this$
|
|
69
|
+
var _this$props3 = this.props,
|
|
70
|
+
tableRef = _this$props3.tableRef,
|
|
71
|
+
hasHeaderRow = _this$props3.hasHeaderRow,
|
|
72
|
+
isDragAndDropEnabled = _this$props3.isDragAndDropEnabled,
|
|
73
|
+
tableActive = _this$props3.tableActive,
|
|
74
|
+
updateCellHoverLocation = _this$props3.updateCellHoverLocation;
|
|
113
75
|
var rowHeights = (0, _rowControls.getRowHeights)(tableRef);
|
|
114
76
|
if ((0, _coreUtils.isSSR)()) {
|
|
115
77
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -141,7 +103,7 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
141
103
|
},
|
|
142
104
|
contentEditable: false
|
|
143
105
|
}, rowHeights.map(function (rowHeight, index) {
|
|
144
|
-
return
|
|
106
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
145
107
|
// Ignored via go/ees005
|
|
146
108
|
// eslint-disable-next-line react/no-array-index-key
|
|
147
109
|
key: "wrapper-".concat(index)
|
|
@@ -158,37 +120,6 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
158
120
|
onMouseOver: function onMouseOver() {
|
|
159
121
|
return updateCellHoverLocation(index);
|
|
160
122
|
}
|
|
161
|
-
}, hasHeaderRow ? index > 0 ? index : null : index + 1) : /*#__PURE__*/_react.default.createElement("div", {
|
|
162
|
-
// Ignored via go/ees005
|
|
163
|
-
role: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? 'button' : undefined
|
|
164
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
165
|
-
,
|
|
166
|
-
key: "wrapper-".concat(index)
|
|
167
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
168
|
-
,
|
|
169
|
-
className: _this2.getClassNames(index),
|
|
170
|
-
"data-index": index
|
|
171
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
172
|
-
,
|
|
173
|
-
style: _this2.getCellStyles(index, rowHeight),
|
|
174
|
-
onClick: function onClick(event) {
|
|
175
|
-
return _this2.selectRow(index, event);
|
|
176
|
-
},
|
|
177
|
-
onFocus: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? function () {
|
|
178
|
-
return _this2.hoverRows(index);
|
|
179
|
-
} : undefined,
|
|
180
|
-
onMouseOver: function onMouseOver() {
|
|
181
|
-
return _this2.hoverRows(index);
|
|
182
|
-
},
|
|
183
|
-
tabIndex: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? 0 : undefined,
|
|
184
|
-
onKeyDown: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? function (event) {
|
|
185
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
186
|
-
event.preventDefault();
|
|
187
|
-
_this2.selectRow(index, event);
|
|
188
|
-
}
|
|
189
|
-
} : undefined,
|
|
190
|
-
onMouseOut: _this2.clearHoverSelection,
|
|
191
|
-
onBlur: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? _this2.clearHoverSelection : undefined
|
|
192
123
|
}, hasHeaderRow ? index > 0 ? index : null : index + 1);
|
|
193
124
|
}));
|
|
194
125
|
}
|
|
@@ -43,11 +43,11 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
43
43
|
isNumberColumnEnabled = _ref.isNumberColumnEnabled,
|
|
44
44
|
isHeaderRowEnabled = _ref.isHeaderRowEnabled,
|
|
45
45
|
isHeaderColumnEnabled = _ref.isHeaderColumnEnabled,
|
|
46
|
+
isDragAndDropEnabled = _ref.isDragAndDropEnabled,
|
|
46
47
|
tableActive = _ref.tableActive,
|
|
47
48
|
hasHeaderRow = _ref.hasHeaderRow,
|
|
48
49
|
hoveredRows = _ref.hoveredRows,
|
|
49
50
|
stickyHeader = _ref.stickyHeader,
|
|
50
|
-
isDragAndDropEnabled = _ref.isDragAndDropEnabled,
|
|
51
51
|
hoveredCell = _ref.hoveredCell,
|
|
52
52
|
isTableHovered = _ref.isTableHovered,
|
|
53
53
|
tableWrapperWidth = _ref.tableWrapperWidth,
|
|
@@ -256,17 +256,12 @@ var handleMouseLeave = exports.handleMouseLeave = function handleMouseLeave(view
|
|
|
256
256
|
var _getPluginState5 = (0, _pluginFactory2.getPluginState)(state),
|
|
257
257
|
insertColumnButtonIndex = _getPluginState5.insertColumnButtonIndex,
|
|
258
258
|
insertRowButtonIndex = _getPluginState5.insertRowButtonIndex,
|
|
259
|
-
isDragAndDropEnabled = _getPluginState5.isDragAndDropEnabled,
|
|
260
259
|
isTableHovered = _getPluginState5.isTableHovered;
|
|
261
260
|
if (isTableHovered) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
!isDragMenuOpen && (0, _commands.setTableHovered)(false)(state, dispatch);
|
|
267
|
-
} else {
|
|
268
|
-
(0, _commands.setTableHovered)(false)(state, dispatch);
|
|
269
|
-
}
|
|
261
|
+
var _getDragDropPluginSta = (0, _pluginFactory.getPluginState)(state),
|
|
262
|
+
_getDragDropPluginSta2 = _getDragDropPluginSta.isDragMenuOpen,
|
|
263
|
+
isDragMenuOpen = _getDragDropPluginSta2 === void 0 ? false : _getDragDropPluginSta2;
|
|
264
|
+
!isDragMenuOpen && (0, _commands.setTableHovered)(false)(state, dispatch);
|
|
270
265
|
return true;
|
|
271
266
|
}
|
|
272
267
|
|
|
@@ -494,7 +489,7 @@ var trackCellLocation = function trackCellLocation(view, mouseEvent) {
|
|
|
494
489
|
};
|
|
495
490
|
var withCellTracking = exports.withCellTracking = function withCellTracking(eventHandler) {
|
|
496
491
|
return function (view, mouseEvent) {
|
|
497
|
-
if ((0,
|
|
492
|
+
if ((0, _pluginFactory.getPluginState)(view.state) && !(0, _pluginFactory.getPluginState)(view.state).isDragging) {
|
|
498
493
|
trackCellLocation(view, mouseEvent);
|
|
499
494
|
}
|
|
500
495
|
return eventHandler(view, mouseEvent);
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -112,32 +112,18 @@ var getToolbarMenuConfig = exports.getToolbarMenuConfig = function getToolbarMen
|
|
|
112
112
|
}
|
|
113
113
|
}];
|
|
114
114
|
var tableOptionsDropdownWidth = isTableScalingWithFixedColumnWidthsOptionShown ? 192 : undefined;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
};
|
|
128
|
-
} else {
|
|
129
|
-
return {
|
|
130
|
-
id: 'editor.table.tableOptions',
|
|
131
|
-
type: 'dropdown',
|
|
132
|
-
testId: 'table_options',
|
|
133
|
-
title: formatMessage(_messages.tableMessages.tableOptions),
|
|
134
|
-
hidden: options.every(function (option) {
|
|
135
|
-
return option.hidden;
|
|
136
|
-
}),
|
|
137
|
-
options: options,
|
|
138
|
-
dropdownWidth: tableOptionsDropdownWidth
|
|
139
|
-
};
|
|
140
|
-
}
|
|
115
|
+
return {
|
|
116
|
+
id: 'editor.table.tableOptions',
|
|
117
|
+
type: 'dropdown',
|
|
118
|
+
testId: 'table_options',
|
|
119
|
+
iconBefore: _customize.default,
|
|
120
|
+
title: formatMessage(_messages.tableMessages.tableOptions),
|
|
121
|
+
hidden: options.every(function (option) {
|
|
122
|
+
return option.hidden;
|
|
123
|
+
}),
|
|
124
|
+
options: options,
|
|
125
|
+
dropdownWidth: tableOptionsDropdownWidth
|
|
126
|
+
};
|
|
141
127
|
};
|
|
142
128
|
|
|
143
129
|
// Added these options for mobile. Mobile bridge translates this menu and
|
|
@@ -471,8 +457,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
471
457
|
var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
472
458
|
var alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, areAnyNewToolbarFlagsEnabled, options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
473
459
|
var isLimitedModeEnabled = (_api$limitedMode$shar = api === null || api === void 0 || (_api$limitedMode = api.limitedMode) === null || _api$limitedMode === void 0 || (_api$limitedMode = _api$limitedMode.sharedState.currentState()) === null || _api$limitedMode === void 0 ? void 0 : _api$limitedMode.enabled) !== null && _api$limitedMode$shar !== void 0 ? _api$limitedMode$shar : false;
|
|
474
|
-
var
|
|
475
|
-
var columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor, isLimitedModeEnabled) : [];
|
|
460
|
+
var columnSettingsItems = getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor, isLimitedModeEnabled);
|
|
476
461
|
var colorPicker = !areAnyNewToolbarFlagsEnabled ? getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView) : [];
|
|
477
462
|
var fitToContentButton = (0, _tableMode.isContentModeSupported)({
|
|
478
463
|
allowColumnResizing: !!pluginState.pluginConfig.allowColumnResizing,
|
|
@@ -573,7 +558,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
573
558
|
},
|
|
574
559
|
zIndex: _editorSharedStyles.akEditorFloatingPanelZIndex + 1,
|
|
575
560
|
// Place the context menu slightly above the others
|
|
576
|
-
items: [menu].concat((0, _toConsumableArray2.default)(!areAnyNewToolbarFlagsEnabled ? [separator(menu.hidden)] : []), (0, _toConsumableArray2.default)(alignmentMenu), (0, _toConsumableArray2.default)(!areAnyNewToolbarFlagsEnabled ? [separator(alignmentMenu.length === 0)] : []),
|
|
561
|
+
items: [menu].concat((0, _toConsumableArray2.default)(!areAnyNewToolbarFlagsEnabled ? [separator(menu.hidden)] : []), (0, _toConsumableArray2.default)(alignmentMenu), (0, _toConsumableArray2.default)(!areAnyNewToolbarFlagsEnabled ? [separator(alignmentMenu.length === 0)] : []), columnSettingsItems, fitToContentButton, (0, _toConsumableArray2.default)(colorPicker), (0, _toConsumableArray2.default)(!areAnyNewToolbarFlagsEnabled ? [{
|
|
577
562
|
type: 'extensions-placeholder',
|
|
578
563
|
separator: 'end'
|
|
579
564
|
}, copyButton, {
|
|
@@ -649,24 +634,6 @@ var separator = function separator(hidden) {
|
|
|
649
634
|
hidden: hidden
|
|
650
635
|
};
|
|
651
636
|
};
|
|
652
|
-
var getCellItems = function getCellItems(state, view, _ref3, getEditorContainerWidth, api, editorAnalyticsAPI) {
|
|
653
|
-
var formatMessage = _ref3.formatMessage;
|
|
654
|
-
var isTableScalingEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
655
|
-
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
656
|
-
var shouldUseIncreasedScalingPercent = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
657
|
-
var isCommentEditor = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
658
|
-
var isLimitedModeEnabled = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
|
|
659
|
-
var initialSelectionRect = getClosestSelectionRect(state);
|
|
660
|
-
if (initialSelectionRect) {
|
|
661
|
-
var cellOptions = getToolbarCellOptionsConfig(state, view, initialSelectionRect, {
|
|
662
|
-
formatMessage: formatMessage
|
|
663
|
-
}, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isLimitedModeEnabled);
|
|
664
|
-
// Ignored via go/ees005
|
|
665
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
666
|
-
return [cellOptions, separator(cellOptions.hidden)];
|
|
667
|
-
}
|
|
668
|
-
return [];
|
|
669
|
-
};
|
|
670
637
|
var getDistributeConfig = function getDistributeConfig(getEditorContainerWidth, api, editorAnalyticsAPI) {
|
|
671
638
|
var isTableScalingEnabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
672
639
|
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
@@ -687,9 +654,9 @@ var getDistributeConfig = function getDistributeConfig(getEditorContainerWidth,
|
|
|
687
654
|
|
|
688
655
|
// this create the button group for distribute column and also fixed column width
|
|
689
656
|
// fixed column button should be in this function call in the future
|
|
690
|
-
var getColumnSettingItems = function getColumnSettingItems(editorState, editorView,
|
|
657
|
+
var getColumnSettingItems = function getColumnSettingItems(editorState, editorView, _ref3, getEditorContainerWidth, api, editorAnalyticsAPI) {
|
|
691
658
|
var _pluginState$pluginCo3;
|
|
692
|
-
var formatMessage =
|
|
659
|
+
var formatMessage = _ref3.formatMessage;
|
|
693
660
|
var isTableScalingEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
694
661
|
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
695
662
|
var isCommentEditor = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
@@ -715,7 +682,7 @@ var getColumnSettingItems = function getColumnSettingItems(editorState, editorVi
|
|
|
715
682
|
wouldChange = (_newResizeStateWithAn3 = (_newResizeStateWithAn4 = newResizeStateWithAnalytics) === null || _newResizeStateWithAn4 === void 0 ? void 0 : _newResizeStateWithAn4.changed) !== null && _newResizeStateWithAn3 !== void 0 ? _newResizeStateWithAn3 : false;
|
|
716
683
|
}
|
|
717
684
|
}
|
|
718
|
-
if (pluginState !== null && pluginState !== void 0 && (_pluginState$pluginCo3 = pluginState.pluginConfig) !== null && _pluginState$pluginCo3 !== void 0 && _pluginState$pluginCo3.allowDistributeColumns
|
|
685
|
+
if (pluginState !== null && pluginState !== void 0 && (_pluginState$pluginCo3 = pluginState.pluginConfig) !== null && _pluginState$pluginCo3 !== void 0 && _pluginState$pluginCo3.allowDistributeColumns) {
|
|
719
686
|
items.push({
|
|
720
687
|
id: 'editor.table.distributeColumns',
|
|
721
688
|
type: 'button',
|
|
@@ -739,9 +706,9 @@ var getColumnSettingItems = function getColumnSettingItems(editorState, editorVi
|
|
|
739
706
|
}
|
|
740
707
|
return items;
|
|
741
708
|
};
|
|
742
|
-
var getColorPicker = function getColorPicker(state, menu,
|
|
709
|
+
var getColorPicker = function getColorPicker(state, menu, _ref4, editorAnalyticsAPI, getEditorView) {
|
|
743
710
|
var _node$attrs;
|
|
744
|
-
var formatMessage =
|
|
711
|
+
var formatMessage = _ref4.formatMessage;
|
|
745
712
|
var _getPluginState2 = (0, _pluginFactory2.getPluginState)(state),
|
|
746
713
|
targetCellPosition = _getPluginState2.targetCellPosition,
|
|
747
714
|
pluginConfig = _getPluginState2.pluginConfig;
|
|
@@ -803,8 +770,8 @@ var highlightColumnsHandler = function highlightColumnsHandler(state, dispatch)
|
|
|
803
770
|
}
|
|
804
771
|
return false;
|
|
805
772
|
};
|
|
806
|
-
var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState,
|
|
807
|
-
var formatMessage =
|
|
773
|
+
var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref5, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, areAnyNewToolbarFlagsEnabled, isFullWidthEditor, isCommentEditor) {
|
|
774
|
+
var formatMessage = _ref5.formatMessage;
|
|
808
775
|
var tableObject = (0, _utils3.findTable)(editorState.selection);
|
|
809
776
|
if (!tableObject) {
|
|
810
777
|
return [];
|
|
@@ -902,13 +869,13 @@ var isLayoutOptionDisabledImpl = function isLayoutOptionDisabledImpl(selectedNod
|
|
|
902
869
|
}
|
|
903
870
|
return false;
|
|
904
871
|
};
|
|
905
|
-
var getMemoizedIsLayoutOptionDisabled = (0, _memoizeOne.default)(isLayoutOptionDisabledImpl, function (
|
|
872
|
+
var getMemoizedIsLayoutOptionDisabled = (0, _memoizeOne.default)(isLayoutOptionDisabledImpl, function (_ref6, _ref7) {
|
|
873
|
+
var _ref8 = (0, _toArray2.default)(_ref6),
|
|
874
|
+
prevNode = _ref8[0],
|
|
875
|
+
prevRest = _ref8.slice(1);
|
|
906
876
|
var _ref9 = (0, _toArray2.default)(_ref7),
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
var _ref0 = (0, _toArray2.default)(_ref8),
|
|
910
|
-
nextNode = _ref0[0],
|
|
911
|
-
nextRest = _ref0.slice(1);
|
|
877
|
+
nextNode = _ref9[0],
|
|
878
|
+
nextRest = _ref9.slice(1);
|
|
912
879
|
// Only node needs special comparison (attrs only), rest use reference equality
|
|
913
880
|
var nodeEqual = (0, _isEqual.default)(prevNode.attrs, nextNode.attrs);
|
|
914
881
|
var restEqual = prevRest.every(function (val, idx) {
|