@atlaskit/editor-plugin-text-formatting 2.2.18 → 2.3.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 +21 -0
- package/dist/cjs/textFormattingPlugin.js +4 -2
- package/dist/cjs/ui/FloatingToolbarComponent.js +1 -1
- package/dist/cjs/ui/Toolbar/constants.js +33 -18
- package/dist/cjs/ui/Toolbar/hooks/responsive-toolbar-buttons.js +35 -5
- package/dist/es2019/textFormattingPlugin.js +4 -2
- package/dist/es2019/ui/FloatingToolbarComponent.js +2 -2
- package/dist/es2019/ui/Toolbar/constants.js +69 -40
- package/dist/es2019/ui/Toolbar/hooks/responsive-toolbar-buttons.js +36 -6
- package/dist/esm/textFormattingPlugin.js +4 -2
- package/dist/esm/ui/FloatingToolbarComponent.js +2 -2
- package/dist/esm/ui/Toolbar/constants.js +32 -17
- package/dist/esm/ui/Toolbar/hooks/responsive-toolbar-buttons.js +36 -6
- package/dist/types/textFormattingPluginType.d.ts +3 -1
- package/dist/types/ui/Toolbar/constants.d.ts +28 -15
- package/dist/types/ui/Toolbar/hooks/responsive-toolbar-buttons.d.ts +3 -3
- package/dist/types-ts4.5/textFormattingPluginType.d.ts +3 -1
- package/dist/types-ts4.5/ui/Toolbar/constants.d.ts +28 -15
- package/dist/types-ts4.5/ui/Toolbar/hooks/responsive-toolbar-buttons.d.ts +3 -3
- package/package.json +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-text-formatting
|
|
2
2
|
|
|
3
|
+
## 2.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#158546](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/158546)
|
|
8
|
+
[`b7fe4e6f226f3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b7fe4e6f226f3) -
|
|
9
|
+
ED-27284 use user preferences plugin in editor preset.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 2.2.19
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#169224](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/169224)
|
|
20
|
+
[`95aee735823c6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/95aee735823c6) -
|
|
21
|
+
[ux] ED-27798: Show T icon for block type plugin toolbar, and show only bold as single button,
|
|
22
|
+
italic as dropdown in text formatting toolbar
|
|
23
|
+
|
|
3
24
|
## 2.2.18
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -8,6 +8,7 @@ exports.textFormattingPlugin = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
13
|
var _clearFormatting = require("./pm-plugins/clear-formatting");
|
|
13
14
|
var _clearFormattingKeymap = _interopRequireDefault(require("./pm-plugins/clear-formatting-keymap"));
|
|
@@ -149,8 +150,9 @@ var textFormattingPlugin = exports.textFormattingPlugin = function textFormattin
|
|
|
149
150
|
},
|
|
150
151
|
pluginsOptions: {
|
|
151
152
|
selectionToolbar: function selectionToolbar() {
|
|
152
|
-
var _api$selectionToolbar;
|
|
153
|
-
|
|
153
|
+
var _api$userPreferences, _api$selectionToolbar;
|
|
154
|
+
var toolbarDocking = (0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin') ? api === null || api === void 0 || (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 || (_api$userPreferences = _api$userPreferences.sharedState.currentState()) === null || _api$userPreferences === void 0 || (_api$userPreferences = _api$userPreferences.preferences) === null || _api$userPreferences === void 0 ? void 0 : _api$userPreferences.toolbarDockingPosition : api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking;
|
|
155
|
+
if (toolbarDocking === 'none' && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
|
|
154
156
|
exposure: true
|
|
155
157
|
})) {
|
|
156
158
|
var toolbarCustom = {
|
|
@@ -154,7 +154,7 @@ var FloatingToolbarTextFormat = function FloatingToolbarTextFormat(_ref) {
|
|
|
154
154
|
});
|
|
155
155
|
var _useIconList = (0, _useIconList2.useIconList)({
|
|
156
156
|
icons: defaultIcons,
|
|
157
|
-
iconTypeList: _constants.
|
|
157
|
+
iconTypeList: _constants.ToolbarButtonsStrong,
|
|
158
158
|
shouldUnselect: hasMultiplePartsWithFormattingSelected
|
|
159
159
|
}),
|
|
160
160
|
dropdownItems = _useIconList.dropdownItems,
|
|
@@ -4,28 +4,43 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.ToolbarButtonsStrongItalicUnderline = exports.ToolbarButtonsStrongItalic = exports.ToolbarButtonsStrong = exports.ResponsiveCustomMenuSpacious = exports.ResponsiveCustomMenuMinimal = exports.ResponsiveCustomMenuCompact = exports.ResponsiveCustomButtonToolbarSpacious = exports.ResponsiveCustomButtonToolbarMinimal = exports.ResponsiveCustomButtonToolbarCompact = exports.ButtonsMenuSpacious = exports.ButtonsMenuMinimal = exports.ButtonsMenuCompact = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _types = require("@atlaskit/editor-common/types");
|
|
10
10
|
var _types2 = require("./types");
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
11
|
+
var ToolbarButtonsStrongItalic = exports.ToolbarButtonsStrongItalic = [_types2.IconTypes.strong, _types2.IconTypes.em];
|
|
12
|
+
var ToolbarButtonsStrong = exports.ToolbarButtonsStrong = [_types2.IconTypes.strong];
|
|
13
|
+
var ToolbarButtonsStrongItalicUnderline = exports.ToolbarButtonsStrongItalicUnderline = [_types2.IconTypes.strong, _types2.IconTypes.em, _types2.IconTypes.underline];
|
|
14
|
+
var ButtonsMenuMinimal = exports.ButtonsMenuMinimal = [_types2.IconTypes.em, _types2.IconTypes.underline, _types2.IconTypes.strike, _types2.IconTypes.code, _types2.IconTypes.subscript, _types2.IconTypes.superscript];
|
|
15
|
+
var ButtonsMenuCompact = exports.ButtonsMenuCompact = [_types2.IconTypes.underline, _types2.IconTypes.strike, _types2.IconTypes.code, _types2.IconTypes.subscript, _types2.IconTypes.superscript];
|
|
16
|
+
var ButtonsMenuSpacious = exports.ButtonsMenuSpacious = [_types2.IconTypes.strike, _types2.IconTypes.code, _types2.IconTypes.subscript, _types2.IconTypes.superscript];
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomButtonToolbarNext
|
|
20
|
-
* along with references to platform_editor_controls gate
|
|
18
|
+
/**
|
|
19
|
+
* Minimal toolbar is with Bold as single button, and Italic as a dropdown button.
|
|
21
20
|
*/
|
|
22
|
-
var
|
|
23
|
-
var ResponsiveCustomButtonToolbarNext = exports.ResponsiveCustomButtonToolbarNext = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.ToolbarSize.XXL, DefaultButtonsToolbarNext), _types.ToolbarSize.XL, DefaultButtonsToolbarNext), _types.ToolbarSize.L, DefaultButtonsToolbarNext), _types.ToolbarSize.M, [_types2.IconTypes.strong, _types2.IconTypes.em]), _types.ToolbarSize.S, [_types2.IconTypes.strong, _types2.IconTypes.em]), _types.ToolbarSize.XXXS, [_types2.IconTypes.strong]);
|
|
21
|
+
var ResponsiveCustomButtonToolbarMinimal = exports.ResponsiveCustomButtonToolbarMinimal = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.ToolbarSize.XXL, ToolbarButtonsStrong), _types.ToolbarSize.XL, ToolbarButtonsStrong), _types.ToolbarSize.L, ToolbarButtonsStrong), _types.ToolbarSize.M, ToolbarButtonsStrong), _types.ToolbarSize.S, ToolbarButtonsStrong), _types.ToolbarSize.XXXS, []);
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomMenuNext
|
|
28
|
-
* along with references to platform_editor_controls gate
|
|
23
|
+
/**
|
|
24
|
+
* Compact toolbar is with Bold, Italic as single buttons, and underline as a dropdown button.
|
|
29
25
|
*/
|
|
30
|
-
var
|
|
31
|
-
|
|
26
|
+
var ResponsiveCustomButtonToolbarCompact = exports.ResponsiveCustomButtonToolbarCompact = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.ToolbarSize.XXL, ToolbarButtonsStrongItalic), _types.ToolbarSize.XL, ToolbarButtonsStrongItalic), _types.ToolbarSize.L, ToolbarButtonsStrongItalic), _types.ToolbarSize.M, ToolbarButtonsStrongItalic), _types.ToolbarSize.S, ToolbarButtonsStrongItalic), _types.ToolbarSize.XXXS, []);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Spacious toolbar is with Bold, italic, underline as single buttons, and strike as a dropdown button.
|
|
30
|
+
*/
|
|
31
|
+
var ResponsiveCustomButtonToolbarSpacious = exports.ResponsiveCustomButtonToolbarSpacious = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.ToolbarSize.XXL, ToolbarButtonsStrongItalicUnderline), _types.ToolbarSize.XL, ToolbarButtonsStrongItalicUnderline), _types.ToolbarSize.L, ToolbarButtonsStrongItalicUnderline), _types.ToolbarSize.M, ToolbarButtonsStrongItalic), _types.ToolbarSize.S, ToolbarButtonsStrongItalic), _types.ToolbarSize.XXXS, ToolbarButtonsStrong);
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Corresponding dropdown menu for the ResponsiveCustomButtonToolbarMinimal
|
|
35
|
+
*/
|
|
36
|
+
var ResponsiveCustomMenuMinimal = exports.ResponsiveCustomMenuMinimal = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.ToolbarSize.XXL, ButtonsMenuMinimal), _types.ToolbarSize.XL, ButtonsMenuMinimal), _types.ToolbarSize.L, ButtonsMenuMinimal), _types.ToolbarSize.M, ButtonsMenuMinimal), _types.ToolbarSize.S, ButtonsMenuMinimal), _types.ToolbarSize.XXXS, [_types2.IconTypes.strong, _types2.IconTypes.em].concat(ButtonsMenuMinimal));
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Corresponding dropdown menu for the ResponsiveCustomButtonToolbarCompact
|
|
40
|
+
*/
|
|
41
|
+
var ResponsiveCustomMenuCompact = exports.ResponsiveCustomMenuCompact = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.ToolbarSize.XXL, ButtonsMenuCompact), _types.ToolbarSize.XL, ButtonsMenuCompact), _types.ToolbarSize.L, ButtonsMenuCompact), _types.ToolbarSize.M, ButtonsMenuCompact), _types.ToolbarSize.S, ButtonsMenuCompact), _types.ToolbarSize.XXXS, [_types2.IconTypes.strong, _types2.IconTypes.em].concat(ButtonsMenuCompact));
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Corresponding dropdown menu for the ResponsiveCustomButtonToolbarSpacious
|
|
45
|
+
*/
|
|
46
|
+
var ResponsiveCustomMenuSpacious = exports.ResponsiveCustomMenuSpacious = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.ToolbarSize.XXL, ButtonsMenuSpacious), _types.ToolbarSize.XL, ButtonsMenuSpacious), _types.ToolbarSize.L, ButtonsMenuSpacious), _types.ToolbarSize.M, [_types2.IconTypes.underline].concat(ButtonsMenuSpacious)), _types.ToolbarSize.S, [_types2.IconTypes.underline].concat(ButtonsMenuSpacious)), _types.ToolbarSize.XXXS, [_types2.IconTypes.em, _types2.IconTypes.underline].concat(ButtonsMenuSpacious));
|
|
@@ -6,32 +6,62 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useResponsiveToolbarButtons = exports.useResponsiveIconTypeMenu = exports.useResponsiveIconTypeButtons = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
|
-
var
|
|
9
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
10
10
|
var _constants = require("../constants");
|
|
11
11
|
var _useIconList = require("./use-icon-list");
|
|
12
12
|
var useResponsiveIconTypeButtons = exports.useResponsiveIconTypeButtons = function useResponsiveIconTypeButtons(_ref) {
|
|
13
13
|
var toolbarSize = _ref.toolbarSize,
|
|
14
14
|
responsivenessEnabled = _ref.responsivenessEnabled;
|
|
15
|
-
var ResponsiveCustomButtonToolbar =
|
|
15
|
+
var ResponsiveCustomButtonToolbar = _constants.ResponsiveCustomButtonToolbarCompact;
|
|
16
|
+
if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_controls', 'cohort', 'variant1')) {
|
|
17
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_13')) {
|
|
18
|
+
ResponsiveCustomButtonToolbar = _constants.ResponsiveCustomButtonToolbarMinimal;
|
|
19
|
+
} else {
|
|
20
|
+
ResponsiveCustomButtonToolbar = !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4') ? _constants.ResponsiveCustomButtonToolbarSpacious : _constants.ResponsiveCustomButtonToolbarCompact;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
16
23
|
var iconTypeList = (0, _react.useMemo)(function () {
|
|
17
24
|
return ResponsiveCustomButtonToolbar[toolbarSize];
|
|
18
25
|
}, [toolbarSize, ResponsiveCustomButtonToolbar]);
|
|
19
26
|
if (responsivenessEnabled) {
|
|
20
27
|
return iconTypeList;
|
|
21
28
|
}
|
|
22
|
-
|
|
29
|
+
if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_controls', 'cohort', 'variant1')) {
|
|
30
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_13')) {
|
|
31
|
+
return _constants.ToolbarButtonsStrong;
|
|
32
|
+
} else {
|
|
33
|
+
return !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4') ? _constants.ToolbarButtonsStrongItalicUnderline : _constants.ToolbarButtonsStrongItalic;
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
return _constants.ToolbarButtonsStrongItalic;
|
|
37
|
+
}
|
|
23
38
|
};
|
|
24
39
|
var useResponsiveIconTypeMenu = exports.useResponsiveIconTypeMenu = function useResponsiveIconTypeMenu(_ref2) {
|
|
25
40
|
var toolbarSize = _ref2.toolbarSize,
|
|
26
41
|
responsivenessEnabled = _ref2.responsivenessEnabled;
|
|
27
|
-
var ResponsiveCustomMenu =
|
|
42
|
+
var ResponsiveCustomMenu = _constants.ResponsiveCustomMenuCompact;
|
|
43
|
+
if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_controls', 'cohort', 'variant1')) {
|
|
44
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_13')) {
|
|
45
|
+
ResponsiveCustomMenu = _constants.ResponsiveCustomMenuMinimal;
|
|
46
|
+
} else {
|
|
47
|
+
ResponsiveCustomMenu = !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4') ? _constants.ResponsiveCustomMenuSpacious : _constants.ResponsiveCustomMenuCompact;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
28
50
|
var iconTypeList = (0, _react.useMemo)(function () {
|
|
29
51
|
return ResponsiveCustomMenu[toolbarSize];
|
|
30
52
|
}, [toolbarSize, ResponsiveCustomMenu]);
|
|
31
53
|
if (responsivenessEnabled) {
|
|
32
54
|
return iconTypeList;
|
|
33
55
|
}
|
|
34
|
-
|
|
56
|
+
if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_controls', 'cohort', 'variant1')) {
|
|
57
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_13')) {
|
|
58
|
+
return _constants.ButtonsMenuMinimal;
|
|
59
|
+
} else {
|
|
60
|
+
return !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4') ? _constants.ButtonsMenuSpacious : _constants.ButtonsMenuCompact;
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
return _constants.ToolbarButtonsStrongItalic;
|
|
64
|
+
}
|
|
35
65
|
};
|
|
36
66
|
var useResponsiveToolbarButtons = exports.useResponsiveToolbarButtons = function useResponsiveToolbarButtons(_ref3) {
|
|
37
67
|
var icons = _ref3.icons,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { code, em, strike, strong, subsup, underline } from '@atlaskit/adf-schema';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
5
|
import { plugin as clearFormattingPlugin, pluginKey as clearFormattingPluginKey } from './pm-plugins/clear-formatting';
|
|
5
6
|
import clearFormattingKeymapPlugin from './pm-plugins/clear-formatting-keymap';
|
|
@@ -143,8 +144,9 @@ export const textFormattingPlugin = ({
|
|
|
143
144
|
},
|
|
144
145
|
pluginsOptions: {
|
|
145
146
|
selectionToolbar: () => {
|
|
146
|
-
var _api$selectionToolbar, _api$selectionToolbar2, _api$selectionToolbar3;
|
|
147
|
-
|
|
147
|
+
var _api$userPreferences, _api$userPreferences$, _api$userPreferences$2, _api$selectionToolbar, _api$selectionToolbar2, _api$selectionToolbar3;
|
|
148
|
+
const toolbarDocking = fg('platform_editor_use_preferences_plugin') ? api === null || api === void 0 ? void 0 : (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 ? void 0 : (_api$userPreferences$ = _api$userPreferences.sharedState.currentState()) === null || _api$userPreferences$ === void 0 ? void 0 : (_api$userPreferences$2 = _api$userPreferences$.preferences) === null || _api$userPreferences$2 === void 0 ? void 0 : _api$userPreferences$2.toolbarDockingPosition : api === null || api === void 0 ? void 0 : (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 ? void 0 : (_api$selectionToolbar2 = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar2 === void 0 ? void 0 : (_api$selectionToolbar3 = _api$selectionToolbar2.currentState()) === null || _api$selectionToolbar3 === void 0 ? void 0 : _api$selectionToolbar3.toolbarDocking;
|
|
149
|
+
if (toolbarDocking === 'none' && editorExperiment('platform_editor_controls', 'variant1', {
|
|
148
150
|
exposure: true
|
|
149
151
|
})) {
|
|
150
152
|
const toolbarCustom = {
|
|
@@ -13,7 +13,7 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
|
|
|
13
13
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
16
|
-
import {
|
|
16
|
+
import { ToolbarButtonsStrong } from './Toolbar/constants';
|
|
17
17
|
import { FormattingTextDropdownMenu } from './Toolbar/dropdown-menu';
|
|
18
18
|
import { getCommonActiveMarks, hasMultiplePartsWithFormattingInSelection } from './Toolbar/formatting-in-selection-utils';
|
|
19
19
|
import { useClearIcon } from './Toolbar/hooks/clear-formatting-icon';
|
|
@@ -155,7 +155,7 @@ const FloatingToolbarTextFormat = ({
|
|
|
155
155
|
singleItems
|
|
156
156
|
} = useIconList({
|
|
157
157
|
icons: defaultIcons,
|
|
158
|
-
iconTypeList:
|
|
158
|
+
iconTypeList: ToolbarButtonsStrong,
|
|
159
159
|
shouldUnselect: hasMultiplePartsWithFormattingSelected
|
|
160
160
|
});
|
|
161
161
|
const clearIcon = useClearIcon({
|
|
@@ -1,51 +1,80 @@
|
|
|
1
1
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { IconTypes } from './types';
|
|
3
|
-
export const
|
|
4
|
-
export const
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
7
|
-
export const
|
|
3
|
+
export const ToolbarButtonsStrongItalic = [IconTypes.strong, IconTypes.em];
|
|
4
|
+
export const ToolbarButtonsStrong = [IconTypes.strong];
|
|
5
|
+
export const ToolbarButtonsStrongItalicUnderline = [IconTypes.strong, IconTypes.em, IconTypes.underline];
|
|
6
|
+
export const ButtonsMenuMinimal = [IconTypes.em, IconTypes.underline, IconTypes.strike, IconTypes.code, IconTypes.subscript, IconTypes.superscript];
|
|
7
|
+
export const ButtonsMenuCompact = [IconTypes.underline, IconTypes.strike, IconTypes.code, IconTypes.subscript, IconTypes.superscript];
|
|
8
|
+
export const ButtonsMenuSpacious = [IconTypes.strike, IconTypes.code, IconTypes.subscript, IconTypes.superscript];
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomButtonToolbarNext
|
|
12
|
-
* along with references to platform_editor_controls gate
|
|
10
|
+
/**
|
|
11
|
+
* Minimal toolbar is with Bold as single button, and Italic as a dropdown button.
|
|
13
12
|
*/
|
|
14
|
-
export const
|
|
15
|
-
[ToolbarSize.XXL]:
|
|
16
|
-
[ToolbarSize.XL]:
|
|
17
|
-
[ToolbarSize.L]:
|
|
18
|
-
[ToolbarSize.M]:
|
|
19
|
-
[ToolbarSize.S]:
|
|
13
|
+
export const ResponsiveCustomButtonToolbarMinimal = {
|
|
14
|
+
[ToolbarSize.XXL]: ToolbarButtonsStrong,
|
|
15
|
+
[ToolbarSize.XL]: ToolbarButtonsStrong,
|
|
16
|
+
[ToolbarSize.L]: ToolbarButtonsStrong,
|
|
17
|
+
[ToolbarSize.M]: ToolbarButtonsStrong,
|
|
18
|
+
[ToolbarSize.S]: ToolbarButtonsStrong,
|
|
20
19
|
[ToolbarSize.XXXS]: []
|
|
21
20
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
[ToolbarSize.
|
|
28
|
-
[ToolbarSize.
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Compact toolbar is with Bold, Italic as single buttons, and underline as a dropdown button.
|
|
24
|
+
*/
|
|
25
|
+
export const ResponsiveCustomButtonToolbarCompact = {
|
|
26
|
+
[ToolbarSize.XXL]: ToolbarButtonsStrongItalic,
|
|
27
|
+
[ToolbarSize.XL]: ToolbarButtonsStrongItalic,
|
|
28
|
+
[ToolbarSize.L]: ToolbarButtonsStrongItalic,
|
|
29
|
+
[ToolbarSize.M]: ToolbarButtonsStrongItalic,
|
|
30
|
+
[ToolbarSize.S]: ToolbarButtonsStrongItalic,
|
|
31
|
+
[ToolbarSize.XXXS]: []
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Spacious toolbar is with Bold, italic, underline as single buttons, and strike as a dropdown button.
|
|
36
|
+
*/
|
|
37
|
+
export const ResponsiveCustomButtonToolbarSpacious = {
|
|
38
|
+
[ToolbarSize.XXL]: ToolbarButtonsStrongItalicUnderline,
|
|
39
|
+
[ToolbarSize.XL]: ToolbarButtonsStrongItalicUnderline,
|
|
40
|
+
[ToolbarSize.L]: ToolbarButtonsStrongItalicUnderline,
|
|
41
|
+
[ToolbarSize.M]: ToolbarButtonsStrongItalic,
|
|
42
|
+
[ToolbarSize.S]: ToolbarButtonsStrongItalic,
|
|
43
|
+
[ToolbarSize.XXXS]: ToolbarButtonsStrong
|
|
29
44
|
};
|
|
30
45
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomMenuNext
|
|
34
|
-
* along with references to platform_editor_controls gate
|
|
46
|
+
/**
|
|
47
|
+
* Corresponding dropdown menu for the ResponsiveCustomButtonToolbarMinimal
|
|
35
48
|
*/
|
|
36
|
-
export const
|
|
37
|
-
[ToolbarSize.XXL]:
|
|
38
|
-
[ToolbarSize.XL]:
|
|
39
|
-
[ToolbarSize.L]:
|
|
40
|
-
[ToolbarSize.M]:
|
|
41
|
-
[ToolbarSize.S]:
|
|
42
|
-
[ToolbarSize.XXXS]: [IconTypes.strong, IconTypes.em, ...
|
|
49
|
+
export const ResponsiveCustomMenuMinimal = {
|
|
50
|
+
[ToolbarSize.XXL]: ButtonsMenuMinimal,
|
|
51
|
+
[ToolbarSize.XL]: ButtonsMenuMinimal,
|
|
52
|
+
[ToolbarSize.L]: ButtonsMenuMinimal,
|
|
53
|
+
[ToolbarSize.M]: ButtonsMenuMinimal,
|
|
54
|
+
[ToolbarSize.S]: ButtonsMenuMinimal,
|
|
55
|
+
[ToolbarSize.XXXS]: [IconTypes.strong, IconTypes.em, ...ButtonsMenuMinimal]
|
|
43
56
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
[ToolbarSize.
|
|
50
|
-
[ToolbarSize.
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Corresponding dropdown menu for the ResponsiveCustomButtonToolbarCompact
|
|
60
|
+
*/
|
|
61
|
+
export const ResponsiveCustomMenuCompact = {
|
|
62
|
+
[ToolbarSize.XXL]: ButtonsMenuCompact,
|
|
63
|
+
[ToolbarSize.XL]: ButtonsMenuCompact,
|
|
64
|
+
[ToolbarSize.L]: ButtonsMenuCompact,
|
|
65
|
+
[ToolbarSize.M]: ButtonsMenuCompact,
|
|
66
|
+
[ToolbarSize.S]: ButtonsMenuCompact,
|
|
67
|
+
[ToolbarSize.XXXS]: [IconTypes.strong, IconTypes.em, ...ButtonsMenuCompact]
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Corresponding dropdown menu for the ResponsiveCustomButtonToolbarSpacious
|
|
72
|
+
*/
|
|
73
|
+
export const ResponsiveCustomMenuSpacious = {
|
|
74
|
+
[ToolbarSize.XXL]: ButtonsMenuSpacious,
|
|
75
|
+
[ToolbarSize.XL]: ButtonsMenuSpacious,
|
|
76
|
+
[ToolbarSize.L]: ButtonsMenuSpacious,
|
|
77
|
+
[ToolbarSize.M]: [IconTypes.underline, ...ButtonsMenuSpacious],
|
|
78
|
+
[ToolbarSize.S]: [IconTypes.underline, ...ButtonsMenuSpacious],
|
|
79
|
+
[ToolbarSize.XXXS]: [IconTypes.em, IconTypes.underline, ...ButtonsMenuSpacious]
|
|
51
80
|
};
|
|
@@ -1,29 +1,59 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
4
|
+
import { ButtonsMenuMinimal, ButtonsMenuCompact, ButtonsMenuSpacious, ToolbarButtonsStrong, ToolbarButtonsStrongItalic, ToolbarButtonsStrongItalicUnderline, ResponsiveCustomButtonToolbarMinimal, ResponsiveCustomButtonToolbarCompact, ResponsiveCustomButtonToolbarSpacious, ResponsiveCustomMenuMinimal, ResponsiveCustomMenuCompact, ResponsiveCustomMenuSpacious } from '../constants';
|
|
5
5
|
import { useIconList } from './use-icon-list';
|
|
6
6
|
export const useResponsiveIconTypeButtons = ({
|
|
7
7
|
toolbarSize,
|
|
8
8
|
responsivenessEnabled
|
|
9
9
|
}) => {
|
|
10
|
-
|
|
10
|
+
let ResponsiveCustomButtonToolbar = ResponsiveCustomButtonToolbarCompact;
|
|
11
|
+
if (expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1')) {
|
|
12
|
+
if (fg('platform_editor_controls_patch_13')) {
|
|
13
|
+
ResponsiveCustomButtonToolbar = ResponsiveCustomButtonToolbarMinimal;
|
|
14
|
+
} else {
|
|
15
|
+
ResponsiveCustomButtonToolbar = !fg('platform_editor_controls_patch_4') ? ResponsiveCustomButtonToolbarSpacious : ResponsiveCustomButtonToolbarCompact;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
11
18
|
const iconTypeList = useMemo(() => ResponsiveCustomButtonToolbar[toolbarSize], [toolbarSize, ResponsiveCustomButtonToolbar]);
|
|
12
19
|
if (responsivenessEnabled) {
|
|
13
20
|
return iconTypeList;
|
|
14
21
|
}
|
|
15
|
-
|
|
22
|
+
if (expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1')) {
|
|
23
|
+
if (fg('platform_editor_controls_patch_13')) {
|
|
24
|
+
return ToolbarButtonsStrong;
|
|
25
|
+
} else {
|
|
26
|
+
return !fg('platform_editor_controls_patch_4') ? ToolbarButtonsStrongItalicUnderline : ToolbarButtonsStrongItalic;
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
return ToolbarButtonsStrongItalic;
|
|
30
|
+
}
|
|
16
31
|
};
|
|
17
32
|
export const useResponsiveIconTypeMenu = ({
|
|
18
33
|
toolbarSize,
|
|
19
34
|
responsivenessEnabled
|
|
20
35
|
}) => {
|
|
21
|
-
|
|
36
|
+
let ResponsiveCustomMenu = ResponsiveCustomMenuCompact;
|
|
37
|
+
if (expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1')) {
|
|
38
|
+
if (fg('platform_editor_controls_patch_13')) {
|
|
39
|
+
ResponsiveCustomMenu = ResponsiveCustomMenuMinimal;
|
|
40
|
+
} else {
|
|
41
|
+
ResponsiveCustomMenu = !fg('platform_editor_controls_patch_4') ? ResponsiveCustomMenuSpacious : ResponsiveCustomMenuCompact;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
22
44
|
const iconTypeList = useMemo(() => ResponsiveCustomMenu[toolbarSize], [toolbarSize, ResponsiveCustomMenu]);
|
|
23
45
|
if (responsivenessEnabled) {
|
|
24
46
|
return iconTypeList;
|
|
25
47
|
}
|
|
26
|
-
|
|
48
|
+
if (expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1')) {
|
|
49
|
+
if (fg('platform_editor_controls_patch_13')) {
|
|
50
|
+
return ButtonsMenuMinimal;
|
|
51
|
+
} else {
|
|
52
|
+
return !fg('platform_editor_controls_patch_4') ? ButtonsMenuSpacious : ButtonsMenuCompact;
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
return ToolbarButtonsStrongItalic;
|
|
56
|
+
}
|
|
27
57
|
};
|
|
28
58
|
export const useResponsiveToolbarButtons = ({
|
|
29
59
|
icons,
|
|
@@ -3,6 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { code, em, strike, strong, subsup, underline } from '@atlaskit/adf-schema';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
8
|
import { plugin as clearFormattingPlugin, pluginKey as clearFormattingPluginKey } from './pm-plugins/clear-formatting';
|
|
8
9
|
import clearFormattingKeymapPlugin from './pm-plugins/clear-formatting-keymap';
|
|
@@ -143,8 +144,9 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
143
144
|
},
|
|
144
145
|
pluginsOptions: {
|
|
145
146
|
selectionToolbar: function selectionToolbar() {
|
|
146
|
-
var _api$selectionToolbar;
|
|
147
|
-
|
|
147
|
+
var _api$userPreferences, _api$selectionToolbar;
|
|
148
|
+
var toolbarDocking = fg('platform_editor_use_preferences_plugin') ? api === null || api === void 0 || (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 || (_api$userPreferences = _api$userPreferences.sharedState.currentState()) === null || _api$userPreferences === void 0 || (_api$userPreferences = _api$userPreferences.preferences) === null || _api$userPreferences === void 0 ? void 0 : _api$userPreferences.toolbarDockingPosition : api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking;
|
|
149
|
+
if (toolbarDocking === 'none' && editorExperiment('platform_editor_controls', 'variant1', {
|
|
148
150
|
exposure: true
|
|
149
151
|
})) {
|
|
150
152
|
var toolbarCustom = {
|
|
@@ -15,7 +15,7 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
|
|
|
15
15
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
16
16
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
17
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
18
|
-
import {
|
|
18
|
+
import { ToolbarButtonsStrong } from './Toolbar/constants';
|
|
19
19
|
import { FormattingTextDropdownMenu } from './Toolbar/dropdown-menu';
|
|
20
20
|
import { getCommonActiveMarks, hasMultiplePartsWithFormattingInSelection } from './Toolbar/formatting-in-selection-utils';
|
|
21
21
|
import { useClearIcon } from './Toolbar/hooks/clear-formatting-icon';
|
|
@@ -146,7 +146,7 @@ var FloatingToolbarTextFormat = function FloatingToolbarTextFormat(_ref) {
|
|
|
146
146
|
});
|
|
147
147
|
var _useIconList = useIconList({
|
|
148
148
|
icons: defaultIcons,
|
|
149
|
-
iconTypeList:
|
|
149
|
+
iconTypeList: ToolbarButtonsStrong,
|
|
150
150
|
shouldUnselect: hasMultiplePartsWithFormattingSelected
|
|
151
151
|
}),
|
|
152
152
|
dropdownItems = _useIconList.dropdownItems,
|
|
@@ -1,24 +1,39 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
3
3
|
import { IconTypes } from './types';
|
|
4
|
-
export var
|
|
5
|
-
export var
|
|
6
|
-
export var
|
|
7
|
-
export var
|
|
8
|
-
export var
|
|
4
|
+
export var ToolbarButtonsStrongItalic = [IconTypes.strong, IconTypes.em];
|
|
5
|
+
export var ToolbarButtonsStrong = [IconTypes.strong];
|
|
6
|
+
export var ToolbarButtonsStrongItalicUnderline = [IconTypes.strong, IconTypes.em, IconTypes.underline];
|
|
7
|
+
export var ButtonsMenuMinimal = [IconTypes.em, IconTypes.underline, IconTypes.strike, IconTypes.code, IconTypes.subscript, IconTypes.superscript];
|
|
8
|
+
export var ButtonsMenuCompact = [IconTypes.underline, IconTypes.strike, IconTypes.code, IconTypes.subscript, IconTypes.superscript];
|
|
9
|
+
export var ButtonsMenuSpacious = [IconTypes.strike, IconTypes.code, IconTypes.subscript, IconTypes.superscript];
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomButtonToolbarNext
|
|
13
|
-
* along with references to platform_editor_controls gate
|
|
11
|
+
/**
|
|
12
|
+
* Minimal toolbar is with Bold as single button, and Italic as a dropdown button.
|
|
14
13
|
*/
|
|
15
|
-
export var
|
|
16
|
-
export var ResponsiveCustomButtonToolbarNext = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, DefaultButtonsToolbarNext), ToolbarSize.XL, DefaultButtonsToolbarNext), ToolbarSize.L, DefaultButtonsToolbarNext), ToolbarSize.M, [IconTypes.strong, IconTypes.em]), ToolbarSize.S, [IconTypes.strong, IconTypes.em]), ToolbarSize.XXXS, [IconTypes.strong]);
|
|
14
|
+
export var ResponsiveCustomButtonToolbarMinimal = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, ToolbarButtonsStrong), ToolbarSize.XL, ToolbarButtonsStrong), ToolbarSize.L, ToolbarButtonsStrong), ToolbarSize.M, ToolbarButtonsStrong), ToolbarSize.S, ToolbarButtonsStrong), ToolbarSize.XXXS, []);
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomMenuNext
|
|
21
|
-
* along with references to platform_editor_controls gate
|
|
16
|
+
/**
|
|
17
|
+
* Compact toolbar is with Bold, Italic as single buttons, and underline as a dropdown button.
|
|
22
18
|
*/
|
|
23
|
-
export var
|
|
24
|
-
|
|
19
|
+
export var ResponsiveCustomButtonToolbarCompact = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, ToolbarButtonsStrongItalic), ToolbarSize.XL, ToolbarButtonsStrongItalic), ToolbarSize.L, ToolbarButtonsStrongItalic), ToolbarSize.M, ToolbarButtonsStrongItalic), ToolbarSize.S, ToolbarButtonsStrongItalic), ToolbarSize.XXXS, []);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Spacious toolbar is with Bold, italic, underline as single buttons, and strike as a dropdown button.
|
|
23
|
+
*/
|
|
24
|
+
export var ResponsiveCustomButtonToolbarSpacious = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, ToolbarButtonsStrongItalicUnderline), ToolbarSize.XL, ToolbarButtonsStrongItalicUnderline), ToolbarSize.L, ToolbarButtonsStrongItalicUnderline), ToolbarSize.M, ToolbarButtonsStrongItalic), ToolbarSize.S, ToolbarButtonsStrongItalic), ToolbarSize.XXXS, ToolbarButtonsStrong);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Corresponding dropdown menu for the ResponsiveCustomButtonToolbarMinimal
|
|
28
|
+
*/
|
|
29
|
+
export var ResponsiveCustomMenuMinimal = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, ButtonsMenuMinimal), ToolbarSize.XL, ButtonsMenuMinimal), ToolbarSize.L, ButtonsMenuMinimal), ToolbarSize.M, ButtonsMenuMinimal), ToolbarSize.S, ButtonsMenuMinimal), ToolbarSize.XXXS, [IconTypes.strong, IconTypes.em].concat(ButtonsMenuMinimal));
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Corresponding dropdown menu for the ResponsiveCustomButtonToolbarCompact
|
|
33
|
+
*/
|
|
34
|
+
export var ResponsiveCustomMenuCompact = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, ButtonsMenuCompact), ToolbarSize.XL, ButtonsMenuCompact), ToolbarSize.L, ButtonsMenuCompact), ToolbarSize.M, ButtonsMenuCompact), ToolbarSize.S, ButtonsMenuCompact), ToolbarSize.XXXS, [IconTypes.strong, IconTypes.em].concat(ButtonsMenuCompact));
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Corresponding dropdown menu for the ResponsiveCustomButtonToolbarSpacious
|
|
38
|
+
*/
|
|
39
|
+
export var ResponsiveCustomMenuSpacious = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, ButtonsMenuSpacious), ToolbarSize.XL, ButtonsMenuSpacious), ToolbarSize.L, ButtonsMenuSpacious), ToolbarSize.M, [IconTypes.underline].concat(ButtonsMenuSpacious)), ToolbarSize.S, [IconTypes.underline].concat(ButtonsMenuSpacious)), ToolbarSize.XXXS, [IconTypes.em, IconTypes.underline].concat(ButtonsMenuSpacious));
|
|
@@ -1,31 +1,61 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
4
|
+
import { ButtonsMenuMinimal, ButtonsMenuCompact, ButtonsMenuSpacious, ToolbarButtonsStrong, ToolbarButtonsStrongItalic, ToolbarButtonsStrongItalicUnderline, ResponsiveCustomButtonToolbarMinimal, ResponsiveCustomButtonToolbarCompact, ResponsiveCustomButtonToolbarSpacious, ResponsiveCustomMenuMinimal, ResponsiveCustomMenuCompact, ResponsiveCustomMenuSpacious } from '../constants';
|
|
5
5
|
import { useIconList } from './use-icon-list';
|
|
6
6
|
export var useResponsiveIconTypeButtons = function useResponsiveIconTypeButtons(_ref) {
|
|
7
7
|
var toolbarSize = _ref.toolbarSize,
|
|
8
8
|
responsivenessEnabled = _ref.responsivenessEnabled;
|
|
9
|
-
var ResponsiveCustomButtonToolbar =
|
|
9
|
+
var ResponsiveCustomButtonToolbar = ResponsiveCustomButtonToolbarCompact;
|
|
10
|
+
if (expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1')) {
|
|
11
|
+
if (fg('platform_editor_controls_patch_13')) {
|
|
12
|
+
ResponsiveCustomButtonToolbar = ResponsiveCustomButtonToolbarMinimal;
|
|
13
|
+
} else {
|
|
14
|
+
ResponsiveCustomButtonToolbar = !fg('platform_editor_controls_patch_4') ? ResponsiveCustomButtonToolbarSpacious : ResponsiveCustomButtonToolbarCompact;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
10
17
|
var iconTypeList = useMemo(function () {
|
|
11
18
|
return ResponsiveCustomButtonToolbar[toolbarSize];
|
|
12
19
|
}, [toolbarSize, ResponsiveCustomButtonToolbar]);
|
|
13
20
|
if (responsivenessEnabled) {
|
|
14
21
|
return iconTypeList;
|
|
15
22
|
}
|
|
16
|
-
|
|
23
|
+
if (expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1')) {
|
|
24
|
+
if (fg('platform_editor_controls_patch_13')) {
|
|
25
|
+
return ToolbarButtonsStrong;
|
|
26
|
+
} else {
|
|
27
|
+
return !fg('platform_editor_controls_patch_4') ? ToolbarButtonsStrongItalicUnderline : ToolbarButtonsStrongItalic;
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
return ToolbarButtonsStrongItalic;
|
|
31
|
+
}
|
|
17
32
|
};
|
|
18
33
|
export var useResponsiveIconTypeMenu = function useResponsiveIconTypeMenu(_ref2) {
|
|
19
34
|
var toolbarSize = _ref2.toolbarSize,
|
|
20
35
|
responsivenessEnabled = _ref2.responsivenessEnabled;
|
|
21
|
-
var ResponsiveCustomMenu =
|
|
36
|
+
var ResponsiveCustomMenu = ResponsiveCustomMenuCompact;
|
|
37
|
+
if (expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1')) {
|
|
38
|
+
if (fg('platform_editor_controls_patch_13')) {
|
|
39
|
+
ResponsiveCustomMenu = ResponsiveCustomMenuMinimal;
|
|
40
|
+
} else {
|
|
41
|
+
ResponsiveCustomMenu = !fg('platform_editor_controls_patch_4') ? ResponsiveCustomMenuSpacious : ResponsiveCustomMenuCompact;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
22
44
|
var iconTypeList = useMemo(function () {
|
|
23
45
|
return ResponsiveCustomMenu[toolbarSize];
|
|
24
46
|
}, [toolbarSize, ResponsiveCustomMenu]);
|
|
25
47
|
if (responsivenessEnabled) {
|
|
26
48
|
return iconTypeList;
|
|
27
49
|
}
|
|
28
|
-
|
|
50
|
+
if (expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1')) {
|
|
51
|
+
if (fg('platform_editor_controls_patch_13')) {
|
|
52
|
+
return ButtonsMenuMinimal;
|
|
53
|
+
} else {
|
|
54
|
+
return !fg('platform_editor_controls_patch_4') ? ButtonsMenuSpacious : ButtonsMenuCompact;
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
return ToolbarButtonsStrongItalic;
|
|
58
|
+
}
|
|
29
59
|
};
|
|
30
60
|
export var useResponsiveToolbarButtons = function useResponsiveToolbarButtons(_ref3) {
|
|
31
61
|
var icons = _ref3.icons,
|
|
@@ -3,6 +3,7 @@ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
3
3
|
import type { BasePlugin } from '@atlaskit/editor-plugin-base';
|
|
4
4
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
5
5
|
import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
|
|
6
|
+
import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
|
|
6
7
|
import type { ToggleMarkEditorCommand } from './pm-plugins/commands';
|
|
7
8
|
export type TextFormattingPluginOptions = CommonTextFormattingOptions;
|
|
8
9
|
export type TextFormattingPlugin = NextEditorPlugin<'textFormatting', {
|
|
@@ -11,7 +12,8 @@ export type TextFormattingPlugin = NextEditorPlugin<'textFormatting', {
|
|
|
11
12
|
OptionalPlugin<AnalyticsPlugin>,
|
|
12
13
|
OptionalPlugin<PrimaryToolbarPlugin>,
|
|
13
14
|
OptionalPlugin<BasePlugin>,
|
|
14
|
-
OptionalPlugin<SelectionToolbarPlugin
|
|
15
|
+
OptionalPlugin<SelectionToolbarPlugin>,
|
|
16
|
+
OptionalPlugin<UserPreferencesPlugin>
|
|
15
17
|
];
|
|
16
18
|
commands: {
|
|
17
19
|
toggleSuperscript: ToggleMarkEditorCommand;
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { IconTypes } from './types';
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
3
|
+
export declare const ToolbarButtonsStrongItalic: IconTypes[];
|
|
4
|
+
export declare const ToolbarButtonsStrong: IconTypes[];
|
|
5
|
+
export declare const ToolbarButtonsStrongItalicUnderline: IconTypes[];
|
|
6
|
+
export declare const ButtonsMenuMinimal: IconTypes[];
|
|
7
|
+
export declare const ButtonsMenuCompact: IconTypes[];
|
|
8
|
+
export declare const ButtonsMenuSpacious: IconTypes[];
|
|
9
|
+
/**
|
|
10
|
+
* Minimal toolbar is with Bold as single button, and Italic as a dropdown button.
|
|
11
11
|
*/
|
|
12
|
-
export declare const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomMenuNext
|
|
16
|
-
* along with references to platform_editor_controls gate
|
|
12
|
+
export declare const ResponsiveCustomButtonToolbarMinimal: Record<ToolbarSize, IconTypes[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Compact toolbar is with Bold, Italic as single buttons, and underline as a dropdown button.
|
|
17
15
|
*/
|
|
18
|
-
export declare const
|
|
19
|
-
|
|
16
|
+
export declare const ResponsiveCustomButtonToolbarCompact: Record<ToolbarSize, IconTypes[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Spacious toolbar is with Bold, italic, underline as single buttons, and strike as a dropdown button.
|
|
19
|
+
*/
|
|
20
|
+
export declare const ResponsiveCustomButtonToolbarSpacious: Record<ToolbarSize, IconTypes[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Corresponding dropdown menu for the ResponsiveCustomButtonToolbarMinimal
|
|
23
|
+
*/
|
|
24
|
+
export declare const ResponsiveCustomMenuMinimal: Record<ToolbarSize, IconTypes[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Corresponding dropdown menu for the ResponsiveCustomButtonToolbarCompact
|
|
27
|
+
*/
|
|
28
|
+
export declare const ResponsiveCustomMenuCompact: Record<ToolbarSize, IconTypes[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Corresponding dropdown menu for the ResponsiveCustomButtonToolbarSpacious
|
|
31
|
+
*/
|
|
32
|
+
export declare const ResponsiveCustomMenuSpacious: Record<ToolbarSize, IconTypes[]>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { MenuIconItem } from '../types';
|
|
2
|
+
import type { IconTypes, MenuIconItem } from '../types';
|
|
3
3
|
import { type IconsPositions } from './use-icon-list';
|
|
4
4
|
export declare const useResponsiveIconTypeButtons: ({ toolbarSize, responsivenessEnabled, }: {
|
|
5
5
|
toolbarSize: ToolbarSize;
|
|
6
6
|
responsivenessEnabled: boolean;
|
|
7
|
-
}) =>
|
|
7
|
+
}) => IconTypes[];
|
|
8
8
|
export declare const useResponsiveIconTypeMenu: ({ toolbarSize, responsivenessEnabled, }: {
|
|
9
9
|
toolbarSize: ToolbarSize;
|
|
10
10
|
responsivenessEnabled: boolean;
|
|
11
|
-
}) =>
|
|
11
|
+
}) => IconTypes[];
|
|
12
12
|
export declare const useResponsiveToolbarButtons: ({ icons, toolbarSize, responsivenessEnabled, }: {
|
|
13
13
|
responsivenessEnabled: boolean;
|
|
14
14
|
toolbarSize: ToolbarSize;
|
|
@@ -3,6 +3,7 @@ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
3
3
|
import type { BasePlugin } from '@atlaskit/editor-plugin-base';
|
|
4
4
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
5
5
|
import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
|
|
6
|
+
import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
|
|
6
7
|
import type { ToggleMarkEditorCommand } from './pm-plugins/commands';
|
|
7
8
|
export type TextFormattingPluginOptions = CommonTextFormattingOptions;
|
|
8
9
|
export type TextFormattingPlugin = NextEditorPlugin<'textFormatting', {
|
|
@@ -11,7 +12,8 @@ export type TextFormattingPlugin = NextEditorPlugin<'textFormatting', {
|
|
|
11
12
|
OptionalPlugin<AnalyticsPlugin>,
|
|
12
13
|
OptionalPlugin<PrimaryToolbarPlugin>,
|
|
13
14
|
OptionalPlugin<BasePlugin>,
|
|
14
|
-
OptionalPlugin<SelectionToolbarPlugin
|
|
15
|
+
OptionalPlugin<SelectionToolbarPlugin>,
|
|
16
|
+
OptionalPlugin<UserPreferencesPlugin>
|
|
15
17
|
];
|
|
16
18
|
commands: {
|
|
17
19
|
toggleSuperscript: ToggleMarkEditorCommand;
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { IconTypes } from './types';
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
3
|
+
export declare const ToolbarButtonsStrongItalic: IconTypes[];
|
|
4
|
+
export declare const ToolbarButtonsStrong: IconTypes[];
|
|
5
|
+
export declare const ToolbarButtonsStrongItalicUnderline: IconTypes[];
|
|
6
|
+
export declare const ButtonsMenuMinimal: IconTypes[];
|
|
7
|
+
export declare const ButtonsMenuCompact: IconTypes[];
|
|
8
|
+
export declare const ButtonsMenuSpacious: IconTypes[];
|
|
9
|
+
/**
|
|
10
|
+
* Minimal toolbar is with Bold as single button, and Italic as a dropdown button.
|
|
11
11
|
*/
|
|
12
|
-
export declare const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomMenuNext
|
|
16
|
-
* along with references to platform_editor_controls gate
|
|
12
|
+
export declare const ResponsiveCustomButtonToolbarMinimal: Record<ToolbarSize, IconTypes[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Compact toolbar is with Bold, Italic as single buttons, and underline as a dropdown button.
|
|
17
15
|
*/
|
|
18
|
-
export declare const
|
|
19
|
-
|
|
16
|
+
export declare const ResponsiveCustomButtonToolbarCompact: Record<ToolbarSize, IconTypes[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Spacious toolbar is with Bold, italic, underline as single buttons, and strike as a dropdown button.
|
|
19
|
+
*/
|
|
20
|
+
export declare const ResponsiveCustomButtonToolbarSpacious: Record<ToolbarSize, IconTypes[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Corresponding dropdown menu for the ResponsiveCustomButtonToolbarMinimal
|
|
23
|
+
*/
|
|
24
|
+
export declare const ResponsiveCustomMenuMinimal: Record<ToolbarSize, IconTypes[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Corresponding dropdown menu for the ResponsiveCustomButtonToolbarCompact
|
|
27
|
+
*/
|
|
28
|
+
export declare const ResponsiveCustomMenuCompact: Record<ToolbarSize, IconTypes[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Corresponding dropdown menu for the ResponsiveCustomButtonToolbarSpacious
|
|
31
|
+
*/
|
|
32
|
+
export declare const ResponsiveCustomMenuSpacious: Record<ToolbarSize, IconTypes[]>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { MenuIconItem } from '../types';
|
|
2
|
+
import type { IconTypes, MenuIconItem } from '../types';
|
|
3
3
|
import { type IconsPositions } from './use-icon-list';
|
|
4
4
|
export declare const useResponsiveIconTypeButtons: ({ toolbarSize, responsivenessEnabled, }: {
|
|
5
5
|
toolbarSize: ToolbarSize;
|
|
6
6
|
responsivenessEnabled: boolean;
|
|
7
|
-
}) =>
|
|
7
|
+
}) => IconTypes[];
|
|
8
8
|
export declare const useResponsiveIconTypeMenu: ({ toolbarSize, responsivenessEnabled, }: {
|
|
9
9
|
toolbarSize: ToolbarSize;
|
|
10
10
|
responsivenessEnabled: boolean;
|
|
11
|
-
}) =>
|
|
11
|
+
}) => IconTypes[];
|
|
12
12
|
export declare const useResponsiveToolbarButtons: ({ icons, toolbarSize, responsivenessEnabled, }: {
|
|
13
13
|
responsivenessEnabled: boolean;
|
|
14
14
|
toolbarSize: ToolbarSize;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-text-formatting",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Text-formatting plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
37
|
-
"@atlaskit/editor-common": "^106.
|
|
37
|
+
"@atlaskit/editor-common": "^106.7.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
39
39
|
"@atlaskit/editor-plugin-base": "^3.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
|
|
41
|
-
"@atlaskit/editor-plugin-selection-toolbar": "^3.
|
|
41
|
+
"@atlaskit/editor-plugin-selection-toolbar": "^3.7.0",
|
|
42
42
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
43
43
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
44
44
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
47
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
48
48
|
"@atlaskit/tmp-editor-statsig": "^7.0.0",
|
|
49
|
-
"@atlaskit/tokens": "^5.
|
|
49
|
+
"@atlaskit/tokens": "^5.2.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"@emotion/react": "^11.7.1",
|
|
52
52
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -116,12 +116,18 @@
|
|
|
116
116
|
"platform_editor_controls_patch_10": {
|
|
117
117
|
"type": "boolean"
|
|
118
118
|
},
|
|
119
|
+
"platform_editor_controls_patch_13": {
|
|
120
|
+
"type": "boolean"
|
|
121
|
+
},
|
|
119
122
|
"editor_inline_comments_on_inline_nodes": {
|
|
120
123
|
"type": "boolean"
|
|
121
124
|
},
|
|
122
125
|
"platform_editor_controls_patch_4": {
|
|
123
126
|
"type": "boolean"
|
|
124
127
|
},
|
|
128
|
+
"platform_editor_use_preferences_plugin": {
|
|
129
|
+
"type": "boolean"
|
|
130
|
+
},
|
|
125
131
|
"platform_editor_controls_patch_7": {
|
|
126
132
|
"type": "boolean"
|
|
127
133
|
}
|