@atlaskit/editor-plugin-table 1.2.0 → 1.2.1
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/plugins/table/index.js +2 -1
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +1 -2
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +32 -17
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +1 -5
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +3 -38
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +16 -3
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +6 -3
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/types/i18n.js +5 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/index.js +2 -1
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +1 -2
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +32 -17
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +1 -5
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/misc.js +1 -37
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +18 -4
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +6 -3
- package/dist/es2019/plugins/table/ui/common-styles.js +1 -0
- package/dist/es2019/types/i18n.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/index.js +2 -1
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +1 -2
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +32 -17
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +1 -5
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/misc.js +1 -35
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +17 -4
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +6 -3
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/types/i18n.js +1 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +2 -2
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +1 -2
- package/dist/types/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -1
- package/dist/types/plugins/table/ui/FloatingContextualMenu/index.d.ts +3 -2
- package/dist/types/types/i18n.d.ts +5 -0
- package/package.json +7 -7
- package/src/__tests__/integration/horizontal-scroll.ts +4 -9
- package/src/__tests__/integration/sticky-header.ts +61 -1
- package/src/__tests__/unit/commands/insert.ts +8 -8
- package/src/__tests__/unit/nodeviews/cell.ts +14 -0
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +2 -2
- package/src/__tests__/unit/ui/ContextualMenu.tsx +2 -0
- package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +1 -0
- package/src/plugins/table/index.tsx +4 -0
- package/src/plugins/table/nodeviews/TableComponent.tsx +1 -2
- package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.ts +40 -23
- package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +1 -9
- package/src/plugins/table/pm-plugins/table-resizing/utils/misc.ts +1 -57
- package/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx +21 -2
- package/src/plugins/table/ui/FloatingContextualMenu/index.tsx +8 -1
- package/src/plugins/table/ui/common-styles.ts +1 -0
- package/src/types/i18n.ts +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 1.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f07824eeccc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f07824eeccc) - ED-15647 fix undo when pasting table with resized column in expand
|
|
8
|
+
- [`924e8493f96`](https://bitbucket.org/atlassian/atlassian-frontend/commits/924e8493f96) - [ux] [ED-16418] Fixed issue where on resize the topPosEditorElement top position which determines the height of the sticky header would not update on window resize or other actions that may affect its height
|
|
9
|
+
- [`2f7fff7239d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2f7fff7239d) - [ux] [ED-17271] Sticky headers now listen for width changes in the parent scroll container
|
|
10
|
+
- [`2367ba14aa0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2367ba14aa0) - [ux] ED-16758 Added support for theme tokens in table cell background color.
|
|
11
|
+
- [`1f10173bdad`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1f10173bdad) - [ux] [ED-15686] Added sticky to floating contextual menu dropdown
|
|
12
|
+
- [`a5d7c8d0f1e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a5d7c8d0f1e) - [ux] Fix of the regression caused due to https://product-fabric.atlassian.net/browse/DTR-1313
|
|
13
|
+
- [`deef98920f4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/deef98920f4) - [ux] ED-16718 Table scroll troll - refactor nested expand logic back into editor-common
|
|
14
|
+
- [`1720ddc8076`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1720ddc8076) - [ux] ED-16725 Added support for semantic tooltip names for background color palette.
|
|
15
|
+
- [`454e652b2ed`](https://bitbucket.org/atlassian/atlassian-frontend/commits/454e652b2ed) - [ux] This change (TSLA-488) addresses a bug that occurs when changing the browser window size causes the
|
|
16
|
+
table margin to not be immediately updated for tables with active sticky headers. This change adds an
|
|
17
|
+
event listener for window resizing that updates the table margins.
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 1.2.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -273,7 +273,8 @@ var tablesPlugin = function tablesPlugin(options) {
|
|
|
273
273
|
isOpen: Boolean(isContextualMenuOpen),
|
|
274
274
|
pluginConfig: pluginConfig,
|
|
275
275
|
editorAnalyticsAPI: options === null || options === void 0 ? void 0 : options.editorAnalyticsAPI,
|
|
276
|
-
getEditorContainerWidth: defaultGetEditorContainerWidth
|
|
276
|
+
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
277
|
+
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
|
|
277
278
|
}), allowControls && /*#__PURE__*/_react.default.createElement(_FloatingDeleteButton.default, {
|
|
278
279
|
editorView: editorView,
|
|
279
280
|
selection: editorView.state.selection,
|
|
@@ -32,7 +32,6 @@ var _utils4 = require("../utils");
|
|
|
32
32
|
var _updateOverflowShadows = require("./update-overflow-shadows");
|
|
33
33
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
34
34
|
var _OverflowShadowsObserver = require("./OverflowShadowsObserver");
|
|
35
|
-
var _misc = require("../pm-plugins/table-resizing/utils/misc");
|
|
36
35
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
37
36
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty3.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
38
37
|
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); }; }
|
|
@@ -251,7 +250,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
251
250
|
return;
|
|
252
251
|
}
|
|
253
252
|
var parentNodeWith = (0, _nodeWidth.getParentNodeWidth)(pos, state, containerWidth, options && options.isFullWidthModeEnabled);
|
|
254
|
-
return
|
|
253
|
+
return parentNodeWith;
|
|
255
254
|
});
|
|
256
255
|
(0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "updateParentWidth", function (width) {
|
|
257
256
|
_this.setState({
|
|
@@ -188,7 +188,7 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
188
188
|
(0, _dom.syncStickyRowToTable)(tree.table);
|
|
189
189
|
}, 0);
|
|
190
190
|
});
|
|
191
|
-
(0, _defineProperty2.default)(this, "
|
|
191
|
+
(0, _defineProperty2.default)(this, "updateStickyHeaderWidth", function () {
|
|
192
192
|
// table width might have changed, sync that back to sticky row
|
|
193
193
|
var tree = _this.tree;
|
|
194
194
|
if (!tree) {
|
|
@@ -220,7 +220,7 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
220
220
|
// otherwise make it non-sticky
|
|
221
221
|
return false;
|
|
222
222
|
});
|
|
223
|
-
(0, _defineProperty2.default)(this, "makeHeaderRowSticky", function (tree) {
|
|
223
|
+
(0, _defineProperty2.default)(this, "makeHeaderRowSticky", function (tree, scrollTop) {
|
|
224
224
|
var _tbody$firstChild;
|
|
225
225
|
// If header row height is more than 50% of viewport height don't do this
|
|
226
226
|
if (_this.stickyRowHeight && _this.stickyRowHeight > window.innerHeight / 2) {
|
|
@@ -235,7 +235,10 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
237
|
var currentTableTop = _this.getCurrentTableTop(tree);
|
|
238
|
-
|
|
238
|
+
if (!scrollTop) {
|
|
239
|
+
scrollTop = (0, _dom2.getTop)(_this.editorScrollableElement);
|
|
240
|
+
}
|
|
241
|
+
var domTop = currentTableTop > 0 ? scrollTop : scrollTop + currentTableTop;
|
|
239
242
|
if (!_this.isSticky) {
|
|
240
243
|
(0, _dom.syncStickyRowToTable)(table);
|
|
241
244
|
_this.dom.classList.add('sticky');
|
|
@@ -342,7 +345,7 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
342
345
|
}
|
|
343
346
|
this.topPosEditorElement = (0, _dom2.getTop)(this.editorScrollableElement);
|
|
344
347
|
}
|
|
345
|
-
this.eventDispatcher.on('widthPlugin', this.
|
|
348
|
+
this.eventDispatcher.on('widthPlugin', this.updateStickyHeaderWidth);
|
|
346
349
|
this.eventDispatcher.on(_pluginKey.pluginKey.key, this.onTablePluginState);
|
|
347
350
|
this.listening = true;
|
|
348
351
|
this.dom.addEventListener('wheel', this.headerRowMouseScroll.bind(this));
|
|
@@ -370,7 +373,7 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
370
373
|
if (this.editorScrollableElement && !this.stickyHeadersOptimization) {
|
|
371
374
|
this.editorScrollableElement.removeEventListener('scroll', this.onScroll);
|
|
372
375
|
}
|
|
373
|
-
this.eventDispatcher.off('widthPlugin', this.
|
|
376
|
+
this.eventDispatcher.off('widthPlugin', this.updateStickyHeaderWidth);
|
|
374
377
|
this.eventDispatcher.off(_pluginKey.pluginKey.key, this.onTablePluginState);
|
|
375
378
|
this.listening = false;
|
|
376
379
|
this.dom.removeEventListener('wheel', this.headerRowMouseScroll);
|
|
@@ -392,6 +395,9 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
392
395
|
return;
|
|
393
396
|
}
|
|
394
397
|
this.resizeObserver.observe(this.dom);
|
|
398
|
+
if (this.editorScrollableElement) {
|
|
399
|
+
this.resizeObserver.observe(this.editorScrollableElement);
|
|
400
|
+
}
|
|
395
401
|
window.requestAnimationFrame(function () {
|
|
396
402
|
var _this2$tree;
|
|
397
403
|
// we expect tree to be defined after animation frame
|
|
@@ -422,14 +428,21 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
422
428
|
}
|
|
423
429
|
var table = _this3.tree.table;
|
|
424
430
|
entries.forEach(function (entry) {
|
|
425
|
-
var
|
|
426
|
-
|
|
427
|
-
//
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
(
|
|
431
|
+
var _this3$editorScrollab;
|
|
432
|
+
// On resize of the parent scroll element we need to adjust the width
|
|
433
|
+
// of the sticky header
|
|
434
|
+
if (entry.target.className === ((_this3$editorScrollab = _this3.editorScrollableElement) === null || _this3$editorScrollab === void 0 ? void 0 : _this3$editorScrollab.className)) {
|
|
435
|
+
_this3.updateStickyHeaderWidth();
|
|
436
|
+
} else {
|
|
437
|
+
var newHeight = entry.contentRect ? entry.contentRect.height : entry.target.offsetHeight;
|
|
438
|
+
if (_this3.sentinels.bottom &&
|
|
439
|
+
// When the table header is sticky, it would be taller by a 1px (border-bottom),
|
|
440
|
+
// So we adding this check to allow a 1px difference.
|
|
441
|
+
Math.abs(newHeight - (_this3.stickyRowHeight || 0)) > _consts.stickyHeaderBorderBottomWidth) {
|
|
442
|
+
_this3.stickyRowHeight = newHeight;
|
|
443
|
+
_this3.sentinels.bottom.style.bottom = "".concat(_consts.tableScrollbarOffset + _consts.stickyRowOffsetTop + newHeight, "px");
|
|
444
|
+
(0, _dom.updateStickyMargins)(table);
|
|
445
|
+
}
|
|
433
446
|
}
|
|
434
447
|
});
|
|
435
448
|
});
|
|
@@ -455,18 +468,20 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
455
468
|
var _entry$rootBounds2;
|
|
456
469
|
var sentinelIsBelowScrollArea = (((_entry$rootBounds2 = entry.rootBounds) === null || _entry$rootBounds2 === void 0 ? void 0 : _entry$rootBounds2.bottom) || 0) < entry.boundingClientRect.bottom;
|
|
457
470
|
if (!entry.isIntersecting && !sentinelIsBelowScrollArea) {
|
|
458
|
-
|
|
471
|
+
var _entry$rootBounds3;
|
|
472
|
+
_this4.tree && _this4.makeHeaderRowSticky(_this4.tree, (_entry$rootBounds3 = entry.rootBounds) === null || _entry$rootBounds3 === void 0 ? void 0 : _entry$rootBounds3.top);
|
|
459
473
|
} else {
|
|
460
474
|
table && _this4.makeRowHeaderNotSticky(table);
|
|
461
475
|
}
|
|
462
476
|
}
|
|
463
477
|
if (target.classList.contains(_types.TableCssClassName.TABLE_STICKY_SENTINEL_BOTTOM)) {
|
|
464
|
-
var _entry$
|
|
465
|
-
var sentinelIsAboveScrollArea = entry.boundingClientRect.top - _this4.dom.offsetHeight < (((_entry$
|
|
478
|
+
var _entry$rootBounds4;
|
|
479
|
+
var sentinelIsAboveScrollArea = entry.boundingClientRect.top - _this4.dom.offsetHeight < (((_entry$rootBounds4 = entry.rootBounds) === null || _entry$rootBounds4 === void 0 ? void 0 : _entry$rootBounds4.top) || 0);
|
|
466
480
|
if (table && !entry.isIntersecting && sentinelIsAboveScrollArea) {
|
|
467
481
|
_this4.makeRowHeaderNotSticky(table);
|
|
468
482
|
} else if (entry.isIntersecting && sentinelIsAboveScrollArea) {
|
|
469
|
-
|
|
483
|
+
var _entry$rootBounds5;
|
|
484
|
+
_this4.tree && _this4.makeHeaderRowSticky(_this4.tree, entry === null || entry === void 0 ? void 0 : (_entry$rootBounds5 = entry.rootBounds) === null || _entry$rootBounds5 === void 0 ? void 0 : _entry$rootBounds5.top);
|
|
470
485
|
}
|
|
471
486
|
}
|
|
472
487
|
});
|
|
@@ -15,7 +15,6 @@ var _commands = require("./commands");
|
|
|
15
15
|
var _pluginFactory = require("./plugin-factory");
|
|
16
16
|
var _utils3 = require("./utils");
|
|
17
17
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
18
|
-
var _misc = require("./utils/misc");
|
|
19
18
|
var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI) {
|
|
20
19
|
var state = view.state,
|
|
21
20
|
dispatch = view.dispatch;
|
|
@@ -36,10 +35,7 @@ var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos
|
|
|
36
35
|
}
|
|
37
36
|
var containerWidth = getEditorContainerWidth();
|
|
38
37
|
var parentWidth = (0, _nodeWidth.getParentNodeWidth)(start, state, containerWidth);
|
|
39
|
-
|
|
40
|
-
// TODO - refactor this logic into getParentNodeWidth() in editor-common [ED-16718]
|
|
41
|
-
var parentActualWidth = (0, _misc.getParentWidthWithoutPadding)(parentWidth, start, state);
|
|
42
|
-
var maxSize = parentActualWidth || (0, _utils3.getLayoutSize)(dom.getAttribute('data-layout'), containerWidth.width, {});
|
|
38
|
+
var maxSize = parentWidth || (0, _utils3.getLayoutSize)(dom.getAttribute('data-layout'), containerWidth.width, {});
|
|
43
39
|
if (originalTable.attrs.isNumberColumnEnabled) {
|
|
44
40
|
maxSize -= _editorSharedStyles.akEditorTableNumberColumnWidth;
|
|
45
41
|
}
|
|
@@ -7,7 +7,7 @@ exports.currentColWidth = currentColWidth;
|
|
|
7
7
|
exports.domCellAround = domCellAround;
|
|
8
8
|
exports.getDefaultLayoutMaxWidth = getDefaultLayoutMaxWidth;
|
|
9
9
|
exports.getLayoutSize = getLayoutSize;
|
|
10
|
-
exports.getTableMaxWidth =
|
|
10
|
+
exports.getTableMaxWidth = void 0;
|
|
11
11
|
exports.pointsAtCell = pointsAtCell;
|
|
12
12
|
exports.tableLayoutToSize = void 0;
|
|
13
13
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
@@ -15,8 +15,6 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
15
15
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
16
16
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
17
17
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
18
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
19
|
-
var _prosemirrorUtils = require("prosemirror-utils");
|
|
20
18
|
var tableLayoutToSize = {
|
|
21
19
|
default: _editorSharedStyles.akEditorDefaultLayoutWidth,
|
|
22
20
|
wide: _editorSharedStyles.akEditorWideLayoutWidth,
|
|
@@ -84,43 +82,10 @@ var getTableMaxWidth = function getTableMaxWidth(_ref2) {
|
|
|
84
82
|
getEditorContainerWidth = _ref2.getEditorContainerWidth;
|
|
85
83
|
var containerWidth = getEditorContainerWidth();
|
|
86
84
|
var parentWidth = (0, _nodeWidth.getParentNodeWidth)(tableStart, state, containerWidth);
|
|
87
|
-
|
|
88
|
-
// TODO - refactor this logic into getParentNodeWidth() in editor-common [ED-16718]
|
|
89
|
-
var parentActualWidth = getParentWidthWithoutPadding(parentWidth, tableStart, state);
|
|
90
|
-
var maxWidth = parentActualWidth || getLayoutSize(layout, containerWidth.width, {});
|
|
85
|
+
var maxWidth = parentWidth || getLayoutSize(layout, containerWidth.width, {});
|
|
91
86
|
if (table.attrs.isNumberColumnEnabled) {
|
|
92
87
|
maxWidth -= _editorSharedStyles.akEditorTableNumberColumnWidth;
|
|
93
88
|
}
|
|
94
89
|
return maxWidth;
|
|
95
90
|
};
|
|
96
|
-
exports.getTableMaxWidth = getTableMaxWidth;
|
|
97
|
-
var getParentWidthWithoutPadding = function getParentWidthWithoutPadding(parentWidth, tableStartPos, state) {
|
|
98
|
-
var node = getNestedParentNode(tableStartPos, state);
|
|
99
|
-
if (!node) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
var schema = state.schema;
|
|
103
|
-
if (node.type === schema.nodes.expand) {
|
|
104
|
-
// padding
|
|
105
|
-
parentWidth -= (0, _constants.gridSize)() * 2;
|
|
106
|
-
// gutter offset
|
|
107
|
-
parentWidth += (0, _constants.gridSize)() * 1.5 * 2;
|
|
108
|
-
// padding right
|
|
109
|
-
parentWidth -= (0, _constants.gridSize)();
|
|
110
|
-
// padding left
|
|
111
|
-
parentWidth -= (0, _constants.gridSize)() * 4 - (0, _constants.gridSize)() / 2;
|
|
112
|
-
}
|
|
113
|
-
return parentWidth;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
// copy of getNestedParentNode() from packages/editor/editor-common/src/node-width/index.ts
|
|
117
|
-
// to be removed later when we will move getParentWidthWithoutPadding() logic to editor-common
|
|
118
|
-
exports.getParentWidthWithoutPadding = getParentWidthWithoutPadding;
|
|
119
|
-
var getNestedParentNode = function getNestedParentNode(tablePos, state) {
|
|
120
|
-
if (tablePos === undefined) {
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
var $pos = state.doc.resolve(tablePos);
|
|
124
|
-
var parent = (0, _prosemirrorUtils.findParentNodeOfTypeClosestToPos)($pos, [state.schema.nodes.bodiedExtension, state.schema.nodes.layoutSection, state.schema.nodes.expand]);
|
|
125
|
-
return parent ? parent.node : null;
|
|
126
|
-
};
|
|
91
|
+
exports.getTableMaxWidth = getTableMaxWidth;
|
|
@@ -114,9 +114,12 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
114
114
|
isOpen = _this$props.isOpen,
|
|
115
115
|
selectionRect = _this$props.selectionRect,
|
|
116
116
|
formatMessage = _this$props.intl.formatMessage,
|
|
117
|
-
editorView = _this$props.editorView
|
|
117
|
+
editorView = _this$props.editorView,
|
|
118
|
+
getEditorFeatureFlags = _this$props.getEditorFeatureFlags;
|
|
118
119
|
var items = [];
|
|
119
120
|
var isSubmenuOpen = _this.state.isSubmenuOpen;
|
|
121
|
+
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
122
|
+
useSomewhatSemanticTextColorNames = _getEditorFeatureFlag.useSomewhatSemanticTextColorNames;
|
|
120
123
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
121
124
|
var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
122
125
|
targetCellPosition = _getPluginState.targetCellPosition,
|
|
@@ -140,9 +143,19 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
140
143
|
ref: _this.handleSubMenuRef
|
|
141
144
|
}, (0, _react2.jsx)(_uiColor.ColorPalette, {
|
|
142
145
|
cols: 7,
|
|
143
|
-
palette: _uiColor.cellBackgroundColorPalette,
|
|
144
146
|
onClick: _this.setColor,
|
|
145
|
-
selectedColor: background
|
|
147
|
+
selectedColor: background,
|
|
148
|
+
paletteOptions: {
|
|
149
|
+
palette: _uiColor.cellBackgroundColorPalette,
|
|
150
|
+
paletteColorTooltipMessages: _uiColor.backgroundPaletteTooltipMessages,
|
|
151
|
+
// We did not want to create new FF or update
|
|
152
|
+
// useSomewhatSemanticTextColorNames name
|
|
153
|
+
// because it is temporary and require extra work.
|
|
154
|
+
// So even though it says text color names,
|
|
155
|
+
// we are going to use for all color pickers
|
|
156
|
+
// such as text, background and table charts.
|
|
157
|
+
showSomewhatSemanticTooltips: useSomewhatSemanticTextColorNames
|
|
158
|
+
}
|
|
146
159
|
})))
|
|
147
160
|
});
|
|
148
161
|
}
|
|
@@ -40,7 +40,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
40
40
|
isOpen = _ref.isOpen,
|
|
41
41
|
pluginConfig = _ref.pluginConfig,
|
|
42
42
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
43
|
-
getEditorContainerWidth = _ref.getEditorContainerWidth
|
|
43
|
+
getEditorContainerWidth = _ref.getEditorContainerWidth,
|
|
44
|
+
getEditorFeatureFlags = _ref.getEditorFeatureFlags;
|
|
44
45
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
45
46
|
var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
46
47
|
targetCellPosition = _getPluginState.targetCellPosition;
|
|
@@ -71,7 +72,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
71
72
|
,
|
|
72
73
|
zIndex: _editorSharedStyles.akEditorFloatingOverlapPanelZIndex,
|
|
73
74
|
forcePlacement: true,
|
|
74
|
-
offset: [-7, 0]
|
|
75
|
+
offset: [-7, 0],
|
|
76
|
+
stick: true
|
|
75
77
|
}, (0, _react.jsx)("div", {
|
|
76
78
|
css: _styles.tablePopupStyles
|
|
77
79
|
}, (0, _react.jsx)(_ContextualMenu.default, {
|
|
@@ -85,7 +87,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
85
87
|
selectionRect: selectionRect,
|
|
86
88
|
boundariesElement: boundariesElement,
|
|
87
89
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
88
|
-
getEditorContainerWidth: getEditorContainerWidth
|
|
90
|
+
getEditorContainerWidth: getEditorContainerWidth,
|
|
91
|
+
getEditorFeatureFlags: getEditorFeatureFlags
|
|
89
92
|
})));
|
|
90
93
|
};
|
|
91
94
|
FloatingContextualMenu.displayName = 'FloatingContextualMenu';
|
|
@@ -35,7 +35,7 @@ var listLargeNumericMarkersOldStyles = "\n .ProseMirror .pm-table-cell-content-
|
|
|
35
35
|
// TODO: https://product-fabric.atlassian.net/browse/DSP-4139
|
|
36
36
|
var tableStyles = function tableStyles(props) {
|
|
37
37
|
var _props$featureFlags, _props$featureFlags2;
|
|
38
|
-
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " button {\n background: ", ";\n color: ", ";\n cursor: none;\n }\n\n .", ":not(.", ") button:hover {\n background: ", ";\n color: ", " !important;\n cursor: pointer;\n }\n\n .ProseMirror {\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n\n .", " {\n margin-bottom: 0;\n }\n\n .", " {\n td.", ", th.", " {\n position: relative;\n overflow: visible;\n }\n\n td.", " {\n background-color: ", ";\n\n // ED-15246: Trello card is visible through a border of a table border\n // This fixes a border issue caused by relative positioned table cells\n &::after {\n height: 100%;\n content: '';\n border-left: 1px solid ", ";\n border-bottom: 1px solid ", ";\n position: absolute;\n right: 0px;\n top: 0px;\n bottom: 0;\n width: 100%;\n display: inline-block;\n pointer-events: none;\n }\n }\n }\n\n .", " {\n ", "\n }\n\n .", " {\n ", "\n }\n\n /* Delete button */\n ", "\n /* Ends Delete button */\n\n /* sticky styles */\n .", " .", " .", ":first-of-type {\n margin-top: ", "px;\n width: ", "px;\n\n position: fixed !important;\n z-index: ", " !important;\n box-shadow: 0px -", "px ", ";\n border-right: 0 none;\n /* top set by NumberColumn component */\n }\n\n .", " .", ".sticky {\n position: fixed !important;\n /* needs to be above row controls */\n z-index: ", " !important;\n background: ", ";\n\n width: ", "px;\n height: ", "px;\n }\n\n .", ".sticky .", " {\n border-bottom: 0px none;\n border-right: 0px none;\n\n height: ", "px;\n width: ", "px;\n }\n\n .", " .", " {\n z-index: 0;\n }\n\n .", "\n .", "\n .", ".sticky {\n position: fixed !important;\n z-index: ", " !important;\n display: flex;\n border-left: ", "px solid\n ", ";\n margin-left: -", "px;\n }\n\n .", " col:first-of-type {\n /* moving rows out of a table layout does weird things in Chrome */\n border-right: 1px solid ", ";\n }\n\n tr.sticky {\n padding-top: ", "px;\n position: fixed;\n display: grid;\n\n /* to keep it above cell selection */\n z-index: ", ";\n\n overflow-y: visible;\n overflow-x: hidden;\n\n grid-auto-flow: column;\n\n /* background for where controls apply */\n background: ", ";\n box-sizing: content-box;\n\n margin-top: 2px;\n\n box-shadow: ", ";\n margin-left: -1px;\n\n &.no-pointer-events {\n pointer-events: none;\n }\n }\n\n .", " .", " {\n left: unset;\n position: fixed;\n z-index: ", ";\n }\n\n .", ".", "\n .", " {\n padding-bottom: ", "px;\n }\n\n tr.sticky th {\n border-bottom: ", "px solid\n ", ";\n margin-right: -1px;\n }\n\n .", " tr.sticky > th:last-child {\n border-right-width: 1px;\n }\n\n /* add left edge for first cell */\n .", " tr.sticky > th:first-of-type {\n margin-left: 0px;\n }\n\n /* add a little bit so the scroll lines up with the table */\n .", " tr.sticky::after {\n content: ' ';\n width: ", "px;\n }\n\n /* To fix jumpiness caused in Chrome Browsers for sticky headers */\n .", " .sticky + tr {\n min-height: 0px;\n }\n\n /* move resize line a little in sticky bar */\n .", ".", " {\n tr.sticky\n td.", ",\n tr.sticky\n th.", " {\n .", "::after {\n right: ", "px;\n }\n }\n\n /* when selected put it back to normal -- :not selector would be nicer */\n tr.sticky\n td.", ".", ",\n tr.sticky\n th.", ".", " {\n .", "::after {\n right: ", "px;\n }\n }\n }\n\n tr.sticky\n .", ",\n tr.sticky\n .", " {\n z-index: 1;\n }\n\n .", " tr.sticky {\n padding-top: ", "px;\n }\n\n .", ".", "\n .", "\n .", ":first-of-type {\n margin-top: ", "px;\n }\n\n .", ".sticky {\n border-top: ", "px solid\n ", ";\n }\n\n ", "\n ", "\n\n .", " .", " {\n height: 0; // stop overflow flash & set correct height in update-overflow-shadows.ts\n }\n\n .less-padding {\n padding: 0 ", "px;\n\n .", " {\n padding: 0 ", "px;\n\n // https://product-fabric.atlassian.net/browse/ED-16386\n // Fixes issue where the extra padding that is added here throws off the position\n // of the rows control dot\n &::after {\n right: 6px !important;\n }\n }\n\n &.", "[data-number-column='true'] {\n padding-left: ", "px;\n }\n\n .", " {\n left: 6px;\n }\n\n .", " {\n left: calc(100% - 6px);\n }\n }\n\n > .", " {\n /**\n * Prevent margins collapsing, aids with placing the gap-cursor correctly\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing\n *\n * TODO: Enable this, many tests will fail!\n * border-top: 1px solid transparent;\n */\n }\n\n /* Breakout only works on top level */\n > * .", " .", " {\n margin-left: unset !important;\n width: 100% !important;\n }\n\n ", ";\n\n /* Corner controls */\n .", " {\n width: ", "px;\n height: ", "px;\n display: none;\n\n .", " {\n position: relative;\n\n ", ";\n }\n }\n\n .", ".sticky {\n .", " {\n /* sticky row insert dot overlaps other row insert and messes things up */\n display: none !important;\n }\n }\n\n .", " {\n position: absolute;\n top: 0;\n width: ", "px;\n height: ", "px;\n border: 1px solid ", ";\n border-radius: 0;\n border-top-left-radius: ", "px;\n background: ", ";\n box-sizing: border-box;\n padding: 0;\n :focus {\n outline: none;\n }\n }\n .active .", " {\n border-color: ", ";\n background: ", ";\n }\n\n .", "[data-number-column='true'] {\n .", ", .", " {\n width: ", "px;\n }\n .", " .", " {\n border-right-width: 0;\n }\n }\n\n :not(.", ") .", ":hover {\n border-color: ", ";\n background: ", ";\n cursor: pointer;\n }\n\n :not(.", ")\n .", ".", " {\n border-color: ", ";\n background: ", ";\n }\n\n /* Row controls */\n .", " {\n width: ", "px;\n box-sizing: border-box;\n display: none;\n position: relative;\n\n ", ";\n\n .", " {\n display: flex;\n flex-direction: column;\n }\n .", ":last-child > button {\n border-bottom-left-radius: ", "px;\n }\n .", " {\n position: relative;\n margin-top: -1px;\n }\n .", ":hover,\n .", ".active,\n .", ":hover {\n z-index: ", ";\n }\n\n ", "\n }\n\n :not(.", ") .", " {\n ", "\n ", "\n }\n\n /* Numbered column */\n .", " {\n position: relative;\n float: right;\n margin-left: ", "px;\n top: ", "px;\n width: ", "px;\n box-sizing: border-box;\n }\n\n .", " {\n border: 1px solid ", ";\n box-sizing: border-box;\n margin-top: -1px;\n padding-bottom: 2px;\n padding: 10px 2px;\n text-align: center;\n font-size: ", ";\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n\n :first-child:not(style),\n style:first-child + * {\n margin-top: 0;\n }\n :last-child {\n border-bottom: 1px solid ", ";\n }\n }\n\n .", " {\n .", ", .", " {\n display: block;\n }\n .", " {\n padding-left: 1px;\n .", " {\n border-left: 0 none;\n }\n\n .", ".active {\n border-bottom: 1px solid ", ";\n border-color: ", ";\n background-color: ", ";\n position: relative;\n z-index: ", ";\n color: ", ";\n }\n }\n }\n :not(.", ") .", " {\n .", " {\n cursor: pointer;\n }\n .", ":hover {\n border-bottom: 1px solid ", ";\n border-color: ", ";\n background-color: ", ";\n position: relative;\n z-index: ", ";\n color: ", ";\n }\n .", ".", " {\n background-color: ", ";\n border: 1px solid ", ";\n border-left: 0;\n color: ", ";\n position: relative;\n z-index: ", ";\n }\n }\n\n /* Table */\n .", " > table {\n table-layout: fixed;\n white-space: normal;\n border-top: none;\n // 1px border width offset added here to prevent unwanted overflow and scolling - ED-16212\n margin-right: -1px;\n\n > tbody > tr {\n white-space: pre-wrap;\n }\n\n .", " + * {\n margin-top: 0;\n }\n\n /*\n * Headings have a top margin by default, but we don't want this on the\n * first heading within table header cells.\n *\n * This specifically sets margin-top for the first heading within a header\n * cell when center/right aligned.\n */\n th.", " > .fabric-editor-block-mark {\n > h1:first-of-type,\n > h2:first-of-type,\n > h3:first-of-type,\n > h4:first-of-type,\n > h5:first-of-type,\n > h6:first-of-type {\n margin-top: 0;\n }\n }\n\n .", ", .", " {\n position: relative;\n }\n /* Give selected cells a blue overlay */\n .", "::after,\n .", "::after {\n z-index: ", ";\n position: absolute;\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n pointer-events: none;\n }\n .", " {\n border: 1px solid ", ";\n }\n .", "::after {\n background: ", ";\n z-index: ", ";\n }\n th.", "::after,\n td.", "::after {\n background: ", ";\n z-index: ", ";\n }\n // ED-15246: Trello card is visible through a border of a table border\n td.", ", td.", " {\n &::after {\n height: 100%;\n width: 100%;\n border: 1px solid ", ";\n content: '';\n position: absolute;\n left: -1px;\n top: -1px;\n bottom: 0;\n z-index: ", ";\n display: inline-block;\n pointer-events: none;\n }\n &.", "::after {\n border: 1px solid ", ";\n z-index: ", ";\n }\n }\n }\n .", " {\n position: absolute;\n /* top of corner control is table margin top - corner control height + 1 pixel of table border. */\n top: ", "px;\n }\n .", ".", " {\n z-index: ", ";\n }\n .", " {\n left: -", "px;\n }\n .", " {\n padding-right: ", "px;\n margin-right: -", "px;\n padding-bottom: 0px;\n /* fixes gap cursor height */\n overflow: auto;\n position: relative;\n }\n }\n\n .ProseMirror.", " {\n .", " {\n overflow-x: auto;\n ", ";\n }\n }\n\n .ProseMirror.", " {\n cursor: col-resize;\n }\n\n /*\n ED-15882: When custom start numbers is enabled for lists, we have\n styles that handle this generally (in editor-common) so we can\n throw away the older table-specific styles here.\n */\n ", "\n"])), _types.TableCssClassName.LAYOUT_BUTTON, "var(--ds-background-neutral, ".concat(_colors.N20A, ")"), "var(--ds-icon, ".concat(_colors.N300, ")"), _types.TableCssClassName.LAYOUT_BUTTON, _types.TableCssClassName.IS_RESIZING, "var(--ds-background-neutral-hovered, ".concat(_colors.B300, ")"), "var(--ds-icon, white)", (0, _styles.tableSharedStyle)(props), (0, _uiStyles.columnControlsLineMarker)(props), _uiStyles.hoveredDeleteButton, _uiStyles.hoveredCell, _uiStyles.hoveredWarningCell, _uiStyles.resizeHandle, rangeSelectionStyles, _types.TableCssClassName.LAST_ITEM_IN_CELL, _types.TableCssClassName.TABLE_NODE_WRAPPER, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.TABLE_CELL, (0, _consts.tableCellBackgroundColor)(props), (0, _consts.tableBorderColor)(props), (0, _consts.tableBorderColor)(props), _types.TableCssClassName.CONTROLS_FLOATING_BUTTON_COLUMN, _uiStyles.insertColumnButtonWrapper, _types.TableCssClassName.CONTROLS_FLOATING_BUTTON_ROW, _uiStyles.insertRowButtonWrapper, _uiStyles.DeleteButton, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.NUMBERED_COLUMN, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _consts.stickyRowOffsetTop + 2, _editorSharedStyles.akEditorTableNumberColumnWidth, _editorSharedStyles.akEditorStickyHeaderZIndex, _consts.stickyRowOffsetTop, "var(--ds-surface, white)", _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.CORNER_CONTROLS, _editorSharedStyles.akEditorSmallZIndex, "var(--ds-surface, white)", _consts.tableToolbarSize, _consts.tableToolbarSize, _types.TableCssClassName.CORNER_CONTROLS, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _consts.tableToolbarSize, _consts.tableToolbarSize, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.ROW_CONTROLS, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _editorSharedStyles.akEditorStickyHeaderZIndex, _consts.tableToolbarSize, "var(--ds-surface, white)", _consts.tableToolbarSize, _types.TableCssClassName.TABLE_STICKY, "var(--ds-surface, green)", _consts.stickyRowOffsetTop, _consts.stickyRowZIndex, "var(--ds-surface, white)", "var(--ds-shadow-overflow, ".concat("0 6px 4px -4px ".concat(_colors.N40A), ")"), _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY_SHADOW, _consts.stickyRowZIndex + 1, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY_SHADOW, _consts.tableToolbarSize, _consts.stickyHeaderBorderBottomWidth, (0, _consts.tableBorderColor)(props), _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY, insertColumnButtonOffset + 1, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, (_consts.resizeHandlerAreaWidth - _consts.resizeLineWidth) / 2 + 1, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, (_consts.resizeHandlerAreaWidth - _consts.resizeLineWidth) / 2, _types.TableCssClassName.HOVERED_CELL, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.WITH_CONTROLS, _consts.tableControlsSpacing, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.NUMBERED_COLUMN, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _consts.tableControlsSpacing + 2, _types.TableCssClassName.CORNER_CONTROLS, _consts.tableControlsSpacing - _consts.tableToolbarSize + 2, "var(--ds-surface, white)", (_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.stickyHeadersOptimization ? sentinelStyles : '', (0, _uiStyles.OverflowShadow)(props), _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY_SHADOW, _consts.tablePadding, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, _consts.tablePadding, _types.TableCssClassName.TABLE_CONTAINER, _editorSharedStyles.akEditorTableNumberColumnWidth + _consts.tablePadding - 1, _types.TableCssClassName.TABLE_LEFT_SHADOW, _types.TableCssClassName.TABLE_RIGHT_SHADOW, _types.TableCssClassName.NODEVIEW_WRAPPER, _types.TableCssClassName.NODEVIEW_WRAPPER, _types.TableCssClassName.TABLE_CONTAINER, (0, _uiStyles.columnControlsDecoration)(props), _types.TableCssClassName.CORNER_CONTROLS, _consts.tableToolbarSize + 1, cornerControlHeight, _types.TableCssClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, (0, _uiStyles.InsertMarker)(props, "\n left: -11px;\n top: 9px;\n "), _types.TableCssClassName.CORNER_CONTROLS, _types.TableCssClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _consts.tableToolbarSize + 1, _consts.tableToolbarSize + 1, (0, _consts.tableBorderColor)(props), _consts.tableBorderRadiusSize, (0, _consts.tableToolbarColor)(props), _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _consts.tableBorderSelectedColor, "var(--ds-background-selected, ".concat(_consts.tableToolbarSelectedColor, ")"), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.CORNER_CONTROLS, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _editorSharedStyles.akEditorTableToolbarSize + _editorSharedStyles.akEditorTableNumberColumnWidth, _types.TableCssClassName.ROW_CONTROLS, _types.TableCssClassName.CONTROLS_BUTTON, _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _consts.tableBorderSelectedColor, "var(--ds-background-selected, ".concat(_consts.tableToolbarSelectedColor, ")"), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _consts.tableBorderDeleteColor, "var(--ds-background-danger, ".concat(_consts.tableToolbarDeleteColor, ")"), _types.TableCssClassName.ROW_CONTROLS, _consts.tableToolbarSize, (0, _uiStyles.InsertMarker)(props, "\n bottom: -1px;\n left: -11px;\n "), _types.TableCssClassName.ROW_CONTROLS_INNER, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _consts.tableBorderRadiusSize, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _types.TableCssClassName.CONTROLS_BUTTON, _editorSharedStyles.akEditorUnitZIndex, (0, _uiStyles.HeaderButton)(props, "\n border-bottom: 1px solid ".concat((0, _consts.tableBorderColor)(props), ";\n border-right: 0px;\n border-radius: 0;\n height: 100%;\n width: ").concat(_consts.tableToolbarSize, "px;\n\n .").concat(_types.TableCssClassName.CONTROLS_BUTTON_OVERLAY, " {\n position: absolute;\n width: 30px;\n height: 50%;\n right: 0;\n bottom: 0;\n }\n .").concat(_types.TableCssClassName.CONTROLS_BUTTON_OVERLAY, ":first-of-type {\n top: 0;\n }\n ")), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.ROW_CONTROLS, (0, _uiStyles.HeaderButtonHover)(), (0, _uiStyles.HeaderButtonDanger)(), _types.TableCssClassName.NUMBERED_COLUMN, _editorSharedStyles.akEditorTableToolbarSize - 1, _editorSharedStyles.akEditorTableToolbarSize, _editorSharedStyles.akEditorTableNumberColumnWidth + 1, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, (0, _consts.tableBorderColor)(props), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), (0, _consts.tableToolbarColor)(props), (0, _consts.tableTextColor)(props), (0, _consts.tableBorderColor)(props), (0, _consts.tableBorderColor)(props), _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.CORNER_CONTROLS, _types.TableCssClassName.ROW_CONTROLS, _types.TableCssClassName.NUMBERED_COLUMN, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _consts.tableBorderSelectedColor, _consts.tableBorderSelectedColor, "var(--ds-background-selected, ".concat(_consts.tableToolbarSelectedColor, ")"), _editorSharedStyles.akEditorUnitZIndex, "var(--ds-text-selected, ".concat(_colors.N0, ")"), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _consts.tableBorderSelectedColor, _consts.tableBorderSelectedColor, "var(--ds-background-selected, ".concat(_consts.tableToolbarSelectedColor, ")"), _editorSharedStyles.akEditorUnitZIndex, "var(--ds-text-selected, ".concat(_colors.N0, ")"), _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, "var(--ds-background-danger, ".concat(_consts.tableToolbarDeleteColor, ")"), _consts.tableBorderDeleteColor, "var(--ds-text-danger, ".concat(_colors.R500, ")"), _editorSharedStyles.akEditorUnitZIndex, _types.TableCssClassName.TABLE_NODE_WRAPPER, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _editorSharedStyles.akEditorSmallZIndex, _types.TableCssClassName.SELECTED_CELL, _consts.tableBorderSelectedColor, _types.TableCssClassName.SELECTED_CELL, _consts.tableCellSelectedColor, _editorSharedStyles.akEditorSmallZIndex, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _consts.tableCellDeleteColor, _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.HOVERED_CELL, _types.TableCssClassName.SELECTED_CELL, _consts.tableBorderSelectedColor, _editorSharedStyles.akEditorSmallZIndex, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _consts.tableBorderDeleteColor, _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, _styles.tableMarginTop - cornerControlHeight + 1, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, _types.TableCssClassName.TABLE_LEFT_SHADOW, _editorSharedStyles.akEditorUnitZIndex, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, _consts.tableToolbarSize, _types.TableCssClassName.TABLE_NODE_WRAPPER, insertColumnButtonOffset, insertColumnButtonOffset, _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.TABLE_NODE_WRAPPER, _scrollbar.scrollbarStyles, _types.TableCssClassName.RESIZE_CURSOR, props !== null && props !== void 0 && (_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.restartNumberedLists ? "" : listLargeNumericMarkersOldStyles);
|
|
38
|
+
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " button {\n background: ", ";\n color: ", ";\n cursor: none;\n }\n\n .", ":not(.", ") button:hover {\n background: ", ";\n color: ", " !important;\n cursor: pointer;\n }\n\n .ProseMirror {\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n\n .", " {\n margin-bottom: 0;\n }\n\n .", " {\n td.", ", th.", " {\n position: relative;\n overflow: visible;\n }\n\n td.", " {\n background-color: ", ";\n\n // ED-15246: Trello card is visible through a border of a table border\n // This fixes a border issue caused by relative positioned table cells\n &::after {\n height: 100%;\n content: '';\n border-left: 1px solid ", ";\n border-bottom: 1px solid ", ";\n position: absolute;\n right: 0px;\n top: 0px;\n bottom: 0;\n width: 100%;\n display: inline-block;\n pointer-events: none;\n }\n }\n }\n\n .", " {\n ", "\n }\n\n .", " {\n ", "\n }\n\n /* Delete button */\n ", "\n /* Ends Delete button */\n\n /* sticky styles */\n .", " .", " .", ":first-of-type {\n margin-top: ", "px;\n width: ", "px;\n\n position: fixed !important;\n z-index: ", " !important;\n box-shadow: 0px -", "px ", ";\n border-right: 0 none;\n /* top set by NumberColumn component */\n }\n\n .", " .", ".sticky {\n position: fixed !important;\n /* needs to be above row controls */\n z-index: ", " !important;\n background: ", ";\n\n width: ", "px;\n height: ", "px;\n }\n\n .", ".sticky .", " {\n border-bottom: 0px none;\n border-right: 0px none;\n\n height: ", "px;\n width: ", "px;\n }\n\n .", " .", " {\n z-index: 0;\n }\n\n .", "\n .", "\n .", ".sticky {\n position: fixed !important;\n z-index: ", " !important;\n display: flex;\n border-left: ", "px solid\n ", ";\n margin-left: -", "px;\n }\n\n .", " col:first-of-type {\n /* moving rows out of a table layout does weird things in Chrome */\n border-right: 1px solid ", ";\n }\n\n tr.sticky {\n padding-top: ", "px;\n position: fixed;\n display: grid;\n\n /* to keep it above cell selection */\n z-index: ", ";\n\n overflow-y: visible;\n overflow-x: hidden;\n\n grid-auto-flow: column;\n\n /* background for where controls apply */\n background: ", ";\n box-sizing: content-box;\n\n margin-top: 2px;\n\n box-shadow: ", ";\n margin-left: -1px;\n\n &.no-pointer-events {\n pointer-events: none;\n }\n }\n\n .", " .", " {\n left: unset;\n position: fixed;\n z-index: ", ";\n }\n\n .", ".", "\n .", " {\n padding-bottom: ", "px;\n }\n\n tr.sticky th {\n border-bottom: ", "px solid\n ", ";\n margin-right: -1px;\n }\n\n .", " tr.sticky > th:last-child {\n border-right-width: 1px;\n }\n\n /* add left edge for first cell */\n .", " tr.sticky > th:first-of-type {\n margin-left: 0px;\n }\n\n /* add a little bit so the scroll lines up with the table */\n .", " tr.sticky::after {\n content: ' ';\n width: ", "px;\n }\n\n /* To fix jumpiness caused in Chrome Browsers for sticky headers */\n .", " .sticky + tr {\n min-height: 0px;\n }\n\n /* move resize line a little in sticky bar */\n .", ".", " {\n tr.sticky\n td.", ",\n tr.sticky\n th.", " {\n .", "::after {\n right: ", "px;\n }\n }\n\n /* when selected put it back to normal -- :not selector would be nicer */\n tr.sticky\n td.", ".", ",\n tr.sticky\n th.", ".", " {\n .", "::after {\n right: ", "px;\n }\n }\n }\n\n tr.sticky\n .", ",\n tr.sticky\n .", " {\n z-index: 1;\n }\n\n .", " tr.sticky {\n padding-top: ", "px;\n }\n\n .", ".", "\n .", "\n .", ":first-of-type {\n margin-top: ", "px;\n }\n\n .", ".sticky {\n border-top: ", "px solid\n ", ";\n }\n\n ", "\n ", "\n\n .", " .", " {\n height: 0; // stop overflow flash & set correct height in update-overflow-shadows.ts\n }\n\n .less-padding {\n padding: 0 ", "px;\n\n .", " {\n padding: 0 ", "px;\n\n // https://product-fabric.atlassian.net/browse/ED-16386\n // Fixes issue where the extra padding that is added here throws off the position\n // of the rows control dot\n &::after {\n right: 6px !important;\n }\n }\n\n &.", "[data-number-column='true'] {\n padding-left: ", "px;\n }\n\n .", " {\n left: 6px;\n }\n\n .", " {\n left: calc(100% - 6px);\n }\n }\n\n > .", " {\n /**\n * Prevent margins collapsing, aids with placing the gap-cursor correctly\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing\n *\n * TODO: Enable this, many tests will fail!\n * border-top: 1px solid transparent;\n */\n }\n\n /* Breakout only works on top level */\n > * .", " .", " {\n margin-left: unset !important;\n width: 100% !important;\n }\n\n ", ";\n\n /* Corner controls */\n .", " {\n width: ", "px;\n height: ", "px;\n display: none;\n\n .", " {\n position: relative;\n\n ", ";\n }\n }\n\n .", ".sticky {\n .", " {\n /* sticky row insert dot overlaps other row insert and messes things up */\n display: none !important;\n }\n }\n\n .", " {\n position: absolute;\n top: 0;\n width: ", "px;\n height: ", "px;\n border: 1px solid ", ";\n border-radius: 0;\n border-top-left-radius: ", "px;\n background: ", ";\n box-sizing: border-box;\n padding: 0;\n :focus {\n outline: none;\n }\n }\n .active .", " {\n border-color: ", ";\n background: ", ";\n }\n\n .", "[data-number-column='true'] {\n .", ", .", " {\n width: ", "px;\n }\n .", " .", " {\n border-right-width: 0;\n }\n }\n\n :not(.", ") .", ":hover {\n border-color: ", ";\n background: ", ";\n cursor: pointer;\n }\n\n :not(.", ")\n .", ".", " {\n border-color: ", ";\n background: ", ";\n }\n\n /* Row controls */\n .", " {\n width: ", "px;\n box-sizing: border-box;\n display: none;\n position: relative;\n\n ", ";\n\n .", " {\n display: flex;\n flex-direction: column;\n }\n .", ":last-child > button {\n border-bottom-left-radius: ", "px;\n }\n .", " {\n position: relative;\n margin-top: -1px;\n }\n .", ":hover,\n .", ".active,\n .", ":hover {\n z-index: ", ";\n }\n\n ", "\n }\n\n :not(.", ") .", " {\n ", "\n ", "\n }\n\n /* Numbered column */\n .", " {\n position: relative;\n float: right;\n margin-left: ", "px;\n top: ", "px;\n width: ", "px;\n box-sizing: border-box;\n }\n\n .", " {\n border: 1px solid ", ";\n box-sizing: border-box;\n margin-top: -1px;\n padding-bottom: 2px;\n padding: 10px 2px;\n text-align: center;\n font-size: ", ";\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n\n :first-child:not(style),\n style:first-child + * {\n margin-top: 0;\n }\n :last-child {\n border-bottom: 1px solid ", ";\n }\n }\n\n .", " {\n .", ", .", " {\n display: block;\n }\n .", " {\n padding-left: 1px;\n .", " {\n border-left: 0 none;\n }\n\n .", ".active {\n border-bottom: 1px solid ", ";\n border-color: ", ";\n background-color: ", ";\n position: relative;\n z-index: ", ";\n color: ", ";\n }\n }\n }\n :not(.", ") .", " {\n .", " {\n cursor: pointer;\n }\n .", ":hover {\n border-bottom: 1px solid ", ";\n border-color: ", ";\n background-color: ", ";\n position: relative;\n z-index: ", ";\n color: ", ";\n }\n .", ".", " {\n background-color: ", ";\n border: 1px solid ", ";\n border-left: 0;\n color: ", ";\n position: relative;\n z-index: ", ";\n }\n }\n\n /* Table */\n .", " > table {\n table-layout: fixed;\n white-space: normal;\n border-top: none;\n // 1px border width offset added here to prevent unwanted overflow and scolling - ED-16212\n margin-right: -1px;\n\n > tbody > tr {\n white-space: pre-wrap;\n }\n\n .", " + * {\n margin-top: 0;\n }\n\n /*\n * Headings have a top margin by default, but we don't want this on the\n * first heading within table header cells.\n *\n * This specifically sets margin-top for the first heading within a header\n * cell when center/right aligned.\n */\n th.", " > .fabric-editor-block-mark {\n > h1:first-of-type,\n > h2:first-of-type,\n > h3:first-of-type,\n > h4:first-of-type,\n > h5:first-of-type,\n > h6:first-of-type {\n margin-top: 0;\n }\n }\n\n .", ", .", " {\n position: relative;\n }\n /* Give selected cells a blue overlay */\n .", "::after,\n .", "::after {\n z-index: ", ";\n position: absolute;\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n pointer-events: none;\n }\n .", " {\n border: 1px solid ", ";\n }\n .", "::after {\n background: ", ";\n z-index: ", ";\n }\n th.", "::after,\n td.", "::after {\n background: ", ";\n z-index: ", ";\n }\n // ED-15246: Trello card is visible through a border of a table border\n td.", ", td.", " {\n &::after {\n height: 100%;\n width: 100%;\n border: 1px solid ", ";\n content: '';\n position: absolute;\n left: -1px;\n top: -1px;\n bottom: 0;\n z-index: ", ";\n display: inline-block;\n pointer-events: none;\n }\n &.", "::after {\n border: 1px solid ", ";\n z-index: ", ";\n }\n }\n }\n .", " {\n position: absolute;\n /* top of corner control is table margin top - corner control height + 1 pixel of table border. */\n top: ", "px;\n }\n .", ".", " {\n z-index: ", ";\n }\n .", " {\n left: -", "px;\n }\n .", " {\n padding-right: ", "px;\n margin-right: -", "px;\n padding-bottom: 0px;\n /* fixes gap cursor height */\n overflow: auto;\n overflow-y: hidden;\n position: relative;\n }\n }\n\n .ProseMirror.", " {\n .", " {\n overflow-x: auto;\n ", ";\n }\n }\n\n .ProseMirror.", " {\n cursor: col-resize;\n }\n\n /*\n ED-15882: When custom start numbers is enabled for lists, we have\n styles that handle this generally (in editor-common) so we can\n throw away the older table-specific styles here.\n */\n ", "\n"])), _types.TableCssClassName.LAYOUT_BUTTON, "var(--ds-background-neutral, ".concat(_colors.N20A, ")"), "var(--ds-icon, ".concat(_colors.N300, ")"), _types.TableCssClassName.LAYOUT_BUTTON, _types.TableCssClassName.IS_RESIZING, "var(--ds-background-neutral-hovered, ".concat(_colors.B300, ")"), "var(--ds-icon, white)", (0, _styles.tableSharedStyle)(props), (0, _uiStyles.columnControlsLineMarker)(props), _uiStyles.hoveredDeleteButton, _uiStyles.hoveredCell, _uiStyles.hoveredWarningCell, _uiStyles.resizeHandle, rangeSelectionStyles, _types.TableCssClassName.LAST_ITEM_IN_CELL, _types.TableCssClassName.TABLE_NODE_WRAPPER, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.TABLE_CELL, (0, _consts.tableCellBackgroundColor)(props), (0, _consts.tableBorderColor)(props), (0, _consts.tableBorderColor)(props), _types.TableCssClassName.CONTROLS_FLOATING_BUTTON_COLUMN, _uiStyles.insertColumnButtonWrapper, _types.TableCssClassName.CONTROLS_FLOATING_BUTTON_ROW, _uiStyles.insertRowButtonWrapper, _uiStyles.DeleteButton, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.NUMBERED_COLUMN, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _consts.stickyRowOffsetTop + 2, _editorSharedStyles.akEditorTableNumberColumnWidth, _editorSharedStyles.akEditorStickyHeaderZIndex, _consts.stickyRowOffsetTop, "var(--ds-surface, white)", _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.CORNER_CONTROLS, _editorSharedStyles.akEditorSmallZIndex, "var(--ds-surface, white)", _consts.tableToolbarSize, _consts.tableToolbarSize, _types.TableCssClassName.CORNER_CONTROLS, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _consts.tableToolbarSize, _consts.tableToolbarSize, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.ROW_CONTROLS, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _editorSharedStyles.akEditorStickyHeaderZIndex, _consts.tableToolbarSize, "var(--ds-surface, white)", _consts.tableToolbarSize, _types.TableCssClassName.TABLE_STICKY, "var(--ds-surface, green)", _consts.stickyRowOffsetTop, _consts.stickyRowZIndex, "var(--ds-surface, white)", "var(--ds-shadow-overflow, ".concat("0 6px 4px -4px ".concat(_colors.N40A), ")"), _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY_SHADOW, _consts.stickyRowZIndex + 1, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY_SHADOW, _consts.tableToolbarSize, _consts.stickyHeaderBorderBottomWidth, (0, _consts.tableBorderColor)(props), _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY, insertColumnButtonOffset + 1, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, (_consts.resizeHandlerAreaWidth - _consts.resizeLineWidth) / 2 + 1, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, (_consts.resizeHandlerAreaWidth - _consts.resizeLineWidth) / 2, _types.TableCssClassName.HOVERED_CELL, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.WITH_CONTROLS, _consts.tableControlsSpacing, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.NUMBERED_COLUMN, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _consts.tableControlsSpacing + 2, _types.TableCssClassName.CORNER_CONTROLS, _consts.tableControlsSpacing - _consts.tableToolbarSize + 2, "var(--ds-surface, white)", (_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.stickyHeadersOptimization ? sentinelStyles : '', (0, _uiStyles.OverflowShadow)(props), _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY_SHADOW, _consts.tablePadding, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, _consts.tablePadding, _types.TableCssClassName.TABLE_CONTAINER, _editorSharedStyles.akEditorTableNumberColumnWidth + _consts.tablePadding - 1, _types.TableCssClassName.TABLE_LEFT_SHADOW, _types.TableCssClassName.TABLE_RIGHT_SHADOW, _types.TableCssClassName.NODEVIEW_WRAPPER, _types.TableCssClassName.NODEVIEW_WRAPPER, _types.TableCssClassName.TABLE_CONTAINER, (0, _uiStyles.columnControlsDecoration)(props), _types.TableCssClassName.CORNER_CONTROLS, _consts.tableToolbarSize + 1, cornerControlHeight, _types.TableCssClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, (0, _uiStyles.InsertMarker)(props, "\n left: -11px;\n top: 9px;\n "), _types.TableCssClassName.CORNER_CONTROLS, _types.TableCssClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _consts.tableToolbarSize + 1, _consts.tableToolbarSize + 1, (0, _consts.tableBorderColor)(props), _consts.tableBorderRadiusSize, (0, _consts.tableToolbarColor)(props), _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _consts.tableBorderSelectedColor, "var(--ds-background-selected, ".concat(_consts.tableToolbarSelectedColor, ")"), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.CORNER_CONTROLS, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _editorSharedStyles.akEditorTableToolbarSize + _editorSharedStyles.akEditorTableNumberColumnWidth, _types.TableCssClassName.ROW_CONTROLS, _types.TableCssClassName.CONTROLS_BUTTON, _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _consts.tableBorderSelectedColor, "var(--ds-background-selected, ".concat(_consts.tableToolbarSelectedColor, ")"), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _consts.tableBorderDeleteColor, "var(--ds-background-danger, ".concat(_consts.tableToolbarDeleteColor, ")"), _types.TableCssClassName.ROW_CONTROLS, _consts.tableToolbarSize, (0, _uiStyles.InsertMarker)(props, "\n bottom: -1px;\n left: -11px;\n "), _types.TableCssClassName.ROW_CONTROLS_INNER, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _consts.tableBorderRadiusSize, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _types.TableCssClassName.CONTROLS_BUTTON, _editorSharedStyles.akEditorUnitZIndex, (0, _uiStyles.HeaderButton)(props, "\n border-bottom: 1px solid ".concat((0, _consts.tableBorderColor)(props), ";\n border-right: 0px;\n border-radius: 0;\n height: 100%;\n width: ").concat(_consts.tableToolbarSize, "px;\n\n .").concat(_types.TableCssClassName.CONTROLS_BUTTON_OVERLAY, " {\n position: absolute;\n width: 30px;\n height: 50%;\n right: 0;\n bottom: 0;\n }\n .").concat(_types.TableCssClassName.CONTROLS_BUTTON_OVERLAY, ":first-of-type {\n top: 0;\n }\n ")), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.ROW_CONTROLS, (0, _uiStyles.HeaderButtonHover)(), (0, _uiStyles.HeaderButtonDanger)(), _types.TableCssClassName.NUMBERED_COLUMN, _editorSharedStyles.akEditorTableToolbarSize - 1, _editorSharedStyles.akEditorTableToolbarSize, _editorSharedStyles.akEditorTableNumberColumnWidth + 1, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, (0, _consts.tableBorderColor)(props), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), (0, _consts.tableToolbarColor)(props), (0, _consts.tableTextColor)(props), (0, _consts.tableBorderColor)(props), (0, _consts.tableBorderColor)(props), _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.CORNER_CONTROLS, _types.TableCssClassName.ROW_CONTROLS, _types.TableCssClassName.NUMBERED_COLUMN, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _consts.tableBorderSelectedColor, _consts.tableBorderSelectedColor, "var(--ds-background-selected, ".concat(_consts.tableToolbarSelectedColor, ")"), _editorSharedStyles.akEditorUnitZIndex, "var(--ds-text-selected, ".concat(_colors.N0, ")"), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _consts.tableBorderSelectedColor, _consts.tableBorderSelectedColor, "var(--ds-background-selected, ".concat(_consts.tableToolbarSelectedColor, ")"), _editorSharedStyles.akEditorUnitZIndex, "var(--ds-text-selected, ".concat(_colors.N0, ")"), _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, "var(--ds-background-danger, ".concat(_consts.tableToolbarDeleteColor, ")"), _consts.tableBorderDeleteColor, "var(--ds-text-danger, ".concat(_colors.R500, ")"), _editorSharedStyles.akEditorUnitZIndex, _types.TableCssClassName.TABLE_NODE_WRAPPER, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _editorSharedStyles.akEditorSmallZIndex, _types.TableCssClassName.SELECTED_CELL, _consts.tableBorderSelectedColor, _types.TableCssClassName.SELECTED_CELL, _consts.tableCellSelectedColor, _editorSharedStyles.akEditorSmallZIndex, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _consts.tableCellDeleteColor, _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.HOVERED_CELL, _types.TableCssClassName.SELECTED_CELL, _consts.tableBorderSelectedColor, _editorSharedStyles.akEditorSmallZIndex, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _consts.tableBorderDeleteColor, _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, _styles.tableMarginTop - cornerControlHeight + 1, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, _types.TableCssClassName.TABLE_LEFT_SHADOW, _editorSharedStyles.akEditorUnitZIndex, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, _consts.tableToolbarSize, _types.TableCssClassName.TABLE_NODE_WRAPPER, insertColumnButtonOffset, insertColumnButtonOffset, _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.TABLE_NODE_WRAPPER, _scrollbar.scrollbarStyles, _types.TableCssClassName.RESIZE_CURSOR, props !== null && props !== void 0 && (_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.restartNumberedLists ? "" : listLargeNumericMarkersOldStyles);
|
|
39
39
|
};
|
|
40
40
|
exports.tableStyles = tableStyles;
|
|
41
41
|
var tableFullPageEditorStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror .", " > table {\n margin-left: 0;\n // 1px border width offset added here to prevent unwanted overflow and scolling - ED-16212\n margin-right: -1px;\n width: 100%;\n }\n"])), _types.TableCssClassName.TABLE_NODE_WRAPPER);
|
package/dist/cjs/version.json
CHANGED
|
@@ -269,7 +269,8 @@ const tablesPlugin = options => {
|
|
|
269
269
|
isOpen: Boolean(isContextualMenuOpen),
|
|
270
270
|
pluginConfig: pluginConfig,
|
|
271
271
|
editorAnalyticsAPI: options === null || options === void 0 ? void 0 : options.editorAnalyticsAPI,
|
|
272
|
-
getEditorContainerWidth: defaultGetEditorContainerWidth
|
|
272
|
+
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
273
|
+
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
|
|
273
274
|
}), allowControls && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
274
275
|
editorView: editorView,
|
|
275
276
|
selection: editorView.state.selection,
|
|
@@ -21,7 +21,6 @@ import { containsHeaderRow, tablesHaveDifferentColumnWidths, tablesHaveDifferent
|
|
|
21
21
|
import { updateOverflowShadows } from './update-overflow-shadows';
|
|
22
22
|
import memoizeOne from 'memoize-one';
|
|
23
23
|
import { OverflowShadowsObserver } from './OverflowShadowsObserver';
|
|
24
|
-
import { getParentWidthWithoutPadding } from '../pm-plugins/table-resizing/utils/misc';
|
|
25
24
|
const isIE11 = browser.ie_version === 11;
|
|
26
25
|
const NOOP = () => undefined;
|
|
27
26
|
class TableComponent extends React.Component {
|
|
@@ -255,7 +254,7 @@ class TableComponent extends React.Component {
|
|
|
255
254
|
return;
|
|
256
255
|
}
|
|
257
256
|
const parentNodeWith = getParentNodeWidth(pos, state, containerWidth, options && options.isFullWidthModeEnabled);
|
|
258
|
-
return
|
|
257
|
+
return parentNodeWith;
|
|
259
258
|
});
|
|
260
259
|
_defineProperty(this, "updateParentWidth", width => {
|
|
261
260
|
this.setState({
|
|
@@ -172,7 +172,7 @@ export class TableRowNodeView {
|
|
|
172
172
|
syncStickyRowToTable(tree.table);
|
|
173
173
|
}, 0);
|
|
174
174
|
});
|
|
175
|
-
_defineProperty(this, "
|
|
175
|
+
_defineProperty(this, "updateStickyHeaderWidth", () => {
|
|
176
176
|
// table width might have changed, sync that back to sticky row
|
|
177
177
|
const tree = this.tree;
|
|
178
178
|
if (!tree) {
|
|
@@ -206,7 +206,7 @@ export class TableRowNodeView {
|
|
|
206
206
|
// otherwise make it non-sticky
|
|
207
207
|
return false;
|
|
208
208
|
});
|
|
209
|
-
_defineProperty(this, "makeHeaderRowSticky", tree => {
|
|
209
|
+
_defineProperty(this, "makeHeaderRowSticky", (tree, scrollTop) => {
|
|
210
210
|
var _tbody$firstChild;
|
|
211
211
|
// If header row height is more than 50% of viewport height don't do this
|
|
212
212
|
if (this.stickyRowHeight && this.stickyRowHeight > window.innerHeight / 2) {
|
|
@@ -223,7 +223,10 @@ export class TableRowNodeView {
|
|
|
223
223
|
return;
|
|
224
224
|
}
|
|
225
225
|
const currentTableTop = this.getCurrentTableTop(tree);
|
|
226
|
-
|
|
226
|
+
if (!scrollTop) {
|
|
227
|
+
scrollTop = getTop(this.editorScrollableElement);
|
|
228
|
+
}
|
|
229
|
+
const domTop = currentTableTop > 0 ? scrollTop : scrollTop + currentTableTop;
|
|
227
230
|
if (!this.isSticky) {
|
|
228
231
|
syncStickyRowToTable(table);
|
|
229
232
|
this.dom.classList.add('sticky');
|
|
@@ -315,7 +318,7 @@ export class TableRowNodeView {
|
|
|
315
318
|
}
|
|
316
319
|
this.topPosEditorElement = getTop(this.editorScrollableElement);
|
|
317
320
|
}
|
|
318
|
-
this.eventDispatcher.on('widthPlugin', this.
|
|
321
|
+
this.eventDispatcher.on('widthPlugin', this.updateStickyHeaderWidth);
|
|
319
322
|
this.eventDispatcher.on(tablePluginKey.key, this.onTablePluginState);
|
|
320
323
|
this.listening = true;
|
|
321
324
|
this.dom.addEventListener('wheel', this.headerRowMouseScroll.bind(this));
|
|
@@ -341,7 +344,7 @@ export class TableRowNodeView {
|
|
|
341
344
|
if (this.editorScrollableElement && !this.stickyHeadersOptimization) {
|
|
342
345
|
this.editorScrollableElement.removeEventListener('scroll', this.onScroll);
|
|
343
346
|
}
|
|
344
|
-
this.eventDispatcher.off('widthPlugin', this.
|
|
347
|
+
this.eventDispatcher.off('widthPlugin', this.updateStickyHeaderWidth);
|
|
345
348
|
this.eventDispatcher.off(tablePluginKey.key, this.onTablePluginState);
|
|
346
349
|
this.listening = false;
|
|
347
350
|
this.dom.removeEventListener('wheel', this.headerRowMouseScroll);
|
|
@@ -360,6 +363,9 @@ export class TableRowNodeView {
|
|
|
360
363
|
return;
|
|
361
364
|
}
|
|
362
365
|
this.resizeObserver.observe(this.dom);
|
|
366
|
+
if (this.editorScrollableElement) {
|
|
367
|
+
this.resizeObserver.observe(this.editorScrollableElement);
|
|
368
|
+
}
|
|
363
369
|
window.requestAnimationFrame(() => {
|
|
364
370
|
var _this$tree;
|
|
365
371
|
// we expect tree to be defined after animation frame
|
|
@@ -389,14 +395,21 @@ export class TableRowNodeView {
|
|
|
389
395
|
table
|
|
390
396
|
} = this.tree;
|
|
391
397
|
entries.forEach(entry => {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
//
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
398
|
+
var _this$editorScrollabl;
|
|
399
|
+
// On resize of the parent scroll element we need to adjust the width
|
|
400
|
+
// of the sticky header
|
|
401
|
+
if (entry.target.className === ((_this$editorScrollabl = this.editorScrollableElement) === null || _this$editorScrollabl === void 0 ? void 0 : _this$editorScrollabl.className)) {
|
|
402
|
+
this.updateStickyHeaderWidth();
|
|
403
|
+
} else {
|
|
404
|
+
const newHeight = entry.contentRect ? entry.contentRect.height : entry.target.offsetHeight;
|
|
405
|
+
if (this.sentinels.bottom &&
|
|
406
|
+
// When the table header is sticky, it would be taller by a 1px (border-bottom),
|
|
407
|
+
// So we adding this check to allow a 1px difference.
|
|
408
|
+
Math.abs(newHeight - (this.stickyRowHeight || 0)) > stickyHeaderBorderBottomWidth) {
|
|
409
|
+
this.stickyRowHeight = newHeight;
|
|
410
|
+
this.sentinels.bottom.style.bottom = `${tableScrollbarOffset + stickyRowOffsetTop + newHeight}px`;
|
|
411
|
+
updateTableMargin(table);
|
|
412
|
+
}
|
|
400
413
|
}
|
|
401
414
|
});
|
|
402
415
|
});
|
|
@@ -421,18 +434,20 @@ export class TableRowNodeView {
|
|
|
421
434
|
var _entry$rootBounds2;
|
|
422
435
|
const sentinelIsBelowScrollArea = (((_entry$rootBounds2 = entry.rootBounds) === null || _entry$rootBounds2 === void 0 ? void 0 : _entry$rootBounds2.bottom) || 0) < entry.boundingClientRect.bottom;
|
|
423
436
|
if (!entry.isIntersecting && !sentinelIsBelowScrollArea) {
|
|
424
|
-
|
|
437
|
+
var _entry$rootBounds3;
|
|
438
|
+
this.tree && this.makeHeaderRowSticky(this.tree, (_entry$rootBounds3 = entry.rootBounds) === null || _entry$rootBounds3 === void 0 ? void 0 : _entry$rootBounds3.top);
|
|
425
439
|
} else {
|
|
426
440
|
table && this.makeRowHeaderNotSticky(table);
|
|
427
441
|
}
|
|
428
442
|
}
|
|
429
443
|
if (target.classList.contains(ClassName.TABLE_STICKY_SENTINEL_BOTTOM)) {
|
|
430
|
-
var _entry$
|
|
431
|
-
const sentinelIsAboveScrollArea = entry.boundingClientRect.top - this.dom.offsetHeight < (((_entry$
|
|
444
|
+
var _entry$rootBounds4;
|
|
445
|
+
const sentinelIsAboveScrollArea = entry.boundingClientRect.top - this.dom.offsetHeight < (((_entry$rootBounds4 = entry.rootBounds) === null || _entry$rootBounds4 === void 0 ? void 0 : _entry$rootBounds4.top) || 0);
|
|
432
446
|
if (table && !entry.isIntersecting && sentinelIsAboveScrollArea) {
|
|
433
447
|
this.makeRowHeaderNotSticky(table);
|
|
434
448
|
} else if (entry.isIntersecting && sentinelIsAboveScrollArea) {
|
|
435
|
-
|
|
449
|
+
var _entry$rootBounds5;
|
|
450
|
+
this.tree && this.makeHeaderRowSticky(this.tree, entry === null || entry === void 0 ? void 0 : (_entry$rootBounds5 = entry.rootBounds) === null || _entry$rootBounds5 === void 0 ? void 0 : _entry$rootBounds5.top);
|
|
436
451
|
}
|
|
437
452
|
}
|
|
438
453
|
});
|
|
@@ -9,7 +9,6 @@ import { evenColumns, setDragging, stopResizing } from './commands';
|
|
|
9
9
|
import { getPluginState } from './plugin-factory';
|
|
10
10
|
import { currentColWidth, getLayoutSize, getResizeState, pointsAtCell, resizeColumn, updateControls } from './utils';
|
|
11
11
|
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
12
|
-
import { getParentWidthWithoutPadding } from './utils/misc';
|
|
13
12
|
export const handleMouseDown = (view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI) => {
|
|
14
13
|
const {
|
|
15
14
|
state,
|
|
@@ -32,10 +31,7 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
|
|
|
32
31
|
}
|
|
33
32
|
const containerWidth = getEditorContainerWidth();
|
|
34
33
|
const parentWidth = getParentNodeWidth(start, state, containerWidth);
|
|
35
|
-
|
|
36
|
-
// TODO - refactor this logic into getParentNodeWidth() in editor-common [ED-16718]
|
|
37
|
-
const parentActualWidth = getParentWidthWithoutPadding(parentWidth, start, state);
|
|
38
|
-
let maxSize = parentActualWidth || getLayoutSize(dom.getAttribute('data-layout'), containerWidth.width, {});
|
|
34
|
+
let maxSize = parentWidth || getLayoutSize(dom.getAttribute('data-layout'), containerWidth.width, {});
|
|
39
35
|
if (originalTable.attrs.isNumberColumnEnabled) {
|
|
40
36
|
maxSize -= akEditorTableNumberColumnWidth;
|
|
41
37
|
}
|