@atlaskit/editor-plugin-table 9.5.7 → 9.5.9
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 +19 -0
- package/dist/cjs/nodeviews/TableComponent.js +2 -1
- package/dist/cjs/pm-plugins/view-mode-sort/utils.js +5 -4
- package/dist/cjs/ui/common-styles.js +1 -1
- package/dist/cjs/ui/toolbar.js +1 -0
- package/dist/es2019/nodeviews/TableComponent.js +2 -1
- package/dist/es2019/pm-plugins/view-mode-sort/utils.js +5 -4
- package/dist/es2019/ui/common-styles.js +11 -7
- package/dist/es2019/ui/toolbar.js +1 -0
- package/dist/esm/nodeviews/TableComponent.js +2 -1
- package/dist/esm/pm-plugins/view-mode-sort/utils.js +5 -4
- package/dist/esm/ui/common-styles.js +1 -1
- package/dist/esm/ui/toolbar.js +1 -0
- package/dist/types/pm-plugins/view-mode-sort/utils.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/view-mode-sort/utils.d.ts +2 -2
- package/package.json +6 -6
- package/src/nodeviews/TableComponent.tsx +4 -1
- package/src/pm-plugins/view-mode-sort/utils.ts +14 -4
- package/src/ui/common-styles.ts +11 -7
- package/src/ui/toolbar.tsx +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 9.5.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#115089](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/115089)
|
|
8
|
+
[`cebfa87c2825a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cebfa87c2825a) -
|
|
9
|
+
[ux] [ED-26564] This change fixes the table sort functionality for tables containing nested
|
|
10
|
+
tables, and fixes the styling for the table sort button when selected (is active).
|
|
11
|
+
|
|
12
|
+
## 9.5.8
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#115259](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/115259)
|
|
17
|
+
[`a3150808f308a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a3150808f308a) -
|
|
18
|
+
Add new forceStaticToolbar config option to floating toolbar and add it to panel and table. Add
|
|
19
|
+
new contextual toolbar plugin which controls expand and collapse logic for toolbar options.
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 9.5.7
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -338,6 +338,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
338
338
|
(0, _defineProperty3.default)(_this, "handleScrollDebounced", (0, _rafSchd.default)(_this.handleScroll));
|
|
339
339
|
(0, _defineProperty3.default)(_this, "handleAutoSizeDebounced", (0, _rafSchd.default)(_this.handleAutoSize));
|
|
340
340
|
(0, _defineProperty3.default)(_this, "handleWindowResizeDebounced", (0, _rafSchd.default)(_this.handleWindowResize));
|
|
341
|
+
(0, _defineProperty3.default)(_this, "updateShadowStateDebounced", (0, _rafSchd.default)(_this.updateShadowState));
|
|
341
342
|
var _options = props.options,
|
|
342
343
|
_containerWidth = props.containerWidth,
|
|
343
344
|
_getNode = props.getNode;
|
|
@@ -733,7 +734,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
733
734
|
// that happens when a table is nested in expand and expand's width is
|
|
734
735
|
// changed via breakout button
|
|
735
736
|
window.requestAnimationFrame(function () {
|
|
736
|
-
_this4.overflowShadowsObserver = new _OverflowShadowsObserver.OverflowShadowsObserver(_this4.updateShadowState,
|
|
737
|
+
_this4.overflowShadowsObserver = new _OverflowShadowsObserver.OverflowShadowsObserver((0, _platformFeatureFlags.fg)('platform_editor_nested_tables_view_mode_sort') ? _this4.updateShadowStateDebounced : _this4.updateShadowState,
|
|
737
738
|
// Ignored via go/ees005
|
|
738
739
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
739
740
|
_this4.table, _this4.wrapper);
|
|
@@ -9,10 +9,11 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _types = require("@atlaskit/editor-common/types");
|
|
11
11
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
13
|
var _consts = require("./consts");
|
|
13
14
|
var unsort = exports.unsort = function unsort(oldOrder, tableElement) {
|
|
14
|
-
var
|
|
15
|
-
var
|
|
15
|
+
var tbody = (0, _platformFeatureFlags.fg)('platform_editor_nested_tables_view_mode_sort') ? tableElement.querySelector(":scope > tbody") : tableElement.querySelector('tbody');
|
|
16
|
+
var rows = (0, _platformFeatureFlags.fg)('platform_editor_nested_tables_view_mode_sort') ? tableElement.querySelectorAll(":scope > tbody > tr") : tableElement.querySelectorAll('tr');
|
|
16
17
|
var sortedOrder = (0, _toConsumableArray2.default)(oldOrder).sort(function (a, b) {
|
|
17
18
|
return a.value - b.value;
|
|
18
19
|
});
|
|
@@ -117,8 +118,8 @@ var toggleSort = exports.toggleSort = function toggleSort(view, event, pluginSta
|
|
|
117
118
|
};
|
|
118
119
|
var getTableElements = exports.getTableElements = function getTableElements(tableId) {
|
|
119
120
|
var tableElement = document.querySelector("table[data-table-local-id=\"".concat(tableId, "\"]"));
|
|
120
|
-
var tbody = tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelector('tbody');
|
|
121
|
-
var rows = tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelectorAll('tr');
|
|
121
|
+
var tbody = (0, _platformFeatureFlags.fg)('platform_editor_nested_tables_view_mode_sort') ? tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelector(':scope > tbody') : tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelector('tbody');
|
|
122
|
+
var rows = (0, _platformFeatureFlags.fg)('platform_editor_nested_tables_view_mode_sort') ? tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelectorAll(':scope > tbody > tr') : tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelectorAll('tr');
|
|
122
123
|
return {
|
|
123
124
|
tbody: tbody,
|
|
124
125
|
rows: rows
|
|
@@ -43,7 +43,7 @@ var breakoutWidthStyling = function breakoutWidthStyling() {
|
|
|
43
43
|
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t\t> *:not([data-mark-type='fragment'])\n\t\t\t.", "\n\t\t\t.", " {\n\t\t\tmargin-left: unset !important;\n\t\t\twidth: 100% !important;\n\t\t}\n\n\t\t> [data-mark-type='fragment'] * .", " .", " {\n\t\t\tmargin-left: unset !important;\n\t\t\twidth: 100% !important;\n\t\t}\n\t"])), _types.TableCssClassName.NODEVIEW_WRAPPER, _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.NODEVIEW_WRAPPER, _types.TableCssClassName.TABLE_CONTAINER);
|
|
44
44
|
};
|
|
45
45
|
var viewModeSortStyles = function viewModeSortStyles() {
|
|
46
|
-
return (0, _platformFeatureFlags.fg)('platform_editor_nested_tables_view_mode_sort') ? (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t// new styles\n\t\t\t\tth {\n\t\t\t\t\t.", " {\n\t\t\t\t\t\t+ p {\n\t\t\t\t\t\t\tmargin-top: 0 !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t&:has(.is-active) {\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t.", " {\n\t\t\t\t\t\topacity: 0;\n\t\t\t\t\t\t&:focus {\n\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t&:hover:not(:has(.", ":hover)) {\n\t\t\t\t\t\t> .", " {\n\t\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t"])), _consts.SORTING_ICON_CLASS_NAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME, _types.TableCssClassName.TABLE_CONTAINER, _consts.SORTING_ICON_CLASS_NAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME) : (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t// old styles\n\t\t\t\tth {\n\t\t\t\t\t.", " {\n\t\t\t\t\t\t+ p {\n\t\t\t\t\t\t\tmargin-top: 0 !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t&:has(.is-active) {\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t.", " {\n\t\t\t\t\t\topacity: 0;\n\t\t\t\t\t\t&:focus {\n\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t&:hover {\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t"])), _consts.SORTING_ICON_CLASS_NAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME);
|
|
46
|
+
return (0, _platformFeatureFlags.fg)('platform_editor_nested_tables_view_mode_sort') ? (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t// new styles\n\t\t\t\tth {\n\t\t\t\t\t.", " {\n\t\t\t\t\t\t+ p {\n\t\t\t\t\t\t\tmargin-top: 0 !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t> .", " {\n\t\t\t\t\t\t&:has(.is-active) {\n\t\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t> .", " {\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\topacity: 0;\n\t\t\t\t\t\t\t&:focus {\n\t\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t&:hover:not(:has(.", ":hover)) {\n\t\t\t\t\t\t> .", " {\n\t\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t"])), _consts.SORTING_ICON_CLASS_NAME, _consts.SORTING_ICON_CLASS_NAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME, _consts.SORTING_ICON_CLASS_NAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME, _types.TableCssClassName.TABLE_CONTAINER, _consts.SORTING_ICON_CLASS_NAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME) : (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t// old styles\n\t\t\t\tth {\n\t\t\t\t\t.", " {\n\t\t\t\t\t\t+ p {\n\t\t\t\t\t\t\tmargin-top: 0 !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t&:has(.is-active) {\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t.", " {\n\t\t\t\t\t\topacity: 0;\n\t\t\t\t\t\t&:focus {\n\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t&:hover {\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t"])), _consts.SORTING_ICON_CLASS_NAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME);
|
|
47
47
|
};
|
|
48
48
|
var tableBorderStyles = function tableBorderStyles() {
|
|
49
49
|
return "border-color: ".concat(_consts2.tableBorderDeleteColor);
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -434,6 +434,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
434
434
|
},
|
|
435
435
|
zIndex: _editorSharedStyles.akEditorFloatingPanelZIndex + 1,
|
|
436
436
|
// Place the context menu slightly above the others
|
|
437
|
+
forceStaticToolbar: true,
|
|
437
438
|
items: [menu, separator(menu.hidden)].concat((0, _toConsumableArray2.default)(alignmentMenu), [separator(alignmentMenu.length === 0)], (0, _toConsumableArray2.default)(cellItems), (0, _toConsumableArray2.default)(columnSettingsItems), colorPicker, [{
|
|
438
439
|
type: 'extensions-placeholder',
|
|
439
440
|
separator: 'end'
|
|
@@ -336,6 +336,7 @@ class TableComponent extends React.Component {
|
|
|
336
336
|
_defineProperty(this, "handleScrollDebounced", rafSchedule(this.handleScroll));
|
|
337
337
|
_defineProperty(this, "handleAutoSizeDebounced", rafSchedule(this.handleAutoSize));
|
|
338
338
|
_defineProperty(this, "handleWindowResizeDebounced", rafSchedule(this.handleWindowResize));
|
|
339
|
+
_defineProperty(this, "updateShadowStateDebounced", rafSchedule(this.updateShadowState));
|
|
339
340
|
const {
|
|
340
341
|
options: _options,
|
|
341
342
|
containerWidth: _containerWidth,
|
|
@@ -702,7 +703,7 @@ class TableComponent extends React.Component {
|
|
|
702
703
|
// that happens when a table is nested in expand and expand's width is
|
|
703
704
|
// changed via breakout button
|
|
704
705
|
window.requestAnimationFrame(() => {
|
|
705
|
-
this.overflowShadowsObserver = new OverflowShadowsObserver(this.updateShadowState,
|
|
706
|
+
this.overflowShadowsObserver = new OverflowShadowsObserver(fg('platform_editor_nested_tables_view_mode_sort') ? this.updateShadowStateDebounced : this.updateShadowState,
|
|
706
707
|
// Ignored via go/ees005
|
|
707
708
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
708
709
|
this.table, this.wrapper);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { convertProsemirrorTableNodeToArrayOfRows, createCompareNodes } from '@atlaskit/editor-common/utils';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { IS_DISABLED_CLASS_NAME, SORT_INDEX_DATA_ATTRIBUTE, SORTING_ICON_CLASS_NAME } from './consts';
|
|
4
5
|
export const unsort = (oldOrder, tableElement) => {
|
|
5
|
-
const
|
|
6
|
-
const
|
|
6
|
+
const tbody = fg('platform_editor_nested_tables_view_mode_sort') ? tableElement.querySelector(`:scope > tbody`) : tableElement.querySelector('tbody');
|
|
7
|
+
const rows = fg('platform_editor_nested_tables_view_mode_sort') ? tableElement.querySelectorAll(`:scope > tbody > tr`) : tableElement.querySelectorAll('tr');
|
|
7
8
|
const sortedOrder = [...oldOrder].sort((a, b) => a.value - b.value);
|
|
8
9
|
sortedOrder.forEach(item => {
|
|
9
10
|
tbody === null || tbody === void 0 ? void 0 : tbody.appendChild(rows[item.index + 1]);
|
|
@@ -107,8 +108,8 @@ export const toggleSort = (view, event, pluginState) => {
|
|
|
107
108
|
};
|
|
108
109
|
export const getTableElements = tableId => {
|
|
109
110
|
const tableElement = document.querySelector(`table[data-table-local-id="${tableId}"]`);
|
|
110
|
-
const tbody = tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelector('tbody');
|
|
111
|
-
const rows = tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelectorAll('tr');
|
|
111
|
+
const tbody = fg('platform_editor_nested_tables_view_mode_sort') ? tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelector(':scope > tbody') : tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelector('tbody');
|
|
112
|
+
const rows = fg('platform_editor_nested_tables_view_mode_sort') ? tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelectorAll(':scope > tbody > tr') : tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelectorAll('tr');
|
|
112
113
|
return {
|
|
113
114
|
tbody,
|
|
114
115
|
rows
|
|
@@ -134,16 +134,20 @@ const viewModeSortStyles = () => {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
> .${SORTING_ICON_CLASS_NAME} {
|
|
138
|
+
&:has(.is-active) {
|
|
139
|
+
.${SORTABLE_COLUMN_ICON_CLASSNAME} {
|
|
140
|
+
opacity: 1;
|
|
141
|
+
}
|
|
140
142
|
}
|
|
141
143
|
}
|
|
142
144
|
|
|
143
|
-
.${
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
> .${SORTING_ICON_CLASS_NAME} {
|
|
146
|
+
.${SORTABLE_COLUMN_ICON_CLASSNAME} {
|
|
147
|
+
opacity: 0;
|
|
148
|
+
&:focus {
|
|
149
|
+
opacity: 1;
|
|
150
|
+
}
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
153
|
|
|
@@ -406,6 +406,7 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
|
|
|
406
406
|
},
|
|
407
407
|
zIndex: akEditorFloatingPanelZIndex + 1,
|
|
408
408
|
// Place the context menu slightly above the others
|
|
409
|
+
forceStaticToolbar: true,
|
|
409
410
|
items: [menu, separator(menu.hidden), ...alignmentMenu, separator(alignmentMenu.length === 0), ...cellItems, ...columnSettingsItems, ...colorPicker, {
|
|
410
411
|
type: 'extensions-placeholder',
|
|
411
412
|
separator: 'end'
|
|
@@ -332,6 +332,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
332
332
|
_defineProperty(_this, "handleScrollDebounced", rafSchedule(_this.handleScroll));
|
|
333
333
|
_defineProperty(_this, "handleAutoSizeDebounced", rafSchedule(_this.handleAutoSize));
|
|
334
334
|
_defineProperty(_this, "handleWindowResizeDebounced", rafSchedule(_this.handleWindowResize));
|
|
335
|
+
_defineProperty(_this, "updateShadowStateDebounced", rafSchedule(_this.updateShadowState));
|
|
335
336
|
var _options = props.options,
|
|
336
337
|
_containerWidth = props.containerWidth,
|
|
337
338
|
_getNode = props.getNode;
|
|
@@ -727,7 +728,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
727
728
|
// that happens when a table is nested in expand and expand's width is
|
|
728
729
|
// changed via breakout button
|
|
729
730
|
window.requestAnimationFrame(function () {
|
|
730
|
-
_this4.overflowShadowsObserver = new OverflowShadowsObserver(_this4.updateShadowState,
|
|
731
|
+
_this4.overflowShadowsObserver = new OverflowShadowsObserver(fg('platform_editor_nested_tables_view_mode_sort') ? _this4.updateShadowStateDebounced : _this4.updateShadowState,
|
|
731
732
|
// Ignored via go/ees005
|
|
732
733
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
733
734
|
_this4.table, _this4.wrapper);
|
|
@@ -2,10 +2,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { convertProsemirrorTableNodeToArrayOfRows, createCompareNodes } from '@atlaskit/editor-common/utils';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { IS_DISABLED_CLASS_NAME, SORT_INDEX_DATA_ATTRIBUTE, SORTING_ICON_CLASS_NAME } from './consts';
|
|
6
7
|
export var unsort = function unsort(oldOrder, tableElement) {
|
|
7
|
-
var
|
|
8
|
-
var
|
|
8
|
+
var tbody = fg('platform_editor_nested_tables_view_mode_sort') ? tableElement.querySelector(":scope > tbody") : tableElement.querySelector('tbody');
|
|
9
|
+
var rows = fg('platform_editor_nested_tables_view_mode_sort') ? tableElement.querySelectorAll(":scope > tbody > tr") : tableElement.querySelectorAll('tr');
|
|
9
10
|
var sortedOrder = _toConsumableArray(oldOrder).sort(function (a, b) {
|
|
10
11
|
return a.value - b.value;
|
|
11
12
|
});
|
|
@@ -110,8 +111,8 @@ export var toggleSort = function toggleSort(view, event, pluginState) {
|
|
|
110
111
|
};
|
|
111
112
|
export var getTableElements = function getTableElements(tableId) {
|
|
112
113
|
var tableElement = document.querySelector("table[data-table-local-id=\"".concat(tableId, "\"]"));
|
|
113
|
-
var tbody = tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelector('tbody');
|
|
114
|
-
var rows = tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelectorAll('tr');
|
|
114
|
+
var tbody = fg('platform_editor_nested_tables_view_mode_sort') ? tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelector(':scope > tbody') : tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelector('tbody');
|
|
115
|
+
var rows = fg('platform_editor_nested_tables_view_mode_sort') ? tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelectorAll(':scope > tbody > tr') : tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelectorAll('tr');
|
|
115
116
|
return {
|
|
116
117
|
tbody: tbody,
|
|
117
118
|
rows: rows
|
|
@@ -38,7 +38,7 @@ var breakoutWidthStyling = function breakoutWidthStyling() {
|
|
|
38
38
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t\t> *:not([data-mark-type='fragment'])\n\t\t\t.", "\n\t\t\t.", " {\n\t\t\tmargin-left: unset !important;\n\t\t\twidth: 100% !important;\n\t\t}\n\n\t\t> [data-mark-type='fragment'] * .", " .", " {\n\t\t\tmargin-left: unset !important;\n\t\t\twidth: 100% !important;\n\t\t}\n\t"])), ClassName.NODEVIEW_WRAPPER, ClassName.TABLE_CONTAINER, ClassName.NODEVIEW_WRAPPER, ClassName.TABLE_CONTAINER);
|
|
39
39
|
};
|
|
40
40
|
var viewModeSortStyles = function viewModeSortStyles() {
|
|
41
|
-
return fg('platform_editor_nested_tables_view_mode_sort') ? css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n\t\t\t\t// new styles\n\t\t\t\tth {\n\t\t\t\t\t.", " {\n\t\t\t\t\t\t+ p {\n\t\t\t\t\t\t\tmargin-top: 0 !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t&:has(.is-active) {\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t.", " {\n\t\t\t\t\t\topacity: 0;\n\t\t\t\t\t\t&:focus {\n\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t&:hover:not(:has(.", ":hover)) {\n\t\t\t\t\t\t> .", " {\n\t\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t"])), SORTING_ICON_CLASS_NAME, SORTABLE_COLUMN_ICON_CLASSNAME, SORTABLE_COLUMN_ICON_CLASSNAME, ClassName.TABLE_CONTAINER, SORTING_ICON_CLASS_NAME, SORTABLE_COLUMN_ICON_CLASSNAME) : css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\t\t\t\t// old styles\n\t\t\t\tth {\n\t\t\t\t\t.", " {\n\t\t\t\t\t\t+ p {\n\t\t\t\t\t\t\tmargin-top: 0 !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t&:has(.is-active) {\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t.", " {\n\t\t\t\t\t\topacity: 0;\n\t\t\t\t\t\t&:focus {\n\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t&:hover {\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t"])), SORTING_ICON_CLASS_NAME, SORTABLE_COLUMN_ICON_CLASSNAME, SORTABLE_COLUMN_ICON_CLASSNAME, SORTABLE_COLUMN_ICON_CLASSNAME);
|
|
41
|
+
return fg('platform_editor_nested_tables_view_mode_sort') ? css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n\t\t\t\t// new styles\n\t\t\t\tth {\n\t\t\t\t\t.", " {\n\t\t\t\t\t\t+ p {\n\t\t\t\t\t\t\tmargin-top: 0 !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t> .", " {\n\t\t\t\t\t\t&:has(.is-active) {\n\t\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t> .", " {\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\topacity: 0;\n\t\t\t\t\t\t\t&:focus {\n\t\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t&:hover:not(:has(.", ":hover)) {\n\t\t\t\t\t\t> .", " {\n\t\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t"])), SORTING_ICON_CLASS_NAME, SORTING_ICON_CLASS_NAME, SORTABLE_COLUMN_ICON_CLASSNAME, SORTING_ICON_CLASS_NAME, SORTABLE_COLUMN_ICON_CLASSNAME, ClassName.TABLE_CONTAINER, SORTING_ICON_CLASS_NAME, SORTABLE_COLUMN_ICON_CLASSNAME) : css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\t\t\t\t// old styles\n\t\t\t\tth {\n\t\t\t\t\t.", " {\n\t\t\t\t\t\t+ p {\n\t\t\t\t\t\t\tmargin-top: 0 !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t&:has(.is-active) {\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t.", " {\n\t\t\t\t\t\topacity: 0;\n\t\t\t\t\t\t&:focus {\n\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t&:hover {\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t"])), SORTING_ICON_CLASS_NAME, SORTABLE_COLUMN_ICON_CLASSNAME, SORTABLE_COLUMN_ICON_CLASSNAME, SORTABLE_COLUMN_ICON_CLASSNAME);
|
|
42
42
|
};
|
|
43
43
|
var tableBorderStyles = function tableBorderStyles() {
|
|
44
44
|
return "border-color: ".concat(tableBorderDeleteColor);
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -426,6 +426,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
426
426
|
},
|
|
427
427
|
zIndex: akEditorFloatingPanelZIndex + 1,
|
|
428
428
|
// Place the context menu slightly above the others
|
|
429
|
+
forceStaticToolbar: true,
|
|
429
430
|
items: [menu, separator(menu.hidden)].concat(_toConsumableArray(alignmentMenu), [separator(alignmentMenu.length === 0)], _toConsumableArray(cellItems), _toConsumableArray(columnSettingsItems), colorPicker, [{
|
|
430
431
|
type: 'extensions-placeholder',
|
|
431
432
|
separator: 'end'
|
|
@@ -6,6 +6,6 @@ export declare const unsort: (oldOrder: {
|
|
|
6
6
|
}[], tableElement: HTMLElement) => void;
|
|
7
7
|
export declare const toggleSort: (view: EditorView, event: Event, pluginState: TableSortMeta) => void;
|
|
8
8
|
export declare const getTableElements: (tableId: string) => {
|
|
9
|
-
tbody:
|
|
10
|
-
rows: NodeListOf<
|
|
9
|
+
tbody: Element | null | undefined;
|
|
10
|
+
rows: NodeListOf<Element> | undefined;
|
|
11
11
|
};
|
|
@@ -6,6 +6,6 @@ export declare const unsort: (oldOrder: {
|
|
|
6
6
|
}[], tableElement: HTMLElement) => void;
|
|
7
7
|
export declare const toggleSort: (view: EditorView, event: Event, pluginState: TableSortMeta) => void;
|
|
8
8
|
export declare const getTableElements: (tableId: string) => {
|
|
9
|
-
tbody:
|
|
10
|
-
rows: NodeListOf<
|
|
9
|
+
tbody: Element | null | undefined;
|
|
10
|
+
rows: NodeListOf<Element> | undefined;
|
|
11
11
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "9.5.
|
|
3
|
+
"version": "9.5.9",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@atlaskit/adf-schema": "^47.2.1",
|
|
31
31
|
"@atlaskit/button": "^20.5.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.10.0",
|
|
33
|
-
"@atlaskit/editor-common": "^99.
|
|
33
|
+
"@atlaskit/editor-common": "^99.18.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.7.0",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.4.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.12.0",
|
|
@@ -43,18 +43,18 @@
|
|
|
43
43
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
44
44
|
"@atlaskit/editor-shared-styles": "^3.3.0",
|
|
45
45
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
46
|
-
"@atlaskit/icon": "^23.
|
|
46
|
+
"@atlaskit/icon": "^23.10.0",
|
|
47
47
|
"@atlaskit/menu": "^2.14.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
49
49
|
"@atlaskit/pragmatic-drag-and-drop": "^1.5.0",
|
|
50
50
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
|
51
51
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
52
|
-
"@atlaskit/primitives": "^13.
|
|
52
|
+
"@atlaskit/primitives": "^13.6.0",
|
|
53
53
|
"@atlaskit/theme": "^16.0.0",
|
|
54
54
|
"@atlaskit/tmp-editor-statsig": "^2.47.0",
|
|
55
|
-
"@atlaskit/toggle": "^14.
|
|
55
|
+
"@atlaskit/toggle": "^14.2.0",
|
|
56
56
|
"@atlaskit/tokens": "^3.3.0",
|
|
57
|
-
"@atlaskit/tooltip": "^19.
|
|
57
|
+
"@atlaskit/tooltip": "^19.2.0",
|
|
58
58
|
"@babel/runtime": "^7.0.0",
|
|
59
59
|
"@emotion/react": "^11.7.1",
|
|
60
60
|
"classnames": "^2.2.5",
|
|
@@ -651,7 +651,9 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
651
651
|
// changed via breakout button
|
|
652
652
|
window.requestAnimationFrame(() => {
|
|
653
653
|
this.overflowShadowsObserver = new OverflowShadowsObserver(
|
|
654
|
-
|
|
654
|
+
fg('platform_editor_nested_tables_view_mode_sort')
|
|
655
|
+
? this.updateShadowStateDebounced
|
|
656
|
+
: this.updateShadowState,
|
|
655
657
|
// Ignored via go/ees005
|
|
656
658
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
657
659
|
this.table as HTMLElement,
|
|
@@ -1335,6 +1337,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
1335
1337
|
private handleScrollDebounced = rafSchedule(this.handleScroll);
|
|
1336
1338
|
private handleAutoSizeDebounced = rafSchedule(this.handleAutoSize);
|
|
1337
1339
|
private handleWindowResizeDebounced = rafSchedule(this.handleWindowResize);
|
|
1340
|
+
private updateShadowStateDebounced = rafSchedule(this.updateShadowState);
|
|
1338
1341
|
}
|
|
1339
1342
|
|
|
1340
1343
|
export default injectIntl(TableComponent);
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
} from '@atlaskit/editor-common/utils';
|
|
6
6
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
|
|
9
10
|
import {
|
|
10
11
|
IS_DISABLED_CLASS_NAME,
|
|
@@ -14,8 +15,12 @@ import {
|
|
|
14
15
|
import type { TableSortMeta } from './types';
|
|
15
16
|
|
|
16
17
|
export const unsort = (oldOrder: { index: number; value: number }[], tableElement: HTMLElement) => {
|
|
17
|
-
const
|
|
18
|
-
|
|
18
|
+
const tbody = fg('platform_editor_nested_tables_view_mode_sort')
|
|
19
|
+
? tableElement.querySelector(`:scope > tbody`)
|
|
20
|
+
: tableElement.querySelector('tbody');
|
|
21
|
+
const rows = fg('platform_editor_nested_tables_view_mode_sort')
|
|
22
|
+
? tableElement.querySelectorAll(`:scope > tbody > tr`)
|
|
23
|
+
: tableElement.querySelectorAll('tr');
|
|
19
24
|
|
|
20
25
|
const sortedOrder = [...oldOrder].sort((a, b) => a.value - b.value);
|
|
21
26
|
sortedOrder.forEach((item) => {
|
|
@@ -129,7 +134,12 @@ export const toggleSort = (view: EditorView, event: Event, pluginState: TableSor
|
|
|
129
134
|
|
|
130
135
|
export const getTableElements = (tableId: string) => {
|
|
131
136
|
const tableElement = document.querySelector(`table[data-table-local-id="${tableId}"]`);
|
|
132
|
-
const tbody =
|
|
133
|
-
|
|
137
|
+
const tbody = fg('platform_editor_nested_tables_view_mode_sort')
|
|
138
|
+
? tableElement?.querySelector(':scope > tbody')
|
|
139
|
+
: tableElement?.querySelector('tbody');
|
|
140
|
+
|
|
141
|
+
const rows = fg('platform_editor_nested_tables_view_mode_sort')
|
|
142
|
+
? tableElement?.querySelectorAll(':scope > tbody > tr')
|
|
143
|
+
: tableElement?.querySelectorAll('tr');
|
|
134
144
|
return { tbody, rows };
|
|
135
145
|
};
|
package/src/ui/common-styles.ts
CHANGED
|
@@ -206,16 +206,20 @@ const viewModeSortStyles = () => {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
> .${SORTING_ICON_CLASS_NAME} {
|
|
210
|
+
&:has(.is-active) {
|
|
211
|
+
.${SORTABLE_COLUMN_ICON_CLASSNAME} {
|
|
212
|
+
opacity: 1;
|
|
213
|
+
}
|
|
212
214
|
}
|
|
213
215
|
}
|
|
214
216
|
|
|
215
|
-
.${
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
> .${SORTING_ICON_CLASS_NAME} {
|
|
218
|
+
.${SORTABLE_COLUMN_ICON_CLASSNAME} {
|
|
219
|
+
opacity: 0;
|
|
220
|
+
&:focus {
|
|
221
|
+
opacity: 1;
|
|
222
|
+
}
|
|
219
223
|
}
|
|
220
224
|
}
|
|
221
225
|
|
package/src/ui/toolbar.tsx
CHANGED
|
@@ -602,6 +602,7 @@ export const getToolbarConfig =
|
|
|
602
602
|
offset: [0, 18],
|
|
603
603
|
absoluteOffset: { top: -6 },
|
|
604
604
|
zIndex: akEditorFloatingPanelZIndex + 1, // Place the context menu slightly above the others
|
|
605
|
+
forceStaticToolbar: true,
|
|
605
606
|
items: [
|
|
606
607
|
menu,
|
|
607
608
|
separator(menu.hidden),
|