@atlaskit/editor-plugin-table 7.16.7 → 7.16.9
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 +17 -0
- package/dist/cjs/commands/misc.js +11 -1
- package/dist/cjs/nodeviews/ExternalDropTargets.js +4 -0
- package/dist/cjs/nodeviews/TableComponent.js +28 -5
- package/dist/cjs/nodeviews/TableContainer.js +38 -12
- package/dist/cjs/nodeviews/TableResizer.js +27 -6
- package/dist/cjs/toolbar.js +17 -7
- package/dist/cjs/ui/ColumnResizeWidget/index.js +2 -0
- package/dist/cjs/ui/DragHandle/index.js +10 -3
- package/dist/cjs/ui/DragPreview/index.js +1 -0
- package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +12 -1
- package/dist/cjs/ui/FloatingContextualButton/index.js +3 -1
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +7 -2
- package/dist/cjs/ui/FloatingDeleteButton/DeleteButton.js +7 -2
- package/dist/cjs/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +7 -2
- package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +61 -57
- package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +36 -14
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +22 -4
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +2 -0
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +4 -1
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +3 -1
- package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +12 -3
- package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +2 -0
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +13 -4
- package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +50 -43
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +16 -2
- package/dist/cjs/ui/TableFloatingControls/RowDropTarget/index.js +3 -1
- package/dist/cjs/ui/TableFloatingControls/index.js +80 -76
- package/dist/cjs/ui/icons/DragHandleDisabledIcon.js +3 -1
- package/dist/cjs/ui/icons/DragInMotionIcon.js +3 -1
- package/dist/cjs/ui/icons/MinimisedHandle.js +1 -0
- package/dist/es2019/commands/misc.js +10 -0
- package/dist/es2019/nodeviews/ExternalDropTargets.js +4 -0
- package/dist/es2019/nodeviews/TableComponent.js +28 -5
- package/dist/es2019/nodeviews/TableContainer.js +37 -12
- package/dist/es2019/nodeviews/TableResizer.js +27 -6
- package/dist/es2019/toolbar.js +13 -3
- package/dist/es2019/ui/ColumnResizeWidget/index.js +2 -0
- package/dist/es2019/ui/DragHandle/index.js +10 -3
- package/dist/es2019/ui/DragPreview/index.js +1 -0
- package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +12 -1
- package/dist/es2019/ui/FloatingContextualButton/index.js +3 -1
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +7 -2
- package/dist/es2019/ui/FloatingDeleteButton/DeleteButton.js +7 -2
- package/dist/es2019/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +7 -2
- package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +56 -52
- package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +36 -14
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +22 -4
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +2 -0
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +4 -1
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +3 -1
- package/dist/es2019/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +12 -3
- package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +2 -0
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +13 -4
- package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +47 -40
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +16 -2
- package/dist/es2019/ui/TableFloatingControls/RowDropTarget/index.js +3 -1
- package/dist/es2019/ui/TableFloatingControls/index.js +78 -74
- package/dist/es2019/ui/icons/DragHandleDisabledIcon.js +3 -1
- package/dist/es2019/ui/icons/DragInMotionIcon.js +3 -1
- package/dist/es2019/ui/icons/MinimisedHandle.js +1 -0
- package/dist/esm/commands/misc.js +10 -0
- package/dist/esm/nodeviews/ExternalDropTargets.js +4 -0
- package/dist/esm/nodeviews/TableComponent.js +28 -5
- package/dist/esm/nodeviews/TableContainer.js +38 -12
- package/dist/esm/nodeviews/TableResizer.js +29 -8
- package/dist/esm/toolbar.js +16 -4
- package/dist/esm/ui/ColumnResizeWidget/index.js +2 -0
- package/dist/esm/ui/DragHandle/index.js +10 -3
- package/dist/esm/ui/DragPreview/index.js +1 -0
- package/dist/esm/ui/FloatingContextualButton/FixedButton.js +12 -1
- package/dist/esm/ui/FloatingContextualButton/index.js +3 -1
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +7 -2
- package/dist/esm/ui/FloatingDeleteButton/DeleteButton.js +7 -2
- package/dist/esm/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +7 -2
- package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +61 -57
- package/dist/esm/ui/FloatingInsertButton/InsertButton.js +36 -14
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +22 -4
- package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +2 -0
- package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +4 -1
- package/dist/esm/ui/TableFloatingColumnControls/index.js +3 -1
- package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +12 -3
- package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +2 -0
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +13 -4
- package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +50 -43
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +16 -2
- package/dist/esm/ui/TableFloatingControls/RowDropTarget/index.js +3 -1
- package/dist/esm/ui/TableFloatingControls/index.js +80 -76
- package/dist/esm/ui/icons/DragHandleDisabledIcon.js +3 -1
- package/dist/esm/ui/icons/DragInMotionIcon.js +3 -1
- package/dist/esm/ui/icons/MinimisedHandle.js +1 -0
- package/dist/types/commands/misc.d.ts +2 -1
- package/dist/types/nodeviews/TableContainer.d.ts +3 -2
- package/dist/types/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types/toolbar.d.ts +2 -1
- package/dist/types-ts4.5/commands/misc.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +3 -2
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/toolbar.d.ts +2 -1
- package/docs/0-intro.tsx +1 -0
- package/package.json +2 -2
- package/src/commands/misc.ts +20 -1
- package/src/nodeviews/ExternalDropTargets.tsx +4 -0
- package/src/nodeviews/TableComponent.tsx +18 -0
- package/src/nodeviews/TableContainer.tsx +17 -1
- package/src/nodeviews/TableResizer.tsx +52 -6
- package/src/toolbar.tsx +20 -1
- package/src/ui/ColumnResizeWidget/index.tsx +2 -0
- package/src/ui/DragHandle/index.tsx +3 -0
- package/src/ui/DragPreview/index.tsx +1 -0
- package/src/ui/FloatingContextualButton/FixedButton.tsx +10 -0
- package/src/ui/FloatingContextualButton/index.tsx +1 -0
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +3 -0
- package/src/ui/FloatingDeleteButton/DeleteButton.tsx +4 -0
- package/src/ui/FloatingDeleteButton/index.tsx +2 -0
- package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -0
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +3 -0
- package/src/ui/FloatingInsertButton/InsertButton.tsx +14 -0
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +16 -1
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +2 -0
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +2 -0
- package/src/ui/TableFloatingColumnControls/index.tsx +1 -0
- package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +6 -0
- package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +4 -0
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +5 -0
- package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +5 -0
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +15 -1
- package/src/ui/TableFloatingControls/RowDropTarget/index.tsx +1 -0
- package/src/ui/TableFloatingControls/index.tsx +1 -0
- package/src/ui/icons/DragHandleDisabledIcon.tsx +1 -0
- package/src/ui/icons/DragInMotionIcon.tsx +1 -0
- package/src/ui/icons/MinimisedHandle.tsx +1 -0
|
@@ -76,81 +76,85 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
76
76
|
}
|
|
77
77
|
var stickyTop = stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
|
|
78
78
|
var wrapperClassName = isDragAndDropEnabled ? _types.TableCssClassName.DRAG_ROW_CONTROLS_WRAPPER : _types.TableCssClassName.ROW_CONTROLS_WRAPPER;
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
79
|
+
return (
|
|
80
|
+
/*#__PURE__*/
|
|
81
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
82
|
+
_react.default.createElement("div", {
|
|
83
|
+
className: wrapperClassName
|
|
84
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
85
|
+
onMouseDown: function onMouseDown(e) {
|
|
86
|
+
return !isDragAndDropEnabled && e.preventDefault();
|
|
87
|
+
}
|
|
88
|
+
}, isNumberColumnEnabled ? /*#__PURE__*/_react.default.createElement(_NumberColumn.default, {
|
|
89
|
+
editorView: editorView,
|
|
90
|
+
hoverRows: _hoverRows,
|
|
91
|
+
tableRef: tableRef,
|
|
92
|
+
tableActive: tableActive,
|
|
93
|
+
hoveredRows: hoveredRows,
|
|
94
|
+
hasHeaderRow: hasHeaderRow,
|
|
95
|
+
isInDanger: isInDanger,
|
|
96
|
+
isResizing: isResizing,
|
|
97
|
+
selectRow: _selectRow,
|
|
98
|
+
updateCellHoverLocation: updateCellHoverLocation,
|
|
99
|
+
stickyTop: stickyTop,
|
|
100
|
+
isDragAndDropEnabled: isDragAndDropEnabled
|
|
101
|
+
}) : null, tableActive && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.use-shared-state-hook') ? /*#__PURE__*/_react.default.createElement(_CornerControls.DragCornerControlsWithSelection, {
|
|
102
|
+
editorView: editorView,
|
|
103
|
+
tableRef: tableRef,
|
|
104
|
+
isInDanger: isInDanger,
|
|
105
|
+
isResizing: isResizing,
|
|
106
|
+
api: api
|
|
107
|
+
}) : /*#__PURE__*/_react.default.createElement(_CornerControls.DragCornerControls, {
|
|
108
|
+
editorView: editorView,
|
|
109
|
+
tableRef: tableRef,
|
|
110
|
+
isInDanger: isInDanger,
|
|
111
|
+
isResizing: isResizing
|
|
112
|
+
}), /*#__PURE__*/_react.default.createElement(_RowControls.DragControls, {
|
|
113
|
+
tableRef: tableRef,
|
|
114
|
+
tableNode: tableNode,
|
|
115
|
+
hoveredCell: hoveredCell,
|
|
116
|
+
isTableHovered: isTableHovered,
|
|
117
|
+
editorView: editorView,
|
|
118
|
+
tableActive: tableActive,
|
|
119
|
+
isInDanger: isInDanger,
|
|
120
|
+
isResizing: isResizing,
|
|
121
|
+
tableWidth: tableWrapperWidth,
|
|
122
|
+
hoverRows: _hoverRows,
|
|
123
|
+
selectRow: _selectRow,
|
|
124
|
+
selectRows: _selectRows,
|
|
125
|
+
updateCellHoverLocation: updateCellHoverLocation
|
|
126
|
+
})) : (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.use-shared-state-hook') ? /*#__PURE__*/_react.default.createElement(_FloatingControlsWithSelection.FloatingControlsWithSelection, {
|
|
127
|
+
editorView: editorView,
|
|
128
|
+
tableRef: tableRef,
|
|
129
|
+
isInDanger: isInDanger,
|
|
130
|
+
isResizing: isResizing,
|
|
131
|
+
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
132
|
+
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
133
|
+
hoveredRows: hoveredRows,
|
|
134
|
+
stickyTop: tableActive ? stickyTop : undefined,
|
|
135
|
+
tableActive: tableActive,
|
|
136
|
+
hoverRows: _hoverRows,
|
|
137
|
+
selectRow: _selectRow,
|
|
138
|
+
api: api
|
|
139
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_CornerControls.CornerControls, {
|
|
140
|
+
editorView: editorView,
|
|
141
|
+
tableRef: tableRef,
|
|
142
|
+
isInDanger: isInDanger,
|
|
143
|
+
isResizing: isResizing,
|
|
144
|
+
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
145
|
+
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
146
|
+
hoveredRows: hoveredRows,
|
|
147
|
+
stickyTop: tableActive ? stickyTop : undefined
|
|
148
|
+
}), /*#__PURE__*/_react.default.createElement(_RowControls.RowControls, {
|
|
149
|
+
editorView: editorView,
|
|
150
|
+
tableRef: tableRef,
|
|
151
|
+
hoverRows: _hoverRows,
|
|
152
|
+
hoveredRows: hoveredRows,
|
|
153
|
+
isInDanger: isInDanger,
|
|
154
|
+
isResizing: isResizing,
|
|
155
|
+
selectRow: _selectRow,
|
|
156
|
+
stickyTop: tableActive ? stickyTop : undefined
|
|
157
|
+
})))))
|
|
158
|
+
);
|
|
155
159
|
};
|
|
156
160
|
var _default = exports.default = TableFloatingControls;
|
|
@@ -13,7 +13,9 @@ var DragHandleDisabledIcon = exports.DragHandleDisabledIcon = function DragHandl
|
|
|
13
13
|
height: "16",
|
|
14
14
|
viewBox: "0 0 24 16",
|
|
15
15
|
fill: "none",
|
|
16
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
18
|
+
,
|
|
17
19
|
style: style,
|
|
18
20
|
"data-testid": "drag-icon-disabled"
|
|
19
21
|
}, /*#__PURE__*/_react.default.createElement("rect", {
|
|
@@ -13,7 +13,9 @@ var DragInMotionIcon = exports.DragInMotionIcon = function DragInMotionIcon(_ref
|
|
|
13
13
|
height: "20",
|
|
14
14
|
viewBox: "0 0 28 20",
|
|
15
15
|
fill: "none",
|
|
16
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
18
|
+
,
|
|
17
19
|
style: style
|
|
18
20
|
}, /*#__PURE__*/_react.default.createElement("rect", {
|
|
19
21
|
x: "1",
|
|
@@ -14,6 +14,7 @@ var MinimisedHandleIcon = exports.MinimisedHandleIcon = function MinimisedHandle
|
|
|
14
14
|
height: "5",
|
|
15
15
|
fill: "none"
|
|
16
16
|
}, /*#__PURE__*/_react.default.createElement("rect", {
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
17
18
|
className: _types.TableCssClassName.DRAG_HANDLE_MINIMISED,
|
|
18
19
|
width: "24",
|
|
19
20
|
height: "5",
|
|
@@ -563,4 +563,14 @@ export const setTableAlignment = newAlignment => ({
|
|
|
563
563
|
};
|
|
564
564
|
tr.setNodeMarkup(tableObject.pos, undefined, nextTableAttrs).setMeta('scrollIntoView', false);
|
|
565
565
|
return tr;
|
|
566
|
+
};
|
|
567
|
+
export const setTableAlignmentWithTableContentWithPos = (newAlignment, tableNodeWithPos) => ({
|
|
568
|
+
tr
|
|
569
|
+
}) => {
|
|
570
|
+
const nextTableAttrs = {
|
|
571
|
+
...tableNodeWithPos.node.attrs,
|
|
572
|
+
layout: newAlignment
|
|
573
|
+
};
|
|
574
|
+
tr.setNodeMarkup(tableNodeWithPos.pos, undefined, nextTableAttrs).setMeta('scrollIntoView', false);
|
|
575
|
+
return tr;
|
|
566
576
|
};
|
|
@@ -39,16 +39,20 @@ export const ExternalDropTargets = ({
|
|
|
39
39
|
return /*#__PURE__*/React.createElement("div", {
|
|
40
40
|
style: {
|
|
41
41
|
width: getTableWrapperWidth(),
|
|
42
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
42
43
|
overflow: 'hidden',
|
|
44
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
43
45
|
position: 'absolute',
|
|
44
46
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
45
47
|
top: `-${dropTargetExtendedWidth - tableMarginTop}px`,
|
|
48
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
46
49
|
pointerEvents: 'auto',
|
|
47
50
|
zIndex: `${dropTargetsZIndex}`
|
|
48
51
|
},
|
|
49
52
|
"data-testid": "table-floating-column-extended-drop-targets"
|
|
50
53
|
}, /*#__PURE__*/React.createElement("div", {
|
|
51
54
|
style: {
|
|
55
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
52
56
|
display: 'flex',
|
|
53
57
|
// move drop targets based on table wrapper scroll
|
|
54
58
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
@@ -736,7 +736,9 @@ class TableComponent extends React.Component {
|
|
|
736
736
|
const {
|
|
737
737
|
stickyScrollbar
|
|
738
738
|
} = getEditorFeatureFlags();
|
|
739
|
-
return /*#__PURE__*/React.createElement(TableContainer
|
|
739
|
+
return /*#__PURE__*/React.createElement(TableContainer
|
|
740
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
741
|
+
, {
|
|
740
742
|
className: classnames(ClassName.TABLE_CONTAINER, {
|
|
741
743
|
[ClassName.WITH_CONTROLS]: allowControls && tableActive,
|
|
742
744
|
[ClassName.TABLE_STICKY]: this.state.stickyHeader && hasHeaderRow,
|
|
@@ -757,9 +759,11 @@ class TableComponent extends React.Component {
|
|
|
757
759
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
758
760
|
isTableAlignmentEnabled: isTableAlignmentEnabled
|
|
759
761
|
}, /*#__PURE__*/React.createElement("div", {
|
|
762
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
760
763
|
className: ClassName.TABLE_STICKY_SENTINEL_TOP,
|
|
761
764
|
"data-testid": "sticky-sentinel-top"
|
|
762
765
|
}), stickyScrollbar && /*#__PURE__*/React.createElement("div", {
|
|
766
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
763
767
|
className: ClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_TOP,
|
|
764
768
|
"data-testid": "sticky-scrollbar-sentinel-top"
|
|
765
769
|
}), allowControls && rowControls, isDragAndDropEnabled && /*#__PURE__*/React.createElement(ExternalDropTargets, {
|
|
@@ -774,10 +778,15 @@ class TableComponent extends React.Component {
|
|
|
774
778
|
return ((_this$wrapper4 = this.wrapper) === null || _this$wrapper4 === void 0 ? void 0 : _this$wrapper4.clientWidth) || 760;
|
|
775
779
|
}
|
|
776
780
|
}), /*#__PURE__*/React.createElement("div", {
|
|
777
|
-
contentEditable: false
|
|
778
|
-
style
|
|
781
|
+
contentEditable: false
|
|
782
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
783
|
+
,
|
|
784
|
+
style: shadowStyle(showBeforeShadow)
|
|
785
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
786
|
+
,
|
|
779
787
|
className: ClassName.TABLE_LEFT_SHADOW
|
|
780
788
|
}), this.state.stickyHeader && /*#__PURE__*/React.createElement("div", {
|
|
789
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
781
790
|
className: `${ClassName.TABLE_LEFT_SHADOW} ${ClassName.TABLE_STICKY_SHADOW}`,
|
|
782
791
|
style: {
|
|
783
792
|
visibility: showBeforeShadow && hasHeaderRow ? 'visible' : 'hidden',
|
|
@@ -785,6 +794,7 @@ class TableComponent extends React.Component {
|
|
|
785
794
|
paddingBottom: `${isDragAndDropEnabled && "var(--ds-space-025, 2px)"}`
|
|
786
795
|
}
|
|
787
796
|
}), /*#__PURE__*/React.createElement("div", {
|
|
797
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
788
798
|
className: classnames(ClassName.TABLE_NODE_WRAPPER),
|
|
789
799
|
ref: elem => {
|
|
790
800
|
this.wrapper = elem;
|
|
@@ -799,10 +809,13 @@ class TableComponent extends React.Component {
|
|
|
799
809
|
}
|
|
800
810
|
}
|
|
801
811
|
}, allowControls && colControls), stickyScrollbar && /*#__PURE__*/React.createElement("div", {
|
|
812
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
802
813
|
className: ClassName.TABLE_STICKY_SCROLLBAR_CONTAINER,
|
|
803
814
|
style: {
|
|
815
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
804
816
|
height: "var(--ds-space-250, 20px)",
|
|
805
817
|
// MAX_BROWSER_SCROLLBAR_HEIGHT
|
|
818
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
806
819
|
display: 'none',
|
|
807
820
|
// prevent unwanted scroll during table resize without removing scrollbar container from the dom
|
|
808
821
|
width: isResizing ? "var(--ds-space-0, 0px)" : '100%'
|
|
@@ -810,18 +823,26 @@ class TableComponent extends React.Component {
|
|
|
810
823
|
}, /*#__PURE__*/React.createElement("div", {
|
|
811
824
|
style: {
|
|
812
825
|
width: tableRef === null || tableRef === void 0 ? void 0 : tableRef.clientWidth,
|
|
826
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
813
827
|
height: '100%'
|
|
814
828
|
}
|
|
815
829
|
})), /*#__PURE__*/React.createElement("div", {
|
|
816
|
-
contentEditable: false
|
|
817
|
-
style
|
|
830
|
+
contentEditable: false
|
|
831
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
832
|
+
,
|
|
833
|
+
style: shadowStyle(showAfterShadow)
|
|
834
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
835
|
+
,
|
|
818
836
|
className: ClassName.TABLE_RIGHT_SHADOW
|
|
819
837
|
}), this.state.stickyHeader && /*#__PURE__*/React.createElement("div", {
|
|
820
838
|
style: {
|
|
839
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
821
840
|
position: 'absolute',
|
|
841
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
822
842
|
right: "var(--ds-space-400, 32px)" // tableOverflowShadowWidthWide
|
|
823
843
|
}
|
|
824
844
|
}, /*#__PURE__*/React.createElement("div", {
|
|
845
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
825
846
|
className: `${ClassName.TABLE_RIGHT_SHADOW} ${ClassName.TABLE_STICKY_SHADOW}`,
|
|
826
847
|
style: {
|
|
827
848
|
visibility: showAfterShadow && hasHeaderRow ? 'visible' : 'hidden',
|
|
@@ -829,9 +850,11 @@ class TableComponent extends React.Component {
|
|
|
829
850
|
paddingBottom: `${isDragAndDropEnabled && "var(--ds-space-025, 2px)"}`
|
|
830
851
|
}
|
|
831
852
|
})), /*#__PURE__*/React.createElement("div", {
|
|
853
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
832
854
|
className: ClassName.TABLE_STICKY_SENTINEL_BOTTOM,
|
|
833
855
|
"data-testid": "sticky-sentinel-bottom"
|
|
834
856
|
}), stickyScrollbar && /*#__PURE__*/React.createElement("div", {
|
|
857
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
835
858
|
className: ClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_BOTTOM,
|
|
836
859
|
"data-testid": "sticky-scrollbar-sentinel-bottom"
|
|
837
860
|
}));
|
|
@@ -13,8 +13,12 @@ export const InnerContainer = /*#__PURE__*/forwardRef(({
|
|
|
13
13
|
children
|
|
14
14
|
}, ref) => {
|
|
15
15
|
return /*#__PURE__*/React.createElement("div", {
|
|
16
|
-
ref: ref
|
|
17
|
-
style
|
|
16
|
+
ref: ref
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
18
|
+
,
|
|
19
|
+
style: style
|
|
20
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
21
|
+
,
|
|
18
22
|
className: className,
|
|
19
23
|
"data-number-column": node.attrs.isNumberColumnEnabled,
|
|
20
24
|
"data-layout": node.attrs.layout,
|
|
@@ -37,10 +41,14 @@ const AlignmentTableContainer = ({
|
|
|
37
41
|
const style = useMemo(() => {
|
|
38
42
|
return alignment === 'align-start' ? leftAlignStyle : centerAlignStyle;
|
|
39
43
|
}, [alignment]);
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
style
|
|
43
|
-
|
|
44
|
+
return (
|
|
45
|
+
/*#__PURE__*/
|
|
46
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
47
|
+
React.createElement("div", {
|
|
48
|
+
"data-testid": "table-alignment-container",
|
|
49
|
+
style: style
|
|
50
|
+
}, children)
|
|
51
|
+
);
|
|
44
52
|
};
|
|
45
53
|
const AlignmentTableContainerWrapper = ({
|
|
46
54
|
isTableAlignmentEnabled,
|
|
@@ -51,7 +59,9 @@ const AlignmentTableContainerWrapper = ({
|
|
|
51
59
|
return /*#__PURE__*/React.createElement("div", {
|
|
52
60
|
"data-testid": "table-alignment-container",
|
|
53
61
|
style: {
|
|
62
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
54
63
|
display: 'flex',
|
|
64
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
55
65
|
justifyContent: 'center'
|
|
56
66
|
}
|
|
57
67
|
}, children);
|
|
@@ -65,6 +75,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
65
75
|
className,
|
|
66
76
|
node,
|
|
67
77
|
containerWidth,
|
|
78
|
+
lineLength,
|
|
68
79
|
editorView,
|
|
69
80
|
getPos,
|
|
70
81
|
tableRef,
|
|
@@ -146,6 +157,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
146
157
|
width,
|
|
147
158
|
maxWidth: maxResizerWidth,
|
|
148
159
|
containerWidth,
|
|
160
|
+
lineLength,
|
|
149
161
|
updateWidth,
|
|
150
162
|
editorView,
|
|
151
163
|
getPos,
|
|
@@ -170,12 +182,18 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
170
182
|
width: tableWidthRef.current,
|
|
171
183
|
height: resizing ? updateContainerHeight(tableWrapperHeight !== null && tableWrapperHeight !== void 0 ? tableWrapperHeight : 'auto') : 'auto',
|
|
172
184
|
position: isLivePageViewMode ? 'relative' : 'unset'
|
|
173
|
-
}
|
|
185
|
+
}
|
|
186
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
187
|
+
,
|
|
174
188
|
className: ClassName.TABLE_RESIZER_CONTAINER,
|
|
175
189
|
ref: containerRef
|
|
176
|
-
}, isLivePageViewMode ? /*#__PURE__*/React.createElement(InnerContainer
|
|
190
|
+
}, isLivePageViewMode ? /*#__PURE__*/React.createElement(InnerContainer
|
|
191
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
192
|
+
, {
|
|
177
193
|
className: className,
|
|
178
|
-
node: node
|
|
194
|
+
node: node
|
|
195
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
196
|
+
,
|
|
179
197
|
style: {
|
|
180
198
|
width: 'inherit'
|
|
181
199
|
}
|
|
@@ -189,7 +207,8 @@ export const TableContainer = ({
|
|
|
189
207
|
node,
|
|
190
208
|
className,
|
|
191
209
|
containerWidth: {
|
|
192
|
-
width: editorWidth
|
|
210
|
+
width: editorWidth,
|
|
211
|
+
lineLength
|
|
193
212
|
},
|
|
194
213
|
editorView,
|
|
195
214
|
getPos,
|
|
@@ -204,10 +223,13 @@ export const TableContainer = ({
|
|
|
204
223
|
isTableAlignmentEnabled
|
|
205
224
|
}) => {
|
|
206
225
|
if (isTableResizingEnabled && !isNested) {
|
|
207
|
-
return /*#__PURE__*/React.createElement(ResizableTableContainer
|
|
226
|
+
return /*#__PURE__*/React.createElement(ResizableTableContainer
|
|
227
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
228
|
+
, {
|
|
208
229
|
className: className,
|
|
209
230
|
node: node,
|
|
210
231
|
containerWidth: editorWidth,
|
|
232
|
+
lineLength: lineLength,
|
|
211
233
|
editorView: editorView,
|
|
212
234
|
getPos: getPos,
|
|
213
235
|
tableRef: tableRef,
|
|
@@ -220,11 +242,14 @@ export const TableContainer = ({
|
|
|
220
242
|
}, children);
|
|
221
243
|
}
|
|
222
244
|
return /*#__PURE__*/React.createElement(InnerContainer, {
|
|
223
|
-
node: node
|
|
245
|
+
node: node
|
|
246
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
247
|
+
,
|
|
224
248
|
className: classNames(className, {
|
|
225
249
|
'less-padding': editorWidth < akEditorMobileBreakoutPoint && !isNested
|
|
226
250
|
}),
|
|
227
251
|
style: {
|
|
252
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
228
253
|
width: 'inherit'
|
|
229
254
|
}
|
|
230
255
|
}, children);
|
|
@@ -8,18 +8,20 @@ import { focusTableResizer, ToolTipContent } from '@atlaskit/editor-common/keyma
|
|
|
8
8
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
9
9
|
import { ResizerNext } from '@atlaskit/editor-common/resizer';
|
|
10
10
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
11
|
+
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
11
12
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
12
13
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
|
-
import { updateWidthToWidest } from '../commands/misc';
|
|
14
|
+
import { setTableAlignmentWithTableContentWithPos, updateWidthToWidest } from '../commands/misc';
|
|
14
15
|
import { META_KEYS } from '../pm-plugins/table-analytics';
|
|
15
16
|
import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, previewScaleTable, scaleTable, TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
|
|
16
17
|
import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
|
|
17
18
|
import { TABLE_GUIDELINE_VISIBLE_ADJUSTMENT, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE, TABLE_SNAP_GAP } from '../ui/consts';
|
|
18
|
-
import { normaliseAlignment } from '../utils/alignment';
|
|
19
|
+
import { ALIGN_CENTER, ALIGN_START, normaliseAlignment } from '../utils/alignment';
|
|
19
20
|
import { generateResizedPayload, generateResizeFrameRatePayloads, useMeasureFramerate } from '../utils/analytics';
|
|
20
21
|
import { defaultGuidelines, defaultGuidelinesForPreserveTable } from '../utils/guidelines';
|
|
21
22
|
import { defaultSnappingWidths, defaultTablePreserveSnappingWidths, findClosestSnap } from '../utils/snapping';
|
|
22
23
|
const RESIZE_STEP_VALUE = 10;
|
|
24
|
+
const FULL_WIDTH_EDITOR_CONTENT_WIDTH = 1800;
|
|
23
25
|
const handles = {
|
|
24
26
|
right: true
|
|
25
27
|
};
|
|
@@ -73,6 +75,7 @@ export const TableResizer = ({
|
|
|
73
75
|
width,
|
|
74
76
|
maxWidth,
|
|
75
77
|
containerWidth,
|
|
78
|
+
lineLength,
|
|
76
79
|
updateWidth,
|
|
77
80
|
onResizeStop,
|
|
78
81
|
onResizeStart,
|
|
@@ -128,6 +131,22 @@ export const TableResizer = ({
|
|
|
128
131
|
const guidelineSnaps = useMemo(() => snappingEnabled ? {
|
|
129
132
|
x: isTableScalingEnabled ? defaultTablePreserveSnappingWidths(containerWidth, isTableAlignmentEnabled) : defaultSnappingWidths
|
|
130
133
|
} : undefined, [snappingEnabled, isTableScalingEnabled, isTableAlignmentEnabled, containerWidth]);
|
|
134
|
+
const switchToCenterAlignment = useCallback((pos, node, newWidth, state, dispatch) => {
|
|
135
|
+
if (isTableAlignmentEnabled && node && node.attrs.layout === ALIGN_START && newWidth > lineLength && lineLength < FULL_WIDTH_EDITOR_CONTENT_WIDTH &&
|
|
136
|
+
// We don't want to switch alignment in Full-width editor
|
|
137
|
+
isResizing.current) {
|
|
138
|
+
const tableNodeWithPos = {
|
|
139
|
+
pos,
|
|
140
|
+
node
|
|
141
|
+
};
|
|
142
|
+
const tr = setTableAlignmentWithTableContentWithPos(ALIGN_CENTER, tableNodeWithPos)(state);
|
|
143
|
+
if (tr) {
|
|
144
|
+
dispatch(tr);
|
|
145
|
+
}
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
return false;
|
|
149
|
+
}, [lineLength, isTableAlignmentEnabled, isResizing]);
|
|
131
150
|
useEffect(() => {
|
|
132
151
|
return () => {
|
|
133
152
|
// only bring back the cursor if this table was deleted - i.e. if a user was resizing, then another
|
|
@@ -206,12 +225,14 @@ export const TableResizer = ({
|
|
|
206
225
|
const fullWidthGuideline = defaultGuidelinesForPreserveTable(containerWidth, isTableAlignmentEnabled).filter(guideline => guideline.isFullWidth)[0];
|
|
207
226
|
const isFullWidthGuidelineActive = closestSnap.keys.includes(fullWidthGuideline.key);
|
|
208
227
|
const shouldUpdateWidthToWidest = !!isTableScalingEnabled && isFullWidthGuidelineActive;
|
|
209
|
-
|
|
228
|
+
chainCommands((state, dispatch) => {
|
|
229
|
+
return switchToCenterAlignment(pos, node, newWidth, state, dispatch);
|
|
230
|
+
}, updateWidthToWidest({
|
|
210
231
|
[currentTableNodeLocalId]: shouldUpdateWidthToWidest
|
|
211
|
-
})(state, dispatch);
|
|
232
|
+
}))(state, dispatch);
|
|
212
233
|
updateWidth(shouldUpdateWidthToWidest ? TABLE_MAX_WIDTH : newWidth);
|
|
213
234
|
return newWidth;
|
|
214
|
-
}, [countFrames, isTableScalingEnabled, isTableAlignmentEnabled, tableRef, node, editorView, updateActiveGuidelines, containerWidth, updateWidth, getPos]);
|
|
235
|
+
}, [countFrames, isTableScalingEnabled, isTableAlignmentEnabled, tableRef, node, editorView, updateActiveGuidelines, containerWidth, updateWidth, getPos, switchToCenterAlignment]);
|
|
215
236
|
const scheduleResize = useMemo(() => rafSchd(handleResize), [handleResize]);
|
|
216
237
|
const handleResizeStop = useCallback((originalState, delta) => {
|
|
217
238
|
var _node$attrs$localId2, _node$attrs2;
|
|
@@ -365,7 +386,7 @@ export const TableResizer = ({
|
|
|
365
386
|
(_updateTooltip$curren = updateTooltip.current) === null || _updateTooltip$curren === void 0 ? void 0 : _updateTooltip$curren.call(updateTooltip);
|
|
366
387
|
}
|
|
367
388
|
}, [width]);
|
|
368
|
-
const resizeRatio = !isTableAlignmentEnabled || isTableAlignmentEnabled && normaliseAlignment(node.attrs.layout) ===
|
|
389
|
+
const resizeRatio = !isTableAlignmentEnabled || isTableAlignmentEnabled && normaliseAlignment(node.attrs.layout) === ALIGN_CENTER ? 2 : 1;
|
|
369
390
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ResizerNext, {
|
|
370
391
|
ref: resizerRef,
|
|
371
392
|
enable: handles,
|
package/dist/es2019/toolbar.js
CHANGED
|
@@ -317,7 +317,7 @@ export const getToolbarConfig = (getEditorContainerWidth, editorAnalyticsAPI, ge
|
|
|
317
317
|
const menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI);
|
|
318
318
|
let alignmentMenu;
|
|
319
319
|
const isNested = pluginState.tablePos && isTableNested(state, pluginState.tablePos);
|
|
320
|
-
alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI) : [];
|
|
320
|
+
alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth) : [];
|
|
321
321
|
let cellItems;
|
|
322
322
|
cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled);
|
|
323
323
|
let columnSettingsItems;
|
|
@@ -564,7 +564,7 @@ const highlightColumnsHandler = (state, dispatch) => {
|
|
|
564
564
|
};
|
|
565
565
|
export const getAlignmentOptionsConfig = (editorState, {
|
|
566
566
|
formatMessage
|
|
567
|
-
}, editorAnalyticsAPI) => {
|
|
567
|
+
}, editorAnalyticsAPI, getEditorContainerWidth) => {
|
|
568
568
|
const tableObject = findTable(editorState.selection);
|
|
569
569
|
if (!tableObject) {
|
|
570
570
|
return [];
|
|
@@ -597,7 +597,10 @@ export const getAlignmentOptionsConfig = (editorState, {
|
|
|
597
597
|
icon: icon,
|
|
598
598
|
title: formatMessage(layoutToMessages[value]),
|
|
599
599
|
selected: normaliseAlignment(currentLayout) === value,
|
|
600
|
-
onClick: setTableAlignmentWithAnalytics(editorAnalyticsAPI)(value, currentLayout, INPUT_METHOD.FLOATING_TB)
|
|
600
|
+
onClick: setTableAlignmentWithAnalytics(editorAnalyticsAPI)(value, currentLayout, INPUT_METHOD.FLOATING_TB),
|
|
601
|
+
...(isLayoutOptionDisabled(tableObject.node, getEditorContainerWidth) && {
|
|
602
|
+
disabled: value !== 'center'
|
|
603
|
+
})
|
|
601
604
|
};
|
|
602
605
|
});
|
|
603
606
|
const alignmentItemOptions = {
|
|
@@ -623,4 +626,11 @@ export const getAlignmentOptionsConfig = (editorState, {
|
|
|
623
626
|
export const getSelectedAlignmentIcon = (alignmentIcons, selectedNode) => {
|
|
624
627
|
const selectedAlignment = selectedNode.attrs.layout;
|
|
625
628
|
return alignmentIcons.find(icon => icon.value === normaliseAlignment(selectedAlignment));
|
|
629
|
+
};
|
|
630
|
+
export const isLayoutOptionDisabled = (selectedNode, getEditorContainerWidth) => {
|
|
631
|
+
const lineLength = getEditorContainerWidth().lineLength;
|
|
632
|
+
if (selectedNode && lineLength && selectedNode.attrs.width > lineLength) {
|
|
633
|
+
return true;
|
|
634
|
+
}
|
|
635
|
+
return false;
|
|
626
636
|
};
|
|
@@ -16,6 +16,7 @@ export const ColumnResizeWidget = ({
|
|
|
16
16
|
} = useIntl();
|
|
17
17
|
if (!includeTooltip) {
|
|
18
18
|
return jsx("div", {
|
|
19
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
19
20
|
className: TableCssClassName.RESIZE_HANDLE_DECORATION,
|
|
20
21
|
"data-start-index": startIndex,
|
|
21
22
|
"data-end-index": endIndex
|
|
@@ -31,6 +32,7 @@ export const ColumnResizeWidget = ({
|
|
|
31
32
|
position: "mouse",
|
|
32
33
|
mousePosition: "auto-start"
|
|
33
34
|
}, tooltipProps => jsx("div", _extends({
|
|
35
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
34
36
|
className: TableCssClassName.RESIZE_HANDLE_DECORATION,
|
|
35
37
|
"data-start-index": startIndex,
|
|
36
38
|
"data-end-index": endIndex
|
|
@@ -148,7 +148,9 @@ const DragHandleComponent = ({
|
|
|
148
148
|
}, [tableLocalId, direction, indexes, isRow, editorView.state.selection, hasMergedCells]);
|
|
149
149
|
const showDragMenuAnchorId = isRow ? 'drag-handle-button-row' : 'drag-handle-button-column';
|
|
150
150
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
151
|
-
type: "button"
|
|
151
|
+
type: "button"
|
|
152
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
153
|
+
,
|
|
152
154
|
className: ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE,
|
|
153
155
|
"data-testid": "table-drag-handle-clickable-zone-button",
|
|
154
156
|
style: {
|
|
@@ -173,7 +175,9 @@ const DragHandleComponent = ({
|
|
|
173
175
|
onClick: onClick
|
|
174
176
|
}), /*#__PURE__*/React.createElement("button", {
|
|
175
177
|
type: "button",
|
|
176
|
-
id: isDragMenuTarget ? showDragMenuAnchorId : undefined
|
|
178
|
+
id: isDragMenuTarget ? showDragMenuAnchorId : undefined
|
|
179
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
180
|
+
,
|
|
177
181
|
className: classnames(ClassName.DRAG_HANDLE_BUTTON_CONTAINER, appearance, {
|
|
178
182
|
[ClassName.DRAG_HANDLE_DISABLED]: hasMergedCells
|
|
179
183
|
}),
|
|
@@ -202,7 +206,10 @@ const DragHandleComponent = ({
|
|
|
202
206
|
}
|
|
203
207
|
}, appearance !== 'placeholder' ?
|
|
204
208
|
// cannot block pointer events in Firefox as it breaks Dragging functionality
|
|
205
|
-
browser.gecko ? /*#__PURE__*/React.createElement(HandleIconComponent, handleIconProps) :
|
|
209
|
+
browser.gecko ? /*#__PURE__*/React.createElement(HandleIconComponent, handleIconProps) :
|
|
210
|
+
/*#__PURE__*/
|
|
211
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
212
|
+
React.createElement("span", {
|
|
206
213
|
style: {
|
|
207
214
|
pointerEvents: 'none'
|
|
208
215
|
}
|
|
@@ -24,6 +24,7 @@ export const DragPreview = ({
|
|
|
24
24
|
}
|
|
25
25
|
}, /*#__PURE__*/React.createElement(DragInMotionIcon, {
|
|
26
26
|
style: {
|
|
27
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
27
28
|
position: 'absolute',
|
|
28
29
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
29
30
|
marginLeft: `${marginLeft}px`,
|