@atlaskit/editor-plugin-table 7.24.6 → 7.24.8

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,22 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.24.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [#127766](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/127766)
8
+ [`8a9803d7d9555`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8a9803d7d9555) -
9
+ ED-24425: Fixed the drag handle show hover state when hover delete column on the next column/row
10
+
11
+ ## 7.24.7
12
+
13
+ ### Patch Changes
14
+
15
+ - [#127699](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/127699)
16
+ [`7fa3a110dc3b6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7fa3a110dc3b6) -
17
+ Add analytics to track usage of dark mode header cell fix.
18
+ - Updated dependencies
19
+
3
20
  ## 7.24.6
4
21
 
5
22
  ### Patch Changes
@@ -14,6 +14,7 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
14
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
16
  var _adfSchema = require("@atlaskit/adf-schema");
17
+ var _analytics = require("@atlaskit/editor-common/analytics");
17
18
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
19
  var _TableNodeViewBase = _interopRequireDefault(require("./TableNodeViewBase"));
19
20
  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); }; }
@@ -45,7 +46,7 @@ var cssVariablePattern = /^VAR\(--.*\)$/;
45
46
  var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
46
47
  (0, _inherits2.default)(TableCell, _TableNodeView);
47
48
  var _super = _createSuper(TableCell);
48
- function TableCell(node, view, getPos, eventDispatcher) {
49
+ function TableCell(node, view, getPos, eventDispatcher, editorAnalyticsAPI) {
49
50
  var _this;
50
51
  (0, _classCallCheck2.default)(this, TableCell);
51
52
  _this = _super.call(this, node, view, getPos, eventDispatcher);
@@ -72,9 +73,17 @@ var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
72
73
  _this.delayHandle = delayUntilIdle(function () {
73
74
  var pos = getPos();
74
75
  if (pos) {
75
- view.dispatch(view.state.tr.setNodeAttribute(pos, 'background', node.attrs.background.toLowerCase())
76
+ var tr = view.state.tr;
77
+ tr.setNodeAttribute(pos, 'background', node.attrs.background.toLowerCase())
76
78
  // Ensures dispatch does not contribute to undo history (otherwise user requires multiple undo's to revert table)
77
- .setMeta('addToHistory', false));
79
+ .setMeta('addToHistory', false);
80
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
81
+ action: _analytics.TABLE_ACTION.TABLE_CELL_BACKGROUND_FIXED,
82
+ actionSubject: _analytics.ACTION_SUBJECT.TABLE,
83
+ actionSubjectId: null,
84
+ eventType: _analytics.EVENT_TYPE.TRACK
85
+ })(tr);
86
+ view.dispatch(tr);
78
87
  }
79
88
  });
80
89
  }
@@ -52,7 +52,8 @@ var lazyTableView = exports.lazyTableView = function lazyTableView(options) {
52
52
  var lazyTableCellView = exports.lazyTableCellView = function lazyTableCellView(options) {
53
53
  if (!(0, _platformFeatureFlags.fg)('platform_editor_lazy-node-views')) {
54
54
  return function (node, view, getPos) {
55
- return new _TableCell.default(node, view, getPos, options.eventDispatcher);
55
+ var _options$pluginInject;
56
+ return new _TableCell.default(node, view, getPos, options.eventDispatcher, (_options$pluginInject = options.pluginInjectionApi) === null || _options$pluginInject === void 0 || (_options$pluginInject = _options$pluginInject.analytics) === null || _options$pluginInject === void 0 ? void 0 : _options$pluginInject.actions);
56
57
  };
57
58
  }
58
59
  var loader = function loader() {
@@ -62,9 +63,11 @@ var lazyTableCellView = exports.lazyTableCellView = function lazyTableCellView(o
62
63
  }).then(function (_ref2) {
63
64
  var TableCell = _ref2.default;
64
65
  return function (node, view, getPos, decorations, getNodeViewOptions) {
66
+ var _pluginInjectionApi$a;
65
67
  var _getNodeViewOptions2 = getNodeViewOptions(),
66
- eventDispatcher = _getNodeViewOptions2.eventDispatcher;
67
- return new TableCell(node, view, getPos, eventDispatcher);
68
+ eventDispatcher = _getNodeViewOptions2.eventDispatcher,
69
+ pluginInjectionApi = _getNodeViewOptions2.pluginInjectionApi;
70
+ return new TableCell(node, view, getPos, eventDispatcher, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions);
68
71
  };
69
72
  });
70
73
  return result;
@@ -80,7 +83,8 @@ var lazyTableCellView = exports.lazyTableCellView = function lazyTableCellView(o
80
83
  var lazyTableHeaderView = exports.lazyTableHeaderView = function lazyTableHeaderView(options) {
81
84
  if (!(0, _platformFeatureFlags.fg)('platform_editor_lazy-node-views')) {
82
85
  return function (node, view, getPos) {
83
- return new _TableCell.default(node, view, getPos, options.eventDispatcher);
86
+ var _options$pluginInject2;
87
+ return new _TableCell.default(node, view, getPos, options.eventDispatcher, (_options$pluginInject2 = options.pluginInjectionApi) === null || _options$pluginInject2 === void 0 || (_options$pluginInject2 = _options$pluginInject2.analytics) === null || _options$pluginInject2 === void 0 ? void 0 : _options$pluginInject2.actions);
84
88
  };
85
89
  }
86
90
  var loader = function loader() {
@@ -90,9 +94,11 @@ var lazyTableHeaderView = exports.lazyTableHeaderView = function lazyTableHeader
90
94
  }).then(function (_ref3) {
91
95
  var TableCell = _ref3.default;
92
96
  return function (node, view, getPos, decorations, getNodeViewOptions) {
97
+ var _pluginInjectionApi$a2;
93
98
  var _getNodeViewOptions3 = getNodeViewOptions(),
94
- eventDispatcher = _getNodeViewOptions3.eventDispatcher;
95
- return new TableCell(node, view, getPos, eventDispatcher);
99
+ eventDispatcher = _getNodeViewOptions3.eventDispatcher,
100
+ pluginInjectionApi = _getNodeViewOptions3.pluginInjectionApi;
101
+ return new TableCell(node, view, getPos, eventDispatcher, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions);
96
102
  };
97
103
  });
98
104
  return result;
@@ -267,10 +267,12 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
267
267
  eventDispatcher: eventDispatcher
268
268
  }),
269
269
  tableCell: (0, _lazyNodeViews.lazyTableCellView)({
270
- eventDispatcher: eventDispatcher
270
+ eventDispatcher: eventDispatcher,
271
+ pluginInjectionApi: pluginInjectionApi
271
272
  }),
272
273
  tableHeader: (0, _lazyNodeViews.lazyTableHeaderView)({
273
- eventDispatcher: eventDispatcher
274
+ eventDispatcher: eventDispatcher,
275
+ pluginInjectionApi: pluginInjectionApi
274
276
  })
275
277
  },
276
278
  handleDOMEvents: {
@@ -60,8 +60,11 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
60
60
  isDragMenuOpen = _getDnDPluginState.isDragMenuOpen;
61
61
  var isRow = direction === 'row';
62
62
  var isColumn = direction === 'column';
63
- var isRowHandleHovered = isRow && hoveredRows.length > 0;
64
- var isColumnHandleHovered = isColumn && hoveredColumns.length > 0;
63
+
64
+ // Added !isDragMenuOpen check so when hover 'Delete column/row' from drag menu
65
+ // the handle of the next column/row does not show the 'hovered' state icon
66
+ var isRowHandleHovered = isRow && hoveredRows.length > 0 && !isDragMenuOpen;
67
+ var isColumnHandleHovered = isColumn && hoveredColumns.length > 0 && !isDragMenuOpen;
65
68
  var hasMergedCells = (0, _react.useMemo)(function () {
66
69
  var table = (0, _editorTables.findTable)(selection);
67
70
  if (!table) {
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { getCellAttrs, getCellDomAttrs } from '@atlaskit/adf-schema';
3
+ import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
3
4
  import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import TableNodeView from './TableNodeViewBase';
5
6
  const DEFAULT_COL_SPAN = 1;
@@ -23,7 +24,7 @@ function delayUntilIdle(cb) {
23
24
  }
24
25
  const cssVariablePattern = /^VAR\(--.*\)$/;
25
26
  export default class TableCell extends TableNodeView {
26
- constructor(node, view, getPos, eventDispatcher) {
27
+ constructor(node, view, getPos, eventDispatcher, editorAnalyticsAPI) {
27
28
  super(node, view, getPos, eventDispatcher);
28
29
 
29
30
  // CONFCLOUD-78239: Previously we had a bug which tried to invert the heading colour of a table
@@ -48,9 +49,17 @@ export default class TableCell extends TableNodeView {
48
49
  this.delayHandle = delayUntilIdle(() => {
49
50
  const pos = getPos();
50
51
  if (pos) {
51
- view.dispatch(view.state.tr.setNodeAttribute(pos, 'background', node.attrs.background.toLowerCase())
52
+ const tr = view.state.tr;
53
+ tr.setNodeAttribute(pos, 'background', node.attrs.background.toLowerCase())
52
54
  // Ensures dispatch does not contribute to undo history (otherwise user requires multiple undo's to revert table)
53
- .setMeta('addToHistory', false));
55
+ .setMeta('addToHistory', false);
56
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
57
+ action: TABLE_ACTION.TABLE_CELL_BACKGROUND_FIXED,
58
+ actionSubject: ACTION_SUBJECT.TABLE,
59
+ actionSubjectId: null,
60
+ eventType: EVENT_TYPE.TRACK
61
+ })(tr);
62
+ view.dispatch(tr);
54
63
  }
55
64
  });
56
65
  }
@@ -41,7 +41,8 @@ export const lazyTableView = options => {
41
41
  export const lazyTableCellView = options => {
42
42
  if (!fg('platform_editor_lazy-node-views')) {
43
43
  return (node, view, getPos) => {
44
- return new TableCell(node, view, getPos, options.eventDispatcher);
44
+ var _options$pluginInject, _options$pluginInject2;
45
+ return new TableCell(node, view, getPos, options.eventDispatcher, (_options$pluginInject = options.pluginInjectionApi) === null || _options$pluginInject === void 0 ? void 0 : (_options$pluginInject2 = _options$pluginInject.analytics) === null || _options$pluginInject2 === void 0 ? void 0 : _options$pluginInject2.actions);
45
46
  };
46
47
  }
47
48
  const loader = () => {
@@ -50,10 +51,12 @@ export const lazyTableCellView = options => {
50
51
  default: TableCell
51
52
  }) => {
52
53
  return (node, view, getPos, decorations, getNodeViewOptions) => {
54
+ var _pluginInjectionApi$a;
53
55
  const {
54
- eventDispatcher
56
+ eventDispatcher,
57
+ pluginInjectionApi
55
58
  } = getNodeViewOptions();
56
- return new TableCell(node, view, getPos, eventDispatcher);
59
+ return new TableCell(node, view, getPos, eventDispatcher, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions);
57
60
  };
58
61
  });
59
62
  return result;
@@ -67,7 +70,8 @@ export const lazyTableCellView = options => {
67
70
  export const lazyTableHeaderView = options => {
68
71
  if (!fg('platform_editor_lazy-node-views')) {
69
72
  return (node, view, getPos) => {
70
- return new TableCell(node, view, getPos, options.eventDispatcher);
73
+ var _options$pluginInject3, _options$pluginInject4;
74
+ return new TableCell(node, view, getPos, options.eventDispatcher, (_options$pluginInject3 = options.pluginInjectionApi) === null || _options$pluginInject3 === void 0 ? void 0 : (_options$pluginInject4 = _options$pluginInject3.analytics) === null || _options$pluginInject4 === void 0 ? void 0 : _options$pluginInject4.actions);
71
75
  };
72
76
  }
73
77
  const loader = () => {
@@ -76,10 +80,12 @@ export const lazyTableHeaderView = options => {
76
80
  default: TableCell
77
81
  }) => {
78
82
  return (node, view, getPos, decorations, getNodeViewOptions) => {
83
+ var _pluginInjectionApi$a2;
79
84
  const {
80
- eventDispatcher
85
+ eventDispatcher,
86
+ pluginInjectionApi
81
87
  } = getNodeViewOptions();
82
- return new TableCell(node, view, getPos, eventDispatcher);
88
+ return new TableCell(node, view, getPos, eventDispatcher, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions);
83
89
  };
84
90
  });
85
91
  return result;
@@ -265,10 +265,12 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
265
265
  eventDispatcher
266
266
  }),
267
267
  tableCell: lazyTableCellView({
268
- eventDispatcher
268
+ eventDispatcher,
269
+ pluginInjectionApi
269
270
  }),
270
271
  tableHeader: lazyTableHeaderView({
271
- eventDispatcher
272
+ eventDispatcher,
273
+ pluginInjectionApi
272
274
  })
273
275
  },
274
276
  handleDOMEvents: {
@@ -51,8 +51,11 @@ const DragHandleComponent = ({
51
51
  } = getDnDPluginState(state);
52
52
  const isRow = direction === 'row';
53
53
  const isColumn = direction === 'column';
54
- const isRowHandleHovered = isRow && hoveredRows.length > 0;
55
- const isColumnHandleHovered = isColumn && hoveredColumns.length > 0;
54
+
55
+ // Added !isDragMenuOpen check so when hover 'Delete column/row' from drag menu
56
+ // the handle of the next column/row does not show the 'hovered' state icon
57
+ const isRowHandleHovered = isRow && hoveredRows.length > 0 && !isDragMenuOpen;
58
+ const isColumnHandleHovered = isColumn && hoveredColumns.length > 0 && !isDragMenuOpen;
56
59
  const hasMergedCells = useMemo(() => {
57
60
  const table = findTable(selection);
58
61
  if (!table) {
@@ -9,6 +9,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
9
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
11
  import { getCellAttrs, getCellDomAttrs } from '@atlaskit/adf-schema';
12
+ import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
12
13
  import { fg } from '@atlaskit/platform-feature-flags';
13
14
  import TableNodeView from './TableNodeViewBase';
14
15
  var DEFAULT_COL_SPAN = 1;
@@ -38,7 +39,7 @@ var cssVariablePattern = /^VAR\(--.*\)$/;
38
39
  var TableCell = /*#__PURE__*/function (_TableNodeView) {
39
40
  _inherits(TableCell, _TableNodeView);
40
41
  var _super = _createSuper(TableCell);
41
- function TableCell(node, view, getPos, eventDispatcher) {
42
+ function TableCell(node, view, getPos, eventDispatcher, editorAnalyticsAPI) {
42
43
  var _this;
43
44
  _classCallCheck(this, TableCell);
44
45
  _this = _super.call(this, node, view, getPos, eventDispatcher);
@@ -65,9 +66,17 @@ var TableCell = /*#__PURE__*/function (_TableNodeView) {
65
66
  _this.delayHandle = delayUntilIdle(function () {
66
67
  var pos = getPos();
67
68
  if (pos) {
68
- view.dispatch(view.state.tr.setNodeAttribute(pos, 'background', node.attrs.background.toLowerCase())
69
+ var tr = view.state.tr;
70
+ tr.setNodeAttribute(pos, 'background', node.attrs.background.toLowerCase())
69
71
  // Ensures dispatch does not contribute to undo history (otherwise user requires multiple undo's to revert table)
70
- .setMeta('addToHistory', false));
72
+ .setMeta('addToHistory', false);
73
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
74
+ action: TABLE_ACTION.TABLE_CELL_BACKGROUND_FIXED,
75
+ actionSubject: ACTION_SUBJECT.TABLE,
76
+ actionSubjectId: null,
77
+ eventType: EVENT_TYPE.TRACK
78
+ })(tr);
79
+ view.dispatch(tr);
71
80
  }
72
81
  });
73
82
  }
@@ -41,7 +41,8 @@ export var lazyTableView = function lazyTableView(options) {
41
41
  export var lazyTableCellView = function lazyTableCellView(options) {
42
42
  if (!fg('platform_editor_lazy-node-views')) {
43
43
  return function (node, view, getPos) {
44
- return new TableCell(node, view, getPos, options.eventDispatcher);
44
+ var _options$pluginInject;
45
+ return new TableCell(node, view, getPos, options.eventDispatcher, (_options$pluginInject = options.pluginInjectionApi) === null || _options$pluginInject === void 0 || (_options$pluginInject = _options$pluginInject.analytics) === null || _options$pluginInject === void 0 ? void 0 : _options$pluginInject.actions);
45
46
  };
46
47
  }
47
48
  var loader = function loader() {
@@ -49,9 +50,11 @@ export var lazyTableCellView = function lazyTableCellView(options) {
49
50
  './TableCell').then(function (_ref2) {
50
51
  var TableCell = _ref2.default;
51
52
  return function (node, view, getPos, decorations, getNodeViewOptions) {
53
+ var _pluginInjectionApi$a;
52
54
  var _getNodeViewOptions2 = getNodeViewOptions(),
53
- eventDispatcher = _getNodeViewOptions2.eventDispatcher;
54
- return new TableCell(node, view, getPos, eventDispatcher);
55
+ eventDispatcher = _getNodeViewOptions2.eventDispatcher,
56
+ pluginInjectionApi = _getNodeViewOptions2.pluginInjectionApi;
57
+ return new TableCell(node, view, getPos, eventDispatcher, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions);
55
58
  };
56
59
  });
57
60
  return result;
@@ -67,7 +70,8 @@ export var lazyTableCellView = function lazyTableCellView(options) {
67
70
  export var lazyTableHeaderView = function lazyTableHeaderView(options) {
68
71
  if (!fg('platform_editor_lazy-node-views')) {
69
72
  return function (node, view, getPos) {
70
- return new TableCell(node, view, getPos, options.eventDispatcher);
73
+ var _options$pluginInject2;
74
+ return new TableCell(node, view, getPos, options.eventDispatcher, (_options$pluginInject2 = options.pluginInjectionApi) === null || _options$pluginInject2 === void 0 || (_options$pluginInject2 = _options$pluginInject2.analytics) === null || _options$pluginInject2 === void 0 ? void 0 : _options$pluginInject2.actions);
71
75
  };
72
76
  }
73
77
  var loader = function loader() {
@@ -75,9 +79,11 @@ export var lazyTableHeaderView = function lazyTableHeaderView(options) {
75
79
  './TableCell').then(function (_ref3) {
76
80
  var TableCell = _ref3.default;
77
81
  return function (node, view, getPos, decorations, getNodeViewOptions) {
82
+ var _pluginInjectionApi$a2;
78
83
  var _getNodeViewOptions3 = getNodeViewOptions(),
79
- eventDispatcher = _getNodeViewOptions3.eventDispatcher;
80
- return new TableCell(node, view, getPos, eventDispatcher);
84
+ eventDispatcher = _getNodeViewOptions3.eventDispatcher,
85
+ pluginInjectionApi = _getNodeViewOptions3.pluginInjectionApi;
86
+ return new TableCell(node, view, getPos, eventDispatcher, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions);
81
87
  };
82
88
  });
83
89
  return result;
@@ -260,10 +260,12 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
260
260
  eventDispatcher: eventDispatcher
261
261
  }),
262
262
  tableCell: lazyTableCellView({
263
- eventDispatcher: eventDispatcher
263
+ eventDispatcher: eventDispatcher,
264
+ pluginInjectionApi: pluginInjectionApi
264
265
  }),
265
266
  tableHeader: lazyTableHeaderView({
266
- eventDispatcher: eventDispatcher
267
+ eventDispatcher: eventDispatcher,
268
+ pluginInjectionApi: pluginInjectionApi
267
269
  })
268
270
  },
269
271
  handleDOMEvents: {
@@ -50,8 +50,11 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
50
50
  isDragMenuOpen = _getDnDPluginState.isDragMenuOpen;
51
51
  var isRow = direction === 'row';
52
52
  var isColumn = direction === 'column';
53
- var isRowHandleHovered = isRow && hoveredRows.length > 0;
54
- var isColumnHandleHovered = isColumn && hoveredColumns.length > 0;
53
+
54
+ // Added !isDragMenuOpen check so when hover 'Delete column/row' from drag menu
55
+ // the handle of the next column/row does not show the 'hovered' state icon
56
+ var isRowHandleHovered = isRow && hoveredRows.length > 0 && !isDragMenuOpen;
57
+ var isColumnHandleHovered = isColumn && hoveredColumns.length > 0 && !isDragMenuOpen;
55
58
  var hasMergedCells = useMemo(function () {
56
59
  var table = findTable(selection);
57
60
  if (!table) {
@@ -1,10 +1,11 @@
1
+ import { type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
1
2
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
2
3
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
4
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
4
5
  import TableNodeView from './TableNodeViewBase';
5
6
  export default class TableCell extends TableNodeView<HTMLElement> implements NodeView {
6
7
  private delayHandle;
7
- constructor(node: PMNode, view: EditorView, getPos: () => number | undefined, eventDispatcher: EventDispatcher);
8
+ constructor(node: PMNode, view: EditorView, getPos: () => number | undefined, eventDispatcher: EventDispatcher, editorAnalyticsAPI: EditorAnalyticsAPI | undefined);
8
9
  destroy: () => void;
9
10
  update(node: PMNode): boolean;
10
11
  private updateNodeView;
@@ -21,6 +21,7 @@ type TableViewOptions = {
21
21
  export declare const lazyTableView: (options: TableViewOptions) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor;
22
22
  type TableCellViewOptions = {
23
23
  eventDispatcher: EventDispatcher;
24
+ pluginInjectionApi?: PluginInjectionAPI;
24
25
  };
25
26
  export declare const lazyTableCellView: (options: TableCellViewOptions) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor | ((node: PMNode, view: EditorView, getPos: () => number | undefined) => TableCell);
26
27
  export declare const lazyTableHeaderView: (options: TableCellViewOptions) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor | ((node: PMNode, view: EditorView, getPos: () => number | undefined) => TableCell);
@@ -1,10 +1,11 @@
1
+ import { type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
1
2
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
2
3
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
4
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
4
5
  import TableNodeView from './TableNodeViewBase';
5
6
  export default class TableCell extends TableNodeView<HTMLElement> implements NodeView {
6
7
  private delayHandle;
7
- constructor(node: PMNode, view: EditorView, getPos: () => number | undefined, eventDispatcher: EventDispatcher);
8
+ constructor(node: PMNode, view: EditorView, getPos: () => number | undefined, eventDispatcher: EventDispatcher, editorAnalyticsAPI: EditorAnalyticsAPI | undefined);
8
9
  destroy: () => void;
9
10
  update(node: PMNode): boolean;
10
11
  private updateNodeView;
@@ -21,6 +21,7 @@ type TableViewOptions = {
21
21
  export declare const lazyTableView: (options: TableViewOptions) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor;
22
22
  type TableCellViewOptions = {
23
23
  eventDispatcher: EventDispatcher;
24
+ pluginInjectionApi?: PluginInjectionAPI;
24
25
  };
25
26
  export declare const lazyTableCellView: (options: TableCellViewOptions) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor | ((node: PMNode, view: EditorView, getPos: () => number | undefined) => TableCell);
26
27
  export declare const lazyTableHeaderView: (options: TableCellViewOptions) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor | ((node: PMNode, view: EditorView, getPos: () => number | undefined) => TableCell);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.24.6",
3
+ "version": "7.24.8",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/adf-schema": "^40.3.0",
32
32
  "@atlaskit/button": "^19.1.0",
33
33
  "@atlaskit/custom-steps": "^0.6.0",
34
- "@atlaskit/editor-common": "^87.4.0",
34
+ "@atlaskit/editor-common": "^87.5.0",
35
35
  "@atlaskit/editor-palette": "1.6.0",
36
36
  "@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.6.0",
@@ -44,7 +44,7 @@
44
44
  "@atlaskit/editor-shared-styles": "^2.13.0",
45
45
  "@atlaskit/editor-tables": "^2.8.0",
46
46
  "@atlaskit/icon": "^22.10.0",
47
- "@atlaskit/menu": "^2.9.0",
47
+ "@atlaskit/menu": "^2.10.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.3.0",
49
49
  "@atlaskit/pragmatic-drag-and-drop": "^1.2.0",
50
50
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.4.0",
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/theme": "^12.11.0",
54
54
  "@atlaskit/toggle": "^13.2.0",
55
55
  "@atlaskit/tokens": "^1.57.0",
56
- "@atlaskit/tooltip": "^18.5.0",
56
+ "@atlaskit/tooltip": "^18.6.0",
57
57
  "@babel/runtime": "^7.0.0",
58
58
  "@emotion/react": "^11.7.1",
59
59
  "classnames": "^2.2.5",
@@ -1,5 +1,11 @@
1
1
  import type { CellDomAttrs } from '@atlaskit/adf-schema';
2
2
  import { getCellAttrs, getCellDomAttrs } from '@atlaskit/adf-schema';
3
+ import {
4
+ ACTION_SUBJECT,
5
+ type EditorAnalyticsAPI,
6
+ EVENT_TYPE,
7
+ TABLE_ACTION,
8
+ } from '@atlaskit/editor-common/analytics';
3
9
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
4
10
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
5
11
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
@@ -35,6 +41,7 @@ export default class TableCell extends TableNodeView<HTMLElement> implements Nod
35
41
  view: EditorView,
36
42
  getPos: () => number | undefined,
37
43
  eventDispatcher: EventDispatcher,
44
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
38
45
  ) {
39
46
  super(node, view, getPos, eventDispatcher);
40
47
 
@@ -55,12 +62,17 @@ export default class TableCell extends TableNodeView<HTMLElement> implements Nod
55
62
  this.delayHandle = delayUntilIdle(() => {
56
63
  const pos = getPos();
57
64
  if (pos) {
58
- view.dispatch(
59
- view.state.tr
60
- .setNodeAttribute(pos, 'background', node.attrs.background.toLowerCase())
61
- // Ensures dispatch does not contribute to undo history (otherwise user requires multiple undo's to revert table)
62
- .setMeta('addToHistory', false),
63
- );
65
+ const tr = view.state.tr;
66
+ tr.setNodeAttribute(pos, 'background', node.attrs.background.toLowerCase())
67
+ // Ensures dispatch does not contribute to undo history (otherwise user requires multiple undo's to revert table)
68
+ .setMeta('addToHistory', false);
69
+ editorAnalyticsAPI?.attachAnalyticsEvent({
70
+ action: TABLE_ACTION.TABLE_CELL_BACKGROUND_FIXED,
71
+ actionSubject: ACTION_SUBJECT.TABLE,
72
+ actionSubjectId: null,
73
+ eventType: EVENT_TYPE.TRACK,
74
+ })(tr);
75
+ view.dispatch(tr);
64
76
  }
65
77
  });
66
78
  }
@@ -98,11 +98,18 @@ export const lazyTableView = (options: TableViewOptions) => {
98
98
 
99
99
  type TableCellViewOptions = {
100
100
  eventDispatcher: EventDispatcher;
101
+ pluginInjectionApi?: PluginInjectionAPI;
101
102
  };
102
103
  export const lazyTableCellView = (options: TableCellViewOptions) => {
103
104
  if (!fg('platform_editor_lazy-node-views')) {
104
105
  return (node: PMNode, view: EditorView, getPos: () => number | undefined) => {
105
- return new TableCell(node, view, getPos, options.eventDispatcher);
106
+ return new TableCell(
107
+ node,
108
+ view,
109
+ getPos,
110
+ options.eventDispatcher,
111
+ options.pluginInjectionApi?.analytics?.actions,
112
+ );
106
113
  };
107
114
  }
108
115
 
@@ -118,9 +125,15 @@ export const lazyTableCellView = (options: TableCellViewOptions) => {
118
125
  decorations: readonly Decoration[],
119
126
  getNodeViewOptions: () => TableCellViewOptions,
120
127
  ) => {
121
- const { eventDispatcher } = getNodeViewOptions();
128
+ const { eventDispatcher, pluginInjectionApi } = getNodeViewOptions();
122
129
 
123
- return new TableCell(node, view, getPos, eventDispatcher);
130
+ return new TableCell(
131
+ node,
132
+ view,
133
+ getPos,
134
+ eventDispatcher,
135
+ pluginInjectionApi?.analytics?.actions,
136
+ );
124
137
  };
125
138
  });
126
139
 
@@ -137,7 +150,13 @@ export const lazyTableCellView = (options: TableCellViewOptions) => {
137
150
  export const lazyTableHeaderView = (options: TableCellViewOptions) => {
138
151
  if (!fg('platform_editor_lazy-node-views')) {
139
152
  return (node: PMNode, view: EditorView, getPos: () => number | undefined) => {
140
- return new TableCell(node, view, getPos, options.eventDispatcher);
153
+ return new TableCell(
154
+ node,
155
+ view,
156
+ getPos,
157
+ options.eventDispatcher,
158
+ options.pluginInjectionApi?.analytics?.actions,
159
+ );
141
160
  };
142
161
  }
143
162
 
@@ -153,9 +172,15 @@ export const lazyTableHeaderView = (options: TableCellViewOptions) => {
153
172
  decorations: readonly Decoration[],
154
173
  getNodeViewOptions: () => TableCellViewOptions,
155
174
  ) => {
156
- const { eventDispatcher } = getNodeViewOptions();
175
+ const { eventDispatcher, pluginInjectionApi } = getNodeViewOptions();
157
176
 
158
- return new TableCell(node, view, getPos, eventDispatcher);
177
+ return new TableCell(
178
+ node,
179
+ view,
180
+ getPos,
181
+ eventDispatcher,
182
+ pluginInjectionApi?.analytics?.actions,
183
+ );
159
184
  };
160
185
  });
161
186
 
@@ -364,8 +364,8 @@ export const createPlugin = (
364
364
  isChromelessEditor,
365
365
  }),
366
366
  tableRow: lazyTableRowView({ eventDispatcher }),
367
- tableCell: lazyTableCellView({ eventDispatcher }),
368
- tableHeader: lazyTableHeaderView({ eventDispatcher }),
367
+ tableCell: lazyTableCellView({ eventDispatcher, pluginInjectionApi }),
368
+ tableHeader: lazyTableHeaderView({ eventDispatcher, pluginInjectionApi }),
369
369
  },
370
370
  handleDOMEvents: {
371
371
  focus: handleFocus,
@@ -77,8 +77,10 @@ const DragHandleComponent = ({
77
77
  const isRow = direction === 'row';
78
78
  const isColumn = direction === 'column';
79
79
 
80
- const isRowHandleHovered = isRow && hoveredRows.length > 0;
81
- const isColumnHandleHovered = isColumn && hoveredColumns.length > 0;
80
+ // Added !isDragMenuOpen check so when hover 'Delete column/row' from drag menu
81
+ // the handle of the next column/row does not show the 'hovered' state icon
82
+ const isRowHandleHovered = isRow && hoveredRows.length > 0 && !isDragMenuOpen;
83
+ const isColumnHandleHovered = isColumn && hoveredColumns.length > 0 && !isDragMenuOpen;
82
84
 
83
85
  const hasMergedCells = useMemo(() => {
84
86
  const table = findTable(selection);