@atlaskit/editor-plugin-highlight 12.1.31 → 12.1.32

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-highlight
2
2
 
3
+ ## 12.1.32
4
+
5
+ ### Patch Changes
6
+
7
+ - [`245230d12da8d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/245230d12da8d) -
8
+ [ux] [EDITOR-8142] add red highlight color and filter out the transparent/ default highlight color
9
+ behind platform_editor_lovability_text_bg_color_patch_1
10
+ - Updated dependencies
11
+
3
12
  ## 12.1.31
4
13
 
5
14
  ### Patch Changes
@@ -122,7 +122,10 @@ function HighlightColorMenuItem(_ref3) {
122
122
  var iconColor = getTextColorIconColor(defaultColor, textColor, isNewColorPaletteEnabled);
123
123
  var highlightPalette = isNewColorPaletteEnabled ? _uiColor.highlightColorPaletteNew : _uiColor.highlightColorPalette;
124
124
  return highlightPalette.filter(function (color) {
125
- return isNewColorPaletteEnabled || color.value !== _uiColor.REMOVE_HIGHLIGHT_COLOR;
125
+ if (!isNewColorPaletteEnabled || (0, _platformFeatureFlags.fg)('platform_editor_lovability_text_bg_color_patch_1')) {
126
+ return color.value !== _uiColor.REMOVE_HIGHLIGHT_COLOR;
127
+ }
128
+ return color.label !== 'Red';
126
129
  }).map(function (color) {
127
130
  return _objectSpread(_objectSpread({}, color), {}, {
128
131
  decorator: isNewColorPaletteEnabled && color.value === _uiColor.REMOVE_HIGHLIGHT_COLOR ? /*#__PURE__*/React.createElement(NoColorIconDecorator, {
@@ -1,16 +1,18 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.PaletteDropdown = void 0;
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
9
  var _uiColor = require("@atlaskit/editor-common/ui-color");
10
10
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
11
11
  var _editorPalette = require("@atlaskit/editor-palette");
12
12
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
14
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
15
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
14
16
  var HIGHLIGHT_COLOR_PICKER_COLUMNS = 8;
15
17
  var HIGHLIGHT_COLOR_PICKER_COLUMNS_NEW = 10;
16
18
  var PaletteDropdown = exports.PaletteDropdown = function PaletteDropdown(props) {
@@ -25,7 +27,18 @@ var PaletteDropdown = exports.PaletteDropdown = function PaletteDropdown(props)
25
27
  handleClickOutside = props.handleClickOutside,
26
28
  handleEscapeKeydown = props.handleEscapeKeydown;
27
29
  var isNewColorPaletteEnabled = (0, _expValEquals.expValEquals)('platform_editor_lovability_text_bg_color', 'isEnabled', true);
28
- var highlightPalette = isNewColorPaletteEnabled ? _uiColor.highlightColorPaletteNew : _uiColor.highlightColorPalette;
30
+ var isRedHighlightEnabled = (0, _platformFeatureFlags.fg)('platform_editor_lovability_text_bg_color_patch_1');
31
+ var highlightPalette = (0, _react.useMemo)(function () {
32
+ if (isNewColorPaletteEnabled) {
33
+ return _uiColor.highlightColorPaletteNew.filter(function (color) {
34
+ if (isRedHighlightEnabled) {
35
+ return color.value !== _uiColor.REMOVE_HIGHLIGHT_COLOR;
36
+ }
37
+ return color.label !== 'Red';
38
+ });
39
+ }
40
+ return _uiColor.highlightColorPalette;
41
+ }, [isNewColorPaletteEnabled, isRedHighlightEnabled]);
29
42
  var colorPickerColumns = isNewColorPaletteEnabled ? HIGHLIGHT_COLOR_PICKER_COLUMNS_NEW : HIGHLIGHT_COLOR_PICKER_COLUMNS;
30
43
 
31
44
  // pixels, used to determine where to horizontally position the dropdown when space is limited
@@ -110,7 +110,12 @@ export function HighlightColorMenuItem({
110
110
  const isSelected = color => color.value === selectedColor;
111
111
  const iconColor = getTextColorIconColor(defaultColor, textColor, isNewColorPaletteEnabled);
112
112
  const highlightPalette = isNewColorPaletteEnabled ? highlightColorPaletteNew : highlightColorPalette;
113
- return highlightPalette.filter(color => isNewColorPaletteEnabled || color.value !== REMOVE_HIGHLIGHT_COLOR).map(color => ({
113
+ return highlightPalette.filter(color => {
114
+ if (!isNewColorPaletteEnabled || fg('platform_editor_lovability_text_bg_color_patch_1')) {
115
+ return color.value !== REMOVE_HIGHLIGHT_COLOR;
116
+ }
117
+ return color.label !== 'Red';
118
+ }).map(color => ({
114
119
  ...color,
115
120
  decorator: isNewColorPaletteEnabled && color.value === REMOVE_HIGHLIGHT_COLOR ? /*#__PURE__*/React.createElement(NoColorIconDecorator, {
116
121
  isSelected: isSelected(color),
@@ -1,8 +1,9 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import { ColorPalette, REMOVE_HIGHLIGHT_COLOR, getSelectedRowAndColumnFromPalette, highlightColorPalette, highlightColorPaletteNew } from '@atlaskit/editor-common/ui-color';
3
3
  import { ArrowKeyNavigationType, DropdownContainer as Dropdown } from '@atlaskit/editor-common/ui-menu';
4
4
  import { hexToEditorTextBackgroundPaletteColor } from '@atlaskit/editor-palette';
5
5
  import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
8
  const HIGHLIGHT_COLOR_PICKER_COLUMNS = 8;
8
9
  const HIGHLIGHT_COLOR_PICKER_COLUMNS_NEW = 10;
@@ -20,7 +21,18 @@ export const PaletteDropdown = props => {
20
21
  handleEscapeKeydown
21
22
  } = props;
22
23
  const isNewColorPaletteEnabled = expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true);
23
- const highlightPalette = isNewColorPaletteEnabled ? highlightColorPaletteNew : highlightColorPalette;
24
+ const isRedHighlightEnabled = fg('platform_editor_lovability_text_bg_color_patch_1');
25
+ const highlightPalette = useMemo(() => {
26
+ if (isNewColorPaletteEnabled) {
27
+ return highlightColorPaletteNew.filter(color => {
28
+ if (isRedHighlightEnabled) {
29
+ return color.value !== REMOVE_HIGHLIGHT_COLOR;
30
+ }
31
+ return color.label !== 'Red';
32
+ });
33
+ }
34
+ return highlightColorPalette;
35
+ }, [isNewColorPaletteEnabled, isRedHighlightEnabled]);
24
36
  const colorPickerColumns = isNewColorPaletteEnabled ? HIGHLIGHT_COLOR_PICKER_COLUMNS_NEW : HIGHLIGHT_COLOR_PICKER_COLUMNS;
25
37
 
26
38
  // pixels, used to determine where to horizontally position the dropdown when space is limited
@@ -113,7 +113,10 @@ export function HighlightColorMenuItem(_ref3) {
113
113
  var iconColor = getTextColorIconColor(defaultColor, textColor, isNewColorPaletteEnabled);
114
114
  var highlightPalette = isNewColorPaletteEnabled ? highlightColorPaletteNew : highlightColorPalette;
115
115
  return highlightPalette.filter(function (color) {
116
- return isNewColorPaletteEnabled || color.value !== REMOVE_HIGHLIGHT_COLOR;
116
+ if (!isNewColorPaletteEnabled || fg('platform_editor_lovability_text_bg_color_patch_1')) {
117
+ return color.value !== REMOVE_HIGHLIGHT_COLOR;
118
+ }
119
+ return color.label !== 'Red';
117
120
  }).map(function (color) {
118
121
  return _objectSpread(_objectSpread({}, color), {}, {
119
122
  decorator: isNewColorPaletteEnabled && color.value === REMOVE_HIGHLIGHT_COLOR ? /*#__PURE__*/React.createElement(NoColorIconDecorator, {
@@ -1,8 +1,9 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import { ColorPalette, REMOVE_HIGHLIGHT_COLOR, getSelectedRowAndColumnFromPalette, highlightColorPalette, highlightColorPaletteNew } from '@atlaskit/editor-common/ui-color';
3
3
  import { ArrowKeyNavigationType, DropdownContainer as Dropdown } from '@atlaskit/editor-common/ui-menu';
4
4
  import { hexToEditorTextBackgroundPaletteColor } from '@atlaskit/editor-palette';
5
5
  import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
8
  var HIGHLIGHT_COLOR_PICKER_COLUMNS = 8;
8
9
  var HIGHLIGHT_COLOR_PICKER_COLUMNS_NEW = 10;
@@ -18,7 +19,18 @@ export var PaletteDropdown = function PaletteDropdown(props) {
18
19
  handleClickOutside = props.handleClickOutside,
19
20
  handleEscapeKeydown = props.handleEscapeKeydown;
20
21
  var isNewColorPaletteEnabled = expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true);
21
- var highlightPalette = isNewColorPaletteEnabled ? highlightColorPaletteNew : highlightColorPalette;
22
+ var isRedHighlightEnabled = fg('platform_editor_lovability_text_bg_color_patch_1');
23
+ var highlightPalette = useMemo(function () {
24
+ if (isNewColorPaletteEnabled) {
25
+ return highlightColorPaletteNew.filter(function (color) {
26
+ if (isRedHighlightEnabled) {
27
+ return color.value !== REMOVE_HIGHLIGHT_COLOR;
28
+ }
29
+ return color.label !== 'Red';
30
+ });
31
+ }
32
+ return highlightColorPalette;
33
+ }, [isNewColorPaletteEnabled, isRedHighlightEnabled]);
22
34
  var colorPickerColumns = isNewColorPaletteEnabled ? HIGHLIGHT_COLOR_PICKER_COLUMNS_NEW : HIGHLIGHT_COLOR_PICKER_COLUMNS;
23
35
 
24
36
  // pixels, used to determine where to horizontally position the dropdown when space is limited
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-highlight",
3
- "version": "12.1.31",
3
+ "version": "12.1.32",
4
4
  "description": "Highlight plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -41,7 +41,7 @@
41
41
  "@atlaskit/icon": "^37.0.0",
42
42
  "@atlaskit/platform-feature-flags": "^2.0.0",
43
43
  "@atlaskit/primitives": "^22.0.0",
44
- "@atlaskit/tmp-editor-statsig": "^126.2.0",
44
+ "@atlaskit/tmp-editor-statsig": "^126.3.0",
45
45
  "@atlaskit/tokens": "^16.0.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "@emotion/react": "^11.7.1"