@atlaskit/editor-plugin-table 7.28.2 → 7.28.4
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 +21 -0
- package/dist/cjs/nodeviews/TableComponent.js +3 -2
- package/dist/cjs/nodeviews/table.js +2 -2
- package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +18 -7
- package/dist/cjs/ui/FloatingContextualButton/index.js +2 -1
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +2 -1
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +3 -1
- package/dist/cjs/ui/TableFloatingControls/index.js +3 -3
- package/dist/es2019/nodeviews/TableComponent.js +3 -2
- package/dist/es2019/nodeviews/table.js +2 -2
- package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +19 -8
- package/dist/es2019/ui/FloatingContextualButton/index.js +2 -1
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +2 -1
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +3 -1
- package/dist/es2019/ui/TableFloatingControls/index.js +3 -3
- package/dist/esm/nodeviews/TableComponent.js +3 -2
- package/dist/esm/nodeviews/table.js +2 -2
- package/dist/esm/ui/FloatingContextualButton/FixedButton.js +19 -8
- package/dist/esm/ui/FloatingContextualButton/index.js +2 -1
- package/dist/esm/ui/TableFloatingColumnControls/index.js +2 -1
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +3 -1
- package/dist/esm/ui/TableFloatingControls/index.js +3 -3
- package/package.json +3 -6
- package/src/nodeviews/TableComponent.tsx +4 -3
- package/src/nodeviews/table.tsx +2 -2
- package/src/ui/FloatingContextualButton/FixedButton.tsx +23 -9
- package/src/ui/FloatingContextualButton/index.tsx +1 -1
- package/src/ui/TableFloatingColumnControls/index.tsx +4 -1
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +4 -1
- package/src/ui/TableFloatingControls/index.tsx +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.28.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#146656](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/146656)
|
|
8
|
+
[`2c23467e86c29`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2c23467e86c29) -
|
|
9
|
+
[ux] No-issue: Set isFacadeDisabled to true for table cell dropdown
|
|
10
|
+
- [#146417](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/146417)
|
|
11
|
+
[`4302239b19be5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4302239b19be5) -
|
|
12
|
+
Migrate table useSharedStateHook FF from LD to Statsig experiment.
|
|
13
|
+
|
|
14
|
+
## 7.28.3
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#145959](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/145959)
|
|
19
|
+
[`ea00ae7d7d94f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ea00ae7d7d94f) -
|
|
20
|
+
[ED-25130] Fix sticky header numbered column when using the new breakout css logic
|
|
21
|
+
(container-type)
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 7.28.2
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -27,6 +27,7 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
27
27
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
28
28
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
29
29
|
var _combine = require("@atlaskit/pragmatic-drag-and-drop/combine");
|
|
30
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
30
31
|
var _commands = require("../commands");
|
|
31
32
|
var _eventHandlers = require("../event-handlers");
|
|
32
33
|
var _utils3 = require("../pm-plugins/drag-and-drop/utils");
|
|
@@ -609,7 +610,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
609
610
|
getEditorFeatureFlags = _this$props11.getEditorFeatureFlags;
|
|
610
611
|
var isInDanger = this.props.isInDanger;
|
|
611
612
|
var table = (0, _utils2.findTable)(view.state.selection);
|
|
612
|
-
if (
|
|
613
|
+
if ((0, _experiments.editorExperiment)('platform_editor_table_use_shared_state_hook', false)) {
|
|
613
614
|
var pluginState = (0, _pluginFactory.getPluginState)(view.state);
|
|
614
615
|
isInDanger = pluginState.isInDanger;
|
|
615
616
|
}
|
|
@@ -753,7 +754,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
753
754
|
showBeforeShadow = _this$state3.showBeforeShadow,
|
|
754
755
|
showAfterShadow = _this$state3.showAfterShadow;
|
|
755
756
|
var node = getNode();
|
|
756
|
-
if (
|
|
757
|
+
if ((0, _experiments.editorExperiment)('platform_editor_table_use_shared_state_hook', false)) {
|
|
757
758
|
var pluginState = (0, _pluginFactory.getPluginState)(view.state);
|
|
758
759
|
isInDanger = pluginState.isInDanger;
|
|
759
760
|
hoveredRows = pluginState.hoveredRows;
|
|
@@ -22,7 +22,7 @@ var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
|
|
|
22
22
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
23
23
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
24
24
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
25
|
-
var
|
|
25
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
26
26
|
var _createPluginConfig = require("../create-plugin-config");
|
|
27
27
|
var _dragAndDrop = require("../pm-plugins/drag-and-drop");
|
|
28
28
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
@@ -136,7 +136,7 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
136
136
|
key: "render",
|
|
137
137
|
value: function render(props, forwardRef) {
|
|
138
138
|
var _this3 = this;
|
|
139
|
-
if ((0,
|
|
139
|
+
if ((0, _experiments.editorExperiment)('platform_editor_table_use_shared_state_hook', true)) {
|
|
140
140
|
return /*#__PURE__*/_react.default.createElement(_TableComponentWithSharedState.TableComponentWithSharedState, {
|
|
141
141
|
forwardRef: forwardRef,
|
|
142
142
|
getNode: this.getNode,
|
|
@@ -89,8 +89,24 @@ var FixedButton = exports.FixedButton = function FixedButton(_ref2) {
|
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
}, [fixedButtonRef, observerTargetRef, tableWrapper, targetCellPosition, targetCellRef, isContextualMenuOpen]);
|
|
92
|
-
var targetCellRect = targetCellRef.getBoundingClientRect();
|
|
93
92
|
var fixedButtonTop = (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css') ? 0 : stickyHeader.top;
|
|
93
|
+
var containerLeft = (0, _react.useMemo)(function () {
|
|
94
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css')) {
|
|
95
|
+
return 0;
|
|
96
|
+
}
|
|
97
|
+
var container = targetCellRef.closest('[data-testid="ak-editor-fp-content-area"]');
|
|
98
|
+
return (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().left) || 0;
|
|
99
|
+
}, [targetCellRef]);
|
|
100
|
+
var left = (0, _react.useMemo)(function () {
|
|
101
|
+
var targetCellRect = targetCellRef.getBoundingClientRect();
|
|
102
|
+
var baseLeft = calcLeftPos({
|
|
103
|
+
buttonWidth: BUTTON_WIDTH,
|
|
104
|
+
cellRectLeft: targetCellRect.left,
|
|
105
|
+
cellRefWidth: targetCellRef.clientWidth,
|
|
106
|
+
offset: offset
|
|
107
|
+
});
|
|
108
|
+
return baseLeft - containerLeft;
|
|
109
|
+
}, [containerLeft, targetCellRef, offset]);
|
|
94
110
|
|
|
95
111
|
// Using a portal here to ensure wrapperRef has the tableWrapper as an
|
|
96
112
|
// ancestor. This is required to make the Intersection Observer work.
|
|
@@ -125,12 +141,7 @@ var FixedButton = exports.FixedButton = function FixedButton(_ref2) {
|
|
|
125
141
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
126
142
|
zIndex: _editorSharedStyles.akEditorTableCellOnStickyHeaderZIndex,
|
|
127
143
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
128
|
-
left:
|
|
129
|
-
buttonWidth: BUTTON_WIDTH,
|
|
130
|
-
cellRectLeft: targetCellRect.left,
|
|
131
|
-
cellRefWidth: targetCellRef.clientWidth,
|
|
132
|
-
offset: offset
|
|
133
|
-
}),
|
|
144
|
+
left: left,
|
|
134
145
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
135
146
|
width: "var(--ds-space-250, 20px)",
|
|
136
147
|
// BUTTON_WIDTH
|
|
@@ -88,7 +88,8 @@ var FloatingContextualButtonInner = /*#__PURE__*/_react.default.memo(function (p
|
|
|
88
88
|
keymap: (0, _platformFeatureFlags.fg)('platform_editor_a11y_table_context_menu') ? _keymaps.focusToContextMenuTrigger : undefined,
|
|
89
89
|
onClick: handleClick,
|
|
90
90
|
iconBefore: (0, _react2.jsx)(_chevronDown.default, {
|
|
91
|
-
label: ""
|
|
91
|
+
label: "",
|
|
92
|
+
isFacadeDisabled: true
|
|
92
93
|
}),
|
|
93
94
|
"aria-label": labelCellOptions,
|
|
94
95
|
"aria-expanded": (0, _platformFeatureFlags.fg)('platform_editor_a11y_table_context_menu') ? isContextualMenuOpen : undefined
|
|
@@ -10,6 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
12
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
13
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
13
14
|
var _types = require("../../types");
|
|
14
15
|
var _utils = require("../../utils");
|
|
15
16
|
var _ColumnControls = require("./ColumnControls");
|
|
@@ -104,7 +105,7 @@ var TableFloatingColumnControls = function TableFloatingColumnControls(_ref) {
|
|
|
104
105
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
105
106
|
isDragging: isDragging,
|
|
106
107
|
getScrollOffset: getScrollOffset,
|
|
107
|
-
api: (0,
|
|
108
|
+
api: (0, _experiments.editorExperiment)('platform_editor_table_use_shared_state_hook', true) ? api : undefined
|
|
108
109
|
}), isDragging && /*#__PURE__*/_react.default.createElement(_ColumnDropTargets.ColumnDropTargets, {
|
|
109
110
|
tableRef: tableRef,
|
|
110
111
|
isHeaderSticky: (stickyHeader === null || stickyHeader === void 0 ? void 0 : stickyHeader.sticky) && hasHeaderRow,
|
|
@@ -17,6 +17,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
17
17
|
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
18
18
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
19
19
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
20
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
21
|
var _commands = require("../../../commands");
|
|
21
22
|
var _types = require("../../../types");
|
|
22
23
|
var _utils2 = require("../../../utils");
|
|
@@ -76,9 +77,10 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
76
77
|
stickyTop = _this$props3.stickyTop,
|
|
77
78
|
hasHeaderRow = _this$props3.hasHeaderRow;
|
|
78
79
|
if (stickyTop && hasHeaderRow && index === 0) {
|
|
80
|
+
var topOffset = (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css') ? 0 : stickyTop;
|
|
79
81
|
return {
|
|
80
82
|
height: rowHeight,
|
|
81
|
-
top: "".concat(
|
|
83
|
+
top: "".concat(topOffset, "px")
|
|
82
84
|
};
|
|
83
85
|
}
|
|
84
86
|
return {
|
|
@@ -10,7 +10,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
11
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
12
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
13
|
-
var
|
|
13
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
14
14
|
var _commands = require("../../commands");
|
|
15
15
|
var _types = require("../../types");
|
|
16
16
|
var _nodes = require("../../utils/nodes");
|
|
@@ -108,7 +108,7 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
108
108
|
updateCellHoverLocation: updateCellHoverLocation,
|
|
109
109
|
stickyTop: stickyTop,
|
|
110
110
|
isDragAndDropEnabled: isDragAndDropEnabled
|
|
111
|
-
}) : null, tableActive && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, shouldShowCornerControls && ((0,
|
|
111
|
+
}) : null, tableActive && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, shouldShowCornerControls && ((0, _experiments.editorExperiment)('platform_editor_table_use_shared_state_hook', true) ? /*#__PURE__*/_react.default.createElement(_CornerControls.DragCornerControlsWithSelection, {
|
|
112
112
|
editorView: editorView,
|
|
113
113
|
tableRef: tableRef,
|
|
114
114
|
isInDanger: isInDanger,
|
|
@@ -133,7 +133,7 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
133
133
|
selectRow: _selectRow,
|
|
134
134
|
selectRows: _selectRows,
|
|
135
135
|
updateCellHoverLocation: updateCellHoverLocation
|
|
136
|
-
})) : (0,
|
|
136
|
+
})) : (0, _experiments.editorExperiment)('platform_editor_table_use_shared_state_hook', true) ? /*#__PURE__*/_react.default.createElement(_FloatingControlsWithSelection.FloatingControlsWithSelection, {
|
|
137
137
|
editorView: editorView,
|
|
138
138
|
tableRef: tableRef,
|
|
139
139
|
isInDanger: isInDanger,
|
|
@@ -13,6 +13,7 @@ import { akEditorTableNumberColumnWidth, akEditorTableToolbarSize as tableToolba
|
|
|
13
13
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
16
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
16
17
|
import { autoSizeTable, clearHoverSelection } from '../commands';
|
|
17
18
|
import { handleMouseOut, handleMouseOver, isTableInFocus, withCellTracking } from '../event-handlers';
|
|
18
19
|
import { autoScrollerFactory } from '../pm-plugins/drag-and-drop/utils';
|
|
@@ -589,7 +590,7 @@ class TableComponent extends React.Component {
|
|
|
589
590
|
isInDanger
|
|
590
591
|
} = this.props;
|
|
591
592
|
const table = findTable(view.state.selection);
|
|
592
|
-
if (
|
|
593
|
+
if (editorExperiment('platform_editor_table_use_shared_state_hook', false)) {
|
|
593
594
|
const pluginState = getPluginState(view.state);
|
|
594
595
|
isInDanger = pluginState.isInDanger;
|
|
595
596
|
}
|
|
@@ -733,7 +734,7 @@ class TableComponent extends React.Component {
|
|
|
733
734
|
showAfterShadow
|
|
734
735
|
} = this.state;
|
|
735
736
|
const node = getNode();
|
|
736
|
-
if (
|
|
737
|
+
if (editorExperiment('platform_editor_table_use_shared_state_hook', false)) {
|
|
737
738
|
const pluginState = getPluginState(view.state);
|
|
738
739
|
isInDanger = pluginState.isInDanger;
|
|
739
740
|
hoveredRows = pluginState.hoveredRows;
|
|
@@ -6,7 +6,7 @@ import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
|
6
6
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
7
7
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
8
8
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
9
|
-
import {
|
|
9
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
10
|
import { pluginConfig as getPluginConfig } from '../create-plugin-config';
|
|
11
11
|
import { pluginKey as tableDragAndDropPluginKey } from '../pm-plugins/drag-and-drop';
|
|
12
12
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -103,7 +103,7 @@ export default class TableView extends ReactNodeView {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
render(props, forwardRef) {
|
|
106
|
-
if (
|
|
106
|
+
if (editorExperiment('platform_editor_table_use_shared_state_hook', true)) {
|
|
107
107
|
return /*#__PURE__*/React.createElement(TableComponentWithSharedState, {
|
|
108
108
|
forwardRef: forwardRef,
|
|
109
109
|
getNode: this.getNode,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import rafSchedule from 'raf-schd';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import { akEditorTableCellOnStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -81,8 +81,24 @@ export const FixedButton = ({
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
}, [fixedButtonRef, observerTargetRef, tableWrapper, targetCellPosition, targetCellRef, isContextualMenuOpen]);
|
|
84
|
-
const targetCellRect = targetCellRef.getBoundingClientRect();
|
|
85
84
|
const fixedButtonTop = fg('platform_editor_breakout_use_css') ? 0 : stickyHeader.top;
|
|
85
|
+
const containerLeft = useMemo(() => {
|
|
86
|
+
if (!fg('platform_editor_breakout_use_css')) {
|
|
87
|
+
return 0;
|
|
88
|
+
}
|
|
89
|
+
const container = targetCellRef.closest('[data-testid="ak-editor-fp-content-area"]');
|
|
90
|
+
return (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().left) || 0;
|
|
91
|
+
}, [targetCellRef]);
|
|
92
|
+
const left = useMemo(() => {
|
|
93
|
+
const targetCellRect = targetCellRef.getBoundingClientRect();
|
|
94
|
+
const baseLeft = calcLeftPos({
|
|
95
|
+
buttonWidth: BUTTON_WIDTH,
|
|
96
|
+
cellRectLeft: targetCellRect.left,
|
|
97
|
+
cellRefWidth: targetCellRef.clientWidth,
|
|
98
|
+
offset
|
|
99
|
+
});
|
|
100
|
+
return baseLeft - containerLeft;
|
|
101
|
+
}, [containerLeft, targetCellRef, offset]);
|
|
86
102
|
|
|
87
103
|
// Using a portal here to ensure wrapperRef has the tableWrapper as an
|
|
88
104
|
// ancestor. This is required to make the Intersection Observer work.
|
|
@@ -117,12 +133,7 @@ export const FixedButton = ({
|
|
|
117
133
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
118
134
|
zIndex: akEditorTableCellOnStickyHeaderZIndex,
|
|
119
135
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
120
|
-
left
|
|
121
|
-
buttonWidth: BUTTON_WIDTH,
|
|
122
|
-
cellRectLeft: targetCellRect.left,
|
|
123
|
-
cellRefWidth: targetCellRef.clientWidth,
|
|
124
|
-
offset
|
|
125
|
-
}),
|
|
136
|
+
left,
|
|
126
137
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
127
138
|
width: "var(--ds-space-250, 20px)",
|
|
128
139
|
// BUTTON_WIDTH
|
|
@@ -85,7 +85,8 @@ const FloatingContextualButtonInner = /*#__PURE__*/React.memo(props => {
|
|
|
85
85
|
keymap: fg('platform_editor_a11y_table_context_menu') ? focusToContextMenuTrigger : undefined,
|
|
86
86
|
onClick: handleClick,
|
|
87
87
|
iconBefore: jsx(ExpandIcon, {
|
|
88
|
-
label: ""
|
|
88
|
+
label: "",
|
|
89
|
+
isFacadeDisabled: true
|
|
89
90
|
}),
|
|
90
91
|
"aria-label": labelCellOptions,
|
|
91
92
|
"aria-expanded": fg('platform_editor_a11y_table_context_menu') ? isContextualMenuOpen : undefined
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
4
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
5
|
import { TableCssClassName as ClassName } from '../../types';
|
|
5
6
|
import { containsHeaderColumn, getColumnsWidths, getRowHeights } from '../../utils';
|
|
6
7
|
import { ColumnControls } from './ColumnControls';
|
|
@@ -93,7 +94,7 @@ const TableFloatingColumnControls = ({
|
|
|
93
94
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
94
95
|
isDragging: isDragging,
|
|
95
96
|
getScrollOffset: getScrollOffset,
|
|
96
|
-
api:
|
|
97
|
+
api: editorExperiment('platform_editor_table_use_shared_state_hook', true) ? api : undefined
|
|
97
98
|
}), isDragging && /*#__PURE__*/React.createElement(ColumnDropTargets, {
|
|
98
99
|
tableRef: tableRef,
|
|
99
100
|
isHeaderSticky: (stickyHeader === null || stickyHeader === void 0 ? void 0 : stickyHeader.sticky) && hasHeaderRow,
|
|
@@ -3,6 +3,7 @@ import React, { Component } from 'react';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { isRowSelected } from '@atlaskit/editor-tables/utils';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { clearHoverSelection } from '../../../commands';
|
|
7
8
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
8
9
|
import { getRowHeights } from '../../../utils';
|
|
@@ -57,9 +58,10 @@ export default class NumberColumn extends Component {
|
|
|
57
58
|
hasHeaderRow
|
|
58
59
|
} = this.props;
|
|
59
60
|
if (stickyTop && hasHeaderRow && index === 0) {
|
|
61
|
+
const topOffset = fg('platform_editor_breakout_use_css') ? 0 : stickyTop;
|
|
60
62
|
return {
|
|
61
63
|
height: rowHeight,
|
|
62
|
-
top: `${
|
|
64
|
+
top: `${topOffset}px`
|
|
63
65
|
};
|
|
64
66
|
}
|
|
65
67
|
return {
|
|
@@ -2,7 +2,7 @@ import React, { useCallback } from 'react';
|
|
|
2
2
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
3
3
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
5
|
-
import {
|
|
5
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
6
|
import { hoverCell, hoverRows, selectRow, selectRows } from '../../commands';
|
|
7
7
|
import { TableCssClassName as ClassName } from '../../types';
|
|
8
8
|
import { isTableNested } from '../../utils/nodes';
|
|
@@ -106,7 +106,7 @@ export const TableFloatingControls = ({
|
|
|
106
106
|
updateCellHoverLocation: updateCellHoverLocation,
|
|
107
107
|
stickyTop: stickyTop,
|
|
108
108
|
isDragAndDropEnabled: isDragAndDropEnabled
|
|
109
|
-
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(React.Fragment, null, shouldShowCornerControls && (
|
|
109
|
+
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(React.Fragment, null, shouldShowCornerControls && (editorExperiment('platform_editor_table_use_shared_state_hook', true) ? /*#__PURE__*/React.createElement(DragCornerControlsWithSelection, {
|
|
110
110
|
editorView: editorView,
|
|
111
111
|
tableRef: tableRef,
|
|
112
112
|
isInDanger: isInDanger,
|
|
@@ -131,7 +131,7 @@ export const TableFloatingControls = ({
|
|
|
131
131
|
selectRow: _selectRow,
|
|
132
132
|
selectRows: _selectRows,
|
|
133
133
|
updateCellHoverLocation: updateCellHoverLocation
|
|
134
|
-
})) :
|
|
134
|
+
})) : editorExperiment('platform_editor_table_use_shared_state_hook', true) ? /*#__PURE__*/React.createElement(FloatingControlsWithSelection, {
|
|
135
135
|
editorView: editorView,
|
|
136
136
|
tableRef: tableRef,
|
|
137
137
|
isInDanger: isInDanger,
|
|
@@ -27,6 +27,7 @@ import { akEditorTableNumberColumnWidth, akEditorTableToolbarSize as tableToolba
|
|
|
27
27
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
28
28
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
29
29
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
30
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
30
31
|
import { autoSizeTable, clearHoverSelection } from '../commands';
|
|
31
32
|
import { handleMouseOut, handleMouseOver, isTableInFocus, withCellTracking } from '../event-handlers';
|
|
32
33
|
import { autoScrollerFactory } from '../pm-plugins/drag-and-drop/utils';
|
|
@@ -602,7 +603,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
602
603
|
getEditorFeatureFlags = _this$props11.getEditorFeatureFlags;
|
|
603
604
|
var isInDanger = this.props.isInDanger;
|
|
604
605
|
var table = findTable(view.state.selection);
|
|
605
|
-
if (
|
|
606
|
+
if (editorExperiment('platform_editor_table_use_shared_state_hook', false)) {
|
|
606
607
|
var pluginState = getPluginState(view.state);
|
|
607
608
|
isInDanger = pluginState.isInDanger;
|
|
608
609
|
}
|
|
@@ -746,7 +747,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
746
747
|
showBeforeShadow = _this$state3.showBeforeShadow,
|
|
747
748
|
showAfterShadow = _this$state3.showAfterShadow;
|
|
748
749
|
var node = getNode();
|
|
749
|
-
if (
|
|
750
|
+
if (editorExperiment('platform_editor_table_use_shared_state_hook', false)) {
|
|
750
751
|
var pluginState = getPluginState(view.state);
|
|
751
752
|
isInDanger = pluginState.isInDanger;
|
|
752
753
|
hoveredRows = pluginState.hoveredRows;
|
|
@@ -17,7 +17,7 @@ import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
|
17
17
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
18
18
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
19
19
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
20
|
-
import {
|
|
20
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
21
21
|
import { pluginConfig as getPluginConfig } from '../create-plugin-config';
|
|
22
22
|
import { pluginKey as tableDragAndDropPluginKey } from '../pm-plugins/drag-and-drop';
|
|
23
23
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -129,7 +129,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
129
129
|
key: "render",
|
|
130
130
|
value: function render(props, forwardRef) {
|
|
131
131
|
var _this3 = this;
|
|
132
|
-
if (
|
|
132
|
+
if (editorExperiment('platform_editor_table_use_shared_state_hook', true)) {
|
|
133
133
|
return /*#__PURE__*/React.createElement(TableComponentWithSharedState, {
|
|
134
134
|
forwardRef: forwardRef,
|
|
135
135
|
getNode: this.getNode,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import rafSchedule from 'raf-schd';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import { akEditorTableCellOnStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -79,8 +79,24 @@ export var FixedButton = function FixedButton(_ref2) {
|
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
}, [fixedButtonRef, observerTargetRef, tableWrapper, targetCellPosition, targetCellRef, isContextualMenuOpen]);
|
|
82
|
-
var targetCellRect = targetCellRef.getBoundingClientRect();
|
|
83
82
|
var fixedButtonTop = fg('platform_editor_breakout_use_css') ? 0 : stickyHeader.top;
|
|
83
|
+
var containerLeft = useMemo(function () {
|
|
84
|
+
if (!fg('platform_editor_breakout_use_css')) {
|
|
85
|
+
return 0;
|
|
86
|
+
}
|
|
87
|
+
var container = targetCellRef.closest('[data-testid="ak-editor-fp-content-area"]');
|
|
88
|
+
return (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().left) || 0;
|
|
89
|
+
}, [targetCellRef]);
|
|
90
|
+
var left = useMemo(function () {
|
|
91
|
+
var targetCellRect = targetCellRef.getBoundingClientRect();
|
|
92
|
+
var baseLeft = calcLeftPos({
|
|
93
|
+
buttonWidth: BUTTON_WIDTH,
|
|
94
|
+
cellRectLeft: targetCellRect.left,
|
|
95
|
+
cellRefWidth: targetCellRef.clientWidth,
|
|
96
|
+
offset: offset
|
|
97
|
+
});
|
|
98
|
+
return baseLeft - containerLeft;
|
|
99
|
+
}, [containerLeft, targetCellRef, offset]);
|
|
84
100
|
|
|
85
101
|
// Using a portal here to ensure wrapperRef has the tableWrapper as an
|
|
86
102
|
// ancestor. This is required to make the Intersection Observer work.
|
|
@@ -115,12 +131,7 @@ export var FixedButton = function FixedButton(_ref2) {
|
|
|
115
131
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
116
132
|
zIndex: akEditorTableCellOnStickyHeaderZIndex,
|
|
117
133
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
118
|
-
left:
|
|
119
|
-
buttonWidth: BUTTON_WIDTH,
|
|
120
|
-
cellRectLeft: targetCellRect.left,
|
|
121
|
-
cellRefWidth: targetCellRef.clientWidth,
|
|
122
|
-
offset: offset
|
|
123
|
-
}),
|
|
134
|
+
left: left,
|
|
124
135
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
125
136
|
width: "var(--ds-space-250, 20px)",
|
|
126
137
|
// BUTTON_WIDTH
|
|
@@ -77,7 +77,8 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
77
77
|
keymap: fg('platform_editor_a11y_table_context_menu') ? focusToContextMenuTrigger : undefined,
|
|
78
78
|
onClick: handleClick,
|
|
79
79
|
iconBefore: jsx(ExpandIcon, {
|
|
80
|
-
label: ""
|
|
80
|
+
label: "",
|
|
81
|
+
isFacadeDisabled: true
|
|
81
82
|
}),
|
|
82
83
|
"aria-label": labelCellOptions,
|
|
83
84
|
"aria-expanded": fg('platform_editor_a11y_table_context_menu') ? isContextualMenuOpen : undefined
|
|
@@ -2,6 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
5
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
6
|
import { TableCssClassName as ClassName } from '../../types';
|
|
6
7
|
import { containsHeaderColumn, getColumnsWidths, getRowHeights } from '../../utils';
|
|
7
8
|
import { ColumnControls } from './ColumnControls';
|
|
@@ -94,7 +95,7 @@ var TableFloatingColumnControls = function TableFloatingColumnControls(_ref) {
|
|
|
94
95
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
95
96
|
isDragging: isDragging,
|
|
96
97
|
getScrollOffset: getScrollOffset,
|
|
97
|
-
api:
|
|
98
|
+
api: editorExperiment('platform_editor_table_use_shared_state_hook', true) ? api : undefined
|
|
98
99
|
}), isDragging && /*#__PURE__*/React.createElement(ColumnDropTargets, {
|
|
99
100
|
tableRef: tableRef,
|
|
100
101
|
isHeaderSticky: (stickyHeader === null || stickyHeader === void 0 ? void 0 : stickyHeader.sticky) && hasHeaderRow,
|
|
@@ -11,6 +11,7 @@ import React, { Component } from 'react';
|
|
|
11
11
|
import classnames from 'classnames';
|
|
12
12
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
13
13
|
import { isRowSelected } from '@atlaskit/editor-tables/utils';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
15
|
import { clearHoverSelection } from '../../../commands';
|
|
15
16
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
16
17
|
import { getRowHeights } from '../../../utils';
|
|
@@ -66,9 +67,10 @@ var NumberColumn = /*#__PURE__*/function (_Component) {
|
|
|
66
67
|
stickyTop = _this$props3.stickyTop,
|
|
67
68
|
hasHeaderRow = _this$props3.hasHeaderRow;
|
|
68
69
|
if (stickyTop && hasHeaderRow && index === 0) {
|
|
70
|
+
var topOffset = fg('platform_editor_breakout_use_css') ? 0 : stickyTop;
|
|
69
71
|
return {
|
|
70
72
|
height: rowHeight,
|
|
71
|
-
top: "".concat(
|
|
73
|
+
top: "".concat(topOffset, "px")
|
|
72
74
|
};
|
|
73
75
|
}
|
|
74
76
|
return {
|
|
@@ -2,7 +2,7 @@ import React, { useCallback } from 'react';
|
|
|
2
2
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
3
3
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
5
|
-
import {
|
|
5
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
6
|
import { hoverCell, hoverRows, selectRow, selectRows } from '../../commands';
|
|
7
7
|
import { TableCssClassName as ClassName } from '../../types';
|
|
8
8
|
import { isTableNested } from '../../utils/nodes';
|
|
@@ -98,7 +98,7 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
|
98
98
|
updateCellHoverLocation: updateCellHoverLocation,
|
|
99
99
|
stickyTop: stickyTop,
|
|
100
100
|
isDragAndDropEnabled: isDragAndDropEnabled
|
|
101
|
-
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(React.Fragment, null, shouldShowCornerControls && (
|
|
101
|
+
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(React.Fragment, null, shouldShowCornerControls && (editorExperiment('platform_editor_table_use_shared_state_hook', true) ? /*#__PURE__*/React.createElement(DragCornerControlsWithSelection, {
|
|
102
102
|
editorView: editorView,
|
|
103
103
|
tableRef: tableRef,
|
|
104
104
|
isInDanger: isInDanger,
|
|
@@ -123,7 +123,7 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
|
123
123
|
selectRow: _selectRow,
|
|
124
124
|
selectRows: _selectRows,
|
|
125
125
|
updateCellHoverLocation: updateCellHoverLocation
|
|
126
|
-
})) :
|
|
126
|
+
})) : editorExperiment('platform_editor_table_use_shared_state_hook', true) ? /*#__PURE__*/React.createElement(FloatingControlsWithSelection, {
|
|
127
127
|
editorView: editorView,
|
|
128
128
|
tableRef: tableRef,
|
|
129
129
|
isInDanger: isInDanger,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.28.
|
|
3
|
+
"version": "7.28.4",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@atlaskit/adf-schema": "^40.9.0",
|
|
31
31
|
"@atlaskit/button": "^20.2.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.7.0",
|
|
33
|
-
"@atlaskit/editor-common": "^91.
|
|
33
|
+
"@atlaskit/editor-common": "^91.2.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.6.1",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.8.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
44
44
|
"@atlaskit/editor-shared-styles": "^3.0.0",
|
|
45
45
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
46
|
-
"@atlaskit/icon": "^22.
|
|
46
|
+
"@atlaskit/icon": "^22.19.0",
|
|
47
47
|
"@atlaskit/menu": "^2.12.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
49
49
|
"@atlaskit/pragmatic-drag-and-drop": "^1.3.0",
|
|
@@ -103,9 +103,6 @@
|
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
105
|
"platform-feature-flags": {
|
|
106
|
-
"platform.editor.table.use-shared-state-hook": {
|
|
107
|
-
"type": "boolean"
|
|
108
|
-
},
|
|
109
106
|
"platform_editor_batch_steps_table": {
|
|
110
107
|
"type": "boolean"
|
|
111
108
|
},
|
|
@@ -26,6 +26,7 @@ import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
|
26
26
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
27
27
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
28
28
|
import type { CleanupFn } from '@atlaskit/pragmatic-drag-and-drop/types';
|
|
29
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
29
30
|
import { token } from '@atlaskit/tokens';
|
|
30
31
|
|
|
31
32
|
import { autoSizeTable, clearHoverSelection } from '../commands';
|
|
@@ -117,7 +118,7 @@ interface ComponentProps {
|
|
|
117
118
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
118
119
|
intl: IntlShape;
|
|
119
120
|
|
|
120
|
-
// marking props as option to ensure backward compatibility when
|
|
121
|
+
// marking props as option to ensure backward compatibility when platform_editor_table_use_shared_state_hook disabled
|
|
121
122
|
isInDanger?: boolean;
|
|
122
123
|
hoveredRows?: number[];
|
|
123
124
|
hoveredCell?: CellHoverMeta;
|
|
@@ -536,7 +537,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
536
537
|
|
|
537
538
|
const table = findTable(view.state.selection);
|
|
538
539
|
|
|
539
|
-
if (
|
|
540
|
+
if (editorExperiment('platform_editor_table_use_shared_state_hook', false)) {
|
|
540
541
|
const pluginState = getPluginState(view.state);
|
|
541
542
|
isInDanger = pluginState.isInDanger;
|
|
542
543
|
}
|
|
@@ -749,7 +750,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
749
750
|
const { showBeforeShadow, showAfterShadow } = this.state;
|
|
750
751
|
const node = getNode();
|
|
751
752
|
|
|
752
|
-
if (
|
|
753
|
+
if (editorExperiment('platform_editor_table_use_shared_state_hook', false)) {
|
|
753
754
|
const pluginState = getPluginState(view.state);
|
|
754
755
|
isInDanger = pluginState.isInDanger;
|
|
755
756
|
hoveredRows = pluginState.hoveredRows;
|
package/src/nodeviews/table.tsx
CHANGED
|
@@ -19,7 +19,7 @@ import type { EditorState, PluginKey } from '@atlaskit/editor-prosemirror/state'
|
|
|
19
19
|
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
20
20
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
21
21
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
22
|
-
import {
|
|
22
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
23
23
|
|
|
24
24
|
import { pluginConfig as getPluginConfig } from '../create-plugin-config';
|
|
25
25
|
import { pluginKey as tableDragAndDropPluginKey } from '../pm-plugins/drag-and-drop';
|
|
@@ -182,7 +182,7 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
182
182
|
};
|
|
183
183
|
|
|
184
184
|
render(props: Props, forwardRef: ForwardRef) {
|
|
185
|
-
if (
|
|
185
|
+
if (editorExperiment('platform_editor_table_use_shared_state_hook', true)) {
|
|
186
186
|
return (
|
|
187
187
|
<TableComponentWithSharedState
|
|
188
188
|
forwardRef={forwardRef}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
|
|
3
3
|
import rafSchedule from 'raf-schd';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
@@ -130,10 +130,29 @@ export const FixedButton = ({
|
|
|
130
130
|
isContextualMenuOpen,
|
|
131
131
|
]);
|
|
132
132
|
|
|
133
|
-
const targetCellRect = targetCellRef.getBoundingClientRect();
|
|
134
|
-
|
|
135
133
|
const fixedButtonTop = fg('platform_editor_breakout_use_css') ? 0 : stickyHeader.top;
|
|
136
134
|
|
|
135
|
+
const containerLeft = useMemo(() => {
|
|
136
|
+
if (!fg('platform_editor_breakout_use_css')) {
|
|
137
|
+
return 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const container = targetCellRef.closest('[data-testid="ak-editor-fp-content-area"]');
|
|
141
|
+
return container?.getBoundingClientRect().left || 0;
|
|
142
|
+
}, [targetCellRef]);
|
|
143
|
+
|
|
144
|
+
const left = useMemo(() => {
|
|
145
|
+
const targetCellRect = targetCellRef.getBoundingClientRect();
|
|
146
|
+
const baseLeft = calcLeftPos({
|
|
147
|
+
buttonWidth: BUTTON_WIDTH,
|
|
148
|
+
cellRectLeft: targetCellRect.left,
|
|
149
|
+
cellRefWidth: targetCellRef.clientWidth,
|
|
150
|
+
offset,
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
return baseLeft - containerLeft;
|
|
154
|
+
}, [containerLeft, targetCellRef, offset]);
|
|
155
|
+
|
|
137
156
|
// Using a portal here to ensure wrapperRef has the tableWrapper as an
|
|
138
157
|
// ancestor. This is required to make the Intersection Observer work.
|
|
139
158
|
return createPortal(
|
|
@@ -166,12 +185,7 @@ export const FixedButton = ({
|
|
|
166
185
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
167
186
|
zIndex: akEditorTableCellOnStickyHeaderZIndex,
|
|
168
187
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
169
|
-
left
|
|
170
|
-
buttonWidth: BUTTON_WIDTH,
|
|
171
|
-
cellRectLeft: targetCellRect.left,
|
|
172
|
-
cellRefWidth: targetCellRef.clientWidth,
|
|
173
|
-
offset,
|
|
174
|
-
}),
|
|
188
|
+
left,
|
|
175
189
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
176
190
|
width: token('space.250', '20px'), // BUTTON_WIDTH
|
|
177
191
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -110,7 +110,7 @@ const FloatingContextualButtonInner = React.memo((props: Props & WrappedComponen
|
|
|
110
110
|
fg('platform_editor_a11y_table_context_menu') ? focusToContextMenuTrigger : undefined
|
|
111
111
|
}
|
|
112
112
|
onClick={handleClick}
|
|
113
|
-
iconBefore={<ExpandIcon label="" />}
|
|
113
|
+
iconBefore={<ExpandIcon label="" isFacadeDisabled={true} />}
|
|
114
114
|
aria-label={labelCellOptions}
|
|
115
115
|
aria-expanded={
|
|
116
116
|
fg('platform_editor_a11y_table_context_menu') ? isContextualMenuOpen : undefined
|
|
@@ -7,6 +7,7 @@ import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
7
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
10
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
11
|
|
|
11
12
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
12
13
|
import type { CellHoverMeta, DraggableSourceData, PluginInjectionAPI } from '../../types';
|
|
@@ -136,7 +137,9 @@ const TableFloatingColumnControls = ({
|
|
|
136
137
|
isNumberColumnEnabled={isNumberColumnEnabled}
|
|
137
138
|
isDragging={isDragging}
|
|
138
139
|
getScrollOffset={getScrollOffset}
|
|
139
|
-
api={
|
|
140
|
+
api={
|
|
141
|
+
editorExperiment('platform_editor_table_use_shared_state_hook', true) ? api : undefined
|
|
142
|
+
}
|
|
140
143
|
/>
|
|
141
144
|
{isDragging && (
|
|
142
145
|
<ColumnDropTargets
|
|
@@ -5,6 +5,7 @@ import classnames from 'classnames';
|
|
|
5
5
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import { isRowSelected } from '@atlaskit/editor-tables/utils';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
|
|
9
10
|
import { clearHoverSelection } from '../../../commands';
|
|
10
11
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
@@ -111,9 +112,11 @@ export default class NumberColumn extends Component<Props, any> {
|
|
|
111
112
|
private getCellStyles = (index: number, rowHeight: number) => {
|
|
112
113
|
const { stickyTop, hasHeaderRow } = this.props;
|
|
113
114
|
if (stickyTop && hasHeaderRow && index === 0) {
|
|
115
|
+
const topOffset = fg('platform_editor_breakout_use_css') ? 0 : stickyTop;
|
|
116
|
+
|
|
114
117
|
return {
|
|
115
118
|
height: rowHeight,
|
|
116
|
-
top: `${
|
|
119
|
+
top: `${topOffset}px`,
|
|
117
120
|
};
|
|
118
121
|
}
|
|
119
122
|
return {
|
|
@@ -8,7 +8,7 @@ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
8
8
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
9
9
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
10
10
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
11
|
-
import {
|
|
11
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
12
|
|
|
13
13
|
import { hoverCell, hoverRows, selectRow, selectRows } from '../../commands';
|
|
14
14
|
import type { TablePlugin } from '../../plugin';
|
|
@@ -163,7 +163,7 @@ export const TableFloatingControls = ({
|
|
|
163
163
|
{isDragAndDropEnabled ? (
|
|
164
164
|
<>
|
|
165
165
|
{shouldShowCornerControls &&
|
|
166
|
-
(
|
|
166
|
+
(editorExperiment('platform_editor_table_use_shared_state_hook', true) ? (
|
|
167
167
|
<DragCornerControlsWithSelection
|
|
168
168
|
editorView={editorView}
|
|
169
169
|
tableRef={tableRef}
|
|
@@ -195,7 +195,7 @@ export const TableFloatingControls = ({
|
|
|
195
195
|
updateCellHoverLocation={updateCellHoverLocation}
|
|
196
196
|
/>
|
|
197
197
|
</>
|
|
198
|
-
) :
|
|
198
|
+
) : editorExperiment('platform_editor_table_use_shared_state_hook', true) ? (
|
|
199
199
|
<FloatingControlsWithSelection
|
|
200
200
|
editorView={editorView}
|
|
201
201
|
tableRef={tableRef}
|