@atlaskit/editor-plugin-table 26.0.2 → 26.0.3

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,14 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 26.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2ed029496fab6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2ed029496fab6) -
8
+ [ux] [EDITOR-8491] Fix the table cell background colour palette so the current colour is shown as
9
+ selected.
10
+ - Updated dependencies
11
+
3
12
  ## 26.0.2
4
13
 
5
14
  ### Patch Changes
@@ -36,20 +36,24 @@ var BackgroundColorItem = exports.BackgroundColorItem = function BackgroundColor
36
36
  editorView = _ref2.editorView;
37
37
  var _useIntl = (0, _reactIntl.useIntl)(),
38
38
  formatMessage = _useIntl.formatMessage;
39
- var selectedColor = (0, _react.useMemo)(function () {
40
- var _node$attrs2;
41
- if (!editorView) {
42
- return '#ffffff';
43
- }
44
- var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
45
- targetCellPosition = _getPluginState.targetCellPosition;
46
- var node = targetCellPosition ? editorView.state.doc.nodeAt(targetCellPosition) : null;
47
- if ((0, _expValEquals.expValEquals)('platform_editor_table_menu_updates_patch_3', 'isEnabled', true)) {
48
- var _node$attrs;
49
- return (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff';
50
- }
51
- return (0, _editorPalette.hexToEditorBackgroundPaletteColor)((node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.background) || '#ffffff');
52
- }, [editorView]);
39
+ var _useMemo = (0, _react.useMemo)(function () {
40
+ var _node$attrs, _node$attrs2;
41
+ if (!editorView) {
42
+ return {
43
+ selectedColor: '#ffffff',
44
+ selectedColorRaw: '#ffffff'
45
+ };
46
+ }
47
+ var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
48
+ targetCellPosition = _getPluginState.targetCellPosition;
49
+ var node = targetCellPosition ? editorView.state.doc.nodeAt(targetCellPosition) : null;
50
+ return {
51
+ selectedColor: (0, _editorPalette.hexToEditorBackgroundPaletteColor)((node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff'),
52
+ selectedColorRaw: (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.background) || '#ffffff'
53
+ };
54
+ }, [editorView]),
55
+ selectedColor = _useMemo.selectedColor,
56
+ selectedColorRaw = _useMemo.selectedColorRaw;
53
57
  var onClick = (0, _react.useCallback)(function (color) {
54
58
  var _api$analytics;
55
59
  if (!editorView) {
@@ -96,7 +100,7 @@ var BackgroundColorItem = exports.BackgroundColorItem = function BackgroundColor
96
100
  }, /*#__PURE__*/_react.default.createElement(_uiColor.ColorPalette, {
97
101
  cols: activeCols,
98
102
  onClick: onClick,
99
- selectedColor: colorPreviewStyle.backgroundColor,
103
+ selectedColor: (0, _expValEquals.expValEquals)('platform_editor_table_menu_updates_patch_3', 'isEnabled', true) ? selectedColorRaw : colorPreviewStyle.backgroundColor,
100
104
  paletteOptions: paletteOptions
101
105
  })));
102
106
  };
@@ -31,20 +31,25 @@ export const BackgroundColorItem = ({
31
31
  const {
32
32
  formatMessage
33
33
  } = useIntl();
34
- const selectedColor = useMemo(() => {
35
- var _node$attrs2;
34
+ const {
35
+ selectedColor,
36
+ selectedColorRaw
37
+ } = useMemo(() => {
38
+ var _node$attrs, _node$attrs2;
36
39
  if (!editorView) {
37
- return '#ffffff';
40
+ return {
41
+ selectedColor: '#ffffff',
42
+ selectedColorRaw: '#ffffff'
43
+ };
38
44
  }
39
45
  const {
40
46
  targetCellPosition
41
47
  } = getPluginState(editorView.state);
42
48
  const node = targetCellPosition ? editorView.state.doc.nodeAt(targetCellPosition) : null;
43
- if (expValEquals('platform_editor_table_menu_updates_patch_3', 'isEnabled', true)) {
44
- var _node$attrs;
45
- return (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff';
46
- }
47
- return hexToEditorBackgroundPaletteColor((node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.background) || '#ffffff');
49
+ return {
50
+ selectedColor: hexToEditorBackgroundPaletteColor((node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff'),
51
+ selectedColorRaw: (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.background) || '#ffffff'
52
+ };
48
53
  }, [editorView]);
49
54
  const onClick = useCallback(color => {
50
55
  var _api$analytics;
@@ -90,7 +95,7 @@ export const BackgroundColorItem = ({
90
95
  }, /*#__PURE__*/React.createElement(ColorPalette, {
91
96
  cols: activeCols,
92
97
  onClick: onClick,
93
- selectedColor: colorPreviewStyle.backgroundColor,
98
+ selectedColor: expValEquals('platform_editor_table_menu_updates_patch_3', 'isEnabled', true) ? selectedColorRaw : colorPreviewStyle.backgroundColor,
94
99
  paletteOptions: paletteOptions
95
100
  })));
96
101
  };
@@ -28,20 +28,24 @@ export var BackgroundColorItem = function BackgroundColorItem(_ref) {
28
28
  editorView = _ref2.editorView;
29
29
  var _useIntl = useIntl(),
30
30
  formatMessage = _useIntl.formatMessage;
31
- var selectedColor = useMemo(function () {
32
- var _node$attrs2;
33
- if (!editorView) {
34
- return '#ffffff';
35
- }
36
- var _getPluginState = getPluginState(editorView.state),
37
- targetCellPosition = _getPluginState.targetCellPosition;
38
- var node = targetCellPosition ? editorView.state.doc.nodeAt(targetCellPosition) : null;
39
- if (expValEquals('platform_editor_table_menu_updates_patch_3', 'isEnabled', true)) {
40
- var _node$attrs;
41
- return (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff';
42
- }
43
- return hexToEditorBackgroundPaletteColor((node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.background) || '#ffffff');
44
- }, [editorView]);
31
+ var _useMemo = useMemo(function () {
32
+ var _node$attrs, _node$attrs2;
33
+ if (!editorView) {
34
+ return {
35
+ selectedColor: '#ffffff',
36
+ selectedColorRaw: '#ffffff'
37
+ };
38
+ }
39
+ var _getPluginState = getPluginState(editorView.state),
40
+ targetCellPosition = _getPluginState.targetCellPosition;
41
+ var node = targetCellPosition ? editorView.state.doc.nodeAt(targetCellPosition) : null;
42
+ return {
43
+ selectedColor: hexToEditorBackgroundPaletteColor((node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff'),
44
+ selectedColorRaw: (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.background) || '#ffffff'
45
+ };
46
+ }, [editorView]),
47
+ selectedColor = _useMemo.selectedColor,
48
+ selectedColorRaw = _useMemo.selectedColorRaw;
45
49
  var onClick = useCallback(function (color) {
46
50
  var _api$analytics;
47
51
  if (!editorView) {
@@ -88,7 +92,7 @@ export var BackgroundColorItem = function BackgroundColorItem(_ref) {
88
92
  }, /*#__PURE__*/React.createElement(ColorPalette, {
89
93
  cols: activeCols,
90
94
  onClick: onClick,
91
- selectedColor: colorPreviewStyle.backgroundColor,
95
+ selectedColor: expValEquals('platform_editor_table_menu_updates_patch_3', 'isEnabled', true) ? selectedColorRaw : colorPreviewStyle.backgroundColor,
92
96
  paletteOptions: paletteOptions
93
97
  })));
94
98
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "26.0.2",
3
+ "version": "26.0.3",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,7 +29,7 @@
29
29
  "@atlaskit/editor-plugin-batch-attribute-updates": "^14.0.0",
30
30
  "@atlaskit/editor-plugin-content-insertion": "^14.0.0",
31
31
  "@atlaskit/editor-plugin-editor-viewmode": "^16.0.0",
32
- "@atlaskit/editor-plugin-extension": "17.0.2",
32
+ "@atlaskit/editor-plugin-extension": "17.0.3",
33
33
  "@atlaskit/editor-plugin-guideline": "^14.0.0",
34
34
  "@atlaskit/editor-plugin-interaction": "^25.0.0",
35
35
  "@atlaskit/editor-plugin-limited-mode": "^11.0.0",
@@ -53,9 +53,9 @@
53
53
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.0.0",
54
54
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^2.0.0",
55
55
  "@atlaskit/primitives": "^22.2.0",
56
- "@atlaskit/tmp-editor-statsig": "^144.0.0",
56
+ "@atlaskit/tmp-editor-statsig": "^145.0.0",
57
57
  "@atlaskit/toggle": "^17.1.0",
58
- "@atlaskit/tokens": "^16.4.0",
58
+ "@atlaskit/tokens": "^16.5.0",
59
59
  "@atlaskit/tooltip": "^24.0.0",
60
60
  "@babel/runtime": "^7.0.0",
61
61
  "@compiled/react": "^1.0.0",
@@ -68,7 +68,7 @@
68
68
  "uuid": "^3.1.0"
69
69
  },
70
70
  "peerDependencies": {
71
- "@atlaskit/editor-common": "^118.1.0",
71
+ "@atlaskit/editor-common": "^118.2.0",
72
72
  "react": "^18.2.0 || ^19.2.0",
73
73
  "react-dom": "^18.2.0 || ^19.2.0",
74
74
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"