@atlaskit/editor-plugin-alignment 3.0.1 → 3.0.2
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 +8 -0
- package/dist/cjs/alignmentPlugin.js +4 -2
- package/dist/cjs/ui/PrimaryToolbarComponent.js +7 -3
- package/dist/cjs/ui/ToolbarAlignment/index.compiled.css +4 -0
- package/dist/cjs/ui/ToolbarAlignment/index.js +18 -3
- package/dist/es2019/alignmentPlugin.js +4 -2
- package/dist/es2019/ui/PrimaryToolbarComponent.js +5 -2
- package/dist/es2019/ui/ToolbarAlignment/index.compiled.css +4 -0
- package/dist/es2019/ui/ToolbarAlignment/index.js +14 -1
- package/dist/esm/alignmentPlugin.js +4 -2
- package/dist/esm/ui/PrimaryToolbarComponent.js +6 -2
- package/dist/esm/ui/ToolbarAlignment/index.compiled.css +4 -0
- package/dist/esm/ui/ToolbarAlignment/index.js +16 -1
- package/dist/types/ui/PrimaryToolbarComponent.d.ts +3 -2
- package/dist/types/ui/ToolbarAlignment/index.d.ts +3 -2
- package/dist/types-ts4.5/ui/PrimaryToolbarComponent.d.ts +3 -2
- package/dist/types-ts4.5/ui/ToolbarAlignment/index.d.ts +3 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-alignment
|
|
2
2
|
|
|
3
|
+
## 3.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#120931](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120931)
|
|
8
|
+
[`624b97c021fea`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/624b97c021fea) -
|
|
9
|
+
[ux] ED-26676 revert to existing primary toolbar components
|
|
10
|
+
|
|
3
11
|
## 3.0.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -24,7 +24,8 @@ var alignmentPlugin = exports.alignmentPlugin = function alignmentPlugin(_ref) {
|
|
|
24
24
|
popupsBoundariesElement = _ref2.popupsBoundariesElement,
|
|
25
25
|
popupsScrollableElement = _ref2.popupsScrollableElement,
|
|
26
26
|
disabled = _ref2.disabled,
|
|
27
|
-
isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing
|
|
27
|
+
isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing,
|
|
28
|
+
toolbarSize = _ref2.toolbarSize;
|
|
28
29
|
return /*#__PURE__*/_react.default.createElement(_PrimaryToolbarComponent.PrimaryToolbarComponent, {
|
|
29
30
|
api: api,
|
|
30
31
|
editorView: editorView,
|
|
@@ -32,7 +33,8 @@ var alignmentPlugin = exports.alignmentPlugin = function alignmentPlugin(_ref) {
|
|
|
32
33
|
popupsMountPoint: popupsMountPoint,
|
|
33
34
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
34
35
|
popupsScrollableElement: popupsScrollableElement,
|
|
35
|
-
isToolbarReducedSpacing: isToolbarReducedSpacing
|
|
36
|
+
isToolbarReducedSpacing: isToolbarReducedSpacing,
|
|
37
|
+
toolbarSize: toolbarSize
|
|
36
38
|
});
|
|
37
39
|
};
|
|
38
40
|
api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 || _api$primaryToolbar.actions.registerComponent({
|
|
@@ -8,8 +8,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.PrimaryToolbarComponent = PrimaryToolbarComponent;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
11
|
+
var _types = require("@atlaskit/editor-common/types");
|
|
11
12
|
var _editorCommands = require("../editor-commands");
|
|
12
|
-
var
|
|
13
|
+
var _types2 = require("../pm-plugins/types");
|
|
13
14
|
var _ToolbarAlignment = _interopRequireDefault(require("./ToolbarAlignment"));
|
|
14
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -20,7 +21,9 @@ function PrimaryToolbarComponent(_ref) {
|
|
|
20
21
|
popupsMountPoint = _ref.popupsMountPoint,
|
|
21
22
|
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
22
23
|
popupsScrollableElement = _ref.popupsScrollableElement,
|
|
23
|
-
isToolbarReducedSpacing = _ref.isToolbarReducedSpacing
|
|
24
|
+
isToolbarReducedSpacing = _ref.isToolbarReducedSpacing,
|
|
25
|
+
_ref$toolbarSize = _ref.toolbarSize,
|
|
26
|
+
toolbarSize = _ref$toolbarSize === void 0 ? _types.ToolbarSize.XXL : _ref$toolbarSize;
|
|
24
27
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['alignment']),
|
|
25
28
|
alignmentState = _useSharedPluginState.alignmentState;
|
|
26
29
|
var changeAlignmentCallback = (0, _react.useCallback)(function (align) {
|
|
@@ -38,6 +41,7 @@ function PrimaryToolbarComponent(_ref) {
|
|
|
38
41
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
39
42
|
popupsScrollableElement: popupsScrollableElement,
|
|
40
43
|
api: api,
|
|
41
|
-
toolbarType:
|
|
44
|
+
toolbarType: _types2.ToolbarType.PRIMARY,
|
|
45
|
+
toolbarSize: toolbarSize
|
|
42
46
|
});
|
|
43
47
|
}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = exports.AlignmentToolbar = void 0;
|
|
9
|
+
require("./index.compiled.css");
|
|
9
10
|
var _runtime = require("@compiled/react/runtime");
|
|
10
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -16,10 +17,11 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
16
17
|
var _react = _interopRequireDefault(require("react"));
|
|
17
18
|
var _reactIntlNext = require("react-intl-next");
|
|
18
19
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
20
|
+
var _types = require("@atlaskit/editor-common/types");
|
|
19
21
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
20
22
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
21
23
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
22
|
-
var
|
|
24
|
+
var _types2 = require("../../pm-plugins/types");
|
|
23
25
|
var _Alignment = _interopRequireDefault(require("../Alignment"));
|
|
24
26
|
var _iconMap = require("./icon-map");
|
|
25
27
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
@@ -89,7 +91,9 @@ var AlignmentToolbar = exports.AlignmentToolbar = /*#__PURE__*/function (_React$
|
|
|
89
91
|
pluginState = _this$props.pluginState,
|
|
90
92
|
disabled = _this$props.disabled,
|
|
91
93
|
intl = _this$props.intl,
|
|
92
|
-
api = _this$props.api
|
|
94
|
+
api = _this$props.api,
|
|
95
|
+
toolbarType = _this$props.toolbarType,
|
|
96
|
+
toolbarSize = _this$props.toolbarSize;
|
|
93
97
|
var alignment = (_pluginState$align = pluginState === null || pluginState === void 0 ? void 0 : pluginState.align) !== null && _pluginState$align !== void 0 ? _pluginState$align : 'start';
|
|
94
98
|
var title = intl.formatMessage(_messages.alignmentMessages.alignment);
|
|
95
99
|
var reducedSpacing = (0, _experiments.editorExperiment)('contextual_formatting_toolbar', true) || (0, _experiments.editorExperiment)('platform_editor_contextual_formatting_toolbar_v2', 'variant1', {
|
|
@@ -97,6 +101,16 @@ var AlignmentToolbar = exports.AlignmentToolbar = /*#__PURE__*/function (_React$
|
|
|
97
101
|
}) || (0, _experiments.editorExperiment)('platform_editor_contextual_formatting_toolbar_v2', 'variant2', {
|
|
98
102
|
exposure: true
|
|
99
103
|
}) ? 'compact' : 'none';
|
|
104
|
+
if (toolbarType === _types2.ToolbarType.PRIMARY && toolbarSize && toolbarSize > _types.ToolbarSize.XL && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
|
|
105
|
+
exposure: true
|
|
106
|
+
})) {
|
|
107
|
+
return /*#__PURE__*/_react.default.createElement(_Alignment.default, {
|
|
108
|
+
onClick: function onClick(align) {
|
|
109
|
+
return _this2.changeAlignment(align, false);
|
|
110
|
+
},
|
|
111
|
+
className: (0, _runtime.ax)(["_ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t"])
|
|
112
|
+
});
|
|
113
|
+
}
|
|
100
114
|
return /*#__PURE__*/_react.default.createElement(_ui.ToolbarDropdownWrapper, null, /*#__PURE__*/_react.default.createElement(_uiMenu.DropdownContainer, {
|
|
101
115
|
mountTo: popupsMountPoint,
|
|
102
116
|
boundariesElement: popupsBoundariesElement,
|
|
@@ -146,7 +160,7 @@ var AlignmentToolbar = exports.AlignmentToolbar = /*#__PURE__*/function (_React$
|
|
|
146
160
|
key: "componentDidUpdate",
|
|
147
161
|
value: function componentDidUpdate(prevProps) {
|
|
148
162
|
var _this3 = this;
|
|
149
|
-
if (this.props.toolbarType !==
|
|
163
|
+
if (this.props.toolbarType !== _types2.ToolbarType.FLOATING && this.state.isOpen) {
|
|
150
164
|
// by triggering the keyboard event with a setTimeout, we ensure that the tooltip
|
|
151
165
|
// associated with the alignment button doesn't render until the next render cycle
|
|
152
166
|
// where the popup will be correctly positioned and the relative position of the tooltip
|
|
@@ -164,4 +178,5 @@ var AlignmentToolbar = exports.AlignmentToolbar = /*#__PURE__*/function (_React$
|
|
|
164
178
|
}]);
|
|
165
179
|
}(_react.default.Component);
|
|
166
180
|
(0, _defineProperty2.default)(AlignmentToolbar, "displayName", 'AlignmentToolbar');
|
|
181
|
+
var alignmentToolbarStyles = null;
|
|
167
182
|
var _default = exports.default = (0, _reactIntlNext.injectIntl)(AlignmentToolbar);
|
|
@@ -18,7 +18,8 @@ export const alignmentPlugin = ({
|
|
|
18
18
|
popupsBoundariesElement,
|
|
19
19
|
popupsScrollableElement,
|
|
20
20
|
disabled,
|
|
21
|
-
isToolbarReducedSpacing
|
|
21
|
+
isToolbarReducedSpacing,
|
|
22
|
+
toolbarSize
|
|
22
23
|
}) => {
|
|
23
24
|
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
24
25
|
api: api,
|
|
@@ -27,7 +28,8 @@ export const alignmentPlugin = ({
|
|
|
27
28
|
popupsMountPoint: popupsMountPoint,
|
|
28
29
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
29
30
|
popupsScrollableElement: popupsScrollableElement,
|
|
30
|
-
isToolbarReducedSpacing: isToolbarReducedSpacing
|
|
31
|
+
isToolbarReducedSpacing: isToolbarReducedSpacing,
|
|
32
|
+
toolbarSize: toolbarSize
|
|
31
33
|
});
|
|
32
34
|
};
|
|
33
35
|
api === null || api === void 0 ? void 0 : (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.actions.registerComponent({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
3
4
|
import { changeAlignment } from '../editor-commands';
|
|
4
5
|
import { ToolbarType } from '../pm-plugins/types';
|
|
5
6
|
import ToolbarAlignment from './ToolbarAlignment';
|
|
@@ -10,7 +11,8 @@ export function PrimaryToolbarComponent({
|
|
|
10
11
|
popupsMountPoint,
|
|
11
12
|
popupsBoundariesElement,
|
|
12
13
|
popupsScrollableElement,
|
|
13
|
-
isToolbarReducedSpacing
|
|
14
|
+
isToolbarReducedSpacing,
|
|
15
|
+
toolbarSize = ToolbarSize.XXL
|
|
14
16
|
}) {
|
|
15
17
|
const {
|
|
16
18
|
alignmentState
|
|
@@ -28,6 +30,7 @@ export function PrimaryToolbarComponent({
|
|
|
28
30
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
29
31
|
popupsScrollableElement: popupsScrollableElement,
|
|
30
32
|
api: api,
|
|
31
|
-
toolbarType: ToolbarType.PRIMARY
|
|
33
|
+
toolbarType: ToolbarType.PRIMARY,
|
|
34
|
+
toolbarSize: toolbarSize
|
|
32
35
|
});
|
|
33
36
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import "./index.compiled.css";
|
|
3
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
5
|
import React from 'react';
|
|
5
6
|
import { injectIntl } from 'react-intl-next';
|
|
6
7
|
import { alignmentMessages as messages } from '@atlaskit/editor-common/messages';
|
|
8
|
+
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
7
9
|
import { ToolbarDropdownTriggerWrapper, ToolbarDropdownWrapper, ToolbarExpandIcon, ToolbarSeparator } from '@atlaskit/editor-common/ui';
|
|
8
10
|
import { ArrowKeyNavigationType, DropdownContainer as Dropdown, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
9
11
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -67,7 +69,9 @@ export class AlignmentToolbar extends React.Component {
|
|
|
67
69
|
pluginState,
|
|
68
70
|
disabled,
|
|
69
71
|
intl,
|
|
70
|
-
api
|
|
72
|
+
api,
|
|
73
|
+
toolbarType,
|
|
74
|
+
toolbarSize
|
|
71
75
|
} = this.props;
|
|
72
76
|
const alignment = (_pluginState$align = pluginState === null || pluginState === void 0 ? void 0 : pluginState.align) !== null && _pluginState$align !== void 0 ? _pluginState$align : 'start';
|
|
73
77
|
const title = intl.formatMessage(messages.alignment);
|
|
@@ -76,6 +80,14 @@ export class AlignmentToolbar extends React.Component {
|
|
|
76
80
|
}) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant2', {
|
|
77
81
|
exposure: true
|
|
78
82
|
}) ? 'compact' : 'none';
|
|
83
|
+
if (toolbarType === ToolbarType.PRIMARY && toolbarSize && toolbarSize > ToolbarSize.XL && editorExperiment('platform_editor_controls', 'variant1', {
|
|
84
|
+
exposure: true
|
|
85
|
+
})) {
|
|
86
|
+
return /*#__PURE__*/React.createElement(Alignment, {
|
|
87
|
+
onClick: align => this.changeAlignment(align, false),
|
|
88
|
+
className: ax(["_ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t"])
|
|
89
|
+
});
|
|
90
|
+
}
|
|
79
91
|
return /*#__PURE__*/React.createElement(ToolbarDropdownWrapper, null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
80
92
|
mountTo: popupsMountPoint,
|
|
81
93
|
boundariesElement: popupsBoundariesElement,
|
|
@@ -137,4 +149,5 @@ export class AlignmentToolbar extends React.Component {
|
|
|
137
149
|
}
|
|
138
150
|
}
|
|
139
151
|
_defineProperty(AlignmentToolbar, "displayName", 'AlignmentToolbar');
|
|
152
|
+
const alignmentToolbarStyles = null;
|
|
140
153
|
export default injectIntl(AlignmentToolbar);
|
|
@@ -17,7 +17,8 @@ export var alignmentPlugin = function alignmentPlugin(_ref) {
|
|
|
17
17
|
popupsBoundariesElement = _ref2.popupsBoundariesElement,
|
|
18
18
|
popupsScrollableElement = _ref2.popupsScrollableElement,
|
|
19
19
|
disabled = _ref2.disabled,
|
|
20
|
-
isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing
|
|
20
|
+
isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing,
|
|
21
|
+
toolbarSize = _ref2.toolbarSize;
|
|
21
22
|
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
22
23
|
api: api,
|
|
23
24
|
editorView: editorView,
|
|
@@ -25,7 +26,8 @@ export var alignmentPlugin = function alignmentPlugin(_ref) {
|
|
|
25
26
|
popupsMountPoint: popupsMountPoint,
|
|
26
27
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
27
28
|
popupsScrollableElement: popupsScrollableElement,
|
|
28
|
-
isToolbarReducedSpacing: isToolbarReducedSpacing
|
|
29
|
+
isToolbarReducedSpacing: isToolbarReducedSpacing,
|
|
30
|
+
toolbarSize: toolbarSize
|
|
29
31
|
});
|
|
30
32
|
};
|
|
31
33
|
api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 || _api$primaryToolbar.actions.registerComponent({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
3
4
|
import { changeAlignment } from '../editor-commands';
|
|
4
5
|
import { ToolbarType } from '../pm-plugins/types';
|
|
5
6
|
import ToolbarAlignment from './ToolbarAlignment';
|
|
@@ -10,7 +11,9 @@ export function PrimaryToolbarComponent(_ref) {
|
|
|
10
11
|
popupsMountPoint = _ref.popupsMountPoint,
|
|
11
12
|
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
12
13
|
popupsScrollableElement = _ref.popupsScrollableElement,
|
|
13
|
-
isToolbarReducedSpacing = _ref.isToolbarReducedSpacing
|
|
14
|
+
isToolbarReducedSpacing = _ref.isToolbarReducedSpacing,
|
|
15
|
+
_ref$toolbarSize = _ref.toolbarSize,
|
|
16
|
+
toolbarSize = _ref$toolbarSize === void 0 ? ToolbarSize.XXL : _ref$toolbarSize;
|
|
14
17
|
var _useSharedPluginState = useSharedPluginState(api, ['alignment']),
|
|
15
18
|
alignmentState = _useSharedPluginState.alignmentState;
|
|
16
19
|
var changeAlignmentCallback = useCallback(function (align) {
|
|
@@ -28,6 +31,7 @@ export function PrimaryToolbarComponent(_ref) {
|
|
|
28
31
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
29
32
|
popupsScrollableElement: popupsScrollableElement,
|
|
30
33
|
api: api,
|
|
31
|
-
toolbarType: ToolbarType.PRIMARY
|
|
34
|
+
toolbarType: ToolbarType.PRIMARY,
|
|
35
|
+
toolbarSize: toolbarSize
|
|
32
36
|
});
|
|
33
37
|
}
|
|
@@ -5,12 +5,14 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
6
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
import "./index.compiled.css";
|
|
8
9
|
import { ax, ix } from "@compiled/react/runtime";
|
|
9
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
10
11
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
12
|
import React from 'react';
|
|
12
13
|
import { injectIntl } from 'react-intl-next';
|
|
13
14
|
import { alignmentMessages as messages } from '@atlaskit/editor-common/messages';
|
|
15
|
+
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
14
16
|
import { ToolbarDropdownTriggerWrapper, ToolbarDropdownWrapper, ToolbarExpandIcon, ToolbarSeparator } from '@atlaskit/editor-common/ui';
|
|
15
17
|
import { ArrowKeyNavigationType, DropdownContainer as Dropdown, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
16
18
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -82,7 +84,9 @@ export var AlignmentToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
82
84
|
pluginState = _this$props.pluginState,
|
|
83
85
|
disabled = _this$props.disabled,
|
|
84
86
|
intl = _this$props.intl,
|
|
85
|
-
api = _this$props.api
|
|
87
|
+
api = _this$props.api,
|
|
88
|
+
toolbarType = _this$props.toolbarType,
|
|
89
|
+
toolbarSize = _this$props.toolbarSize;
|
|
86
90
|
var alignment = (_pluginState$align = pluginState === null || pluginState === void 0 ? void 0 : pluginState.align) !== null && _pluginState$align !== void 0 ? _pluginState$align : 'start';
|
|
87
91
|
var title = intl.formatMessage(messages.alignment);
|
|
88
92
|
var reducedSpacing = editorExperiment('contextual_formatting_toolbar', true) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant1', {
|
|
@@ -90,6 +94,16 @@ export var AlignmentToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
90
94
|
}) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant2', {
|
|
91
95
|
exposure: true
|
|
92
96
|
}) ? 'compact' : 'none';
|
|
97
|
+
if (toolbarType === ToolbarType.PRIMARY && toolbarSize && toolbarSize > ToolbarSize.XL && editorExperiment('platform_editor_controls', 'variant1', {
|
|
98
|
+
exposure: true
|
|
99
|
+
})) {
|
|
100
|
+
return /*#__PURE__*/React.createElement(Alignment, {
|
|
101
|
+
onClick: function onClick(align) {
|
|
102
|
+
return _this2.changeAlignment(align, false);
|
|
103
|
+
},
|
|
104
|
+
className: ax(["_ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t"])
|
|
105
|
+
});
|
|
106
|
+
}
|
|
93
107
|
return /*#__PURE__*/React.createElement(ToolbarDropdownWrapper, null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
94
108
|
mountTo: popupsMountPoint,
|
|
95
109
|
boundariesElement: popupsBoundariesElement,
|
|
@@ -157,4 +171,5 @@ export var AlignmentToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
157
171
|
}]);
|
|
158
172
|
}(React.Component);
|
|
159
173
|
_defineProperty(AlignmentToolbar, "displayName", 'AlignmentToolbar');
|
|
174
|
+
var alignmentToolbarStyles = null;
|
|
160
175
|
export default injectIntl(AlignmentToolbar);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type
|
|
2
|
+
import { ToolbarSize, type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import type { AlignmentPlugin } from '../alignmentPluginType';
|
|
5
5
|
interface PrimaryToolbarComponentProps {
|
|
@@ -10,6 +10,7 @@ interface PrimaryToolbarComponentProps {
|
|
|
10
10
|
popupsBoundariesElement?: HTMLElement;
|
|
11
11
|
popupsScrollableElement?: HTMLElement;
|
|
12
12
|
isToolbarReducedSpacing: boolean;
|
|
13
|
+
toolbarSize?: ToolbarSize;
|
|
13
14
|
}
|
|
14
|
-
export declare function PrimaryToolbarComponent({ api, editorView, disabled, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, isToolbarReducedSpacing, }: PrimaryToolbarComponentProps): React.JSX.Element;
|
|
15
|
+
export declare function PrimaryToolbarComponent({ api, editorView, disabled, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, isToolbarReducedSpacing, toolbarSize, }: PrimaryToolbarComponentProps): React.JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
7
|
-
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
7
|
+
import { ToolbarSize, type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
8
8
|
import type { AlignmentPlugin } from '../../alignmentPluginType';
|
|
9
|
-
import { type AlignmentPluginState, type AlignmentState
|
|
9
|
+
import { ToolbarType, type AlignmentPluginState, type AlignmentState } from '../../pm-plugins/types';
|
|
10
10
|
export interface State {
|
|
11
11
|
isOpen: boolean;
|
|
12
12
|
}
|
|
@@ -20,6 +20,7 @@ export interface Props {
|
|
|
20
20
|
disabled?: boolean;
|
|
21
21
|
api: ExtractInjectionAPI<AlignmentPlugin> | undefined;
|
|
22
22
|
toolbarType: ToolbarType;
|
|
23
|
+
toolbarSize?: ToolbarSize;
|
|
23
24
|
}
|
|
24
25
|
export declare class AlignmentToolbar extends React.Component<Props & WrappedComponentProps, State> {
|
|
25
26
|
static displayName: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type
|
|
2
|
+
import { ToolbarSize, type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import type { AlignmentPlugin } from '../alignmentPluginType';
|
|
5
5
|
interface PrimaryToolbarComponentProps {
|
|
@@ -10,6 +10,7 @@ interface PrimaryToolbarComponentProps {
|
|
|
10
10
|
popupsBoundariesElement?: HTMLElement;
|
|
11
11
|
popupsScrollableElement?: HTMLElement;
|
|
12
12
|
isToolbarReducedSpacing: boolean;
|
|
13
|
+
toolbarSize?: ToolbarSize;
|
|
13
14
|
}
|
|
14
|
-
export declare function PrimaryToolbarComponent({ api, editorView, disabled, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, isToolbarReducedSpacing, }: PrimaryToolbarComponentProps): React.JSX.Element;
|
|
15
|
+
export declare function PrimaryToolbarComponent({ api, editorView, disabled, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, isToolbarReducedSpacing, toolbarSize, }: PrimaryToolbarComponentProps): React.JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
7
|
-
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
7
|
+
import { ToolbarSize, type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
8
8
|
import type { AlignmentPlugin } from '../../alignmentPluginType';
|
|
9
|
-
import { type AlignmentPluginState, type AlignmentState
|
|
9
|
+
import { ToolbarType, type AlignmentPluginState, type AlignmentState } from '../../pm-plugins/types';
|
|
10
10
|
export interface State {
|
|
11
11
|
isOpen: boolean;
|
|
12
12
|
}
|
|
@@ -20,6 +20,7 @@ export interface Props {
|
|
|
20
20
|
disabled?: boolean;
|
|
21
21
|
api: ExtractInjectionAPI<AlignmentPlugin> | undefined;
|
|
22
22
|
toolbarType: ToolbarType;
|
|
23
|
+
toolbarSize?: ToolbarSize;
|
|
23
24
|
}
|
|
24
25
|
export declare class AlignmentToolbar extends React.Component<Props & WrappedComponentProps, State> {
|
|
25
26
|
static displayName: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-alignment",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Alignment plugin for @atlaskit/editor-core",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/icon": "^24.1.0",
|
|
38
38
|
"@atlaskit/platform-feature-flags": "1.1.0",
|
|
39
39
|
"@atlaskit/tmp-editor-statsig": "^3.3.0",
|
|
40
|
-
"@atlaskit/tokens": "^4.
|
|
40
|
+
"@atlaskit/tokens": "^4.3.0",
|
|
41
41
|
"@babel/runtime": "^7.0.0",
|
|
42
42
|
"@compiled/react": "^0.18.2"
|
|
43
43
|
},
|