@atlaskit/editor-plugin-text-color 11.1.3 → 11.2.0

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/editor-commands/toggle-color.js +11 -8
  3. package/dist/cjs/pm-plugins/commands/toggle-color.js +11 -8
  4. package/dist/cjs/ui/TextColorHighlightMenu.js +36 -0
  5. package/dist/es2019/editor-commands/toggle-color.js +13 -10
  6. package/dist/es2019/pm-plugins/commands/toggle-color.js +13 -10
  7. package/dist/es2019/ui/TextColorHighlightMenu.js +36 -0
  8. package/dist/esm/editor-commands/toggle-color.js +11 -8
  9. package/dist/esm/pm-plugins/commands/toggle-color.js +11 -8
  10. package/dist/esm/ui/TextColorHighlightMenu.js +36 -0
  11. package/main/package.json +1 -8
  12. package/package.json +4 -4
  13. package/text-color-plugin/package.json +1 -8
  14. package/text-color-plugin-type/package.json +1 -8
  15. package/types/package.json +1 -8
  16. package/dist/types-ts4.5/editor-commands/change-color.d.ts +0 -4
  17. package/dist/types-ts4.5/editor-commands/palette.d.ts +0 -4
  18. package/dist/types-ts4.5/editor-commands/remove-color.d.ts +0 -2
  19. package/dist/types-ts4.5/editor-commands/toggle-color.d.ts +0 -2
  20. package/dist/types-ts4.5/entry-points/main.d.ts +0 -1
  21. package/dist/types-ts4.5/entry-points/text-color-plugin-type.d.ts +0 -1
  22. package/dist/types-ts4.5/entry-points/text-color-plugin.d.ts +0 -1
  23. package/dist/types-ts4.5/entry-points/types.d.ts +0 -1
  24. package/dist/types-ts4.5/index.d.ts +0 -4
  25. package/dist/types-ts4.5/pm-plugins/commands/change-color.d.ts +0 -4
  26. package/dist/types-ts4.5/pm-plugins/commands/remove-color.d.ts +0 -2
  27. package/dist/types-ts4.5/pm-plugins/commands/toggle-color.d.ts +0 -2
  28. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +0 -6
  29. package/dist/types-ts4.5/pm-plugins/main.d.ts +0 -40
  30. package/dist/types-ts4.5/pm-plugins/utils/color.d.ts +0 -6
  31. package/dist/types-ts4.5/pm-plugins/utils/constants.d.ts +0 -5
  32. package/dist/types-ts4.5/pm-plugins/utils/disabled.d.ts +0 -6
  33. package/dist/types-ts4.5/pm-plugins/utils/inputType.d.ts +0 -3
  34. package/dist/types-ts4.5/textColorPlugin.d.ts +0 -2
  35. package/dist/types-ts4.5/textColorPluginType.d.ts +0 -32
  36. package/dist/types-ts4.5/types/index.d.ts +0 -6
  37. package/dist/types-ts4.5/ui/FloatingToolbarComponent.d.ts +0 -12
  38. package/dist/types-ts4.5/ui/PrimaryToolbarComponent.d.ts +0 -17
  39. package/dist/types-ts4.5/ui/RemoveColorMenuItem.d.ts +0 -9
  40. package/dist/types-ts4.5/ui/TextColorHighlightMenu.d.ts +0 -9
  41. package/dist/types-ts4.5/ui/TextColorMenuItem.d.ts +0 -10
  42. package/dist/types-ts4.5/ui/TextMenuSection.d.ts +0 -7
  43. package/dist/types-ts4.5/ui/ToolbarTextColor/icon.d.ts +0 -2
  44. package/dist/types-ts4.5/ui/ToolbarTextColor/index.d.ts +0 -48
  45. package/dist/types-ts4.5/ui/toolbar-components.d.ts +0 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/editor-plugin-text-color
2
2
 
3
+ ## 11.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`b26d59f2d7dbf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b26d59f2d7dbf) -
8
+ [ux] [EDITOR-7589] combine text color highlight color behind experiment
9
+
10
+ ### Patch Changes
11
+
12
+ - [`3a59e88cfd890`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3a59e88cfd890) -
13
+ [ux] [EDITOR-7589] update icon colors for highlight color palette and toolbar icon
14
+ - Updated dependencies
15
+
16
+ ## 11.1.4
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 11.1.3
4
23
 
5
24
  ### Patch Changes
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toggleColor = void 0;
7
7
  var _mark = require("@atlaskit/editor-common/mark");
8
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
8
9
  var _main = require("../pm-plugins/main");
9
10
  var _constants = require("../pm-plugins/utils/constants");
10
11
  var _disabled = require("../pm-plugins/utils/disabled");
@@ -19,14 +20,16 @@ var toggleColor = exports.toggleColor = function toggleColor(color) {
19
20
  });
20
21
  return tr;
21
22
  }
22
- _constants.overrideMarks.forEach(function (mark) {
23
- var marks = tr.doc.type.schema.marks;
24
- if (marks[mark]) {
25
- (0, _mark.removeMark)(marks[mark])({
26
- tr: tr
27
- });
28
- }
29
- });
23
+ if (!(0, _expValEquals.expValEquals)('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
24
+ _constants.overrideMarks.forEach(function (mark) {
25
+ var marks = tr.doc.type.schema.marks;
26
+ if (marks[mark]) {
27
+ (0, _mark.removeMark)(marks[mark])({
28
+ tr: tr
29
+ });
30
+ }
31
+ });
32
+ }
30
33
  (0, _mark.toggleMark)(textColor, {
31
34
  color: color
32
35
  })({
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toggleColor = void 0;
7
7
  var _mark = require("@atlaskit/editor-common/mark");
8
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
8
9
  var _main = require("../main");
9
10
  var _constants = require("../utils/constants");
10
11
  var _disabled = require("../utils/disabled");
@@ -22,14 +23,16 @@ var toggleColor = exports.toggleColor = function toggleColor(color) {
22
23
  return false;
23
24
  }
24
25
  if (dispatch) {
25
- _constants.overrideMarks.forEach(function (mark) {
26
- var marks = tr.doc.type.schema.marks;
27
- if (marks[mark]) {
28
- (0, _mark.removeMark)(marks[mark])({
29
- tr: tr
30
- });
31
- }
32
- });
26
+ if (!(0, _expValEquals.expValEquals)('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
27
+ _constants.overrideMarks.forEach(function (mark) {
28
+ var marks = tr.doc.type.schema.marks;
29
+ if (marks[mark]) {
30
+ (0, _mark.removeMark)(marks[mark])({
31
+ tr: tr
32
+ });
33
+ }
34
+ });
35
+ }
33
36
  (0, _mark.toggleMark)(textColor, {
34
37
  color: color
35
38
  })({
@@ -10,6 +10,7 @@ var _reactIntl = require("react-intl");
10
10
  var _hooks = require("@atlaskit/editor-common/hooks");
11
11
  var _keymaps = require("@atlaskit/editor-common/keymaps");
12
12
  var _messages = require("@atlaskit/editor-common/messages");
13
+ var _uiColor = require("@atlaskit/editor-common/ui-color");
13
14
  var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
14
15
  var _editorPalette = require("@atlaskit/editor-palette");
15
16
  var _editorToolbar = require("@atlaskit/editor-toolbar");
@@ -17,6 +18,12 @@ var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react
17
18
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
18
19
  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); }
19
20
  var getIconColor = function getIconColor(textColor, defaultColor, highlightColor) {
21
+ if ((0, _expValEquals.expValEquals)('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
22
+ if (!textColor || textColor === defaultColor && defaultColor) {
23
+ return "var(--ds-text, #292A2E)";
24
+ }
25
+ return (0, _editorPalette.hexToEditorTextPaletteColor)(textColor) || "var(--ds-text, #292A2E)";
26
+ }
20
27
  if (highlightColor || !textColor || textColor === defaultColor && defaultColor) {
21
28
  return "var(--ds-text, #292A2E)";
22
29
  }
@@ -111,6 +118,35 @@ var TextColorHighlightMenu = exports.TextColorHighlightMenu = function TextColor
111
118
  };
112
119
  }, [setIsPaletteOpen, isPaletteOpen]);
113
120
  var iconColor = getIconColor(textColor, defaultColor, highlightColor);
121
+ if ((0, _expValEquals.expValEquals)('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
122
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownMenuProvider, {
123
+ isOpen: isPaletteOpen,
124
+ setIsOpen: setIsPaletteOpen
125
+ }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownMenu, {
126
+ iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarColorSwatch, {
127
+ highlightColor: getHighlightColorIcon(highlightColor)
128
+ }, /*#__PURE__*/_react.default.createElement(_editorToolbar.TextColorIcon, {
129
+ label: formatMessage(_messages.textColorMessages.textColorTooltip),
130
+ iconColor: iconColor,
131
+ shouldRecommendSmallIcon: true,
132
+ size: 'small',
133
+ isDisabled: isDisabled,
134
+ spacing: 'compact'
135
+ })),
136
+ isDisabled: isDisabled,
137
+ testId: "text-color-highlight-menu",
138
+ hasSectionMargin: false,
139
+ tooltipComponent: /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarTooltip, {
140
+ content: /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
141
+ description: formatMessage(isHighlightPluginExisted ? _messages.textColorMessages.textColorHighlightTooltip : _messages.textColorMessages.textColorTooltip),
142
+ keymap: _keymaps.toggleHighlightPalette
143
+ })
144
+ })
145
+ }, /*#__PURE__*/_react.default.createElement(_uiColor.SelectedTextColorProvider, {
146
+ textColor: textColor,
147
+ defaultColor: defaultColor
148
+ }, children)));
149
+ }
114
150
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownMenuProvider, {
115
151
  isOpen: isPaletteOpen,
116
152
  setIsOpen: setIsPaletteOpen
@@ -1,4 +1,5 @@
1
1
  import { removeMark, toggleMark } from '@atlaskit/editor-common/mark';
2
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
3
  import { ACTIONS, pluginKey } from '../pm-plugins/main';
3
4
  import { overrideMarks } from '../pm-plugins/utils/constants';
4
5
  import { getDisabledStateNew } from '../pm-plugins/utils/disabled';
@@ -15,16 +16,18 @@ export const toggleColor = color => ({
15
16
  });
16
17
  return tr;
17
18
  }
18
- overrideMarks.forEach(mark => {
19
- const {
20
- marks
21
- } = tr.doc.type.schema;
22
- if (marks[mark]) {
23
- removeMark(marks[mark])({
24
- tr
25
- });
26
- }
27
- });
19
+ if (!expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
20
+ overrideMarks.forEach(mark => {
21
+ const {
22
+ marks
23
+ } = tr.doc.type.schema;
24
+ if (marks[mark]) {
25
+ removeMark(marks[mark])({
26
+ tr
27
+ });
28
+ }
29
+ });
30
+ }
28
31
  toggleMark(textColor, {
29
32
  color
30
33
  })({
@@ -1,4 +1,5 @@
1
1
  import { removeMark, toggleMark } from '@atlaskit/editor-common/mark';
2
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
3
  import { ACTIONS, pluginKey } from '../main';
3
4
  import { overrideMarks } from '../utils/constants';
4
5
  import { getDisabledState } from '../utils/disabled';
@@ -17,16 +18,18 @@ export const toggleColor = color => (state, dispatch) => {
17
18
  return false;
18
19
  }
19
20
  if (dispatch) {
20
- overrideMarks.forEach(mark => {
21
- const {
22
- marks
23
- } = tr.doc.type.schema;
24
- if (marks[mark]) {
25
- removeMark(marks[mark])({
26
- tr
27
- });
28
- }
29
- });
21
+ if (!expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
22
+ overrideMarks.forEach(mark => {
23
+ const {
24
+ marks
25
+ } = tr.doc.type.schema;
26
+ if (marks[mark]) {
27
+ removeMark(marks[mark])({
28
+ tr
29
+ });
30
+ }
31
+ });
32
+ }
30
33
  toggleMark(textColor, {
31
34
  color
32
35
  })({
@@ -3,12 +3,19 @@ import { useIntl } from 'react-intl';
3
3
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
4
  import { toggleHighlightPalette, ToolTipContent } from '@atlaskit/editor-common/keymaps';
5
5
  import { textColorMessages as messages } from '@atlaskit/editor-common/messages';
6
+ import { SelectedTextColorProvider } from '@atlaskit/editor-common/ui-color';
6
7
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
7
8
  import { hexToEditorTextPaletteColor, hexToEditorTextBackgroundPaletteColor } from '@atlaskit/editor-palette';
8
9
  import { TextColorIcon, ToolbarColorSwatch, ToolbarDropdownMenu, ToolbarDropdownMenuProvider, ToolbarTooltip, useToolbarUI } from '@atlaskit/editor-toolbar';
9
10
  import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
10
11
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
11
12
  const getIconColor = (textColor, defaultColor, highlightColor) => {
13
+ if (expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
14
+ if (!textColor || textColor === defaultColor && defaultColor) {
15
+ return "var(--ds-text, #292A2E)";
16
+ }
17
+ return hexToEditorTextPaletteColor(textColor) || "var(--ds-text, #292A2E)";
18
+ }
12
19
  if (highlightColor || !textColor || textColor === defaultColor && defaultColor) {
13
20
  return "var(--ds-text, #292A2E)";
14
21
  }
@@ -106,6 +113,35 @@ export const TextColorHighlightMenu = ({
106
113
  };
107
114
  }, [setIsPaletteOpen, isPaletteOpen]);
108
115
  const iconColor = getIconColor(textColor, defaultColor, highlightColor);
116
+ if (expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
117
+ return /*#__PURE__*/React.createElement(ToolbarDropdownMenuProvider, {
118
+ isOpen: isPaletteOpen,
119
+ setIsOpen: setIsPaletteOpen
120
+ }, /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
121
+ iconBefore: /*#__PURE__*/React.createElement(ToolbarColorSwatch, {
122
+ highlightColor: getHighlightColorIcon(highlightColor)
123
+ }, /*#__PURE__*/React.createElement(TextColorIcon, {
124
+ label: formatMessage(messages.textColorTooltip),
125
+ iconColor: iconColor,
126
+ shouldRecommendSmallIcon: true,
127
+ size: 'small',
128
+ isDisabled: isDisabled,
129
+ spacing: 'compact'
130
+ })),
131
+ isDisabled: isDisabled,
132
+ testId: "text-color-highlight-menu",
133
+ hasSectionMargin: false,
134
+ tooltipComponent: /*#__PURE__*/React.createElement(ToolbarTooltip, {
135
+ content: /*#__PURE__*/React.createElement(ToolTipContent, {
136
+ description: formatMessage(isHighlightPluginExisted ? messages.textColorHighlightTooltip : messages.textColorTooltip),
137
+ keymap: toggleHighlightPalette
138
+ })
139
+ })
140
+ }, /*#__PURE__*/React.createElement(SelectedTextColorProvider, {
141
+ textColor: textColor,
142
+ defaultColor: defaultColor
143
+ }, children)));
144
+ }
109
145
  return /*#__PURE__*/React.createElement(ToolbarDropdownMenuProvider, {
110
146
  isOpen: isPaletteOpen,
111
147
  setIsOpen: setIsPaletteOpen
@@ -1,4 +1,5 @@
1
1
  import { removeMark, toggleMark } from '@atlaskit/editor-common/mark';
2
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
3
  import { ACTIONS, pluginKey } from '../pm-plugins/main';
3
4
  import { overrideMarks } from '../pm-plugins/utils/constants';
4
5
  import { getDisabledStateNew } from '../pm-plugins/utils/disabled';
@@ -13,14 +14,16 @@ export var toggleColor = function toggleColor(color) {
13
14
  });
14
15
  return tr;
15
16
  }
16
- overrideMarks.forEach(function (mark) {
17
- var marks = tr.doc.type.schema.marks;
18
- if (marks[mark]) {
19
- removeMark(marks[mark])({
20
- tr: tr
21
- });
22
- }
23
- });
17
+ if (!expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
18
+ overrideMarks.forEach(function (mark) {
19
+ var marks = tr.doc.type.schema.marks;
20
+ if (marks[mark]) {
21
+ removeMark(marks[mark])({
22
+ tr: tr
23
+ });
24
+ }
25
+ });
26
+ }
24
27
  toggleMark(textColor, {
25
28
  color: color
26
29
  })({
@@ -1,4 +1,5 @@
1
1
  import { removeMark, toggleMark } from '@atlaskit/editor-common/mark';
2
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
3
  import { ACTIONS, pluginKey } from '../main';
3
4
  import { overrideMarks } from '../utils/constants';
4
5
  import { getDisabledState } from '../utils/disabled';
@@ -16,14 +17,16 @@ export var toggleColor = function toggleColor(color) {
16
17
  return false;
17
18
  }
18
19
  if (dispatch) {
19
- overrideMarks.forEach(function (mark) {
20
- var marks = tr.doc.type.schema.marks;
21
- if (marks[mark]) {
22
- removeMark(marks[mark])({
23
- tr: tr
24
- });
25
- }
26
- });
20
+ if (!expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
21
+ overrideMarks.forEach(function (mark) {
22
+ var marks = tr.doc.type.schema.marks;
23
+ if (marks[mark]) {
24
+ removeMark(marks[mark])({
25
+ tr: tr
26
+ });
27
+ }
28
+ });
29
+ }
27
30
  toggleMark(textColor, {
28
31
  color: color
29
32
  })({
@@ -3,12 +3,19 @@ import { useIntl } from 'react-intl';
3
3
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
4
  import { toggleHighlightPalette, ToolTipContent } from '@atlaskit/editor-common/keymaps';
5
5
  import { textColorMessages as messages } from '@atlaskit/editor-common/messages';
6
+ import { SelectedTextColorProvider } from '@atlaskit/editor-common/ui-color';
6
7
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
7
8
  import { hexToEditorTextPaletteColor, hexToEditorTextBackgroundPaletteColor } from '@atlaskit/editor-palette';
8
9
  import { TextColorIcon, ToolbarColorSwatch, ToolbarDropdownMenu, ToolbarDropdownMenuProvider, ToolbarTooltip, useToolbarUI } from '@atlaskit/editor-toolbar';
9
10
  import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
10
11
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
11
12
  var getIconColor = function getIconColor(textColor, defaultColor, highlightColor) {
13
+ if (expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
14
+ if (!textColor || textColor === defaultColor && defaultColor) {
15
+ return "var(--ds-text, #292A2E)";
16
+ }
17
+ return hexToEditorTextPaletteColor(textColor) || "var(--ds-text, #292A2E)";
18
+ }
12
19
  if (highlightColor || !textColor || textColor === defaultColor && defaultColor) {
13
20
  return "var(--ds-text, #292A2E)";
14
21
  }
@@ -103,6 +110,35 @@ export var TextColorHighlightMenu = function TextColorHighlightMenu(_ref) {
103
110
  };
104
111
  }, [setIsPaletteOpen, isPaletteOpen]);
105
112
  var iconColor = getIconColor(textColor, defaultColor, highlightColor);
113
+ if (expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true)) {
114
+ return /*#__PURE__*/React.createElement(ToolbarDropdownMenuProvider, {
115
+ isOpen: isPaletteOpen,
116
+ setIsOpen: setIsPaletteOpen
117
+ }, /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
118
+ iconBefore: /*#__PURE__*/React.createElement(ToolbarColorSwatch, {
119
+ highlightColor: getHighlightColorIcon(highlightColor)
120
+ }, /*#__PURE__*/React.createElement(TextColorIcon, {
121
+ label: formatMessage(messages.textColorTooltip),
122
+ iconColor: iconColor,
123
+ shouldRecommendSmallIcon: true,
124
+ size: 'small',
125
+ isDisabled: isDisabled,
126
+ spacing: 'compact'
127
+ })),
128
+ isDisabled: isDisabled,
129
+ testId: "text-color-highlight-menu",
130
+ hasSectionMargin: false,
131
+ tooltipComponent: /*#__PURE__*/React.createElement(ToolbarTooltip, {
132
+ content: /*#__PURE__*/React.createElement(ToolTipContent, {
133
+ description: formatMessage(isHighlightPluginExisted ? messages.textColorHighlightTooltip : messages.textColorTooltip),
134
+ keymap: toggleHighlightPalette
135
+ })
136
+ })
137
+ }, /*#__PURE__*/React.createElement(SelectedTextColorProvider, {
138
+ textColor: textColor,
139
+ defaultColor: defaultColor
140
+ }, children)));
141
+ }
106
142
  return /*#__PURE__*/React.createElement(ToolbarDropdownMenuProvider, {
107
143
  isOpen: isPaletteOpen,
108
144
  setIsOpen: setIsPaletteOpen
package/main/package.json CHANGED
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/main.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/main.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/main.d.ts"
17
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-color",
3
- "version": "11.1.3",
3
+ "version": "11.2.0",
4
4
  "description": "Text color plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,7 +34,7 @@
34
34
  "@atlaskit/css": "^0.19.0",
35
35
  "@atlaskit/editor-palette": "^2.2.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^11.0.0",
37
- "@atlaskit/editor-plugin-highlight": "^11.0.0",
37
+ "@atlaskit/editor-plugin-highlight": "^11.1.0",
38
38
  "@atlaskit/editor-plugin-interaction": "^20.0.0",
39
39
  "@atlaskit/editor-plugin-primary-toolbar": "^12.0.0",
40
40
  "@atlaskit/editor-plugin-selection-toolbar": "^12.0.0",
@@ -49,13 +49,13 @@
49
49
  "@atlaskit/platform-feature-flags": "^1.1.0",
50
50
  "@atlaskit/platform-feature-flags-react": "^0.5.0",
51
51
  "@atlaskit/primitives": "^19.0.0",
52
- "@atlaskit/tmp-editor-statsig": "^102.0.0",
52
+ "@atlaskit/tmp-editor-statsig": "^103.0.0",
53
53
  "@atlaskit/tokens": "^13.4.0",
54
54
  "@babel/runtime": "^7.0.0",
55
55
  "@emotion/react": "^11.7.1"
56
56
  },
57
57
  "peerDependencies": {
58
- "@atlaskit/editor-common": "^115.15.0",
58
+ "@atlaskit/editor-common": "^115.16.0",
59
59
  "react": "^18.2.0",
60
60
  "react-dom": "^18.2.0",
61
61
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/text-color-plugin.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/text-color-plugin.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/text-color-plugin.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/text-color-plugin-type.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/text-color-plugin-type.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/text-color-plugin-type.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/types.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/types.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/types.d.ts"
17
10
  }
@@ -1,4 +0,0 @@
1
- import type { EditorCommand, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { TextColorPlugin } from '../textColorPluginType';
3
- import type { TextColorInputMethod } from '../types';
4
- export declare const changeColor: (color: string, api: ExtractInjectionAPI<TextColorPlugin> | undefined, inputMethod?: TextColorInputMethod) => EditorCommand;
@@ -1,4 +0,0 @@
1
- import type { EditorCommand, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { TextColorPlugin } from '../textColorPluginType';
3
- export declare const togglePalette: (api: ExtractInjectionAPI<TextColorPlugin> | undefined) => EditorCommand;
4
- export declare const setPalette: (isPaletteOpen: boolean) => EditorCommand;
@@ -1,2 +0,0 @@
1
- import type { EditorCommand } from '@atlaskit/editor-common/types';
2
- export declare const removeColor: EditorCommand;
@@ -1,2 +0,0 @@
1
- import type { EditorCommand } from '@atlaskit/editor-common/types';
2
- export declare const toggleColor: (color: string) => EditorCommand;
@@ -1 +0,0 @@
1
- export type { TextColorPluginState, TextColorPluginConfig } from '../pm-plugins/main';
@@ -1 +0,0 @@
1
- export type { TextColorPlugin, TextColorPluginOptions, Dependencies } from '../textColorPluginType';
@@ -1 +0,0 @@
1
- export { textColorPlugin } from '../textColorPlugin';
@@ -1 +0,0 @@
1
- export type { TextColorInputMethod } from '../types/index';
@@ -1,4 +0,0 @@
1
- export { textColorPlugin } from './textColorPlugin';
2
- export type { TextColorPlugin, TextColorPluginOptions, Dependencies } from './textColorPluginType';
3
- export type { TextColorInputMethod } from './types';
4
- export type { TextColorPluginState, TextColorPluginConfig } from './pm-plugins/main';
@@ -1,4 +0,0 @@
1
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import type { Command } from '@atlaskit/editor-common/types';
3
- import type { TextColorInputMethod } from '../../types';
4
- export declare const changeColor: (color: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod?: TextColorInputMethod) => Command;
@@ -1,2 +0,0 @@
1
- import type { Command } from '@atlaskit/editor-common/types';
2
- export declare const removeColor: () => Command;
@@ -1,2 +0,0 @@
1
- import type { Command } from '@atlaskit/editor-common/types';
2
- export declare const toggleColor: (color: string) => Command;
@@ -1,6 +0,0 @@
1
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { TextColorPlugin } from '../textColorPluginType';
4
- export declare function keymapPlugin({ api }: {
5
- api: ExtractInjectionAPI<TextColorPlugin> | undefined;
6
- }): SafePlugin;
@@ -1,40 +0,0 @@
1
- import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { PluginToolbarComponentConfig } from '@atlaskit/editor-common/toolbar';
4
- import type { PaletteColor } from '@atlaskit/editor-common/ui-color';
5
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
- export type TextColorPluginState = {
7
- color: string | null;
8
- defaultColor: string;
9
- disabled?: boolean;
10
- isPaletteOpen?: boolean;
11
- palette: Array<PaletteColor>;
12
- };
13
- type TextColorDefaultColor = {
14
- color: string;
15
- label: string;
16
- };
17
- export interface TextColorPluginConfig {
18
- defaultColor?: TextColorDefaultColor;
19
- /**
20
- * Optional configuration to control this plugin's toolbar components.
21
- * @default { enabled: true }
22
- * @example
23
- * To hide toolbar component, set `enabled` to `false`.
24
- * ```ts
25
- * toolbarConfig: {
26
- * enabled: false,
27
- * },
28
- * ```
29
- */
30
- toolbarConfig?: Exclude<PluginToolbarComponentConfig, 'showAt'>;
31
- }
32
- export declare enum ACTIONS {
33
- RESET_COLOR = 0,
34
- SET_COLOR = 1,
35
- DISABLE = 2,
36
- SET_PALETTE = 3
37
- }
38
- export declare const pluginKey: PluginKey<TextColorPluginState>;
39
- export declare function createPlugin(dispatch: Dispatch, pluginConfig?: TextColorPluginConfig): SafePlugin;
40
- export {};
@@ -1,6 +0,0 @@
1
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
2
- /**
3
- * Use getDisabledStateNew instead and pass in `tr`
4
- */
5
- export declare const getActiveColor: (state: EditorState) => string | null;
6
- export declare const getActiveColorNew: (tr: Transaction) => string | null;
@@ -1,5 +0,0 @@
1
- export declare const overrideMarks: string[];
2
- export declare const DEFAULT_COLOR: {
3
- color: string;
4
- label: string;
5
- };
@@ -1,6 +0,0 @@
1
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
2
- /**
3
- * Use getDisabledStateNew instead and pass in `tr`
4
- */
5
- export declare const getDisabledState: (state: EditorState) => boolean;
6
- export declare const getDisabledStateNew: (tr: Transaction) => boolean;
@@ -1,3 +0,0 @@
1
- import type { TextColorInputMethod } from '../../types';
2
- import { ToolbarType } from '../../types';
3
- export declare const getInputMethod: (toolbarType: ToolbarType) => TextColorInputMethod;
@@ -1,2 +0,0 @@
1
- import type { TextColorPlugin } from './textColorPluginType';
2
- export declare const textColorPlugin: TextColorPlugin;
@@ -1,32 +0,0 @@
1
- import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
- import type { HighlightPlugin } from '@atlaskit/editor-plugin-highlight';
4
- import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
5
- import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
6
- import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
7
- import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
8
- import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
9
- import type { TextColorPluginConfig, TextColorPluginState } from './pm-plugins/main';
10
- import type { TextColorInputMethod } from './types';
11
- export type TextColorPluginOptions = TextColorPluginConfig | boolean;
12
- export type Dependencies = [
13
- OptionalPlugin<AnalyticsPlugin>,
14
- OptionalPlugin<PrimaryToolbarPlugin>,
15
- OptionalPlugin<SelectionToolbarPlugin>,
16
- OptionalPlugin<ToolbarPlugin>,
17
- OptionalPlugin<UserPreferencesPlugin>,
18
- OptionalPlugin<HighlightPlugin>,
19
- OptionalPlugin<InteractionPlugin>
20
- ];
21
- export type TextColorPlugin = NextEditorPlugin<'textColor', {
22
- actions: {
23
- changeColor: (color: string, inputMethod?: TextColorInputMethod) => Command;
24
- };
25
- commands: {
26
- changeColor: (color: string, inputMethod?: TextColorInputMethod) => EditorCommand;
27
- setPalette: (isPaletteOpen: boolean) => EditorCommand;
28
- };
29
- dependencies: Dependencies;
30
- pluginConfiguration: TextColorPluginOptions | undefined;
31
- sharedState: TextColorPluginState | undefined;
32
- }>;
@@ -1,6 +0,0 @@
1
- import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
- export type TextColorInputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.FLOATING_TB;
3
- export declare enum ToolbarType {
4
- PRIMARY = "primaryToolbar",
5
- FLOATING = "floatingToolbar"
6
- }
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- import type { TextColorPlugin } from '../textColorPluginType';
6
- interface FloatingToolbarComponentProps {
7
- api: ExtractInjectionAPI<TextColorPlugin> | undefined;
8
- dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
9
- editorView: EditorView;
10
- }
11
- export declare const FloatingToolbarComponent: ({ api, editorView, dispatchAnalyticsEvent, }: FloatingToolbarComponentProps) => React.JSX.Element | null;
12
- export {};
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- import type { TextColorPlugin } from '../textColorPluginType';
6
- interface PrimaryToolbarComponentProps {
7
- api: ExtractInjectionAPI<TextColorPlugin> | undefined;
8
- disabled: boolean;
9
- dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
10
- editorView: EditorView;
11
- isReducedSpacing: boolean;
12
- popupsBoundariesElement?: HTMLElement;
13
- popupsMountPoint?: HTMLElement;
14
- popupsScrollableElement?: HTMLElement;
15
- }
16
- export declare const PrimaryToolbarComponent: ({ api, isReducedSpacing, editorView, popupsMountPoint, popupsScrollableElement, popupsBoundariesElement, dispatchAnalyticsEvent, disabled, }: PrimaryToolbarComponentProps) => React.JSX.Element | null;
17
- export {};
@@ -1,9 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { ToolbarComponentTypes } from '@atlaskit/editor-toolbar-model';
3
- import type { TextColorPlugin } from '../textColorPluginType';
4
- type RemoveColorMenuItemButtonProps = {
5
- api?: ExtractInjectionAPI<TextColorPlugin>;
6
- parents: ToolbarComponentTypes;
7
- };
8
- export declare const RemoveColorMenuItem: ({ api, parents, }: RemoveColorMenuItemButtonProps) => JSX.Element;
9
- export {};
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { TextColorPlugin } from '../textColorPluginType';
4
- interface TextColorHighlightMenuProps {
5
- api: ExtractInjectionAPI<TextColorPlugin> | undefined;
6
- children: React.ReactNode;
7
- }
8
- export declare const TextColorHighlightMenu: ({ children, api, }: TextColorHighlightMenuProps) => React.JSX.Element;
9
- export {};
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { ToolbarComponentTypes } from '@atlaskit/editor-toolbar-model';
4
- import type { TextColorPlugin } from '../textColorPluginType';
5
- interface TextColorMenuItemProps {
6
- api: ExtractInjectionAPI<TextColorPlugin> | undefined;
7
- parents: ToolbarComponentTypes;
8
- }
9
- export declare function TextColorMenuItem({ api, parents }: TextColorMenuItemProps): React.JSX.Element;
10
- export {};
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import type { CommonComponentProps } from '@atlaskit/editor-toolbar-model';
3
- type TextMenuSectionProps = {
4
- children: React.ReactNode;
5
- } & CommonComponentProps;
6
- export declare const TextMenuSection: ({ children, parents }: TextMenuSectionProps) => React.JSX.Element;
7
- export {};
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const EditorTextColorIcon: () => React.JSX.Element;
@@ -1,48 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import React from 'react';
6
- import { jsx } from '@emotion/react';
7
- import type { WithIntlProps, WrappedComponentProps } from 'react-intl';
8
- import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
9
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
10
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
11
- import type { TextColorPluginState } from '../../pm-plugins/main';
12
- import type { TextColorPlugin } from '../../textColorPluginType';
13
- import { ToolbarType } from '../../types';
14
- export interface State {
15
- isOpen: boolean;
16
- isOpenedByKeyboard: boolean;
17
- }
18
- export interface Props {
19
- disabled?: boolean;
20
- dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
21
- editorView: EditorView;
22
- isReducedSpacing?: boolean;
23
- pluginInjectionApi: ExtractInjectionAPI<TextColorPlugin> | undefined;
24
- pluginState: TextColorPluginState;
25
- popupsBoundariesElement?: HTMLElement;
26
- popupsMountPoint?: HTMLElement;
27
- popupsScrollableElement?: HTMLElement;
28
- toolbarType: ToolbarType;
29
- }
30
- export declare class ToolbarTextColor extends React.Component<Props & WrappedComponentProps, State> {
31
- state: State;
32
- private toolbarItemRef;
33
- changeColor: (color: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => boolean;
34
- render(): jsx.JSX.Element;
35
- private changeTextColor;
36
- private toggleOpen;
37
- private onKeyDown;
38
- private handleOpenChange;
39
- private hide;
40
- private hideonEsc;
41
- private getSelectedColor;
42
- private buildAnalyticsPalette;
43
- private dispatchAnalyticsEvent;
44
- }
45
- declare const _default_1: React.FC<WithIntlProps<Props & WrappedComponentProps>> & {
46
- WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
47
- };
48
- export default _default_1;
@@ -1,4 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
- import type { TextColorPlugin } from '../textColorPluginType';
4
- export declare const getToolbarComponents: (api: ExtractInjectionAPI<TextColorPlugin> | undefined) => RegisterComponent[];