@atlaskit/editor-plugin-highlight 6.3.13 → 6.3.14

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-highlight
2
2
 
3
+ ## 6.3.14
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.13
4
12
 
5
13
  ### Patch Changes
@@ -60,14 +60,14 @@ function HighlightColorMenuItem(_ref2) {
60
60
  var activeColor = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'highlight.activeColor');
61
61
  var context = (0, _editorToolbar.useToolbarDropdownMenu)();
62
62
  var closeMenu = context === null || context === void 0 ? void 0 : context.closeMenu;
63
- var handleHighlightColorChange = (0, _react.useCallback)(function (color) {
63
+ var handleHighlightColorChange = (0, _react.useCallback)(function (color, event) {
64
64
  var _api$highlight;
65
65
  if (api !== null && api !== void 0 && (_api$highlight = api.highlight) !== null && _api$highlight !== void 0 && (_api$highlight = _api$highlight.commands) !== null && _api$highlight !== void 0 && _api$highlight.changeColor) {
66
66
  api.core.actions.execute(api.highlight.commands.changeColor({
67
67
  color: color,
68
68
  inputMethod: (0, _toolbar.getInputMethodFromParentKeys)(parents)
69
69
  }));
70
- closeMenu === null || closeMenu === void 0 || closeMenu();
70
+ closeMenu === null || closeMenu === void 0 || closeMenu(event);
71
71
  }
72
72
  }, [api, closeMenu, parents]);
73
73
  var colorPalette = (0, _react.useMemo)(function () {
@@ -91,8 +91,8 @@ function HighlightColorMenuItem(_ref2) {
91
91
  }, /*#__PURE__*/React.createElement(_heading.default, {
92
92
  size: "xxsmall"
93
93
  }, formatMessage(_messages.highlightMessages.highlight)), /*#__PURE__*/React.createElement(_editorToolbar.ColorPalette, {
94
- onClick: function onClick(color) {
95
- handleHighlightColorChange(color);
94
+ onClick: function onClick(color, _, event) {
95
+ handleHighlightColorChange(color, event);
96
96
  },
97
97
  selectedColor: activeColor || null,
98
98
  paletteOptions: {
@@ -104,8 +104,8 @@ function HighlightColorMenuItem(_ref2) {
104
104
  }, /*#__PURE__*/React.createElement(_new.default, {
105
105
  shouldFitContainer: true,
106
106
  appearance: "subtle",
107
- onClick: function onClick() {
108
- return handleHighlightColorChange(_uiColor.REMOVE_HIGHLIGHT_COLOR);
107
+ onClick: function onClick(event) {
108
+ return handleHighlightColorChange(_uiColor.REMOVE_HIGHLIGHT_COLOR, event);
109
109
  }
110
110
  }, /*#__PURE__*/React.createElement(_compiled.Text, {
111
111
  weight: "medium"
@@ -51,14 +51,14 @@ export function HighlightColorMenuItem({
51
51
  const activeColor = useSharedPluginStateSelector(api, 'highlight.activeColor');
52
52
  const context = useToolbarDropdownMenu();
53
53
  const closeMenu = context === null || context === void 0 ? void 0 : context.closeMenu;
54
- const handleHighlightColorChange = useCallback(color => {
54
+ const handleHighlightColorChange = useCallback((color, event) => {
55
55
  var _api$highlight, _api$highlight$comman;
56
56
  if (api !== null && api !== void 0 && (_api$highlight = api.highlight) !== null && _api$highlight !== void 0 && (_api$highlight$comman = _api$highlight.commands) !== null && _api$highlight$comman !== void 0 && _api$highlight$comman.changeColor) {
57
57
  api.core.actions.execute(api.highlight.commands.changeColor({
58
58
  color,
59
59
  inputMethod: getInputMethodFromParentKeys(parents)
60
60
  }));
61
- closeMenu === null || closeMenu === void 0 ? void 0 : closeMenu();
61
+ closeMenu === null || closeMenu === void 0 ? void 0 : closeMenu(event);
62
62
  }
63
63
  }, [api, closeMenu, parents]);
64
64
  const colorPalette = useMemo(() => {
@@ -77,8 +77,8 @@ export function HighlightColorMenuItem({
77
77
  }, /*#__PURE__*/React.createElement(Heading, {
78
78
  size: "xxsmall"
79
79
  }, formatMessage(messages.highlight)), /*#__PURE__*/React.createElement(ColorPalette, {
80
- onClick: color => {
81
- handleHighlightColorChange(color);
80
+ onClick: (color, _, event) => {
81
+ handleHighlightColorChange(color, event);
82
82
  },
83
83
  selectedColor: activeColor || null,
84
84
  paletteOptions: {
@@ -90,7 +90,7 @@ export function HighlightColorMenuItem({
90
90
  }, /*#__PURE__*/React.createElement(Button, {
91
91
  shouldFitContainer: true,
92
92
  appearance: "subtle",
93
- onClick: () => handleHighlightColorChange(REMOVE_HIGHLIGHT_COLOR)
93
+ onClick: event => handleHighlightColorChange(REMOVE_HIGHLIGHT_COLOR, event)
94
94
  }, /*#__PURE__*/React.createElement(Text, {
95
95
  weight: "medium"
96
96
  }, "Remove highlight"))));
@@ -51,14 +51,14 @@ export function HighlightColorMenuItem(_ref2) {
51
51
  var activeColor = useSharedPluginStateSelector(api, 'highlight.activeColor');
52
52
  var context = useToolbarDropdownMenu();
53
53
  var closeMenu = context === null || context === void 0 ? void 0 : context.closeMenu;
54
- var handleHighlightColorChange = useCallback(function (color) {
54
+ var handleHighlightColorChange = useCallback(function (color, event) {
55
55
  var _api$highlight;
56
56
  if (api !== null && api !== void 0 && (_api$highlight = api.highlight) !== null && _api$highlight !== void 0 && (_api$highlight = _api$highlight.commands) !== null && _api$highlight !== void 0 && _api$highlight.changeColor) {
57
57
  api.core.actions.execute(api.highlight.commands.changeColor({
58
58
  color: color,
59
59
  inputMethod: getInputMethodFromParentKeys(parents)
60
60
  }));
61
- closeMenu === null || closeMenu === void 0 || closeMenu();
61
+ closeMenu === null || closeMenu === void 0 || closeMenu(event);
62
62
  }
63
63
  }, [api, closeMenu, parents]);
64
64
  var colorPalette = useMemo(function () {
@@ -82,8 +82,8 @@ export function HighlightColorMenuItem(_ref2) {
82
82
  }, /*#__PURE__*/React.createElement(Heading, {
83
83
  size: "xxsmall"
84
84
  }, formatMessage(messages.highlight)), /*#__PURE__*/React.createElement(ColorPalette, {
85
- onClick: function onClick(color) {
86
- handleHighlightColorChange(color);
85
+ onClick: function onClick(color, _, event) {
86
+ handleHighlightColorChange(color, event);
87
87
  },
88
88
  selectedColor: activeColor || null,
89
89
  paletteOptions: {
@@ -95,8 +95,8 @@ export function HighlightColorMenuItem(_ref2) {
95
95
  }, /*#__PURE__*/React.createElement(Button, {
96
96
  shouldFitContainer: true,
97
97
  appearance: "subtle",
98
- onClick: function onClick() {
99
- return handleHighlightColorChange(REMOVE_HIGHLIGHT_COLOR);
98
+ onClick: function onClick(event) {
99
+ return handleHighlightColorChange(REMOVE_HIGHLIGHT_COLOR, event);
100
100
  }
101
101
  }, /*#__PURE__*/React.createElement(Text, {
102
102
  weight: "medium"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-highlight",
3
- "version": "6.3.13",
3
+ "version": "6.3.14",
4
4
  "description": "Highlight plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -50,7 +50,7 @@
50
50
  "@atlaskit/icon": "^29.0.0",
51
51
  "@atlaskit/platform-feature-flags": "^1.1.0",
52
52
  "@atlaskit/primitives": "^16.4.0",
53
- "@atlaskit/tmp-editor-statsig": "^14.5.0",
53
+ "@atlaskit/tmp-editor-statsig": "^14.6.0",
54
54
  "@atlaskit/tokens": "^8.4.0",
55
55
  "@babel/runtime": "^7.0.0",
56
56
  "@emotion/react": "^11.7.1"