@atlaskit/editor-plugin-text-color 5.2.0 → 5.4.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 +23 -0
- package/dist/cjs/textColorPlugin.js +3 -0
- package/dist/cjs/ui/RemoveColorMenuItem.js +1 -1
- package/dist/cjs/ui/TextColorHighlightMenu.js +1 -1
- package/dist/cjs/ui/TextColorMenuItem.js +21 -9
- package/dist/cjs/ui/TextMenuSection.js +1 -1
- package/dist/es2019/textColorPlugin.js +3 -0
- package/dist/es2019/ui/RemoveColorMenuItem.js +1 -1
- package/dist/es2019/ui/TextColorHighlightMenu.js +1 -1
- package/dist/es2019/ui/TextColorMenuItem.js +21 -9
- package/dist/es2019/ui/TextMenuSection.js +1 -1
- package/dist/esm/textColorPlugin.js +3 -0
- package/dist/esm/ui/RemoveColorMenuItem.js +1 -1
- package/dist/esm/ui/TextColorHighlightMenu.js +1 -1
- package/dist/esm/ui/TextColorMenuItem.js +21 -9
- package/dist/esm/ui/TextMenuSection.js +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-text-color
|
|
2
2
|
|
|
3
|
+
## 5.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`b367661ba720e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b367661ba720e) -
|
|
8
|
+
EDITOR-1562 bump adf-schema for afm
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 5.3.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- [`66414cddf2784`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/66414cddf2784) -
|
|
19
|
+
Add new platform_editor_toolbar_aifc_fix_editor_view experiment, replace destructured objects with
|
|
20
|
+
direct property access
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 5.2.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
|
@@ -35,6 +35,9 @@ var textColorPlugin = exports.textColorPlugin = function textColorPlugin(_ref) {
|
|
|
35
35
|
isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing,
|
|
36
36
|
dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
37
37
|
disabled = _ref2.disabled;
|
|
38
|
+
if (!editorView) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
38
41
|
return /*#__PURE__*/_react.default.createElement(_PrimaryToolbarComponent.PrimaryToolbarComponent, {
|
|
39
42
|
isReducedSpacing: isToolbarReducedSpacing,
|
|
40
43
|
editorView: editorView,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* TextColorMenuItem.tsx generated by @compiled/babel-plugin v0.
|
|
1
|
+
/* TextColorMenuItem.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -40,6 +40,7 @@ function TextColorMenuItem(_ref) {
|
|
|
40
40
|
palette = _useSharedPluginState.palette;
|
|
41
41
|
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
42
42
|
editorView = _useEditorToolbar.editorView;
|
|
43
|
+
// Warning! Do not destructure editorView, it will become stale
|
|
43
44
|
var _ref2 = editorView !== null && editorView !== void 0 ? editorView : {
|
|
44
45
|
state: null,
|
|
45
46
|
dispatch: null
|
|
@@ -49,15 +50,26 @@ function TextColorMenuItem(_ref) {
|
|
|
49
50
|
var context = (0, _editorToolbar.useToolbarDropdownMenu)();
|
|
50
51
|
var closeMenu = context === null || context === void 0 ? void 0 : context.closeMenu;
|
|
51
52
|
var handleTextColorChange = (0, _react.useCallback)(function (color) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true)) {
|
|
54
|
+
var _api$textColor;
|
|
55
|
+
if (!(editorView !== null && editorView !== void 0 && editorView.state) || !(editorView !== null && editorView !== void 0 && editorView.dispatch)) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
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) {
|
|
59
|
+
api.textColor.actions.changeColor(color, (0, _toolbar.getInputMethodFromParentKeys)(parents))(editorView.state, editorView.dispatch);
|
|
60
|
+
closeMenu === null || closeMenu === void 0 || closeMenu();
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
var _api$textColor2;
|
|
64
|
+
if (!state || !dispatch) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (api !== null && api !== void 0 && (_api$textColor2 = api.textColor) !== null && _api$textColor2 !== void 0 && (_api$textColor2 = _api$textColor2.actions) !== null && _api$textColor2 !== void 0 && _api$textColor2.changeColor) {
|
|
68
|
+
api.textColor.actions.changeColor(color, (0, _toolbar.getInputMethodFromParentKeys)(parents))(state, dispatch);
|
|
69
|
+
closeMenu === null || closeMenu === void 0 || closeMenu();
|
|
70
|
+
}
|
|
55
71
|
}
|
|
56
|
-
|
|
57
|
-
api.textColor.actions.changeColor(color, (0, _toolbar.getInputMethodFromParentKeys)(parents))(state, dispatch);
|
|
58
|
-
closeMenu === null || closeMenu === void 0 || closeMenu();
|
|
59
|
-
}
|
|
60
|
-
}, [api, state, dispatch, closeMenu, parents]);
|
|
72
|
+
}, [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, state, dispatch]);
|
|
61
73
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
62
74
|
formatMessage = _useIntl.formatMessage;
|
|
63
75
|
return /*#__PURE__*/_react.default.createElement(_compiled.Stack, {
|
|
@@ -30,6 +30,9 @@ export const textColorPlugin = ({
|
|
|
30
30
|
dispatchAnalyticsEvent,
|
|
31
31
|
disabled
|
|
32
32
|
}) => {
|
|
33
|
+
if (!editorView) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
33
36
|
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
34
37
|
isReducedSpacing: isToolbarReducedSpacing,
|
|
35
38
|
editorView: editorView,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* RemoveColorMenuItem.tsx generated by @compiled/babel-plugin v0.
|
|
1
|
+
/* RemoveColorMenuItem.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
import "./RemoveColorMenuItem.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* TextColorHighlightMenu.tsx generated by @compiled/babel-plugin v0.
|
|
1
|
+
/* TextColorHighlightMenu.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
import "./TextColorHighlightMenu.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React from 'react';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* TextColorMenuItem.tsx generated by @compiled/babel-plugin v0.
|
|
1
|
+
/* TextColorMenuItem.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
import "./TextColorMenuItem.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useCallback } from 'react';
|
|
@@ -34,6 +34,7 @@ export function TextColorMenuItem({
|
|
|
34
34
|
const {
|
|
35
35
|
editorView
|
|
36
36
|
} = useEditorToolbar();
|
|
37
|
+
// Warning! Do not destructure editorView, it will become stale
|
|
37
38
|
const {
|
|
38
39
|
state,
|
|
39
40
|
dispatch
|
|
@@ -44,15 +45,26 @@ export function TextColorMenuItem({
|
|
|
44
45
|
const context = useToolbarDropdownMenu();
|
|
45
46
|
const closeMenu = context === null || context === void 0 ? void 0 : context.closeMenu;
|
|
46
47
|
const handleTextColorChange = useCallback(color => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
if (expValEquals('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true)) {
|
|
49
|
+
var _api$textColor, _api$textColor$action;
|
|
50
|
+
if (!(editorView !== null && editorView !== void 0 && editorView.state) || !(editorView !== null && editorView !== void 0 && editorView.dispatch)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
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) {
|
|
54
|
+
api.textColor.actions.changeColor(color, getInputMethodFromParentKeys(parents))(editorView.state, editorView.dispatch);
|
|
55
|
+
closeMenu === null || closeMenu === void 0 ? void 0 : closeMenu();
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
var _api$textColor2, _api$textColor2$actio;
|
|
59
|
+
if (!state || !dispatch) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (api !== null && api !== void 0 && (_api$textColor2 = api.textColor) !== null && _api$textColor2 !== void 0 && (_api$textColor2$actio = _api$textColor2.actions) !== null && _api$textColor2$actio !== void 0 && _api$textColor2$actio.changeColor) {
|
|
63
|
+
api.textColor.actions.changeColor(color, getInputMethodFromParentKeys(parents))(state, dispatch);
|
|
64
|
+
closeMenu === null || closeMenu === void 0 ? void 0 : closeMenu();
|
|
65
|
+
}
|
|
50
66
|
}
|
|
51
|
-
|
|
52
|
-
api.textColor.actions.changeColor(color, getInputMethodFromParentKeys(parents))(state, dispatch);
|
|
53
|
-
closeMenu === null || closeMenu === void 0 ? void 0 : closeMenu();
|
|
54
|
-
}
|
|
55
|
-
}, [api, state, dispatch, closeMenu, parents]);
|
|
67
|
+
}, [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, state, dispatch]);
|
|
56
68
|
const {
|
|
57
69
|
formatMessage
|
|
58
70
|
} = useIntl();
|
|
@@ -28,6 +28,9 @@ export var textColorPlugin = function textColorPlugin(_ref) {
|
|
|
28
28
|
isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing,
|
|
29
29
|
dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
30
30
|
disabled = _ref2.disabled;
|
|
31
|
+
if (!editorView) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
31
34
|
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
32
35
|
isReducedSpacing: isToolbarReducedSpacing,
|
|
33
36
|
editorView: editorView,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* RemoveColorMenuItem.tsx generated by @compiled/babel-plugin v0.
|
|
1
|
+
/* RemoveColorMenuItem.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
import "./RemoveColorMenuItem.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* TextColorHighlightMenu.tsx generated by @compiled/babel-plugin v0.
|
|
1
|
+
/* TextColorHighlightMenu.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
import "./TextColorHighlightMenu.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React from 'react';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* TextColorMenuItem.tsx generated by @compiled/babel-plugin v0.
|
|
1
|
+
/* TextColorMenuItem.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
import "./TextColorMenuItem.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useCallback } from 'react';
|
|
@@ -31,6 +31,7 @@ export function TextColorMenuItem(_ref) {
|
|
|
31
31
|
palette = _useSharedPluginState.palette;
|
|
32
32
|
var _useEditorToolbar = useEditorToolbar(),
|
|
33
33
|
editorView = _useEditorToolbar.editorView;
|
|
34
|
+
// Warning! Do not destructure editorView, it will become stale
|
|
34
35
|
var _ref2 = editorView !== null && editorView !== void 0 ? editorView : {
|
|
35
36
|
state: null,
|
|
36
37
|
dispatch: null
|
|
@@ -40,15 +41,26 @@ export function TextColorMenuItem(_ref) {
|
|
|
40
41
|
var context = useToolbarDropdownMenu();
|
|
41
42
|
var closeMenu = context === null || context === void 0 ? void 0 : context.closeMenu;
|
|
42
43
|
var handleTextColorChange = useCallback(function (color) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
if (expValEquals('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true)) {
|
|
45
|
+
var _api$textColor;
|
|
46
|
+
if (!(editorView !== null && editorView !== void 0 && editorView.state) || !(editorView !== null && editorView !== void 0 && editorView.dispatch)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
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
|
+
api.textColor.actions.changeColor(color, getInputMethodFromParentKeys(parents))(editorView.state, editorView.dispatch);
|
|
51
|
+
closeMenu === null || closeMenu === void 0 || closeMenu();
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
var _api$textColor2;
|
|
55
|
+
if (!state || !dispatch) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (api !== null && api !== void 0 && (_api$textColor2 = api.textColor) !== null && _api$textColor2 !== void 0 && (_api$textColor2 = _api$textColor2.actions) !== null && _api$textColor2 !== void 0 && _api$textColor2.changeColor) {
|
|
59
|
+
api.textColor.actions.changeColor(color, getInputMethodFromParentKeys(parents))(state, dispatch);
|
|
60
|
+
closeMenu === null || closeMenu === void 0 || closeMenu();
|
|
61
|
+
}
|
|
46
62
|
}
|
|
47
|
-
|
|
48
|
-
api.textColor.actions.changeColor(color, getInputMethodFromParentKeys(parents))(state, dispatch);
|
|
49
|
-
closeMenu === null || closeMenu === void 0 || closeMenu();
|
|
50
|
-
}
|
|
51
|
-
}, [api, state, dispatch, closeMenu, parents]);
|
|
63
|
+
}, [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, state, dispatch]);
|
|
52
64
|
var _useIntl = useIntl(),
|
|
53
65
|
formatMessage = _useIntl.formatMessage;
|
|
54
66
|
return /*#__PURE__*/React.createElement(Stack, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-text-color",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "Text color plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
],
|
|
30
30
|
"atlaskit:src": "src/index.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@atlaskit/adf-schema": "^51.1.
|
|
32
|
+
"@atlaskit/adf-schema": "^51.1.2",
|
|
33
33
|
"@atlaskit/button": "^23.4.0",
|
|
34
34
|
"@atlaskit/css": "^0.14.0",
|
|
35
35
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
36
|
-
"@atlaskit/editor-plugin-analytics": "^5.
|
|
37
|
-
"@atlaskit/editor-plugin-highlight": "^5.
|
|
36
|
+
"@atlaskit/editor-plugin-analytics": "^5.2.0",
|
|
37
|
+
"@atlaskit/editor-plugin-highlight": "^5.3.0",
|
|
38
38
|
"@atlaskit/editor-plugin-primary-toolbar": "^6.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-selection-toolbar": "^6.1.0",
|
|
40
40
|
"@atlaskit/editor-plugin-toolbar": "^2.1.0",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
49
49
|
"@atlaskit/primitives": "^14.14.0",
|
|
50
50
|
"@atlaskit/theme": "^21.0.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^12.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^12.18.0",
|
|
52
52
|
"@atlaskit/tokens": "^6.3.0",
|
|
53
53
|
"@babel/runtime": "^7.0.0",
|
|
54
54
|
"@emotion/react": "^11.7.1"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@atlaskit/editor-common": "^109.
|
|
57
|
+
"@atlaskit/editor-common": "^109.5.0",
|
|
58
58
|
"react": "^18.2.0",
|
|
59
59
|
"react-dom": "^18.2.0",
|
|
60
60
|
"react-intl-next": "npm:react-intl@^5.18.1"
|