@atlaskit/editor-plugin-table 15.4.21 → 15.4.23
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/nodeviews/{TableComponentNext.js → TableComponent.js} +5 -4
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +2 -9
- package/dist/cjs/nodeviews/table-node-views.js +1 -1
- package/dist/cjs/nodeviews/toDOM.js +1 -32
- package/dist/cjs/pm-plugins/main.js +2 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/consts.js +0 -1
- package/dist/cjs/ui/ContentComponent.js +2 -1
- package/dist/cjs/ui/FloatingContextualButton/index.js +4 -1
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +3 -2
- package/dist/cjs/ui/common-styles.js +7 -14
- package/dist/es2019/nodeviews/{TableComponentNext.js → TableComponent.js} +5 -4
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +1 -6
- package/dist/es2019/nodeviews/table-node-views.js +1 -1
- package/dist/es2019/nodeviews/toDOM.js +1 -32
- package/dist/es2019/pm-plugins/main.js +2 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/consts.js +0 -1
- package/dist/es2019/ui/ContentComponent.js +2 -1
- package/dist/es2019/ui/FloatingContextualButton/index.js +4 -1
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +3 -2
- package/dist/es2019/ui/common-styles.js +39 -52
- package/dist/esm/nodeviews/{TableComponentNext.js → TableComponent.js} +5 -4
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +1 -8
- package/dist/esm/nodeviews/table-node-views.js +1 -1
- package/dist/esm/nodeviews/toDOM.js +1 -32
- package/dist/esm/pm-plugins/main.js +2 -1
- package/dist/esm/pm-plugins/table-resizing/utils/consts.js +0 -1
- package/dist/esm/ui/ContentComponent.js +2 -1
- package/dist/esm/ui/FloatingContextualButton/index.js +4 -1
- package/dist/esm/ui/TableFloatingColumnControls/index.js +3 -2
- package/dist/esm/ui/common-styles.js +8 -15
- package/dist/types/nodeviews/table-node-views.d.ts +1 -0
- package/dist/types/ui/FloatingContextualButton/index.d.ts +1 -0
- package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +1 -1
- package/dist/types/ui/TableFloatingColumnControls/index.d.ts +2 -1
- package/dist/types/ui/icons/DragHandleDisabledIcon.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/table-node-views.d.ts +1 -0
- package/dist/types-ts4.5/ui/FloatingContextualButton/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/icons/DragHandleDisabledIcon.d.ts +1 -1
- package/package.json +11 -6
- package/dist/cjs/nodeviews/TableComponentLegacy.js +0 -1141
- package/dist/es2019/nodeviews/TableComponentLegacy.js +0 -1114
- package/dist/esm/nodeviews/TableComponentLegacy.js +0 -1135
- package/dist/types/nodeviews/TableComponentLegacy.d.ts +0 -47
- package/dist/types/nodeviews/TableComponentNext.d.ts +0 -47
- /package/dist/{types-ts4.5/nodeviews/TableComponentNext.d.ts → types/nodeviews/TableComponent.d.ts} +0 -0
- /package/dist/types-ts4.5/nodeviews/{TableComponentLegacy.d.ts → TableComponent.d.ts} +0 -0
|
@@ -31,37 +31,7 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
31
31
|
if (config.allowColumnResizing) {
|
|
32
32
|
colgroup = ['colgroup', {}, ...generateColgroupFromNode(node, config.isCommentEditor, config.isChromelessEditor, config.isNested, config.isTableScalingEnabled, config.shouldUseIncreasedScalingPercent)];
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
// For Chromeless editor, and nested tables in full page editor
|
|
36
|
-
const tableContainerDivLegacy = ['div', {
|
|
37
|
-
class: 'pm-table-container',
|
|
38
|
-
'data-number-column': node.attrs.isNumberColumnEnabled,
|
|
39
|
-
'data-layout': node.attrs.layout,
|
|
40
|
-
'data-testid': 'table-container'
|
|
41
|
-
}, ['div', {
|
|
42
|
-
class: 'pm-table-sticky-sentinel-top',
|
|
43
|
-
'data-testid': 'sticky-sentinel-top'
|
|
44
|
-
}], ['div', {
|
|
45
|
-
class: 'pm-table-row-controls-wrapper'
|
|
46
|
-
}, ['div']], ['div', {
|
|
47
|
-
class: 'pm-table-with-left-shadow',
|
|
48
|
-
style: 'visibility: hidden'
|
|
49
|
-
}], ['div', {
|
|
50
|
-
class: 'pm-table-wrapper'
|
|
51
|
-
}, ['table', attrs, ['span', {
|
|
52
|
-
class: 'pm-table-shadow-sentinel-right'
|
|
53
|
-
}], ['span', {
|
|
54
|
-
class: 'pm-table-shadow-sentinel-left'
|
|
55
|
-
}], colgroup, ['tbody', 0]]], ['div', {
|
|
56
|
-
class: 'pm-table-with-right-shadow',
|
|
57
|
-
style: 'visibility: hidden'
|
|
58
|
-
}], ['div', {
|
|
59
|
-
class: 'pm-table-sticky-sentinel-bottom',
|
|
60
|
-
'data-testid': 'sticky-sentinel-bottom'
|
|
61
|
-
}]];
|
|
62
|
-
|
|
63
|
-
// removed the left/right shadow divs
|
|
64
|
-
const tableContainerDivNext = ['div', {
|
|
34
|
+
const tableContainerDiv = ['div', {
|
|
65
35
|
class: 'pm-table-container',
|
|
66
36
|
'data-number-column': node.attrs.isNumberColumnEnabled,
|
|
67
37
|
'data-layout': node.attrs.layout,
|
|
@@ -77,7 +47,6 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
77
47
|
class: 'pm-table-sticky-sentinel-bottom',
|
|
78
48
|
'data-testid': 'sticky-sentinel-bottom'
|
|
79
49
|
}]];
|
|
80
|
-
const tableContainerDiv = expValEquals('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant1') || expValEquals('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant2') || expValEquals('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant3') ? tableContainerDivNext : tableContainerDivLegacy;
|
|
81
50
|
if (!config.tableResizingEnabled || config.isNested) {
|
|
82
51
|
return ['div', {
|
|
83
52
|
class: 'tableView-content-wrap',
|
|
@@ -67,7 +67,8 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
67
67
|
}),
|
|
68
68
|
tableRow: tableRowView({
|
|
69
69
|
eventDispatcher,
|
|
70
|
-
pluginInjectionApi
|
|
70
|
+
pluginInjectionApi,
|
|
71
|
+
isDragAndDropEnabled: dragAndDropEnabled
|
|
71
72
|
}),
|
|
72
73
|
tableCell: tableCellView({
|
|
73
74
|
eventDispatcher,
|
|
@@ -107,7 +107,8 @@ const ContentComponentInternal = ({
|
|
|
107
107
|
isContextualMenuOpen: isContextualMenuOpen,
|
|
108
108
|
stickyHeader: stickyHeader,
|
|
109
109
|
tableWrapper: tableWrapperTarget,
|
|
110
|
-
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard
|
|
110
|
+
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
|
|
111
|
+
isDragAndDropEnabled: isDragAndDropEnabled
|
|
111
112
|
}), allowControls && /*#__PURE__*/React.createElement(FloatingInsertButton, {
|
|
112
113
|
tableNode: tableNode,
|
|
113
114
|
tableRef: tableRef,
|
|
@@ -42,6 +42,7 @@ const FloatingContextualButtonInner = /*#__PURE__*/React.memo(props => {
|
|
|
42
42
|
tableWrapper,
|
|
43
43
|
targetCellPosition,
|
|
44
44
|
isCellMenuOpenByKeyboard,
|
|
45
|
+
isDragAndDropEnabled,
|
|
45
46
|
intl: {
|
|
46
47
|
formatMessage
|
|
47
48
|
}
|
|
@@ -101,7 +102,7 @@ const FloatingContextualButtonInner = /*#__PURE__*/React.memo(props => {
|
|
|
101
102
|
}));
|
|
102
103
|
const parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
|
|
103
104
|
const parentStickyNative = targetCellRef.parentElement && targetCellRef.parentElement.classList.contains(ClassName.NATIVE_STICKY);
|
|
104
|
-
if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') && isAnchorSupported() && targetCellRef.nodeName === 'TH' && parentStickyNative) {
|
|
105
|
+
if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') && isAnchorSupported() && targetCellRef.nodeName === 'TH' && parentStickyNative && isDragAndDropEnabled) {
|
|
105
106
|
var _targetCellRef$datase, _targetCellRef$parent, _targetCellRef$parent2;
|
|
106
107
|
const anchorName = (_targetCellRef$datase = targetCellRef.dataset.nodeAnchor) !== null && _targetCellRef$datase !== void 0 ? _targetCellRef$datase : '';
|
|
107
108
|
const rowAnchorName = (_targetCellRef$parent = (_targetCellRef$parent2 = targetCellRef.parentElement) === null || _targetCellRef$parent2 === void 0 ? void 0 : _targetCellRef$parent2.dataset.nodeAnchor) !== null && _targetCellRef$parent !== void 0 ? _targetCellRef$parent : '';
|
|
@@ -114,6 +115,8 @@ const FloatingContextualButtonInner = /*#__PURE__*/React.memo(props => {
|
|
|
114
115
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
115
116
|
positionAnchor: anchorName
|
|
116
117
|
} // need to do this because CSSProperties doesn't have positionAnchor property even though it's a valid CSS property
|
|
118
|
+
,
|
|
119
|
+
"data-testid": "table-cell-options-anchor-wrapper"
|
|
117
120
|
}, button);
|
|
118
121
|
}
|
|
119
122
|
if (stickyHeader && parentSticky && tableWrapper) {
|
|
@@ -25,7 +25,8 @@ const TableFloatingColumnControls = ({
|
|
|
25
25
|
getScrollOffset,
|
|
26
26
|
tableWrapperHeight,
|
|
27
27
|
api,
|
|
28
|
-
isChromelessEditor
|
|
28
|
+
isChromelessEditor,
|
|
29
|
+
isDragAndDropEnabled
|
|
29
30
|
}) => {
|
|
30
31
|
const [isDragging, setIsDragging] = useState(false);
|
|
31
32
|
const containerRef = useRef(null);
|
|
@@ -73,7 +74,7 @@ const TableFloatingColumnControls = ({
|
|
|
73
74
|
containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.style.removeProperty('top');
|
|
74
75
|
}
|
|
75
76
|
let anchorStyles = {};
|
|
76
|
-
if (isAnchorSupported() && expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
|
|
77
|
+
if (isAnchorSupported() && isDragAndDropEnabled && expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
|
|
77
78
|
var _tableRef$querySelect;
|
|
78
79
|
// cast here is due to CSSProperties missing valid positionAnchor property
|
|
79
80
|
anchorStyles = {
|
|
@@ -8,7 +8,7 @@ import { css } from '@emotion/react';
|
|
|
8
8
|
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
9
9
|
import { ANCHOR_VARIABLE_NAME, tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
|
|
10
10
|
import { SORTABLE_COLUMN_ICON_CLASSNAME } from '@atlaskit/editor-common/table';
|
|
11
|
-
import { akEditorSelectedNodeClassName, akEditorSmallZIndex, akEditorStickyHeaderZIndex, akEditorTableCellOnStickyHeaderZIndex, akEditorTableNumberColumnWidth, akEditorTableToolbarSize, akEditorUnitZIndex, getSelectionStyles, MAX_BROWSER_SCROLLBAR_HEIGHT, SelectionStyle, relativeSizeToBaseFontSize, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
11
|
+
import { akEditorSelectedNodeClassName, akEditorSmallZIndex, akEditorStickyHeaderZIndex, akEditorTableCellOnStickyHeaderZIndex, akEditorTableNumberColumnWidth, akEditorTableToolbarSize, akEditorUnitZIndex, getSelectionStyles, MAX_BROWSER_SCROLLBAR_HEIGHT, SelectionStyle, relativeSizeToBaseFontSize, relativeFontSizeToBase16, akEditorSelectedBorderColor } from '@atlaskit/editor-shared-styles';
|
|
12
12
|
import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
14
|
import { N0, N40A, R500 } from '@atlaskit/theme/colors';
|
|
@@ -41,6 +41,12 @@ const rangeSelectionStyles = `
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
`;
|
|
44
|
+
const rangeSelectionStylesForFakeBorders = `
|
|
45
|
+
.${ClassName.NODEVIEW_WRAPPER}.${akEditorSelectedNodeClassName} .pm-table-left-border,
|
|
46
|
+
.${ClassName.NODEVIEW_WRAPPER}.${akEditorSelectedNodeClassName} .pm-table-right-border {
|
|
47
|
+
background: ${akEditorSelectedBorderColor};
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
44
50
|
const sentinelStyles = `.${ClassName.TABLE_CONTAINER} {
|
|
45
51
|
> .${ClassName.TABLE_STICKY_SENTINEL_TOP}, > .${ClassName.TABLE_STICKY_SENTINEL_BOTTOM} {
|
|
46
52
|
position: absolute;
|
|
@@ -204,47 +210,6 @@ const tableStickyHeaderFirefoxFixStyle = () => {
|
|
|
204
210
|
}
|
|
205
211
|
};
|
|
206
212
|
|
|
207
|
-
/**
|
|
208
|
-
* Styles for the table scroll inline shadow
|
|
209
|
-
* inspired by https://css-scroll-shadows.vercel.app/
|
|
210
|
-
*/
|
|
211
|
-
const tableScrollInlineShadowStyles = () => {
|
|
212
|
-
return css`
|
|
213
|
-
.${ClassName.TABLE_SCROLL_INLINE_SHADOW} {
|
|
214
|
-
--editor-table-shadow-cover: #fff;
|
|
215
|
-
--editor-table-shadow-color: ${"var(--ds-shadow-overflow-spread, #1E1F2129)"};
|
|
216
|
-
--editor-table-shadow-size: ${"var(--ds-space-100, 8px)"};
|
|
217
|
-
background-image:
|
|
218
|
-
linear-gradient(to right, var(--editor-table-shadow-cover) 33%, transparent),
|
|
219
|
-
linear-gradient(to right, transparent, var(--editor-table-shadow-cover) 66%),
|
|
220
|
-
linear-gradient(to right, var(--editor-table-shadow-color), transparent),
|
|
221
|
-
linear-gradient(to left, var(--editor-table-shadow-color), transparent);
|
|
222
|
-
background-size:
|
|
223
|
-
calc(var(--editor-table-shadow-size) * 3) 100%,
|
|
224
|
-
calc(var(--editor-table-shadow-size) * 3) 100%,
|
|
225
|
-
calc(var(--editor-table-shadow-size) * 1) 100%,
|
|
226
|
-
calc(var(--editor-table-shadow-size) * 1) 100%;
|
|
227
|
-
background-position:
|
|
228
|
-
left ${"var(--ds-space-300, 24px)"},
|
|
229
|
-
right ${"var(--ds-space-300, 24px)"},
|
|
230
|
-
left ${"var(--ds-space-300, 24px)"},
|
|
231
|
-
right ${"var(--ds-space-300, 24px)"};
|
|
232
|
-
background-attachment: local, local, scroll, scroll;
|
|
233
|
-
background-repeat: no-repeat;
|
|
234
|
-
|
|
235
|
-
th,
|
|
236
|
-
td {
|
|
237
|
-
mix-blend-mode: multiply;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.${ClassName.TABLE_STICKY} .${ClassName.TABLE_SCROLL_INLINE_SHADOW} tr.sticky th,
|
|
242
|
-
.${ClassName.TABLE_STICKY} .${ClassName.TABLE_SCROLL_INLINE_SHADOW} tr.sticky td {
|
|
243
|
-
mix-blend-mode: normal;
|
|
244
|
-
}
|
|
245
|
-
`;
|
|
246
|
-
};
|
|
247
|
-
|
|
248
213
|
// re-exporting these styles to use in Gemini test when table node view is rendered outside of PM
|
|
249
214
|
export const baseTableStyles = props => {
|
|
250
215
|
var _props$featureFlags;
|
|
@@ -257,6 +222,7 @@ export const baseTableStyles = props => {
|
|
|
257
222
|
${insertLine()};
|
|
258
223
|
${resizeHandle()};
|
|
259
224
|
${rangeSelectionStyles};
|
|
225
|
+
${fg('platform_editor_table_numbered_table_border') && rangeSelectionStylesForFakeBorders};
|
|
260
226
|
${viewModeSortStyles()};
|
|
261
227
|
${expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') && tableAnchorStyles};
|
|
262
228
|
|
|
@@ -288,8 +254,6 @@ export const baseTableStyles = props => {
|
|
|
288
254
|
}
|
|
289
255
|
}
|
|
290
256
|
|
|
291
|
-
${expValEquals('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant3') && tableScrollInlineShadowStyles()}
|
|
292
|
-
|
|
293
257
|
.${ClassName.CONTROLS_FLOATING_BUTTON_COLUMN} {
|
|
294
258
|
${insertColumnButtonWrapper()}
|
|
295
259
|
}
|
|
@@ -1167,16 +1131,27 @@ export const baseTableStyles = props => {
|
|
|
1167
1131
|
top: ${tableMarginTop}px;
|
|
1168
1132
|
}
|
|
1169
1133
|
|
|
1134
|
+
${fg('platform_editor_table_sticky_header_patch_1') ? `
|
|
1170
1135
|
.${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} > .${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER} {
|
|
1171
1136
|
/* +2px is to overlap the table border on the sides */
|
|
1172
1137
|
width: calc(anchor-size(width) + 2px);
|
|
1173
1138
|
height: ${tableMarginTop}px;
|
|
1174
1139
|
background: ${"var(--ds-surface, #FFFFFF)"};
|
|
1140
|
+
top: unset;
|
|
1175
1141
|
position: fixed;
|
|
1176
1142
|
position-area: top center;
|
|
1177
1143
|
position-visibility: anchors-visible;
|
|
1178
1144
|
z-index: ${nativeStickyHeaderZIndex + 1};
|
|
1179
|
-
}
|
|
1145
|
+
}` : `.${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} > .${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER} {
|
|
1146
|
+
/* +2px is to overlap the table border on the sides */
|
|
1147
|
+
width: calc(anchor-size(width) + 2px);
|
|
1148
|
+
height: ${tableMarginTop}px;
|
|
1149
|
+
background: ${"var(--ds-surface, #FFFFFF)"};
|
|
1150
|
+
position: fixed;
|
|
1151
|
+
position-area: top center;
|
|
1152
|
+
position-visibility: anchors-visible;
|
|
1153
|
+
z-index: ${nativeStickyHeaderZIndex + 1};
|
|
1154
|
+
}`}
|
|
1180
1155
|
|
|
1181
1156
|
/** Mask for content to the left of the column controls */
|
|
1182
1157
|
|
|
@@ -1205,24 +1180,36 @@ export const baseTableStyles = props => {
|
|
|
1205
1180
|
outline: 1px solid ${tableBorderColor};
|
|
1206
1181
|
border-left: 1px solid ${tableBorderColor};
|
|
1207
1182
|
background: ${"var(--ds-background-accent-gray-subtlest, #F0F1F2)"};
|
|
1183
|
+
${fg('platform_editor_table_sticky_header_patch_1') ? `border-top: 1px solid ${tableBorderColor};` : ``}
|
|
1208
1184
|
}
|
|
1209
1185
|
|
|
1210
1186
|
.${ClassName.TABLE_CONTAINER}[data-number-column="true"].${ClassName.TABLE_SELECTED} .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr:first-of-type th.${ClassName.SELECTED_CELL}:not(.${ClassName.HOVERED_CELL_IN_DANGER}):first-of-type::before, .${ClassName.TABLE_CONTAINER}[data-number-column="true"] .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr:first-of-type th.${ClassName.SELECTED_CELL}:not(.${ClassName.HOVERED_CELL_IN_DANGER}, .${ClassName.COLUMN_SELECTED}):first-of-type::before {
|
|
1211
1187
|
outline: none;
|
|
1212
1188
|
border-left-color: ${tableBorderSelectedColor};
|
|
1189
|
+
${fg('platform_editor_table_sticky_header_patch_1') ? `border-top-color: ${tableBorderSelectedColor};` : ``}
|
|
1213
1190
|
background: ${tableHeaderCellSelectedColor};
|
|
1214
1191
|
}
|
|
1215
1192
|
|
|
1216
|
-
.${ClassName.TABLE_CONTAINER}[data-number-column="true"] .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr:first-of-type th.${ClassName.HOVERED_CELL_IN_DANGER}:not(.${ClassName.COLUMN_SELECTED}):first-of-type::before {
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1193
|
+
${fg('platform_editor_table_sticky_header_patch_1') ? `.${ClassName.TABLE_CONTAINER}[data-number-column="true"] .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr:first-of-type th.${ClassName.HOVERED_CELL_IN_DANGER}:first-of-type::before, .${ClassName.TABLE_CONTAINER}[data-number-column="true"] .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr:first-of-type th.${ClassName.HOVERED_CELL_IN_DANGER}:not(.${ClassName.COLUMN_SELECTED}):first-of-type::before {
|
|
1194
|
+
outline: none;
|
|
1195
|
+
border-left: unset;
|
|
1196
|
+
border-top: unset;
|
|
1197
|
+
background: ${tableCellDeleteColor};
|
|
1198
|
+
}
|
|
1199
|
+
.${ClassName.TABLE_CONTAINER}[data-number-column="true"].${ClassName.TABLE_SELECTED}.${ClassName.HOVERED_DELETE_BUTTON} .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr:first-of-type th:first-of-type::before, .${ClassName.TABLE_CONTAINER}[data-number-column="true"].${ClassName.HOVERED_DELETE_BUTTON} .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr:first-of-type th.${ClassName.SELECTED_CELL}:not(.${ClassName.COLUMN_SELECTED}):first-of-type::before {
|
|
1222
1200
|
outline: none;
|
|
1223
1201
|
border-left-color: ${tableBorderDeleteColor};
|
|
1202
|
+
border-top-color: ${tableBorderDeleteColor};
|
|
1224
1203
|
background: ${tableCellDeleteColor};
|
|
1225
|
-
}
|
|
1204
|
+
}` : ` .${ClassName.TABLE_CONTAINER}[data-number-column="true"] .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr:first-of-type th.${ClassName.HOVERED_CELL_IN_DANGER}:not(.${ClassName.COLUMN_SELECTED}):first-of-type::before {
|
|
1205
|
+
outline: none;
|
|
1206
|
+
background: ${tableCellDeleteColor};
|
|
1207
|
+
}
|
|
1208
|
+
.${ClassName.TABLE_CONTAINER}[data-number-column="true"].${ClassName.HOVERED_DELETE_BUTTON} .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr:first-of-type th.${ClassName.SELECTED_CELL}:not(.${ClassName.COLUMN_SELECTED}):first-of-type::before {
|
|
1209
|
+
outline: none;
|
|
1210
|
+
border-left-color: ${tableBorderDeleteColor};
|
|
1211
|
+
background: ${tableCellDeleteColor};
|
|
1212
|
+
}`}
|
|
1226
1213
|
|
|
1227
1214
|
.${ClassName.TABLE_CONTAINER}[data-number-column="true"] .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} .${ClassName.NATIVE_STICKY_ACTIVE} th:first-of-type::before {
|
|
1228
1215
|
box-shadow: 0 6px 4px -4px ${"var(--ds-shadow-overflow-perimeter, #1E1F211f)"};
|
|
@@ -851,7 +851,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
851
851
|
},
|
|
852
852
|
tableWrapperHeight: this.state.tableWrapperHeight,
|
|
853
853
|
api: pluginInjectionApi,
|
|
854
|
-
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor
|
|
854
|
+
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
855
|
+
isDragAndDropEnabled: isDragAndDropEnabled
|
|
855
856
|
}) : null;
|
|
856
857
|
|
|
857
858
|
/**
|
|
@@ -916,7 +917,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
916
917
|
}
|
|
917
918
|
}), /*#__PURE__*/React.createElement("div", {
|
|
918
919
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
919
|
-
className: classnames(ClassName.TABLE_NODE_WRAPPER
|
|
920
|
+
className: classnames(ClassName.TABLE_NODE_WRAPPER),
|
|
920
921
|
ref: function ref(elem) {
|
|
921
922
|
_this5.wrapper = elem;
|
|
922
923
|
if (elem) {
|
|
@@ -963,14 +964,14 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
963
964
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
964
965
|
className: ClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_BOTTOM,
|
|
965
966
|
"data-testid": "sticky-scrollbar-sentinel-bottom"
|
|
966
|
-
}),
|
|
967
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
967
968
|
contentEditable: false
|
|
968
969
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
969
970
|
,
|
|
970
971
|
className: ClassName.TABLE_LEFT_BORDER,
|
|
971
972
|
"data-with-numbered-table": node.attrs.isNumberColumnEnabled,
|
|
972
973
|
"data-testid": "table-left-border"
|
|
973
|
-
}),
|
|
974
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
974
975
|
contentEditable: false
|
|
975
976
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
976
977
|
,
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import { findTable } from '@atlaskit/editor-tables';
|
|
4
|
-
import
|
|
5
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
|
-
import TableComponentLegacy from './TableComponentLegacy';
|
|
7
|
-
import TableComponentNext from './TableComponentNext';
|
|
4
|
+
import TableComponent from './TableComponent';
|
|
8
5
|
|
|
9
6
|
// Ignored via go/ees005
|
|
10
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
8
|
|
|
12
|
-
var TableComponent = componentWithCondition(function () {
|
|
13
|
-
return expValEquals('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant1') || expValEquals('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant2') || expValEquals('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant3');
|
|
14
|
-
}, TableComponentNext, TableComponentLegacy);
|
|
15
|
-
|
|
16
9
|
/**
|
|
17
10
|
* Use useSharedPluginState to control re-renders from plugin dependencies
|
|
18
11
|
*/
|
|
@@ -24,7 +24,7 @@ export var tableHeaderView = function tableHeaderView(options) {
|
|
|
24
24
|
};
|
|
25
25
|
export var tableRowView = function tableRowView(options) {
|
|
26
26
|
return function (node, view, getPos) {
|
|
27
|
-
if (isAnchorSupported() && expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
|
|
27
|
+
if (isAnchorSupported() && options.isDragAndDropEnabled && expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
|
|
28
28
|
return new TableRowNativeStickyWithFallback(node, view, getPos, options.eventDispatcher, options.pluginInjectionApi);
|
|
29
29
|
} else {
|
|
30
30
|
return new TableRow(node, view, getPos, options.eventDispatcher, options.pluginInjectionApi);
|
|
@@ -40,37 +40,7 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
40
40
|
if (config.allowColumnResizing) {
|
|
41
41
|
colgroup = ['colgroup', {}].concat(_toConsumableArray(generateColgroupFromNode(node, config.isCommentEditor, config.isChromelessEditor, config.isNested, config.isTableScalingEnabled, config.shouldUseIncreasedScalingPercent)));
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
// For Chromeless editor, and nested tables in full page editor
|
|
45
|
-
var tableContainerDivLegacy = ['div', {
|
|
46
|
-
class: 'pm-table-container',
|
|
47
|
-
'data-number-column': node.attrs.isNumberColumnEnabled,
|
|
48
|
-
'data-layout': node.attrs.layout,
|
|
49
|
-
'data-testid': 'table-container'
|
|
50
|
-
}, ['div', {
|
|
51
|
-
class: 'pm-table-sticky-sentinel-top',
|
|
52
|
-
'data-testid': 'sticky-sentinel-top'
|
|
53
|
-
}], ['div', {
|
|
54
|
-
class: 'pm-table-row-controls-wrapper'
|
|
55
|
-
}, ['div']], ['div', {
|
|
56
|
-
class: 'pm-table-with-left-shadow',
|
|
57
|
-
style: 'visibility: hidden'
|
|
58
|
-
}], ['div', {
|
|
59
|
-
class: 'pm-table-wrapper'
|
|
60
|
-
}, ['table', attrs, ['span', {
|
|
61
|
-
class: 'pm-table-shadow-sentinel-right'
|
|
62
|
-
}], ['span', {
|
|
63
|
-
class: 'pm-table-shadow-sentinel-left'
|
|
64
|
-
}], colgroup, ['tbody', 0]]], ['div', {
|
|
65
|
-
class: 'pm-table-with-right-shadow',
|
|
66
|
-
style: 'visibility: hidden'
|
|
67
|
-
}], ['div', {
|
|
68
|
-
class: 'pm-table-sticky-sentinel-bottom',
|
|
69
|
-
'data-testid': 'sticky-sentinel-bottom'
|
|
70
|
-
}]];
|
|
71
|
-
|
|
72
|
-
// removed the left/right shadow divs
|
|
73
|
-
var tableContainerDivNext = ['div', {
|
|
43
|
+
var tableContainerDiv = ['div', {
|
|
74
44
|
class: 'pm-table-container',
|
|
75
45
|
'data-number-column': node.attrs.isNumberColumnEnabled,
|
|
76
46
|
'data-layout': node.attrs.layout,
|
|
@@ -86,7 +56,6 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
86
56
|
class: 'pm-table-sticky-sentinel-bottom',
|
|
87
57
|
'data-testid': 'sticky-sentinel-bottom'
|
|
88
58
|
}]];
|
|
89
|
-
var tableContainerDiv = expValEquals('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant1') || expValEquals('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant2') || expValEquals('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant3') ? tableContainerDivNext : tableContainerDivLegacy;
|
|
90
59
|
if (!config.tableResizingEnabled || config.isNested) {
|
|
91
60
|
return ['div', {
|
|
92
61
|
class: 'tableView-content-wrap',
|
|
@@ -69,7 +69,8 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
69
69
|
}),
|
|
70
70
|
tableRow: tableRowView({
|
|
71
71
|
eventDispatcher: eventDispatcher,
|
|
72
|
-
pluginInjectionApi: pluginInjectionApi
|
|
72
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
73
|
+
isDragAndDropEnabled: dragAndDropEnabled
|
|
73
74
|
}),
|
|
74
75
|
tableCell: tableCellView({
|
|
75
76
|
eventDispatcher: eventDispatcher,
|
|
@@ -104,7 +104,8 @@ var ContentComponentInternal = function ContentComponentInternal(_ref) {
|
|
|
104
104
|
isContextualMenuOpen: isContextualMenuOpen,
|
|
105
105
|
stickyHeader: stickyHeader,
|
|
106
106
|
tableWrapper: tableWrapperTarget,
|
|
107
|
-
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard
|
|
107
|
+
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
|
|
108
|
+
isDragAndDropEnabled: isDragAndDropEnabled
|
|
108
109
|
}), allowControls && /*#__PURE__*/React.createElement(FloatingInsertButton, {
|
|
109
110
|
tableNode: tableNode,
|
|
110
111
|
tableRef: tableRef,
|
|
@@ -41,6 +41,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
41
41
|
tableWrapper = props.tableWrapper,
|
|
42
42
|
targetCellPosition = props.targetCellPosition,
|
|
43
43
|
isCellMenuOpenByKeyboard = props.isCellMenuOpenByKeyboard,
|
|
44
|
+
isDragAndDropEnabled = props.isDragAndDropEnabled,
|
|
44
45
|
formatMessage = props.intl.formatMessage; // : Props & WrappedComponentProps
|
|
45
46
|
|
|
46
47
|
var handleClick = function handleClick() {
|
|
@@ -93,7 +94,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
93
94
|
}));
|
|
94
95
|
var parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
|
|
95
96
|
var parentStickyNative = targetCellRef.parentElement && targetCellRef.parentElement.classList.contains(ClassName.NATIVE_STICKY);
|
|
96
|
-
if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') && isAnchorSupported() && targetCellRef.nodeName === 'TH' && parentStickyNative) {
|
|
97
|
+
if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') && isAnchorSupported() && targetCellRef.nodeName === 'TH' && parentStickyNative && isDragAndDropEnabled) {
|
|
97
98
|
var _targetCellRef$datase, _targetCellRef$parent, _targetCellRef$parent2;
|
|
98
99
|
var anchorName = (_targetCellRef$datase = targetCellRef.dataset.nodeAnchor) !== null && _targetCellRef$datase !== void 0 ? _targetCellRef$datase : '';
|
|
99
100
|
var rowAnchorName = (_targetCellRef$parent = (_targetCellRef$parent2 = targetCellRef.parentElement) === null || _targetCellRef$parent2 === void 0 ? void 0 : _targetCellRef$parent2.dataset.nodeAnchor) !== null && _targetCellRef$parent !== void 0 ? _targetCellRef$parent : '';
|
|
@@ -106,6 +107,8 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
106
107
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
107
108
|
positionAnchor: anchorName
|
|
108
109
|
} // need to do this because CSSProperties doesn't have positionAnchor property even though it's a valid CSS property
|
|
110
|
+
,
|
|
111
|
+
"data-testid": "table-cell-options-anchor-wrapper"
|
|
109
112
|
}, button);
|
|
110
113
|
}
|
|
111
114
|
if (stickyHeader && parentSticky && tableWrapper) {
|
|
@@ -26,7 +26,8 @@ var TableFloatingColumnControls = function TableFloatingColumnControls(_ref) {
|
|
|
26
26
|
getScrollOffset = _ref.getScrollOffset,
|
|
27
27
|
tableWrapperHeight = _ref.tableWrapperHeight,
|
|
28
28
|
api = _ref.api,
|
|
29
|
-
isChromelessEditor = _ref.isChromelessEditor
|
|
29
|
+
isChromelessEditor = _ref.isChromelessEditor,
|
|
30
|
+
isDragAndDropEnabled = _ref.isDragAndDropEnabled;
|
|
30
31
|
var _useState = useState(false),
|
|
31
32
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
33
|
isDragging = _useState2[0],
|
|
@@ -74,7 +75,7 @@ var TableFloatingColumnControls = function TableFloatingColumnControls(_ref) {
|
|
|
74
75
|
containerRef === null || containerRef === void 0 || (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 || _containerRef$current2.style.removeProperty('top');
|
|
75
76
|
}
|
|
76
77
|
var anchorStyles = {};
|
|
77
|
-
if (isAnchorSupported() && expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
|
|
78
|
+
if (isAnchorSupported() && isDragAndDropEnabled && expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
|
|
78
79
|
var _tableRef$querySelect;
|
|
79
80
|
// cast here is due to CSSProperties missing valid positionAnchor property
|
|
80
81
|
anchorStyles = {
|