@atlaskit/editor-plugin-table 7.24.2 → 7.24.4

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
+ ## 7.24.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#125830](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/125830)
8
+ [`0886d04fff5e6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0886d04fff5e6) -
9
+ [ux] Fix bug in dark mode for table header pasted from light mode.
10
+
11
+ ## 7.24.3
12
+
13
+ ### Patch Changes
14
+
15
+ - [#125536](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/125536)
16
+ [`bf49379d856ff`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bf49379d856ff) -
17
+ hide element drag handle during column resize
18
+
3
19
  ## 7.24.2
4
20
 
5
21
  ### Patch Changes
@@ -8,21 +8,77 @@ exports.default = void 0;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
16
  var _adfSchema = require("@atlaskit/adf-schema");
17
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
18
  var _TableNodeViewBase = _interopRequireDefault(require("./TableNodeViewBase"));
16
19
  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); }; }
17
20
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
18
21
  var DEFAULT_COL_SPAN = 1;
19
22
  var DEFAULT_ROW_SPAN = 1;
23
+
24
+ /**
25
+ * For performance reasons we do this in the background - it shouldn't block the main thread
26
+ */
27
+ function delayUntilIdle(cb) {
28
+ if (typeof window === 'undefined') {
29
+ return;
30
+ }
31
+ // eslint-disable-next-line compat/compat
32
+ if (window.requestIdleCallback !== undefined) {
33
+ // eslint-disable-next-line compat/compat
34
+ return window.requestIdleCallback(function () {
35
+ return cb();
36
+ }, {
37
+ timeout: 500
38
+ });
39
+ }
40
+ return window.requestAnimationFrame(function () {
41
+ return cb();
42
+ });
43
+ }
44
+ var cssVariablePattern = /^VAR\(--.*\)$/;
20
45
  var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
21
46
  (0, _inherits2.default)(TableCell, _TableNodeView);
22
47
  var _super = _createSuper(TableCell);
23
48
  function TableCell(node, view, getPos, eventDispatcher) {
49
+ var _this;
24
50
  (0, _classCallCheck2.default)(this, TableCell);
25
- return _super.call(this, node, view, getPos, eventDispatcher);
51
+ _this = _super.call(this, node, view, getPos, eventDispatcher);
52
+
53
+ // CONFCLOUD-78239: Previously we had a bug which tried to invert the heading colour of a table
54
+ // Obviously design tokens can't be inverted and so it would result in `VAR(--DS-BACKGROUND-ACCENT-GRAY-SUBTLEST, #F4F5F7)`
55
+ // which is not a valid CSS variable.
56
+ //
57
+ // We should follow-up and remove this in TODO-xx in 6 months once we're confident
58
+ // that this has fixed most of the cases in the wild.
59
+ //
60
+ // This is a workaround to fix those cases on the fly. Note it is super specific on purpose
61
+ // so that it just fixes the heading token (other tokens should be unaffected)
62
+ // At some point in the future
63
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "destroy", function () {
64
+ if (_this.delayHandle && typeof window !== 'undefined') {
65
+ var _window, _window$cancelIdleCal, _window2, _window2$cancelAnimat;
66
+ // eslint-disable-next-line compat/compat
67
+ (_window = window) === null || _window === void 0 || (_window$cancelIdleCal = _window.cancelIdleCallback) === null || _window$cancelIdleCal === void 0 || _window$cancelIdleCal.call(_window, _this.delayHandle);
68
+ (_window2 = window) === null || _window2 === void 0 || (_window2$cancelAnimat = _window2.cancelAnimationFrame) === null || _window2$cancelAnimat === void 0 || _window2$cancelAnimat.call(_window2, _this.delayHandle);
69
+ }
70
+ });
71
+ if (cssVariablePattern.test(node.attrs.background) && (0, _platformFeatureFlags.fg)('platform_editor_dark_mode_cell_header_color_fix')) {
72
+ _this.delayHandle = delayUntilIdle(function () {
73
+ var pos = getPos();
74
+ if (pos) {
75
+ view.dispatch(view.state.tr.setNodeAttribute(pos, 'background', node.attrs.background.toLowerCase())
76
+ // Ensures dispatch does not contribute to undo history (otherwise user requires multiple undo's to revert table)
77
+ .setMeta('addToHistory', false));
78
+ }
79
+ });
80
+ }
81
+ return _this;
26
82
  }
27
83
  (0, _createClass2.default)(TableCell, [{
28
84
  key: "update",
@@ -36,7 +92,7 @@ var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
36
92
  }, {
37
93
  key: "updateNodeView",
38
94
  value: function updateNodeView(node) {
39
- var _this = this;
95
+ var _this2 = this;
40
96
  if (this.node.type !== node.type) {
41
97
  return false;
42
98
  }
@@ -67,10 +123,10 @@ var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
67
123
  var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
68
124
  key = _ref4[0],
69
125
  value = _ref4[1];
70
- return _this.dom.setAttribute(key, value || '');
126
+ return _this2.dom.setAttribute(key, value || '');
71
127
  });
72
128
  removedAttrs.forEach(function (key) {
73
- return _this.dom.removeAttribute(key);
129
+ return _this2.dom.removeAttribute(key);
74
130
  });
75
131
  return true;
76
132
  }
@@ -64,7 +64,7 @@ var stopResizing = exports.stopResizing = function stopResizing(tr) {
64
64
  return (0, _pluginFactory.createCommand)({
65
65
  type: 'STOP_RESIZING'
66
66
  }, function (originalTr) {
67
- return (tr || originalTr).setMeta('scrollIntoView', false);
67
+ return (tr || originalTr).setMeta('scrollIntoView', false).setMeta('is-resizer-resizing', false);
68
68
  });
69
69
  };
70
70
  var setDragging = exports.setDragging = function setDragging(dragging, tr) {
@@ -74,7 +74,7 @@ var setDragging = exports.setDragging = function setDragging(dragging, tr) {
74
74
  dragging: dragging
75
75
  }
76
76
  }, function (originalTr) {
77
- return tr || originalTr;
77
+ return (tr || originalTr).setMeta('is-resizer-resizing', true);
78
78
  });
79
79
  };
80
80
  var setLastClick = exports.setLastClick = function setLastClick(lastClick, transform) {
@@ -1,10 +1,59 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import { getCellAttrs, getCellDomAttrs } from '@atlaskit/adf-schema';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
2
4
  import TableNodeView from './TableNodeViewBase';
3
5
  const DEFAULT_COL_SPAN = 1;
4
6
  const DEFAULT_ROW_SPAN = 1;
7
+
8
+ /**
9
+ * For performance reasons we do this in the background - it shouldn't block the main thread
10
+ */
11
+ function delayUntilIdle(cb) {
12
+ if (typeof window === 'undefined') {
13
+ return;
14
+ }
15
+ // eslint-disable-next-line compat/compat
16
+ if (window.requestIdleCallback !== undefined) {
17
+ // eslint-disable-next-line compat/compat
18
+ return window.requestIdleCallback(() => cb(), {
19
+ timeout: 500
20
+ });
21
+ }
22
+ return window.requestAnimationFrame(() => cb());
23
+ }
24
+ const cssVariablePattern = /^VAR\(--.*\)$/;
5
25
  export default class TableCell extends TableNodeView {
6
26
  constructor(node, view, getPos, eventDispatcher) {
7
27
  super(node, view, getPos, eventDispatcher);
28
+
29
+ // CONFCLOUD-78239: Previously we had a bug which tried to invert the heading colour of a table
30
+ // Obviously design tokens can't be inverted and so it would result in `VAR(--DS-BACKGROUND-ACCENT-GRAY-SUBTLEST, #F4F5F7)`
31
+ // which is not a valid CSS variable.
32
+ //
33
+ // We should follow-up and remove this in TODO-xx in 6 months once we're confident
34
+ // that this has fixed most of the cases in the wild.
35
+ //
36
+ // This is a workaround to fix those cases on the fly. Note it is super specific on purpose
37
+ // so that it just fixes the heading token (other tokens should be unaffected)
38
+ // At some point in the future
39
+ _defineProperty(this, "destroy", () => {
40
+ if (this.delayHandle && typeof window !== 'undefined') {
41
+ var _window, _window$cancelIdleCal, _window2, _window2$cancelAnimat;
42
+ // eslint-disable-next-line compat/compat
43
+ (_window = window) === null || _window === void 0 ? void 0 : (_window$cancelIdleCal = _window.cancelIdleCallback) === null || _window$cancelIdleCal === void 0 ? void 0 : _window$cancelIdleCal.call(_window, this.delayHandle);
44
+ (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$cancelAnimat = _window2.cancelAnimationFrame) === null || _window2$cancelAnimat === void 0 ? void 0 : _window2$cancelAnimat.call(_window2, this.delayHandle);
45
+ }
46
+ });
47
+ if (cssVariablePattern.test(node.attrs.background) && fg('platform_editor_dark_mode_cell_header_color_fix')) {
48
+ this.delayHandle = delayUntilIdle(() => {
49
+ const pos = getPos();
50
+ if (pos) {
51
+ view.dispatch(view.state.tr.setNodeAttribute(pos, 'background', node.attrs.background.toLowerCase())
52
+ // Ensures dispatch does not contribute to undo history (otherwise user requires multiple undo's to revert table)
53
+ .setMeta('addToHistory', false));
54
+ }
55
+ });
56
+ }
8
57
  }
9
58
  update(node) {
10
59
  const didUpdate = this.updateNodeView(node);
@@ -50,13 +50,13 @@ export const setResizeHandlePos = resizeHandlePos => createCommand({
50
50
  });
51
51
  export const stopResizing = tr => createCommand({
52
52
  type: 'STOP_RESIZING'
53
- }, originalTr => (tr || originalTr).setMeta('scrollIntoView', false));
53
+ }, originalTr => (tr || originalTr).setMeta('scrollIntoView', false).setMeta('is-resizer-resizing', false));
54
54
  export const setDragging = (dragging, tr) => createCommand({
55
55
  type: 'SET_DRAGGING',
56
56
  data: {
57
57
  dragging
58
58
  }
59
- }, originalTr => tr || originalTr);
59
+ }, originalTr => (tr || originalTr).setMeta('is-resizer-resizing', true));
60
60
  export const setLastClick = (lastClick, transform) => createCommand({
61
61
  type: 'SET_LAST_CLICK',
62
62
  data: {
@@ -1,21 +1,77 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
5
  import _inherits from "@babel/runtime/helpers/inherits";
5
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
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); }; }
8
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
11
  import { getCellAttrs, getCellDomAttrs } from '@atlaskit/adf-schema';
12
+ import { fg } from '@atlaskit/platform-feature-flags';
10
13
  import TableNodeView from './TableNodeViewBase';
11
14
  var DEFAULT_COL_SPAN = 1;
12
15
  var DEFAULT_ROW_SPAN = 1;
16
+
17
+ /**
18
+ * For performance reasons we do this in the background - it shouldn't block the main thread
19
+ */
20
+ function delayUntilIdle(cb) {
21
+ if (typeof window === 'undefined') {
22
+ return;
23
+ }
24
+ // eslint-disable-next-line compat/compat
25
+ if (window.requestIdleCallback !== undefined) {
26
+ // eslint-disable-next-line compat/compat
27
+ return window.requestIdleCallback(function () {
28
+ return cb();
29
+ }, {
30
+ timeout: 500
31
+ });
32
+ }
33
+ return window.requestAnimationFrame(function () {
34
+ return cb();
35
+ });
36
+ }
37
+ var cssVariablePattern = /^VAR\(--.*\)$/;
13
38
  var TableCell = /*#__PURE__*/function (_TableNodeView) {
14
39
  _inherits(TableCell, _TableNodeView);
15
40
  var _super = _createSuper(TableCell);
16
41
  function TableCell(node, view, getPos, eventDispatcher) {
42
+ var _this;
17
43
  _classCallCheck(this, TableCell);
18
- return _super.call(this, node, view, getPos, eventDispatcher);
44
+ _this = _super.call(this, node, view, getPos, eventDispatcher);
45
+
46
+ // CONFCLOUD-78239: Previously we had a bug which tried to invert the heading colour of a table
47
+ // Obviously design tokens can't be inverted and so it would result in `VAR(--DS-BACKGROUND-ACCENT-GRAY-SUBTLEST, #F4F5F7)`
48
+ // which is not a valid CSS variable.
49
+ //
50
+ // We should follow-up and remove this in TODO-xx in 6 months once we're confident
51
+ // that this has fixed most of the cases in the wild.
52
+ //
53
+ // This is a workaround to fix those cases on the fly. Note it is super specific on purpose
54
+ // so that it just fixes the heading token (other tokens should be unaffected)
55
+ // At some point in the future
56
+ _defineProperty(_assertThisInitialized(_this), "destroy", function () {
57
+ if (_this.delayHandle && typeof window !== 'undefined') {
58
+ var _window, _window$cancelIdleCal, _window2, _window2$cancelAnimat;
59
+ // eslint-disable-next-line compat/compat
60
+ (_window = window) === null || _window === void 0 || (_window$cancelIdleCal = _window.cancelIdleCallback) === null || _window$cancelIdleCal === void 0 || _window$cancelIdleCal.call(_window, _this.delayHandle);
61
+ (_window2 = window) === null || _window2 === void 0 || (_window2$cancelAnimat = _window2.cancelAnimationFrame) === null || _window2$cancelAnimat === void 0 || _window2$cancelAnimat.call(_window2, _this.delayHandle);
62
+ }
63
+ });
64
+ if (cssVariablePattern.test(node.attrs.background) && fg('platform_editor_dark_mode_cell_header_color_fix')) {
65
+ _this.delayHandle = delayUntilIdle(function () {
66
+ var pos = getPos();
67
+ if (pos) {
68
+ view.dispatch(view.state.tr.setNodeAttribute(pos, 'background', node.attrs.background.toLowerCase())
69
+ // Ensures dispatch does not contribute to undo history (otherwise user requires multiple undo's to revert table)
70
+ .setMeta('addToHistory', false));
71
+ }
72
+ });
73
+ }
74
+ return _this;
19
75
  }
20
76
  _createClass(TableCell, [{
21
77
  key: "update",
@@ -29,7 +85,7 @@ var TableCell = /*#__PURE__*/function (_TableNodeView) {
29
85
  }, {
30
86
  key: "updateNodeView",
31
87
  value: function updateNodeView(node) {
32
- var _this = this;
88
+ var _this2 = this;
33
89
  if (this.node.type !== node.type) {
34
90
  return false;
35
91
  }
@@ -60,10 +116,10 @@ var TableCell = /*#__PURE__*/function (_TableNodeView) {
60
116
  var _ref4 = _slicedToArray(_ref3, 2),
61
117
  key = _ref4[0],
62
118
  value = _ref4[1];
63
- return _this.dom.setAttribute(key, value || '');
119
+ return _this2.dom.setAttribute(key, value || '');
64
120
  });
65
121
  removedAttrs.forEach(function (key) {
66
- return _this.dom.removeAttribute(key);
122
+ return _this2.dom.removeAttribute(key);
67
123
  });
68
124
  return true;
69
125
  }
@@ -58,7 +58,7 @@ export var stopResizing = function stopResizing(tr) {
58
58
  return createCommand({
59
59
  type: 'STOP_RESIZING'
60
60
  }, function (originalTr) {
61
- return (tr || originalTr).setMeta('scrollIntoView', false);
61
+ return (tr || originalTr).setMeta('scrollIntoView', false).setMeta('is-resizer-resizing', false);
62
62
  });
63
63
  };
64
64
  export var setDragging = function setDragging(dragging, tr) {
@@ -68,7 +68,7 @@ export var setDragging = function setDragging(dragging, tr) {
68
68
  dragging: dragging
69
69
  }
70
70
  }, function (originalTr) {
71
- return tr || originalTr;
71
+ return (tr || originalTr).setMeta('is-resizer-resizing', true);
72
72
  });
73
73
  };
74
74
  export var setLastClick = function setLastClick(lastClick, transform) {
@@ -3,7 +3,9 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
4
4
  import TableNodeView from './TableNodeViewBase';
5
5
  export default class TableCell extends TableNodeView<HTMLElement> implements NodeView {
6
+ private delayHandle;
6
7
  constructor(node: PMNode, view: EditorView, getPos: () => number | undefined, eventDispatcher: EventDispatcher);
8
+ destroy: () => void;
7
9
  update(node: PMNode): boolean;
8
10
  private updateNodeView;
9
11
  }
@@ -3,7 +3,9 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
4
4
  import TableNodeView from './TableNodeViewBase';
5
5
  export default class TableCell extends TableNodeView<HTMLElement> implements NodeView {
6
+ private delayHandle;
6
7
  constructor(node: PMNode, view: EditorView, getPos: () => number | undefined, eventDispatcher: EventDispatcher);
8
+ destroy: () => void;
7
9
  update(node: PMNode): boolean;
8
10
  private updateNodeView;
9
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.24.2",
3
+ "version": "7.24.4",
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.0.0",
34
+ "@atlaskit/editor-common": "^87.2.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.8.0",
47
- "@atlaskit/menu": "^2.8.0",
47
+ "@atlaskit/menu": "^2.9.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",
@@ -111,6 +111,9 @@
111
111
  "platform.editor.table.use-increased-scaling-percent": {
112
112
  "type": "boolean"
113
113
  },
114
+ "platform_editor_dark_mode_cell_header_color_fix": {
115
+ "type": "boolean"
116
+ },
114
117
  "platform.editor.table.live-pages-sorting_4malx": {
115
118
  "type": "boolean"
116
119
  },
@@ -3,13 +3,33 @@ import { getCellAttrs, getCellDomAttrs } from '@atlaskit/adf-schema';
3
3
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
4
4
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
 
7
8
  import TableNodeView from './TableNodeViewBase';
8
9
 
9
10
  const DEFAULT_COL_SPAN = 1;
10
11
  const DEFAULT_ROW_SPAN = 1;
11
12
 
13
+ /**
14
+ * For performance reasons we do this in the background - it shouldn't block the main thread
15
+ */
16
+ function delayUntilIdle(cb: Function) {
17
+ if (typeof window === 'undefined') {
18
+ return;
19
+ }
20
+ // eslint-disable-next-line compat/compat
21
+ if (window.requestIdleCallback !== undefined) {
22
+ // eslint-disable-next-line compat/compat
23
+ return window.requestIdleCallback(() => cb(), { timeout: 500 });
24
+ }
25
+ return window.requestAnimationFrame(() => cb());
26
+ }
27
+
28
+ const cssVariablePattern = /^VAR\(--.*\)$/;
29
+
12
30
  export default class TableCell extends TableNodeView<HTMLElement> implements NodeView {
31
+ private delayHandle: number | undefined;
32
+
13
33
  constructor(
14
34
  node: PMNode,
15
35
  view: EditorView,
@@ -17,8 +37,43 @@ export default class TableCell extends TableNodeView<HTMLElement> implements Nod
17
37
  eventDispatcher: EventDispatcher,
18
38
  ) {
19
39
  super(node, view, getPos, eventDispatcher);
40
+
41
+ // CONFCLOUD-78239: Previously we had a bug which tried to invert the heading colour of a table
42
+ // Obviously design tokens can't be inverted and so it would result in `VAR(--DS-BACKGROUND-ACCENT-GRAY-SUBTLEST, #F4F5F7)`
43
+ // which is not a valid CSS variable.
44
+ //
45
+ // We should follow-up and remove this in TODO-xx in 6 months once we're confident
46
+ // that this has fixed most of the cases in the wild.
47
+ //
48
+ // This is a workaround to fix those cases on the fly. Note it is super specific on purpose
49
+ // so that it just fixes the heading token (other tokens should be unaffected)
50
+ // At some point in the future
51
+ if (
52
+ cssVariablePattern.test(node.attrs.background) &&
53
+ fg('platform_editor_dark_mode_cell_header_color_fix')
54
+ ) {
55
+ this.delayHandle = delayUntilIdle(() => {
56
+ const pos = getPos();
57
+ 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
+ );
64
+ }
65
+ });
66
+ }
20
67
  }
21
68
 
69
+ destroy = () => {
70
+ if (this.delayHandle && typeof window !== 'undefined') {
71
+ // eslint-disable-next-line compat/compat
72
+ window?.cancelIdleCallback?.(this.delayHandle);
73
+ window?.cancelAnimationFrame?.(this.delayHandle);
74
+ }
75
+ };
76
+
22
77
  update(node: PMNode) {
23
78
  const didUpdate = this.updateNodeView(node);
24
79
  if (didUpdate) {
@@ -72,7 +72,8 @@ export const stopResizing = (tr?: Transaction) =>
72
72
  {
73
73
  type: 'STOP_RESIZING',
74
74
  },
75
- (originalTr) => (tr || originalTr).setMeta('scrollIntoView', false),
75
+ (originalTr) =>
76
+ (tr || originalTr).setMeta('scrollIntoView', false).setMeta('is-resizer-resizing', false),
76
77
  );
77
78
 
78
79
  export const setDragging = (
@@ -86,7 +87,7 @@ export const setDragging = (
86
87
  dragging,
87
88
  },
88
89
  },
89
- (originalTr) => tr || originalTr,
90
+ (originalTr) => (tr || originalTr).setMeta('is-resizer-resizing', true),
90
91
  );
91
92
 
92
93
  export const setLastClick = (