@atlaskit/editor-plugin-text-formatting 2.4.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/ui/FloatingToolbarComponent.js +1 -2
- package/dist/cjs/ui/Toolbar/dropdown-menu.js +1 -2
- package/dist/cjs/ui/Toolbar/hooks/formatting-icons.js +1 -2
- package/dist/cjs/ui/Toolbar/hooks/responsive-toolbar-buttons.js +4 -4
- package/dist/cjs/ui/Toolbar/hooks/use-icon-list.js +2 -10
- package/dist/cjs/ui/Toolbar/index.js +3 -3
- package/dist/cjs/ui/Toolbar/single-toolbar-buttons.js +2 -7
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/ui/FloatingToolbarComponent.js +1 -2
- package/dist/es2019/ui/Toolbar/dropdown-menu.js +1 -2
- package/dist/es2019/ui/Toolbar/hooks/formatting-icons.js +1 -2
- package/dist/es2019/ui/Toolbar/hooks/responsive-toolbar-buttons.js +5 -5
- package/dist/es2019/ui/Toolbar/hooks/use-icon-list.js +2 -10
- package/dist/es2019/ui/Toolbar/index.js +3 -3
- package/dist/es2019/ui/Toolbar/single-toolbar-buttons.js +2 -7
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/ui/FloatingToolbarComponent.js +1 -2
- package/dist/esm/ui/Toolbar/dropdown-menu.js +1 -2
- package/dist/esm/ui/Toolbar/hooks/formatting-icons.js +1 -2
- package/dist/esm/ui/Toolbar/hooks/responsive-toolbar-buttons.js +5 -5
- package/dist/esm/ui/Toolbar/hooks/use-icon-list.js +2 -10
- package/dist/esm/ui/Toolbar/index.js +3 -3
- package/dist/esm/ui/Toolbar/single-toolbar-buttons.js +2 -7
- package/dist/types/ui/Toolbar/dropdown-menu.d.ts +1 -1
- package/dist/types/ui/Toolbar/formatting-in-selection-utils.d.ts +1 -1
- package/dist/types/ui/Toolbar/hooks/use-icon-list.d.ts +1 -2
- package/dist/types-ts4.5/ui/Toolbar/dropdown-menu.d.ts +1 -1
- package/dist/types-ts4.5/ui/Toolbar/formatting-in-selection-utils.d.ts +1 -1
- package/dist/types-ts4.5/ui/Toolbar/hooks/use-icon-list.d.ts +1 -2
- package/package.json +12 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-text-formatting
|
|
2
2
|
|
|
3
|
+
## 3.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#181024](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/181024)
|
|
8
|
+
[`8e80c487ca307`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8e80c487ca307) - ##
|
|
9
|
+
Make `@atlaskit/editor-common` a peer dependency
|
|
10
|
+
|
|
11
|
+
**WHAT:** `@atlaskit/editor-common` has been moved from `dependencies` to `peerDependencies` in
|
|
12
|
+
all editor plugin packages.
|
|
13
|
+
|
|
14
|
+
**WHY:** This change ensures that only a single version of `@atlaskit/editor-common` is used in
|
|
15
|
+
consuming applications, preventing issues caused by multiple versions of singleton libraries (such
|
|
16
|
+
as context mismatches or duplicated state). This is especially important for packages that rely on
|
|
17
|
+
shared context or singletons.
|
|
18
|
+
|
|
19
|
+
**HOW TO ADJUST:**
|
|
20
|
+
|
|
21
|
+
- Consumers must now explicitly install `@atlaskit/editor-common` in their own project if they use
|
|
22
|
+
any of these editor plugins.
|
|
23
|
+
- Ensure the version you install matches the version required by the plugins.
|
|
24
|
+
- You can use the
|
|
25
|
+
[`check-peer-dependencies`](https://www.npmjs.com/package/check-peer-dependencies) package to
|
|
26
|
+
verify that all required peer dependencies are installed and compatible.
|
|
27
|
+
- Example install command:
|
|
28
|
+
```
|
|
29
|
+
npm install @atlaskit/editor-common
|
|
30
|
+
```
|
|
31
|
+
or
|
|
32
|
+
```
|
|
33
|
+
yarn add @atlaskit/editor-common
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Note:** This is a breaking change. If `@atlaskit/editor-common` is not installed at the
|
|
37
|
+
application level, you may see errors or unexpected behavior.
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies
|
|
42
|
+
|
|
43
|
+
## 2.4.1
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- [#173846](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/173846)
|
|
48
|
+
[`852a3c0aec64b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/852a3c0aec64b) -
|
|
49
|
+
Clean up platform_editor_controls_patch_10
|
|
50
|
+
|
|
3
51
|
## 2.4.0
|
|
4
52
|
|
|
5
53
|
### Minor Changes
|
|
@@ -155,7 +155,7 @@ var plugin = exports.plugin = function plugin(dispatch, editorAnalyticsAPI) {
|
|
|
155
155
|
return commands.moveRight()(state, dispatch);
|
|
156
156
|
} else if (event.key === _keymaps.moveLeft.common && !event.metaKey) {
|
|
157
157
|
return commands.moveLeft()(state, dispatch);
|
|
158
|
-
} else if (event.key === 'u' && event.metaKey && (_pluginKey$getState = _pluginKey.pluginKey.getState(state)) !== null && _pluginKey$getState !== void 0 && _pluginKey$getState.underlineDisabled && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
158
|
+
} else if (event.key === 'u' && event.metaKey && (_pluginKey$getState = _pluginKey.pluginKey.getState(state)) !== null && _pluginKey$getState !== void 0 && _pluginKey$getState.underlineDisabled && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
159
159
|
// This is a workaround for browser behaviour with cmd+u (in Chrome only) where the underline mark being applied around the selection
|
|
160
160
|
event.preventDefault();
|
|
161
161
|
}
|
|
@@ -154,8 +154,7 @@ var FloatingToolbarTextFormat = function FloatingToolbarTextFormat(_ref) {
|
|
|
154
154
|
});
|
|
155
155
|
var _useIconList = (0, _useIconList2.useIconList)({
|
|
156
156
|
icons: defaultIcons,
|
|
157
|
-
iconTypeList: _constants.ToolbarButtonsStrong
|
|
158
|
-
shouldUnselect: hasMultiplePartsWithFormattingSelected
|
|
157
|
+
iconTypeList: _constants.ToolbarButtonsStrong
|
|
159
158
|
}),
|
|
160
159
|
dropdownItems = _useIconList.dropdownItems,
|
|
161
160
|
singleItems = _useIconList.singleItems;
|
|
@@ -11,7 +11,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
12
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
13
13
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
14
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
14
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
15
|
var _dropdownToolbarButton = require("./dropdown-toolbar-button");
|
|
17
16
|
var _menuState = require("./hooks/menu-state");
|
|
@@ -55,7 +54,7 @@ var FormattingTextDropdownMenu = exports.FormattingTextDropdownMenu = /*#__PURE_
|
|
|
55
54
|
var activeItem = items[0].items.find(function (item) {
|
|
56
55
|
return item.isActive;
|
|
57
56
|
});
|
|
58
|
-
var defaultIcon = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
57
|
+
var defaultIcon = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (_items$0$items$ = items[0].items[0]) === null || _items$0$items$ === void 0 ? void 0 : _items$0$items$.elemBefore : undefined;
|
|
59
58
|
var defaultIconName = (_items$0$items$2 = items[0].items[0]) === null || _items$0$items$2 === void 0 ? void 0 : _items$0$items$2.value.name;
|
|
60
59
|
var iconBefore;
|
|
61
60
|
var activeIconName = defaultIconName;
|
|
@@ -18,7 +18,6 @@ var _textBoldEditorBold = _interopRequireDefault(require("@atlaskit/icon/core/mi
|
|
|
18
18
|
var _textItalicEditorItalic = _interopRequireDefault(require("@atlaskit/icon/core/migration/text-italic--editor-italic"));
|
|
19
19
|
var _textStrikethrough = _interopRequireDefault(require("@atlaskit/icon/core/text-strikethrough"));
|
|
20
20
|
var _textUnderline = _interopRequireDefault(require("@atlaskit/icon/core/text-underline"));
|
|
21
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
21
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
23
22
|
var _commands = require("../../../pm-plugins/commands");
|
|
24
23
|
var _icons = require("../icons");
|
|
@@ -191,7 +190,7 @@ var buildMenuIconState = function buildMenuIconState(iconMark, hasMultiplePartsW
|
|
|
191
190
|
hasSchemaMark: hasSchemaMark
|
|
192
191
|
};
|
|
193
192
|
}
|
|
194
|
-
var isActive = hasMultiplePartsWithFormattingSelected && !(commonActiveMarks !== null && commonActiveMarks !== void 0 && commonActiveMarks.includes(iconMark)) && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
193
|
+
var isActive = hasMultiplePartsWithFormattingSelected && !(commonActiveMarks !== null && commonActiveMarks !== void 0 && commonActiveMarks.includes(iconMark)) && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? false : textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState["".concat(iconMark, "Active")];
|
|
195
194
|
var isDisabled = textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState["".concat(iconMark, "Disabled")];
|
|
196
195
|
var isHidden = textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState["".concat(iconMark, "Hidden")];
|
|
197
196
|
return {
|
|
@@ -17,7 +17,7 @@ var useResponsiveIconTypeButtons = exports.useResponsiveIconTypeButtons = functi
|
|
|
17
17
|
if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_13')) {
|
|
18
18
|
ResponsiveCustomButtonToolbar = _constants.ResponsiveCustomButtonToolbarMinimal;
|
|
19
19
|
} else {
|
|
20
|
-
ResponsiveCustomButtonToolbar =
|
|
20
|
+
ResponsiveCustomButtonToolbar = _constants.ResponsiveCustomButtonToolbarCompact;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
var iconTypeList = (0, _react.useMemo)(function () {
|
|
@@ -30,7 +30,7 @@ var useResponsiveIconTypeButtons = exports.useResponsiveIconTypeButtons = functi
|
|
|
30
30
|
if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_13')) {
|
|
31
31
|
return _constants.ToolbarButtonsStrong;
|
|
32
32
|
} else {
|
|
33
|
-
return
|
|
33
|
+
return _constants.ToolbarButtonsStrongItalic;
|
|
34
34
|
}
|
|
35
35
|
} else {
|
|
36
36
|
return _constants.ToolbarButtonsStrongItalic;
|
|
@@ -44,7 +44,7 @@ var useResponsiveIconTypeMenu = exports.useResponsiveIconTypeMenu = function use
|
|
|
44
44
|
if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_13')) {
|
|
45
45
|
ResponsiveCustomMenu = _constants.ResponsiveCustomMenuMinimal;
|
|
46
46
|
} else {
|
|
47
|
-
ResponsiveCustomMenu =
|
|
47
|
+
ResponsiveCustomMenu = _constants.ResponsiveCustomMenuCompact;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
var iconTypeList = (0, _react.useMemo)(function () {
|
|
@@ -57,7 +57,7 @@ var useResponsiveIconTypeMenu = exports.useResponsiveIconTypeMenu = function use
|
|
|
57
57
|
if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_13')) {
|
|
58
58
|
return _constants.ButtonsMenuMinimal;
|
|
59
59
|
} else {
|
|
60
|
-
return
|
|
60
|
+
return _constants.ButtonsMenuCompact;
|
|
61
61
|
}
|
|
62
62
|
} else {
|
|
63
63
|
return _constants.ToolbarButtonsStrongItalic;
|
|
@@ -7,22 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useIconList = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
10
|
var useIconList = exports.useIconList = function useIconList(_ref) {
|
|
13
11
|
var icons = _ref.icons,
|
|
14
|
-
iconTypeList = _ref.iconTypeList
|
|
15
|
-
shouldUnselect = _ref.shouldUnselect;
|
|
12
|
+
iconTypeList = _ref.iconTypeList;
|
|
16
13
|
return (0, _react.useMemo)(function () {
|
|
17
14
|
return icons.reduce(function (acc, icon) {
|
|
18
15
|
if (!icon || !icon.iconMark) {
|
|
19
16
|
return acc;
|
|
20
17
|
}
|
|
21
|
-
if (
|
|
22
|
-
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
23
|
-
shouldUnselect && icon.isActive && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_10')) {
|
|
24
|
-
icon.isActive = false;
|
|
25
|
-
}
|
|
26
18
|
var isIconSingleButton = iconTypeList.includes(icon.iconMark);
|
|
27
19
|
if (isIconSingleButton) {
|
|
28
20
|
return {
|
|
@@ -38,5 +30,5 @@ var useIconList = exports.useIconList = function useIconList(_ref) {
|
|
|
38
30
|
dropdownItems: [],
|
|
39
31
|
singleItems: []
|
|
40
32
|
});
|
|
41
|
-
}, [icons,
|
|
33
|
+
}, [icons, iconTypeList]);
|
|
42
34
|
};
|
|
@@ -169,7 +169,7 @@ var ToolbarFormatting = function ToolbarFormatting(_ref) {
|
|
|
169
169
|
}), (0, _react2.jsx)("span", {
|
|
170
170
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage
|
|
171
171
|
css: _styles.wrapperStyle
|
|
172
|
-
}, isToolbarDisabled && !(
|
|
172
|
+
}, isToolbarDisabled && !(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _react2.jsx)("div", null, (0, _react2.jsx)(_moreButton.MoreButton, {
|
|
173
173
|
label: moreFormattingButtonLabel,
|
|
174
174
|
isReducedSpacing: isReducedSpacing,
|
|
175
175
|
isDisabled: true,
|
|
@@ -184,11 +184,11 @@ var ToolbarFormatting = function ToolbarFormatting(_ref) {
|
|
|
184
184
|
isReducedSpacing: isReducedSpacing,
|
|
185
185
|
moreButtonLabel: moreFormattingButtonLabel,
|
|
186
186
|
hasFormattingActive: hasFormattingActive,
|
|
187
|
-
hasMoreButton: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
187
|
+
hasMoreButton: !(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1'),
|
|
188
188
|
items: items,
|
|
189
189
|
intl: intl,
|
|
190
190
|
toolbarType: toolbarType,
|
|
191
|
-
isDisabled: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
191
|
+
isDisabled: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? isToolbarDisabled : false
|
|
192
192
|
}))), !(api !== null && api !== void 0 && api.primaryToolbar) && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
|
|
193
193
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
194
194
|
(0, _react2.jsx)("span", {
|
|
@@ -10,7 +10,6 @@ var _react2 = require("@emotion/react");
|
|
|
10
10
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
11
11
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
14
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
14
|
/**
|
|
16
15
|
* @jsxRuntime classic
|
|
@@ -48,15 +47,11 @@ var SingleToolbarButtons = exports.SingleToolbarButtons = /*#__PURE__*/_react.de
|
|
|
48
47
|
buttonId: item.buttonId,
|
|
49
48
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
50
49
|
onClick: onClick(item.command),
|
|
51
|
-
selected:
|
|
52
|
-
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
53
|
-
hasMultiplePartsWithFormattingSelected && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_10') ? false : item.isActive,
|
|
50
|
+
selected: item.isActive,
|
|
54
51
|
disabled: item.isDisabled,
|
|
55
52
|
title: item.tooltipElement,
|
|
56
53
|
iconBefore: item.iconElement,
|
|
57
|
-
"aria-pressed":
|
|
58
|
-
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
59
|
-
hasMultiplePartsWithFormattingSelected && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_10') ? false : item.isActive,
|
|
54
|
+
"aria-pressed": item.isActive,
|
|
60
55
|
"aria-label": (_item$ariaLabel = item['aria-label']) !== null && _item$ariaLabel !== void 0 ? _item$ariaLabel : String(item.content),
|
|
61
56
|
"aria-keyshortcuts": item['aria-keyshortcuts']
|
|
62
57
|
});
|
|
@@ -131,7 +131,7 @@ export const plugin = (dispatch, editorAnalyticsAPI) => new SafePlugin({
|
|
|
131
131
|
return commands.moveRight()(state, dispatch);
|
|
132
132
|
} else if (event.key === keymapMoveLeft.common && !event.metaKey) {
|
|
133
133
|
return commands.moveLeft()(state, dispatch);
|
|
134
|
-
} else if (event.key === 'u' && event.metaKey && (_pluginKey$getState = pluginKey.getState(state)) !== null && _pluginKey$getState !== void 0 && _pluginKey$getState.underlineDisabled && editorExperiment('platform_editor_controls', 'variant1')
|
|
134
|
+
} else if (event.key === 'u' && event.metaKey && (_pluginKey$getState = pluginKey.getState(state)) !== null && _pluginKey$getState !== void 0 && _pluginKey$getState.underlineDisabled && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
135
135
|
// This is a workaround for browser behaviour with cmd+u (in Chrome only) where the underline mark being applied around the selection
|
|
136
136
|
event.preventDefault();
|
|
137
137
|
}
|
|
@@ -155,8 +155,7 @@ const FloatingToolbarTextFormat = ({
|
|
|
155
155
|
singleItems
|
|
156
156
|
} = useIconList({
|
|
157
157
|
icons: defaultIcons,
|
|
158
|
-
iconTypeList: ToolbarButtonsStrong
|
|
159
|
-
shouldUnselect: hasMultiplePartsWithFormattingSelected
|
|
158
|
+
iconTypeList: ToolbarButtonsStrong
|
|
160
159
|
});
|
|
161
160
|
const clearIcon = useClearIcon({
|
|
162
161
|
formattingPluginInitialised: textFormattingState.isInitialised,
|
|
@@ -2,7 +2,6 @@ import React, { useCallback, useState } from 'react';
|
|
|
2
2
|
import { toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
3
3
|
import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
|
|
4
4
|
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
6
|
import { DropdownToolbarButton } from './dropdown-toolbar-button';
|
|
8
7
|
import { useMenuState } from './hooks/menu-state';
|
|
@@ -37,7 +36,7 @@ export const FormattingTextDropdownMenu = /*#__PURE__*/React.memo(({
|
|
|
37
36
|
}
|
|
38
37
|
}, [editorView.state, editorView.dispatch, closeMenu]);
|
|
39
38
|
const activeItem = items[0].items.find(item => item.isActive);
|
|
40
|
-
const defaultIcon = editorExperiment('platform_editor_controls', 'variant1')
|
|
39
|
+
const defaultIcon = editorExperiment('platform_editor_controls', 'variant1') ? (_items$0$items$ = items[0].items[0]) === null || _items$0$items$ === void 0 ? void 0 : _items$0$items$.elemBefore : undefined;
|
|
41
40
|
const defaultIconName = (_items$0$items$2 = items[0].items[0]) === null || _items$0$items$2 === void 0 ? void 0 : _items$0$items$2.value.name;
|
|
42
41
|
let iconBefore;
|
|
43
42
|
let activeIconName = defaultIconName;
|
|
@@ -16,7 +16,6 @@ import BoldIcon from '@atlaskit/icon/core/migration/text-bold--editor-bold';
|
|
|
16
16
|
import ItalicIcon from '@atlaskit/icon/core/migration/text-italic--editor-italic';
|
|
17
17
|
import TextStrikethroughIcon from '@atlaskit/icon/core/text-strikethrough';
|
|
18
18
|
import UnderlineIcon from '@atlaskit/icon/core/text-underline';
|
|
19
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
19
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
21
20
|
import { toggleCodeWithAnalytics, toggleEmWithAnalytics, toggleStrikeWithAnalytics, toggleStrongWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics, toggleUnderlineWithAnalytics } from '../../../pm-plugins/commands';
|
|
22
21
|
import { Subscript, Superscript } from '../icons';
|
|
@@ -183,7 +182,7 @@ const buildMenuIconState = (iconMark, hasMultiplePartsWithFormattingSelected, co
|
|
|
183
182
|
hasSchemaMark
|
|
184
183
|
};
|
|
185
184
|
}
|
|
186
|
-
const isActive = hasMultiplePartsWithFormattingSelected && !(commonActiveMarks !== null && commonActiveMarks !== void 0 && commonActiveMarks.includes(iconMark)) && editorExperiment('platform_editor_controls', 'variant1')
|
|
185
|
+
const isActive = hasMultiplePartsWithFormattingSelected && !(commonActiveMarks !== null && commonActiveMarks !== void 0 && commonActiveMarks.includes(iconMark)) && editorExperiment('platform_editor_controls', 'variant1') ? false : textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState[`${iconMark}Active`];
|
|
187
186
|
const isDisabled = textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState[`${iconMark}Disabled`];
|
|
188
187
|
const isHidden = textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState[`${iconMark}Hidden`];
|
|
189
188
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
4
|
-
import { ButtonsMenuMinimal, ButtonsMenuCompact,
|
|
4
|
+
import { ButtonsMenuMinimal, ButtonsMenuCompact, ToolbarButtonsStrong, ToolbarButtonsStrongItalic, ResponsiveCustomButtonToolbarMinimal, ResponsiveCustomButtonToolbarCompact, ResponsiveCustomMenuMinimal, ResponsiveCustomMenuCompact } from '../constants';
|
|
5
5
|
import { useIconList } from './use-icon-list';
|
|
6
6
|
export const useResponsiveIconTypeButtons = ({
|
|
7
7
|
toolbarSize,
|
|
@@ -12,7 +12,7 @@ export const useResponsiveIconTypeButtons = ({
|
|
|
12
12
|
if (fg('platform_editor_controls_patch_13')) {
|
|
13
13
|
ResponsiveCustomButtonToolbar = ResponsiveCustomButtonToolbarMinimal;
|
|
14
14
|
} else {
|
|
15
|
-
ResponsiveCustomButtonToolbar =
|
|
15
|
+
ResponsiveCustomButtonToolbar = ResponsiveCustomButtonToolbarCompact;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
const iconTypeList = useMemo(() => ResponsiveCustomButtonToolbar[toolbarSize], [toolbarSize, ResponsiveCustomButtonToolbar]);
|
|
@@ -23,7 +23,7 @@ export const useResponsiveIconTypeButtons = ({
|
|
|
23
23
|
if (fg('platform_editor_controls_patch_13')) {
|
|
24
24
|
return ToolbarButtonsStrong;
|
|
25
25
|
} else {
|
|
26
|
-
return
|
|
26
|
+
return ToolbarButtonsStrongItalic;
|
|
27
27
|
}
|
|
28
28
|
} else {
|
|
29
29
|
return ToolbarButtonsStrongItalic;
|
|
@@ -38,7 +38,7 @@ export const useResponsiveIconTypeMenu = ({
|
|
|
38
38
|
if (fg('platform_editor_controls_patch_13')) {
|
|
39
39
|
ResponsiveCustomMenu = ResponsiveCustomMenuMinimal;
|
|
40
40
|
} else {
|
|
41
|
-
ResponsiveCustomMenu =
|
|
41
|
+
ResponsiveCustomMenu = ResponsiveCustomMenuCompact;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
const iconTypeList = useMemo(() => ResponsiveCustomMenu[toolbarSize], [toolbarSize, ResponsiveCustomMenu]);
|
|
@@ -49,7 +49,7 @@ export const useResponsiveIconTypeMenu = ({
|
|
|
49
49
|
if (fg('platform_editor_controls_patch_13')) {
|
|
50
50
|
return ButtonsMenuMinimal;
|
|
51
51
|
} else {
|
|
52
|
-
return
|
|
52
|
+
return ButtonsMenuCompact;
|
|
53
53
|
}
|
|
54
54
|
} else {
|
|
55
55
|
return ToolbarButtonsStrongItalic;
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
2
|
export const useIconList = ({
|
|
5
3
|
icons,
|
|
6
|
-
iconTypeList
|
|
7
|
-
shouldUnselect
|
|
4
|
+
iconTypeList
|
|
8
5
|
}) => {
|
|
9
6
|
return useMemo(() => {
|
|
10
7
|
return icons.reduce((acc, icon) => {
|
|
11
8
|
if (!icon || !icon.iconMark) {
|
|
12
9
|
return acc;
|
|
13
10
|
}
|
|
14
|
-
if (
|
|
15
|
-
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
16
|
-
shouldUnselect && icon.isActive && editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_controls_patch_10')) {
|
|
17
|
-
icon.isActive = false;
|
|
18
|
-
}
|
|
19
11
|
const isIconSingleButton = iconTypeList.includes(icon.iconMark);
|
|
20
12
|
if (isIconSingleButton) {
|
|
21
13
|
return {
|
|
@@ -31,5 +23,5 @@ export const useIconList = ({
|
|
|
31
23
|
dropdownItems: [],
|
|
32
24
|
singleItems: []
|
|
33
25
|
});
|
|
34
|
-
}, [icons,
|
|
26
|
+
}, [icons, iconTypeList]);
|
|
35
27
|
};
|
|
@@ -158,7 +158,7 @@ const ToolbarFormatting = ({
|
|
|
158
158
|
}), jsx("span", {
|
|
159
159
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage
|
|
160
160
|
css: wrapperStyle
|
|
161
|
-
}, isToolbarDisabled && !
|
|
161
|
+
}, isToolbarDisabled && !editorExperiment('platform_editor_controls', 'variant1') ? jsx("div", null, jsx(MoreButton, {
|
|
162
162
|
label: moreFormattingButtonLabel,
|
|
163
163
|
isReducedSpacing: isReducedSpacing,
|
|
164
164
|
isDisabled: true,
|
|
@@ -173,11 +173,11 @@ const ToolbarFormatting = ({
|
|
|
173
173
|
isReducedSpacing: isReducedSpacing,
|
|
174
174
|
moreButtonLabel: moreFormattingButtonLabel,
|
|
175
175
|
hasFormattingActive: hasFormattingActive,
|
|
176
|
-
hasMoreButton: editorExperiment('platform_editor_controls', 'variant1')
|
|
176
|
+
hasMoreButton: !editorExperiment('platform_editor_controls', 'variant1'),
|
|
177
177
|
items: items,
|
|
178
178
|
intl: intl,
|
|
179
179
|
toolbarType: toolbarType,
|
|
180
|
-
isDisabled: editorExperiment('platform_editor_controls', 'variant1')
|
|
180
|
+
isDisabled: editorExperiment('platform_editor_controls', 'variant1') ? isToolbarDisabled : false
|
|
181
181
|
}))), !(api !== null && api !== void 0 && api.primaryToolbar) && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
|
|
182
182
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
183
183
|
jsx("span", {
|
|
@@ -9,7 +9,6 @@ import { jsx } from '@emotion/react';
|
|
|
9
9
|
import { buttonGroupStyle, buttonGroupStyleBeforeVisualRefresh } from '@atlaskit/editor-common/styles';
|
|
10
10
|
import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
12
|
export const SingleToolbarButtons = /*#__PURE__*/React.memo(({
|
|
14
13
|
items,
|
|
15
14
|
isReducedSpacing,
|
|
@@ -40,15 +39,11 @@ export const SingleToolbarButtons = /*#__PURE__*/React.memo(({
|
|
|
40
39
|
buttonId: item.buttonId,
|
|
41
40
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
42
41
|
onClick: onClick(item.command),
|
|
43
|
-
selected:
|
|
44
|
-
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
45
|
-
hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_controls_patch_10') ? false : item.isActive,
|
|
42
|
+
selected: item.isActive,
|
|
46
43
|
disabled: item.isDisabled,
|
|
47
44
|
title: item.tooltipElement,
|
|
48
45
|
iconBefore: item.iconElement,
|
|
49
|
-
"aria-pressed":
|
|
50
|
-
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
51
|
-
hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_controls_patch_10') ? false : item.isActive,
|
|
46
|
+
"aria-pressed": item.isActive,
|
|
52
47
|
"aria-label": (_item$ariaLabel = item['aria-label']) !== null && _item$ariaLabel !== void 0 ? _item$ariaLabel : String(item.content),
|
|
53
48
|
"aria-keyshortcuts": item['aria-keyshortcuts']
|
|
54
49
|
});
|
|
@@ -148,7 +148,7 @@ export var plugin = function plugin(dispatch, editorAnalyticsAPI) {
|
|
|
148
148
|
return commands.moveRight()(state, dispatch);
|
|
149
149
|
} else if (event.key === keymapMoveLeft.common && !event.metaKey) {
|
|
150
150
|
return commands.moveLeft()(state, dispatch);
|
|
151
|
-
} else if (event.key === 'u' && event.metaKey && (_pluginKey$getState = pluginKey.getState(state)) !== null && _pluginKey$getState !== void 0 && _pluginKey$getState.underlineDisabled && editorExperiment('platform_editor_controls', 'variant1')
|
|
151
|
+
} else if (event.key === 'u' && event.metaKey && (_pluginKey$getState = pluginKey.getState(state)) !== null && _pluginKey$getState !== void 0 && _pluginKey$getState.underlineDisabled && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
152
152
|
// This is a workaround for browser behaviour with cmd+u (in Chrome only) where the underline mark being applied around the selection
|
|
153
153
|
event.preventDefault();
|
|
154
154
|
}
|
|
@@ -146,8 +146,7 @@ var FloatingToolbarTextFormat = function FloatingToolbarTextFormat(_ref) {
|
|
|
146
146
|
});
|
|
147
147
|
var _useIconList = useIconList({
|
|
148
148
|
icons: defaultIcons,
|
|
149
|
-
iconTypeList: ToolbarButtonsStrong
|
|
150
|
-
shouldUnselect: hasMultiplePartsWithFormattingSelected
|
|
149
|
+
iconTypeList: ToolbarButtonsStrong
|
|
151
150
|
}),
|
|
152
151
|
dropdownItems = _useIconList.dropdownItems,
|
|
153
152
|
singleItems = _useIconList.singleItems;
|
|
@@ -3,7 +3,6 @@ import React, { useCallback, useState } from 'react';
|
|
|
3
3
|
import { toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
|
|
5
5
|
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
7
|
import { DropdownToolbarButton } from './dropdown-toolbar-button';
|
|
9
8
|
import { useMenuState } from './hooks/menu-state';
|
|
@@ -46,7 +45,7 @@ export var FormattingTextDropdownMenu = /*#__PURE__*/React.memo(function (_ref)
|
|
|
46
45
|
var activeItem = items[0].items.find(function (item) {
|
|
47
46
|
return item.isActive;
|
|
48
47
|
});
|
|
49
|
-
var defaultIcon = editorExperiment('platform_editor_controls', 'variant1')
|
|
48
|
+
var defaultIcon = editorExperiment('platform_editor_controls', 'variant1') ? (_items$0$items$ = items[0].items[0]) === null || _items$0$items$ === void 0 ? void 0 : _items$0$items$.elemBefore : undefined;
|
|
50
49
|
var defaultIconName = (_items$0$items$2 = items[0].items[0]) === null || _items$0$items$2 === void 0 ? void 0 : _items$0$items$2.value.name;
|
|
51
50
|
var iconBefore;
|
|
52
51
|
var activeIconName = defaultIconName;
|
|
@@ -17,7 +17,6 @@ import BoldIcon from '@atlaskit/icon/core/migration/text-bold--editor-bold';
|
|
|
17
17
|
import ItalicIcon from '@atlaskit/icon/core/migration/text-italic--editor-italic';
|
|
18
18
|
import TextStrikethroughIcon from '@atlaskit/icon/core/text-strikethrough';
|
|
19
19
|
import UnderlineIcon from '@atlaskit/icon/core/text-underline';
|
|
20
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
21
20
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
22
21
|
import { toggleCodeWithAnalytics, toggleEmWithAnalytics, toggleStrikeWithAnalytics, toggleStrongWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics, toggleUnderlineWithAnalytics } from '../../../pm-plugins/commands';
|
|
23
22
|
import { Subscript, Superscript } from '../icons';
|
|
@@ -183,7 +182,7 @@ var buildMenuIconState = function buildMenuIconState(iconMark, hasMultiplePartsW
|
|
|
183
182
|
hasSchemaMark: hasSchemaMark
|
|
184
183
|
};
|
|
185
184
|
}
|
|
186
|
-
var isActive = hasMultiplePartsWithFormattingSelected && !(commonActiveMarks !== null && commonActiveMarks !== void 0 && commonActiveMarks.includes(iconMark)) && editorExperiment('platform_editor_controls', 'variant1')
|
|
185
|
+
var isActive = hasMultiplePartsWithFormattingSelected && !(commonActiveMarks !== null && commonActiveMarks !== void 0 && commonActiveMarks.includes(iconMark)) && editorExperiment('platform_editor_controls', 'variant1') ? false : textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState["".concat(iconMark, "Active")];
|
|
187
186
|
var isDisabled = textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState["".concat(iconMark, "Disabled")];
|
|
188
187
|
var isHidden = textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState["".concat(iconMark, "Hidden")];
|
|
189
188
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
4
|
-
import { ButtonsMenuMinimal, ButtonsMenuCompact,
|
|
4
|
+
import { ButtonsMenuMinimal, ButtonsMenuCompact, ToolbarButtonsStrong, ToolbarButtonsStrongItalic, ResponsiveCustomButtonToolbarMinimal, ResponsiveCustomButtonToolbarCompact, ResponsiveCustomMenuMinimal, ResponsiveCustomMenuCompact } from '../constants';
|
|
5
5
|
import { useIconList } from './use-icon-list';
|
|
6
6
|
export var useResponsiveIconTypeButtons = function useResponsiveIconTypeButtons(_ref) {
|
|
7
7
|
var toolbarSize = _ref.toolbarSize,
|
|
@@ -11,7 +11,7 @@ export var useResponsiveIconTypeButtons = function useResponsiveIconTypeButtons(
|
|
|
11
11
|
if (fg('platform_editor_controls_patch_13')) {
|
|
12
12
|
ResponsiveCustomButtonToolbar = ResponsiveCustomButtonToolbarMinimal;
|
|
13
13
|
} else {
|
|
14
|
-
ResponsiveCustomButtonToolbar =
|
|
14
|
+
ResponsiveCustomButtonToolbar = ResponsiveCustomButtonToolbarCompact;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
var iconTypeList = useMemo(function () {
|
|
@@ -24,7 +24,7 @@ export var useResponsiveIconTypeButtons = function useResponsiveIconTypeButtons(
|
|
|
24
24
|
if (fg('platform_editor_controls_patch_13')) {
|
|
25
25
|
return ToolbarButtonsStrong;
|
|
26
26
|
} else {
|
|
27
|
-
return
|
|
27
|
+
return ToolbarButtonsStrongItalic;
|
|
28
28
|
}
|
|
29
29
|
} else {
|
|
30
30
|
return ToolbarButtonsStrongItalic;
|
|
@@ -38,7 +38,7 @@ export var useResponsiveIconTypeMenu = function useResponsiveIconTypeMenu(_ref2)
|
|
|
38
38
|
if (fg('platform_editor_controls_patch_13')) {
|
|
39
39
|
ResponsiveCustomMenu = ResponsiveCustomMenuMinimal;
|
|
40
40
|
} else {
|
|
41
|
-
ResponsiveCustomMenu =
|
|
41
|
+
ResponsiveCustomMenu = ResponsiveCustomMenuCompact;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
var iconTypeList = useMemo(function () {
|
|
@@ -51,7 +51,7 @@ export var useResponsiveIconTypeMenu = function useResponsiveIconTypeMenu(_ref2)
|
|
|
51
51
|
if (fg('platform_editor_controls_patch_13')) {
|
|
52
52
|
return ButtonsMenuMinimal;
|
|
53
53
|
} else {
|
|
54
|
-
return
|
|
54
|
+
return ButtonsMenuCompact;
|
|
55
55
|
}
|
|
56
56
|
} else {
|
|
57
57
|
return ToolbarButtonsStrongItalic;
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
3
|
export var useIconList = function useIconList(_ref) {
|
|
6
4
|
var icons = _ref.icons,
|
|
7
|
-
iconTypeList = _ref.iconTypeList
|
|
8
|
-
shouldUnselect = _ref.shouldUnselect;
|
|
5
|
+
iconTypeList = _ref.iconTypeList;
|
|
9
6
|
return useMemo(function () {
|
|
10
7
|
return icons.reduce(function (acc, icon) {
|
|
11
8
|
if (!icon || !icon.iconMark) {
|
|
12
9
|
return acc;
|
|
13
10
|
}
|
|
14
|
-
if (
|
|
15
|
-
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
16
|
-
shouldUnselect && icon.isActive && editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_controls_patch_10')) {
|
|
17
|
-
icon.isActive = false;
|
|
18
|
-
}
|
|
19
11
|
var isIconSingleButton = iconTypeList.includes(icon.iconMark);
|
|
20
12
|
if (isIconSingleButton) {
|
|
21
13
|
return {
|
|
@@ -31,5 +23,5 @@ export var useIconList = function useIconList(_ref) {
|
|
|
31
23
|
dropdownItems: [],
|
|
32
24
|
singleItems: []
|
|
33
25
|
});
|
|
34
|
-
}, [icons,
|
|
26
|
+
}, [icons, iconTypeList]);
|
|
35
27
|
};
|
|
@@ -163,7 +163,7 @@ var ToolbarFormatting = function ToolbarFormatting(_ref) {
|
|
|
163
163
|
}), jsx("span", {
|
|
164
164
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage
|
|
165
165
|
css: wrapperStyle
|
|
166
|
-
}, isToolbarDisabled && !
|
|
166
|
+
}, isToolbarDisabled && !editorExperiment('platform_editor_controls', 'variant1') ? jsx("div", null, jsx(MoreButton, {
|
|
167
167
|
label: moreFormattingButtonLabel,
|
|
168
168
|
isReducedSpacing: isReducedSpacing,
|
|
169
169
|
isDisabled: true,
|
|
@@ -178,11 +178,11 @@ var ToolbarFormatting = function ToolbarFormatting(_ref) {
|
|
|
178
178
|
isReducedSpacing: isReducedSpacing,
|
|
179
179
|
moreButtonLabel: moreFormattingButtonLabel,
|
|
180
180
|
hasFormattingActive: hasFormattingActive,
|
|
181
|
-
hasMoreButton: editorExperiment('platform_editor_controls', 'variant1')
|
|
181
|
+
hasMoreButton: !editorExperiment('platform_editor_controls', 'variant1'),
|
|
182
182
|
items: items,
|
|
183
183
|
intl: intl,
|
|
184
184
|
toolbarType: toolbarType,
|
|
185
|
-
isDisabled: editorExperiment('platform_editor_controls', 'variant1')
|
|
185
|
+
isDisabled: editorExperiment('platform_editor_controls', 'variant1') ? isToolbarDisabled : false
|
|
186
186
|
}))), !(api !== null && api !== void 0 && api.primaryToolbar) && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
|
|
187
187
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
188
188
|
jsx("span", {
|
|
@@ -9,7 +9,6 @@ import { jsx } from '@emotion/react';
|
|
|
9
9
|
import { buttonGroupStyle, buttonGroupStyleBeforeVisualRefresh } from '@atlaskit/editor-common/styles';
|
|
10
10
|
import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
12
|
export var SingleToolbarButtons = /*#__PURE__*/React.memo(function (_ref) {
|
|
14
13
|
var items = _ref.items,
|
|
15
14
|
isReducedSpacing = _ref.isReducedSpacing,
|
|
@@ -39,15 +38,11 @@ export var SingleToolbarButtons = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
39
38
|
buttonId: item.buttonId,
|
|
40
39
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
41
40
|
onClick: onClick(item.command),
|
|
42
|
-
selected:
|
|
43
|
-
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
44
|
-
hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_controls_patch_10') ? false : item.isActive,
|
|
41
|
+
selected: item.isActive,
|
|
45
42
|
disabled: item.isDisabled,
|
|
46
43
|
title: item.tooltipElement,
|
|
47
44
|
iconBefore: item.iconElement,
|
|
48
|
-
"aria-pressed":
|
|
49
|
-
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
50
|
-
hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_controls_patch_10') ? false : item.isActive,
|
|
45
|
+
"aria-pressed": item.isActive,
|
|
51
46
|
"aria-label": (_item$ariaLabel = item['aria-label']) !== null && _item$ariaLabel !== void 0 ? _item$ariaLabel : String(item.content),
|
|
52
47
|
"aria-keyshortcuts": item['aria-keyshortcuts']
|
|
53
48
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import { type MenuIconItem, ToolbarType } from './types';
|
|
4
|
+
import { type MenuIconItem, type ToolbarType } from './types';
|
|
5
5
|
type DropdownMenuProps = {
|
|
6
6
|
editorView: EditorView;
|
|
7
7
|
isReducedSpacing: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
1
|
+
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
export declare const hasMultiplePartsWithFormattingInSelection: ({ selectedContent, }: {
|
|
3
3
|
selectedContent?: PMNode[] | undefined;
|
|
4
4
|
}) => boolean;
|
|
@@ -2,11 +2,10 @@ import type { IconTypes, MenuIconItem } from '../types';
|
|
|
2
2
|
interface UseIconsParams {
|
|
3
3
|
icons: Array<MenuIconItem | null>;
|
|
4
4
|
iconTypeList: IconTypes[];
|
|
5
|
-
shouldUnselect?: boolean;
|
|
6
5
|
}
|
|
7
6
|
export type IconsPositions = {
|
|
8
7
|
dropdownItems: Array<MenuIconItem>;
|
|
9
8
|
singleItems: Array<MenuIconItem>;
|
|
10
9
|
};
|
|
11
|
-
export declare const useIconList: ({ icons, iconTypeList
|
|
10
|
+
export declare const useIconList: ({ icons, iconTypeList }: UseIconsParams) => IconsPositions;
|
|
12
11
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import { type MenuIconItem, ToolbarType } from './types';
|
|
4
|
+
import { type MenuIconItem, type ToolbarType } from './types';
|
|
5
5
|
type DropdownMenuProps = {
|
|
6
6
|
editorView: EditorView;
|
|
7
7
|
isReducedSpacing: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
1
|
+
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
export declare const hasMultiplePartsWithFormattingInSelection: ({ selectedContent, }: {
|
|
3
3
|
selectedContent?: PMNode[] | undefined;
|
|
4
4
|
}) => boolean;
|
|
@@ -2,11 +2,10 @@ import type { IconTypes, MenuIconItem } from '../types';
|
|
|
2
2
|
interface UseIconsParams {
|
|
3
3
|
icons: Array<MenuIconItem | null>;
|
|
4
4
|
iconTypeList: IconTypes[];
|
|
5
|
-
shouldUnselect?: boolean;
|
|
6
5
|
}
|
|
7
6
|
export type IconsPositions = {
|
|
8
7
|
dropdownItems: Array<MenuIconItem>;
|
|
9
8
|
singleItems: Array<MenuIconItem>;
|
|
10
9
|
};
|
|
11
|
-
export declare const useIconList: ({ icons, iconTypeList
|
|
10
|
+
export declare const useIconList: ({ icons, iconTypeList }: UseIconsParams) => IconsPositions;
|
|
12
11
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-text-formatting",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Text-formatting plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"atlassian": {
|
|
11
11
|
"team": "Editor: Core Experiences",
|
|
12
|
-
"singleton": true
|
|
13
|
-
"runReact18": true
|
|
12
|
+
"singleton": true
|
|
14
13
|
},
|
|
15
14
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
16
15
|
"main": "dist/cjs/index.js",
|
|
@@ -34,30 +33,30 @@
|
|
|
34
33
|
},
|
|
35
34
|
"dependencies": {
|
|
36
35
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
37
|
-
"@atlaskit/editor-
|
|
38
|
-
"@atlaskit/editor-plugin-
|
|
39
|
-
"@atlaskit/editor-plugin-
|
|
40
|
-
"@atlaskit/editor-plugin-
|
|
41
|
-
"@atlaskit/editor-plugin-selection-toolbar": "^3.7.0",
|
|
36
|
+
"@atlaskit/editor-plugin-analytics": "^3.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-base": "^4.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-primary-toolbar": "^4.0.0",
|
|
39
|
+
"@atlaskit/editor-plugin-selection-toolbar": "^4.0.0",
|
|
42
40
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
43
41
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
44
42
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
45
|
-
"@atlaskit/icon": "^27.
|
|
43
|
+
"@atlaskit/icon": "^27.2.0",
|
|
46
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
45
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^8.
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^8.7.0",
|
|
49
47
|
"@atlaskit/tokens": "^5.4.0",
|
|
50
48
|
"@babel/runtime": "^7.0.0",
|
|
51
49
|
"@emotion/react": "^11.7.1",
|
|
52
50
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
53
51
|
},
|
|
54
52
|
"peerDependencies": {
|
|
53
|
+
"@atlaskit/editor-common": "^107.6.0",
|
|
55
54
|
"react": "^18.2.0"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
58
|
-
"@atlaskit/editor-plugin-composition": "^
|
|
59
|
-
"@atlaskit/editor-plugin-decorations": "^
|
|
60
|
-
"@atlaskit/editor-plugin-feature-flags": "^
|
|
57
|
+
"@atlaskit/editor-plugin-composition": "^2.0.0",
|
|
58
|
+
"@atlaskit/editor-plugin-decorations": "^3.0.0",
|
|
59
|
+
"@atlaskit/editor-plugin-feature-flags": "^2.0.0",
|
|
61
60
|
"@testing-library/react": "^13.4.0",
|
|
62
61
|
"typescript": "~5.4.2"
|
|
63
62
|
},
|
|
@@ -107,21 +106,12 @@
|
|
|
107
106
|
"platform_editor_resolve_marks": {
|
|
108
107
|
"type": "boolean"
|
|
109
108
|
},
|
|
110
|
-
"platform_editor_controls_patch_9": {
|
|
111
|
-
"type": "boolean"
|
|
112
|
-
},
|
|
113
|
-
"platform_editor_controls_patch_10": {
|
|
114
|
-
"type": "boolean"
|
|
115
|
-
},
|
|
116
109
|
"platform_editor_controls_patch_13": {
|
|
117
110
|
"type": "boolean"
|
|
118
111
|
},
|
|
119
112
|
"editor_inline_comments_on_inline_nodes": {
|
|
120
113
|
"type": "boolean"
|
|
121
114
|
},
|
|
122
|
-
"platform_editor_controls_patch_4": {
|
|
123
|
-
"type": "boolean"
|
|
124
|
-
},
|
|
125
115
|
"platform_editor_use_preferences_plugin": {
|
|
126
116
|
"type": "boolean"
|
|
127
117
|
},
|