@atlaskit/editor-plugin-text-color 7.1.0 → 7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @atlaskit/editor-plugin-text-color
2
2
 
3
+ ## 7.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`87b12e64ff750`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/87b12e64ff750) -
8
+ Removed usages of LEGACY icon props
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 7.1.1
15
+
16
+ ### Patch Changes
17
+
18
+ - [`c4d291905a6e1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c4d291905a6e1) -
19
+ Add new types for common plugin configuration, use for insert block plugin and add new config to
20
+ textColorPlugin to hide the text color toolbar
21
+ - Updated dependencies
22
+
3
23
  ## 7.1.0
4
24
 
5
25
  ### Minor Changes
@@ -24,6 +24,9 @@ var pluginConfig = function pluginConfig(textColorConfig) {
24
24
  }
25
25
  return textColorConfig;
26
26
  };
27
+ var isToolbarComponentEnabled = function isToolbarComponentEnabled(textColorConfig) {
28
+ return textColorConfig === undefined || textColorConfig.toolbarConfig === undefined || textColorConfig.toolbarConfig.enabled !== false;
29
+ };
27
30
  var textColorPlugin = exports.textColorPlugin = function textColorPlugin(_ref) {
28
31
  var textColorConfig = _ref.config,
29
32
  api = _ref.api;
@@ -51,9 +54,16 @@ var textColorPlugin = exports.textColorPlugin = function textColorPlugin(_ref) {
51
54
  });
52
55
  };
53
56
  if (isToolbarAIFCEnabled) {
54
- var _api$toolbar;
55
- if (api !== null && api !== void 0 && (_api$toolbar = api.toolbar) !== null && _api$toolbar !== void 0 && _api$toolbar.actions.registerComponents) {
56
- api.toolbar.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)(api));
57
+ if ((0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_text_color_config')) {
58
+ var _api$toolbar;
59
+ if (api !== null && api !== void 0 && (_api$toolbar = api.toolbar) !== null && _api$toolbar !== void 0 && _api$toolbar.actions.registerComponents && isToolbarComponentEnabled(pluginConfig(textColorConfig))) {
60
+ api.toolbar.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)(api));
61
+ }
62
+ } else {
63
+ var _api$toolbar2;
64
+ if (api !== null && api !== void 0 && (_api$toolbar2 = api.toolbar) !== null && _api$toolbar2 !== void 0 && _api$toolbar2.actions.registerComponents) {
65
+ api.toolbar.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)(api));
66
+ }
57
67
  }
58
68
  } else {
59
69
  var _api$primaryToolbar;
@@ -217,7 +217,6 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
217
217
  }, (0, _react2.jsx)(_chevronDown.default, {
218
218
  label: "",
219
219
  color: "currentColor",
220
- LEGACY_margin: "0 0 0 -8px",
221
220
  size: "small"
222
221
  })))
223
222
  })
@@ -17,6 +17,9 @@ const pluginConfig = textColorConfig => {
17
17
  }
18
18
  return textColorConfig;
19
19
  };
20
+ const isToolbarComponentEnabled = textColorConfig => {
21
+ return textColorConfig === undefined || textColorConfig.toolbarConfig === undefined || textColorConfig.toolbarConfig.enabled !== false;
22
+ };
20
23
  export const textColorPlugin = ({
21
24
  config: textColorConfig,
22
25
  api
@@ -46,9 +49,16 @@ export const textColorPlugin = ({
46
49
  });
47
50
  };
48
51
  if (isToolbarAIFCEnabled) {
49
- var _api$toolbar;
50
- if (api !== null && api !== void 0 && (_api$toolbar = api.toolbar) !== null && _api$toolbar !== void 0 && _api$toolbar.actions.registerComponents) {
51
- api.toolbar.actions.registerComponents(getToolbarComponents(api));
52
+ if (fg('platform_editor_toolbar_aifc_text_color_config')) {
53
+ var _api$toolbar;
54
+ if (api !== null && api !== void 0 && (_api$toolbar = api.toolbar) !== null && _api$toolbar !== void 0 && _api$toolbar.actions.registerComponents && isToolbarComponentEnabled(pluginConfig(textColorConfig))) {
55
+ api.toolbar.actions.registerComponents(getToolbarComponents(api));
56
+ }
57
+ } else {
58
+ var _api$toolbar2;
59
+ if (api !== null && api !== void 0 && (_api$toolbar2 = api.toolbar) !== null && _api$toolbar2 !== void 0 && _api$toolbar2.actions.registerComponents) {
60
+ api.toolbar.actions.registerComponents(getToolbarComponents(api));
61
+ }
52
62
  }
53
63
  } else {
54
64
  var _api$primaryToolbar;
@@ -197,7 +197,6 @@ export class ToolbarTextColor extends React.Component {
197
197
  }, jsx(ChevronDownIcon, {
198
198
  label: "",
199
199
  color: "currentColor",
200
- LEGACY_margin: "0 0 0 -8px",
201
200
  size: "small"
202
201
  })))
203
202
  })
@@ -17,6 +17,9 @@ var pluginConfig = function pluginConfig(textColorConfig) {
17
17
  }
18
18
  return textColorConfig;
19
19
  };
20
+ var isToolbarComponentEnabled = function isToolbarComponentEnabled(textColorConfig) {
21
+ return textColorConfig === undefined || textColorConfig.toolbarConfig === undefined || textColorConfig.toolbarConfig.enabled !== false;
22
+ };
20
23
  export var textColorPlugin = function textColorPlugin(_ref) {
21
24
  var textColorConfig = _ref.config,
22
25
  api = _ref.api;
@@ -44,9 +47,16 @@ export var textColorPlugin = function textColorPlugin(_ref) {
44
47
  });
45
48
  };
46
49
  if (isToolbarAIFCEnabled) {
47
- var _api$toolbar;
48
- if (api !== null && api !== void 0 && (_api$toolbar = api.toolbar) !== null && _api$toolbar !== void 0 && _api$toolbar.actions.registerComponents) {
49
- api.toolbar.actions.registerComponents(getToolbarComponents(api));
50
+ if (fg('platform_editor_toolbar_aifc_text_color_config')) {
51
+ var _api$toolbar;
52
+ if (api !== null && api !== void 0 && (_api$toolbar = api.toolbar) !== null && _api$toolbar !== void 0 && _api$toolbar.actions.registerComponents && isToolbarComponentEnabled(pluginConfig(textColorConfig))) {
53
+ api.toolbar.actions.registerComponents(getToolbarComponents(api));
54
+ }
55
+ } else {
56
+ var _api$toolbar2;
57
+ if (api !== null && api !== void 0 && (_api$toolbar2 = api.toolbar) !== null && _api$toolbar2 !== void 0 && _api$toolbar2.actions.registerComponents) {
58
+ api.toolbar.actions.registerComponents(getToolbarComponents(api));
59
+ }
50
60
  }
51
61
  } else {
52
62
  var _api$primaryToolbar;
@@ -213,7 +213,6 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
213
213
  }, jsx(ChevronDownIcon, {
214
214
  label: "",
215
215
  color: "currentColor",
216
- LEGACY_margin: "0 0 0 -8px",
217
216
  size: "small"
218
217
  })))
219
218
  })
@@ -1,5 +1,6 @@
1
1
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
+ import type { PluginToolbarComponentConfig } from '@atlaskit/editor-common/toolbar';
3
4
  import type { PaletteColor } from '@atlaskit/editor-common/ui-color';
4
5
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
6
  export type TextColorPluginState = {
@@ -15,6 +16,18 @@ type TextColorDefaultColor = {
15
16
  };
16
17
  export interface TextColorPluginConfig {
17
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'>;
18
31
  }
19
32
  export declare enum ACTIONS {
20
33
  RESET_COLOR = 0,
@@ -1,5 +1,6 @@
1
1
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
+ import type { PluginToolbarComponentConfig } from '@atlaskit/editor-common/toolbar';
3
4
  import type { PaletteColor } from '@atlaskit/editor-common/ui-color';
4
5
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
6
  export type TextColorPluginState = {
@@ -15,6 +16,18 @@ type TextColorDefaultColor = {
15
16
  };
16
17
  export interface TextColorPluginConfig {
17
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'>;
18
31
  }
19
32
  export declare enum ACTIONS {
20
33
  RESET_COLOR = 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-color",
3
- "version": "7.1.0",
3
+ "version": "7.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,26 +34,26 @@
34
34
  "@atlaskit/css": "^0.19.0",
35
35
  "@atlaskit/editor-palette": "^2.1.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^7.0.0",
37
- "@atlaskit/editor-plugin-highlight": "^7.1.0",
37
+ "@atlaskit/editor-plugin-highlight": "^7.2.0",
38
38
  "@atlaskit/editor-plugin-primary-toolbar": "^8.0.0",
39
39
  "@atlaskit/editor-plugin-selection-toolbar": "^8.0.0",
40
40
  "@atlaskit/editor-plugin-toolbar": "^4.0.0",
41
41
  "@atlaskit/editor-prosemirror": "^7.2.0",
42
42
  "@atlaskit/editor-shared-styles": "^3.10.0",
43
- "@atlaskit/editor-toolbar": "^0.18.0",
43
+ "@atlaskit/editor-toolbar": "^0.19.0",
44
44
  "@atlaskit/editor-toolbar-model": "^0.2.0",
45
45
  "@atlaskit/heading": "^5.2.0",
46
- "@atlaskit/icon": "^29.3.0",
46
+ "@atlaskit/icon": "^29.4.0",
47
47
  "@atlaskit/platform-feature-flags": "^1.1.0",
48
48
  "@atlaskit/primitives": "^17.0.0",
49
49
  "@atlaskit/theme": "^21.0.0",
50
- "@atlaskit/tmp-editor-statsig": "^16.3.0",
51
- "@atlaskit/tokens": "^9.0.0",
50
+ "@atlaskit/tmp-editor-statsig": "^16.11.0",
51
+ "@atlaskit/tokens": "^9.1.0",
52
52
  "@babel/runtime": "^7.0.0",
53
53
  "@emotion/react": "^11.7.1"
54
54
  },
55
55
  "peerDependencies": {
56
- "@atlaskit/editor-common": "^111.1.0",
56
+ "@atlaskit/editor-common": "^111.7.0",
57
57
  "react": "^18.2.0",
58
58
  "react-dom": "^18.2.0",
59
59
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -107,6 +107,9 @@
107
107
  },
108
108
  "platform_editor_toolbar_aifc_patch_7": {
109
109
  "type": "boolean"
110
+ },
111
+ "platform_editor_toolbar_aifc_text_color_config": {
112
+ "type": "boolean"
110
113
  }
111
114
  }
112
115
  }