@atlaskit/editor-plugin-alignment 11.1.1 → 11.1.3
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 +15 -0
- package/dist/cjs/ui/Toolbar/AlignmentMenu.js +6 -4
- package/dist/es2019/ui/Toolbar/AlignmentMenu.js +6 -4
- package/dist/esm/ui/Toolbar/AlignmentMenu.js +6 -4
- package/dist/types/alignmentPluginType.d.ts +3 -1
- package/dist/types-ts4.5/alignmentPluginType.d.ts +3 -1
- package/package.json +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-alignment
|
|
2
2
|
|
|
3
|
+
## 11.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`41962dd9dccb2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/41962dd9dccb2) -
|
|
8
|
+
NO-ISSUE: adds a default toolbar state so we can render the toolbar on initial load without
|
|
9
|
+
relying on editor state
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 11.1.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 11.1.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -10,14 +10,15 @@ var _reactIntl = require("react-intl");
|
|
|
10
10
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
11
11
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
12
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
13
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
13
14
|
var _options = require("./options");
|
|
14
15
|
var AlignmentMenu = exports.AlignmentMenu = function AlignmentMenu(_ref) {
|
|
15
16
|
var children = _ref.children,
|
|
16
17
|
api = _ref.api;
|
|
17
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['alignment'], function (states) {
|
|
18
|
-
var _states$alignmentStat, _states$alignmentStat2;
|
|
18
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['alignment', 'interaction'], function (states) {
|
|
19
|
+
var _states$interactionSt, _states$alignmentStat, _states$alignmentStat2;
|
|
19
20
|
return {
|
|
20
|
-
align: (_states$alignmentStat = states.alignmentState) === null || _states$alignmentStat === void 0 ? void 0 : _states$alignmentStat.align,
|
|
21
|
+
align: ((_states$interactionSt = states.interactionState) === null || _states$interactionSt === void 0 ? void 0 : _states$interactionSt.interactionState) === 'hasNotHadInteraction' && (0, _expValEquals.expValEquals)('platform_editor_default_toolbar_state', 'isEnabled', true) ? 'start' : (_states$alignmentStat = states.alignmentState) === null || _states$alignmentStat === void 0 ? void 0 : _states$alignmentStat.align,
|
|
21
22
|
isEnabled: (_states$alignmentStat2 = states.alignmentState) === null || _states$alignmentStat2 === void 0 ? void 0 : _states$alignmentStat2.isEnabled
|
|
22
23
|
};
|
|
23
24
|
}),
|
|
@@ -31,7 +32,8 @@ var AlignmentMenu = exports.AlignmentMenu = function AlignmentMenu(_ref) {
|
|
|
31
32
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownMenu, {
|
|
32
33
|
iconBefore: /*#__PURE__*/_react.default.createElement(Icon, {
|
|
33
34
|
label: "",
|
|
34
|
-
size: "small"
|
|
35
|
+
size: "small",
|
|
36
|
+
testId: "text-alignment-menu-".concat(align, "-icon")
|
|
35
37
|
}),
|
|
36
38
|
isDisabled: !isEnabled,
|
|
37
39
|
testId: "text-alignment-menu",
|
|
@@ -3,6 +3,7 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { alignmentMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { ToolbarDropdownMenu, ToolbarTooltip } from '@atlaskit/editor-toolbar';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
7
|
import { alignmentOptions } from './options';
|
|
7
8
|
export const AlignmentMenu = ({
|
|
8
9
|
children,
|
|
@@ -11,10 +12,10 @@ export const AlignmentMenu = ({
|
|
|
11
12
|
const {
|
|
12
13
|
align = 'start',
|
|
13
14
|
isEnabled
|
|
14
|
-
} = useSharedPluginStateWithSelector(api, ['alignment'], states => {
|
|
15
|
-
var _states$alignmentStat, _states$alignmentStat2;
|
|
15
|
+
} = useSharedPluginStateWithSelector(api, ['alignment', 'interaction'], states => {
|
|
16
|
+
var _states$interactionSt, _states$alignmentStat, _states$alignmentStat2;
|
|
16
17
|
return {
|
|
17
|
-
align: (_states$alignmentStat = states.alignmentState) === null || _states$alignmentStat === void 0 ? void 0 : _states$alignmentStat.align,
|
|
18
|
+
align: ((_states$interactionSt = states.interactionState) === null || _states$interactionSt === void 0 ? void 0 : _states$interactionSt.interactionState) === 'hasNotHadInteraction' && expValEquals('platform_editor_default_toolbar_state', 'isEnabled', true) ? 'start' : (_states$alignmentStat = states.alignmentState) === null || _states$alignmentStat === void 0 ? void 0 : _states$alignmentStat.align,
|
|
18
19
|
isEnabled: (_states$alignmentStat2 = states.alignmentState) === null || _states$alignmentStat2 === void 0 ? void 0 : _states$alignmentStat2.isEnabled
|
|
19
20
|
};
|
|
20
21
|
});
|
|
@@ -28,7 +29,8 @@ export const AlignmentMenu = ({
|
|
|
28
29
|
return /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
|
|
29
30
|
iconBefore: /*#__PURE__*/React.createElement(Icon, {
|
|
30
31
|
label: "",
|
|
31
|
-
size: "small"
|
|
32
|
+
size: "small",
|
|
33
|
+
testId: `text-alignment-menu-${align}-icon`
|
|
32
34
|
}),
|
|
33
35
|
isDisabled: !isEnabled,
|
|
34
36
|
testId: "text-alignment-menu",
|
|
@@ -3,14 +3,15 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { alignmentMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { ToolbarDropdownMenu, ToolbarTooltip } from '@atlaskit/editor-toolbar';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
7
|
import { alignmentOptions } from './options';
|
|
7
8
|
export var AlignmentMenu = function AlignmentMenu(_ref) {
|
|
8
9
|
var children = _ref.children,
|
|
9
10
|
api = _ref.api;
|
|
10
|
-
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['alignment'], function (states) {
|
|
11
|
-
var _states$alignmentStat, _states$alignmentStat2;
|
|
11
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['alignment', 'interaction'], function (states) {
|
|
12
|
+
var _states$interactionSt, _states$alignmentStat, _states$alignmentStat2;
|
|
12
13
|
return {
|
|
13
|
-
align: (_states$alignmentStat = states.alignmentState) === null || _states$alignmentStat === void 0 ? void 0 : _states$alignmentStat.align,
|
|
14
|
+
align: ((_states$interactionSt = states.interactionState) === null || _states$interactionSt === void 0 ? void 0 : _states$interactionSt.interactionState) === 'hasNotHadInteraction' && expValEquals('platform_editor_default_toolbar_state', 'isEnabled', true) ? 'start' : (_states$alignmentStat = states.alignmentState) === null || _states$alignmentStat === void 0 ? void 0 : _states$alignmentStat.align,
|
|
14
15
|
isEnabled: (_states$alignmentStat2 = states.alignmentState) === null || _states$alignmentStat2 === void 0 ? void 0 : _states$alignmentStat2.isEnabled
|
|
15
16
|
};
|
|
16
17
|
}),
|
|
@@ -24,7 +25,8 @@ export var AlignmentMenu = function AlignmentMenu(_ref) {
|
|
|
24
25
|
return /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
|
|
25
26
|
iconBefore: /*#__PURE__*/React.createElement(Icon, {
|
|
26
27
|
label: "",
|
|
27
|
-
size: "small"
|
|
28
|
+
size: "small",
|
|
29
|
+
testId: "text-alignment-menu-".concat(align, "-icon")
|
|
28
30
|
}),
|
|
29
31
|
isDisabled: !isEnabled,
|
|
30
32
|
testId: "text-alignment-menu",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
|
+
import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
4
5
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
5
6
|
import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
|
|
6
7
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
@@ -11,7 +12,8 @@ export type AlignmentPluginDependencies = [
|
|
|
11
12
|
OptionalPlugin<SelectionToolbarPlugin>,
|
|
12
13
|
OptionalPlugin<AnalyticsPlugin>,
|
|
13
14
|
OptionalPlugin<UserPreferencesPlugin>,
|
|
14
|
-
OptionalPlugin<ToolbarPlugin
|
|
15
|
+
OptionalPlugin<ToolbarPlugin>,
|
|
16
|
+
OptionalPlugin<InteractionPlugin>
|
|
15
17
|
];
|
|
16
18
|
export type AlignmentPlugin = NextEditorPlugin<'alignment', {
|
|
17
19
|
dependencies: AlignmentPluginDependencies;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
|
+
import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
4
5
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
5
6
|
import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
|
|
6
7
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
@@ -11,7 +12,8 @@ export type AlignmentPluginDependencies = [
|
|
|
11
12
|
OptionalPlugin<SelectionToolbarPlugin>,
|
|
12
13
|
OptionalPlugin<AnalyticsPlugin>,
|
|
13
14
|
OptionalPlugin<UserPreferencesPlugin>,
|
|
14
|
-
OptionalPlugin<ToolbarPlugin
|
|
15
|
+
OptionalPlugin<ToolbarPlugin>,
|
|
16
|
+
OptionalPlugin<InteractionPlugin>
|
|
15
17
|
];
|
|
16
18
|
export type AlignmentPlugin = NextEditorPlugin<'alignment', {
|
|
17
19
|
dependencies: AlignmentPluginDependencies;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-alignment",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.3",
|
|
4
4
|
"description": "Alignment plugin for @atlaskit/editor-core",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -26,24 +26,25 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@atlaskit/adf-schema": "^52.
|
|
29
|
+
"@atlaskit/adf-schema": "^52.13.0",
|
|
30
30
|
"@atlaskit/css": "^0.19.0",
|
|
31
31
|
"@atlaskit/editor-plugin-analytics": "^10.1.0",
|
|
32
|
+
"@atlaskit/editor-plugin-interaction": "^19.1.0",
|
|
32
33
|
"@atlaskit/editor-plugin-primary-toolbar": "^11.1.0",
|
|
33
34
|
"@atlaskit/editor-plugin-selection-toolbar": "^11.3.0",
|
|
34
35
|
"@atlaskit/editor-plugin-toolbar": "^7.3.0",
|
|
35
36
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
36
37
|
"@atlaskit/editor-tables": "^2.10.0",
|
|
37
|
-
"@atlaskit/editor-toolbar": "^1.
|
|
38
|
+
"@atlaskit/editor-toolbar": "^1.7.0",
|
|
38
39
|
"@atlaskit/icon": "^35.0.0",
|
|
39
40
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
40
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
41
|
+
"@atlaskit/tmp-editor-statsig": "^82.4.0",
|
|
41
42
|
"@atlaskit/tokens": "^13.0.0",
|
|
42
43
|
"@babel/runtime": "^7.0.0",
|
|
43
44
|
"@compiled/react": "^0.20.0"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
|
-
"@atlaskit/editor-common": "^114.
|
|
47
|
+
"@atlaskit/editor-common": "^114.41.0",
|
|
47
48
|
"react": "^18.2.0",
|
|
48
49
|
"react-dom": "^18.2.0",
|
|
49
50
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -51,6 +52,8 @@
|
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@testing-library/react": "^16.3.0",
|
|
53
54
|
"@testing-library/user-event": "^14.4.3",
|
|
55
|
+
"react": "^18.2.0",
|
|
56
|
+
"react-dom": "^18.2.0",
|
|
54
57
|
"react-intl": "^6.6.2",
|
|
55
58
|
"wait-for-expect": "^1.2.0"
|
|
56
59
|
},
|