@atlaskit/editor-plugin-text-color 0.1.14 → 0.1.16

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,18 @@
1
1
  # @atlaskit/editor-plugin-text-color
2
2
 
3
+ ## 0.1.16
4
+
5
+ ### Patch Changes
6
+
7
+ - [#67557](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67557) [`124d0c6d5286`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/124d0c6d5286) - Migrating block-type, text-color, and text-formatting to use useSharedPluginState rather than WithPluginState. Removing unused option on default preset. Adding formattingIsPresent prop to TextFormattingState.
8
+ - Updated dependencies
9
+
10
+ ## 0.1.15
11
+
12
+ ### Patch Changes
13
+
14
+ - [#65802](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/65802) [`438ead060875`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/438ead060875) - Ensure all editor plugins are marked as singletons
15
+
3
16
  ## 0.1.14
4
17
 
5
18
  ### Patch Changes
@@ -13,10 +13,9 @@ Object.defineProperty(exports, "textColorPluginKey", {
13
13
  });
14
14
  var _react = _interopRequireDefault(require("react"));
15
15
  var _adfSchema = require("@atlaskit/adf-schema");
16
- var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
17
16
  var _changeColor2 = require("./commands/change-color");
18
17
  var _main = require("./pm-plugins/main");
19
- var _ToolbarTextColor = _interopRequireDefault(require("./ui/ToolbarTextColor"));
18
+ var _PrimaryToolbarComponent = require("./ui/PrimaryToolbarComponent");
20
19
  var pluginConfig = function pluginConfig(textColorConfig) {
21
20
  if (!textColorConfig || typeof textColorConfig === 'boolean') {
22
21
  return undefined;
@@ -63,24 +62,15 @@ var textColorPlugin = exports.textColorPlugin = function textColorPlugin(_ref) {
63
62
  isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing,
64
63
  dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
65
64
  disabled = _ref3.disabled;
66
- return /*#__PURE__*/_react.default.createElement(_withPluginState.WithPluginState, {
67
- plugins: {
68
- textColor: _main.pluginKey
69
- },
70
- render: function render(_ref4) {
71
- var textColor = _ref4.textColor;
72
- return /*#__PURE__*/_react.default.createElement(_ToolbarTextColor.default, {
73
- pluginState: textColor,
74
- isReducedSpacing: isToolbarReducedSpacing,
75
- editorView: editorView,
76
- popupsMountPoint: popupsMountPoint,
77
- popupsBoundariesElement: popupsBoundariesElement,
78
- popupsScrollableElement: popupsScrollableElement,
79
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
80
- disabled: disabled,
81
- pluginInjectionApi: api
82
- });
83
- }
65
+ return /*#__PURE__*/_react.default.createElement(_PrimaryToolbarComponent.PrimaryToolbarComponent, {
66
+ isReducedSpacing: isToolbarReducedSpacing,
67
+ editorView: editorView,
68
+ popupsMountPoint: popupsMountPoint,
69
+ popupsBoundariesElement: popupsBoundariesElement,
70
+ popupsScrollableElement: popupsScrollableElement,
71
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
72
+ disabled: disabled,
73
+ api: api
84
74
  });
85
75
  }
86
76
  };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.PrimaryToolbarComponent = PrimaryToolbarComponent;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _hooks = require("@atlaskit/editor-common/hooks");
10
+ var _ToolbarTextColor = _interopRequireDefault(require("./ToolbarTextColor"));
11
+ function PrimaryToolbarComponent(_ref) {
12
+ var api = _ref.api,
13
+ isReducedSpacing = _ref.isReducedSpacing,
14
+ editorView = _ref.editorView,
15
+ popupsMountPoint = _ref.popupsMountPoint,
16
+ popupsScrollableElement = _ref.popupsScrollableElement,
17
+ popupsBoundariesElement = _ref.popupsBoundariesElement,
18
+ dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
19
+ disabled = _ref.disabled;
20
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['textColor']),
21
+ textColorState = _useSharedPluginState.textColorState;
22
+ return /*#__PURE__*/_react.default.createElement(_ToolbarTextColor.default, {
23
+ pluginState: textColorState,
24
+ isReducedSpacing: isReducedSpacing,
25
+ editorView: editorView,
26
+ popupsMountPoint: popupsMountPoint,
27
+ popupsBoundariesElement: popupsBoundariesElement,
28
+ popupsScrollableElement: popupsScrollableElement,
29
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
30
+ disabled: disabled,
31
+ pluginInjectionApi: api
32
+ });
33
+ }
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
2
  import { textColor } from '@atlaskit/adf-schema';
3
- import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
4
3
  import { changeColor } from './commands/change-color';
5
4
  import { createPlugin, pluginKey as textColorPluginKey } from './pm-plugins/main';
6
- import ToolbarTextColor from './ui/ToolbarTextColor';
5
+ import { PrimaryToolbarComponent } from './ui/PrimaryToolbarComponent';
7
6
  const pluginConfig = textColorConfig => {
8
7
  if (!textColorConfig || typeof textColorConfig === 'boolean') {
9
8
  return undefined;
@@ -51,23 +50,15 @@ export const textColorPlugin = ({
51
50
  dispatchAnalyticsEvent,
52
51
  disabled
53
52
  }) {
54
- return /*#__PURE__*/React.createElement(WithPluginState, {
55
- plugins: {
56
- textColor: textColorPluginKey
57
- },
58
- render: ({
59
- textColor
60
- }) => /*#__PURE__*/React.createElement(ToolbarTextColor, {
61
- pluginState: textColor,
62
- isReducedSpacing: isToolbarReducedSpacing,
63
- editorView: editorView,
64
- popupsMountPoint: popupsMountPoint,
65
- popupsBoundariesElement: popupsBoundariesElement,
66
- popupsScrollableElement: popupsScrollableElement,
67
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
68
- disabled: disabled,
69
- pluginInjectionApi: api
70
- })
53
+ return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
54
+ isReducedSpacing: isToolbarReducedSpacing,
55
+ editorView: editorView,
56
+ popupsMountPoint: popupsMountPoint,
57
+ popupsBoundariesElement: popupsBoundariesElement,
58
+ popupsScrollableElement: popupsScrollableElement,
59
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
60
+ disabled: disabled,
61
+ api: api
71
62
  });
72
63
  }
73
64
  };
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
+ import ToolbarTextColor from './ToolbarTextColor';
4
+ export function PrimaryToolbarComponent({
5
+ api,
6
+ isReducedSpacing,
7
+ editorView,
8
+ popupsMountPoint,
9
+ popupsScrollableElement,
10
+ popupsBoundariesElement,
11
+ dispatchAnalyticsEvent,
12
+ disabled
13
+ }) {
14
+ const {
15
+ textColorState
16
+ } = useSharedPluginState(api, ['textColor']);
17
+ return /*#__PURE__*/React.createElement(ToolbarTextColor, {
18
+ pluginState: textColorState,
19
+ isReducedSpacing: isReducedSpacing,
20
+ editorView: editorView,
21
+ popupsMountPoint: popupsMountPoint,
22
+ popupsBoundariesElement: popupsBoundariesElement,
23
+ popupsScrollableElement: popupsScrollableElement,
24
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
25
+ disabled: disabled,
26
+ pluginInjectionApi: api
27
+ });
28
+ }
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
2
  import { textColor } from '@atlaskit/adf-schema';
3
- import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
4
3
  import { changeColor as _changeColor } from './commands/change-color';
5
4
  import { createPlugin, pluginKey as textColorPluginKey } from './pm-plugins/main';
6
- import ToolbarTextColor from './ui/ToolbarTextColor';
5
+ import { PrimaryToolbarComponent } from './ui/PrimaryToolbarComponent';
7
6
  var pluginConfig = function pluginConfig(textColorConfig) {
8
7
  if (!textColorConfig || typeof textColorConfig === 'boolean') {
9
8
  return undefined;
@@ -50,24 +49,15 @@ export var textColorPlugin = function textColorPlugin(_ref) {
50
49
  isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing,
51
50
  dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
52
51
  disabled = _ref3.disabled;
53
- return /*#__PURE__*/React.createElement(WithPluginState, {
54
- plugins: {
55
- textColor: textColorPluginKey
56
- },
57
- render: function render(_ref4) {
58
- var textColor = _ref4.textColor;
59
- return /*#__PURE__*/React.createElement(ToolbarTextColor, {
60
- pluginState: textColor,
61
- isReducedSpacing: isToolbarReducedSpacing,
62
- editorView: editorView,
63
- popupsMountPoint: popupsMountPoint,
64
- popupsBoundariesElement: popupsBoundariesElement,
65
- popupsScrollableElement: popupsScrollableElement,
66
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
67
- disabled: disabled,
68
- pluginInjectionApi: api
69
- });
70
- }
52
+ return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
53
+ isReducedSpacing: isToolbarReducedSpacing,
54
+ editorView: editorView,
55
+ popupsMountPoint: popupsMountPoint,
56
+ popupsBoundariesElement: popupsBoundariesElement,
57
+ popupsScrollableElement: popupsScrollableElement,
58
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
59
+ disabled: disabled,
60
+ api: api
71
61
  });
72
62
  }
73
63
  };
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
+ import ToolbarTextColor from './ToolbarTextColor';
4
+ export function PrimaryToolbarComponent(_ref) {
5
+ var api = _ref.api,
6
+ isReducedSpacing = _ref.isReducedSpacing,
7
+ editorView = _ref.editorView,
8
+ popupsMountPoint = _ref.popupsMountPoint,
9
+ popupsScrollableElement = _ref.popupsScrollableElement,
10
+ popupsBoundariesElement = _ref.popupsBoundariesElement,
11
+ dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
12
+ disabled = _ref.disabled;
13
+ var _useSharedPluginState = useSharedPluginState(api, ['textColor']),
14
+ textColorState = _useSharedPluginState.textColorState;
15
+ return /*#__PURE__*/React.createElement(ToolbarTextColor, {
16
+ pluginState: textColorState,
17
+ isReducedSpacing: isReducedSpacing,
18
+ editorView: editorView,
19
+ popupsMountPoint: popupsMountPoint,
20
+ popupsBoundariesElement: popupsBoundariesElement,
21
+ popupsScrollableElement: popupsScrollableElement,
22
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
23
+ disabled: disabled,
24
+ pluginInjectionApi: api
25
+ });
26
+ }
@@ -0,0 +1,17 @@
1
+ /// <reference types="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 '../types';
6
+ interface PrimaryToolbarComponentProps {
7
+ isReducedSpacing: boolean;
8
+ editorView: EditorView;
9
+ popupsMountPoint?: HTMLElement;
10
+ popupsBoundariesElement?: HTMLElement;
11
+ popupsScrollableElement?: HTMLElement;
12
+ dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
13
+ disabled: boolean;
14
+ api: ExtractInjectionAPI<TextColorPlugin> | undefined;
15
+ }
16
+ export declare function PrimaryToolbarComponent({ api, isReducedSpacing, editorView, popupsMountPoint, popupsScrollableElement, popupsBoundariesElement, dispatchAnalyticsEvent, disabled, }: PrimaryToolbarComponentProps): JSX.Element;
17
+ export {};
@@ -0,0 +1,17 @@
1
+ /// <reference types="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 '../types';
6
+ interface PrimaryToolbarComponentProps {
7
+ isReducedSpacing: boolean;
8
+ editorView: EditorView;
9
+ popupsMountPoint?: HTMLElement;
10
+ popupsBoundariesElement?: HTMLElement;
11
+ popupsScrollableElement?: HTMLElement;
12
+ dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
13
+ disabled: boolean;
14
+ api: ExtractInjectionAPI<TextColorPlugin> | undefined;
15
+ }
16
+ export declare function PrimaryToolbarComponent({ api, isReducedSpacing, editorView, popupsMountPoint, popupsScrollableElement, popupsBoundariesElement, dispatchAnalyticsEvent, disabled, }: PrimaryToolbarComponentProps): JSX.Element;
17
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-color",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "Text color plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -9,11 +9,12 @@
9
9
  },
10
10
  "atlassian": {
11
11
  "team": "Editor: Lego",
12
+ "singleton": true,
12
13
  "inPublicMirror": false,
13
14
  "releaseModel": "continuous",
14
15
  "runReact18": false
15
16
  },
16
- "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
17
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
17
18
  "main": "dist/cjs/index.js",
18
19
  "module": "dist/esm/index.js",
19
20
  "module:es2019": "dist/es2019/index.js",
@@ -33,7 +34,7 @@
33
34
  },
34
35
  "dependencies": {
35
36
  "@atlaskit/adf-schema": "^35.3.0",
36
- "@atlaskit/editor-common": "^76.35.0",
37
+ "@atlaskit/editor-common": "^76.40.0",
37
38
  "@atlaskit/editor-palette": "1.5.2",
38
39
  "@atlaskit/editor-plugin-analytics": "^0.4.0",
39
40
  "@atlaskit/editor-prosemirror": "1.1.0",
@@ -53,7 +54,6 @@
53
54
  "@af/visual-regression": "*",
54
55
  "@atlaskit/ssr": "*",
55
56
  "@atlaskit/visual-regression": "*",
56
- "@atlaskit/webdriver-runner": "*",
57
57
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
58
58
  "@testing-library/react": "^12.1.5",
59
59
  "react-dom": "^16.8.0",