@atlaskit/editor-plugin-text-color 1.16.4 → 1.16.6

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 (33) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/pm-plugins/commands/change-color.js +2 -0
  3. package/dist/cjs/pm-plugins/main.js +2 -6
  4. package/dist/cjs/pm-plugins/utils/inputType.js +1 -2
  5. package/dist/cjs/textColorPlugin.js +0 -6
  6. package/dist/cjs/ui/FloatingToolbarComponent.js +7 -1
  7. package/dist/cjs/ui/PrimaryToolbarComponent.js +7 -1
  8. package/dist/cjs/ui/ToolbarTextColor/icon.js +16 -9
  9. package/dist/cjs/ui/ToolbarTextColor/index.js +18 -18
  10. package/dist/es2019/index.js +3 -0
  11. package/dist/es2019/pm-plugins/commands/change-color.js +2 -0
  12. package/dist/es2019/pm-plugins/commands/remove-color.js +1 -1
  13. package/dist/es2019/pm-plugins/commands/toggle-color.js +1 -1
  14. package/dist/es2019/pm-plugins/main.js +2 -1
  15. package/dist/es2019/textColorPlugin.js +1 -2
  16. package/dist/es2019/ui/FloatingToolbarComponent.js +7 -1
  17. package/dist/es2019/ui/PrimaryToolbarComponent.js +7 -1
  18. package/dist/es2019/ui/ToolbarTextColor/icon.js +7 -1
  19. package/dist/es2019/ui/ToolbarTextColor/index.js +4 -1
  20. package/dist/esm/index.js +3 -0
  21. package/dist/esm/pm-plugins/commands/change-color.js +2 -0
  22. package/dist/esm/pm-plugins/main.js +2 -1
  23. package/dist/esm/pm-plugins/utils/inputType.js +1 -2
  24. package/dist/esm/textColorPlugin.js +1 -2
  25. package/dist/esm/ui/FloatingToolbarComponent.js +7 -1
  26. package/dist/esm/ui/PrimaryToolbarComponent.js +7 -1
  27. package/dist/esm/ui/ToolbarTextColor/icon.js +16 -9
  28. package/dist/esm/ui/ToolbarTextColor/index.js +18 -18
  29. package/dist/types/pm-plugins/main.d.ts +1 -1
  30. package/dist/types/textColorPlugin.d.ts +0 -4
  31. package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
  32. package/dist/types-ts4.5/textColorPlugin.d.ts +0 -4
  33. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-text-color
2
2
 
3
+ ## 1.16.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.16.5
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 1.16.4
4
16
 
5
17
  ### Patch Changes
@@ -17,6 +17,8 @@ var _toggleColor = require("./toggle-color");
17
17
  * @param palette - Current palette of colors
18
18
  * @return Higher order command with analytics logic inside.
19
19
  */
20
+ // Ignored via go/ees005
21
+ // eslint-disable-next-line @typescript-eslint/max-params
20
22
  function createWithColorAnalytics(newColor, previousColor, palette, editorAnalyticsApi, inputMethod) {
21
23
  var newColorFromPalette = palette.find(function (_ref) {
22
24
  var value = _ref.value;
@@ -5,12 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.ACTIONS = void 0;
8
- Object.defineProperty(exports, "DEFAULT_COLOR", {
9
- enumerable: true,
10
- get: function get() {
11
- return _constants.DEFAULT_COLOR;
12
- }
13
- });
14
8
  exports.createPlugin = createPlugin;
15
9
  exports.pluginKey = void 0;
16
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
@@ -52,6 +46,8 @@ function createPlugin(dispatch, pluginConfig) {
52
46
  init: function init(_config, editorState) {
53
47
  return createInitialPluginState(editorState, pluginConfig);
54
48
  },
49
+ // Ignored via go/ees005
50
+ // eslint-disable-next-line @typescript-eslint/max-params
55
51
  apply: function apply(tr, pluginState, _, newState) {
56
52
  var meta = tr.getMeta(pluginKey) || {};
57
53
  var nextState;
@@ -8,8 +8,7 @@ exports.getInputMethod = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _analytics = require("@atlaskit/editor-common/analytics");
10
10
  var _types = require("../../types");
11
- var _toolbarTypeToInputMe;
12
- var toolbarTypeToInputMethod = (_toolbarTypeToInputMe = {}, (0, _defineProperty2.default)(_toolbarTypeToInputMe, _types.ToolbarType.PRIMARY, _analytics.INPUT_METHOD.TOOLBAR), (0, _defineProperty2.default)(_toolbarTypeToInputMe, _types.ToolbarType.FLOATING, _analytics.INPUT_METHOD.FLOATING_TB), _toolbarTypeToInputMe);
11
+ var toolbarTypeToInputMethod = (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.ToolbarType.PRIMARY, _analytics.INPUT_METHOD.TOOLBAR), _types.ToolbarType.FLOATING, _analytics.INPUT_METHOD.FLOATING_TB);
13
12
  var getInputMethod = exports.getInputMethod = function getInputMethod(toolbarType) {
14
13
  return toolbarTypeToInputMethod[toolbarType];
15
14
  };
@@ -5,12 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.textColorPlugin = void 0;
8
- Object.defineProperty(exports, "textColorPluginKey", {
9
- enumerable: true,
10
- get: function get() {
11
- return _main.pluginKey;
12
- }
13
- });
14
8
  var _react = _interopRequireDefault(require("react"));
15
9
  var _adfSchema = require("@atlaskit/adf-schema");
16
10
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
@@ -9,6 +9,9 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _hooks = require("@atlaskit/editor-common/hooks");
10
10
  var _types = require("../types");
11
11
  var _ToolbarTextColor = _interopRequireDefault(require("./ToolbarTextColor"));
12
+ // Ignored via go/ees005
13
+ // eslint-disable-next-line import/no-named-as-default
14
+
12
15
  var FloatingToolbarSettings = {
13
16
  disabled: false,
14
17
  isReducedSpacing: true
@@ -19,7 +22,10 @@ function FloatingToolbarComponent(_ref) {
19
22
  dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
20
23
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['textColor']),
21
24
  textColorState = _useSharedPluginState.textColorState;
22
- return /*#__PURE__*/_react.default.createElement(_ToolbarTextColor.default, {
25
+ return /*#__PURE__*/_react.default.createElement(_ToolbarTextColor.default
26
+ // Ignored via go/ees005
27
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
28
+ , {
23
29
  pluginState: textColorState,
24
30
  isReducedSpacing: FloatingToolbarSettings.isReducedSpacing,
25
31
  editorView: editorView,
@@ -9,6 +9,9 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _hooks = require("@atlaskit/editor-common/hooks");
10
10
  var _types = require("../types");
11
11
  var _ToolbarTextColor = _interopRequireDefault(require("./ToolbarTextColor"));
12
+ // Ignored via go/ees005
13
+ // eslint-disable-next-line import/no-named-as-default
14
+
12
15
  function PrimaryToolbarComponent(_ref) {
13
16
  var api = _ref.api,
14
17
  isReducedSpacing = _ref.isReducedSpacing,
@@ -20,7 +23,10 @@ function PrimaryToolbarComponent(_ref) {
20
23
  disabled = _ref.disabled;
21
24
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['textColor']),
22
25
  textColorState = _useSharedPluginState.textColorState;
23
- return /*#__PURE__*/_react.default.createElement(_ToolbarTextColor.default, {
26
+ return /*#__PURE__*/_react.default.createElement(_ToolbarTextColor.default
27
+ // Ignored via go/ees005
28
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
29
+ , {
24
30
  pluginState: textColorState,
25
31
  isReducedSpacing: isReducedSpacing,
26
32
  editorView: editorView,
@@ -9,17 +9,24 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _base = _interopRequireDefault(require("@atlaskit/icon/base"));
11
11
  // eslint-disable-next-line @atlassian/tangerine/import/entry-points
12
+ // Ignored via go/ees005
13
+ // eslint-disable-next-line import/no-named-as-default
12
14
 
13
15
  var textColorGlyph = function textColorGlyph(props) {
14
- return /*#__PURE__*/_react.default.createElement("svg", (0, _extends2.default)({}, props, {
15
- width: "24",
16
- height: "24",
17
- xmlns: "http://www.w3.org/2000/svg"
18
- }), /*#__PURE__*/_react.default.createElement("path", {
19
- d: "M14 12.5h-4l-.874 2.186A.5.5 0 0 1 8.66 15H7.273a.5.5 0 0 1-.456-.705l4.05-9A.5.5 0 0 1 11.323 5h1.354a.5.5 0 0 1 .456.295l4.05 9a.5.5 0 0 1-.456.705h-1.388a.5.5 0 0 1-.465-.314L14 12.5zm-.6-1.5L12 7.5 10.6 11h2.8z",
20
- fill: "currentColor",
21
- fillRule: "evenodd"
22
- }));
16
+ return (
17
+ /*#__PURE__*/
18
+ // Ignored via go/ees005
19
+ // eslint-disable-next-line react/jsx-props-no-spreading
20
+ _react.default.createElement("svg", (0, _extends2.default)({}, props, {
21
+ width: "24",
22
+ height: "24",
23
+ xmlns: "http://www.w3.org/2000/svg"
24
+ }), /*#__PURE__*/_react.default.createElement("path", {
25
+ d: "M14 12.5h-4l-.874 2.186A.5.5 0 0 1 8.66 15H7.273a.5.5 0 0 1-.456-.705l4.05-9A.5.5 0 0 1 11.323 5h1.354a.5.5 0 0 1 .456.295l4.05 9a.5.5 0 0 1-.456.705h-1.388a.5.5 0 0 1-.465-.314L14 12.5zm-.6-1.5L12 7.5 10.6 11h2.8z",
26
+ fill: "currentColor",
27
+ fillRule: "evenodd"
28
+ }))
29
+ );
23
30
  };
24
31
  var EditorTextColorIcon = exports.EditorTextColorIcon = function EditorTextColorIcon() {
25
32
  return /*#__PURE__*/_react.default.createElement(_base.default, {
@@ -7,10 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = exports.ToolbarTextColor = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
10
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
11
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
14
  var _react = _interopRequireDefault(require("react"));
16
15
  var _react2 = require("@emotion/react");
@@ -32,7 +31,7 @@ var _types = require("../../types");
32
31
  var _icon = require("./icon");
33
32
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
34
33
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
35
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
34
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
36
35
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
37
36
  * @jsxRuntime classic
38
37
  * @jsx jsx
@@ -41,24 +40,22 @@ var EXPERIMENT_NAME = 'editor.toolbarTextColor.moreColors';
41
40
  var EXPERIMENT_GROUP_CONTROL = 'control';
42
41
  // eslint-disable-next-line @repo/internal/react/no-class-components
43
42
  var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
44
- (0, _inherits2.default)(ToolbarTextColor, _React$Component);
45
- var _super = _createSuper(ToolbarTextColor);
46
43
  function ToolbarTextColor() {
47
44
  var _this;
48
45
  (0, _classCallCheck2.default)(this, ToolbarTextColor);
49
46
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
50
47
  args[_key] = arguments[_key];
51
48
  }
52
- _this = _super.call.apply(_super, [this].concat(args));
53
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
49
+ _this = _callSuper(this, ToolbarTextColor, [].concat(args));
50
+ (0, _defineProperty2.default)(_this, "state", {
54
51
  isOpen: false,
55
52
  isOpenedByKeyboard: false
56
53
  });
57
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toolbarItemRef", /*#__PURE__*/_react.default.createRef());
58
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "changeColor", function (color, editorAnalyticsApi) {
54
+ (0, _defineProperty2.default)(_this, "toolbarItemRef", /*#__PURE__*/_react.default.createRef());
55
+ (0, _defineProperty2.default)(_this, "changeColor", function (color, editorAnalyticsApi) {
59
56
  return (0, _changeColor.changeColor)(color, editorAnalyticsApi, (0, _inputType.getInputMethod)(_this.props.toolbarType))(_this.props.editorView.state, _this.props.editorView.dispatch);
60
57
  });
61
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "changeTextColor", function (color, editorAnalyticsApi, disabled) {
58
+ (0, _defineProperty2.default)(_this, "changeTextColor", function (color, editorAnalyticsApi, disabled) {
62
59
  if (!disabled) {
63
60
  var _this$props$editorVie;
64
61
  var palette = _this.props.pluginState.palette;
@@ -80,13 +77,13 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
80
77
  }
81
78
  return false;
82
79
  });
83
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleOpen", function () {
80
+ (0, _defineProperty2.default)(_this, "toggleOpen", function () {
84
81
  _this.handleOpenChange({
85
82
  isOpen: !_this.state.isOpen,
86
83
  logCloseEvent: true
87
84
  });
88
85
  });
89
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onKeyDown", function (event) {
86
+ (0, _defineProperty2.default)(_this, "onKeyDown", function (event) {
90
87
  if (event.key === 'Enter' || event.key === ' ') {
91
88
  event.preventDefault();
92
89
  _this.setState({
@@ -95,7 +92,7 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
95
92
  _this.toggleOpen();
96
93
  }
97
94
  });
98
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleOpenChange", function (_ref) {
95
+ (0, _defineProperty2.default)(_this, "handleOpenChange", function (_ref) {
99
96
  var isOpen = _ref.isOpen,
100
97
  logCloseEvent = _ref.logCloseEvent;
101
98
  _this.setState({
@@ -112,7 +109,7 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
112
109
  }));
113
110
  }
114
111
  });
115
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hide", function (e) {
112
+ (0, _defineProperty2.default)(_this, "hide", function (e) {
116
113
  var isOpen = _this.state.isOpen;
117
114
  if (isOpen === true) {
118
115
  _this.dispatchAnalyticsEvent(_this.buildAnalyticsPalette(_analytics.ACTION.CLOSED, {
@@ -127,14 +124,15 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
127
124
  }
128
125
  }
129
126
  });
130
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hideonEsc", function (e) {
127
+ (0, _defineProperty2.default)(_this, "hideonEsc", function (e) {
131
128
  var _this$toolbarItemRef2;
132
129
  _this.hide(e);
133
130
  (_this$toolbarItemRef2 = _this.toolbarItemRef) === null || _this$toolbarItemRef2 === void 0 || (_this$toolbarItemRef2 = _this$toolbarItemRef2.current) === null || _this$toolbarItemRef2 === void 0 || _this$toolbarItemRef2.focus();
134
131
  });
135
132
  return _this;
136
133
  }
137
- (0, _createClass2.default)(ToolbarTextColor, [{
134
+ (0, _inherits2.default)(ToolbarTextColor, _React$Component);
135
+ return (0, _createClass2.default)(ToolbarTextColor, [{
138
136
  key: "render",
139
137
  value: function render() {
140
138
  var _palette$find,
@@ -260,7 +258,10 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
260
258
  }, {
261
259
  key: "getSelectedColor",
262
260
  value: function getSelectedColor(pluginState) {
263
- var selectedColor = pluginState.color !== pluginState.defaultColor ? pluginState.color ? (0, _editorPalette.hexToEditorTextPaletteColor)(pluginState.color) : pluginState.color : null;
261
+ var selectedColor = pluginState.color !== pluginState.defaultColor ? pluginState.color ?
262
+ // Ignored via go/ees005
263
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
264
+ (0, _editorPalette.hexToEditorTextPaletteColor)(pluginState.color) : pluginState.color : null;
264
265
  return selectedColor;
265
266
  }
266
267
  }, {
@@ -302,6 +303,5 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
302
303
  }
303
304
  }
304
305
  }]);
305
- return ToolbarTextColor;
306
306
  }(_react.default.Component);
307
307
  var _default = exports.default = (0, _reactIntlNext.injectIntl)(ToolbarTextColor);
@@ -1 +1,4 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ // Entry file in package.json
3
+
1
4
  export { textColorPlugin } from './textColorPlugin';
@@ -12,6 +12,8 @@ import { toggleColor } from './toggle-color';
12
12
  * @param palette - Current palette of colors
13
13
  * @return Higher order command with analytics logic inside.
14
14
  */
15
+ // Ignored via go/ees005
16
+ // eslint-disable-next-line @typescript-eslint/max-params
15
17
  function createWithColorAnalytics(newColor, previousColor, palette, editorAnalyticsApi, inputMethod) {
16
18
  const newColorFromPalette = palette.find(({
17
19
  value
@@ -7,7 +7,7 @@ export const removeColor = () => (state, dispatch) => {
7
7
  const {
8
8
  textColor
9
9
  } = schema.marks;
10
- let tr = state.tr;
10
+ const tr = state.tr;
11
11
  removeMark(textColor)({
12
12
  tr
13
13
  });
@@ -6,7 +6,7 @@ export const toggleColor = color => (state, dispatch) => {
6
6
  const {
7
7
  textColor
8
8
  } = state.schema.marks;
9
- let tr = state.tr;
9
+ const tr = state.tr;
10
10
  const disabledState = getDisabledState(state);
11
11
  if (disabledState) {
12
12
  if (dispatch) {
@@ -4,7 +4,6 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
4
  import { getActiveColor } from './utils/color';
5
5
  import { DEFAULT_COLOR } from './utils/constants';
6
6
  import { getDisabledState } from './utils/disabled';
7
- export { DEFAULT_COLOR } from './utils/constants';
8
7
  function createInitialPluginState(editorState, pluginConfig) {
9
8
  const defaultColor = (pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.defaultColor) || DEFAULT_COLOR;
10
9
  const palette = [{
@@ -34,6 +33,8 @@ export function createPlugin(dispatch, pluginConfig) {
34
33
  init(_config, editorState) {
35
34
  return createInitialPluginState(editorState, pluginConfig);
36
35
  },
36
+ // Ignored via go/ees005
37
+ // eslint-disable-next-line @typescript-eslint/max-params
37
38
  apply(tr, pluginState, _, newState) {
38
39
  const meta = tr.getMeta(pluginKey) || {};
39
40
  let nextState;
@@ -100,5 +100,4 @@ export const textColorPlugin = ({
100
100
  },
101
101
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
102
102
  };
103
- };
104
- export { textColorPluginKey };
103
+ };
@@ -1,6 +1,9 @@
1
1
  import React from 'react';
2
2
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
3
  import { ToolbarType } from '../types';
4
+
5
+ // Ignored via go/ees005
6
+ // eslint-disable-next-line import/no-named-as-default
4
7
  import ToolbarTextColor from './ToolbarTextColor';
5
8
  const FloatingToolbarSettings = {
6
9
  disabled: false,
@@ -14,7 +17,10 @@ export function FloatingToolbarComponent({
14
17
  const {
15
18
  textColorState
16
19
  } = useSharedPluginState(api, ['textColor']);
17
- return /*#__PURE__*/React.createElement(ToolbarTextColor, {
20
+ return /*#__PURE__*/React.createElement(ToolbarTextColor
21
+ // Ignored via go/ees005
22
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
23
+ , {
18
24
  pluginState: textColorState,
19
25
  isReducedSpacing: FloatingToolbarSettings.isReducedSpacing,
20
26
  editorView: editorView,
@@ -1,6 +1,9 @@
1
1
  import React from 'react';
2
2
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
3
  import { ToolbarType } from '../types';
4
+
5
+ // Ignored via go/ees005
6
+ // eslint-disable-next-line import/no-named-as-default
4
7
  import ToolbarTextColor from './ToolbarTextColor';
5
8
  export function PrimaryToolbarComponent({
6
9
  api,
@@ -15,7 +18,10 @@ export function PrimaryToolbarComponent({
15
18
  const {
16
19
  textColorState
17
20
  } = useSharedPluginState(api, ['textColor']);
18
- return /*#__PURE__*/React.createElement(ToolbarTextColor, {
21
+ return /*#__PURE__*/React.createElement(ToolbarTextColor
22
+ // Ignored via go/ees005
23
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
24
+ , {
19
25
  pluginState: textColorState,
20
26
  isReducedSpacing: isReducedSpacing,
21
27
  editorView: editorView,
@@ -2,8 +2,14 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
 
4
4
  // eslint-disable-next-line @atlassian/tangerine/import/entry-points
5
+ // Ignored via go/ees005
6
+ // eslint-disable-next-line import/no-named-as-default
5
7
  import Icon from '@atlaskit/icon/base';
6
- const textColorGlyph = props => /*#__PURE__*/React.createElement("svg", _extends({}, props, {
8
+ const textColorGlyph = props =>
9
+ /*#__PURE__*/
10
+ // Ignored via go/ees005
11
+ // eslint-disable-next-line react/jsx-props-no-spreading
12
+ React.createElement("svg", _extends({}, props, {
7
13
  width: "24",
8
14
  height: "24",
9
15
  xmlns: "http://www.w3.org/2000/svg"
@@ -239,7 +239,10 @@ export class ToolbarTextColor extends React.Component {
239
239
  );
240
240
  }
241
241
  getSelectedColor(pluginState) {
242
- const selectedColor = pluginState.color !== pluginState.defaultColor ? pluginState.color ? hexToEditorTextPaletteColor(pluginState.color) : pluginState.color : null;
242
+ const selectedColor = pluginState.color !== pluginState.defaultColor ? pluginState.color ?
243
+ // Ignored via go/ees005
244
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
245
+ hexToEditorTextPaletteColor(pluginState.color) : pluginState.color : null;
243
246
  return selectedColor;
244
247
  }
245
248
  getCommonAnalyticsAttributes() {
package/dist/esm/index.js CHANGED
@@ -1 +1,4 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ // Entry file in package.json
3
+
1
4
  export { textColorPlugin } from './textColorPlugin';
@@ -12,6 +12,8 @@ import { toggleColor } from './toggle-color';
12
12
  * @param palette - Current palette of colors
13
13
  * @return Higher order command with analytics logic inside.
14
14
  */
15
+ // Ignored via go/ees005
16
+ // eslint-disable-next-line @typescript-eslint/max-params
15
17
  function createWithColorAnalytics(newColor, previousColor, palette, editorAnalyticsApi, inputMethod) {
16
18
  var newColorFromPalette = palette.find(function (_ref) {
17
19
  var value = _ref.value;
@@ -8,7 +8,6 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
8
8
  import { getActiveColor } from './utils/color';
9
9
  import { DEFAULT_COLOR } from './utils/constants';
10
10
  import { getDisabledState } from './utils/disabled';
11
- export { DEFAULT_COLOR } from './utils/constants';
12
11
  function createInitialPluginState(editorState, pluginConfig) {
13
12
  var defaultColor = (pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.defaultColor) || DEFAULT_COLOR;
14
13
  var palette = [{
@@ -38,6 +37,8 @@ export function createPlugin(dispatch, pluginConfig) {
38
37
  init: function init(_config, editorState) {
39
38
  return createInitialPluginState(editorState, pluginConfig);
40
39
  },
40
+ // Ignored via go/ees005
41
+ // eslint-disable-next-line @typescript-eslint/max-params
41
42
  apply: function apply(tr, pluginState, _, newState) {
42
43
  var meta = tr.getMeta(pluginKey) || {};
43
44
  var nextState;
@@ -1,8 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- var _toolbarTypeToInputMe;
3
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
3
  import { ToolbarType } from '../../types';
5
- var toolbarTypeToInputMethod = (_toolbarTypeToInputMe = {}, _defineProperty(_toolbarTypeToInputMe, ToolbarType.PRIMARY, INPUT_METHOD.TOOLBAR), _defineProperty(_toolbarTypeToInputMe, ToolbarType.FLOATING, INPUT_METHOD.FLOATING_TB), _toolbarTypeToInputMe);
4
+ var toolbarTypeToInputMethod = _defineProperty(_defineProperty({}, ToolbarType.PRIMARY, INPUT_METHOD.TOOLBAR), ToolbarType.FLOATING, INPUT_METHOD.FLOATING_TB);
6
5
  export var getInputMethod = function getInputMethod(toolbarType) {
7
6
  return toolbarTypeToInputMethod[toolbarType];
8
7
  };
@@ -99,5 +99,4 @@ export var textColorPlugin = function textColorPlugin(_ref) {
99
99
  },
100
100
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
101
101
  };
102
- };
103
- export { textColorPluginKey };
102
+ };
@@ -1,6 +1,9 @@
1
1
  import React from 'react';
2
2
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
3
  import { ToolbarType } from '../types';
4
+
5
+ // Ignored via go/ees005
6
+ // eslint-disable-next-line import/no-named-as-default
4
7
  import ToolbarTextColor from './ToolbarTextColor';
5
8
  var FloatingToolbarSettings = {
6
9
  disabled: false,
@@ -12,7 +15,10 @@ export function FloatingToolbarComponent(_ref) {
12
15
  dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
13
16
  var _useSharedPluginState = useSharedPluginState(api, ['textColor']),
14
17
  textColorState = _useSharedPluginState.textColorState;
15
- return /*#__PURE__*/React.createElement(ToolbarTextColor, {
18
+ return /*#__PURE__*/React.createElement(ToolbarTextColor
19
+ // Ignored via go/ees005
20
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
21
+ , {
16
22
  pluginState: textColorState,
17
23
  isReducedSpacing: FloatingToolbarSettings.isReducedSpacing,
18
24
  editorView: editorView,
@@ -1,6 +1,9 @@
1
1
  import React from 'react';
2
2
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
3
  import { ToolbarType } from '../types';
4
+
5
+ // Ignored via go/ees005
6
+ // eslint-disable-next-line import/no-named-as-default
4
7
  import ToolbarTextColor from './ToolbarTextColor';
5
8
  export function PrimaryToolbarComponent(_ref) {
6
9
  var api = _ref.api,
@@ -13,7 +16,10 @@ export function PrimaryToolbarComponent(_ref) {
13
16
  disabled = _ref.disabled;
14
17
  var _useSharedPluginState = useSharedPluginState(api, ['textColor']),
15
18
  textColorState = _useSharedPluginState.textColorState;
16
- return /*#__PURE__*/React.createElement(ToolbarTextColor, {
19
+ return /*#__PURE__*/React.createElement(ToolbarTextColor
20
+ // Ignored via go/ees005
21
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
22
+ , {
17
23
  pluginState: textColorState,
18
24
  isReducedSpacing: isReducedSpacing,
19
25
  editorView: editorView,
@@ -2,17 +2,24 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
 
4
4
  // eslint-disable-next-line @atlassian/tangerine/import/entry-points
5
+ // Ignored via go/ees005
6
+ // eslint-disable-next-line import/no-named-as-default
5
7
  import Icon from '@atlaskit/icon/base';
6
8
  var textColorGlyph = function textColorGlyph(props) {
7
- return /*#__PURE__*/React.createElement("svg", _extends({}, props, {
8
- width: "24",
9
- height: "24",
10
- xmlns: "http://www.w3.org/2000/svg"
11
- }), /*#__PURE__*/React.createElement("path", {
12
- d: "M14 12.5h-4l-.874 2.186A.5.5 0 0 1 8.66 15H7.273a.5.5 0 0 1-.456-.705l4.05-9A.5.5 0 0 1 11.323 5h1.354a.5.5 0 0 1 .456.295l4.05 9a.5.5 0 0 1-.456.705h-1.388a.5.5 0 0 1-.465-.314L14 12.5zm-.6-1.5L12 7.5 10.6 11h2.8z",
13
- fill: "currentColor",
14
- fillRule: "evenodd"
15
- }));
9
+ return (
10
+ /*#__PURE__*/
11
+ // Ignored via go/ees005
12
+ // eslint-disable-next-line react/jsx-props-no-spreading
13
+ React.createElement("svg", _extends({}, props, {
14
+ width: "24",
15
+ height: "24",
16
+ xmlns: "http://www.w3.org/2000/svg"
17
+ }), /*#__PURE__*/React.createElement("path", {
18
+ d: "M14 12.5h-4l-.874 2.186A.5.5 0 0 1 8.66 15H7.273a.5.5 0 0 1-.456-.705l4.05-9A.5.5 0 0 1 11.323 5h1.354a.5.5 0 0 1 .456.295l4.05 9a.5.5 0 0 1-.456.705h-1.388a.5.5 0 0 1-.465-.314L14 12.5zm-.6-1.5L12 7.5 10.6 11h2.8z",
19
+ fill: "currentColor",
20
+ fillRule: "evenodd"
21
+ }))
22
+ );
16
23
  };
17
24
  export var EditorTextColorIcon = function EditorTextColorIcon() {
18
25
  return /*#__PURE__*/React.createElement(Icon, {
@@ -1,13 +1,12 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
3
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
4
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
+ import _inherits from "@babel/runtime/helpers/inherits";
7
6
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
7
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
8
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
9
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
11
  /**
13
12
  * @jsxRuntime classic
@@ -37,24 +36,22 @@ var EXPERIMENT_NAME = 'editor.toolbarTextColor.moreColors';
37
36
  var EXPERIMENT_GROUP_CONTROL = 'control';
38
37
  // eslint-disable-next-line @repo/internal/react/no-class-components
39
38
  export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
40
- _inherits(ToolbarTextColor, _React$Component);
41
- var _super = _createSuper(ToolbarTextColor);
42
39
  function ToolbarTextColor() {
43
40
  var _this;
44
41
  _classCallCheck(this, ToolbarTextColor);
45
42
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
46
43
  args[_key] = arguments[_key];
47
44
  }
48
- _this = _super.call.apply(_super, [this].concat(args));
49
- _defineProperty(_assertThisInitialized(_this), "state", {
45
+ _this = _callSuper(this, ToolbarTextColor, [].concat(args));
46
+ _defineProperty(_this, "state", {
50
47
  isOpen: false,
51
48
  isOpenedByKeyboard: false
52
49
  });
53
- _defineProperty(_assertThisInitialized(_this), "toolbarItemRef", /*#__PURE__*/React.createRef());
54
- _defineProperty(_assertThisInitialized(_this), "changeColor", function (color, editorAnalyticsApi) {
50
+ _defineProperty(_this, "toolbarItemRef", /*#__PURE__*/React.createRef());
51
+ _defineProperty(_this, "changeColor", function (color, editorAnalyticsApi) {
55
52
  return changeColorWithAnalytics(color, editorAnalyticsApi, getInputMethod(_this.props.toolbarType))(_this.props.editorView.state, _this.props.editorView.dispatch);
56
53
  });
57
- _defineProperty(_assertThisInitialized(_this), "changeTextColor", function (color, editorAnalyticsApi, disabled) {
54
+ _defineProperty(_this, "changeTextColor", function (color, editorAnalyticsApi, disabled) {
58
55
  if (!disabled) {
59
56
  var _this$props$editorVie;
60
57
  var palette = _this.props.pluginState.palette;
@@ -76,13 +73,13 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
76
73
  }
77
74
  return false;
78
75
  });
79
- _defineProperty(_assertThisInitialized(_this), "toggleOpen", function () {
76
+ _defineProperty(_this, "toggleOpen", function () {
80
77
  _this.handleOpenChange({
81
78
  isOpen: !_this.state.isOpen,
82
79
  logCloseEvent: true
83
80
  });
84
81
  });
85
- _defineProperty(_assertThisInitialized(_this), "onKeyDown", function (event) {
82
+ _defineProperty(_this, "onKeyDown", function (event) {
86
83
  if (event.key === 'Enter' || event.key === ' ') {
87
84
  event.preventDefault();
88
85
  _this.setState({
@@ -91,7 +88,7 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
91
88
  _this.toggleOpen();
92
89
  }
93
90
  });
94
- _defineProperty(_assertThisInitialized(_this), "handleOpenChange", function (_ref) {
91
+ _defineProperty(_this, "handleOpenChange", function (_ref) {
95
92
  var isOpen = _ref.isOpen,
96
93
  logCloseEvent = _ref.logCloseEvent;
97
94
  _this.setState({
@@ -108,7 +105,7 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
108
105
  }));
109
106
  }
110
107
  });
111
- _defineProperty(_assertThisInitialized(_this), "hide", function (e) {
108
+ _defineProperty(_this, "hide", function (e) {
112
109
  var isOpen = _this.state.isOpen;
113
110
  if (isOpen === true) {
114
111
  _this.dispatchAnalyticsEvent(_this.buildAnalyticsPalette(ACTION.CLOSED, {
@@ -123,14 +120,15 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
123
120
  }
124
121
  }
125
122
  });
126
- _defineProperty(_assertThisInitialized(_this), "hideonEsc", function (e) {
123
+ _defineProperty(_this, "hideonEsc", function (e) {
127
124
  var _this$toolbarItemRef2;
128
125
  _this.hide(e);
129
126
  (_this$toolbarItemRef2 = _this.toolbarItemRef) === null || _this$toolbarItemRef2 === void 0 || (_this$toolbarItemRef2 = _this$toolbarItemRef2.current) === null || _this$toolbarItemRef2 === void 0 || _this$toolbarItemRef2.focus();
130
127
  });
131
128
  return _this;
132
129
  }
133
- _createClass(ToolbarTextColor, [{
130
+ _inherits(ToolbarTextColor, _React$Component);
131
+ return _createClass(ToolbarTextColor, [{
134
132
  key: "render",
135
133
  value: function render() {
136
134
  var _palette$find,
@@ -256,7 +254,10 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
256
254
  }, {
257
255
  key: "getSelectedColor",
258
256
  value: function getSelectedColor(pluginState) {
259
- var selectedColor = pluginState.color !== pluginState.defaultColor ? pluginState.color ? hexToEditorTextPaletteColor(pluginState.color) : pluginState.color : null;
257
+ var selectedColor = pluginState.color !== pluginState.defaultColor ? pluginState.color ?
258
+ // Ignored via go/ees005
259
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
260
+ hexToEditorTextPaletteColor(pluginState.color) : pluginState.color : null;
260
261
  return selectedColor;
261
262
  }
262
263
  }, {
@@ -298,6 +299,5 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
298
299
  }
299
300
  }
300
301
  }]);
301
- return ToolbarTextColor;
302
302
  }(React.Component);
303
303
  export default injectIntl(ToolbarTextColor);
@@ -2,7 +2,6 @@ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import type { PaletteColor } from '@atlaskit/editor-common/ui-color';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
- export { DEFAULT_COLOR } from './utils/constants';
6
5
  export type TextColorPluginState = {
7
6
  palette: Array<PaletteColor>;
8
7
  defaultColor: string;
@@ -23,3 +22,4 @@ export declare enum ACTIONS {
23
22
  }
24
23
  export declare const pluginKey: PluginKey<TextColorPluginState>;
25
24
  export declare function createPlugin(dispatch: Dispatch, pluginConfig?: TextColorPluginConfig): SafePlugin;
25
+ export {};
@@ -1,6 +1,2 @@
1
- import type { TextColorPluginState } from './pm-plugins/main';
2
- import { pluginKey as textColorPluginKey } from './pm-plugins/main';
3
1
  import type { TextColorPlugin } from './textColorPluginType';
4
2
  export declare const textColorPlugin: TextColorPlugin;
5
- export { textColorPluginKey };
6
- export type { TextColorPluginState };
@@ -2,7 +2,6 @@ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import type { PaletteColor } from '@atlaskit/editor-common/ui-color';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
- export { DEFAULT_COLOR } from './utils/constants';
6
5
  export type TextColorPluginState = {
7
6
  palette: Array<PaletteColor>;
8
7
  defaultColor: string;
@@ -23,3 +22,4 @@ export declare enum ACTIONS {
23
22
  }
24
23
  export declare const pluginKey: PluginKey<TextColorPluginState>;
25
24
  export declare function createPlugin(dispatch: Dispatch, pluginConfig?: TextColorPluginConfig): SafePlugin;
25
+ export {};
@@ -1,6 +1,2 @@
1
- import type { TextColorPluginState } from './pm-plugins/main';
2
- import { pluginKey as textColorPluginKey } from './pm-plugins/main';
3
1
  import type { TextColorPlugin } from './textColorPluginType';
4
2
  export declare const textColorPlugin: TextColorPlugin;
5
- export { textColorPluginKey };
6
- export type { TextColorPluginState };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-color",
3
- "version": "1.16.4",
3
+ "version": "1.16.6",
4
4
  "description": "Text color plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,18 +32,18 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^46.1.0",
35
- "@atlaskit/editor-common": "^96.3.0",
35
+ "@atlaskit/editor-common": "^98.0.0",
36
36
  "@atlaskit/editor-palette": "1.6.3",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
38
- "@atlaskit/editor-plugin-primary-toolbar": "^2.0.0",
38
+ "@atlaskit/editor-plugin-primary-toolbar": "^2.1.0",
39
39
  "@atlaskit/editor-prosemirror": "6.2.1",
40
40
  "@atlaskit/editor-shared-styles": "^3.2.0",
41
41
  "@atlaskit/editor-tables": "^2.8.0",
42
42
  "@atlaskit/icon": "^23.1.0",
43
43
  "@atlaskit/platform-feature-flags": "^0.3.0",
44
44
  "@atlaskit/theme": "^14.0.0",
45
- "@atlaskit/tmp-editor-statsig": "^2.23.0",
46
- "@atlaskit/tokens": "^2.4.0",
45
+ "@atlaskit/tmp-editor-statsig": "^2.31.0",
46
+ "@atlaskit/tokens": "^2.5.0",
47
47
  "@babel/runtime": "^7.0.0",
48
48
  "@emotion/react": "^11.7.1"
49
49
  },