@atlaskit/editor-plugin-text-color 3.2.3 → 4.0.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 +14 -0
- package/dist/cjs/ui/TextColorHighlightMenu.js +4 -4
- package/dist/cjs/ui/TextColorMenuItem.js +3 -3
- package/dist/es2019/ui/TextColorHighlightMenu.js +5 -5
- package/dist/es2019/ui/TextColorMenuItem.js +3 -4
- package/dist/esm/ui/TextColorHighlightMenu.js +5 -5
- package/dist/esm/ui/TextColorMenuItem.js +3 -3
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-text-color
|
|
2
2
|
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 3.2.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`36e649e4988d3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/36e649e4988d3) -
|
|
14
|
+
[ux] ED-29072 close all menus on nested menu item clicked
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 3.2.3
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -39,7 +39,7 @@ var TextColorHighlightMenu = exports.TextColorHighlightMenu = function TextColor
|
|
|
39
39
|
var highlightColorIcon = highlightColor ? highlightColor : (0, _editorToolbar.getContrastingBackgroundColor)(iconColor);
|
|
40
40
|
return (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_1', 'isEnabled', true) ? /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarTooltip, {
|
|
41
41
|
content: formatMessage(isHighlightPluginExisted ? _messages.textColorMessages.textColorHighlightTooltip : _messages.textColorMessages.textColorTooltip)
|
|
42
|
-
}, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownMenu, {
|
|
42
|
+
}, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownMenuProvider, null, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownMenu, {
|
|
43
43
|
iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarColorSwatch, {
|
|
44
44
|
highlightColor: highlightColorIcon
|
|
45
45
|
}, /*#__PURE__*/_react.default.createElement(_editorToolbar.TextColorIcon, {
|
|
@@ -55,12 +55,12 @@ var TextColorHighlightMenu = exports.TextColorHighlightMenu = function TextColor
|
|
|
55
55
|
hasSectionMargin: false
|
|
56
56
|
}, (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? children : /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
57
57
|
xcss: styles.menu
|
|
58
|
-
}, children))) : /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownMenu, {
|
|
58
|
+
}, children)))) : /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownMenu, {
|
|
59
59
|
iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarColorSwatch, {
|
|
60
|
-
highlightColor:
|
|
60
|
+
highlightColor: highlightColorIcon
|
|
61
61
|
}, /*#__PURE__*/_react.default.createElement(_editorToolbar.TextColorIcon, {
|
|
62
62
|
label: formatMessage(_messages.textColorMessages.textColorTooltip),
|
|
63
|
-
iconColor:
|
|
63
|
+
iconColor: iconColor,
|
|
64
64
|
shouldRecommendSmallIcon: true,
|
|
65
65
|
size: 'small',
|
|
66
66
|
isDisabled: isTextColorDisabled,
|
|
@@ -43,8 +43,8 @@ function TextColorMenuItem(_ref) {
|
|
|
43
43
|
},
|
|
44
44
|
state = _ref2.state,
|
|
45
45
|
dispatch = _ref2.dispatch;
|
|
46
|
-
var
|
|
47
|
-
|
|
46
|
+
var context = (0, _editorToolbar.useToolbarDropdownMenu)();
|
|
47
|
+
var closeMenu = context === null || context === void 0 ? void 0 : context.closeMenu;
|
|
48
48
|
var handleTextColorChange = (0, _react.useCallback)(function (color) {
|
|
49
49
|
var _api$textColor;
|
|
50
50
|
if (!state || !dispatch) {
|
|
@@ -52,7 +52,7 @@ function TextColorMenuItem(_ref) {
|
|
|
52
52
|
}
|
|
53
53
|
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) {
|
|
54
54
|
api.textColor.actions.changeColor(color, (0, _toolbar.getInputMethodFromParentKeys)(parents))(state, dispatch);
|
|
55
|
-
closeMenu();
|
|
55
|
+
closeMenu === null || closeMenu === void 0 || closeMenu();
|
|
56
56
|
}
|
|
57
57
|
}, [api, state, dispatch, closeMenu, parents]);
|
|
58
58
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
@@ -6,7 +6,7 @@ import { useIntl } from 'react-intl-next';
|
|
|
6
6
|
import { textColorMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
8
8
|
import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette';
|
|
9
|
-
import { TextColorIcon, ToolbarColorSwatch, ToolbarDropdownMenu, ToolbarTooltip, getContrastingBackgroundColor } from '@atlaskit/editor-toolbar';
|
|
9
|
+
import { TextColorIcon, ToolbarColorSwatch, ToolbarDropdownMenu, ToolbarDropdownMenuProvider, ToolbarTooltip, getContrastingBackgroundColor } from '@atlaskit/editor-toolbar';
|
|
10
10
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
11
11
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
12
|
const styles = {
|
|
@@ -34,7 +34,7 @@ export const TextColorHighlightMenu = ({
|
|
|
34
34
|
const highlightColorIcon = highlightColor ? highlightColor : getContrastingBackgroundColor(iconColor);
|
|
35
35
|
return expValEquals('platform_editor_toolbar_aifc_patch_1', 'isEnabled', true) ? /*#__PURE__*/React.createElement(ToolbarTooltip, {
|
|
36
36
|
content: formatMessage(isHighlightPluginExisted ? messages.textColorHighlightTooltip : messages.textColorTooltip)
|
|
37
|
-
}, /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
|
|
37
|
+
}, /*#__PURE__*/React.createElement(ToolbarDropdownMenuProvider, null, /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
|
|
38
38
|
iconBefore: /*#__PURE__*/React.createElement(ToolbarColorSwatch, {
|
|
39
39
|
highlightColor: highlightColorIcon
|
|
40
40
|
}, /*#__PURE__*/React.createElement(TextColorIcon, {
|
|
@@ -50,12 +50,12 @@ export const TextColorHighlightMenu = ({
|
|
|
50
50
|
hasSectionMargin: false
|
|
51
51
|
}, expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? children : /*#__PURE__*/React.createElement(Box, {
|
|
52
52
|
xcss: styles.menu
|
|
53
|
-
}, children))) : /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
|
|
53
|
+
}, children)))) : /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
|
|
54
54
|
iconBefore: /*#__PURE__*/React.createElement(ToolbarColorSwatch, {
|
|
55
|
-
highlightColor:
|
|
55
|
+
highlightColor: highlightColorIcon
|
|
56
56
|
}, /*#__PURE__*/React.createElement(TextColorIcon, {
|
|
57
57
|
label: formatMessage(messages.textColorTooltip),
|
|
58
|
-
iconColor:
|
|
58
|
+
iconColor: iconColor,
|
|
59
59
|
shouldRecommendSmallIcon: true,
|
|
60
60
|
size: 'small',
|
|
61
61
|
isDisabled: isTextColorDisabled,
|
|
@@ -39,9 +39,8 @@ export function TextColorMenuItem({
|
|
|
39
39
|
state: null,
|
|
40
40
|
dispatch: null
|
|
41
41
|
};
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
} = useToolbarDropdownMenu();
|
|
42
|
+
const context = useToolbarDropdownMenu();
|
|
43
|
+
const closeMenu = context === null || context === void 0 ? void 0 : context.closeMenu;
|
|
45
44
|
const handleTextColorChange = useCallback(color => {
|
|
46
45
|
var _api$textColor, _api$textColor$action;
|
|
47
46
|
if (!state || !dispatch) {
|
|
@@ -49,7 +48,7 @@ export function TextColorMenuItem({
|
|
|
49
48
|
}
|
|
50
49
|
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) {
|
|
51
50
|
api.textColor.actions.changeColor(color, getInputMethodFromParentKeys(parents))(state, dispatch);
|
|
52
|
-
closeMenu();
|
|
51
|
+
closeMenu === null || closeMenu === void 0 ? void 0 : closeMenu();
|
|
53
52
|
}
|
|
54
53
|
}, [api, state, dispatch, closeMenu, parents]);
|
|
55
54
|
const {
|
|
@@ -6,7 +6,7 @@ import { useIntl } from 'react-intl-next';
|
|
|
6
6
|
import { textColorMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
8
8
|
import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette';
|
|
9
|
-
import { TextColorIcon, ToolbarColorSwatch, ToolbarDropdownMenu, ToolbarTooltip, getContrastingBackgroundColor } from '@atlaskit/editor-toolbar';
|
|
9
|
+
import { TextColorIcon, ToolbarColorSwatch, ToolbarDropdownMenu, ToolbarDropdownMenuProvider, ToolbarTooltip, getContrastingBackgroundColor } from '@atlaskit/editor-toolbar';
|
|
10
10
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
11
11
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
12
|
var styles = {
|
|
@@ -32,7 +32,7 @@ export var TextColorHighlightMenu = function TextColorHighlightMenu(_ref) {
|
|
|
32
32
|
var highlightColorIcon = highlightColor ? highlightColor : getContrastingBackgroundColor(iconColor);
|
|
33
33
|
return expValEquals('platform_editor_toolbar_aifc_patch_1', 'isEnabled', true) ? /*#__PURE__*/React.createElement(ToolbarTooltip, {
|
|
34
34
|
content: formatMessage(isHighlightPluginExisted ? messages.textColorHighlightTooltip : messages.textColorTooltip)
|
|
35
|
-
}, /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
|
|
35
|
+
}, /*#__PURE__*/React.createElement(ToolbarDropdownMenuProvider, null, /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
|
|
36
36
|
iconBefore: /*#__PURE__*/React.createElement(ToolbarColorSwatch, {
|
|
37
37
|
highlightColor: highlightColorIcon
|
|
38
38
|
}, /*#__PURE__*/React.createElement(TextColorIcon, {
|
|
@@ -48,12 +48,12 @@ export var TextColorHighlightMenu = function TextColorHighlightMenu(_ref) {
|
|
|
48
48
|
hasSectionMargin: false
|
|
49
49
|
}, expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? children : /*#__PURE__*/React.createElement(Box, {
|
|
50
50
|
xcss: styles.menu
|
|
51
|
-
}, children))) : /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
|
|
51
|
+
}, children)))) : /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
|
|
52
52
|
iconBefore: /*#__PURE__*/React.createElement(ToolbarColorSwatch, {
|
|
53
|
-
highlightColor:
|
|
53
|
+
highlightColor: highlightColorIcon
|
|
54
54
|
}, /*#__PURE__*/React.createElement(TextColorIcon, {
|
|
55
55
|
label: formatMessage(messages.textColorTooltip),
|
|
56
|
-
iconColor:
|
|
56
|
+
iconColor: iconColor,
|
|
57
57
|
shouldRecommendSmallIcon: true,
|
|
58
58
|
size: 'small',
|
|
59
59
|
isDisabled: isTextColorDisabled,
|
|
@@ -35,8 +35,8 @@ export function TextColorMenuItem(_ref) {
|
|
|
35
35
|
},
|
|
36
36
|
state = _ref2.state,
|
|
37
37
|
dispatch = _ref2.dispatch;
|
|
38
|
-
var
|
|
39
|
-
|
|
38
|
+
var context = useToolbarDropdownMenu();
|
|
39
|
+
var closeMenu = context === null || context === void 0 ? void 0 : context.closeMenu;
|
|
40
40
|
var handleTextColorChange = useCallback(function (color) {
|
|
41
41
|
var _api$textColor;
|
|
42
42
|
if (!state || !dispatch) {
|
|
@@ -44,7 +44,7 @@ export function TextColorMenuItem(_ref) {
|
|
|
44
44
|
}
|
|
45
45
|
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) {
|
|
46
46
|
api.textColor.actions.changeColor(color, getInputMethodFromParentKeys(parents))(state, dispatch);
|
|
47
|
-
closeMenu();
|
|
47
|
+
closeMenu === null || closeMenu === void 0 || closeMenu();
|
|
48
48
|
}
|
|
49
49
|
}, [api, state, dispatch, closeMenu, parents]);
|
|
50
50
|
var _useIntl = useIntl(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-text-color",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Text color plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"@atlaskit/adf-schema": "^50.2.3",
|
|
33
33
|
"@atlaskit/css": "^0.12.0",
|
|
34
34
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
35
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
36
|
-
"@atlaskit/editor-plugin-highlight": "^
|
|
37
|
-
"@atlaskit/editor-plugin-primary-toolbar": "^
|
|
38
|
-
"@atlaskit/editor-plugin-selection-toolbar": "^
|
|
39
|
-
"@atlaskit/editor-plugin-toolbar": "^0.
|
|
35
|
+
"@atlaskit/editor-plugin-analytics": "^4.0.0",
|
|
36
|
+
"@atlaskit/editor-plugin-highlight": "^4.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-primary-toolbar": "^5.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-selection-toolbar": "^5.0.0",
|
|
39
|
+
"@atlaskit/editor-plugin-toolbar": "^1.0.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
41
41
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
42
42
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
47
|
"@atlaskit/primitives": "^14.12.0",
|
|
48
48
|
"@atlaskit/theme": "^20.0.0",
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^12.0.0",
|
|
50
50
|
"@atlaskit/tokens": "^6.1.0",
|
|
51
51
|
"@babel/runtime": "^7.0.0",
|
|
52
52
|
"@emotion/react": "^11.7.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@atlaskit/editor-common": "^
|
|
55
|
+
"@atlaskit/editor-common": "^108.0.0",
|
|
56
56
|
"react": "^18.2.0",
|
|
57
57
|
"react-dom": "^18.2.0",
|
|
58
58
|
"react-intl-next": "npm:react-intl@^5.18.1"
|