@atlaskit/editor-plugin-table 2.6.12 → 2.7.0

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,21 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 2.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`960a2b478c8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/960a2b478c8) - [ux] [ED-19167] Add blue shadow to resizer handle on hover
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 2.6.13
14
+
15
+ ### Patch Changes
16
+
17
+ - [`8fe864e4f7a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8fe864e4f7a) - [ux] ED-19336: Fixed insert column button not visible when sticky header is enabled."
18
+
3
19
  ## 2.6.12
4
20
 
5
21
  ### Patch Changes
@@ -13,6 +13,7 @@ var _rafSchd = _interopRequireDefault(require("raf-schd"));
13
13
  var _analytics = require("@atlaskit/editor-common/analytics");
14
14
  var _guideline = require("@atlaskit/editor-common/guideline");
15
15
  var _resizer = require("@atlaskit/editor-common/resizer");
16
+ var _styles = require("@atlaskit/editor-common/styles");
16
17
  var _editorTables = require("@atlaskit/editor-tables");
17
18
  var _utils = require("@atlaskit/editor-tables/utils");
18
19
  var _utils2 = require("../pm-plugins/table-resizing/utils");
@@ -28,7 +29,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
28
29
  var handles = {
29
30
  right: true
30
31
  };
31
- var tableHandleMarginTop = 11;
32
+ var tableHandleMarginTop = 12;
32
33
  var generateResizedPayload = function generateResizedPayload(props) {
33
34
  var _props$originalNode$a;
34
35
  var tableMap = _editorTables.TableMap.get(props.resizedNode);
@@ -161,6 +162,22 @@ var TableResizer = function TableResizer(_ref) {
161
162
  var scheduleResize = (0, _react.useMemo)(function () {
162
163
  return (0, _rafSchd.default)(handleResize);
163
164
  }, [handleResize]);
165
+ var handleComponent = (0, _react.useMemo)(function () {
166
+ return {
167
+ left: /*#__PURE__*/_react.default.createElement("div", {
168
+ className: _styles.resizerHandleShadowClassName,
169
+ style: {
170
+ height: 'calc(100% - 24px)'
171
+ }
172
+ }),
173
+ right: /*#__PURE__*/_react.default.createElement("div", {
174
+ className: _styles.resizerHandleShadowClassName,
175
+ style: {
176
+ height: 'calc(100% - 24px)'
177
+ }
178
+ })
179
+ };
180
+ }, []);
164
181
  return /*#__PURE__*/_react.default.createElement(_resizer.ResizerNext, {
165
182
  enable: handles,
166
183
  width: width,
@@ -176,7 +193,8 @@ var TableResizer = function TableResizer(_ref) {
176
193
  snapGap: _consts.TABLE_SNAP_GAP,
177
194
  snap: guidelineSnaps,
178
195
  handlePositioning: "adjacent",
179
- isHandleVisible: ((_findTable = (0, _utils.findTable)((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos()
196
+ isHandleVisible: ((_findTable = (0, _utils.findTable)((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos(),
197
+ handleComponent: handleComponent
180
198
  }, children);
181
199
  };
182
200
  exports.TableResizer = TableResizer;
@@ -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.12",
3
+ "version": "2.7.0",
4
4
  "sideEffects": false
5
5
  }
@@ -3,6 +3,7 @@ import rafSchd from 'raf-schd';
3
3
  import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
4
4
  import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
5
5
  import { ResizerNext } from '@atlaskit/editor-common/resizer';
6
+ import { resizerHandleShadowClassName } from '@atlaskit/editor-common/styles';
6
7
  import { TableMap } from '@atlaskit/editor-tables';
7
8
  import { findTable } from '@atlaskit/editor-tables/utils';
8
9
  import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, hasTableBeenResized, previewScaleTable, scaleTable } from '../pm-plugins/table-resizing/utils';
@@ -14,7 +15,7 @@ import { findClosestSnap } from '../utils/snapping';
14
15
  const handles = {
15
16
  right: true
16
17
  };
17
- const tableHandleMarginTop = 11;
18
+ const tableHandleMarginTop = 12;
18
19
  const generateResizedPayload = props => {
19
20
  var _props$originalNode$a;
20
21
  const tableMap = TableMap.get(props.resizedNode);
@@ -149,6 +150,20 @@ export const TableResizer = ({
149
150
  return newWidth;
150
151
  }, [editorView, getPos, node, tableRef, updateWidth, updateActiveGuidelines]);
151
152
  const scheduleResize = useMemo(() => rafSchd(handleResize), [handleResize]);
153
+ const handleComponent = useMemo(() => ({
154
+ left: /*#__PURE__*/React.createElement("div", {
155
+ className: resizerHandleShadowClassName,
156
+ style: {
157
+ height: 'calc(100% - 24px)'
158
+ }
159
+ }),
160
+ right: /*#__PURE__*/React.createElement("div", {
161
+ className: resizerHandleShadowClassName,
162
+ style: {
163
+ height: 'calc(100% - 24px)'
164
+ }
165
+ })
166
+ }), []);
152
167
  return /*#__PURE__*/React.createElement(ResizerNext, {
153
168
  enable: handles,
154
169
  width: width,
@@ -164,6 +179,7 @@ export const TableResizer = ({
164
179
  snapGap: TABLE_SNAP_GAP,
165
180
  snap: guidelineSnaps,
166
181
  handlePositioning: "adjacent",
167
- isHandleVisible: ((_findTable = findTable((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos()
182
+ isHandleVisible: ((_findTable = findTable((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos(),
183
+ handleComponent: handleComponent
168
184
  }, children);
169
185
  };
@@ -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.12",
3
+ "version": "2.7.0",
4
4
  "sideEffects": false
5
5
  }
@@ -7,6 +7,7 @@ import rafSchd from 'raf-schd';
7
7
  import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
8
8
  import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
9
9
  import { ResizerNext } from '@atlaskit/editor-common/resizer';
10
+ import { resizerHandleShadowClassName } from '@atlaskit/editor-common/styles';
10
11
  import { TableMap } from '@atlaskit/editor-tables';
11
12
  import { findTable } from '@atlaskit/editor-tables/utils';
12
13
  import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, hasTableBeenResized, previewScaleTable, scaleTable } from '../pm-plugins/table-resizing/utils';
@@ -18,7 +19,7 @@ import { findClosestSnap } from '../utils/snapping';
18
19
  var handles = {
19
20
  right: true
20
21
  };
21
- var tableHandleMarginTop = 11;
22
+ var tableHandleMarginTop = 12;
22
23
  var generateResizedPayload = function generateResizedPayload(props) {
23
24
  var _props$originalNode$a;
24
25
  var tableMap = TableMap.get(props.resizedNode);
@@ -151,6 +152,22 @@ export var TableResizer = function TableResizer(_ref) {
151
152
  var scheduleResize = useMemo(function () {
152
153
  return rafSchd(handleResize);
153
154
  }, [handleResize]);
155
+ var handleComponent = useMemo(function () {
156
+ return {
157
+ left: /*#__PURE__*/React.createElement("div", {
158
+ className: resizerHandleShadowClassName,
159
+ style: {
160
+ height: 'calc(100% - 24px)'
161
+ }
162
+ }),
163
+ right: /*#__PURE__*/React.createElement("div", {
164
+ className: resizerHandleShadowClassName,
165
+ style: {
166
+ height: 'calc(100% - 24px)'
167
+ }
168
+ })
169
+ };
170
+ }, []);
154
171
  return /*#__PURE__*/React.createElement(ResizerNext, {
155
172
  enable: handles,
156
173
  width: width,
@@ -166,6 +183,7 @@ export var TableResizer = function TableResizer(_ref) {
166
183
  snapGap: TABLE_SNAP_GAP,
167
184
  snap: guidelineSnaps,
168
185
  handlePositioning: "adjacent",
169
- isHandleVisible: ((_findTable = findTable((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos()
186
+ isHandleVisible: ((_findTable = findTable((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos(),
187
+ handleComponent: handleComponent
170
188
  }, children);
171
189
  };
@@ -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.12",
3
+ "version": "2.7.0",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.6.12",
3
+ "version": "2.7.0",
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.38.0",
31
+ "@atlaskit/editor-common": "^74.40.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",
@@ -21,6 +21,7 @@ import {
21
21
  HandleResize,
22
22
  ResizerNext,
23
23
  } from '@atlaskit/editor-common/resizer';
24
+ import { resizerHandleShadowClassName } from '@atlaskit/editor-common/styles';
24
25
  import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
25
26
  import { Transaction } from '@atlaskit/editor-prosemirror/state';
26
27
  import { EditorView } from '@atlaskit/editor-prosemirror/view';
@@ -54,7 +55,7 @@ interface TableResizerProps {
54
55
  }
55
56
 
56
57
  const handles = { right: true };
57
- const tableHandleMarginTop = 11;
58
+ const tableHandleMarginTop = 12;
58
59
 
59
60
  const generateResizedPayload = (props: {
60
61
  originalNode: PMNode;
@@ -258,6 +259,24 @@ export const TableResizer = ({
258
259
 
259
260
  const scheduleResize = useMemo(() => rafSchd(handleResize), [handleResize]);
260
261
 
262
+ const handleComponent = useMemo(
263
+ () => ({
264
+ left: (
265
+ <div
266
+ className={resizerHandleShadowClassName}
267
+ style={{ height: 'calc(100% - 24px)' }}
268
+ />
269
+ ),
270
+ right: (
271
+ <div
272
+ className={resizerHandleShadowClassName}
273
+ style={{ height: 'calc(100% - 24px)' }}
274
+ />
275
+ ),
276
+ }),
277
+ [],
278
+ );
279
+
261
280
  return (
262
281
  <ResizerNext
263
282
  enable={handles}
@@ -275,6 +294,7 @@ export const TableResizer = ({
275
294
  snap={guidelineSnaps}
276
295
  handlePositioning="adjacent"
277
296
  isHandleVisible={findTable(editorView.state?.selection)?.pos === getPos()}
297
+ handleComponent={handleComponent}
278
298
  >
279
299
  {children}
280
300
  </ResizerNext>
@@ -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}