@atlaskit/adf-schema 56.0.1 → 56.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,19 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 56.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`88d7b2e461104`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/88d7b2e461104) -
8
+ Preserve new text and highlight colors when pasted behind platform_editor_lovability_text_bg_color
9
+ - Updated dependencies
10
+
11
+ ## 56.0.2
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 56.0.1
4
18
 
5
19
  ### Patch Changes
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.backgroundColorPaletteNew = exports.backgroundColorPalette = exports.backgroundColor = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
10
11
  var _markTypes = require("../../next-schema/generated/markTypes");
11
12
  var _colors = require("../../utils/colors");
12
13
  var _editorPalette = require("../../utils/editor-palette");
@@ -67,6 +68,12 @@ colorArrayPaletteNew.forEach(function (_ref3) {
67
68
  label = _ref4[1];
68
69
  return backgroundColorPaletteNew.set(color.toLowerCase(), label);
69
70
  });
71
+ var isSupportedBackgroundColor = function isSupportedBackgroundColor(hexColor) {
72
+ if (backgroundColorPalette.has(hexColor)) {
73
+ return true;
74
+ }
75
+ return (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_text_bg_color', 'isEnabled', true) && backgroundColorPaletteNew.has(hexColor);
76
+ };
70
77
  var backgroundColor = exports.backgroundColor = (0, _markTypes.backgroundColor)({
71
78
  parseDOM: [{
72
79
  style: 'background-color',
@@ -79,7 +86,7 @@ var backgroundColor = exports.backgroundColor = (0, _markTypes.backgroundColor)(
79
86
  hexColor = value.toLowerCase();
80
87
  }
81
88
  // else handle other colour formats
82
- return hexColor && backgroundColorPalette.has(hexColor) ? {
89
+ return hexColor && isSupportedBackgroundColor(hexColor) ? {
83
90
  color: hexColor
84
91
  } : false;
85
92
  }
@@ -97,7 +104,7 @@ var backgroundColor = exports.backgroundColor = (0, _markTypes.backgroundColor)(
97
104
  return false;
98
105
  }
99
106
  var hexColor = maybeElement.dataset.backgroundCustomColor;
100
- return hexColor && backgroundColorPalette.has(hexColor) ? {
107
+ return hexColor && isSupportedBackgroundColor(hexColor) ? {
101
108
  color: hexColor
102
109
  } : false;
103
110
  }
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.textColor = exports.setGlobalTheme = exports.getGlobalTheme = exports.colorPaletteNew = exports.colorPaletteExtended = exports.colorPalette = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
10
11
  var _markTypes = require("../../next-schema/generated/markTypes");
11
12
  var _editorPalette = require("../../utils/editor-palette");
12
13
  var _colors = require("../../utils/colors");
@@ -73,7 +74,7 @@ var colorArrayPaletteNew = [
73
74
  [_colors.L800, 'Dark lime'], [_colors.Y800, 'Dark yellow'], [_colors.O800, 'Dark orange'], [_colors.R500, 'Dark red'],
74
75
  // Dragon's blood
75
76
  [_colors.M800, 'Dark magenta'], [_colors.P500, 'Dark purple'],
76
- // Prince
77
+ // Prince
77
78
  // row 2
78
79
  [_colors.N80, 'Light gray'],
79
80
  // Spooky ghost
@@ -122,6 +123,12 @@ colorArrayPaletteNew.forEach(function (_ref3) {
122
123
  label = _ref4[1];
123
124
  return colorPaletteNew.set(color.toLowerCase(), label);
124
125
  });
126
+ var isSupportedTextColor = function isSupportedTextColor(hexColor) {
127
+ if (colorPalette.has(hexColor)) {
128
+ return true;
129
+ }
130
+ return (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_text_bg_color', 'isEnabled', true) && colorPaletteNew.has(hexColor);
131
+ };
125
132
 
126
133
  // these are for test only
127
134
  var testGlobalTheme;
@@ -161,7 +168,7 @@ var textColor = exports.textColor = (0, _markTypes.textColor)({
161
168
  hexColor = value.toLowerCase();
162
169
  }
163
170
  // else handle other colour formats
164
- return hexColor && colorPalette.has(hexColor) ? {
171
+ return hexColor && isSupportedTextColor(hexColor) ? {
165
172
  color: hexColor
166
173
  } : false;
167
174
  }
@@ -181,7 +188,7 @@ var textColor = exports.textColor = (0, _markTypes.textColor)({
181
188
  return false;
182
189
  }
183
190
  var hexColor = maybeElement.dataset.textCustomColor;
184
- return hexColor && colorPalette.has(hexColor) ? {
191
+ return hexColor && isSupportedTextColor(hexColor) ? {
185
192
  color: hexColor
186
193
  } : false;
187
194
  }
@@ -1,3 +1,4 @@
1
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
1
2
  import { backgroundColor as backgroundColorFactory } from '../../next-schema/generated/markTypes';
2
3
  import { B75, G75, L200, M200, Neutral300, O200, P200, rgbToHex, T200, Yellow200 } from '../../utils/colors';
3
4
  import { hexToEditorTextBackgroundPaletteColor } from '../../utils/editor-palette';
@@ -49,6 +50,12 @@ colorArrayPalette.forEach(([color, label]) => backgroundColorPalette.set(color.t
49
50
  const RGB_PREFIX_BG_COLOR_REGEX = /^rgb/iu;
50
51
  export const backgroundColorPaletteNew = new Map();
51
52
  colorArrayPaletteNew.forEach(([color, label]) => backgroundColorPaletteNew.set(color.toLowerCase(), label));
53
+ const isSupportedBackgroundColor = hexColor => {
54
+ if (backgroundColorPalette.has(hexColor)) {
55
+ return true;
56
+ }
57
+ return expValEqualsNoExposure('platform_editor_lovability_text_bg_color', 'isEnabled', true) && backgroundColorPaletteNew.has(hexColor);
58
+ };
52
59
  export const backgroundColor = backgroundColorFactory({
53
60
  parseDOM: [{
54
61
  style: 'background-color',
@@ -61,7 +68,7 @@ export const backgroundColor = backgroundColorFactory({
61
68
  hexColor = value.toLowerCase();
62
69
  }
63
70
  // else handle other colour formats
64
- return hexColor && backgroundColorPalette.has(hexColor) ? {
71
+ return hexColor && isSupportedBackgroundColor(hexColor) ? {
65
72
  color: hexColor
66
73
  } : false;
67
74
  }
@@ -79,7 +86,7 @@ export const backgroundColor = backgroundColorFactory({
79
86
  return false;
80
87
  }
81
88
  const hexColor = maybeElement.dataset.backgroundCustomColor;
82
- return hexColor && backgroundColorPalette.has(hexColor) ? {
89
+ return hexColor && isSupportedBackgroundColor(hexColor) ? {
83
90
  color: hexColor
84
91
  } : false;
85
92
  }
@@ -1,3 +1,4 @@
1
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
1
2
  import { textColor as textColorFactory } from '../../next-schema/generated/markTypes';
2
3
  import { hexToEditorTextPaletteColor } from '../../utils/editor-palette';
3
4
  import { rgbToHex, N0, N80, P50, P300, P500, T75, T300, T500, G75, G300, G500, R75, R300, R500, Y75, Y200, Y400, B75, B100, B500, Orange200, O600, O800, M200, M600, M800, L200, L600, L800, Y600, Y800 } from '../../utils/colors';
@@ -65,7 +66,7 @@ const colorArrayPaletteNew = [
65
66
  [L800, 'Dark lime'], [Y800, 'Dark yellow'], [O800, 'Dark orange'], [R500, 'Dark red'],
66
67
  // Dragon's blood
67
68
  [M800, 'Dark magenta'], [P500, 'Dark purple'],
68
- // Prince
69
+ // Prince
69
70
  // row 2
70
71
  [N80, 'Light gray'],
71
72
  // Spooky ghost
@@ -104,6 +105,12 @@ export const colorPaletteNew = new Map();
104
105
  export const colorPaletteExtended = colorPalette;
105
106
  colorArrayPalette.forEach(([color, label]) => colorPalette.set(color.toLowerCase(), label));
106
107
  colorArrayPaletteNew.forEach(([color, label]) => colorPaletteNew.set(color.toLowerCase(), label));
108
+ const isSupportedTextColor = hexColor => {
109
+ if (colorPalette.has(hexColor)) {
110
+ return true;
111
+ }
112
+ return expValEqualsNoExposure('platform_editor_lovability_text_bg_color', 'isEnabled', true) && colorPaletteNew.has(hexColor);
113
+ };
107
114
 
108
115
  // these are for test only
109
116
  let testGlobalTheme;
@@ -143,7 +150,7 @@ export const textColor = textColorFactory({
143
150
  hexColor = value.toLowerCase();
144
151
  }
145
152
  // else handle other colour formats
146
- return hexColor && colorPalette.has(hexColor) ? {
153
+ return hexColor && isSupportedTextColor(hexColor) ? {
147
154
  color: hexColor
148
155
  } : false;
149
156
  }
@@ -163,7 +170,7 @@ export const textColor = textColorFactory({
163
170
  return false;
164
171
  }
165
172
  const hexColor = maybeElement.dataset.textCustomColor;
166
- return hexColor && colorPalette.has(hexColor) ? {
173
+ return hexColor && isSupportedTextColor(hexColor) ? {
167
174
  color: hexColor
168
175
  } : false;
169
176
  }
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
3
4
  import { backgroundColor as backgroundColorFactory } from '../../next-schema/generated/markTypes';
4
5
  import { B75, G75, L200, M200, Neutral300, O200, P200, rgbToHex, T200, Yellow200 } from '../../utils/colors';
5
6
  import { hexToEditorTextBackgroundPaletteColor } from '../../utils/editor-palette';
@@ -61,6 +62,12 @@ colorArrayPaletteNew.forEach(function (_ref3) {
61
62
  label = _ref4[1];
62
63
  return backgroundColorPaletteNew.set(color.toLowerCase(), label);
63
64
  });
65
+ var isSupportedBackgroundColor = function isSupportedBackgroundColor(hexColor) {
66
+ if (backgroundColorPalette.has(hexColor)) {
67
+ return true;
68
+ }
69
+ return expValEqualsNoExposure('platform_editor_lovability_text_bg_color', 'isEnabled', true) && backgroundColorPaletteNew.has(hexColor);
70
+ };
64
71
  export var backgroundColor = backgroundColorFactory({
65
72
  parseDOM: [{
66
73
  style: 'background-color',
@@ -73,7 +80,7 @@ export var backgroundColor = backgroundColorFactory({
73
80
  hexColor = value.toLowerCase();
74
81
  }
75
82
  // else handle other colour formats
76
- return hexColor && backgroundColorPalette.has(hexColor) ? {
83
+ return hexColor && isSupportedBackgroundColor(hexColor) ? {
77
84
  color: hexColor
78
85
  } : false;
79
86
  }
@@ -91,7 +98,7 @@ export var backgroundColor = backgroundColorFactory({
91
98
  return false;
92
99
  }
93
100
  var hexColor = maybeElement.dataset.backgroundCustomColor;
94
- return hexColor && backgroundColorPalette.has(hexColor) ? {
101
+ return hexColor && isSupportedBackgroundColor(hexColor) ? {
95
102
  color: hexColor
96
103
  } : false;
97
104
  }
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
3
4
  import { textColor as textColorFactory } from '../../next-schema/generated/markTypes';
4
5
  import { hexToEditorTextPaletteColor } from '../../utils/editor-palette';
5
6
  import { rgbToHex, N0, N80, P50, P300, P500, T75, T300, T500, G75, G300, G500, R75, R300, R500, Y75, Y200, Y400, B75, B100, B500, Orange200, O600, O800, M200, M600, M800, L200, L600, L800, Y600, Y800 } from '../../utils/colors';
@@ -67,7 +68,7 @@ var colorArrayPaletteNew = [
67
68
  [L800, 'Dark lime'], [Y800, 'Dark yellow'], [O800, 'Dark orange'], [R500, 'Dark red'],
68
69
  // Dragon's blood
69
70
  [M800, 'Dark magenta'], [P500, 'Dark purple'],
70
- // Prince
71
+ // Prince
71
72
  // row 2
72
73
  [N80, 'Light gray'],
73
74
  // Spooky ghost
@@ -116,6 +117,12 @@ colorArrayPaletteNew.forEach(function (_ref3) {
116
117
  label = _ref4[1];
117
118
  return colorPaletteNew.set(color.toLowerCase(), label);
118
119
  });
120
+ var isSupportedTextColor = function isSupportedTextColor(hexColor) {
121
+ if (colorPalette.has(hexColor)) {
122
+ return true;
123
+ }
124
+ return expValEqualsNoExposure('platform_editor_lovability_text_bg_color', 'isEnabled', true) && colorPaletteNew.has(hexColor);
125
+ };
119
126
 
120
127
  // these are for test only
121
128
  var testGlobalTheme;
@@ -155,7 +162,7 @@ export var textColor = textColorFactory({
155
162
  hexColor = value.toLowerCase();
156
163
  }
157
164
  // else handle other colour formats
158
- return hexColor && colorPalette.has(hexColor) ? {
165
+ return hexColor && isSupportedTextColor(hexColor) ? {
159
166
  color: hexColor
160
167
  } : false;
161
168
  }
@@ -175,7 +182,7 @@ export var textColor = textColorFactory({
175
182
  return false;
176
183
  }
177
184
  var hexColor = maybeElement.dataset.textCustomColor;
178
- return hexColor && colorPalette.has(hexColor) ? {
185
+ return hexColor && isSupportedTextColor(hexColor) ? {
179
186
  color: hexColor
180
187
  } : false;
181
188
  }
@@ -1,2 +1,2 @@
1
- export { backgroundColor, backgroundColorPalette, backgroundColorPaletteNew } from '../schema/marks/background-color';
1
+ export { backgroundColor, backgroundColorPalette, backgroundColorPaletteNew, } from '../schema/marks/background-color';
2
2
  export type { BackgroundColorDefinition } from '../schema/marks/background-color';
@@ -1,2 +1,2 @@
1
- export { backgroundColor, backgroundColorPalette, backgroundColorPaletteNew } from '../schema/marks/background-color';
1
+ export { backgroundColor, backgroundColorPalette, backgroundColorPaletteNew, } from '../schema/marks/background-color';
2
2
  export type { BackgroundColorDefinition } from '../schema/marks/background-color';
@@ -34,5 +34,5 @@ export type { FragmentAttributes, FragmentDefinition, LocalId } from './fragment
34
34
  export { fragment, toJSON as fragmentToJSON } from './fragment';
35
35
  export { border, borderColorPalette } from './border';
36
36
  export type { BorderMarkAttributes, BorderMarkDefinition } from './border';
37
- export { backgroundColor, backgroundColorPalette, backgroundColorPaletteNew } from './background-color';
37
+ export { backgroundColor, backgroundColorPalette, backgroundColorPaletteNew, } from './background-color';
38
38
  export type { BackgroundColorDefinition } from './background-color';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "56.0.1",
3
+ "version": "56.0.3",
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/"
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@atlaskit/adf-schema-generator": "^3.1.0",
41
41
  "@atlaskit/editor-prosemirror": "^8.0.0",
42
- "@atlaskit/tmp-editor-statsig": "^108.4.0",
42
+ "@atlaskit/tmp-editor-statsig": "^109.3.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "css-color-names": "0.0.4",
45
45
  "linkify-it": "^3.0.3",
@@ -81,7 +81,7 @@
81
81
  "styled-components": "^3.2.6",
82
82
  "ts-jest": "^29.2.2",
83
83
  "ts-node": "^10.9.1",
84
- "typescript": "5.9.2"
84
+ "typescript": "5.9.3"
85
85
  },
86
86
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
87
87
  }