@atlaskit/editor-plugin-table 7.23.0 → 7.24.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 +33 -0
- package/dist/cjs/nodeviews/TableComponent.js +6 -3
- package/dist/cjs/nodeviews/TableContainer.js +4 -2
- package/dist/cjs/nodeviews/lazy-node-views.js +4 -3
- package/dist/cjs/nodeviews/table.js +3 -2
- package/dist/cjs/plugin.js +5 -3
- package/dist/cjs/pm-plugins/main.js +4 -7
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +34 -19
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-logic.js +3 -0
- package/dist/cjs/toolbar.js +15 -12
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +14 -8
- package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +6 -5
- package/dist/cjs/ui/FloatingInsertButton/index.js +5 -3
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +4 -3
- package/dist/cjs/ui/TableFloatingControls/index.js +3 -2
- package/dist/cjs/ui/common-styles.js +1 -1
- package/dist/cjs/ui/ui-styles.js +1 -1
- package/dist/es2019/nodeviews/TableComponent.js +6 -3
- package/dist/es2019/nodeviews/TableContainer.js +4 -2
- package/dist/es2019/nodeviews/lazy-node-views.js +4 -3
- package/dist/es2019/nodeviews/table.js +3 -2
- package/dist/es2019/plugin.js +5 -3
- package/dist/es2019/pm-plugins/main.js +4 -7
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +41 -25
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-logic.js +1 -0
- package/dist/es2019/toolbar.js +15 -12
- package/dist/es2019/types.js +2 -0
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +14 -8
- package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +8 -6
- package/dist/es2019/ui/FloatingInsertButton/index.js +6 -4
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +5 -4
- package/dist/es2019/ui/TableFloatingControls/index.js +3 -2
- package/dist/es2019/ui/common-styles.js +8 -0
- package/dist/es2019/ui/ui-styles.js +4 -0
- package/dist/esm/nodeviews/TableComponent.js +6 -3
- package/dist/esm/nodeviews/TableContainer.js +4 -2
- package/dist/esm/nodeviews/lazy-node-views.js +4 -3
- package/dist/esm/nodeviews/table.js +3 -2
- package/dist/esm/plugin.js +5 -3
- package/dist/esm/pm-plugins/main.js +4 -7
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +35 -21
- package/dist/esm/pm-plugins/table-resizing/utils/resize-logic.js +3 -0
- package/dist/esm/toolbar.js +15 -12
- package/dist/esm/types.js +2 -0
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +14 -8
- package/dist/esm/ui/FloatingInsertButton/InsertButton.js +6 -5
- package/dist/esm/ui/FloatingInsertButton/index.js +6 -4
- package/dist/esm/ui/TableFloatingColumnControls/index.js +5 -4
- package/dist/esm/ui/TableFloatingControls/index.js +3 -2
- package/dist/esm/ui/common-styles.js +1 -1
- package/dist/esm/ui/ui-styles.js +1 -1
- package/dist/types/nodeviews/TableContainer.d.ts +2 -1
- package/dist/types/nodeviews/lazy-node-views.d.ts +1 -0
- package/dist/types/nodeviews/table.d.ts +1 -1
- package/dist/types/nodeviews/types.d.ts +1 -0
- package/dist/types/plugin.d.ts +1 -0
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/types.d.ts +2 -0
- package/dist/types/ui/FloatingInsertButton/InsertButton.d.ts +2 -1
- package/dist/types/ui/FloatingInsertButton/index.d.ts +1 -0
- package/dist/types/ui/TableFloatingColumnControls/index.d.ts +2 -1
- package/dist/types/ui/TableFloatingControls/index.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/lazy-node-views.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/types.d.ts +1 -0
- package/dist/types-ts4.5/plugin.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +2 -0
- package/dist/types-ts4.5/ui/FloatingInsertButton/InsertButton.d.ts +2 -1
- package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +2 -1
- package/package.json +6 -6
- package/src/nodeviews/TableComponent.tsx +3 -0
- package/src/nodeviews/TableContainer.tsx +3 -0
- package/src/nodeviews/lazy-node-views.ts +4 -0
- package/src/nodeviews/table.tsx +2 -0
- package/src/nodeviews/types.ts +1 -0
- package/src/plugin.tsx +4 -0
- package/src/pm-plugins/main.ts +3 -4
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +59 -31
- package/src/pm-plugins/table-resizing/utils/resize-logic.ts +1 -0
- package/src/toolbar.tsx +19 -14
- package/src/types.ts +2 -0
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +20 -7
- package/src/ui/FloatingInsertButton/InsertButton.tsx +12 -4
- package/src/ui/FloatingInsertButton/index.tsx +5 -2
- package/src/ui/TableFloatingColumnControls/index.tsx +8 -3
- package/src/ui/TableFloatingControls/index.tsx +5 -1
- package/src/ui/common-styles.ts +8 -0
- package/src/ui/ui-styles.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.24.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#124890](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/124890)
|
|
8
|
+
[`04951dd1969d5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/04951dd1969d5) -
|
|
9
|
+
[ux] ED-24278: Turned on table dnd in chromeless editor
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 7.24.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#124519](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/124519)
|
|
17
|
+
[`fbd519a29db88`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fbd519a29db88) -
|
|
18
|
+
Don't add merge cell and split cell options to floating toolbar if allowMergedCell is disabled or
|
|
19
|
+
undefined
|
|
20
|
+
- [#124475](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/124475)
|
|
21
|
+
[`f1beea7ed5546`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f1beea7ed5546) -
|
|
22
|
+
[ux] [ED-24078] This change is adding aria-labels to the Table Cell Options menu so that the
|
|
23
|
+
screenreader will announce the keyboard shortcuts to keyboard-only users. The change is feature
|
|
24
|
+
flagged behind 'platform_editor_announce_cell_options_hotkeys'.
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- [#124231](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/124231)
|
|
29
|
+
[`48ae65e0f36e8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/48ae65e0f36e8) -
|
|
30
|
+
Removed FF platform.editor.transform-slice-for-nested-expand
|
|
31
|
+
- [#124519](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/124519)
|
|
32
|
+
[`0d1225bff51ff`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0d1225bff51ff) -
|
|
33
|
+
Use scaled amounts for new column resizing, and update logic to cater for more scenarios
|
|
34
|
+
- Updated dependencies
|
|
35
|
+
|
|
3
36
|
## 7.23.0
|
|
4
37
|
|
|
5
38
|
### Minor Changes
|
|
@@ -736,7 +736,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
736
736
|
headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
|
|
737
737
|
stickyHeader: this.state.stickyHeader,
|
|
738
738
|
tableWrapperWidth: this.state.tableWrapperWidth,
|
|
739
|
-
api: pluginInjectionApi
|
|
739
|
+
api: pluginInjectionApi,
|
|
740
|
+
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor
|
|
740
741
|
});
|
|
741
742
|
var tableContainerWidth = (0, _nodeWidth.getTableContainerWidth)(node);
|
|
742
743
|
var colControls = isDragAndDropEnabled ? /*#__PURE__*/_react.default.createElement(_TableFloatingColumnControls.default, {
|
|
@@ -764,7 +765,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
764
765
|
return ((_this4$wrapper = _this4.wrapper) === null || _this4$wrapper === void 0 ? void 0 : _this4$wrapper.scrollLeft) || 0;
|
|
765
766
|
},
|
|
766
767
|
tableWrapperHeight: this.state.tableWrapperHeight,
|
|
767
|
-
api: pluginInjectionApi
|
|
768
|
+
api: pluginInjectionApi,
|
|
769
|
+
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor
|
|
768
770
|
}) : null;
|
|
769
771
|
var shadowPadding = allowControls && tableActive ? -_editorSharedStyles.akEditorTableToolbarSize : _styles.tableMarginSides;
|
|
770
772
|
var shadowStyle = (0, _memoizeOne.default)(function (visible) {
|
|
@@ -810,7 +812,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
810
812
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
811
813
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
812
814
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
813
|
-
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor
|
|
815
|
+
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
816
|
+
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor
|
|
814
817
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
815
818
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
816
819
|
className: _types.TableCssClassName.TABLE_STICKY_SENTINEL_TOP,
|
|
@@ -297,7 +297,8 @@ var TableContainer = exports.TableContainer = function TableContainer(_ref6) {
|
|
|
297
297
|
isTableWithFixedColumnWidthsOptionEnabled = _ref6.isTableWithFixedColumnWidthsOptionEnabled,
|
|
298
298
|
isTableAlignmentEnabled = _ref6.isTableAlignmentEnabled,
|
|
299
299
|
shouldUseIncreasedScalingPercent = _ref6.shouldUseIncreasedScalingPercent,
|
|
300
|
-
isCommentEditor = _ref6.isCommentEditor
|
|
300
|
+
isCommentEditor = _ref6.isCommentEditor,
|
|
301
|
+
isChromelessEditor = _ref6.isChromelessEditor;
|
|
301
302
|
if (isTableResizingEnabled && !isNested) {
|
|
302
303
|
return /*#__PURE__*/_react.default.createElement(ResizableTableContainer
|
|
303
304
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -329,7 +330,8 @@ var TableContainer = exports.TableContainer = function TableContainer(_ref6) {
|
|
|
329
330
|
}),
|
|
330
331
|
style: {
|
|
331
332
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
332
|
-
width: 'inherit'
|
|
333
|
+
width: 'inherit',
|
|
334
|
+
marginLeft: isChromelessEditor ? 18 : undefined
|
|
333
335
|
}
|
|
334
336
|
}, children);
|
|
335
337
|
};
|
|
@@ -16,7 +16,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
16
16
|
var lazyTableView = exports.lazyTableView = function lazyTableView(options) {
|
|
17
17
|
if (!(0, _platformFeatureFlags.fg)('platform_editor_lazy-node-views')) {
|
|
18
18
|
return function (node, view, getPos) {
|
|
19
|
-
return (0, _table.createTableView)(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isTableAlignmentEnabled, options.isCommentEditor);
|
|
19
|
+
return (0, _table.createTableView)(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isTableAlignmentEnabled, options.isCommentEditor, options.isChromelessEditor);
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
var loader = function loader() {
|
|
@@ -34,8 +34,9 @@ var lazyTableView = exports.lazyTableView = function lazyTableView(options) {
|
|
|
34
34
|
dispatchAnalyticsEvent = _getNodeViewOptions.dispatchAnalyticsEvent,
|
|
35
35
|
pluginInjectionApi = _getNodeViewOptions.pluginInjectionApi,
|
|
36
36
|
isTableAlignmentEnabled = _getNodeViewOptions.isTableAlignmentEnabled,
|
|
37
|
-
isCommentEditor = _getNodeViewOptions.isCommentEditor
|
|
38
|
-
|
|
37
|
+
isCommentEditor = _getNodeViewOptions.isCommentEditor,
|
|
38
|
+
isChromelessEditor = _getNodeViewOptions.isChromelessEditor;
|
|
39
|
+
return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled, isCommentEditor, isChromelessEditor);
|
|
39
40
|
};
|
|
40
41
|
});
|
|
41
42
|
return result;
|
|
@@ -290,7 +290,7 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
290
290
|
}]);
|
|
291
291
|
return TableView;
|
|
292
292
|
}(_reactNodeView.default);
|
|
293
|
-
var createTableView = exports.createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled, isCommentEditor) {
|
|
293
|
+
var createTableView = exports.createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled, isCommentEditor, isChromelessEditor) {
|
|
294
294
|
var _getPluginState2 = (0, _pluginFactory.getPluginState)(view.state),
|
|
295
295
|
pluginConfig = _getPluginState2.pluginConfig,
|
|
296
296
|
isFullWidthModeEnabled = _getPluginState2.isFullWidthModeEnabled,
|
|
@@ -317,7 +317,8 @@ var createTableView = exports.createTableView = function createTableView(node, v
|
|
|
317
317
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
318
318
|
// same as options.isTableScalingEnabled
|
|
319
319
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
320
|
-
isCommentEditor: isCommentEditor
|
|
320
|
+
isCommentEditor: isCommentEditor,
|
|
321
|
+
isChromelessEditor: isChromelessEditor
|
|
321
322
|
},
|
|
322
323
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
323
324
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -204,8 +204,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
204
204
|
dragAndDropEnabled = _ref3.dragAndDropEnabled,
|
|
205
205
|
isTableScalingEnabled = _ref3.isTableScalingEnabled,
|
|
206
206
|
isTableAlignmentEnabled = _ref3.isTableAlignmentEnabled,
|
|
207
|
-
isCommentEditor = _ref3.isCommentEditor
|
|
208
|
-
|
|
207
|
+
isCommentEditor = _ref3.isCommentEditor,
|
|
208
|
+
isChromelessEditor = _ref3.isChromelessEditor;
|
|
209
|
+
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);
|
|
209
210
|
}
|
|
210
211
|
}, {
|
|
211
212
|
name: 'tablePMColResizing',
|
|
@@ -433,7 +434,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
433
434
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
434
435
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
435
436
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
436
|
-
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
|
|
437
|
+
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
|
|
438
|
+
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor
|
|
437
439
|
}), (options === null || options === void 0 ? void 0 : options.allowContextualMenu) && /*#__PURE__*/_react.default.createElement(_FloatingContextualMenu.default, {
|
|
438
440
|
editorView: editorView,
|
|
439
441
|
mountPoint: popupsMountPoint,
|
|
@@ -30,7 +30,7 @@ var _pluginFactory = require("./plugin-factory");
|
|
|
30
30
|
var _pluginKey = require("./plugin-key");
|
|
31
31
|
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; }
|
|
32
32
|
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; }
|
|
33
|
-
var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor) {
|
|
33
|
+
var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor) {
|
|
34
34
|
var _accessibilityUtils;
|
|
35
35
|
var state = (0, _pluginFactory.createPluginState)(dispatch, _objectSpread(_objectSpread(_objectSpread({
|
|
36
36
|
pluginConfig: pluginConfig,
|
|
@@ -202,11 +202,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
202
202
|
if (!pluginConfig.allowBackgroundColor) {
|
|
203
203
|
slice = (0, _misc.transformSliceRemoveCellBackgroundColor)(slice, schema);
|
|
204
204
|
}
|
|
205
|
-
|
|
206
|
-
// If a partial paste of nested expand, paste only nested-expand's content */
|
|
207
|
-
if ((0, _platformFeatureFlags.fg)('platform.editor.transform-slice-for-nested-expand')) {
|
|
208
|
-
slice = (0, _transforms.transformSliceToRemoveOpenNestedExpand)(slice, schema);
|
|
209
|
-
}
|
|
205
|
+
slice = (0, _transforms.transformSliceToRemoveOpenNestedExpand)(slice, schema);
|
|
210
206
|
return slice;
|
|
211
207
|
},
|
|
212
208
|
handleClick: function handleClick(_ref2, _pos, event) {
|
|
@@ -264,7 +260,8 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
264
260
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
265
261
|
pluginInjectionApi: pluginInjectionApi,
|
|
266
262
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
267
|
-
isCommentEditor: isCommentEditor
|
|
263
|
+
isCommentEditor: isCommentEditor,
|
|
264
|
+
isChromelessEditor: isChromelessEditor
|
|
268
265
|
}),
|
|
269
266
|
tableRow: (0, _lazyNodeViews.lazyTableRowView)({
|
|
270
267
|
eventDispatcher: eventDispatcher
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.scaleResizeState = exports.resizeColumnAndTable = exports.resizeColumn = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _styles = require("@atlaskit/editor-common/styles");
|
|
9
10
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
10
11
|
var _types = require("../../../types");
|
|
11
12
|
var _alignment = require("../../../utils/alignment");
|
|
@@ -38,17 +39,18 @@ var resizeColumnAndTable = exports.resizeColumnAndTable = function resizeColumnA
|
|
|
38
39
|
isTableAlignmentEnabled = _ref.isTableAlignmentEnabled;
|
|
39
40
|
var editorContainerWidth = getEditorContainerWidth(editorWidth);
|
|
40
41
|
var isTableLeftAligned = tableNode.attrs.layout === _alignment.ALIGN_START;
|
|
42
|
+
var isNumberColumnEnabled = tableNode.attrs.isNumberColumnEnabled;
|
|
43
|
+
var isOverflow = resizeState.tableWidth > resizeState.maxSize;
|
|
41
44
|
var resizeAmount = isTableLeftAligned ? amount : amount * 2;
|
|
42
45
|
var willTableHitEditorEdge = resizeState.maxSize + resizeAmount > editorContainerWidth;
|
|
43
|
-
var willResizedTableStayInOverflow =
|
|
46
|
+
var willResizedTableStayInOverflow = isOverflow && resizeState.tableWidth + resizeAmount / 2 > resizeState.maxSize;
|
|
44
47
|
|
|
45
48
|
// STEP 1: Update col width
|
|
46
49
|
if (willTableHitEditorEdge || willResizedTableStayInOverflow) {
|
|
47
50
|
var _tableRef$closest;
|
|
48
51
|
var tableContainerWidth = (_tableRef$closest = tableRef.closest('.pm-table-container')) === null || _tableRef$closest === void 0 ? void 0 : _tableRef$closest.clientWidth;
|
|
49
52
|
resizeAmount = amount < 0 ? amount : resizeAmount - (resizeState.maxSize + resizeAmount - tableContainerWidth) / 2;
|
|
50
|
-
}
|
|
51
|
-
if (!willResizedTableStayInOverflow && !willTableHitEditorEdge) {
|
|
53
|
+
} else {
|
|
52
54
|
var diff = -(resizeState.tableWidth - resizeState.maxSize);
|
|
53
55
|
var rest = amount - diff;
|
|
54
56
|
var final = isTableLeftAligned ? diff + rest : diff + rest * 2;
|
|
@@ -59,25 +61,23 @@ var resizeColumnAndTable = exports.resizeColumnAndTable = function resizeColumnA
|
|
|
59
61
|
// STEP 2: Update table container width
|
|
60
62
|
// columns have a min width, so delta !== resizeAmount when this is reached, use this for calculations
|
|
61
63
|
var delta = newState.cols[colIndex].width - resizeState.cols[colIndex].width;
|
|
62
|
-
newState.maxSize = Math.round(
|
|
64
|
+
newState.maxSize = Math.round(isOverflow ? willResizedTableStayInOverflow ?
|
|
63
65
|
// CASE 1A: table will stay in overflow
|
|
64
66
|
// do not grow the table because resize is happening in the overflow region
|
|
65
67
|
// and the overall table container needs to be retained
|
|
66
|
-
resizeState.maxSize :
|
|
68
|
+
isNumberColumnEnabled ? resizeState.maxSize + _editorSharedStyles.akEditorTableNumberColumnWidth : resizeState.maxSize :
|
|
67
69
|
// CASE 1B: table will no longer be in overflow, so adjust container width
|
|
68
70
|
// ensure the table is resized without any 'big jumps' by working out
|
|
69
71
|
// the difference between the new table width and the max size and adding the resize
|
|
70
|
-
resizeState.maxSize + (resizeState.tableWidth - resizeState.maxSize + delta) : willTableHitEditorEdge ?
|
|
72
|
+
isNumberColumnEnabled ? resizeState.maxSize + _editorSharedStyles.akEditorTableNumberColumnWidth + (resizeState.tableWidth - resizeState.maxSize + _editorSharedStyles.akEditorTableNumberColumnWidth + delta) : resizeState.maxSize + (resizeState.tableWidth - resizeState.maxSize + delta) : willTableHitEditorEdge ?
|
|
71
73
|
// CASE 2: table will hit editor edge
|
|
72
74
|
editorContainerWidth :
|
|
73
75
|
// CASE 3: table is being resized from a non-overflow state
|
|
74
|
-
resizeState.maxSize + delta);
|
|
76
|
+
isNumberColumnEnabled ? resizeState.maxSize + _editorSharedStyles.akEditorTableNumberColumnWidth + delta : resizeState.maxSize + delta);
|
|
75
77
|
|
|
76
78
|
// do not apply scaling logic because resize state is already scaled
|
|
77
79
|
(0, _resizeState.updateColgroup)(newState, tableRef, tableNode, false, false);
|
|
78
|
-
|
|
79
|
-
updateTablePreview(tableRef, newState.maxSize, (0, _alignment.shouldChangeAlignmentToCenterResized)(isTableAlignmentEnabled, tableNode, lineLength, newState.maxSize));
|
|
80
|
-
}
|
|
80
|
+
updateTablePreview(tableRef, newState.maxSize, (0, _alignment.shouldChangeAlignmentToCenterResized)(isTableAlignmentEnabled, tableNode, lineLength, newState.maxSize));
|
|
81
81
|
return newState;
|
|
82
82
|
};
|
|
83
83
|
var updateTablePreview = function updateTablePreview(tableRef, newTableWidth, shouldChangeAlignment) {
|
|
@@ -105,37 +105,52 @@ var scaleResizeState = exports.scaleResizeState = function scaleResizeState(_ref
|
|
|
105
105
|
tableRef = _ref2.tableRef,
|
|
106
106
|
tableNode = _ref2.tableNode,
|
|
107
107
|
editorWidth = _ref2.editorWidth;
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
var isNumberColumnEnabled = tableNode.attrs.isNumberColumnEnabled;
|
|
109
|
+
var isTableScaled = isNumberColumnEnabled || resizeState.maxSize > getEditorContainerWidth(editorWidth);
|
|
110
|
+
|
|
111
|
+
// Tables with number column can cause the table to be in two different states:
|
|
112
|
+
// 1. The table sum of col widths will be smaller than the max size, which is incorrect. For this
|
|
113
|
+
// avoid scaling and take the document width
|
|
114
|
+
// 2. The table sum of col widths will be the same size as max width, which happens when the table
|
|
115
|
+
// is scaled using preserve table width logic, for this apply a scaled width
|
|
116
|
+
// return early if table isn't scaled
|
|
117
|
+
if (!isTableScaled || isNumberColumnEnabled && resizeState.maxSize > resizeState.tableWidth) {
|
|
110
118
|
return resizeState;
|
|
111
119
|
}
|
|
112
120
|
var scalePercent = (0, _misc.getTableScalingPercent)(tableNode, tableRef);
|
|
121
|
+
var scaledTableWidth = Math.round(resizeState.tableWidth * scalePercent);
|
|
113
122
|
var cols = resizeState.cols.map(function (col) {
|
|
114
123
|
return _objectSpread(_objectSpread({}, col), {}, {
|
|
115
|
-
|
|
124
|
+
minWidth: _styles.tableCellMinWidth,
|
|
125
|
+
width: Math.max(Math.round(col.width * scalePercent), _styles.tableCellMinWidth)
|
|
116
126
|
});
|
|
117
127
|
});
|
|
118
|
-
var scaledTableWidth = Math.round(resizeState.tableWidth * scalePercent);
|
|
119
128
|
var calculatedTableWidth = cols.reduce(function (prev, curr) {
|
|
120
129
|
return prev + curr.width;
|
|
121
130
|
}, 0);
|
|
122
131
|
|
|
123
132
|
// using Math.round can cause the sum of col widths to be larger than the table width
|
|
124
|
-
// distribute the difference to the
|
|
133
|
+
// distribute the difference to the first column
|
|
125
134
|
if (calculatedTableWidth > scaledTableWidth) {
|
|
126
135
|
var diff = calculatedTableWidth - scaledTableWidth;
|
|
136
|
+
var hasDiffBeenDistributed = false;
|
|
127
137
|
cols = cols.map(function (col) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
138
|
+
if (!hasDiffBeenDistributed && col.width - diff >= col.minWidth) {
|
|
139
|
+
hasDiffBeenDistributed = true;
|
|
140
|
+
return _objectSpread(_objectSpread({}, col), {}, {
|
|
141
|
+
width: col.width - diff
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return col;
|
|
131
145
|
});
|
|
132
146
|
}
|
|
147
|
+
var maxSize = isNumberColumnEnabled ? Math.round((resizeState.maxSize + _editorSharedStyles.akEditorTableNumberColumnWidth) * scalePercent) : Math.round(resizeState.maxSize * scalePercent);
|
|
133
148
|
return _objectSpread(_objectSpread({}, resizeState), {}, {
|
|
134
149
|
widths: cols.map(function (col) {
|
|
135
150
|
return col.width;
|
|
136
151
|
}),
|
|
137
152
|
tableWidth: scaledTableWidth,
|
|
138
|
-
maxSize:
|
|
153
|
+
maxSize: maxSize,
|
|
139
154
|
cols: cols
|
|
140
155
|
});
|
|
141
156
|
};
|
|
@@ -241,6 +241,9 @@ function updateAffectedColumn(resizeState, colIndex, resizeAmount) {
|
|
|
241
241
|
return col;
|
|
242
242
|
});
|
|
243
243
|
return _objectSpread(_objectSpread({}, resizeState), {}, {
|
|
244
|
+
tableWidth: updatedCols.reduce(function (acc, col) {
|
|
245
|
+
return acc + col.width;
|
|
246
|
+
}, 0),
|
|
244
247
|
cols: updatedCols
|
|
245
248
|
});
|
|
246
249
|
}
|
package/dist/cjs/toolbar.js
CHANGED
|
@@ -217,19 +217,22 @@ var getToolbarCellOptionsConfig = exports.getToolbarCellOptionsConfig = function
|
|
|
217
217
|
onMouseLeave: (0, _commands.clearHoverSelection)(),
|
|
218
218
|
selected: false,
|
|
219
219
|
disabled: false
|
|
220
|
-
}, {
|
|
221
|
-
id: 'editor.table.mergeCells',
|
|
222
|
-
title: formatMessage(_messages.tableMessages.mergeCells),
|
|
223
|
-
onClick: (0, _commandsWithAnalytics.mergeCellsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.FLOATING_TB),
|
|
224
|
-
selected: false,
|
|
225
|
-
disabled: !(0, _transforms.canMergeCells)(editorState.tr)
|
|
226
|
-
}, {
|
|
227
|
-
id: 'editor.table.splitCell',
|
|
228
|
-
title: formatMessage(_messages.tableMessages.splitCell),
|
|
229
|
-
onClick: (0, _commandsWithAnalytics.splitCellWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.FLOATING_TB),
|
|
230
|
-
selected: false,
|
|
231
|
-
disabled: !(0, _utils3.splitCell)(editorState)
|
|
232
220
|
}];
|
|
221
|
+
if (pluginState.pluginConfig.allowMergeCells) {
|
|
222
|
+
options.push({
|
|
223
|
+
id: 'editor.table.mergeCells',
|
|
224
|
+
title: formatMessage(_messages.tableMessages.mergeCells),
|
|
225
|
+
onClick: (0, _commandsWithAnalytics.mergeCellsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.FLOATING_TB),
|
|
226
|
+
selected: false,
|
|
227
|
+
disabled: !(0, _transforms.canMergeCells)(editorState.tr)
|
|
228
|
+
}, {
|
|
229
|
+
id: 'editor.table.splitCell',
|
|
230
|
+
title: formatMessage(_messages.tableMessages.splitCell),
|
|
231
|
+
onClick: (0, _commandsWithAnalytics.splitCellWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.FLOATING_TB),
|
|
232
|
+
selected: false,
|
|
233
|
+
disabled: !(0, _utils3.splitCell)(editorState)
|
|
234
|
+
});
|
|
235
|
+
}
|
|
233
236
|
if (pluginState !== null && pluginState !== void 0 && (_pluginState$pluginCo = pluginState.pluginConfig) !== null && _pluginState$pluginCo !== void 0 && _pluginState$pluginCo.allowDistributeColumns) {
|
|
234
237
|
var _newResizeStateWithAn;
|
|
235
238
|
var newResizeStateWithAnalytics = editorView ? (0, _resizeState.getNewResizeStateFromSelectedColumns)(initialSelectionRect, editorState, editorView.domAtPos.bind(editorView), getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled) : undefined;
|
package/dist/cjs/types.js
CHANGED
|
@@ -81,6 +81,7 @@ var TableCssClassName = exports.TableCssClassName = _objectSpread(_objectSpread(
|
|
|
81
81
|
DRAG_CONTROLS_INSERT_BUTTON_INNER: "".concat(_adfSchema.tablePrefixSelector, "-controls__drag-insert-button-inner"),
|
|
82
82
|
DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN: "".concat(_adfSchema.tablePrefixSelector, "-controls__drag-insert-button-inner-column"),
|
|
83
83
|
DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW: "".concat(_adfSchema.tablePrefixSelector, "-controls__drag-insert-button-inner-row"),
|
|
84
|
+
DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW_CHROMELESS: "".concat(_adfSchema.tablePrefixSelector, "-controls__drag-insert-button-inner-row-chromeless"),
|
|
84
85
|
DRAG_CONTROLS_INSERT_BUTTON_WRAP: "".concat(_adfSchema.tablePrefixSelector, "-controls__drag-insert-button-wrap"),
|
|
85
86
|
CONTROLS_INSERT_MARKER: "".concat(_adfSchema.tablePrefixSelector, "-controls__insert-marker"),
|
|
86
87
|
CONTROLS_INSERT_COLUMN: "".concat(_adfSchema.tablePrefixSelector, "-controls__insert-column"),
|
|
@@ -96,6 +97,7 @@ var TableCssClassName = exports.TableCssClassName = _objectSpread(_objectSpread(
|
|
|
96
97
|
/** drag and drop controls */
|
|
97
98
|
DRAG_ROW_CONTROLS_WRAPPER: "".concat(_adfSchema.tablePrefixSelector, "-drag-row-controls-wrapper"),
|
|
98
99
|
DRAG_ROW_CONTROLS: "".concat(_adfSchema.tablePrefixSelector, "-drag-row-controls"),
|
|
100
|
+
DRAG_CONTROLS_CHROMELESS: "drag-controls-chromeless",
|
|
99
101
|
DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER: "".concat(_adfSchema.tablePrefixSelector, "-drag-row-floating-insert-dot-wrapper"),
|
|
100
102
|
DRAG_ROW_FLOATING_INSERT_DOT: "".concat(_adfSchema.tablePrefixSelector, "-drag-row-floating-insert-dot"),
|
|
101
103
|
DRAG_COLUMN_CONTROLS: "".concat(_adfSchema.tablePrefixSelector, "-drag-column-controls"),
|
|
@@ -215,8 +215,9 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
215
215
|
editorView = _this$props3.editorView;
|
|
216
216
|
var _getPluginState3 = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
217
217
|
isDragAndDropEnabled = _getPluginState3.isDragAndDropEnabled;
|
|
218
|
+
var content = formatMessage(isDragAndDropEnabled ? _messages.tableMessages.addColumnRight : _messages.tableMessages.insertColumn);
|
|
218
219
|
return {
|
|
219
|
-
content:
|
|
220
|
+
content: content,
|
|
220
221
|
value: {
|
|
221
222
|
name: 'insert_column'
|
|
222
223
|
},
|
|
@@ -228,7 +229,8 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
228
229
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
229
230
|
(0, _react2.jsx)("span", {
|
|
230
231
|
css: _styles2.elementBeforeIconStyles
|
|
231
|
-
}, (0, _react2.jsx)(_icons.AddColRightIcon, null)) : undefined
|
|
232
|
+
}, (0, _react2.jsx)(_icons.AddColRightIcon, null)) : undefined,
|
|
233
|
+
'aria-label': (0, _platformFeatureFlags.fg)('platform_editor_announce_cell_options_hotkeys') ? (0, _keymaps.tooltip)(_keymaps.addColumnAfter, String(content)) : undefined
|
|
232
234
|
};
|
|
233
235
|
});
|
|
234
236
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createInsertRowItem", function () {
|
|
@@ -237,8 +239,9 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
237
239
|
editorView = _this$props4.editorView;
|
|
238
240
|
var _getPluginState4 = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
239
241
|
isDragAndDropEnabled = _getPluginState4.isDragAndDropEnabled;
|
|
242
|
+
var content = formatMessage(isDragAndDropEnabled ? _messages.tableMessages.addRowBelow : _messages.tableMessages.insertRow);
|
|
240
243
|
return {
|
|
241
|
-
content:
|
|
244
|
+
content: content,
|
|
242
245
|
value: {
|
|
243
246
|
name: 'insert_row'
|
|
244
247
|
},
|
|
@@ -250,7 +253,8 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
250
253
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
251
254
|
(0, _react2.jsx)("span", {
|
|
252
255
|
css: _styles2.elementBeforeIconStyles
|
|
253
|
-
}, (0, _react2.jsx)(_icons.AddRowBelowIcon, null)) : undefined
|
|
256
|
+
}, (0, _react2.jsx)(_icons.AddRowBelowIcon, null)) : undefined,
|
|
257
|
+
'aria-label': (0, _platformFeatureFlags.fg)('platform_editor_announce_cell_options_hotkeys') ? (0, _keymaps.tooltip)(_keymaps.addRowAfter, String(content)) : undefined
|
|
254
258
|
};
|
|
255
259
|
});
|
|
256
260
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createClearCellsItem", function () {
|
|
@@ -266,10 +270,11 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
266
270
|
left = selectionRect.left;
|
|
267
271
|
var noOfColumns = right - left;
|
|
268
272
|
var noOfRows = bottom - top;
|
|
273
|
+
var content = formatMessage(_messages.tableMessages.clearCells, {
|
|
274
|
+
0: Math.max(noOfColumns, noOfRows)
|
|
275
|
+
});
|
|
269
276
|
return {
|
|
270
|
-
content:
|
|
271
|
-
0: Math.max(noOfColumns, noOfRows)
|
|
272
|
-
}),
|
|
277
|
+
content: content,
|
|
273
278
|
value: {
|
|
274
279
|
name: 'clear'
|
|
275
280
|
},
|
|
@@ -285,7 +290,8 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
285
290
|
label: formatMessage(_messages.tableMessages.clearCells, {
|
|
286
291
|
0: Math.max(noOfColumns, noOfRows)
|
|
287
292
|
})
|
|
288
|
-
})) : undefined
|
|
293
|
+
})) : undefined,
|
|
294
|
+
'aria-label': (0, _platformFeatureFlags.fg)('platform_editor_announce_cell_options_hotkeys') ? (0, _keymaps.tooltip)(_keymaps.backspace, String(content)) : undefined
|
|
289
295
|
};
|
|
290
296
|
});
|
|
291
297
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createDeleteColumnItem", function () {
|
|
@@ -41,12 +41,12 @@ var getNumberColumnWidth = function getNumberColumnWidth(tableRef, isDragAndDrop
|
|
|
41
41
|
}
|
|
42
42
|
return 0;
|
|
43
43
|
};
|
|
44
|
-
var getInsertLineWidth = function getInsertLineWidth(tableRef, isDragAndDropEnabled) {
|
|
44
|
+
var getInsertLineWidth = function getInsertLineWidth(tableRef, isDragAndDropEnabled, isChromelessEditor) {
|
|
45
45
|
// The line gets width 100% from the table,
|
|
46
46
|
// but since we have an overflow on the left,
|
|
47
47
|
// we should add an offset to make up for it.
|
|
48
48
|
var LINE_OFFSET = 4;
|
|
49
|
-
var DRAG_LINE_OFFSET = 6;
|
|
49
|
+
var DRAG_LINE_OFFSET = isChromelessEditor ? 14 : 6;
|
|
50
50
|
var parentElement = tableRef.parentElement,
|
|
51
51
|
offsetWidth = tableRef.offsetWidth;
|
|
52
52
|
var parentOffsetWidth = parentElement.offsetWidth;
|
|
@@ -66,7 +66,8 @@ var InsertButtonForDragAndDrop = exports.InsertButtonForDragAndDrop = function I
|
|
|
66
66
|
tableRef = _ref2.tableRef,
|
|
67
67
|
type = _ref2.type,
|
|
68
68
|
formatMessage = _ref2.intl.formatMessage,
|
|
69
|
-
hasStickyHeaders = _ref2.hasStickyHeaders
|
|
69
|
+
hasStickyHeaders = _ref2.hasStickyHeaders,
|
|
70
|
+
isChromelessEditor = _ref2.isChromelessEditor;
|
|
70
71
|
var isRow = type === 'row';
|
|
71
72
|
var content = /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
72
73
|
content: /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
|
|
@@ -76,7 +77,7 @@ var InsertButtonForDragAndDrop = exports.InsertButtonForDragAndDrop = function I
|
|
|
76
77
|
position: "top"
|
|
77
78
|
}, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
78
79
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
79
|
-
className: (0, _classnames2.default)(_types.TableCssClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER, (_classnames = {}, (0, _defineProperty2.default)(_classnames, _types.TableCssClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW, isRow), (0, _defineProperty2.default)(_classnames, _types.TableCssClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN, !isRow), _classnames))
|
|
80
|
+
className: (0, _classnames2.default)(_types.TableCssClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER, (_classnames = {}, (0, _defineProperty2.default)(_classnames, _types.TableCssClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW, isRow && !isChromelessEditor), (0, _defineProperty2.default)(_classnames, _types.TableCssClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN, !isRow), (0, _defineProperty2.default)(_classnames, _types.TableCssClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW_CHROMELESS, isRow && isChromelessEditor), _classnames))
|
|
80
81
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
81
82
|
type: "button"
|
|
82
83
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -100,7 +101,7 @@ var InsertButtonForDragAndDrop = exports.InsertButtonForDragAndDrop = function I
|
|
|
100
101
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
101
102
|
,
|
|
102
103
|
style: type === 'row' ? {
|
|
103
|
-
width: getInsertLineWidth(tableRef, true),
|
|
104
|
+
width: getInsertLineWidth(tableRef, true, isChromelessEditor),
|
|
104
105
|
left: "var(--ds-space-150, 12px)"
|
|
105
106
|
} : {
|
|
106
107
|
height: getInsertLineHeight(tableRef, hasStickyHeaders, true) - 8,
|
|
@@ -59,7 +59,8 @@ var FloatingInsertButton = exports.FloatingInsertButton = /*#__PURE__*/function
|
|
|
59
59
|
isHeaderColumnEnabled = _this$props.isHeaderColumnEnabled,
|
|
60
60
|
isHeaderRowEnabled = _this$props.isHeaderRowEnabled,
|
|
61
61
|
isDragAndDropEnabled = _this$props.isDragAndDropEnabled,
|
|
62
|
-
dispatchAnalyticsEvent = _this$props.dispatchAnalyticsEvent
|
|
62
|
+
dispatchAnalyticsEvent = _this$props.dispatchAnalyticsEvent,
|
|
63
|
+
isChromelessEditor = _this$props.isChromelessEditor;
|
|
63
64
|
|
|
64
65
|
// TODO: temporarily disable insert button for first column and row https://atlassian.slack.com/archives/C05U8HRQM50/p1698363744682219?thread_ts=1698209039.104909&cid=C05U8HRQM50
|
|
65
66
|
if (isDragAndDropEnabled && (insertColumnButtonIndex === 0 || insertRowButtonIndex === 0)) {
|
|
@@ -144,7 +145,8 @@ var FloatingInsertButton = exports.FloatingInsertButton = /*#__PURE__*/function
|
|
|
144
145
|
type: type,
|
|
145
146
|
tableRef: tableRef,
|
|
146
147
|
onMouseDown: type === 'column' ? this.insertColumn : this.insertRow,
|
|
147
|
-
hasStickyHeaders: this.props.hasStickyHeaders || false
|
|
148
|
+
hasStickyHeaders: this.props.hasStickyHeaders || false,
|
|
149
|
+
isChromelessEditor: isChromelessEditor
|
|
148
150
|
}) : /*#__PURE__*/_react.default.createElement(_InsertButton.default, {
|
|
149
151
|
type: type,
|
|
150
152
|
tableRef: tableRef,
|
|
@@ -208,7 +210,7 @@ var FloatingInsertButton = exports.FloatingInsertButton = /*#__PURE__*/function
|
|
|
208
210
|
tableDuplicateCellColouring = _ref$tableDuplicateCe === void 0 ? false : _ref$tableDuplicateCe,
|
|
209
211
|
_ref$tableWithFixedCo = _ref.tableWithFixedColumnWidthsOption,
|
|
210
212
|
tableWithFixedColumnWidthsOption = _ref$tableWithFixedCo === void 0 ? false : _ref$tableWithFixedCo;
|
|
211
|
-
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && (0, _platformFeatureFlags.
|
|
213
|
+
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && (0, _platformFeatureFlags.fg)('platform.editor.table.use-increased-scaling-percent');
|
|
212
214
|
var state = editorView.state,
|
|
213
215
|
dispatch = editorView.dispatch;
|
|
214
216
|
(0, _commandsWithAnalytics.insertColumnWithAnalytics)(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring, tableWithFixedColumnWidthsOption, shouldUseIncreasedScalingPercent)(_analytics.INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
|
|
@@ -32,7 +32,8 @@ var TableFloatingColumnControls = exports.TableFloatingColumnControls = function
|
|
|
32
32
|
isNumberColumnEnabled = _ref.isNumberColumnEnabled,
|
|
33
33
|
getScrollOffset = _ref.getScrollOffset,
|
|
34
34
|
tableWrapperHeight = _ref.tableWrapperHeight,
|
|
35
|
-
api = _ref.api
|
|
35
|
+
api = _ref.api,
|
|
36
|
+
isChromelessEditor = _ref.isChromelessEditor;
|
|
36
37
|
var _useState = (0, _react.useState)(false),
|
|
37
38
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
38
39
|
isDragging = _useState2[0],
|
|
@@ -84,7 +85,7 @@ var TableFloatingColumnControls = exports.TableFloatingColumnControls = function
|
|
|
84
85
|
ref: containerRef
|
|
85
86
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
86
87
|
,
|
|
87
|
-
className: _types.TableCssClassName.DRAG_COLUMN_CONTROLS_WRAPPER,
|
|
88
|
+
className: _types.TableCssClassName.DRAG_COLUMN_CONTROLS_WRAPPER + (isChromelessEditor ? ' ' + _types.TableCssClassName.DRAG_CONTROLS_CHROMELESS : ''),
|
|
88
89
|
"data-testid": "table-floating-column-controls-wrapper"
|
|
89
90
|
}, /*#__PURE__*/_react.default.createElement(_ColumnControls.ColumnControls, {
|
|
90
91
|
editorView: editorView,
|
|
@@ -102,7 +103,7 @@ var TableFloatingColumnControls = exports.TableFloatingColumnControls = function
|
|
|
102
103
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
103
104
|
isDragging: isDragging,
|
|
104
105
|
getScrollOffset: getScrollOffset,
|
|
105
|
-
api: (0, _platformFeatureFlags.
|
|
106
|
+
api: (0, _platformFeatureFlags.fg)('platform.editor.table.use-shared-state-hook') ? api : undefined
|
|
106
107
|
}), isDragging && /*#__PURE__*/_react.default.createElement(_ColumnDropTargets.ColumnDropTargets, {
|
|
107
108
|
tableRef: tableRef,
|
|
108
109
|
isHeaderSticky: (stickyHeader === null || stickyHeader === void 0 ? void 0 : stickyHeader.sticky) && hasHeaderRow,
|
|
@@ -38,7 +38,8 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
38
38
|
hoveredCell = _ref.hoveredCell,
|
|
39
39
|
isTableHovered = _ref.isTableHovered,
|
|
40
40
|
tableWrapperWidth = _ref.tableWrapperWidth,
|
|
41
|
-
api = _ref.api
|
|
41
|
+
api = _ref.api,
|
|
42
|
+
isChromelessEditor = _ref.isChromelessEditor;
|
|
42
43
|
var _selectRow = (0, _react.useCallback)(function (row, expand) {
|
|
43
44
|
var state = editorView.state,
|
|
44
45
|
dispatch = editorView.dispatch;
|
|
@@ -81,7 +82,7 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
81
82
|
return null;
|
|
82
83
|
}
|
|
83
84
|
var stickyTop = stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
|
|
84
|
-
var wrapperClassName = isDragAndDropEnabled ? _types.TableCssClassName.DRAG_ROW_CONTROLS_WRAPPER : _types.TableCssClassName.ROW_CONTROLS_WRAPPER;
|
|
85
|
+
var wrapperClassName = isDragAndDropEnabled ? isChromelessEditor ? _types.TableCssClassName.DRAG_ROW_CONTROLS_WRAPPER + ' ' + _types.TableCssClassName.DRAG_CONTROLS_CHROMELESS : _types.TableCssClassName.DRAG_ROW_CONTROLS_WRAPPER : _types.TableCssClassName.ROW_CONTROLS_WRAPPER;
|
|
85
86
|
var tablePos = (_findTable = (0, _utils2.findTable)(editorView.state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos;
|
|
86
87
|
var isNested = tablePos !== undefined && (0, _nodes.isTableNested)(editorView.state, tablePos);
|
|
87
88
|
var shouldShowCornerControls = (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24041') ? !(featureFlagsState !== null && featureFlagsState !== void 0 && featureFlagsState.elementDragAndDrop) || isNested : !(featureFlagsState !== null && featureFlagsState !== void 0 && featureFlagsState.elementDragAndDrop);
|