@atlaskit/adf-schema 40.0.0 → 40.0.1

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,11 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 40.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - fe59c22: Fix table background colour on dark mode when pasting from the renderer
8
+
3
9
  ## 40.0.0
4
10
 
5
11
  ### Major Changes
@@ -81,6 +81,7 @@ var getGlobalTheme = function getGlobalTheme() {
81
81
  colorMode: colorMode
82
82
  };
83
83
  };
84
+ var cssVariablePattern = /^var\(--.*\)$/;
84
85
 
85
86
  /**
86
87
  * gets cell dom attributes based on node attributes
@@ -131,6 +132,14 @@ var getCellDomAttrs = exports.getCellDomAttrs = function getCellDomAttrs(node) {
131
132
  var tokenColor = (0, _editorPalette.hexToEditorBackgroundPaletteRawValue)(color);
132
133
  if (tokenColor) {
133
134
  attrs.style = "background-color: ".concat(tokenColor, ";");
135
+ } else if (
136
+ /**
137
+ * There was previously a bug in dark mode where we would attempt to invert
138
+ * a design token in `getDarkModeLCHColor` causing issues.
139
+ * If it's a design token we should return it as is.
140
+ */
141
+ cssVariablePattern.test(color)) {
142
+ attrs.style = "background-color: ".concat(color, ";");
134
143
  } else {
135
144
  // if we have a custom color, we need to check if we are in dark mode
136
145
  if (getGlobalTheme().colorMode === 'dark') {
@@ -72,6 +72,7 @@ const getGlobalTheme = () => {
72
72
  colorMode
73
73
  };
74
74
  };
75
+ const cssVariablePattern = /^var\(--.*\)$/;
75
76
 
76
77
  /**
77
78
  * gets cell dom attributes based on node attributes
@@ -124,6 +125,14 @@ export const getCellDomAttrs = node => {
124
125
  const tokenColor = hexToEditorBackgroundPaletteRawValue(color);
125
126
  if (tokenColor) {
126
127
  attrs.style = `background-color: ${tokenColor};`;
128
+ } else if (
129
+ /**
130
+ * There was previously a bug in dark mode where we would attempt to invert
131
+ * a design token in `getDarkModeLCHColor` causing issues.
132
+ * If it's a design token we should return it as is.
133
+ */
134
+ cssVariablePattern.test(color)) {
135
+ attrs.style = `background-color: ${color};`;
127
136
  } else {
128
137
  // if we have a custom color, we need to check if we are in dark mode
129
138
  if (getGlobalTheme().colorMode === 'dark') {
@@ -77,6 +77,7 @@ var getGlobalTheme = function getGlobalTheme() {
77
77
  colorMode: colorMode
78
78
  };
79
79
  };
80
+ var cssVariablePattern = /^var\(--.*\)$/;
80
81
 
81
82
  /**
82
83
  * gets cell dom attributes based on node attributes
@@ -127,6 +128,14 @@ export var getCellDomAttrs = function getCellDomAttrs(node) {
127
128
  var tokenColor = hexToEditorBackgroundPaletteRawValue(color);
128
129
  if (tokenColor) {
129
130
  attrs.style = "background-color: ".concat(tokenColor, ";");
131
+ } else if (
132
+ /**
133
+ * There was previously a bug in dark mode where we would attempt to invert
134
+ * a design token in `getDarkModeLCHColor` causing issues.
135
+ * If it's a design token we should return it as is.
136
+ */
137
+ cssVariablePattern.test(color)) {
138
+ attrs.style = "background-color: ".concat(color, ";");
130
139
  } else {
131
140
  // if we have a custom color, we need to check if we are in dark mode
132
141
  if (getGlobalTheme().colorMode === 'dark') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "40.0.0",
3
+ "version": "40.0.1",
4
4
  "description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"