@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
|
@@ -10,7 +10,7 @@ import { akEditorTableCellOnStickyHeaderZIndex } from '@atlaskit/editor-shared-s
|
|
|
10
10
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
11
11
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
12
12
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
13
|
-
import {
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
14
|
import { insertColumnWithAnalytics, insertRowWithAnalytics } from '../../commands-with-analytics';
|
|
15
15
|
import { TableCssClassName as ClassName } from '../../types';
|
|
16
16
|
import { checkIfNumberColumnEnabled } from '../../utils';
|
|
@@ -34,7 +34,8 @@ export class FloatingInsertButton extends React.Component {
|
|
|
34
34
|
isHeaderColumnEnabled,
|
|
35
35
|
isHeaderRowEnabled,
|
|
36
36
|
isDragAndDropEnabled,
|
|
37
|
-
dispatchAnalyticsEvent
|
|
37
|
+
dispatchAnalyticsEvent,
|
|
38
|
+
isChromelessEditor
|
|
38
39
|
} = this.props;
|
|
39
40
|
|
|
40
41
|
// TODO: temporarily disable insert button for first column and row https://atlassian.slack.com/archives/C05U8HRQM50/p1698363744682219?thread_ts=1698209039.104909&cid=C05U8HRQM50
|
|
@@ -124,7 +125,8 @@ export class FloatingInsertButton extends React.Component {
|
|
|
124
125
|
type: type,
|
|
125
126
|
tableRef: tableRef,
|
|
126
127
|
onMouseDown: type === 'column' ? this.insertColumn : this.insertRow,
|
|
127
|
-
hasStickyHeaders: this.props.hasStickyHeaders || false
|
|
128
|
+
hasStickyHeaders: this.props.hasStickyHeaders || false,
|
|
129
|
+
isChromelessEditor: isChromelessEditor
|
|
128
130
|
}) : /*#__PURE__*/React.createElement(InsertButton, {
|
|
129
131
|
type: type,
|
|
130
132
|
tableRef: tableRef,
|
|
@@ -186,7 +188,7 @@ export class FloatingInsertButton extends React.Component {
|
|
|
186
188
|
tableDuplicateCellColouring = false,
|
|
187
189
|
tableWithFixedColumnWidthsOption = false
|
|
188
190
|
} = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
189
|
-
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption &&
|
|
191
|
+
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && fg('platform.editor.table.use-increased-scaling-percent');
|
|
190
192
|
const {
|
|
191
193
|
state,
|
|
192
194
|
dispatch
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
4
4
|
import { TableCssClassName as ClassName } from '../../types';
|
|
5
5
|
import { containsHeaderColumn, getColumnsWidths, getRowHeights } from '../../utils';
|
|
@@ -21,7 +21,8 @@ export const TableFloatingColumnControls = ({
|
|
|
21
21
|
isNumberColumnEnabled,
|
|
22
22
|
getScrollOffset,
|
|
23
23
|
tableWrapperHeight,
|
|
24
|
-
api
|
|
24
|
+
api,
|
|
25
|
+
isChromelessEditor
|
|
25
26
|
}) => {
|
|
26
27
|
const [isDragging, setIsDragging] = useState(false);
|
|
27
28
|
const containerRef = useRef(null);
|
|
@@ -73,7 +74,7 @@ export const TableFloatingColumnControls = ({
|
|
|
73
74
|
ref: containerRef
|
|
74
75
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
75
76
|
,
|
|
76
|
-
className: ClassName.DRAG_COLUMN_CONTROLS_WRAPPER,
|
|
77
|
+
className: ClassName.DRAG_COLUMN_CONTROLS_WRAPPER + (isChromelessEditor ? ' ' + ClassName.DRAG_CONTROLS_CHROMELESS : ''),
|
|
77
78
|
"data-testid": "table-floating-column-controls-wrapper"
|
|
78
79
|
}, /*#__PURE__*/React.createElement(ColumnControls, {
|
|
79
80
|
editorView: editorView,
|
|
@@ -91,7 +92,7 @@ export const TableFloatingColumnControls = ({
|
|
|
91
92
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
92
93
|
isDragging: isDragging,
|
|
93
94
|
getScrollOffset: getScrollOffset,
|
|
94
|
-
api:
|
|
95
|
+
api: fg('platform.editor.table.use-shared-state-hook') ? api : undefined
|
|
95
96
|
}), isDragging && /*#__PURE__*/React.createElement(ColumnDropTargets, {
|
|
96
97
|
tableRef: tableRef,
|
|
97
98
|
isHeaderSticky: (stickyHeader === null || stickyHeader === void 0 ? void 0 : stickyHeader.sticky) && hasHeaderRow,
|
|
@@ -27,7 +27,8 @@ export const TableFloatingControls = ({
|
|
|
27
27
|
hoveredCell,
|
|
28
28
|
isTableHovered,
|
|
29
29
|
tableWrapperWidth,
|
|
30
|
-
api
|
|
30
|
+
api,
|
|
31
|
+
isChromelessEditor
|
|
31
32
|
}) => {
|
|
32
33
|
var _findTable;
|
|
33
34
|
const _selectRow = useCallback((row, expand) => {
|
|
@@ -81,7 +82,7 @@ export const TableFloatingControls = ({
|
|
|
81
82
|
return null;
|
|
82
83
|
}
|
|
83
84
|
const stickyTop = stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
|
|
84
|
-
const wrapperClassName = isDragAndDropEnabled ? ClassName.DRAG_ROW_CONTROLS_WRAPPER : ClassName.ROW_CONTROLS_WRAPPER;
|
|
85
|
+
const wrapperClassName = isDragAndDropEnabled ? isChromelessEditor ? ClassName.DRAG_ROW_CONTROLS_WRAPPER + ' ' + ClassName.DRAG_CONTROLS_CHROMELESS : ClassName.DRAG_ROW_CONTROLS_WRAPPER : ClassName.ROW_CONTROLS_WRAPPER;
|
|
85
86
|
const tablePos = (_findTable = findTable(editorView.state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos;
|
|
86
87
|
const isNested = tablePos !== undefined && isTableNested(editorView.state, tablePos);
|
|
87
88
|
const shouldShowCornerControls = fg('platform_editor_element_drag_and_drop_ed_24041') ? !(featureFlagsState !== null && featureFlagsState !== void 0 && featureFlagsState.elementDragAndDrop) || isNested : !(featureFlagsState !== null && featureFlagsState !== void 0 && featureFlagsState.elementDragAndDrop);
|
|
@@ -439,10 +439,18 @@ export const baseTableStyles = props => {
|
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
|
|
442
|
+
.${ClassName.DRAG_ROW_CONTROLS_WRAPPER}.${ClassName.DRAG_CONTROLS_CHROMELESS} {
|
|
443
|
+
left: -4px;
|
|
444
|
+
}
|
|
445
|
+
|
|
442
446
|
.${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER} {
|
|
443
447
|
padding: 0 ${tablePadding}px;
|
|
444
448
|
}
|
|
445
449
|
|
|
450
|
+
.${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER}.${ClassName.DRAG_CONTROLS_CHROMELESS} {
|
|
451
|
+
left: -8px;
|
|
452
|
+
}
|
|
453
|
+
|
|
446
454
|
&.${ClassName.TABLE_CONTAINER}[data-number-column='true'] {
|
|
447
455
|
padding-left: ${akEditorTableNumberColumnWidth + tablePadding - 1}px;
|
|
448
456
|
}
|
|
@@ -150,6 +150,10 @@ export const dragInsertButtonWrapper = () => css`
|
|
|
150
150
|
left: -3px;
|
|
151
151
|
bottom: -2px;
|
|
152
152
|
}
|
|
153
|
+
.${ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW_CHROMELESS} {
|
|
154
|
+
left: 6px;
|
|
155
|
+
bottom: -2px;
|
|
156
|
+
}
|
|
153
157
|
|
|
154
158
|
.${ClassName.DRAG_CONTROLS_INSERT_BUTTON} {
|
|
155
159
|
${Button(`
|
|
@@ -729,7 +729,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
729
729
|
headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
|
|
730
730
|
stickyHeader: this.state.stickyHeader,
|
|
731
731
|
tableWrapperWidth: this.state.tableWrapperWidth,
|
|
732
|
-
api: pluginInjectionApi
|
|
732
|
+
api: pluginInjectionApi,
|
|
733
|
+
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor
|
|
733
734
|
});
|
|
734
735
|
var tableContainerWidth = getTableContainerWidth(node);
|
|
735
736
|
var colControls = isDragAndDropEnabled ? /*#__PURE__*/React.createElement(TableFloatingColumnControls, {
|
|
@@ -757,7 +758,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
757
758
|
return ((_this4$wrapper = _this4.wrapper) === null || _this4$wrapper === void 0 ? void 0 : _this4$wrapper.scrollLeft) || 0;
|
|
758
759
|
},
|
|
759
760
|
tableWrapperHeight: this.state.tableWrapperHeight,
|
|
760
|
-
api: pluginInjectionApi
|
|
761
|
+
api: pluginInjectionApi,
|
|
762
|
+
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor
|
|
761
763
|
}) : null;
|
|
762
764
|
var shadowPadding = allowControls && tableActive ? -tableToolbarSize : tableMarginSides;
|
|
763
765
|
var shadowStyle = memoizeOne(function (visible) {
|
|
@@ -803,7 +805,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
803
805
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
804
806
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
805
807
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
806
|
-
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor
|
|
808
|
+
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
809
|
+
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor
|
|
807
810
|
}, /*#__PURE__*/React.createElement("div", {
|
|
808
811
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
809
812
|
className: ClassName.TABLE_STICKY_SENTINEL_TOP,
|
|
@@ -287,7 +287,8 @@ export var TableContainer = function TableContainer(_ref6) {
|
|
|
287
287
|
isTableWithFixedColumnWidthsOptionEnabled = _ref6.isTableWithFixedColumnWidthsOptionEnabled,
|
|
288
288
|
isTableAlignmentEnabled = _ref6.isTableAlignmentEnabled,
|
|
289
289
|
shouldUseIncreasedScalingPercent = _ref6.shouldUseIncreasedScalingPercent,
|
|
290
|
-
isCommentEditor = _ref6.isCommentEditor
|
|
290
|
+
isCommentEditor = _ref6.isCommentEditor,
|
|
291
|
+
isChromelessEditor = _ref6.isChromelessEditor;
|
|
291
292
|
if (isTableResizingEnabled && !isNested) {
|
|
292
293
|
return /*#__PURE__*/React.createElement(ResizableTableContainer
|
|
293
294
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -319,7 +320,8 @@ export var TableContainer = function TableContainer(_ref6) {
|
|
|
319
320
|
}),
|
|
320
321
|
style: {
|
|
321
322
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
322
|
-
width: 'inherit'
|
|
323
|
+
width: 'inherit',
|
|
324
|
+
marginLeft: isChromelessEditor ? 18 : undefined
|
|
323
325
|
}
|
|
324
326
|
}, children);
|
|
325
327
|
};
|
|
@@ -7,7 +7,7 @@ import TableRow from './TableRow';
|
|
|
7
7
|
export var lazyTableView = function lazyTableView(options) {
|
|
8
8
|
if (!fg('platform_editor_lazy-node-views')) {
|
|
9
9
|
return function (node, view, getPos) {
|
|
10
|
-
return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isTableAlignmentEnabled, options.isCommentEditor);
|
|
10
|
+
return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isTableAlignmentEnabled, options.isCommentEditor, options.isChromelessEditor);
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
var loader = function loader() {
|
|
@@ -23,8 +23,9 @@ export var lazyTableView = function lazyTableView(options) {
|
|
|
23
23
|
dispatchAnalyticsEvent = _getNodeViewOptions.dispatchAnalyticsEvent,
|
|
24
24
|
pluginInjectionApi = _getNodeViewOptions.pluginInjectionApi,
|
|
25
25
|
isTableAlignmentEnabled = _getNodeViewOptions.isTableAlignmentEnabled,
|
|
26
|
-
isCommentEditor = _getNodeViewOptions.isCommentEditor
|
|
27
|
-
|
|
26
|
+
isCommentEditor = _getNodeViewOptions.isCommentEditor,
|
|
27
|
+
isChromelessEditor = _getNodeViewOptions.isChromelessEditor;
|
|
28
|
+
return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled, isCommentEditor, isChromelessEditor);
|
|
28
29
|
};
|
|
29
30
|
});
|
|
30
31
|
return result;
|
|
@@ -284,7 +284,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
284
284
|
return TableView;
|
|
285
285
|
}(ReactNodeView);
|
|
286
286
|
export { TableView as default };
|
|
287
|
-
export var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled, isCommentEditor) {
|
|
287
|
+
export var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled, isCommentEditor, isChromelessEditor) {
|
|
288
288
|
var _getPluginState2 = getPluginState(view.state),
|
|
289
289
|
pluginConfig = _getPluginState2.pluginConfig,
|
|
290
290
|
isFullWidthModeEnabled = _getPluginState2.isFullWidthModeEnabled,
|
|
@@ -311,7 +311,8 @@ export var createTableView = function createTableView(node, view, getPos, portal
|
|
|
311
311
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
312
312
|
// same as options.isTableScalingEnabled
|
|
313
313
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
314
|
-
isCommentEditor: isCommentEditor
|
|
314
|
+
isCommentEditor: isCommentEditor,
|
|
315
|
+
isChromelessEditor: isChromelessEditor
|
|
315
316
|
},
|
|
316
317
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
317
318
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
package/dist/esm/plugin.js
CHANGED
|
@@ -197,8 +197,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
197
197
|
dragAndDropEnabled = _ref3.dragAndDropEnabled,
|
|
198
198
|
isTableScalingEnabled = _ref3.isTableScalingEnabled,
|
|
199
199
|
isTableAlignmentEnabled = _ref3.isTableAlignmentEnabled,
|
|
200
|
-
isCommentEditor = _ref3.isCommentEditor
|
|
201
|
-
|
|
200
|
+
isCommentEditor = _ref3.isCommentEditor,
|
|
201
|
+
isChromelessEditor = _ref3.isChromelessEditor;
|
|
202
|
+
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor);
|
|
202
203
|
}
|
|
203
204
|
}, {
|
|
204
205
|
name: 'tablePMColResizing',
|
|
@@ -426,7 +427,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
426
427
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
427
428
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
428
429
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
429
|
-
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
|
|
430
|
+
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
|
|
431
|
+
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor
|
|
430
432
|
}), (options === null || options === void 0 ? void 0 : options.allowContextualMenu) && /*#__PURE__*/React.createElement(FloatingContextualMenu, {
|
|
431
433
|
editorView: editorView,
|
|
432
434
|
mountPoint: popupsMountPoint,
|
|
@@ -23,7 +23,7 @@ import { isHeaderRowRequired } from '../utils/paste';
|
|
|
23
23
|
import { defaultHoveredCell, defaultTableSelection } from './default-table-selection';
|
|
24
24
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
25
25
|
import { pluginKey } from './plugin-key';
|
|
26
|
-
export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor) {
|
|
26
|
+
export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor) {
|
|
27
27
|
var _accessibilityUtils;
|
|
28
28
|
var state = createPluginState(dispatch, _objectSpread(_objectSpread(_objectSpread({
|
|
29
29
|
pluginConfig: pluginConfig,
|
|
@@ -195,11 +195,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
195
195
|
if (!pluginConfig.allowBackgroundColor) {
|
|
196
196
|
slice = transformSliceRemoveCellBackgroundColor(slice, schema);
|
|
197
197
|
}
|
|
198
|
-
|
|
199
|
-
// If a partial paste of nested expand, paste only nested-expand's content */
|
|
200
|
-
if (fg('platform.editor.transform-slice-for-nested-expand')) {
|
|
201
|
-
slice = transformSliceToRemoveOpenNestedExpand(slice, schema);
|
|
202
|
-
}
|
|
198
|
+
slice = transformSliceToRemoveOpenNestedExpand(slice, schema);
|
|
203
199
|
return slice;
|
|
204
200
|
},
|
|
205
201
|
handleClick: function handleClick(_ref2, _pos, event) {
|
|
@@ -257,7 +253,8 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
257
253
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
258
254
|
pluginInjectionApi: pluginInjectionApi,
|
|
259
255
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
260
|
-
isCommentEditor: isCommentEditor
|
|
256
|
+
isCommentEditor: isCommentEditor,
|
|
257
|
+
isChromelessEditor: isChromelessEditor
|
|
261
258
|
}),
|
|
262
259
|
tableRow: lazyTableRowView({
|
|
263
260
|
eventDispatcher: eventDispatcher
|
|
@@ -2,8 +2,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
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; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
// Resize a given column by an amount from the current state
|
|
5
|
-
|
|
6
|
-
import { akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
5
|
+
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
6
|
+
import { akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
7
7
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
8
8
|
import { ALIGN_CENTER, ALIGN_START, shouldChangeAlignmentToCenterResized } from '../../../utils/alignment';
|
|
9
9
|
import { getTableScalingPercent } from './misc';
|
|
@@ -33,17 +33,18 @@ export var resizeColumnAndTable = function resizeColumnAndTable(_ref) {
|
|
|
33
33
|
isTableAlignmentEnabled = _ref.isTableAlignmentEnabled;
|
|
34
34
|
var editorContainerWidth = getEditorContainerWidth(editorWidth);
|
|
35
35
|
var isTableLeftAligned = tableNode.attrs.layout === ALIGN_START;
|
|
36
|
+
var isNumberColumnEnabled = tableNode.attrs.isNumberColumnEnabled;
|
|
37
|
+
var isOverflow = resizeState.tableWidth > resizeState.maxSize;
|
|
36
38
|
var resizeAmount = isTableLeftAligned ? amount : amount * 2;
|
|
37
39
|
var willTableHitEditorEdge = resizeState.maxSize + resizeAmount > editorContainerWidth;
|
|
38
|
-
var willResizedTableStayInOverflow =
|
|
40
|
+
var willResizedTableStayInOverflow = isOverflow && resizeState.tableWidth + resizeAmount / 2 > resizeState.maxSize;
|
|
39
41
|
|
|
40
42
|
// STEP 1: Update col width
|
|
41
43
|
if (willTableHitEditorEdge || willResizedTableStayInOverflow) {
|
|
42
44
|
var _tableRef$closest;
|
|
43
45
|
var tableContainerWidth = (_tableRef$closest = tableRef.closest('.pm-table-container')) === null || _tableRef$closest === void 0 ? void 0 : _tableRef$closest.clientWidth;
|
|
44
46
|
resizeAmount = amount < 0 ? amount : resizeAmount - (resizeState.maxSize + resizeAmount - tableContainerWidth) / 2;
|
|
45
|
-
}
|
|
46
|
-
if (!willResizedTableStayInOverflow && !willTableHitEditorEdge) {
|
|
47
|
+
} else {
|
|
47
48
|
var diff = -(resizeState.tableWidth - resizeState.maxSize);
|
|
48
49
|
var rest = amount - diff;
|
|
49
50
|
var final = isTableLeftAligned ? diff + rest : diff + rest * 2;
|
|
@@ -54,25 +55,23 @@ export var resizeColumnAndTable = function resizeColumnAndTable(_ref) {
|
|
|
54
55
|
// STEP 2: Update table container width
|
|
55
56
|
// columns have a min width, so delta !== resizeAmount when this is reached, use this for calculations
|
|
56
57
|
var delta = newState.cols[colIndex].width - resizeState.cols[colIndex].width;
|
|
57
|
-
newState.maxSize = Math.round(
|
|
58
|
+
newState.maxSize = Math.round(isOverflow ? willResizedTableStayInOverflow ?
|
|
58
59
|
// CASE 1A: table will stay in overflow
|
|
59
60
|
// do not grow the table because resize is happening in the overflow region
|
|
60
61
|
// and the overall table container needs to be retained
|
|
61
|
-
resizeState.maxSize :
|
|
62
|
+
isNumberColumnEnabled ? resizeState.maxSize + akEditorTableNumberColumnWidth : resizeState.maxSize :
|
|
62
63
|
// CASE 1B: table will no longer be in overflow, so adjust container width
|
|
63
64
|
// ensure the table is resized without any 'big jumps' by working out
|
|
64
65
|
// the difference between the new table width and the max size and adding the resize
|
|
65
|
-
resizeState.maxSize + (resizeState.tableWidth - resizeState.maxSize + delta) : willTableHitEditorEdge ?
|
|
66
|
+
isNumberColumnEnabled ? resizeState.maxSize + akEditorTableNumberColumnWidth + (resizeState.tableWidth - resizeState.maxSize + akEditorTableNumberColumnWidth + delta) : resizeState.maxSize + (resizeState.tableWidth - resizeState.maxSize + delta) : willTableHitEditorEdge ?
|
|
66
67
|
// CASE 2: table will hit editor edge
|
|
67
68
|
editorContainerWidth :
|
|
68
69
|
// CASE 3: table is being resized from a non-overflow state
|
|
69
|
-
resizeState.maxSize + delta);
|
|
70
|
+
isNumberColumnEnabled ? resizeState.maxSize + akEditorTableNumberColumnWidth + delta : resizeState.maxSize + delta);
|
|
70
71
|
|
|
71
72
|
// do not apply scaling logic because resize state is already scaled
|
|
72
73
|
updateColgroup(newState, tableRef, tableNode, false, false);
|
|
73
|
-
|
|
74
|
-
updateTablePreview(tableRef, newState.maxSize, shouldChangeAlignmentToCenterResized(isTableAlignmentEnabled, tableNode, lineLength, newState.maxSize));
|
|
75
|
-
}
|
|
74
|
+
updateTablePreview(tableRef, newState.maxSize, shouldChangeAlignmentToCenterResized(isTableAlignmentEnabled, tableNode, lineLength, newState.maxSize));
|
|
76
75
|
return newState;
|
|
77
76
|
};
|
|
78
77
|
var updateTablePreview = function updateTablePreview(tableRef, newTableWidth, shouldChangeAlignment) {
|
|
@@ -100,37 +99,52 @@ export var scaleResizeState = function scaleResizeState(_ref2) {
|
|
|
100
99
|
tableRef = _ref2.tableRef,
|
|
101
100
|
tableNode = _ref2.tableNode,
|
|
102
101
|
editorWidth = _ref2.editorWidth;
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
var isNumberColumnEnabled = tableNode.attrs.isNumberColumnEnabled;
|
|
103
|
+
var isTableScaled = isNumberColumnEnabled || resizeState.maxSize > getEditorContainerWidth(editorWidth);
|
|
104
|
+
|
|
105
|
+
// Tables with number column can cause the table to be in two different states:
|
|
106
|
+
// 1. The table sum of col widths will be smaller than the max size, which is incorrect. For this
|
|
107
|
+
// avoid scaling and take the document width
|
|
108
|
+
// 2. The table sum of col widths will be the same size as max width, which happens when the table
|
|
109
|
+
// is scaled using preserve table width logic, for this apply a scaled width
|
|
110
|
+
// return early if table isn't scaled
|
|
111
|
+
if (!isTableScaled || isNumberColumnEnabled && resizeState.maxSize > resizeState.tableWidth) {
|
|
105
112
|
return resizeState;
|
|
106
113
|
}
|
|
107
114
|
var scalePercent = getTableScalingPercent(tableNode, tableRef);
|
|
115
|
+
var scaledTableWidth = Math.round(resizeState.tableWidth * scalePercent);
|
|
108
116
|
var cols = resizeState.cols.map(function (col) {
|
|
109
117
|
return _objectSpread(_objectSpread({}, col), {}, {
|
|
110
|
-
|
|
118
|
+
minWidth: tableCellMinWidth,
|
|
119
|
+
width: Math.max(Math.round(col.width * scalePercent), tableCellMinWidth)
|
|
111
120
|
});
|
|
112
121
|
});
|
|
113
|
-
var scaledTableWidth = Math.round(resizeState.tableWidth * scalePercent);
|
|
114
122
|
var calculatedTableWidth = cols.reduce(function (prev, curr) {
|
|
115
123
|
return prev + curr.width;
|
|
116
124
|
}, 0);
|
|
117
125
|
|
|
118
126
|
// using Math.round can cause the sum of col widths to be larger than the table width
|
|
119
|
-
// distribute the difference to the
|
|
127
|
+
// distribute the difference to the first column
|
|
120
128
|
if (calculatedTableWidth > scaledTableWidth) {
|
|
121
129
|
var diff = calculatedTableWidth - scaledTableWidth;
|
|
130
|
+
var hasDiffBeenDistributed = false;
|
|
122
131
|
cols = cols.map(function (col) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
132
|
+
if (!hasDiffBeenDistributed && col.width - diff >= col.minWidth) {
|
|
133
|
+
hasDiffBeenDistributed = true;
|
|
134
|
+
return _objectSpread(_objectSpread({}, col), {}, {
|
|
135
|
+
width: col.width - diff
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return col;
|
|
126
139
|
});
|
|
127
140
|
}
|
|
141
|
+
var maxSize = isNumberColumnEnabled ? Math.round((resizeState.maxSize + akEditorTableNumberColumnWidth) * scalePercent) : Math.round(resizeState.maxSize * scalePercent);
|
|
128
142
|
return _objectSpread(_objectSpread({}, resizeState), {}, {
|
|
129
143
|
widths: cols.map(function (col) {
|
|
130
144
|
return col.width;
|
|
131
145
|
}),
|
|
132
146
|
tableWidth: scaledTableWidth,
|
|
133
|
-
maxSize:
|
|
147
|
+
maxSize: maxSize,
|
|
134
148
|
cols: cols
|
|
135
149
|
});
|
|
136
150
|
};
|
|
@@ -231,6 +231,9 @@ export function updateAffectedColumn(resizeState, colIndex, resizeAmount) {
|
|
|
231
231
|
return col;
|
|
232
232
|
});
|
|
233
233
|
return _objectSpread(_objectSpread({}, resizeState), {}, {
|
|
234
|
+
tableWidth: updatedCols.reduce(function (acc, col) {
|
|
235
|
+
return acc + col.width;
|
|
236
|
+
}, 0),
|
|
234
237
|
cols: updatedCols
|
|
235
238
|
});
|
|
236
239
|
}
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -209,19 +209,22 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
209
209
|
onMouseLeave: clearHoverSelection(),
|
|
210
210
|
selected: false,
|
|
211
211
|
disabled: false
|
|
212
|
-
}, {
|
|
213
|
-
id: 'editor.table.mergeCells',
|
|
214
|
-
title: formatMessage(messages.mergeCells),
|
|
215
|
-
onClick: mergeCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB),
|
|
216
|
-
selected: false,
|
|
217
|
-
disabled: !canMergeCells(editorState.tr)
|
|
218
|
-
}, {
|
|
219
|
-
id: 'editor.table.splitCell',
|
|
220
|
-
title: formatMessage(messages.splitCell),
|
|
221
|
-
onClick: splitCellWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB),
|
|
222
|
-
selected: false,
|
|
223
|
-
disabled: !splitCell(editorState)
|
|
224
212
|
}];
|
|
213
|
+
if (pluginState.pluginConfig.allowMergeCells) {
|
|
214
|
+
options.push({
|
|
215
|
+
id: 'editor.table.mergeCells',
|
|
216
|
+
title: formatMessage(messages.mergeCells),
|
|
217
|
+
onClick: mergeCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB),
|
|
218
|
+
selected: false,
|
|
219
|
+
disabled: !canMergeCells(editorState.tr)
|
|
220
|
+
}, {
|
|
221
|
+
id: 'editor.table.splitCell',
|
|
222
|
+
title: formatMessage(messages.splitCell),
|
|
223
|
+
onClick: splitCellWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB),
|
|
224
|
+
selected: false,
|
|
225
|
+
disabled: !splitCell(editorState)
|
|
226
|
+
});
|
|
227
|
+
}
|
|
225
228
|
if (pluginState !== null && pluginState !== void 0 && (_pluginState$pluginCo = pluginState.pluginConfig) !== null && _pluginState$pluginCo !== void 0 && _pluginState$pluginCo.allowDistributeColumns) {
|
|
226
229
|
var _newResizeStateWithAn;
|
|
227
230
|
var newResizeStateWithAnalytics = editorView ? getNewResizeStateFromSelectedColumns(initialSelectionRect, editorState, editorView.domAtPos.bind(editorView), getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled) : undefined;
|
package/dist/esm/types.js
CHANGED
|
@@ -75,6 +75,7 @@ export var TableCssClassName = _objectSpread(_objectSpread({}, TableSharedCssCla
|
|
|
75
75
|
DRAG_CONTROLS_INSERT_BUTTON_INNER: "".concat(tablePrefixSelector, "-controls__drag-insert-button-inner"),
|
|
76
76
|
DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN: "".concat(tablePrefixSelector, "-controls__drag-insert-button-inner-column"),
|
|
77
77
|
DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW: "".concat(tablePrefixSelector, "-controls__drag-insert-button-inner-row"),
|
|
78
|
+
DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW_CHROMELESS: "".concat(tablePrefixSelector, "-controls__drag-insert-button-inner-row-chromeless"),
|
|
78
79
|
DRAG_CONTROLS_INSERT_BUTTON_WRAP: "".concat(tablePrefixSelector, "-controls__drag-insert-button-wrap"),
|
|
79
80
|
CONTROLS_INSERT_MARKER: "".concat(tablePrefixSelector, "-controls__insert-marker"),
|
|
80
81
|
CONTROLS_INSERT_COLUMN: "".concat(tablePrefixSelector, "-controls__insert-column"),
|
|
@@ -90,6 +91,7 @@ export var TableCssClassName = _objectSpread(_objectSpread({}, TableSharedCssCla
|
|
|
90
91
|
/** drag and drop controls */
|
|
91
92
|
DRAG_ROW_CONTROLS_WRAPPER: "".concat(tablePrefixSelector, "-drag-row-controls-wrapper"),
|
|
92
93
|
DRAG_ROW_CONTROLS: "".concat(tablePrefixSelector, "-drag-row-controls"),
|
|
94
|
+
DRAG_CONTROLS_CHROMELESS: "drag-controls-chromeless",
|
|
93
95
|
DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER: "".concat(tablePrefixSelector, "-drag-row-floating-insert-dot-wrapper"),
|
|
94
96
|
DRAG_ROW_FLOATING_INSERT_DOT: "".concat(tablePrefixSelector, "-drag-row-floating-insert-dot"),
|
|
95
97
|
DRAG_COLUMN_CONTROLS: "".concat(tablePrefixSelector, "-drag-column-controls"),
|
|
@@ -208,8 +208,9 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
208
208
|
editorView = _this$props3.editorView;
|
|
209
209
|
var _getPluginState3 = getPluginState(editorView.state),
|
|
210
210
|
isDragAndDropEnabled = _getPluginState3.isDragAndDropEnabled;
|
|
211
|
+
var content = formatMessage(isDragAndDropEnabled ? messages.addColumnRight : messages.insertColumn);
|
|
211
212
|
return {
|
|
212
|
-
content:
|
|
213
|
+
content: content,
|
|
213
214
|
value: {
|
|
214
215
|
name: 'insert_column'
|
|
215
216
|
},
|
|
@@ -221,7 +222,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
221
222
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
222
223
|
jsx("span", {
|
|
223
224
|
css: elementBeforeIconStyles
|
|
224
|
-
}, jsx(AddColRightIcon, null)) : undefined
|
|
225
|
+
}, jsx(AddColRightIcon, null)) : undefined,
|
|
226
|
+
'aria-label': fg('platform_editor_announce_cell_options_hotkeys') ? tooltip(addColumnAfter, String(content)) : undefined
|
|
225
227
|
};
|
|
226
228
|
});
|
|
227
229
|
_defineProperty(_assertThisInitialized(_this), "createInsertRowItem", function () {
|
|
@@ -230,8 +232,9 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
230
232
|
editorView = _this$props4.editorView;
|
|
231
233
|
var _getPluginState4 = getPluginState(editorView.state),
|
|
232
234
|
isDragAndDropEnabled = _getPluginState4.isDragAndDropEnabled;
|
|
235
|
+
var content = formatMessage(isDragAndDropEnabled ? messages.addRowBelow : messages.insertRow);
|
|
233
236
|
return {
|
|
234
|
-
content:
|
|
237
|
+
content: content,
|
|
235
238
|
value: {
|
|
236
239
|
name: 'insert_row'
|
|
237
240
|
},
|
|
@@ -243,7 +246,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
243
246
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
244
247
|
jsx("span", {
|
|
245
248
|
css: elementBeforeIconStyles
|
|
246
|
-
}, jsx(AddRowBelowIcon, null)) : undefined
|
|
249
|
+
}, jsx(AddRowBelowIcon, null)) : undefined,
|
|
250
|
+
'aria-label': fg('platform_editor_announce_cell_options_hotkeys') ? tooltip(addRowAfter, String(content)) : undefined
|
|
247
251
|
};
|
|
248
252
|
});
|
|
249
253
|
_defineProperty(_assertThisInitialized(_this), "createClearCellsItem", function () {
|
|
@@ -259,10 +263,11 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
259
263
|
left = selectionRect.left;
|
|
260
264
|
var noOfColumns = right - left;
|
|
261
265
|
var noOfRows = bottom - top;
|
|
266
|
+
var content = formatMessage(messages.clearCells, {
|
|
267
|
+
0: Math.max(noOfColumns, noOfRows)
|
|
268
|
+
});
|
|
262
269
|
return {
|
|
263
|
-
content:
|
|
264
|
-
0: Math.max(noOfColumns, noOfRows)
|
|
265
|
-
}),
|
|
270
|
+
content: content,
|
|
266
271
|
value: {
|
|
267
272
|
name: 'clear'
|
|
268
273
|
},
|
|
@@ -278,7 +283,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
278
283
|
label: formatMessage(messages.clearCells, {
|
|
279
284
|
0: Math.max(noOfColumns, noOfRows)
|
|
280
285
|
})
|
|
281
|
-
})) : undefined
|
|
286
|
+
})) : undefined,
|
|
287
|
+
'aria-label': fg('platform_editor_announce_cell_options_hotkeys') ? tooltip(backspace, String(content)) : undefined
|
|
282
288
|
};
|
|
283
289
|
});
|
|
284
290
|
_defineProperty(_assertThisInitialized(_this), "createDeleteColumnItem", function () {
|
|
@@ -34,12 +34,12 @@ var getNumberColumnWidth = function getNumberColumnWidth(tableRef, isDragAndDrop
|
|
|
34
34
|
}
|
|
35
35
|
return 0;
|
|
36
36
|
};
|
|
37
|
-
var getInsertLineWidth = function getInsertLineWidth(tableRef, isDragAndDropEnabled) {
|
|
37
|
+
var getInsertLineWidth = function getInsertLineWidth(tableRef, isDragAndDropEnabled, isChromelessEditor) {
|
|
38
38
|
// The line gets width 100% from the table,
|
|
39
39
|
// but since we have an overflow on the left,
|
|
40
40
|
// we should add an offset to make up for it.
|
|
41
41
|
var LINE_OFFSET = 4;
|
|
42
|
-
var DRAG_LINE_OFFSET = 6;
|
|
42
|
+
var DRAG_LINE_OFFSET = isChromelessEditor ? 14 : 6;
|
|
43
43
|
var parentElement = tableRef.parentElement,
|
|
44
44
|
offsetWidth = tableRef.offsetWidth;
|
|
45
45
|
var parentOffsetWidth = parentElement.offsetWidth;
|
|
@@ -59,7 +59,8 @@ export var InsertButtonForDragAndDrop = function InsertButtonForDragAndDrop(_ref
|
|
|
59
59
|
tableRef = _ref2.tableRef,
|
|
60
60
|
type = _ref2.type,
|
|
61
61
|
formatMessage = _ref2.intl.formatMessage,
|
|
62
|
-
hasStickyHeaders = _ref2.hasStickyHeaders
|
|
62
|
+
hasStickyHeaders = _ref2.hasStickyHeaders,
|
|
63
|
+
isChromelessEditor = _ref2.isChromelessEditor;
|
|
63
64
|
var isRow = type === 'row';
|
|
64
65
|
var content = /*#__PURE__*/React.createElement(Tooltip, {
|
|
65
66
|
content: /*#__PURE__*/React.createElement(ToolTipContent, {
|
|
@@ -69,7 +70,7 @@ export var InsertButtonForDragAndDrop = function InsertButtonForDragAndDrop(_ref
|
|
|
69
70
|
position: "top"
|
|
70
71
|
}, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
71
72
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
72
|
-
className: classnames(ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER, (_classnames = {}, _defineProperty(_classnames, ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW, isRow), _defineProperty(_classnames, ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN, !isRow), _classnames))
|
|
73
|
+
className: classnames(ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER, (_classnames = {}, _defineProperty(_classnames, ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW, isRow && !isChromelessEditor), _defineProperty(_classnames, ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN, !isRow), _defineProperty(_classnames, ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW_CHROMELESS, isRow && isChromelessEditor), _classnames))
|
|
73
74
|
}, /*#__PURE__*/React.createElement("button", {
|
|
74
75
|
type: "button"
|
|
75
76
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -93,7 +94,7 @@ export var InsertButtonForDragAndDrop = function InsertButtonForDragAndDrop(_ref
|
|
|
93
94
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
94
95
|
,
|
|
95
96
|
style: type === 'row' ? {
|
|
96
|
-
width: getInsertLineWidth(tableRef, true),
|
|
97
|
+
width: getInsertLineWidth(tableRef, true, isChromelessEditor),
|
|
97
98
|
left: "var(--ds-space-150, 12px)"
|
|
98
99
|
} : {
|
|
99
100
|
height: getInsertLineHeight(tableRef, hasStickyHeaders, true) - 8,
|
|
@@ -18,7 +18,7 @@ import { akEditorTableCellOnStickyHeaderZIndex } from '@atlaskit/editor-shared-s
|
|
|
18
18
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
19
19
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
20
20
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
21
|
-
import {
|
|
21
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import { insertColumnWithAnalytics, insertRowWithAnalytics } from '../../commands-with-analytics';
|
|
23
23
|
import { TableCssClassName as ClassName } from '../../types';
|
|
24
24
|
import { checkIfNumberColumnEnabled } from '../../utils';
|
|
@@ -49,7 +49,8 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
|
|
|
49
49
|
isHeaderColumnEnabled = _this$props.isHeaderColumnEnabled,
|
|
50
50
|
isHeaderRowEnabled = _this$props.isHeaderRowEnabled,
|
|
51
51
|
isDragAndDropEnabled = _this$props.isDragAndDropEnabled,
|
|
52
|
-
dispatchAnalyticsEvent = _this$props.dispatchAnalyticsEvent
|
|
52
|
+
dispatchAnalyticsEvent = _this$props.dispatchAnalyticsEvent,
|
|
53
|
+
isChromelessEditor = _this$props.isChromelessEditor;
|
|
53
54
|
|
|
54
55
|
// TODO: temporarily disable insert button for first column and row https://atlassian.slack.com/archives/C05U8HRQM50/p1698363744682219?thread_ts=1698209039.104909&cid=C05U8HRQM50
|
|
55
56
|
if (isDragAndDropEnabled && (insertColumnButtonIndex === 0 || insertRowButtonIndex === 0)) {
|
|
@@ -134,7 +135,8 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
|
|
|
134
135
|
type: type,
|
|
135
136
|
tableRef: tableRef,
|
|
136
137
|
onMouseDown: type === 'column' ? this.insertColumn : this.insertRow,
|
|
137
|
-
hasStickyHeaders: this.props.hasStickyHeaders || false
|
|
138
|
+
hasStickyHeaders: this.props.hasStickyHeaders || false,
|
|
139
|
+
isChromelessEditor: isChromelessEditor
|
|
138
140
|
}) : /*#__PURE__*/React.createElement(InsertButton, {
|
|
139
141
|
type: type,
|
|
140
142
|
tableRef: tableRef,
|
|
@@ -198,7 +200,7 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
|
|
|
198
200
|
tableDuplicateCellColouring = _ref$tableDuplicateCe === void 0 ? false : _ref$tableDuplicateCe,
|
|
199
201
|
_ref$tableWithFixedCo = _ref.tableWithFixedColumnWidthsOption,
|
|
200
202
|
tableWithFixedColumnWidthsOption = _ref$tableWithFixedCo === void 0 ? false : _ref$tableWithFixedCo;
|
|
201
|
-
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption &&
|
|
203
|
+
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && fg('platform.editor.table.use-increased-scaling-percent');
|
|
202
204
|
var state = editorView.state,
|
|
203
205
|
dispatch = editorView.dispatch;
|
|
204
206
|
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring, tableWithFixedColumnWidthsOption, shouldUseIncreasedScalingPercent)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
|