@atlaskit/editor-plugin-table 9.3.1 → 9.3.2
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 +9 -0
- package/dist/cjs/nodeviews/TableComponent.js +1 -3
- package/dist/cjs/nodeviews/TableRow.js +1 -6
- package/dist/cjs/nodeviews/toDOM.js +4 -16
- package/dist/cjs/pm-plugins/utils/paste.js +3 -3
- package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +1 -5
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -1
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +2 -6
- package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -2
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +1 -2
- package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +1 -4
- package/dist/es2019/nodeviews/TableComponent.js +2 -2
- package/dist/es2019/nodeviews/TableRow.js +1 -6
- package/dist/es2019/nodeviews/toDOM.js +3 -16
- package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +1 -5
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -1
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +2 -7
- package/dist/es2019/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -2
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +1 -2
- package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +1 -5
- package/dist/esm/nodeviews/TableComponent.js +1 -3
- package/dist/esm/nodeviews/TableRow.js +1 -6
- package/dist/esm/nodeviews/toDOM.js +4 -16
- package/dist/esm/pm-plugins/utils/paste.js +3 -3
- package/dist/esm/ui/FloatingContextualButton/FixedButton.js +1 -5
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -1
- package/dist/esm/ui/TableFloatingColumnControls/index.js +2 -6
- package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -2
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +1 -2
- package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +1 -4
- package/package.json +2 -5
- package/src/nodeviews/TableComponent.tsx +1 -3
- package/src/nodeviews/TableRow.ts +1 -7
- package/src/nodeviews/toDOM.ts +2 -21
- package/src/ui/FloatingContextualButton/FixedButton.tsx +1 -6
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +1 -1
- package/src/ui/TableFloatingColumnControls/index.tsx +1 -6
- package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +1 -6
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +1 -2
- package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +1 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 9.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#108797](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/108797)
|
|
8
|
+
[`9a3f165bc940b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9a3f165bc940b) -
|
|
9
|
+
tidy up feature flag confluence_frontend_editor_custom_presets
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 9.3.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -813,8 +813,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
813
813
|
key: "render",
|
|
814
814
|
value: function render() {
|
|
815
815
|
var _this5 = this,
|
|
816
|
-
_this$state$stickyHea2,
|
|
817
|
-
_this$state$stickyHea3,
|
|
818
816
|
_this$props$options10;
|
|
819
817
|
var _this$props12 = this.props,
|
|
820
818
|
view = _this$props12.view,
|
|
@@ -931,7 +929,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
931
929
|
}
|
|
932
930
|
var isNested = (0, _nodes.isTableNested)(view.state, tablePos);
|
|
933
931
|
var topShadowPadding = isDragAndDropEnabled ? 0 : shadowPadding;
|
|
934
|
-
var topOffset =
|
|
932
|
+
var topOffset = 0;
|
|
935
933
|
var topStickyShadowPosition = this.state.stickyHeader && topOffset + this.state.stickyHeader.padding + topShadowPadding + 2;
|
|
936
934
|
var _getEditorFeatureFlag7 = getEditorFeatureFlags(),
|
|
937
935
|
_getEditorFeatureFlag8 = _getEditorFeatureFlag7.tableWithFixedColumnWidthsOption,
|
|
@@ -14,7 +14,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
14
14
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
15
15
|
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
16
16
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
17
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
17
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
19
18
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
20
19
|
var _commands = require("../pm-plugins/sticky-headers/commands");
|
|
@@ -543,11 +542,7 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
543
542
|
_this6.refireIntersectionObservers();
|
|
544
543
|
}, fastScrollThresholdMs);
|
|
545
544
|
}
|
|
546
|
-
|
|
547
|
-
this.dom.style.top = "0px";
|
|
548
|
-
} else {
|
|
549
|
-
this.dom.style.top = "".concat(domTop, "px");
|
|
550
|
-
}
|
|
545
|
+
this.dom.style.top = "0px";
|
|
551
546
|
(0, _dom.updateStickyMargins)(table);
|
|
552
547
|
this.dom.scrollLeft = wrapper.scrollLeft;
|
|
553
548
|
this.emitOn(domTop, this.colControlsOffset);
|
|
@@ -12,7 +12,6 @@ var _kebabCase = _interopRequireDefault(require("lodash/kebabCase"));
|
|
|
12
12
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
13
13
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
14
14
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
17
16
|
var _colgroup = require("../pm-plugins/table-resizing/utils/colgroup");
|
|
18
17
|
var _consts = require("../pm-plugins/table-resizing/utils/consts");
|
|
@@ -27,7 +26,6 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
|
|
|
27
26
|
return _objectSpread(_objectSpread({}, tableNode), {}, {
|
|
28
27
|
toDOM: function toDOM(node) {
|
|
29
28
|
var gutterPadding = (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2;
|
|
30
|
-
var editorWidthFromGetter = (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css') ? undefined : Math.min(config.getEditorContainerWidth().width - gutterPadding, node.attrs.width);
|
|
31
29
|
var alignmentStyle = Object.entries((0, _tableContainerStyles.getAlignmentStyle)(node.attrs.layout)).map(function (_ref) {
|
|
32
30
|
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
33
31
|
k = _ref2[0],
|
|
@@ -35,15 +33,13 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
|
|
|
35
33
|
return "".concat((0, _kebabCase.default)(k), ": ").concat((0, _kebabCase.default)(v));
|
|
36
34
|
}).join(';');
|
|
37
35
|
var tableMinWidth = (0, _colgroup.getResizerMinWidth)(node);
|
|
38
|
-
var attrs =
|
|
36
|
+
var attrs = {
|
|
39
37
|
'data-number-column': node.attrs.isNumberColumnEnabled,
|
|
40
38
|
'data-layout': node.attrs.layout,
|
|
41
39
|
'data-autosize': node.attrs.__autoSize,
|
|
42
40
|
'data-table-local-id': node.attrs.localId,
|
|
43
41
|
'data-table-width': node.attrs.width
|
|
44
|
-
}
|
|
45
|
-
style: "width: ".concat(node.attrs.width, "px;")
|
|
46
|
-
});
|
|
42
|
+
};
|
|
47
43
|
var colgroup = '';
|
|
48
44
|
if (config.allowColumnResizing) {
|
|
49
45
|
colgroup = ['colgroup', {}].concat((0, _toConsumableArray2.default)((0, _colgroup.generateColgroup)(node)));
|
|
@@ -84,10 +80,10 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
|
|
|
84
80
|
style: alignmentStyle
|
|
85
81
|
}, ['div', {
|
|
86
82
|
class: 'pm-table-resizer-container',
|
|
87
|
-
style:
|
|
83
|
+
style: "width: min(calc(100cqw - ".concat(gutterPadding, "px), ").concat(node.attrs.width, "px);")
|
|
88
84
|
}, ['div', {
|
|
89
85
|
class: 'resizer-item display-handle',
|
|
90
|
-
style: (0,
|
|
86
|
+
style: (0, _lazyNodeView.convertToInlineCss)({
|
|
91
87
|
position: 'relative',
|
|
92
88
|
userSelect: 'auto',
|
|
93
89
|
boxSizing: 'border-box',
|
|
@@ -97,14 +93,6 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
|
|
|
97
93
|
minWidth: 'var(--ak-editor-table-min-width)',
|
|
98
94
|
maxWidth: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))",
|
|
99
95
|
width: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(node.attrs.width, ")")
|
|
100
|
-
}) : (0, _lazyNodeView.convertToInlineCss)({
|
|
101
|
-
position: 'relative',
|
|
102
|
-
userSelect: 'auto',
|
|
103
|
-
boxSizing: 'border-box',
|
|
104
|
-
height: 'auto',
|
|
105
|
-
minWidth: "".concat(tableMinWidth, "px"),
|
|
106
|
-
maxWidth: "".concat(editorWidthFromGetter, "px"),
|
|
107
|
-
width: "".concat(editorWidthFromGetter, "px;")
|
|
108
96
|
})
|
|
109
97
|
}, ['span', {
|
|
110
98
|
class: 'resizer-hover-zone'
|
|
@@ -44,7 +44,7 @@ var unwrapContentFromTable = exports.unwrapContentFromTable = function unwrapCon
|
|
|
44
44
|
// Flattens nested tables after a given nesting depth
|
|
45
45
|
// If this looks familiar, it's a heavily modified version of `mapFragment` which has been
|
|
46
46
|
// adjusted to support tracking nesting depth. This wasn't possible by using `mapFragment` directly
|
|
47
|
-
var
|
|
47
|
+
var _unwrapNestedTables = function unwrapNestedTables(content, schema, unwrapNestDepth) {
|
|
48
48
|
var currentNestDepth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
49
49
|
var flattenNested = function flattenNested(node, tableDepth) {
|
|
50
50
|
if (node.type === schema.nodes.table) {
|
|
@@ -58,7 +58,7 @@ var unwrapNestedTables = function unwrapNestedTables(content, schema, unwrapNest
|
|
|
58
58
|
var children = [];
|
|
59
59
|
for (var i = 0, size = content.childCount; i < size; i++) {
|
|
60
60
|
var node = content.child(i);
|
|
61
|
-
var transformed = node.isLeaf ? flattenNested(node, currentNestDepth) : flattenNested(node.copy(_model.Fragment.fromArray(
|
|
61
|
+
var transformed = node.isLeaf ? flattenNested(node, currentNestDepth) : flattenNested(node.copy(_model.Fragment.fromArray(_unwrapNestedTables(node.content, schema, unwrapNestDepth, node.type === schema.nodes.table ? currentNestDepth + 1 : currentNestDepth))), currentNestDepth);
|
|
62
62
|
if (transformed) {
|
|
63
63
|
if (Array.isArray(transformed)) {
|
|
64
64
|
children.push.apply(children, (0, _toConsumableArray2.default)(transformed));
|
|
@@ -141,7 +141,7 @@ var transformSliceToRemoveNestedTables = exports.transformSliceToRemoveNestedTab
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
// after we've worked out what the allowed nesting depth is, unwrap nested tables
|
|
144
|
-
var newChildren =
|
|
144
|
+
var newChildren = _unwrapNestedTables(node.content, schema, allowedTableNesting);
|
|
145
145
|
return node.copy(_model.Fragment.fromArray(newChildren));
|
|
146
146
|
});
|
|
147
147
|
return new _model.Slice(newFragment, slice.openStart, openEnd);
|
|
@@ -10,7 +10,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
11
11
|
var _reactDom = require("react-dom");
|
|
12
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _types = require("../../types");
|
|
15
14
|
var _commonStyles = require("../common-styles");
|
|
16
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -93,11 +92,8 @@ var FixedButton = exports.FixedButton = function FixedButton(_ref2) {
|
|
|
93
92
|
};
|
|
94
93
|
}
|
|
95
94
|
}, [fixedButtonRef, observerTargetRef, tableWrapper, targetCellPosition, targetCellRef, isContextualMenuOpen]);
|
|
96
|
-
var fixedButtonTop =
|
|
95
|
+
var fixedButtonTop = 0;
|
|
97
96
|
var containerLeft = (0, _react.useMemo)(function () {
|
|
98
|
-
if (!(0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css')) {
|
|
99
|
-
return 0;
|
|
100
|
-
}
|
|
101
97
|
var container = targetCellRef.closest('[data-editor-container="true"]');
|
|
102
98
|
return (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().left) || 0;
|
|
103
99
|
}, [targetCellRef]);
|
|
@@ -65,7 +65,7 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
65
65
|
var selectedColIndexes = getSelectedColumns((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection) || editorView.state.selection);
|
|
66
66
|
var firstRow = tableRef.querySelector('tr');
|
|
67
67
|
var hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
|
|
68
|
-
var rowControlStickyTop =
|
|
68
|
+
var rowControlStickyTop = 45;
|
|
69
69
|
var marginTop = hasHeaderRow && stickyTop !== undefined ? rowControlStickyTop !== null && rowControlStickyTop !== void 0 ? rowControlStickyTop : 0 : 0;
|
|
70
70
|
var handleClick = (0, _react.useCallback)(function (event) {
|
|
71
71
|
var state = editorView.state,
|
|
@@ -75,13 +75,9 @@ var TableFloatingColumnControls = function TableFloatingColumnControls(_ref) {
|
|
|
75
75
|
}
|
|
76
76
|
var colWidths = (0, _columnControls.getColumnsWidths)(editorView);
|
|
77
77
|
if (stickyTop) {
|
|
78
|
-
var
|
|
78
|
+
var _containerRef$current;
|
|
79
79
|
var columnControlTopOffsetFromParent = '-12px';
|
|
80
|
-
|
|
81
|
-
containerRef === null || containerRef === void 0 || (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 || _containerRef$current.style.setProperty('top', (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css') ? columnControlTopOffsetFromParent : // Ignored via go/ees005
|
|
82
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
83
|
-
"".concat(stickyTop - headerRowHeight + 33, "px") // 33px is padding and margin applied on tr.sticky
|
|
84
|
-
);
|
|
80
|
+
containerRef === null || containerRef === void 0 || (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 || _containerRef$current.style.setProperty('top', columnControlTopOffsetFromParent);
|
|
85
81
|
} else {
|
|
86
82
|
var _containerRef$current2;
|
|
87
83
|
containerRef === null || containerRef === void 0 || (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 || _containerRef$current2.style.removeProperty('top');
|
|
@@ -18,7 +18,6 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
18
18
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
19
19
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
20
20
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
21
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
21
|
var _commands = require("../../../pm-plugins/commands");
|
|
23
22
|
var _types = require("../../../types");
|
|
24
23
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -89,7 +88,7 @@ var CornerControlComponent = /*#__PURE__*/function (_Component) {
|
|
|
89
88
|
}),
|
|
90
89
|
style: {
|
|
91
90
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
92
|
-
top:
|
|
91
|
+
top: this.props.stickyTop !== undefined ? "0px" : undefined
|
|
93
92
|
},
|
|
94
93
|
contentEditable: false
|
|
95
94
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
@@ -16,7 +16,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
16
16
|
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
17
17
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
18
18
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
19
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
19
|
var _commands = require("../../../pm-plugins/commands");
|
|
21
20
|
var _rowControls = require("../../../pm-plugins/utils/row-controls");
|
|
22
21
|
var _types = require("../../../types");
|
|
@@ -76,7 +75,7 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
76
75
|
stickyTop = _this$props3.stickyTop,
|
|
77
76
|
hasHeaderRow = _this$props3.hasHeaderRow;
|
|
78
77
|
if (stickyTop && hasHeaderRow && index === 0) {
|
|
79
|
-
var topOffset =
|
|
78
|
+
var topOffset = 0;
|
|
80
79
|
return {
|
|
81
80
|
height: rowHeight,
|
|
82
81
|
top: "".concat(topOffset, "px")
|
|
@@ -15,7 +15,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
15
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
16
|
var _reactIntlNext = require("react-intl-next");
|
|
17
17
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
18
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
18
|
var _commands = require("../../../pm-plugins/commands");
|
|
20
19
|
var _rowControls = require("../../../pm-plugins/utils/row-controls");
|
|
21
20
|
var _types = require("../../../types");
|
|
@@ -90,9 +89,7 @@ var RowControlsComponent = /*#__PURE__*/function (_Component) {
|
|
|
90
89
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
91
90
|
marginTop: "".concat(marginTop, "px"),
|
|
92
91
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
93
|
-
top:
|
|
94
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
95
|
-
"".concat(_this2.props.stickyTop + 3, "px") : undefined,
|
|
92
|
+
top: thisRowSticky ? "3px" : undefined,
|
|
96
93
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
97
94
|
paddingTop: thisRowSticky ? "".concat(_consts.tableControlsSpacing, "px") : undefined
|
|
98
95
|
}
|
|
@@ -782,7 +782,7 @@ class TableComponent extends React.Component {
|
|
|
782
782
|
}
|
|
783
783
|
}
|
|
784
784
|
render() {
|
|
785
|
-
var _this$
|
|
785
|
+
var _this$props$options12;
|
|
786
786
|
const {
|
|
787
787
|
view,
|
|
788
788
|
getNode,
|
|
@@ -899,7 +899,7 @@ class TableComponent extends React.Component {
|
|
|
899
899
|
}
|
|
900
900
|
const isNested = isTableNested(view.state, tablePos);
|
|
901
901
|
const topShadowPadding = isDragAndDropEnabled ? 0 : shadowPadding;
|
|
902
|
-
const topOffset =
|
|
902
|
+
const topOffset = 0;
|
|
903
903
|
const topStickyShadowPosition = this.state.stickyHeader && topOffset + this.state.stickyHeader.padding + topShadowPadding + 2;
|
|
904
904
|
const {
|
|
905
905
|
tableWithFixedColumnWidthsOption = false
|
|
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import debounce from 'lodash/debounce';
|
|
3
3
|
import throttle from 'lodash/throttle';
|
|
4
4
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
7
6
|
import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
|
|
8
7
|
import { updateStickyState } from '../pm-plugins/sticky-headers/commands';
|
|
@@ -505,11 +504,7 @@ export default class TableRow extends TableNodeView {
|
|
|
505
504
|
this.refireIntersectionObservers();
|
|
506
505
|
}, fastScrollThresholdMs);
|
|
507
506
|
}
|
|
508
|
-
|
|
509
|
-
this.dom.style.top = `0px`;
|
|
510
|
-
} else {
|
|
511
|
-
this.dom.style.top = `${domTop}px`;
|
|
512
|
-
}
|
|
507
|
+
this.dom.style.top = `0px`;
|
|
513
508
|
updateTableMargin(table);
|
|
514
509
|
this.dom.scrollLeft = wrapper.scrollLeft;
|
|
515
510
|
this.emitOn(domTop, this.colControlsOffset);
|
|
@@ -2,7 +2,6 @@ import kebabCase from 'lodash/kebabCase';
|
|
|
2
2
|
import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
|
|
3
3
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
4
4
|
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
6
|
import { generateColgroup, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
8
7
|
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
|
|
@@ -16,7 +15,6 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
16
15
|
...tableNode,
|
|
17
16
|
toDOM: node => {
|
|
18
17
|
const gutterPadding = akEditorGutterPaddingDynamic() * 2;
|
|
19
|
-
const editorWidthFromGetter = fg('platform_editor_breakout_use_css') ? undefined : Math.min(config.getEditorContainerWidth().width - gutterPadding, node.attrs.width);
|
|
20
18
|
const alignmentStyle = Object.entries(getAlignmentStyle(node.attrs.layout)).map(([k, v]) => `${kebabCase(k)}: ${kebabCase(v)}`).join(';');
|
|
21
19
|
const tableMinWidth = getResizerMinWidth(node);
|
|
22
20
|
const attrs = {
|
|
@@ -24,10 +22,7 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
24
22
|
'data-layout': node.attrs.layout,
|
|
25
23
|
'data-autosize': node.attrs.__autoSize,
|
|
26
24
|
'data-table-local-id': node.attrs.localId,
|
|
27
|
-
'data-table-width': node.attrs.width
|
|
28
|
-
...(fg('platform_editor_breakout_use_css') ? {} : {
|
|
29
|
-
style: `width: ${node.attrs.width}px;`
|
|
30
|
-
})
|
|
25
|
+
'data-table-width': node.attrs.width
|
|
31
26
|
};
|
|
32
27
|
let colgroup = '';
|
|
33
28
|
if (config.allowColumnResizing) {
|
|
@@ -69,10 +64,10 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
69
64
|
style: alignmentStyle
|
|
70
65
|
}, ['div', {
|
|
71
66
|
class: 'pm-table-resizer-container',
|
|
72
|
-
style:
|
|
67
|
+
style: `width: min(calc(100cqw - ${gutterPadding}px), ${node.attrs.width}px);`
|
|
73
68
|
}, ['div', {
|
|
74
69
|
class: 'resizer-item display-handle',
|
|
75
|
-
style:
|
|
70
|
+
style: convertToInlineCss({
|
|
76
71
|
position: 'relative',
|
|
77
72
|
userSelect: 'auto',
|
|
78
73
|
boxSizing: 'border-box',
|
|
@@ -82,14 +77,6 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
82
77
|
minWidth: 'var(--ak-editor-table-min-width)',
|
|
83
78
|
maxWidth: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))`,
|
|
84
79
|
width: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ${node.attrs.width})`
|
|
85
|
-
}) : convertToInlineCss({
|
|
86
|
-
position: 'relative',
|
|
87
|
-
userSelect: 'auto',
|
|
88
|
-
boxSizing: 'border-box',
|
|
89
|
-
height: 'auto',
|
|
90
|
-
minWidth: `${tableMinWidth}px`,
|
|
91
|
-
maxWidth: `${editorWidthFromGetter}px`,
|
|
92
|
-
width: `${editorWidthFromGetter}px;`
|
|
93
80
|
})
|
|
94
81
|
}, ['span', {
|
|
95
82
|
class: 'resizer-hover-zone'
|
|
@@ -2,7 +2,6 @@ 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';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { TableCssClassName as ClassName } from '../../types';
|
|
7
6
|
import { insertColumnButtonOffset } from '../common-styles';
|
|
8
7
|
const BUTTON_WIDTH = 20;
|
|
@@ -85,11 +84,8 @@ export const FixedButton = ({
|
|
|
85
84
|
};
|
|
86
85
|
}
|
|
87
86
|
}, [fixedButtonRef, observerTargetRef, tableWrapper, targetCellPosition, targetCellRef, isContextualMenuOpen]);
|
|
88
|
-
const fixedButtonTop =
|
|
87
|
+
const fixedButtonTop = 0;
|
|
89
88
|
const containerLeft = useMemo(() => {
|
|
90
|
-
if (!fg('platform_editor_breakout_use_css')) {
|
|
91
|
-
return 0;
|
|
92
|
-
}
|
|
93
89
|
const container = targetCellRef.closest('[data-editor-container="true"]');
|
|
94
90
|
return (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().left) || 0;
|
|
95
91
|
}, [targetCellRef]);
|
|
@@ -55,7 +55,7 @@ export const ColumnControls = ({
|
|
|
55
55
|
const selectedColIndexes = getSelectedColumns((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection) || editorView.state.selection);
|
|
56
56
|
const firstRow = tableRef.querySelector('tr');
|
|
57
57
|
const hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
|
|
58
|
-
const rowControlStickyTop =
|
|
58
|
+
const rowControlStickyTop = 45;
|
|
59
59
|
const marginTop = hasHeaderRow && stickyTop !== undefined ? rowControlStickyTop !== null && rowControlStickyTop !== void 0 ? rowControlStickyTop : 0 : 0;
|
|
60
60
|
const handleClick = useCallback(event => {
|
|
61
61
|
const {
|
|
@@ -64,14 +64,9 @@ const TableFloatingColumnControls = ({
|
|
|
64
64
|
}
|
|
65
65
|
const colWidths = getColumnsWidths(editorView);
|
|
66
66
|
if (stickyTop) {
|
|
67
|
-
var
|
|
67
|
+
var _containerRef$current;
|
|
68
68
|
const columnControlTopOffsetFromParent = '-12px';
|
|
69
|
-
|
|
70
|
-
containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.style.setProperty('top', fg('platform_editor_breakout_use_css') ? columnControlTopOffsetFromParent :
|
|
71
|
-
// Ignored via go/ees005
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
73
|
-
`${stickyTop - headerRowHeight + 33}px` // 33px is padding and margin applied on tr.sticky
|
|
74
|
-
);
|
|
69
|
+
containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.style.setProperty('top', columnControlTopOffsetFromParent);
|
|
75
70
|
} else {
|
|
76
71
|
var _containerRef$current2;
|
|
77
72
|
containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.style.removeProperty('top');
|
|
@@ -5,7 +5,6 @@ import { injectIntl } from 'react-intl-next';
|
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
7
7
|
import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { clearHoverSelection, hoverTable } from '../../../pm-plugins/commands';
|
|
10
9
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
11
10
|
// Ignored via go/ees005
|
|
@@ -72,7 +71,7 @@ class CornerControlComponent extends Component {
|
|
|
72
71
|
}),
|
|
73
72
|
style: {
|
|
74
73
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
75
|
-
top:
|
|
74
|
+
top: this.props.stickyTop !== undefined ? `0px` : undefined
|
|
76
75
|
},
|
|
77
76
|
contentEditable: false
|
|
78
77
|
}, /*#__PURE__*/React.createElement("button", {
|
|
@@ -3,7 +3,6 @@ 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';
|
|
7
6
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
8
7
|
import { getRowHeights } from '../../../pm-plugins/utils/row-controls';
|
|
9
8
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
@@ -60,7 +59,7 @@ export default class NumberColumn extends Component {
|
|
|
60
59
|
hasHeaderRow
|
|
61
60
|
} = this.props;
|
|
62
61
|
if (stickyTop && hasHeaderRow && index === 0) {
|
|
63
|
-
const topOffset =
|
|
62
|
+
const topOffset = 0;
|
|
64
63
|
return {
|
|
65
64
|
height: rowHeight,
|
|
66
65
|
top: `${topOffset}px`
|
|
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import React, { Component } from 'react';
|
|
3
3
|
import { injectIntl } from 'react-intl-next';
|
|
4
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
7
6
|
import { getRowClassNames, getRowHeights, getRowsParams } from '../../../pm-plugins/utils/row-controls';
|
|
8
7
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
@@ -70,10 +69,7 @@ class RowControlsComponent extends Component {
|
|
|
70
69
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
71
70
|
marginTop: `${marginTop}px`,
|
|
72
71
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
73
|
-
top:
|
|
74
|
-
// Ignored via go/ees005
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
76
|
-
`${this.props.stickyTop + 3}px` : undefined,
|
|
72
|
+
top: thisRowSticky ? `3px` : undefined,
|
|
77
73
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
78
74
|
paddingTop: thisRowSticky ? `${tableControlsSpacing}px` : undefined
|
|
79
75
|
}
|
|
@@ -807,8 +807,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
807
807
|
key: "render",
|
|
808
808
|
value: function render() {
|
|
809
809
|
var _this5 = this,
|
|
810
|
-
_this$state$stickyHea2,
|
|
811
|
-
_this$state$stickyHea3,
|
|
812
810
|
_this$props$options10;
|
|
813
811
|
var _this$props12 = this.props,
|
|
814
812
|
view = _this$props12.view,
|
|
@@ -925,7 +923,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
925
923
|
}
|
|
926
924
|
var isNested = isTableNested(view.state, tablePos);
|
|
927
925
|
var topShadowPadding = isDragAndDropEnabled ? 0 : shadowPadding;
|
|
928
|
-
var topOffset =
|
|
926
|
+
var topOffset = 0;
|
|
929
927
|
var topStickyShadowPosition = this.state.stickyHeader && topOffset + this.state.stickyHeader.padding + topShadowPadding + 2;
|
|
930
928
|
var _getEditorFeatureFlag7 = getEditorFeatureFlags(),
|
|
931
929
|
_getEditorFeatureFlag8 = _getEditorFeatureFlag7.tableWithFixedColumnWidthsOption,
|
|
@@ -9,7 +9,6 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
9
9
|
import debounce from 'lodash/debounce';
|
|
10
10
|
import throttle from 'lodash/throttle';
|
|
11
11
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
14
13
|
import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
|
|
15
14
|
import { updateStickyState } from '../pm-plugins/sticky-headers/commands';
|
|
@@ -536,11 +535,7 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
|
|
|
536
535
|
_this6.refireIntersectionObservers();
|
|
537
536
|
}, fastScrollThresholdMs);
|
|
538
537
|
}
|
|
539
|
-
|
|
540
|
-
this.dom.style.top = "0px";
|
|
541
|
-
} else {
|
|
542
|
-
this.dom.style.top = "".concat(domTop, "px");
|
|
543
|
-
}
|
|
538
|
+
this.dom.style.top = "0px";
|
|
544
539
|
updateTableMargin(table);
|
|
545
540
|
this.dom.scrollLeft = wrapper.scrollLeft;
|
|
546
541
|
this.emitOn(domTop, this.colControlsOffset);
|
|
@@ -7,7 +7,6 @@ import kebabCase from 'lodash/kebabCase';
|
|
|
7
7
|
import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
|
|
8
8
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
9
9
|
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
11
|
import { generateColgroup, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
13
12
|
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
|
|
@@ -20,7 +19,6 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
20
19
|
return _objectSpread(_objectSpread({}, tableNode), {}, {
|
|
21
20
|
toDOM: function toDOM(node) {
|
|
22
21
|
var gutterPadding = akEditorGutterPaddingDynamic() * 2;
|
|
23
|
-
var editorWidthFromGetter = fg('platform_editor_breakout_use_css') ? undefined : Math.min(config.getEditorContainerWidth().width - gutterPadding, node.attrs.width);
|
|
24
22
|
var alignmentStyle = Object.entries(getAlignmentStyle(node.attrs.layout)).map(function (_ref) {
|
|
25
23
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
26
24
|
k = _ref2[0],
|
|
@@ -28,15 +26,13 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
28
26
|
return "".concat(kebabCase(k), ": ").concat(kebabCase(v));
|
|
29
27
|
}).join(';');
|
|
30
28
|
var tableMinWidth = getResizerMinWidth(node);
|
|
31
|
-
var attrs =
|
|
29
|
+
var attrs = {
|
|
32
30
|
'data-number-column': node.attrs.isNumberColumnEnabled,
|
|
33
31
|
'data-layout': node.attrs.layout,
|
|
34
32
|
'data-autosize': node.attrs.__autoSize,
|
|
35
33
|
'data-table-local-id': node.attrs.localId,
|
|
36
34
|
'data-table-width': node.attrs.width
|
|
37
|
-
}
|
|
38
|
-
style: "width: ".concat(node.attrs.width, "px;")
|
|
39
|
-
});
|
|
35
|
+
};
|
|
40
36
|
var colgroup = '';
|
|
41
37
|
if (config.allowColumnResizing) {
|
|
42
38
|
colgroup = ['colgroup', {}].concat(_toConsumableArray(generateColgroup(node)));
|
|
@@ -77,10 +73,10 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
77
73
|
style: alignmentStyle
|
|
78
74
|
}, ['div', {
|
|
79
75
|
class: 'pm-table-resizer-container',
|
|
80
|
-
style:
|
|
76
|
+
style: "width: min(calc(100cqw - ".concat(gutterPadding, "px), ").concat(node.attrs.width, "px);")
|
|
81
77
|
}, ['div', {
|
|
82
78
|
class: 'resizer-item display-handle',
|
|
83
|
-
style:
|
|
79
|
+
style: convertToInlineCss({
|
|
84
80
|
position: 'relative',
|
|
85
81
|
userSelect: 'auto',
|
|
86
82
|
boxSizing: 'border-box',
|
|
@@ -90,14 +86,6 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
90
86
|
minWidth: 'var(--ak-editor-table-min-width)',
|
|
91
87
|
maxWidth: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))",
|
|
92
88
|
width: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(node.attrs.width, ")")
|
|
93
|
-
}) : convertToInlineCss({
|
|
94
|
-
position: 'relative',
|
|
95
|
-
userSelect: 'auto',
|
|
96
|
-
boxSizing: 'border-box',
|
|
97
|
-
height: 'auto',
|
|
98
|
-
minWidth: "".concat(tableMinWidth, "px"),
|
|
99
|
-
maxWidth: "".concat(editorWidthFromGetter, "px"),
|
|
100
|
-
width: "".concat(editorWidthFromGetter, "px;")
|
|
101
89
|
})
|
|
102
90
|
}, ['span', {
|
|
103
91
|
class: 'resizer-hover-zone'
|
|
@@ -37,7 +37,7 @@ export var unwrapContentFromTable = function unwrapContentFromTable(maybeTable)
|
|
|
37
37
|
// Flattens nested tables after a given nesting depth
|
|
38
38
|
// If this looks familiar, it's a heavily modified version of `mapFragment` which has been
|
|
39
39
|
// adjusted to support tracking nesting depth. This wasn't possible by using `mapFragment` directly
|
|
40
|
-
var
|
|
40
|
+
var _unwrapNestedTables = function unwrapNestedTables(content, schema, unwrapNestDepth) {
|
|
41
41
|
var currentNestDepth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
42
42
|
var flattenNested = function flattenNested(node, tableDepth) {
|
|
43
43
|
if (node.type === schema.nodes.table) {
|
|
@@ -51,7 +51,7 @@ var unwrapNestedTables = function unwrapNestedTables(content, schema, unwrapNest
|
|
|
51
51
|
var children = [];
|
|
52
52
|
for (var i = 0, size = content.childCount; i < size; i++) {
|
|
53
53
|
var node = content.child(i);
|
|
54
|
-
var transformed = node.isLeaf ? flattenNested(node, currentNestDepth) : flattenNested(node.copy(Fragment.fromArray(
|
|
54
|
+
var transformed = node.isLeaf ? flattenNested(node, currentNestDepth) : flattenNested(node.copy(Fragment.fromArray(_unwrapNestedTables(node.content, schema, unwrapNestDepth, node.type === schema.nodes.table ? currentNestDepth + 1 : currentNestDepth))), currentNestDepth);
|
|
55
55
|
if (transformed) {
|
|
56
56
|
if (Array.isArray(transformed)) {
|
|
57
57
|
children.push.apply(children, _toConsumableArray(transformed));
|
|
@@ -134,7 +134,7 @@ export var transformSliceToRemoveNestedTables = function transformSliceToRemoveN
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
// after we've worked out what the allowed nesting depth is, unwrap nested tables
|
|
137
|
-
var newChildren =
|
|
137
|
+
var newChildren = _unwrapNestedTables(node.content, schema, allowedTableNesting);
|
|
138
138
|
return node.copy(Fragment.fromArray(newChildren));
|
|
139
139
|
});
|
|
140
140
|
return new Slice(newFragment, slice.openStart, openEnd);
|
|
@@ -2,7 +2,6 @@ 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';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { TableCssClassName as ClassName } from '../../types';
|
|
7
6
|
import { insertColumnButtonOffset } from '../common-styles';
|
|
8
7
|
var BUTTON_WIDTH = 20;
|
|
@@ -83,11 +82,8 @@ export var FixedButton = function FixedButton(_ref2) {
|
|
|
83
82
|
};
|
|
84
83
|
}
|
|
85
84
|
}, [fixedButtonRef, observerTargetRef, tableWrapper, targetCellPosition, targetCellRef, isContextualMenuOpen]);
|
|
86
|
-
var fixedButtonTop =
|
|
85
|
+
var fixedButtonTop = 0;
|
|
87
86
|
var containerLeft = useMemo(function () {
|
|
88
|
-
if (!fg('platform_editor_breakout_use_css')) {
|
|
89
|
-
return 0;
|
|
90
|
-
}
|
|
91
87
|
var container = targetCellRef.closest('[data-editor-container="true"]');
|
|
92
88
|
return (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().left) || 0;
|
|
93
89
|
}, [targetCellRef]);
|
|
@@ -56,7 +56,7 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
56
56
|
var selectedColIndexes = getSelectedColumns((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection) || editorView.state.selection);
|
|
57
57
|
var firstRow = tableRef.querySelector('tr');
|
|
58
58
|
var hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
|
|
59
|
-
var rowControlStickyTop =
|
|
59
|
+
var rowControlStickyTop = 45;
|
|
60
60
|
var marginTop = hasHeaderRow && stickyTop !== undefined ? rowControlStickyTop !== null && rowControlStickyTop !== void 0 ? rowControlStickyTop : 0 : 0;
|
|
61
61
|
var handleClick = useCallback(function (event) {
|
|
62
62
|
var state = editorView.state,
|
|
@@ -65,13 +65,9 @@ var TableFloatingColumnControls = function TableFloatingColumnControls(_ref) {
|
|
|
65
65
|
}
|
|
66
66
|
var colWidths = getColumnsWidths(editorView);
|
|
67
67
|
if (stickyTop) {
|
|
68
|
-
var
|
|
68
|
+
var _containerRef$current;
|
|
69
69
|
var columnControlTopOffsetFromParent = '-12px';
|
|
70
|
-
|
|
71
|
-
containerRef === null || containerRef === void 0 || (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 || _containerRef$current.style.setProperty('top', fg('platform_editor_breakout_use_css') ? columnControlTopOffsetFromParent : // Ignored via go/ees005
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
73
|
-
"".concat(stickyTop - headerRowHeight + 33, "px") // 33px is padding and margin applied on tr.sticky
|
|
74
|
-
);
|
|
70
|
+
containerRef === null || containerRef === void 0 || (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 || _containerRef$current.style.setProperty('top', columnControlTopOffsetFromParent);
|
|
75
71
|
} else {
|
|
76
72
|
var _containerRef$current2;
|
|
77
73
|
containerRef === null || containerRef === void 0 || (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 || _containerRef$current2.style.removeProperty('top');
|
|
@@ -12,7 +12,6 @@ import { injectIntl } from 'react-intl-next';
|
|
|
12
12
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
13
13
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
14
14
|
import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
|
|
15
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
15
|
import { clearHoverSelection, hoverTable } from '../../../pm-plugins/commands';
|
|
17
16
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
18
17
|
// Ignored via go/ees005
|
|
@@ -79,7 +78,7 @@ var CornerControlComponent = /*#__PURE__*/function (_Component) {
|
|
|
79
78
|
}),
|
|
80
79
|
style: {
|
|
81
80
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
82
|
-
top:
|
|
81
|
+
top: this.props.stickyTop !== undefined ? "0px" : undefined
|
|
83
82
|
},
|
|
84
83
|
contentEditable: false
|
|
85
84
|
}, /*#__PURE__*/React.createElement("button", {
|
|
@@ -10,7 +10,6 @@ import React, { Component } from 'react';
|
|
|
10
10
|
import classnames from 'classnames';
|
|
11
11
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
12
12
|
import { isRowSelected } from '@atlaskit/editor-tables/utils';
|
|
13
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
13
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
15
14
|
import { getRowHeights } from '../../../pm-plugins/utils/row-controls';
|
|
16
15
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
@@ -66,7 +65,7 @@ var NumberColumn = /*#__PURE__*/function (_Component) {
|
|
|
66
65
|
stickyTop = _this$props3.stickyTop,
|
|
67
66
|
hasHeaderRow = _this$props3.hasHeaderRow;
|
|
68
67
|
if (stickyTop && hasHeaderRow && index === 0) {
|
|
69
|
-
var topOffset =
|
|
68
|
+
var topOffset = 0;
|
|
70
69
|
return {
|
|
71
70
|
height: rowHeight,
|
|
72
71
|
top: "".concat(topOffset, "px")
|
|
@@ -9,7 +9,6 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
9
9
|
import React, { Component } from 'react';
|
|
10
10
|
import { injectIntl } from 'react-intl-next';
|
|
11
11
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
14
13
|
import { getRowClassNames, getRowHeights, getRowsParams } from '../../../pm-plugins/utils/row-controls';
|
|
15
14
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
@@ -80,9 +79,7 @@ var RowControlsComponent = /*#__PURE__*/function (_Component) {
|
|
|
80
79
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
81
80
|
marginTop: "".concat(marginTop, "px"),
|
|
82
81
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
83
|
-
top:
|
|
84
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
85
|
-
"".concat(_this2.props.stickyTop + 3, "px") : undefined,
|
|
82
|
+
top: thisRowSticky ? "3px" : undefined,
|
|
86
83
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
87
84
|
paddingTop: thisRowSticky ? "".concat(tableControlsSpacing, "px") : undefined
|
|
88
85
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.2",
|
|
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": "^46.1.0",
|
|
31
31
|
"@atlaskit/button": "^20.4.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.9.0",
|
|
33
|
-
"@atlaskit/editor-common": "^99.
|
|
33
|
+
"@atlaskit/editor-common": "^99.7.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.7.0",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.3.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.11.0",
|
|
@@ -110,9 +110,6 @@
|
|
|
110
110
|
"platform_editor_batch_steps_table": {
|
|
111
111
|
"type": "boolean"
|
|
112
112
|
},
|
|
113
|
-
"platform_editor_breakout_use_css": {
|
|
114
|
-
"type": "boolean"
|
|
115
|
-
},
|
|
116
113
|
"platform_editor_nested_table_in_nested_parent_fix": {
|
|
117
114
|
"type": "boolean"
|
|
118
115
|
},
|
|
@@ -908,9 +908,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
908
908
|
const isNested = isTableNested(view.state, tablePos);
|
|
909
909
|
|
|
910
910
|
const topShadowPadding = isDragAndDropEnabled ? 0 : shadowPadding;
|
|
911
|
-
const topOffset =
|
|
912
|
-
? 0
|
|
913
|
-
: this.state.stickyHeader?.top ?? 0;
|
|
911
|
+
const topOffset = 0;
|
|
914
912
|
|
|
915
913
|
const topStickyShadowPosition =
|
|
916
914
|
this.state.stickyHeader && topOffset + this.state.stickyHeader.padding + topShadowPadding + 2;
|
|
@@ -5,7 +5,6 @@ import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
|
5
5
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
6
6
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
7
|
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
|
|
10
9
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
11
10
|
import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
|
|
@@ -611,12 +610,7 @@ export default class TableRow extends TableNodeView<HTMLTableRowElement> impleme
|
|
|
611
610
|
this.refireIntersectionObservers();
|
|
612
611
|
}, fastScrollThresholdMs);
|
|
613
612
|
}
|
|
614
|
-
|
|
615
|
-
if (fg('platform_editor_breakout_use_css')) {
|
|
616
|
-
this.dom.style.top = `0px`;
|
|
617
|
-
} else {
|
|
618
|
-
this.dom.style.top = `${domTop}px`;
|
|
619
|
-
}
|
|
613
|
+
this.dom.style.top = `0px`;
|
|
620
614
|
updateTableMargin(table);
|
|
621
615
|
this.dom.scrollLeft = wrapper.scrollLeft;
|
|
622
616
|
|
package/src/nodeviews/toDOM.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
|
5
5
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
6
6
|
import type { DOMOutputSpec, NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
7
|
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
9
|
|
|
11
10
|
import { generateColgroup, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
@@ -30,9 +29,6 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): NodeSpec => {
|
|
|
30
29
|
...tableNode,
|
|
31
30
|
toDOM: (node: PMNode): DOMOutputSpec => {
|
|
32
31
|
const gutterPadding = akEditorGutterPaddingDynamic() * 2;
|
|
33
|
-
const editorWidthFromGetter = fg('platform_editor_breakout_use_css')
|
|
34
|
-
? undefined
|
|
35
|
-
: Math.min(config.getEditorContainerWidth().width - gutterPadding, node.attrs.width);
|
|
36
32
|
|
|
37
33
|
const alignmentStyle = Object.entries(getAlignmentStyle(node.attrs.layout))
|
|
38
34
|
.map(([k, v]) => `${kebabCase(k)}: ${kebabCase(v)}`)
|
|
@@ -46,9 +42,6 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): NodeSpec => {
|
|
|
46
42
|
'data-autosize': node.attrs.__autoSize,
|
|
47
43
|
'data-table-local-id': node.attrs.localId,
|
|
48
44
|
'data-table-width': node.attrs.width,
|
|
49
|
-
...(fg('platform_editor_breakout_use_css')
|
|
50
|
-
? {}
|
|
51
|
-
: { style: `width: ${node.attrs.width}px;` }),
|
|
52
45
|
};
|
|
53
46
|
|
|
54
47
|
let colgroup: DOMOutputSpec = '';
|
|
@@ -136,16 +129,13 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): NodeSpec => {
|
|
|
136
129
|
'div',
|
|
137
130
|
{
|
|
138
131
|
class: 'pm-table-resizer-container',
|
|
139
|
-
style:
|
|
140
|
-
? `width: min(calc(100cqw - ${gutterPadding}px), ${node.attrs.width}px);`
|
|
141
|
-
: `width: ${node.attrs.width}px`,
|
|
132
|
+
style: `width: min(calc(100cqw - ${gutterPadding}px), ${node.attrs.width}px);`,
|
|
142
133
|
},
|
|
143
134
|
[
|
|
144
135
|
'div',
|
|
145
136
|
{
|
|
146
137
|
class: 'resizer-item display-handle',
|
|
147
|
-
style:
|
|
148
|
-
? convertToInlineCss({
|
|
138
|
+
style: convertToInlineCss({
|
|
149
139
|
position: 'relative',
|
|
150
140
|
userSelect: 'auto',
|
|
151
141
|
boxSizing: 'border-box',
|
|
@@ -156,15 +146,6 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): NodeSpec => {
|
|
|
156
146
|
maxWidth: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))`,
|
|
157
147
|
width: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ${node.attrs.width})`,
|
|
158
148
|
})
|
|
159
|
-
: convertToInlineCss({
|
|
160
|
-
position: 'relative',
|
|
161
|
-
userSelect: 'auto',
|
|
162
|
-
boxSizing: 'border-box',
|
|
163
|
-
height: 'auto',
|
|
164
|
-
minWidth: `${tableMinWidth}px`,
|
|
165
|
-
maxWidth: `${editorWidthFromGetter}px`,
|
|
166
|
-
width: `${editorWidthFromGetter}px;`,
|
|
167
|
-
}),
|
|
168
149
|
},
|
|
169
150
|
[
|
|
170
151
|
'span',
|
|
@@ -4,7 +4,6 @@ import rafSchedule from 'raf-schd';
|
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
|
|
6
6
|
import { akEditorTableCellOnStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { token } from '@atlaskit/tokens';
|
|
9
8
|
|
|
10
9
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers/types';
|
|
@@ -134,13 +133,9 @@ export const FixedButton = ({
|
|
|
134
133
|
isContextualMenuOpen,
|
|
135
134
|
]);
|
|
136
135
|
|
|
137
|
-
const fixedButtonTop =
|
|
136
|
+
const fixedButtonTop = 0;
|
|
138
137
|
|
|
139
138
|
const containerLeft = useMemo(() => {
|
|
140
|
-
if (!fg('platform_editor_breakout_use_css')) {
|
|
141
|
-
return 0;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
139
|
const container = targetCellRef.closest('[data-editor-container="true"]');
|
|
145
140
|
return container?.getBoundingClientRect().left || 0;
|
|
146
141
|
}, [targetCellRef]);
|
|
@@ -96,7 +96,7 @@ export const ColumnControls = ({
|
|
|
96
96
|
const firstRow = tableRef.querySelector('tr');
|
|
97
97
|
const hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
|
|
98
98
|
|
|
99
|
-
const rowControlStickyTop =
|
|
99
|
+
const rowControlStickyTop = 45;
|
|
100
100
|
const marginTop = hasHeaderRow && stickyTop !== undefined ? rowControlStickyTop ?? 0 : 0;
|
|
101
101
|
|
|
102
102
|
const handleClick = useCallback(
|
|
@@ -101,14 +101,9 @@ const TableFloatingColumnControls = ({
|
|
|
101
101
|
|
|
102
102
|
if (stickyTop) {
|
|
103
103
|
const columnControlTopOffsetFromParent = '-12px';
|
|
104
|
-
const headerRowHeight = hasHeaderRow && stickyTop !== undefined ? rowHeights?.[0] ?? 0 : 0;
|
|
105
104
|
containerRef?.current?.style.setProperty(
|
|
106
105
|
'top',
|
|
107
|
-
|
|
108
|
-
? columnControlTopOffsetFromParent
|
|
109
|
-
: // Ignored via go/ees005
|
|
110
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
111
|
-
`${stickyTop! - headerRowHeight + 33}px`, // 33px is padding and margin applied on tr.sticky
|
|
106
|
+
columnControlTopOffsetFromParent
|
|
112
107
|
);
|
|
113
108
|
} else {
|
|
114
109
|
containerRef?.current?.style.removeProperty('top');
|
|
@@ -7,7 +7,6 @@ import { injectIntl } from 'react-intl-next';
|
|
|
7
7
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
8
8
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
9
9
|
import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
|
|
12
11
|
import { clearHoverSelection, hoverTable } from '../../../pm-plugins/commands';
|
|
13
12
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
@@ -39,13 +38,9 @@ class CornerControlComponent extends Component<CornerControlProps & WrappedCompo
|
|
|
39
38
|
})}
|
|
40
39
|
style={{
|
|
41
40
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
42
|
-
top:
|
|
43
|
-
? this.props.stickyTop !== undefined
|
|
41
|
+
top: this.props.stickyTop !== undefined
|
|
44
42
|
? `0px`
|
|
45
43
|
: undefined
|
|
46
|
-
: this.props.stickyTop !== undefined
|
|
47
|
-
? `${this.props.stickyTop}px`
|
|
48
|
-
: undefined,
|
|
49
44
|
}}
|
|
50
45
|
contentEditable={false}
|
|
51
46
|
>
|
|
@@ -5,7 +5,6 @@ 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';
|
|
9
8
|
|
|
10
9
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
11
10
|
import { getRowHeights } from '../../../pm-plugins/utils/row-controls';
|
|
@@ -123,7 +122,7 @@ export default class NumberColumn extends Component<Props, any> {
|
|
|
123
122
|
private getCellStyles = (index: number, rowHeight: number) => {
|
|
124
123
|
const { stickyTop, hasHeaderRow } = this.props;
|
|
125
124
|
if (stickyTop && hasHeaderRow && index === 0) {
|
|
126
|
-
const topOffset =
|
|
125
|
+
const topOffset = 0;
|
|
127
126
|
|
|
128
127
|
return {
|
|
129
128
|
height: rowHeight,
|
|
@@ -6,7 +6,6 @@ import { injectIntl } from 'react-intl-next';
|
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
9
|
|
|
11
10
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
12
11
|
import type { RowParams } from '../../../pm-plugins/utils/row-controls';
|
|
@@ -85,14 +84,8 @@ class RowControlsComponent extends Component<Props & WrappedComponentProps> {
|
|
|
85
84
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
86
85
|
marginTop: `${marginTop}px`,
|
|
87
86
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
88
|
-
top:
|
|
89
|
-
? thisRowSticky
|
|
87
|
+
top: thisRowSticky
|
|
90
88
|
? `3px`
|
|
91
|
-
: undefined
|
|
92
|
-
: thisRowSticky
|
|
93
|
-
? // Ignored via go/ees005
|
|
94
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
95
|
-
`${this.props.stickyTop! + 3}px`
|
|
96
89
|
: undefined,
|
|
97
90
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
98
91
|
paddingTop: thisRowSticky ? `${tableControlsSpacing}px` : undefined,
|