@atlaskit/editor-plugin-text-color 6.3.18 → 6.3.19

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,13 @@
1
1
  # @atlaskit/editor-plugin-text-color
2
2
 
3
+ ## 6.3.19
4
+
5
+ ### Patch Changes
6
+
7
+ - [`15d7f87e470d5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/15d7f87e470d5) -
8
+ [ux] EDITOR-3749 Fix keep selection after applying text color or highlight
9
+ - Updated dependencies
10
+
3
11
  ## 6.3.18
4
12
 
5
13
  ### Patch Changes
@@ -28,7 +28,7 @@ var RemoveColorMenuItem = exports.RemoveColorMenuItem = function RemoveColorMenu
28
28
  formatMessage = _useIntl.formatMessage;
29
29
  var context = (0, _editorToolbar.useToolbarDropdownMenu)();
30
30
  var closeMenu = context === null || context === void 0 ? void 0 : context.closeMenu;
31
- var onClick = function onClick() {
31
+ var onClick = function onClick(event) {
32
32
  var _api$textColor$shared;
33
33
  if (!api) {
34
34
  return;
@@ -51,7 +51,7 @@ var RemoveColorMenuItem = exports.RemoveColorMenuItem = function RemoveColorMenu
51
51
  });
52
52
  return tr;
53
53
  });
54
- closeMenu === null || closeMenu === void 0 || closeMenu();
54
+ closeMenu === null || closeMenu === void 0 || closeMenu(event);
55
55
  };
56
56
  return /*#__PURE__*/React.createElement("div", {
57
57
  className: (0, _runtime.ax)([styles.removeColorButton])
@@ -41,14 +41,14 @@ function TextColorMenuItem(_ref) {
41
41
  editorView = _useEditorToolbar.editorView;
42
42
  var context = (0, _editorToolbar.useToolbarDropdownMenu)();
43
43
  var closeMenu = context === null || context === void 0 ? void 0 : context.closeMenu;
44
- var handleTextColorChange = (0, _react.useCallback)(function (color) {
44
+ var handleTextColorChange = (0, _react.useCallback)(function (color, event) {
45
45
  var _api$textColor;
46
46
  if (!(editorView !== null && editorView !== void 0 && editorView.state) || !(editorView !== null && editorView !== void 0 && editorView.dispatch)) {
47
47
  return;
48
48
  }
49
49
  if (api !== null && api !== void 0 && (_api$textColor = api.textColor) !== null && _api$textColor !== void 0 && (_api$textColor = _api$textColor.actions) !== null && _api$textColor !== void 0 && _api$textColor.changeColor) {
50
50
  api.textColor.actions.changeColor(color, (0, _toolbar.getInputMethodFromParentKeys)(parents))(editorView.state, editorView.dispatch);
51
- closeMenu === null || closeMenu === void 0 || closeMenu();
51
+ closeMenu === null || closeMenu === void 0 || closeMenu(event);
52
52
  }
53
53
  }, [editorView === null || editorView === void 0 ? void 0 : editorView.state, editorView === null || editorView === void 0 ? void 0 : editorView.dispatch, api === null || api === void 0 ? void 0 : api.textColor.actions, parents, closeMenu]);
54
54
  var _useIntl = (0, _reactIntlNext.useIntl)(),
@@ -59,8 +59,8 @@ function TextColorMenuItem(_ref) {
59
59
  }, /*#__PURE__*/_react.default.createElement(_heading.default, {
60
60
  size: "xxsmall"
61
61
  }, formatMessage(_messages.textColorMessages.textColorTooltip)), /*#__PURE__*/_react.default.createElement(_editorToolbar.ColorPalette, {
62
- onClick: function onClick(color) {
63
- handleTextColorChange(color);
62
+ onClick: function onClick(color, _, event) {
63
+ handleTextColorChange(color, event);
64
64
  },
65
65
  selectedColor: color || defaultColor,
66
66
  paletteOptions: {
@@ -21,7 +21,7 @@ export const RemoveColorMenuItem = ({
21
21
  } = useIntl();
22
22
  const context = useToolbarDropdownMenu();
23
23
  const closeMenu = context === null || context === void 0 ? void 0 : context.closeMenu;
24
- const onClick = () => {
24
+ const onClick = event => {
25
25
  var _api$textColor$shared;
26
26
  if (!api) {
27
27
  return;
@@ -45,7 +45,7 @@ export const RemoveColorMenuItem = ({
45
45
  });
46
46
  return tr;
47
47
  });
48
- closeMenu === null || closeMenu === void 0 ? void 0 : closeMenu();
48
+ closeMenu === null || closeMenu === void 0 ? void 0 : closeMenu(event);
49
49
  };
50
50
  return /*#__PURE__*/React.createElement("div", {
51
51
  className: ax([styles.removeColorButton])
@@ -35,14 +35,14 @@ export function TextColorMenuItem({
35
35
  } = useEditorToolbar();
36
36
  const context = useToolbarDropdownMenu();
37
37
  const closeMenu = context === null || context === void 0 ? void 0 : context.closeMenu;
38
- const handleTextColorChange = useCallback(color => {
38
+ const handleTextColorChange = useCallback((color, event) => {
39
39
  var _api$textColor, _api$textColor$action;
40
40
  if (!(editorView !== null && editorView !== void 0 && editorView.state) || !(editorView !== null && editorView !== void 0 && editorView.dispatch)) {
41
41
  return;
42
42
  }
43
43
  if (api !== null && api !== void 0 && (_api$textColor = api.textColor) !== null && _api$textColor !== void 0 && (_api$textColor$action = _api$textColor.actions) !== null && _api$textColor$action !== void 0 && _api$textColor$action.changeColor) {
44
44
  api.textColor.actions.changeColor(color, getInputMethodFromParentKeys(parents))(editorView.state, editorView.dispatch);
45
- closeMenu === null || closeMenu === void 0 ? void 0 : closeMenu();
45
+ closeMenu === null || closeMenu === void 0 ? void 0 : closeMenu(event);
46
46
  }
47
47
  }, [editorView === null || editorView === void 0 ? void 0 : editorView.state, editorView === null || editorView === void 0 ? void 0 : editorView.dispatch, api === null || api === void 0 ? void 0 : api.textColor.actions, parents, closeMenu]);
48
48
  const {
@@ -54,8 +54,8 @@ export function TextColorMenuItem({
54
54
  }, /*#__PURE__*/React.createElement(Heading, {
55
55
  size: "xxsmall"
56
56
  }, formatMessage(messages.textColorTooltip)), /*#__PURE__*/React.createElement(ColorPalette, {
57
- onClick: color => {
58
- handleTextColorChange(color);
57
+ onClick: (color, _, event) => {
58
+ handleTextColorChange(color, event);
59
59
  },
60
60
  selectedColor: color || defaultColor,
61
61
  paletteOptions: {
@@ -19,7 +19,7 @@ export var RemoveColorMenuItem = function RemoveColorMenuItem(_ref) {
19
19
  formatMessage = _useIntl.formatMessage;
20
20
  var context = useToolbarDropdownMenu();
21
21
  var closeMenu = context === null || context === void 0 ? void 0 : context.closeMenu;
22
- var onClick = function onClick() {
22
+ var onClick = function onClick(event) {
23
23
  var _api$textColor$shared;
24
24
  if (!api) {
25
25
  return;
@@ -42,7 +42,7 @@ export var RemoveColorMenuItem = function RemoveColorMenuItem(_ref) {
42
42
  });
43
43
  return tr;
44
44
  });
45
- closeMenu === null || closeMenu === void 0 || closeMenu();
45
+ closeMenu === null || closeMenu === void 0 || closeMenu(event);
46
46
  };
47
47
  return /*#__PURE__*/React.createElement("div", {
48
48
  className: ax([styles.removeColorButton])
@@ -32,14 +32,14 @@ export function TextColorMenuItem(_ref) {
32
32
  editorView = _useEditorToolbar.editorView;
33
33
  var context = useToolbarDropdownMenu();
34
34
  var closeMenu = context === null || context === void 0 ? void 0 : context.closeMenu;
35
- var handleTextColorChange = useCallback(function (color) {
35
+ var handleTextColorChange = useCallback(function (color, event) {
36
36
  var _api$textColor;
37
37
  if (!(editorView !== null && editorView !== void 0 && editorView.state) || !(editorView !== null && editorView !== void 0 && editorView.dispatch)) {
38
38
  return;
39
39
  }
40
40
  if (api !== null && api !== void 0 && (_api$textColor = api.textColor) !== null && _api$textColor !== void 0 && (_api$textColor = _api$textColor.actions) !== null && _api$textColor !== void 0 && _api$textColor.changeColor) {
41
41
  api.textColor.actions.changeColor(color, getInputMethodFromParentKeys(parents))(editorView.state, editorView.dispatch);
42
- closeMenu === null || closeMenu === void 0 || closeMenu();
42
+ closeMenu === null || closeMenu === void 0 || closeMenu(event);
43
43
  }
44
44
  }, [editorView === null || editorView === void 0 ? void 0 : editorView.state, editorView === null || editorView === void 0 ? void 0 : editorView.dispatch, api === null || api === void 0 ? void 0 : api.textColor.actions, parents, closeMenu]);
45
45
  var _useIntl = useIntl(),
@@ -50,8 +50,8 @@ export function TextColorMenuItem(_ref) {
50
50
  }, /*#__PURE__*/React.createElement(Heading, {
51
51
  size: "xxsmall"
52
52
  }, formatMessage(messages.textColorTooltip)), /*#__PURE__*/React.createElement(ColorPalette, {
53
- onClick: function onClick(color) {
54
- handleTextColorChange(color);
53
+ onClick: function onClick(color, _, event) {
54
+ handleTextColorChange(color, event);
55
55
  },
56
56
  selectedColor: color || defaultColor,
57
57
  paletteOptions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-color",
3
- "version": "6.3.18",
3
+ "version": "6.3.19",
4
4
  "description": "Text color plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -47,7 +47,7 @@
47
47
  "@atlaskit/platform-feature-flags": "^1.1.0",
48
48
  "@atlaskit/primitives": "^16.4.0",
49
49
  "@atlaskit/theme": "^21.0.0",
50
- "@atlaskit/tmp-editor-statsig": "^14.5.0",
50
+ "@atlaskit/tmp-editor-statsig": "^14.6.0",
51
51
  "@atlaskit/tokens": "^8.4.0",
52
52
  "@babel/runtime": "^7.0.0",
53
53
  "@emotion/react": "^11.7.1"