@atlaskit/editor-plugin-table 7.17.4 → 7.17.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/commands/column-resize.js +2 -6
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +7 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +2 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +1 -1
- package/dist/cjs/toolbar.js +1 -1
- package/dist/cjs/transforms/column-width.js +1 -2
- package/dist/cjs/ui/ColumnResizeWidget/index.js +1 -0
- package/dist/cjs/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +1 -0
- package/dist/cjs/ui/FloatingContextualButton/index.js +2 -0
- package/dist/cjs/ui/FloatingContextualButton/styles.js +2 -0
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
- package/dist/cjs/ui/FloatingContextualMenu/index.js +1 -0
- package/dist/cjs/ui/FloatingContextualMenu/styles.js +1 -1
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +2 -0
- package/dist/cjs/ui/FloatingDragMenu/styles.js +1 -1
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +7 -19
- package/dist/cjs/ui/common-styles.js +1 -0
- package/dist/cjs/ui/ui-styles.js +1 -0
- package/dist/es2019/commands/column-resize.js +2 -6
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +7 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +2 -3
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +1 -1
- package/dist/es2019/toolbar.js +1 -0
- package/dist/es2019/transforms/column-width.js +1 -2
- package/dist/es2019/ui/ColumnResizeWidget/index.js +1 -0
- package/dist/es2019/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +1 -0
- package/dist/es2019/ui/FloatingContextualButton/index.js +2 -0
- package/dist/es2019/ui/FloatingContextualButton/styles.js +1 -0
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +2 -0
- package/dist/es2019/ui/FloatingContextualMenu/index.js +1 -0
- package/dist/es2019/ui/FloatingContextualMenu/styles.js +1 -0
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +2 -0
- package/dist/es2019/ui/FloatingDragMenu/styles.js +1 -0
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +7 -19
- package/dist/es2019/ui/common-styles.js +1 -0
- package/dist/es2019/ui/ui-styles.js +1 -0
- package/dist/esm/commands/column-resize.js +2 -6
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +7 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +2 -3
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +1 -1
- package/dist/esm/toolbar.js +1 -0
- package/dist/esm/transforms/column-width.js +1 -2
- package/dist/esm/ui/ColumnResizeWidget/index.js +1 -0
- package/dist/esm/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +1 -0
- package/dist/esm/ui/FloatingContextualButton/index.js +2 -0
- package/dist/esm/ui/FloatingContextualButton/styles.js +1 -0
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +2 -0
- package/dist/esm/ui/FloatingContextualMenu/index.js +1 -0
- package/dist/esm/ui/FloatingContextualMenu/styles.js +1 -0
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +2 -0
- package/dist/esm/ui/FloatingDragMenu/styles.js +1 -0
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +7 -19
- package/dist/esm/ui/common-styles.js +1 -0
- package/dist/esm/ui/ui-styles.js +1 -0
- package/package.json +8 -11
- package/src/commands/column-resize.ts +2 -6
- package/src/pm-plugins/table-resizing/event-handlers.ts +9 -6
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +2 -6
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +1 -3
- package/src/toolbar.tsx +1 -0
- package/src/transforms/column-width.ts +1 -6
- package/src/ui/ColumnResizeWidget/index.tsx +1 -0
- package/src/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.tsx +1 -0
- package/src/ui/FloatingContextualButton/index.tsx +1 -0
- package/src/ui/FloatingContextualButton/styles.ts +1 -0
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +1 -0
- package/src/ui/FloatingContextualMenu/index.tsx +1 -0
- package/src/ui/FloatingContextualMenu/styles.ts +1 -0
- package/src/ui/FloatingDragMenu/DragMenu.tsx +1 -0
- package/src/ui/FloatingDragMenu/styles.ts +1 -0
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +8 -23
- package/src/ui/common-styles.ts +1 -0
- package/src/ui/ui-styles.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.17.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#111968](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111968)
|
|
8
|
+
[`c01dd34bc8e6c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c01dd34bc8e6c) -
|
|
9
|
+
Fixes 2px difference issue for internal column resizing
|
|
10
|
+
|
|
11
|
+
## 7.17.5
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#111382](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111382)
|
|
16
|
+
[`5ce3f135c6211`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5ce3f135c6211) -
|
|
17
|
+
Cleanup feature flag to protect for explicit HTML element check in some places.
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 7.17.4
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -184,12 +184,8 @@ var changeColumnWidthByStep = exports.changeColumnWidthByStep = function changeC
|
|
|
184
184
|
var domAtPos = view.domAtPos.bind(view);
|
|
185
185
|
var colIndex = map.colCount($cell.pos - tableStartPosition) + ($cell.nodeAfter ? $cell.nodeAfter.attrs.colspan : 1) - 1;
|
|
186
186
|
var dom = null;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
dom = domAtPosition.node instanceof HTMLTableElement ? domAtPosition.node : null;
|
|
190
|
-
} else {
|
|
191
|
-
dom = domAtPos(tableStartPosition).node;
|
|
192
|
-
}
|
|
187
|
+
var domAtPosition = domAtPos(tableStartPosition);
|
|
188
|
+
dom = domAtPosition.node instanceof HTMLTableElement ? domAtPosition.node : null;
|
|
193
189
|
if (dom && dom.nodeName !== 'TABLE') {
|
|
194
190
|
dom = dom.closest('table');
|
|
195
191
|
}
|
|
@@ -147,12 +147,17 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
|
|
|
147
147
|
_shouldScale = _shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
148
148
|
}
|
|
149
149
|
var resizedDelta = clientX - startX;
|
|
150
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.use-increased-scaling-percent');
|
|
150
151
|
if (isNewColumnResizingEnabled && !(0, _utils2.isTableNested)(state, tablePos)) {
|
|
151
|
-
var newResizeState = (0, _utils3.resizeColumnAndTable)(resizeState, colIndex,
|
|
152
|
+
var newResizeState = (0, _utils3.resizeColumnAndTable)(resizeState, colIndex, resizedDelta, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, _shouldScale,
|
|
153
|
+
// isTableScalingEnabled
|
|
154
|
+
undefined,
|
|
155
|
+
// originalTableWidth
|
|
156
|
+
shouldUseIncreasedScalingPercent);
|
|
152
157
|
tr = (0, _transforms.updateColumnWidths)(newResizeState, table, start)(tr);
|
|
153
158
|
tr.setNodeAttribute(start - 1, 'width', newResizeState.tableWidth);
|
|
154
159
|
} else {
|
|
155
|
-
var _newResizeState = (0, _utils3.resizeColumn)(resizeState, colIndex,
|
|
160
|
+
var _newResizeState = (0, _utils3.resizeColumn)(resizeState, colIndex, resizedDelta, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, _shouldScale, shouldUseIncreasedScalingPercent);
|
|
156
161
|
tr = (0, _transforms.updateColumnWidths)(_newResizeState, table, start)(tr);
|
|
157
162
|
}
|
|
158
163
|
if (colIndex === map.width - 1) {
|
|
@@ -53,8 +53,6 @@ var resizeColumnAndTable = exports.resizeColumnAndTable = function resizeColumnA
|
|
|
53
53
|
// need to look at the resize amount and try to adjust the colgroups
|
|
54
54
|
if (isOverflowed) {
|
|
55
55
|
resizeAmount = amount < 0 ? amount : resizeAmount - (tableNode.attrs.width + resizeAmount - tableContainerWidth) / 2;
|
|
56
|
-
} else {
|
|
57
|
-
resizeAmount = amount > 0 && tableContainerWidth ? resizeAmount - (tableNode.attrs.width + resizeAmount - tableContainerWidth) / 2 : resizeAmount;
|
|
58
56
|
}
|
|
59
57
|
var newState = (0, _resizeLogic.updateAffectedColumn)(resizeState, colIndex, resizeAmount);
|
|
60
58
|
|
|
@@ -68,7 +66,8 @@ var resizeColumnAndTable = exports.resizeColumnAndTable = function resizeColumnA
|
|
|
68
66
|
updateTablePreview(delta, tableRef, tableNode);
|
|
69
67
|
}
|
|
70
68
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
|
71
|
-
tableWidth
|
|
69
|
+
// resizeState.tableWidth sometimes is off by ~3px on load on resized table when !isOverflowed, using resizeState.maxSize instead
|
|
70
|
+
tableWidth: isOverflowed ? tableContainerWidth : resizeState.maxSize + delta
|
|
72
71
|
});
|
|
73
72
|
};
|
|
74
73
|
var updateTablePreview = function updateTablePreview(resizeAmount, tableRef, tableNode) {
|
|
@@ -325,7 +325,7 @@ var getNewResizeStateFromSelectedColumns = exports.getNewResizeStateFromSelected
|
|
|
325
325
|
}
|
|
326
326
|
var maybeTable = domAtPos(table.start).node;
|
|
327
327
|
var maybeTableElement = maybeTable instanceof HTMLElement ? maybeTable : null;
|
|
328
|
-
var tableRef =
|
|
328
|
+
var tableRef = maybeTableElement === null || maybeTableElement === void 0 ? void 0 : maybeTableElement.closest('table');
|
|
329
329
|
if (!tableRef) {
|
|
330
330
|
return;
|
|
331
331
|
}
|
package/dist/cjs/toolbar.js
CHANGED
|
@@ -43,7 +43,7 @@ var _alignment = require("./utils/alignment");
|
|
|
43
43
|
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); }
|
|
44
44
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
45
45
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
46
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** @jsx jsx */
|
|
46
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
47
47
|
var getToolbarMenuConfig = exports.getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _ref, editorAnalyticsAPI) {
|
|
48
48
|
var formatMessage = _ref.formatMessage;
|
|
49
49
|
var isTableScalingWithFixedColumnWidthsOptionShown = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
@@ -9,7 +9,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
10
10
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
11
11
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
12
|
var _utils = require("../pm-plugins/table-resizing/utils");
|
|
14
13
|
var _colgroup = require("../pm-plugins/table-resizing/utils/colgroup");
|
|
15
14
|
var _resizeState = require("../pm-plugins/table-resizing/utils/resize-state");
|
|
@@ -108,7 +107,7 @@ var rescaleColumns = exports.rescaleColumns = function rescaleColumns() {
|
|
|
108
107
|
var newTable = tr.doc.nodeAt(table.pos);
|
|
109
108
|
var domAtPos = view.domAtPos.bind(view);
|
|
110
109
|
var maybeTable = domAtPos(table.start).node;
|
|
111
|
-
var maybeTableElement =
|
|
110
|
+
var maybeTableElement = maybeTable instanceof HTMLElement ? maybeTable : null;
|
|
112
111
|
var tableRef = maybeTableElement === null || maybeTableElement === void 0 ? void 0 : maybeTableElement.closest('table');
|
|
113
112
|
if (!tableRef || !newTable) {
|
|
114
113
|
return tr;
|
|
@@ -13,6 +13,7 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
13
13
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
14
14
|
var _types = require("../../types");
|
|
15
15
|
/** @jsx jsx */
|
|
16
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
16
17
|
|
|
17
18
|
var ColumnResizeWidget = exports.ColumnResizeWidget = function ColumnResizeWidget(_ref) {
|
|
18
19
|
var startIndex = _ref.startIndex,
|
|
@@ -9,6 +9,7 @@ var _button = require("@atlaskit/button");
|
|
|
9
9
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
10
10
|
var _primitives = require("@atlaskit/primitives");
|
|
11
11
|
/** @jsx jsx */
|
|
12
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
12
13
|
|
|
13
14
|
var containerStyles = (0, _primitives.xcss)({
|
|
14
15
|
marginLeft: 'space.100'
|
|
@@ -22,6 +22,8 @@ var _FixedButton = _interopRequireDefault(require("./FixedButton"));
|
|
|
22
22
|
var _styles = require("./styles");
|
|
23
23
|
/** @jsx jsx */
|
|
24
24
|
|
|
25
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
|
+
|
|
25
27
|
var BUTTON_OFFSET = 3;
|
|
26
28
|
var FloatingContextualButtonInner = /*#__PURE__*/_react.default.memo(function (props) {
|
|
27
29
|
var editorView = props.editorView,
|
|
@@ -7,6 +7,8 @@ exports.tableFloatingCellButtonStyles = exports.tableFloatingCellButtonSelectedS
|
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _colors = require("@atlaskit/theme/colors");
|
|
9
9
|
var _consts = require("../consts");
|
|
10
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
|
+
|
|
10
12
|
var tableFloatingCellButtonStyles = exports.tableFloatingCellButtonStyles = function tableFloatingCellButtonStyles() {
|
|
11
13
|
return (0, _react.css)({
|
|
12
14
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
@@ -44,7 +44,7 @@ var _styles2 = require("./styles");
|
|
|
44
44
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
45
45
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
46
46
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
47
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @atlaskit/design-system/prefer-primitives */ /** @jsx jsx */
|
|
47
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @atlaskit/design-system/prefer-primitives */ /** @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
48
48
|
var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
49
49
|
(0, _inherits2.default)(ContextualMenu, _Component);
|
|
50
50
|
var _super = _createSuper(ContextualMenu);
|
|
@@ -15,6 +15,7 @@ var _consts = require("../consts");
|
|
|
15
15
|
var _ContextualMenu = _interopRequireDefault(require("./ContextualMenu"));
|
|
16
16
|
var _styles = require("./styles");
|
|
17
17
|
/** @jsx jsx */
|
|
18
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
18
19
|
|
|
19
20
|
var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
20
21
|
var mountPoint = _ref.mountPoint,
|
|
@@ -11,7 +11,7 @@ var _adfSchema = require("@atlaskit/adf-schema");
|
|
|
11
11
|
var _colors = require("@atlaskit/theme/colors");
|
|
12
12
|
var _types = require("../../types");
|
|
13
13
|
var _consts = require("../consts");
|
|
14
|
-
var _templateObject;
|
|
14
|
+
var _templateObject; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
15
15
|
var cellColourPreviewStyles = exports.cellColourPreviewStyles = function cellColourPreviewStyles(selectedColor) {
|
|
16
16
|
return (0, _react.css)({
|
|
17
17
|
'&::before': {
|
|
@@ -42,6 +42,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
42
42
|
/** @jsx jsx */
|
|
43
43
|
/** @jsxFrag */
|
|
44
44
|
|
|
45
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
46
|
+
|
|
45
47
|
var MapDragMenuOptionIdToMessage = {
|
|
46
48
|
add_row_above: {
|
|
47
49
|
message: _messages.tableMessages.addRowAbove,
|
|
@@ -11,7 +11,7 @@ var _adfSchema = require("@atlaskit/adf-schema");
|
|
|
11
11
|
var _colors = require("@atlaskit/theme/colors");
|
|
12
12
|
var _types = require("../../types");
|
|
13
13
|
var _consts = require("../consts");
|
|
14
|
-
var _templateObject;
|
|
14
|
+
var _templateObject; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
15
15
|
var cellColourPreviewStyles = exports.cellColourPreviewStyles = function cellColourPreviewStyles(selectedColor) {
|
|
16
16
|
return (0, _react.css)({
|
|
17
17
|
'&::before': {
|
|
@@ -11,7 +11,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _reactIntlNext = require("react-intl-next");
|
|
12
12
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
13
13
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
14
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
14
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
16
15
|
var _commands = require("../../../commands");
|
|
17
16
|
var _commands2 = require("../../../pm-plugins/drag-and-drop/commands");
|
|
@@ -101,26 +100,15 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
101
100
|
}
|
|
102
101
|
}, [editorView, tableActive]);
|
|
103
102
|
var handleMouseMove = (0, _react.useCallback)(function (e) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
var _rowIndex = target === null || target === void 0 ? void 0 : target.getAttribute('data-start-index');
|
|
103
|
+
var target = e.nativeEvent.target instanceof Element ? e.nativeEvent.target : null;
|
|
104
|
+
var isParentDragControls = target === null || target === void 0 ? void 0 : target.closest(".".concat(_types.TableCssClassName.DRAG_ROW_CONTROLS));
|
|
105
|
+
var rowIndex = target === null || target === void 0 ? void 0 : target.getAttribute('data-start-index');
|
|
108
106
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
updateCellHoverLocation(Number(_rowIndex));
|
|
114
|
-
} else {
|
|
115
|
-
var _isParentDragControls = e.nativeEvent.target.closest(".".concat(_types.TableCssClassName.DRAG_ROW_CONTROLS));
|
|
116
|
-
var _rowIndex2 = e.nativeEvent.target.getAttribute('data-start-index');
|
|
117
|
-
|
|
118
|
-
// avoid updating if event target is not related
|
|
119
|
-
if (!_isParentDragControls || !_rowIndex2) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
updateCellHoverLocation(Number(_rowIndex2));
|
|
107
|
+
// avoid updating if event target is not related
|
|
108
|
+
if (!isParentDragControls || !rowIndex) {
|
|
109
|
+
return;
|
|
123
110
|
}
|
|
111
|
+
updateCellHoverLocation(Number(rowIndex));
|
|
124
112
|
}, [updateCellHoverLocation]);
|
|
125
113
|
var rowIndexes = (0, _react.useMemo)(function () {
|
|
126
114
|
return [rowIndex];
|
|
@@ -21,6 +21,7 @@ var _consts2 = require("./consts");
|
|
|
21
21
|
var _uiStyles = require("./ui-styles");
|
|
22
22
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
23
23
|
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression */
|
|
24
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
24
25
|
var cornerControlHeight = _consts2.tableToolbarSize + 1;
|
|
25
26
|
|
|
26
27
|
/*
|
package/dist/cjs/ui/ui-styles.js
CHANGED
|
@@ -14,6 +14,7 @@ var _types = require("../types");
|
|
|
14
14
|
var _consts = require("./consts");
|
|
15
15
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25;
|
|
16
16
|
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression -- needs mahual remediation */
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
17
18
|
var InsertLine = function InsertLine(cssString) {
|
|
18
19
|
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\tbackground: ", ";\n\t\tdisplay: none;\n\t\tposition: absolute;\n\t\tz-index: ", ";\n\t\t", "\n\t}\n"])), _types.TableCssClassName.CONTROLS_INSERT_LINE, _consts.tableBorderSelectedColor, _editorSharedStyles.akEditorUnitZIndex, cssString);
|
|
19
20
|
};
|
|
@@ -179,12 +179,8 @@ export const changeColumnWidthByStep = ({
|
|
|
179
179
|
const domAtPos = view.domAtPos.bind(view);
|
|
180
180
|
const colIndex = map.colCount($cell.pos - tableStartPosition) + ($cell.nodeAfter ? $cell.nodeAfter.attrs.colspan : 1) - 1;
|
|
181
181
|
let dom = null;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
dom = domAtPosition.node instanceof HTMLTableElement ? domAtPosition.node : null;
|
|
185
|
-
} else {
|
|
186
|
-
dom = domAtPos(tableStartPosition).node;
|
|
187
|
-
}
|
|
182
|
+
const domAtPosition = domAtPos(tableStartPosition);
|
|
183
|
+
dom = domAtPosition.node instanceof HTMLTableElement ? domAtPosition.node : null;
|
|
188
184
|
if (dom && dom.nodeName !== 'TABLE') {
|
|
189
185
|
dom = dom.closest('table');
|
|
190
186
|
}
|
|
@@ -154,12 +154,17 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
|
|
|
154
154
|
shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
155
155
|
}
|
|
156
156
|
const resizedDelta = clientX - startX;
|
|
157
|
+
const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
157
158
|
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
158
|
-
const newResizeState = resizeColumnAndTable(resizeState, colIndex,
|
|
159
|
+
const newResizeState = resizeColumnAndTable(resizeState, colIndex, resizedDelta, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, shouldScale,
|
|
160
|
+
// isTableScalingEnabled
|
|
161
|
+
undefined,
|
|
162
|
+
// originalTableWidth
|
|
163
|
+
shouldUseIncreasedScalingPercent);
|
|
159
164
|
tr = updateColumnWidths(newResizeState, table, start)(tr);
|
|
160
165
|
tr.setNodeAttribute(start - 1, 'width', newResizeState.tableWidth);
|
|
161
166
|
} else {
|
|
162
|
-
const newResizeState = resizeColumn(resizeState, colIndex,
|
|
167
|
+
const newResizeState = resizeColumn(resizeState, colIndex, resizedDelta, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, shouldScale, shouldUseIncreasedScalingPercent);
|
|
163
168
|
tr = updateColumnWidths(newResizeState, table, start)(tr);
|
|
164
169
|
}
|
|
165
170
|
if (colIndex === map.width - 1) {
|
|
@@ -40,8 +40,6 @@ export const resizeColumnAndTable = (resizeState, colIndex, amount, tableRef, ta
|
|
|
40
40
|
// need to look at the resize amount and try to adjust the colgroups
|
|
41
41
|
if (isOverflowed) {
|
|
42
42
|
resizeAmount = amount < 0 ? amount : resizeAmount - (tableNode.attrs.width + resizeAmount - tableContainerWidth) / 2;
|
|
43
|
-
} else {
|
|
44
|
-
resizeAmount = amount > 0 && tableContainerWidth ? resizeAmount - (tableNode.attrs.width + resizeAmount - tableContainerWidth) / 2 : resizeAmount;
|
|
45
43
|
}
|
|
46
44
|
const newState = updateAffectedColumn(resizeState, colIndex, resizeAmount);
|
|
47
45
|
|
|
@@ -56,7 +54,8 @@ export const resizeColumnAndTable = (resizeState, colIndex, amount, tableRef, ta
|
|
|
56
54
|
}
|
|
57
55
|
return {
|
|
58
56
|
...newState,
|
|
59
|
-
tableWidth
|
|
57
|
+
// resizeState.tableWidth sometimes is off by ~3px on load on resized table when !isOverflowed, using resizeState.maxSize instead
|
|
58
|
+
tableWidth: isOverflowed ? tableContainerWidth : resizeState.maxSize + delta
|
|
60
59
|
};
|
|
61
60
|
};
|
|
62
61
|
const updateTablePreview = (resizeAmount, tableRef, tableNode) => {
|
|
@@ -294,7 +294,7 @@ export const getNewResizeStateFromSelectedColumns = (rect, state, domAtPos, getE
|
|
|
294
294
|
}
|
|
295
295
|
const maybeTable = domAtPos(table.start).node;
|
|
296
296
|
const maybeTableElement = maybeTable instanceof HTMLElement ? maybeTable : null;
|
|
297
|
-
const tableRef =
|
|
297
|
+
const tableRef = maybeTableElement === null || maybeTableElement === void 0 ? void 0 : maybeTableElement.closest('table');
|
|
298
298
|
if (!tableRef) {
|
|
299
299
|
return;
|
|
300
300
|
}
|
package/dist/es2019/toolbar.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
4
|
import { jsx } from '@emotion/react';
|
|
4
5
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
5
6
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
2
2
|
import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
3
3
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
4
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { getTableContainerElementWidth, getTableElementWidth, hasTableBeenResized } from '../pm-plugins/table-resizing/utils';
|
|
6
5
|
import { isMinCellWidthTable } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
7
6
|
import { getResizeState } from '../pm-plugins/table-resizing/utils/resize-state';
|
|
@@ -95,7 +94,7 @@ export const rescaleColumns = (isTableScalingEnabled = false, isTableFixedColumn
|
|
|
95
94
|
const newTable = tr.doc.nodeAt(table.pos);
|
|
96
95
|
const domAtPos = view.domAtPos.bind(view);
|
|
97
96
|
const maybeTable = domAtPos(table.start).node;
|
|
98
|
-
const maybeTableElement =
|
|
97
|
+
const maybeTableElement = maybeTable instanceof HTMLElement ? maybeTable : null;
|
|
99
98
|
const tableRef = maybeTableElement === null || maybeTableElement === void 0 ? void 0 : maybeTableElement.closest('table');
|
|
100
99
|
if (!tableRef || !newTable) {
|
|
101
100
|
return tr;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
4
|
import { jsx } from '@emotion/react';
|
|
4
5
|
import { useIntl } from 'react-intl-next';
|
|
5
6
|
import { startColumnResizing, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
3
|
import { jsx } from '@emotion/react';
|
|
3
4
|
import { ButtonGroup } from '@atlaskit/button';
|
|
4
5
|
import { FloatingToolbarButton as Button, FloatingToolbarSeparator } from '@atlaskit/editor-common/ui';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
5
|
import { jsx } from '@emotion/react';
|
|
4
6
|
import { injectIntl } from 'react-intl-next';
|
|
5
7
|
import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
@@ -2,6 +2,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { Component } from 'react';
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
7
|
import { jsx } from '@emotion/react';
|
|
6
8
|
import { injectIntl } from 'react-intl-next';
|
|
7
9
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
3
|
import { jsx } from '@emotion/react';
|
|
3
4
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
4
5
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
/** @jsxFrag */
|
|
4
4
|
import React, { useEffect, useState } from 'react';
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
7
|
import { jsx } from '@emotion/react';
|
|
6
8
|
import { injectIntl } from 'react-intl-next';
|
|
7
9
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -4,7 +4,6 @@ import React, { Fragment, useCallback, useEffect, useMemo, useState } from 'reac
|
|
|
4
4
|
import { injectIntl } from 'react-intl-next';
|
|
5
5
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
6
6
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
9
8
|
import { clearHoverSelection } from '../../../commands';
|
|
10
9
|
import { toggleDragMenu } from '../../../pm-plugins/drag-and-drop/commands';
|
|
@@ -91,26 +90,15 @@ const DragControlsComponent = ({
|
|
|
91
90
|
}
|
|
92
91
|
}, [editorView, tableActive]);
|
|
93
92
|
const handleMouseMove = useCallback(e => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const rowIndex = target === null || target === void 0 ? void 0 : target.getAttribute('data-start-index');
|
|
93
|
+
const target = e.nativeEvent.target instanceof Element ? e.nativeEvent.target : null;
|
|
94
|
+
const isParentDragControls = target === null || target === void 0 ? void 0 : target.closest(`.${ClassName.DRAG_ROW_CONTROLS}`);
|
|
95
|
+
const rowIndex = target === null || target === void 0 ? void 0 : target.getAttribute('data-start-index');
|
|
98
96
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
updateCellHoverLocation(Number(rowIndex));
|
|
104
|
-
} else {
|
|
105
|
-
const isParentDragControls = e.nativeEvent.target.closest(`.${ClassName.DRAG_ROW_CONTROLS}`);
|
|
106
|
-
const rowIndex = e.nativeEvent.target.getAttribute('data-start-index');
|
|
107
|
-
|
|
108
|
-
// avoid updating if event target is not related
|
|
109
|
-
if (!isParentDragControls || !rowIndex) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
updateCellHoverLocation(Number(rowIndex));
|
|
97
|
+
// avoid updating if event target is not related
|
|
98
|
+
if (!isParentDragControls || !rowIndex) {
|
|
99
|
+
return;
|
|
113
100
|
}
|
|
101
|
+
updateCellHoverLocation(Number(rowIndex));
|
|
114
102
|
}, [updateCellHoverLocation]);
|
|
115
103
|
const rowIndexes = useMemo(() => {
|
|
116
104
|
return [rowIndex];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression */
|
|
2
2
|
|
|
3
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
4
|
import { css } from '@emotion/react';
|
|
4
5
|
import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
|
|
5
6
|
import { SORTABLE_COLUMN_ICON_CLASSNAME } from '@atlaskit/editor-common/table';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression -- needs mahual remediation */
|
|
2
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
3
|
import { css } from '@emotion/react';
|
|
3
4
|
import { tableCellBorderWidth, tableMarginTop, tableMarginTopWithControl } from '@atlaskit/editor-common/styles';
|
|
4
5
|
import { akEditorShadowZIndex, akEditorTableBorder, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -178,12 +178,8 @@ export var changeColumnWidthByStep = function changeColumnWidthByStep(_ref4) {
|
|
|
178
178
|
var domAtPos = view.domAtPos.bind(view);
|
|
179
179
|
var colIndex = map.colCount($cell.pos - tableStartPosition) + ($cell.nodeAfter ? $cell.nodeAfter.attrs.colspan : 1) - 1;
|
|
180
180
|
var dom = null;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
dom = domAtPosition.node instanceof HTMLTableElement ? domAtPosition.node : null;
|
|
184
|
-
} else {
|
|
185
|
-
dom = domAtPos(tableStartPosition).node;
|
|
186
|
-
}
|
|
181
|
+
var domAtPosition = domAtPos(tableStartPosition);
|
|
182
|
+
dom = domAtPosition.node instanceof HTMLTableElement ? domAtPosition.node : null;
|
|
187
183
|
if (dom && dom.nodeName !== 'TABLE') {
|
|
188
184
|
dom = dom.closest('table');
|
|
189
185
|
}
|
|
@@ -141,12 +141,17 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
141
141
|
_shouldScale = _shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
142
142
|
}
|
|
143
143
|
var resizedDelta = clientX - startX;
|
|
144
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
144
145
|
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
145
|
-
var newResizeState = resizeColumnAndTable(resizeState, colIndex,
|
|
146
|
+
var newResizeState = resizeColumnAndTable(resizeState, colIndex, resizedDelta, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, _shouldScale,
|
|
147
|
+
// isTableScalingEnabled
|
|
148
|
+
undefined,
|
|
149
|
+
// originalTableWidth
|
|
150
|
+
shouldUseIncreasedScalingPercent);
|
|
146
151
|
tr = updateColumnWidths(newResizeState, table, start)(tr);
|
|
147
152
|
tr.setNodeAttribute(start - 1, 'width', newResizeState.tableWidth);
|
|
148
153
|
} else {
|
|
149
|
-
var _newResizeState = resizeColumn(resizeState, colIndex,
|
|
154
|
+
var _newResizeState = resizeColumn(resizeState, colIndex, resizedDelta, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, _shouldScale, shouldUseIncreasedScalingPercent);
|
|
150
155
|
tr = updateColumnWidths(_newResizeState, table, start)(tr);
|
|
151
156
|
}
|
|
152
157
|
if (colIndex === map.width - 1) {
|
|
@@ -48,8 +48,6 @@ export var resizeColumnAndTable = function resizeColumnAndTable(resizeState, col
|
|
|
48
48
|
// need to look at the resize amount and try to adjust the colgroups
|
|
49
49
|
if (isOverflowed) {
|
|
50
50
|
resizeAmount = amount < 0 ? amount : resizeAmount - (tableNode.attrs.width + resizeAmount - tableContainerWidth) / 2;
|
|
51
|
-
} else {
|
|
52
|
-
resizeAmount = amount > 0 && tableContainerWidth ? resizeAmount - (tableNode.attrs.width + resizeAmount - tableContainerWidth) / 2 : resizeAmount;
|
|
53
51
|
}
|
|
54
52
|
var newState = updateAffectedColumn(resizeState, colIndex, resizeAmount);
|
|
55
53
|
|
|
@@ -63,7 +61,8 @@ export var resizeColumnAndTable = function resizeColumnAndTable(resizeState, col
|
|
|
63
61
|
updateTablePreview(delta, tableRef, tableNode);
|
|
64
62
|
}
|
|
65
63
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
|
66
|
-
tableWidth
|
|
64
|
+
// resizeState.tableWidth sometimes is off by ~3px on load on resized table when !isOverflowed, using resizeState.maxSize instead
|
|
65
|
+
tableWidth: isOverflowed ? tableContainerWidth : resizeState.maxSize + delta
|
|
67
66
|
});
|
|
68
67
|
};
|
|
69
68
|
var updateTablePreview = function updateTablePreview(resizeAmount, tableRef, tableNode) {
|
|
@@ -318,7 +318,7 @@ export var getNewResizeStateFromSelectedColumns = function getNewResizeStateFrom
|
|
|
318
318
|
}
|
|
319
319
|
var maybeTable = domAtPos(table.start).node;
|
|
320
320
|
var maybeTableElement = maybeTable instanceof HTMLElement ? maybeTable : null;
|
|
321
|
-
var tableRef =
|
|
321
|
+
var tableRef = maybeTableElement === null || maybeTableElement === void 0 ? void 0 : maybeTableElement.closest('table');
|
|
322
322
|
if (!tableRef) {
|
|
323
323
|
return;
|
|
324
324
|
}
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -4,6 +4,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
/** @jsx jsx */
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
8
|
import { jsx } from '@emotion/react';
|
|
8
9
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
9
10
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -4,7 +4,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
6
6
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { getTableContainerElementWidth, getTableElementWidth, hasTableBeenResized } from '../pm-plugins/table-resizing/utils';
|
|
9
8
|
import { isMinCellWidthTable } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
10
9
|
import { getResizeState } from '../pm-plugins/table-resizing/utils/resize-state';
|
|
@@ -102,7 +101,7 @@ export var rescaleColumns = function rescaleColumns() {
|
|
|
102
101
|
var newTable = tr.doc.nodeAt(table.pos);
|
|
103
102
|
var domAtPos = view.domAtPos.bind(view);
|
|
104
103
|
var maybeTable = domAtPos(table.start).node;
|
|
105
|
-
var maybeTableElement =
|
|
104
|
+
var maybeTableElement = maybeTable instanceof HTMLElement ? maybeTable : null;
|
|
106
105
|
var tableRef = maybeTableElement === null || maybeTableElement === void 0 ? void 0 : maybeTableElement.closest('table');
|
|
107
106
|
if (!tableRef || !newTable) {
|
|
108
107
|
return tr;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
4
|
import { jsx } from '@emotion/react';
|
|
4
5
|
import { useIntl } from 'react-intl-next';
|
|
5
6
|
import { startColumnResizing, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
3
|
import { jsx } from '@emotion/react';
|
|
3
4
|
import { ButtonGroup } from '@atlaskit/button';
|
|
4
5
|
import { FloatingToolbarButton as Button, FloatingToolbarSeparator } from '@atlaskit/editor-common/ui';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
5
|
import { jsx } from '@emotion/react';
|
|
4
6
|
import { injectIntl } from 'react-intl-next';
|
|
5
7
|
import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
@@ -13,6 +13,8 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
13
13
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
14
14
|
/** @jsx jsx */
|
|
15
15
|
import { Component } from 'react';
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
16
18
|
import { jsx } from '@emotion/react';
|
|
17
19
|
import { injectIntl } from 'react-intl-next';
|
|
18
20
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
3
|
import { jsx } from '@emotion/react';
|
|
3
4
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
4
5
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject;
|
|
3
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
4
|
import { css } from '@emotion/react';
|
|
4
5
|
import { tableBackgroundBorderColor } from '@atlaskit/adf-schema';
|
|
5
6
|
import { N60A, N90 } from '@atlaskit/theme/colors';
|
|
@@ -4,6 +4,8 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
4
4
|
/** @jsx jsx */
|
|
5
5
|
/** @jsxFrag */
|
|
6
6
|
import React, { useEffect, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
9
|
import { jsx } from '@emotion/react';
|
|
8
10
|
import { injectIntl } from 'react-intl-next';
|
|
9
11
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject;
|
|
3
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
4
|
import { css } from '@emotion/react';
|
|
4
5
|
import { tableBackgroundBorderColor } from '@atlaskit/adf-schema';
|
|
5
6
|
import { N60A, N90 } from '@atlaskit/theme/colors';
|
|
@@ -5,7 +5,6 @@ import React, { Fragment, useCallback, useEffect, useMemo, useState } from 'reac
|
|
|
5
5
|
import { injectIntl } from 'react-intl-next';
|
|
6
6
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
7
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
10
9
|
import { clearHoverSelection } from '../../../commands';
|
|
11
10
|
import { toggleDragMenu } from '../../../pm-plugins/drag-and-drop/commands';
|
|
@@ -91,26 +90,15 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
91
90
|
}
|
|
92
91
|
}, [editorView, tableActive]);
|
|
93
92
|
var handleMouseMove = useCallback(function (e) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var _rowIndex = target === null || target === void 0 ? void 0 : target.getAttribute('data-start-index');
|
|
93
|
+
var target = e.nativeEvent.target instanceof Element ? e.nativeEvent.target : null;
|
|
94
|
+
var isParentDragControls = target === null || target === void 0 ? void 0 : target.closest(".".concat(ClassName.DRAG_ROW_CONTROLS));
|
|
95
|
+
var rowIndex = target === null || target === void 0 ? void 0 : target.getAttribute('data-start-index');
|
|
98
96
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
updateCellHoverLocation(Number(_rowIndex));
|
|
104
|
-
} else {
|
|
105
|
-
var _isParentDragControls = e.nativeEvent.target.closest(".".concat(ClassName.DRAG_ROW_CONTROLS));
|
|
106
|
-
var _rowIndex2 = e.nativeEvent.target.getAttribute('data-start-index');
|
|
107
|
-
|
|
108
|
-
// avoid updating if event target is not related
|
|
109
|
-
if (!_isParentDragControls || !_rowIndex2) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
updateCellHoverLocation(Number(_rowIndex2));
|
|
97
|
+
// avoid updating if event target is not related
|
|
98
|
+
if (!isParentDragControls || !rowIndex) {
|
|
99
|
+
return;
|
|
113
100
|
}
|
|
101
|
+
updateCellHoverLocation(Number(rowIndex));
|
|
114
102
|
}, [updateCellHoverLocation]);
|
|
115
103
|
var rowIndexes = useMemo(function () {
|
|
116
104
|
return [rowIndex];
|
|
@@ -2,6 +2,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
3
3
|
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression */
|
|
4
4
|
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
6
|
import { css } from '@emotion/react';
|
|
6
7
|
import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
|
|
7
8
|
import { SORTABLE_COLUMN_ICON_CLASSNAME } from '@atlaskit/editor-common/table';
|
package/dist/esm/ui/ui-styles.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25;
|
|
3
3
|
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression -- needs mahual remediation */
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
5
|
import { css } from '@emotion/react';
|
|
5
6
|
import { tableCellBorderWidth, tableMarginTop, tableMarginTopWithControl } from '@atlaskit/editor-common/styles';
|
|
6
7
|
import { akEditorShadowZIndex, akEditorTableBorder, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.17.
|
|
3
|
+
"version": "7.17.6",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
44
44
|
"@atlaskit/editor-shared-styles": "^2.12.0",
|
|
45
45
|
"@atlaskit/editor-tables": "^2.7.0",
|
|
46
|
-
"@atlaskit/icon": "^22.
|
|
47
|
-
"@atlaskit/menu": "^2.
|
|
46
|
+
"@atlaskit/icon": "^22.4.0",
|
|
47
|
+
"@atlaskit/menu": "^2.5.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
49
49
|
"@atlaskit/pragmatic-drag-and-drop": "^1.1.0",
|
|
50
50
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.3.0",
|
|
51
51
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
52
|
-
"@atlaskit/primitives": "^7.
|
|
53
|
-
"@atlaskit/theme": "^12.
|
|
54
|
-
"@atlaskit/toggle": "^13.
|
|
55
|
-
"@atlaskit/tokens": "^1.
|
|
56
|
-
"@atlaskit/tooltip": "^18.
|
|
52
|
+
"@atlaskit/primitives": "^7.4.0",
|
|
53
|
+
"@atlaskit/theme": "^12.10.0",
|
|
54
|
+
"@atlaskit/toggle": "^13.2.0",
|
|
55
|
+
"@atlaskit/tokens": "^1.51.0",
|
|
56
|
+
"@atlaskit/tooltip": "^18.5.0",
|
|
57
57
|
"@babel/runtime": "^7.0.0",
|
|
58
58
|
"@emotion/react": "^11.7.1",
|
|
59
59
|
"classnames": "^2.2.5",
|
|
@@ -132,9 +132,6 @@
|
|
|
132
132
|
"platform.editor.table.use-increased-scaling-percent": {
|
|
133
133
|
"type": "boolean"
|
|
134
134
|
},
|
|
135
|
-
"platform.editor.explicit-html-element-check": {
|
|
136
|
-
"type": "boolean"
|
|
137
|
-
},
|
|
138
135
|
"platform.editor.table.live-pages-sorting_4malx": {
|
|
139
136
|
"type": "boolean"
|
|
140
137
|
},
|
|
@@ -296,12 +296,8 @@ export const changeColumnWidthByStep =
|
|
|
296
296
|
1;
|
|
297
297
|
|
|
298
298
|
let dom: HTMLTableElement | null = null;
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
dom = domAtPosition.node instanceof HTMLTableElement ? domAtPosition.node : null;
|
|
302
|
-
} else {
|
|
303
|
-
dom = domAtPos(tableStartPosition).node as HTMLTableElement;
|
|
304
|
-
}
|
|
299
|
+
const domAtPosition = domAtPos(tableStartPosition);
|
|
300
|
+
dom = domAtPosition.node instanceof HTMLTableElement ? domAtPosition.node : null;
|
|
305
301
|
|
|
306
302
|
if (dom && dom.nodeName !== 'TABLE') {
|
|
307
303
|
dom = dom.closest('table');
|
|
@@ -192,16 +192,20 @@ export const handleMouseDown = (
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
const resizedDelta = clientX - startX;
|
|
195
|
-
|
|
195
|
+
const shouldUseIncreasedScalingPercent =
|
|
196
|
+
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
197
|
+
getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
196
198
|
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
197
199
|
const newResizeState = resizeColumnAndTable(
|
|
198
200
|
resizeState,
|
|
199
201
|
colIndex,
|
|
200
|
-
|
|
202
|
+
resizedDelta,
|
|
201
203
|
dom,
|
|
202
204
|
originalTable,
|
|
203
205
|
resizingSelectedColumns ? selectedColumns : undefined,
|
|
204
|
-
shouldScale,
|
|
206
|
+
shouldScale, // isTableScalingEnabled
|
|
207
|
+
undefined, // originalTableWidth
|
|
208
|
+
shouldUseIncreasedScalingPercent,
|
|
205
209
|
);
|
|
206
210
|
tr = updateColumnWidths(newResizeState, table, start)(tr);
|
|
207
211
|
tr.setNodeAttribute(start - 1, 'width', newResizeState.tableWidth);
|
|
@@ -209,13 +213,12 @@ export const handleMouseDown = (
|
|
|
209
213
|
const newResizeState = resizeColumn(
|
|
210
214
|
resizeState,
|
|
211
215
|
colIndex,
|
|
212
|
-
|
|
216
|
+
resizedDelta,
|
|
213
217
|
dom,
|
|
214
218
|
originalTable,
|
|
215
219
|
resizingSelectedColumns ? selectedColumns : undefined,
|
|
216
220
|
shouldScale,
|
|
217
|
-
|
|
218
|
-
getBooleanFF('platform.editor.table.use-increased-scaling-percent'),
|
|
221
|
+
shouldUseIncreasedScalingPercent,
|
|
219
222
|
);
|
|
220
223
|
tr = updateColumnWidths(newResizeState, table, start)(tr);
|
|
221
224
|
}
|
|
@@ -81,11 +81,6 @@ export const resizeColumnAndTable = (
|
|
|
81
81
|
amount < 0
|
|
82
82
|
? amount
|
|
83
83
|
: resizeAmount - (tableNode.attrs.width + resizeAmount - tableContainerWidth) / 2;
|
|
84
|
-
} else {
|
|
85
|
-
resizeAmount =
|
|
86
|
-
amount > 0 && tableContainerWidth
|
|
87
|
-
? resizeAmount - (tableNode.attrs.width + resizeAmount - tableContainerWidth) / 2
|
|
88
|
-
: resizeAmount;
|
|
89
84
|
}
|
|
90
85
|
|
|
91
86
|
const newState = updateAffectedColumn(resizeState, colIndex, resizeAmount);
|
|
@@ -103,7 +98,8 @@ export const resizeColumnAndTable = (
|
|
|
103
98
|
|
|
104
99
|
return {
|
|
105
100
|
...newState,
|
|
106
|
-
tableWidth
|
|
101
|
+
// resizeState.tableWidth sometimes is off by ~3px on load on resized table when !isOverflowed, using resizeState.maxSize instead
|
|
102
|
+
tableWidth: isOverflowed ? tableContainerWidth : resizeState.maxSize + delta,
|
|
107
103
|
};
|
|
108
104
|
};
|
|
109
105
|
|
|
@@ -347,9 +347,7 @@ export const getNewResizeStateFromSelectedColumns = (
|
|
|
347
347
|
const maybeTable = domAtPos(table.start).node;
|
|
348
348
|
|
|
349
349
|
const maybeTableElement = maybeTable instanceof HTMLElement ? maybeTable : null;
|
|
350
|
-
const tableRef =
|
|
351
|
-
? maybeTableElement?.closest('table')
|
|
352
|
-
: (maybeTable as HTMLElement)?.closest('table');
|
|
350
|
+
const tableRef = maybeTableElement?.closest('table');
|
|
353
351
|
|
|
354
352
|
if (!tableRef) {
|
|
355
353
|
return;
|
package/src/toolbar.tsx
CHANGED
|
@@ -6,7 +6,6 @@ import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
|
6
6
|
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
9
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
10
9
|
|
|
11
10
|
import type { ResizeState } from '../pm-plugins/table-resizing/utils';
|
|
12
11
|
import {
|
|
@@ -118,11 +117,7 @@ export const rescaleColumns =
|
|
|
118
117
|
const newTable = tr.doc.nodeAt(table.pos);
|
|
119
118
|
const domAtPos = view.domAtPos.bind(view);
|
|
120
119
|
const maybeTable = domAtPos(table.start).node;
|
|
121
|
-
const maybeTableElement =
|
|
122
|
-
? maybeTable instanceof HTMLElement
|
|
123
|
-
? maybeTable
|
|
124
|
-
: null
|
|
125
|
-
: (maybeTable as HTMLElement | null);
|
|
120
|
+
const maybeTableElement = maybeTable instanceof HTMLElement ? maybeTable : null;
|
|
126
121
|
const tableRef = maybeTableElement?.closest('table');
|
|
127
122
|
|
|
128
123
|
if (!tableRef || !newTable) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
5
|
import { jsx } from '@emotion/react';
|
|
5
6
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
6
7
|
import { injectIntl } from 'react-intl-next';
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { Component } from 'react';
|
|
4
4
|
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
6
|
import { jsx } from '@emotion/react';
|
|
6
7
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
7
8
|
import { injectIntl } from 'react-intl-next';
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/** @jsxFrag */
|
|
4
4
|
import React, { useEffect, useState } from 'react';
|
|
5
5
|
|
|
6
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
7
|
import { jsx } from '@emotion/react';
|
|
7
8
|
import type { IntlShape, MessageDescriptor, WrappedComponentProps } from 'react-intl-next';
|
|
8
9
|
import { injectIntl } from 'react-intl-next';
|
|
@@ -10,7 +10,6 @@ import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
10
10
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
11
11
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
12
12
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
13
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
14
13
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
15
14
|
import { token } from '@atlaskit/tokens';
|
|
16
15
|
|
|
@@ -128,30 +127,16 @@ const DragControlsComponent = ({
|
|
|
128
127
|
|
|
129
128
|
const handleMouseMove = useCallback(
|
|
130
129
|
(e: MouseEvent) => {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const rowIndex = target?.getAttribute('data-start-index');
|
|
130
|
+
const target = e.nativeEvent.target instanceof Element ? e.nativeEvent.target : null;
|
|
131
|
+
const isParentDragControls = target?.closest(`.${ClassName.DRAG_ROW_CONTROLS}`);
|
|
132
|
+
const rowIndex = target?.getAttribute('data-start-index');
|
|
135
133
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
updateCellHoverLocation(Number(rowIndex));
|
|
142
|
-
} else {
|
|
143
|
-
const isParentDragControls = (e.nativeEvent.target as Element).closest(
|
|
144
|
-
`.${ClassName.DRAG_ROW_CONTROLS}`,
|
|
145
|
-
);
|
|
146
|
-
const rowIndex = (e.nativeEvent.target as Element).getAttribute('data-start-index');
|
|
147
|
-
|
|
148
|
-
// avoid updating if event target is not related
|
|
149
|
-
if (!isParentDragControls || !rowIndex) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
updateCellHoverLocation(Number(rowIndex));
|
|
134
|
+
// avoid updating if event target is not related
|
|
135
|
+
if (!isParentDragControls || !rowIndex) {
|
|
136
|
+
return;
|
|
154
137
|
}
|
|
138
|
+
|
|
139
|
+
updateCellHoverLocation(Number(rowIndex));
|
|
155
140
|
},
|
|
156
141
|
[updateCellHoverLocation],
|
|
157
142
|
);
|
package/src/ui/common-styles.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression */
|
|
2
2
|
|
|
3
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
4
|
import { css } from '@emotion/react';
|
|
4
5
|
|
|
5
6
|
import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
|
package/src/ui/ui-styles.ts
CHANGED