@atlaskit/editor-plugin-table 2.6.11 → 2.6.13

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 CHANGED
@@ -1,5 +1,27 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 2.6.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8fe864e4f7a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8fe864e4f7a) - [ux] ED-19336: Fixed insert column button not visible when sticky header is enabled."
8
+
9
+ ## 2.6.12
10
+
11
+ ### Patch Changes
12
+
13
+ - [`08bae0f0926`](https://bitbucket.org/atlassian/atlassian-frontend/commits/08bae0f0926) - [ux] When there's only one row in a table the top & bottom sentinels become inverted. This creates some nasty visiblity
14
+ toggling side-effects because the intersection observers gets confused and ends up toggling the sticky header on when it should
15
+ be off and vice-versa.
16
+
17
+ This is due to their positioning using css relative top & bottom respectively. A row is only ~44px height and the bottom sentinel is
18
+ positioned ~67px off the bottom, and the top sentinel is ~25px off the top (which aligns to the top of the row).
19
+ So when only 1 row exist the bottom sentinel ends up being ~23px above the top sentinel. Which means the logic for
20
+ toggling becomes inverted and when the sentinels are scrolled off the screen the top on is now last and ends up displaying the
21
+ sticky header, where previously the bottom sentinel would hide it.
22
+
23
+ - Updated dependencies
24
+
3
25
  ## 2.6.11
4
26
 
5
27
  ### Patch Changes
@@ -445,6 +445,11 @@ var TableRowNodeView = /*#__PURE__*/function () {
445
445
  return;
446
446
  }
447
447
  var table = _this4.tree.table;
448
+ if (table.rows.length < 2) {
449
+ // ED-19307 - When there's only one row in a table the top & bottom sentinels become inverted. This creates some nasty visiblity
450
+ // toggling side-effects because the intersection observers gets confused.
451
+ return;
452
+ }
448
453
  entries.forEach(function (entry) {
449
454
  var _entry$rootBounds;
450
455
  var target = entry.target;
@@ -19,6 +19,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
19
19
  var _ui = require("@atlaskit/editor-common/ui");
20
20
  var _utils = require("@atlaskit/editor-common/utils");
21
21
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
22
+ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
22
23
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
23
24
  var _tableMap = require("@atlaskit/editor-tables/table-map");
24
25
  var _utils3 = require("@atlaskit/editor-tables/utils");
@@ -114,6 +115,12 @@ var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
114
115
  var tableWrapper = (0, _utils.closestElement)(targetCellRef, ".".concat(_types.TableCssClassName.TABLE_NODE_WRAPPER));
115
116
  var index = type === 'column' ? insertColumnButtonIndex : insertRowButtonIndex;
116
117
  var hasNumberedColumns = (0, _utils4.checkIfNumberColumnEnabled)(editorView.state.selection);
118
+
119
+ // ED-19336: Fixed the 'add column button' not visible issue when sticky header is enabled
120
+ // By setting the Popup z-index higher than the sticky header z-index ( common-styles.ts tr.sticky)
121
+ // Only when inserting a column, otherwise set to undefined
122
+ // Need to set z-index in the Popup, set z-index in the <InsertButton /> will not work
123
+ var zIndex = type === 'column' ? _editorSharedStyles.akEditorTableCellOnStickyHeaderZIndex : undefined;
117
124
  return /*#__PURE__*/_react.default.createElement(_ui.Popup, (0, _extends2.default)({
118
125
  target: targetCellRef,
119
126
  mountTo: tableContainerWrapper || mountPoint,
@@ -121,7 +128,9 @@ var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
121
128
  scrollableElement: tableWrapper,
122
129
  forcePlacement: true,
123
130
  allowOutOfBounds: true
124
- }, (0, _getPopupOptions.default)(type, index, hasNumberedColumns, tableContainerWrapper)), /*#__PURE__*/_react.default.createElement(_InsertButton.default, {
131
+ }, (0, _getPopupOptions.default)(type, index, hasNumberedColumns, tableContainerWrapper), {
132
+ zIndex: zIndex
133
+ }), /*#__PURE__*/_react.default.createElement(_InsertButton.default, {
125
134
  type: type,
126
135
  tableRef: tableRef,
127
136
  onMouseDown: type === 'column' ? this.insertColumn : this.insertRow,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.6.11",
3
+ "version": "2.6.13",
4
4
  "sideEffects": false
5
5
  }
@@ -417,6 +417,11 @@ export class TableRowNodeView {
417
417
  const {
418
418
  table
419
419
  } = this.tree;
420
+ if (table.rows.length < 2) {
421
+ // ED-19307 - When there's only one row in a table the top & bottom sentinels become inverted. This creates some nasty visiblity
422
+ // toggling side-effects because the intersection observers gets confused.
423
+ return;
424
+ }
420
425
  entries.forEach(entry => {
421
426
  var _entry$rootBounds;
422
427
  const target = entry.target;
@@ -6,6 +6,7 @@ import { ACTION, ACTION_SUBJECT, CONTENT_COMPONENT, EVENT_TYPE, INPUT_METHOD } f
6
6
  import { Popup } from '@atlaskit/editor-common/ui';
7
7
  import { closestElement } from '@atlaskit/editor-common/utils';
8
8
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
9
+ import { akEditorTableCellOnStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
9
10
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
10
11
  import { TableMap } from '@atlaskit/editor-tables/table-map';
11
12
  import { findTable } from '@atlaskit/editor-tables/utils';
@@ -97,6 +98,12 @@ export class FloatingInsertButton extends React.Component {
97
98
  const tableWrapper = closestElement(targetCellRef, `.${ClassName.TABLE_NODE_WRAPPER}`);
98
99
  const index = type === 'column' ? insertColumnButtonIndex : insertRowButtonIndex;
99
100
  const hasNumberedColumns = checkIfNumberColumnEnabled(editorView.state.selection);
101
+
102
+ // ED-19336: Fixed the 'add column button' not visible issue when sticky header is enabled
103
+ // By setting the Popup z-index higher than the sticky header z-index ( common-styles.ts tr.sticky)
104
+ // Only when inserting a column, otherwise set to undefined
105
+ // Need to set z-index in the Popup, set z-index in the <InsertButton /> will not work
106
+ const zIndex = type === 'column' ? akEditorTableCellOnStickyHeaderZIndex : undefined;
100
107
  return /*#__PURE__*/React.createElement(Popup, _extends({
101
108
  target: targetCellRef,
102
109
  mountTo: tableContainerWrapper || mountPoint,
@@ -104,7 +111,9 @@ export class FloatingInsertButton extends React.Component {
104
111
  scrollableElement: tableWrapper,
105
112
  forcePlacement: true,
106
113
  allowOutOfBounds: true
107
- }, getPopupOptions(type, index, hasNumberedColumns, tableContainerWrapper)), /*#__PURE__*/React.createElement(InsertButton, {
114
+ }, getPopupOptions(type, index, hasNumberedColumns, tableContainerWrapper), {
115
+ zIndex: zIndex
116
+ }), /*#__PURE__*/React.createElement(InsertButton, {
108
117
  type: type,
109
118
  tableRef: tableRef,
110
119
  onMouseDown: type === 'column' ? this.insertColumn : this.insertRow,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.6.11",
3
+ "version": "2.6.13",
4
4
  "sideEffects": false
5
5
  }
@@ -438,6 +438,11 @@ export var TableRowNodeView = /*#__PURE__*/function () {
438
438
  return;
439
439
  }
440
440
  var table = _this4.tree.table;
441
+ if (table.rows.length < 2) {
442
+ // ED-19307 - When there's only one row in a table the top & bottom sentinels become inverted. This creates some nasty visiblity
443
+ // toggling side-effects because the intersection observers gets confused.
444
+ return;
445
+ }
441
446
  entries.forEach(function (entry) {
442
447
  var _entry$rootBounds;
443
448
  var target = entry.target;
@@ -14,6 +14,7 @@ import { ACTION, ACTION_SUBJECT, CONTENT_COMPONENT, EVENT_TYPE, INPUT_METHOD } f
14
14
  import { Popup } from '@atlaskit/editor-common/ui';
15
15
  import { closestElement } from '@atlaskit/editor-common/utils';
16
16
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
17
+ import { akEditorTableCellOnStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
17
18
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
18
19
  import { TableMap } from '@atlaskit/editor-tables/table-map';
19
20
  import { findTable } from '@atlaskit/editor-tables/utils';
@@ -107,6 +108,12 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
107
108
  var tableWrapper = closestElement(targetCellRef, ".".concat(ClassName.TABLE_NODE_WRAPPER));
108
109
  var index = type === 'column' ? insertColumnButtonIndex : insertRowButtonIndex;
109
110
  var hasNumberedColumns = checkIfNumberColumnEnabled(editorView.state.selection);
111
+
112
+ // ED-19336: Fixed the 'add column button' not visible issue when sticky header is enabled
113
+ // By setting the Popup z-index higher than the sticky header z-index ( common-styles.ts tr.sticky)
114
+ // Only when inserting a column, otherwise set to undefined
115
+ // Need to set z-index in the Popup, set z-index in the <InsertButton /> will not work
116
+ var zIndex = type === 'column' ? akEditorTableCellOnStickyHeaderZIndex : undefined;
110
117
  return /*#__PURE__*/React.createElement(Popup, _extends({
111
118
  target: targetCellRef,
112
119
  mountTo: tableContainerWrapper || mountPoint,
@@ -114,7 +121,9 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
114
121
  scrollableElement: tableWrapper,
115
122
  forcePlacement: true,
116
123
  allowOutOfBounds: true
117
- }, getPopupOptions(type, index, hasNumberedColumns, tableContainerWrapper)), /*#__PURE__*/React.createElement(InsertButton, {
124
+ }, getPopupOptions(type, index, hasNumberedColumns, tableContainerWrapper), {
125
+ zIndex: zIndex
126
+ }), /*#__PURE__*/React.createElement(InsertButton, {
118
127
  type: type,
119
128
  tableRef: tableRef,
120
129
  onMouseDown: type === 'column' ? this.insertColumn : this.insertRow,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.6.11",
3
+ "version": "2.6.13",
4
4
  "sideEffects": false
5
5
  }
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { IntlProvider } from 'react-intl-next';
4
4
 
5
5
  import Button from '@atlaskit/button/standard-button';
6
+ import type { CollabEditOptions } from '@atlaskit/editor-common/collab';
6
7
  import {
7
8
  createEditorExampleForTests,
8
9
  mapProvidersToProps,
@@ -11,7 +12,6 @@ import { getDefaultLinkPickerOptions } from '@atlaskit/editor-core/example-helpe
11
12
  import { TitleInput } from '@atlaskit/editor-core/example-helpers/PageElements';
12
13
  import { SaveAndCancelButtons } from '@atlaskit/editor-core/examples/5-full-page';
13
14
  import { ContextPanel, Editor } from '@atlaskit/editor-core/src';
14
- import { CollabEditOptions } from '@atlaskit/editor-core/src/plugins/collab-edit';
15
15
  import { customInsertMenuItems } from '@atlaskit/editor-test-helpers/mock-insert-menu';
16
16
  import { SmartCardProvider } from '@atlaskit/link-provider';
17
17
  import { AtlassianIcon } from '@atlaskit/logo/atlassian-icon';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.6.11",
3
+ "version": "2.6.13",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@atlaskit/adf-schema": "^28.0.0",
31
- "@atlaskit/editor-common": "^74.36.0",
31
+ "@atlaskit/editor-common": "^74.38.0",
32
32
  "@atlaskit/editor-palette": "1.5.1",
33
33
  "@atlaskit/editor-plugin-analytics": "^0.1.0",
34
34
  "@atlaskit/editor-plugin-content-insertion": "^0.0.7",
@@ -59,7 +59,7 @@
59
59
  "@atlaskit/editor-plugin-feature-flags": "^0.1.3",
60
60
  "@atlaskit/editor-plugin-grid": "^0.1.0",
61
61
  "@atlaskit/editor-plugin-guideline": "^0.3.4",
62
- "@atlaskit/editor-plugin-hyperlink": "^0.2.0",
62
+ "@atlaskit/editor-plugin-hyperlink": "^0.3.0",
63
63
  "@atlaskit/editor-plugin-width": "^0.1.0",
64
64
  "@atlaskit/editor-test-helpers": "^18.10.0",
65
65
  "@atlaskit/visual-regression": "*",
@@ -285,6 +285,13 @@ export class TableRowNodeView implements NodeView {
285
285
  return;
286
286
  }
287
287
  const { table } = this.tree;
288
+
289
+ if (table.rows.length < 2) {
290
+ // ED-19307 - When there's only one row in a table the top & bottom sentinels become inverted. This creates some nasty visiblity
291
+ // toggling side-effects because the intersection observers gets confused.
292
+ return;
293
+ }
294
+
288
295
  entries.forEach((entry) => {
289
296
  const target = entry.target as HTMLElement;
290
297
 
@@ -18,6 +18,7 @@ import { closestElement } from '@atlaskit/editor-common/utils';
18
18
  import { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
19
19
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
20
20
  import { EditorView } from '@atlaskit/editor-prosemirror/view';
21
+ import { akEditorTableCellOnStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
21
22
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
22
23
  import { TableMap } from '@atlaskit/editor-tables/table-map';
23
24
  import { findTable } from '@atlaskit/editor-tables/utils';
@@ -176,6 +177,13 @@ export class FloatingInsertButton extends React.Component<
176
177
  editorView.state.selection,
177
178
  );
178
179
 
180
+ // ED-19336: Fixed the 'add column button' not visible issue when sticky header is enabled
181
+ // By setting the Popup z-index higher than the sticky header z-index ( common-styles.ts tr.sticky)
182
+ // Only when inserting a column, otherwise set to undefined
183
+ // Need to set z-index in the Popup, set z-index in the <InsertButton /> will not work
184
+ const zIndex: number | undefined =
185
+ type === 'column' ? akEditorTableCellOnStickyHeaderZIndex : undefined;
186
+
179
187
  return (
180
188
  <Popup
181
189
  target={targetCellRef}
@@ -190,6 +198,7 @@ export class FloatingInsertButton extends React.Component<
190
198
  hasNumberedColumns,
191
199
  tableContainerWrapper,
192
200
  )}
201
+ zIndex={zIndex}
193
202
  >
194
203
  <InsertButton
195
204
  type={type}