@atlaskit/editor-plugin-text-formatting 3.0.11 → 3.0.13

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/pm-plugins/main.js +1 -2
  3. package/dist/cjs/ui/FloatingToolbarComponent.js +3 -26
  4. package/dist/cjs/ui/Toolbar/components/Component.js +6 -6
  5. package/dist/cjs/ui/Toolbar/components/utils.js +2 -8
  6. package/dist/cjs/ui/Toolbar/dropdown-menu.js +2 -9
  7. package/dist/cjs/ui/Toolbar/hooks/formatting-icons.js +13 -17
  8. package/dist/cjs/ui/Toolbar/single-toolbar-buttons.js +1 -2
  9. package/dist/es2019/pm-plugins/main.js +1 -2
  10. package/dist/es2019/ui/FloatingToolbarComponent.js +3 -30
  11. package/dist/es2019/ui/Toolbar/components/Component.js +6 -6
  12. package/dist/es2019/ui/Toolbar/components/utils.js +1 -7
  13. package/dist/es2019/ui/Toolbar/dropdown-menu.js +2 -9
  14. package/dist/es2019/ui/Toolbar/hooks/formatting-icons.js +13 -17
  15. package/dist/es2019/ui/Toolbar/single-toolbar-buttons.js +1 -2
  16. package/dist/esm/pm-plugins/main.js +1 -2
  17. package/dist/esm/ui/FloatingToolbarComponent.js +3 -26
  18. package/dist/esm/ui/Toolbar/components/Component.js +6 -6
  19. package/dist/esm/ui/Toolbar/components/utils.js +1 -7
  20. package/dist/esm/ui/Toolbar/dropdown-menu.js +2 -9
  21. package/dist/esm/ui/Toolbar/hooks/formatting-icons.js +13 -17
  22. package/dist/esm/ui/Toolbar/single-toolbar-buttons.js +1 -2
  23. package/dist/types/ui/Toolbar/components/utils.d.ts +0 -1
  24. package/dist/types/ui/Toolbar/dropdown-menu.d.ts +1 -2
  25. package/dist/types/ui/Toolbar/dropdown-toolbar-button.d.ts +2 -2
  26. package/dist/types/ui/Toolbar/hooks/formatting-icons.d.ts +1 -3
  27. package/dist/types/ui/Toolbar/single-toolbar-buttons.d.ts +1 -2
  28. package/dist/types-ts4.5/ui/Toolbar/components/utils.d.ts +0 -1
  29. package/dist/types-ts4.5/ui/Toolbar/dropdown-menu.d.ts +1 -2
  30. package/dist/types-ts4.5/ui/Toolbar/dropdown-toolbar-button.d.ts +2 -2
  31. package/dist/types-ts4.5/ui/Toolbar/hooks/formatting-icons.d.ts +1 -3
  32. package/dist/types-ts4.5/ui/Toolbar/single-toolbar-buttons.d.ts +1 -2
  33. package/package.json +2 -5
  34. package/dist/cjs/ui/Toolbar/formatting-in-selection-utils.js +0 -52
  35. package/dist/es2019/ui/Toolbar/formatting-in-selection-utils.js +0 -34
  36. package/dist/esm/ui/Toolbar/formatting-in-selection-utils.js +0 -46
  37. package/dist/types/ui/Toolbar/formatting-in-selection-utils.d.ts +0 -7
  38. package/dist/types-ts4.5/ui/Toolbar/formatting-in-selection-utils.d.ts +0 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-text-formatting
2
2
 
3
+ ## 3.0.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9a547b35d41b0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9a547b35d41b0) -
8
+ Cleanup platform_editor_common_marks
9
+ - Updated dependencies
10
+
11
+ ## 3.0.12
12
+
13
+ ### Patch Changes
14
+
15
+ - [`f22ce89845e1e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f22ce89845e1e) -
16
+ [ED-28686] Switch to use utility getInputMethodFromParentKeys
17
+ - Updated dependencies
18
+
3
19
  ## 3.0.11
4
20
 
5
21
  ### Patch Changes
@@ -14,7 +14,6 @@ var _utils = require("@atlaskit/editor-common/utils");
14
14
  var _commands = require("@atlaskit/editor-prosemirror/commands");
15
15
  var _model = require("@atlaskit/editor-prosemirror/model");
16
16
  var _state = require("@atlaskit/editor-prosemirror/state");
17
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
17
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
19
18
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
20
19
  var _textFormatting = _interopRequireWildcard(require("../editor-commands/text-formatting"));
@@ -53,7 +52,7 @@ var getTextFormattingState = function getTextFormattingState(editorState, editor
53
52
  var state = {
54
53
  isInitialised: true
55
54
  };
56
- var showOnlyCommonMarks = (0, _expValEquals.expValEquals)('platform_editor_controls', 'cohort', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_common_marks');
55
+ var showOnlyCommonMarks = (0, _expValEquals.expValEquals)('platform_editor_controls', 'cohort', 'variant1');
57
56
  if (showOnlyCommonMarks) {
58
57
  // Code marks will disable all other formatting options when they are included in a
59
58
  // selection but (for now) we do not want to make it behave differently in regards to which
@@ -12,12 +12,9 @@ var _react2 = require("@emotion/react");
12
12
  var _reactIntlNext = require("react-intl-next");
13
13
  var _hooks = require("@atlaskit/editor-common/hooks");
14
14
  var _types = require("@atlaskit/editor-common/types");
15
- var _state = require("@atlaskit/editor-prosemirror/state");
16
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
15
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
18
16
  var _constants = require("./Toolbar/constants");
19
17
  var _dropdownMenu = require("./Toolbar/dropdown-menu");
20
- var _formattingInSelectionUtils = require("./Toolbar/formatting-in-selection-utils");
21
18
  var _clearFormattingIcon = require("./Toolbar/hooks/clear-formatting-icon");
22
19
  var _formattingIcons = require("./Toolbar/hooks/formatting-icons");
23
20
  var _useIconList2 = require("./Toolbar/hooks/use-icon-list");
@@ -153,31 +150,13 @@ var FloatingToolbarTextFormat = function FloatingToolbarTextFormat(_ref) {
153
150
  var textFormattingState = useSharedState(api);
154
151
  var formattingIsPresent = textFormattingState.formattingIsPresent,
155
152
  formattingIconState = (0, _objectWithoutProperties2.default)(textFormattingState, _excluded);
156
- var hasMultiplePartsWithFormattingSelected;
157
- var commonActiveMarks;
158
- if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
159
- var selection = editorView.state.selection;
160
- var from = selection.from,
161
- to = selection.to;
162
- var selectedContent = selection instanceof _state.TextSelection ? editorView.state.doc.slice(from, to).content.content.slice() : undefined;
163
- hasMultiplePartsWithFormattingSelected = (0, _platformFeatureFlags.fg)('platform_editor_common_marks') ? false : (0, _formattingInSelectionUtils.hasMultiplePartsWithFormattingInSelection)({
164
- selectedContent: selectedContent
165
- });
166
- if (!(0, _platformFeatureFlags.fg)('platform_editor_common_marks')) {
167
- commonActiveMarks = (0, _formattingInSelectionUtils.getCommonActiveMarks)({
168
- selectedContent: selectedContent
169
- });
170
- }
171
- }
172
153
  var defaultIcons = (0, _formattingIcons.useFormattingIcons)({
173
154
  schema: editorView.state.schema,
174
155
  intl: intl,
175
156
  isToolbarDisabled: FloatingToolbarSettings.disabled,
176
157
  editorAnalyticsAPI: editorAnalyticsAPI,
177
158
  textFormattingState: formattingIconState,
178
- toolbarType: FloatingToolbarSettings.toolbarType,
179
- hasMultiplePartsWithFormattingSelected: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? hasMultiplePartsWithFormattingSelected : undefined,
180
- commonActiveMarks: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? commonActiveMarks : undefined
159
+ toolbarType: FloatingToolbarSettings.toolbarType
181
160
  });
182
161
  var _useIconList = (0, _useIconList2.useIconList)({
183
162
  icons: defaultIcons,
@@ -207,8 +186,7 @@ var FloatingToolbarTextFormat = function FloatingToolbarTextFormat(_ref) {
207
186
  return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_singleToolbarButtons.SingleToolbarButtons, {
208
187
  items: singleItems,
209
188
  editorView: editorView,
210
- isReducedSpacing: false,
211
- hasMultiplePartsWithFormattingSelected: hasMultiplePartsWithFormattingSelected
189
+ isReducedSpacing: false
212
190
  }), (0, _react2.jsx)(_dropdownMenu.FormattingTextDropdownMenu, {
213
191
  editorView: editorView,
214
192
  items: items,
@@ -217,8 +195,7 @@ var FloatingToolbarTextFormat = function FloatingToolbarTextFormat(_ref) {
217
195
  hasFormattingActive: FloatingToolbarSettings.hasMoreButton,
218
196
  hasMoreButton: FloatingToolbarSettings.hasMoreButton,
219
197
  intl: intl,
220
- toolbarType: FloatingToolbarSettings.toolbarType,
221
- hasMultiplePartsWithFormattingSelected: hasMultiplePartsWithFormattingSelected
198
+ toolbarType: FloatingToolbarSettings.toolbarType
222
199
  }));
223
200
  };
224
201
  var FloatingToolbarTextFormalWithIntl = exports.FloatingToolbarTextFormalWithIntl = (0, _reactIntlNext.injectIntl)(FloatingToolbarTextFormat);
@@ -10,6 +10,7 @@ var _reactIntlNext = require("react-intl-next");
10
10
  var _hooks = require("@atlaskit/editor-common/hooks");
11
11
  var _keymaps = require("@atlaskit/editor-common/keymaps");
12
12
  var _messages = require("@atlaskit/editor-common/messages");
13
+ var _toolbar = require("@atlaskit/editor-common/toolbar");
13
14
  var _editorToolbar = require("@atlaskit/editor-toolbar");
14
15
  var _clearFormatting = require("../../../editor-commands/clear-formatting");
15
16
  var _utils = require("./utils");
@@ -114,10 +115,9 @@ var ClearFormatMenuItem = exports.ClearFormatMenuItem = function ClearFormatMenu
114
115
  }
115
116
  var formatTitle = formatMessage(_messages.toolbarMessages.clearFormatting);
116
117
  var shortcutContent = (0, _keymaps.tooltip)(_keymaps.clearFormatting);
117
- var ariaLabel = (0, _keymaps.tooltip)(_keymaps.clearFormatting, formatTitle);
118
118
  var onClick = function onClick() {
119
119
  var _api$analytics;
120
- api === null || api === void 0 || api.core.actions.execute((0, _clearFormatting.clearFormattingWithAnalyticsNext)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)((0, _utils.getInputMethodFromParentKeys)(parents)));
120
+ api === null || api === void 0 || api.core.actions.execute((0, _clearFormatting.clearFormattingWithAnalyticsNext)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)((0, _toolbar.getInputMethodFromParentKeys)(parents)));
121
121
  };
122
122
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
123
123
  elemBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.ClearFormattingIcon, {
@@ -128,8 +128,7 @@ var ClearFormatMenuItem = exports.ClearFormatMenuItem = function ClearFormatMenu
128
128
  }),
129
129
  isDisabled: !isFormattingPresent,
130
130
  onClick: onClick,
131
- "aria-keyshortcuts": (0, _keymaps.getAriaKeyshortcuts)(_keymaps.clearFormatting),
132
- "aria-label": ariaLabel
131
+ ariaKeyshortcuts: (0, _keymaps.getAriaKeyshortcuts)(_keymaps.clearFormatting)
133
132
  }, formatTitle);
134
133
  };
135
134
  var MoreFormattingMenu = exports.MoreFormattingMenu = function MoreFormattingMenu(_ref4) {
@@ -140,9 +139,10 @@ var MoreFormattingMenu = exports.MoreFormattingMenu = function MoreFormattingMen
140
139
  var content = formatMessage(_messages.toolbarMessages.moreFormatting);
141
140
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownMenu, {
142
141
  iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.MoreItemsIcon, {
143
- label: content,
142
+ label: "",
144
143
  testId: "more-formatting"
145
144
  }),
146
- groupLocation: groupLocation
145
+ groupLocation: groupLocation,
146
+ label: content
147
147
  }, children);
148
148
  };
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.useComponentInfo = exports.getInputMethodFromParentKeys = exports.formatOptions = void 0;
7
+ exports.useComponentInfo = exports.formatOptions = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _reactIntlNext = require("react-intl-next");
10
10
  var _hooks = require("@atlaskit/editor-common/hooks");
@@ -13,14 +13,8 @@ var _messages = require("@atlaskit/editor-common/messages");
13
13
  var _toolbar = require("@atlaskit/editor-common/toolbar");
14
14
  var _editorToolbar = require("@atlaskit/editor-toolbar");
15
15
  var _toggleMark = require("../../../editor-commands/toggle-mark");
16
- var _inputMethodUtils = require("../input-method-utils");
17
- var _types = require("../types");
18
16
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
19
17
  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) { (0, _defineProperty2.default)(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; }
20
- var getInputMethodFromParentKeys = exports.getInputMethodFromParentKeys = function getInputMethodFromParentKeys(parentKeys) {
21
- var _parentKeys$at;
22
- return (0, _inputMethodUtils.getInputMethod)(((_parentKeys$at = parentKeys.at(-1)) === null || _parentKeys$at === void 0 ? void 0 : _parentKeys$at.key) === _toolbar.TOOLBARS.INLINE_TEXT_TOOLBAR ? _types.ToolbarType.FLOATING : _types.ToolbarType.PRIMARY);
23
- };
24
18
  var FormatMarkSchema = {
25
19
  strong: 'strong',
26
20
  em: 'em',
@@ -73,7 +67,7 @@ var useComponentInfo = exports.useComponentInfo = function useComponentInfo(_ref
73
67
  var ariaLabel = (0, _keymaps.tooltip)(shortcut, formatTitle);
74
68
  var onClick = function onClick() {
75
69
  var _api$analytics;
76
- api === null || api === void 0 || api.core.actions.execute(toggleMarkWithAnalyticsCallback(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(getInputMethodFromParentKeys(parents)));
70
+ api === null || api === void 0 || api.core.actions.execute(toggleMarkWithAnalyticsCallback(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)((0, _toolbar.getInputMethodFromParentKeys)(parents)));
77
71
  };
78
72
  return _objectSpread(_objectSpread({}, formatOptionState), {}, {
79
73
  formatTitle: formatTitle,
@@ -29,7 +29,6 @@ var FormattingTextDropdownMenu = exports.FormattingTextDropdownMenu = /*#__PURE_
29
29
  hasMoreButton = _ref.hasMoreButton,
30
30
  intl = _ref.intl,
31
31
  toolbarType = _ref.toolbarType,
32
- hasMultiplePartsWithFormattingSelected = _ref.hasMultiplePartsWithFormattingSelected,
33
32
  isDisabled = _ref.isDisabled;
34
33
  var _useMenuState = (0, _menuState.useMenuState)(),
35
34
  _useMenuState2 = (0, _slicedToArray2.default)(_useMenuState, 3),
@@ -56,14 +55,8 @@ var FormattingTextDropdownMenu = exports.FormattingTextDropdownMenu = /*#__PURE_
56
55
  });
57
56
  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;
58
57
  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;
59
- var iconBefore;
60
- var activeIconName = defaultIconName;
61
- if (hasMultiplePartsWithFormattingSelected && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
62
- iconBefore = defaultIcon;
63
- } else {
64
- iconBefore = activeItem ? activeItem === null || activeItem === void 0 ? void 0 : activeItem.elemBefore : defaultIcon;
65
- activeIconName = (activeItem === null || activeItem === void 0 ? void 0 : activeItem.value.name) || defaultIconName;
66
- }
58
+ var iconBefore = activeItem ? activeItem === null || activeItem === void 0 ? void 0 : activeItem.elemBefore : defaultIcon;
59
+ var activeIconName = (activeItem === null || activeItem === void 0 ? void 0 : activeItem.value.name) || defaultIconName;
67
60
  return /*#__PURE__*/_react.default.createElement(_uiMenu.DropdownMenuWithKeyboardNavigation, {
68
61
  mountTo: popupsMountPoint,
69
62
  onOpenChange: closeMenu,
@@ -175,7 +175,7 @@ var getIcon = function getIcon(_ref) {
175
175
  };
176
176
  };
177
177
  var IconsMarkSchema = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.IconTypes.strong, 'strong'), _types.IconTypes.em, 'em'), _types.IconTypes.strike, 'strike'), _types.IconTypes.code, 'code'), _types.IconTypes.underline, 'underline'), _types.IconTypes.superscript, 'subsup'), _types.IconTypes.subscript, 'subsup');
178
- var buildMenuIconState = function buildMenuIconState(iconMark, hasMultiplePartsWithFormattingSelected, commonActiveMarks) {
178
+ var buildMenuIconState = function buildMenuIconState(iconMark) {
179
179
  return function (_ref2) {
180
180
  var schema = _ref2.schema,
181
181
  textFormattingState = _ref2.textFormattingState;
@@ -190,7 +190,7 @@ var buildMenuIconState = function buildMenuIconState(iconMark, hasMultiplePartsW
190
190
  hasSchemaMark: hasSchemaMark
191
191
  };
192
192
  }
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")];
193
+ var isActive = textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState["".concat(iconMark, "Active")];
194
194
  var isDisabled = textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState["".concat(iconMark, "Disabled")];
195
195
  var isHidden = textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState["".concat(iconMark, "Hidden")];
196
196
  return {
@@ -201,8 +201,8 @@ var buildMenuIconState = function buildMenuIconState(iconMark, hasMultiplePartsW
201
201
  };
202
202
  };
203
203
  };
204
- var buildIcon = function buildIcon(iconMark, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks) {
205
- var getState = buildMenuIconState(iconMark, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
204
+ var buildIcon = function buildIcon(iconMark, editorAnalyticsAPI, toolbarType) {
205
+ var getState = buildMenuIconState(iconMark);
206
206
  return function (_ref3) {
207
207
  var schema = _ref3.schema,
208
208
  textFormattingState = _ref3.textFormattingState,
@@ -238,25 +238,21 @@ var useFormattingIcons = exports.useFormattingIcons = function useFormattingIcon
238
238
  schema = _ref4.schema,
239
239
  intl = _ref4.intl,
240
240
  editorAnalyticsAPI = _ref4.editorAnalyticsAPI,
241
- toolbarType = _ref4.toolbarType,
242
- hasMultiplePartsWithFormattingSelected = _ref4.hasMultiplePartsWithFormattingSelected,
243
- commonActiveMarks = _ref4.commonActiveMarks;
241
+ toolbarType = _ref4.toolbarType;
244
242
  var props = {
245
243
  schema: schema,
246
244
  textFormattingState: textFormattingState,
247
245
  intl: intl,
248
246
  isToolbarDisabled: Boolean(isToolbarDisabled),
249
- toolbarType: toolbarType,
250
- hasMultiplePartsWithFormattingSelected: hasMultiplePartsWithFormattingSelected,
251
- commonActiveMarks: commonActiveMarks
247
+ toolbarType: toolbarType
252
248
  };
253
- var buildStrongIcon = buildIcon(_types.IconTypes.strong, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
254
- var buildEmIcon = buildIcon(_types.IconTypes.em, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
255
- var buildUnderlineIcon = buildIcon(_types.IconTypes.underline, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
256
- var buildStrikeIcon = buildIcon(_types.IconTypes.strike, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
257
- var buildCodeIcon = buildIcon(_types.IconTypes.code, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
258
- var buildSubscriptIcon = buildIcon(_types.IconTypes.subscript, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
259
- var buildSuperscriptIcon = buildIcon(_types.IconTypes.superscript, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
249
+ var buildStrongIcon = buildIcon(_types.IconTypes.strong, editorAnalyticsAPI, toolbarType);
250
+ var buildEmIcon = buildIcon(_types.IconTypes.em, editorAnalyticsAPI, toolbarType);
251
+ var buildUnderlineIcon = buildIcon(_types.IconTypes.underline, editorAnalyticsAPI, toolbarType);
252
+ var buildStrikeIcon = buildIcon(_types.IconTypes.strike, editorAnalyticsAPI, toolbarType);
253
+ var buildCodeIcon = buildIcon(_types.IconTypes.code, editorAnalyticsAPI, toolbarType);
254
+ var buildSubscriptIcon = buildIcon(_types.IconTypes.subscript, editorAnalyticsAPI, toolbarType);
255
+ var buildSuperscriptIcon = buildIcon(_types.IconTypes.superscript, editorAnalyticsAPI, toolbarType);
260
256
  var strongIcon = buildStrongIcon(props);
261
257
  var emIcon = buildEmIcon(props);
262
258
  var underlineIcon = buildUnderlineIcon(props);
@@ -21,8 +21,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
21
21
  var SingleToolbarButtons = exports.SingleToolbarButtons = /*#__PURE__*/_react.default.memo(function (_ref) {
22
22
  var items = _ref.items,
23
23
  isReducedSpacing = _ref.isReducedSpacing,
24
- editorView = _ref.editorView,
25
- hasMultiplePartsWithFormattingSelected = _ref.hasMultiplePartsWithFormattingSelected;
24
+ editorView = _ref.editorView;
26
25
  var onClick = (0, _react.useCallback)(function (command) {
27
26
  return function () {
28
27
  command(editorView.state, editorView.dispatch);
@@ -8,7 +8,6 @@ import { shallowEqual } from '@atlaskit/editor-common/utils';
8
8
  import { toggleMark } from '@atlaskit/editor-prosemirror/commands';
9
9
  import { MarkType } from '@atlaskit/editor-prosemirror/model';
10
10
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
11
- import { fg } from '@atlaskit/platform-feature-flags';
12
11
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
12
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
14
13
  import { createInlineCodeFromTextInputWithAnalytics } from '../editor-commands/text-formatting';
@@ -43,7 +42,7 @@ const getTextFormattingState = (editorState, editorAnalyticsAPI) => {
43
42
  const state = {
44
43
  isInitialised: true
45
44
  };
46
- const showOnlyCommonMarks = expValEquals('platform_editor_controls', 'cohort', 'variant1') && fg('platform_editor_common_marks');
45
+ const showOnlyCommonMarks = expValEquals('platform_editor_controls', 'cohort', 'variant1');
47
46
  if (showOnlyCommonMarks) {
48
47
  // Code marks will disable all other formatting options when they are included in a
49
48
  // selection but (for now) we do not want to make it behave differently in regards to which
@@ -9,12 +9,9 @@ import { jsx } from '@emotion/react';
9
9
  import { injectIntl } from 'react-intl-next';
10
10
  import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
11
11
  import { ToolbarSize } from '@atlaskit/editor-common/types';
12
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
13
- import { fg } from '@atlaskit/platform-feature-flags';
14
12
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
15
13
  import { ToolbarButtonsStrong } from './Toolbar/constants';
16
14
  import { FormattingTextDropdownMenu } from './Toolbar/dropdown-menu';
17
- import { getCommonActiveMarks, hasMultiplePartsWithFormattingInSelection } from './Toolbar/formatting-in-selection-utils';
18
15
  import { useClearIcon } from './Toolbar/hooks/clear-formatting-icon';
19
16
  import { useFormattingIcons } from './Toolbar/hooks/formatting-icons';
20
17
  import { useIconList } from './Toolbar/hooks/use-icon-list';
@@ -148,35 +145,13 @@ const FloatingToolbarTextFormat = ({
148
145
  formattingIsPresent,
149
146
  ...formattingIconState
150
147
  } = textFormattingState;
151
- let hasMultiplePartsWithFormattingSelected;
152
- let commonActiveMarks;
153
- if (editorExperiment('platform_editor_controls', 'variant1')) {
154
- const {
155
- selection
156
- } = editorView.state;
157
- const {
158
- from,
159
- to
160
- } = selection;
161
- const selectedContent = selection instanceof TextSelection ? editorView.state.doc.slice(from, to).content.content.slice() : undefined;
162
- hasMultiplePartsWithFormattingSelected = fg('platform_editor_common_marks') ? false : hasMultiplePartsWithFormattingInSelection({
163
- selectedContent
164
- });
165
- if (!fg('platform_editor_common_marks')) {
166
- commonActiveMarks = getCommonActiveMarks({
167
- selectedContent
168
- });
169
- }
170
- }
171
148
  const defaultIcons = useFormattingIcons({
172
149
  schema: editorView.state.schema,
173
150
  intl,
174
151
  isToolbarDisabled: FloatingToolbarSettings.disabled,
175
152
  editorAnalyticsAPI,
176
153
  textFormattingState: formattingIconState,
177
- toolbarType: FloatingToolbarSettings.toolbarType,
178
- hasMultiplePartsWithFormattingSelected: editorExperiment('platform_editor_controls', 'variant1') ? hasMultiplePartsWithFormattingSelected : undefined,
179
- commonActiveMarks: editorExperiment('platform_editor_controls', 'variant1') ? commonActiveMarks : undefined
154
+ toolbarType: FloatingToolbarSettings.toolbarType
180
155
  });
181
156
  const {
182
157
  dropdownItems,
@@ -207,8 +182,7 @@ const FloatingToolbarTextFormat = ({
207
182
  return jsx(React.Fragment, null, jsx(SingleToolbarButtons, {
208
183
  items: singleItems,
209
184
  editorView: editorView,
210
- isReducedSpacing: false,
211
- hasMultiplePartsWithFormattingSelected: hasMultiplePartsWithFormattingSelected
185
+ isReducedSpacing: false
212
186
  }), jsx(FormattingTextDropdownMenu, {
213
187
  editorView: editorView,
214
188
  items: items,
@@ -217,8 +191,7 @@ const FloatingToolbarTextFormat = ({
217
191
  hasFormattingActive: FloatingToolbarSettings.hasMoreButton,
218
192
  hasMoreButton: FloatingToolbarSettings.hasMoreButton,
219
193
  intl: intl,
220
- toolbarType: FloatingToolbarSettings.toolbarType,
221
- hasMultiplePartsWithFormattingSelected: hasMultiplePartsWithFormattingSelected
194
+ toolbarType: FloatingToolbarSettings.toolbarType
222
195
  }));
223
196
  };
224
197
  export const FloatingToolbarTextFormalWithIntl = injectIntl(FloatingToolbarTextFormat);
@@ -3,9 +3,10 @@ import { useIntl } from 'react-intl-next';
3
3
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
4
  import { clearFormatting, getAriaKeyshortcuts, tooltip } from '@atlaskit/editor-common/keymaps';
5
5
  import { toolbarMessages } from '@atlaskit/editor-common/messages';
6
+ import { getInputMethodFromParentKeys } from '@atlaskit/editor-common/toolbar';
6
7
  import { ToolbarButton, ToolbarDropdownItem, ClearFormattingIcon, ToolbarKeyboardShortcutHint, ToolbarDropdownMenu, MoreItemsIcon, ToolbarTooltip } from '@atlaskit/editor-toolbar';
7
8
  import { clearFormattingWithAnalyticsNext } from '../../../editor-commands/clear-formatting';
8
- import { getInputMethodFromParentKeys, useComponentInfo } from './utils';
9
+ import { useComponentInfo } from './utils';
9
10
  export const FormatMenuItem = ({
10
11
  parents,
11
12
  api,
@@ -113,7 +114,6 @@ export const ClearFormatMenuItem = ({
113
114
  }
114
115
  const formatTitle = formatMessage(toolbarMessages.clearFormatting);
115
116
  const shortcutContent = tooltip(clearFormatting);
116
- const ariaLabel = tooltip(clearFormatting, formatTitle);
117
117
  const onClick = () => {
118
118
  var _api$analytics;
119
119
  api === null || api === void 0 ? void 0 : api.core.actions.execute(clearFormattingWithAnalyticsNext(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(getInputMethodFromParentKeys(parents)));
@@ -127,8 +127,7 @@ export const ClearFormatMenuItem = ({
127
127
  }),
128
128
  isDisabled: !isFormattingPresent,
129
129
  onClick: onClick,
130
- "aria-keyshortcuts": getAriaKeyshortcuts(clearFormatting),
131
- "aria-label": ariaLabel
130
+ ariaKeyshortcuts: getAriaKeyshortcuts(clearFormatting)
132
131
  }, formatTitle);
133
132
  };
134
133
  export const MoreFormattingMenu = ({
@@ -141,9 +140,10 @@ export const MoreFormattingMenu = ({
141
140
  const content = formatMessage(toolbarMessages.moreFormatting);
142
141
  return /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
143
142
  iconBefore: /*#__PURE__*/React.createElement(MoreItemsIcon, {
144
- label: content,
143
+ label: "",
145
144
  testId: "more-formatting"
146
145
  }),
147
- groupLocation: groupLocation
146
+ groupLocation: groupLocation,
147
+ label: content
148
148
  }, children);
149
149
  };
@@ -2,15 +2,9 @@ import { useIntl } from 'react-intl-next';
2
2
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { toggleBold, toggleCode, toggleItalic, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleUnderline, tooltip } from '@atlaskit/editor-common/keymaps';
4
4
  import { toolbarMessages } from '@atlaskit/editor-common/messages';
5
- import { BOLD_MENU_ITEM, CODE_MENU_ITEM, ITALIC_MENU_ITEM, STRIKE_MENU_ITEM, SUBSCRIPT_MENU_ITEM, SUPERSCRIPT_MENU_ITEM, TEXT_FORMATTING_MENU_SECTION_RANK, TOOLBARS, UNDERLINE_MENU_ITEM } from '@atlaskit/editor-common/toolbar';
5
+ import { BOLD_MENU_ITEM, CODE_MENU_ITEM, ITALIC_MENU_ITEM, STRIKE_MENU_ITEM, SUBSCRIPT_MENU_ITEM, SUPERSCRIPT_MENU_ITEM, TEXT_FORMATTING_MENU_SECTION_RANK, UNDERLINE_MENU_ITEM, getInputMethodFromParentKeys } from '@atlaskit/editor-common/toolbar';
6
6
  import { BoldIcon, ItalicIcon, UnderlineIcon, CodeIcon, StrikeThroughIcon, SubscriptIcon, SuperscriptIcon } from '@atlaskit/editor-toolbar';
7
7
  import { toggleStrongWithAnalytics, toggleEmWithAnalytics, toggleUnderlineWithAnalytics, toggleCodeWithAnalytics, toggleStrikeWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics } from '../../../editor-commands/toggle-mark';
8
- import { getInputMethod } from '../input-method-utils';
9
- import { ToolbarType } from '../types';
10
- export const getInputMethodFromParentKeys = parentKeys => {
11
- var _parentKeys$at;
12
- return getInputMethod(((_parentKeys$at = parentKeys.at(-1)) === null || _parentKeys$at === void 0 ? void 0 : _parentKeys$at.key) === TOOLBARS.INLINE_TEXT_TOOLBAR ? ToolbarType.FLOATING : ToolbarType.PRIMARY);
13
- };
14
8
  const FormatMarkSchema = {
15
9
  strong: 'strong',
16
10
  em: 'em',
@@ -18,7 +18,6 @@ export const FormattingTextDropdownMenu = /*#__PURE__*/React.memo(({
18
18
  hasMoreButton,
19
19
  intl,
20
20
  toolbarType,
21
- hasMultiplePartsWithFormattingSelected,
22
21
  isDisabled
23
22
  }) => {
24
23
  var _items$0$items$, _items$0$items$2;
@@ -38,14 +37,8 @@ export const FormattingTextDropdownMenu = /*#__PURE__*/React.memo(({
38
37
  const activeItem = items[0].items.find(item => item.isActive);
39
38
  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;
40
39
  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;
41
- let iconBefore;
42
- let activeIconName = defaultIconName;
43
- if (hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1')) {
44
- iconBefore = defaultIcon;
45
- } else {
46
- iconBefore = activeItem ? activeItem === null || activeItem === void 0 ? void 0 : activeItem.elemBefore : defaultIcon;
47
- activeIconName = (activeItem === null || activeItem === void 0 ? void 0 : activeItem.value.name) || defaultIconName;
48
- }
40
+ const iconBefore = activeItem ? activeItem === null || activeItem === void 0 ? void 0 : activeItem.elemBefore : defaultIcon;
41
+ const activeIconName = (activeItem === null || activeItem === void 0 ? void 0 : activeItem.value.name) || defaultIconName;
49
42
  return /*#__PURE__*/React.createElement(DropdownMenu, {
50
43
  mountTo: popupsMountPoint,
51
44
  onOpenChange: closeMenu,
@@ -167,7 +167,7 @@ const IconsMarkSchema = {
167
167
  [IconTypes.superscript]: 'subsup',
168
168
  [IconTypes.subscript]: 'subsup'
169
169
  };
170
- const buildMenuIconState = (iconMark, hasMultiplePartsWithFormattingSelected, commonActiveMarks) => ({
170
+ const buildMenuIconState = iconMark => ({
171
171
  schema,
172
172
  textFormattingState
173
173
  }) => {
@@ -182,7 +182,7 @@ const buildMenuIconState = (iconMark, hasMultiplePartsWithFormattingSelected, co
182
182
  hasSchemaMark
183
183
  };
184
184
  }
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`];
185
+ const isActive = textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState[`${iconMark}Active`];
186
186
  const isDisabled = textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState[`${iconMark}Disabled`];
187
187
  const isHidden = textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState[`${iconMark}Hidden`];
188
188
  return {
@@ -192,8 +192,8 @@ const buildMenuIconState = (iconMark, hasMultiplePartsWithFormattingSelected, co
192
192
  hasSchemaMark
193
193
  };
194
194
  };
195
- const buildIcon = (iconMark, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks) => {
196
- const getState = buildMenuIconState(iconMark, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
195
+ const buildIcon = (iconMark, editorAnalyticsAPI, toolbarType) => {
196
+ const getState = buildMenuIconState(iconMark);
197
197
  return ({
198
198
  schema,
199
199
  textFormattingState,
@@ -228,26 +228,22 @@ export const useFormattingIcons = ({
228
228
  schema,
229
229
  intl,
230
230
  editorAnalyticsAPI,
231
- toolbarType,
232
- hasMultiplePartsWithFormattingSelected,
233
- commonActiveMarks
231
+ toolbarType
234
232
  }) => {
235
233
  const props = {
236
234
  schema,
237
235
  textFormattingState,
238
236
  intl,
239
237
  isToolbarDisabled: Boolean(isToolbarDisabled),
240
- toolbarType,
241
- hasMultiplePartsWithFormattingSelected,
242
- commonActiveMarks
238
+ toolbarType
243
239
  };
244
- const buildStrongIcon = buildIcon(IconTypes.strong, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
245
- const buildEmIcon = buildIcon(IconTypes.em, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
246
- const buildUnderlineIcon = buildIcon(IconTypes.underline, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
247
- const buildStrikeIcon = buildIcon(IconTypes.strike, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
248
- const buildCodeIcon = buildIcon(IconTypes.code, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
249
- const buildSubscriptIcon = buildIcon(IconTypes.subscript, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
250
- const buildSuperscriptIcon = buildIcon(IconTypes.superscript, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
240
+ const buildStrongIcon = buildIcon(IconTypes.strong, editorAnalyticsAPI, toolbarType);
241
+ const buildEmIcon = buildIcon(IconTypes.em, editorAnalyticsAPI, toolbarType);
242
+ const buildUnderlineIcon = buildIcon(IconTypes.underline, editorAnalyticsAPI, toolbarType);
243
+ const buildStrikeIcon = buildIcon(IconTypes.strike, editorAnalyticsAPI, toolbarType);
244
+ const buildCodeIcon = buildIcon(IconTypes.code, editorAnalyticsAPI, toolbarType);
245
+ const buildSubscriptIcon = buildIcon(IconTypes.subscript, editorAnalyticsAPI, toolbarType);
246
+ const buildSuperscriptIcon = buildIcon(IconTypes.superscript, editorAnalyticsAPI, toolbarType);
251
247
  const strongIcon = buildStrongIcon(props);
252
248
  const emIcon = buildEmIcon(props);
253
249
  const underlineIcon = buildUnderlineIcon(props);
@@ -12,8 +12,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
12
12
  export const SingleToolbarButtons = /*#__PURE__*/React.memo(({
13
13
  items,
14
14
  isReducedSpacing,
15
- editorView,
16
- hasMultiplePartsWithFormattingSelected
15
+ editorView
17
16
  }) => {
18
17
  const onClick = useCallback(command => {
19
18
  return () => {
@@ -12,7 +12,6 @@ import { shallowEqual } from '@atlaskit/editor-common/utils';
12
12
  import { toggleMark } from '@atlaskit/editor-prosemirror/commands';
13
13
  import { MarkType } from '@atlaskit/editor-prosemirror/model';
14
14
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
15
- import { fg } from '@atlaskit/platform-feature-flags';
16
15
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
17
16
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
18
17
  import { createInlineCodeFromTextInputWithAnalytics } from '../editor-commands/text-formatting';
@@ -46,7 +45,7 @@ var getTextFormattingState = function getTextFormattingState(editorState, editor
46
45
  var state = {
47
46
  isInitialised: true
48
47
  };
49
- var showOnlyCommonMarks = expValEquals('platform_editor_controls', 'cohort', 'variant1') && fg('platform_editor_common_marks');
48
+ var showOnlyCommonMarks = expValEquals('platform_editor_controls', 'cohort', 'variant1');
50
49
  if (showOnlyCommonMarks) {
51
50
  // Code marks will disable all other formatting options when they are included in a
52
51
  // selection but (for now) we do not want to make it behave differently in regards to which
@@ -11,12 +11,9 @@ import { jsx } from '@emotion/react';
11
11
  import { injectIntl } from 'react-intl-next';
12
12
  import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
13
13
  import { ToolbarSize } from '@atlaskit/editor-common/types';
14
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
15
- import { fg } from '@atlaskit/platform-feature-flags';
16
14
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
17
15
  import { ToolbarButtonsStrong } from './Toolbar/constants';
18
16
  import { FormattingTextDropdownMenu } from './Toolbar/dropdown-menu';
19
- import { getCommonActiveMarks, hasMultiplePartsWithFormattingInSelection } from './Toolbar/formatting-in-selection-utils';
20
17
  import { useClearIcon } from './Toolbar/hooks/clear-formatting-icon';
21
18
  import { useFormattingIcons } from './Toolbar/hooks/formatting-icons';
22
19
  import { useIconList } from './Toolbar/hooks/use-icon-list';
@@ -145,31 +142,13 @@ var FloatingToolbarTextFormat = function FloatingToolbarTextFormat(_ref) {
145
142
  var textFormattingState = useSharedState(api);
146
143
  var formattingIsPresent = textFormattingState.formattingIsPresent,
147
144
  formattingIconState = _objectWithoutProperties(textFormattingState, _excluded);
148
- var hasMultiplePartsWithFormattingSelected;
149
- var commonActiveMarks;
150
- if (editorExperiment('platform_editor_controls', 'variant1')) {
151
- var selection = editorView.state.selection;
152
- var from = selection.from,
153
- to = selection.to;
154
- var selectedContent = selection instanceof TextSelection ? editorView.state.doc.slice(from, to).content.content.slice() : undefined;
155
- hasMultiplePartsWithFormattingSelected = fg('platform_editor_common_marks') ? false : hasMultiplePartsWithFormattingInSelection({
156
- selectedContent: selectedContent
157
- });
158
- if (!fg('platform_editor_common_marks')) {
159
- commonActiveMarks = getCommonActiveMarks({
160
- selectedContent: selectedContent
161
- });
162
- }
163
- }
164
145
  var defaultIcons = useFormattingIcons({
165
146
  schema: editorView.state.schema,
166
147
  intl: intl,
167
148
  isToolbarDisabled: FloatingToolbarSettings.disabled,
168
149
  editorAnalyticsAPI: editorAnalyticsAPI,
169
150
  textFormattingState: formattingIconState,
170
- toolbarType: FloatingToolbarSettings.toolbarType,
171
- hasMultiplePartsWithFormattingSelected: editorExperiment('platform_editor_controls', 'variant1') ? hasMultiplePartsWithFormattingSelected : undefined,
172
- commonActiveMarks: editorExperiment('platform_editor_controls', 'variant1') ? commonActiveMarks : undefined
151
+ toolbarType: FloatingToolbarSettings.toolbarType
173
152
  });
174
153
  var _useIconList = useIconList({
175
154
  icons: defaultIcons,
@@ -199,8 +178,7 @@ var FloatingToolbarTextFormat = function FloatingToolbarTextFormat(_ref) {
199
178
  return jsx(React.Fragment, null, jsx(SingleToolbarButtons, {
200
179
  items: singleItems,
201
180
  editorView: editorView,
202
- isReducedSpacing: false,
203
- hasMultiplePartsWithFormattingSelected: hasMultiplePartsWithFormattingSelected
181
+ isReducedSpacing: false
204
182
  }), jsx(FormattingTextDropdownMenu, {
205
183
  editorView: editorView,
206
184
  items: items,
@@ -209,8 +187,7 @@ var FloatingToolbarTextFormat = function FloatingToolbarTextFormat(_ref) {
209
187
  hasFormattingActive: FloatingToolbarSettings.hasMoreButton,
210
188
  hasMoreButton: FloatingToolbarSettings.hasMoreButton,
211
189
  intl: intl,
212
- toolbarType: FloatingToolbarSettings.toolbarType,
213
- hasMultiplePartsWithFormattingSelected: hasMultiplePartsWithFormattingSelected
190
+ toolbarType: FloatingToolbarSettings.toolbarType
214
191
  }));
215
192
  };
216
193
  export var FloatingToolbarTextFormalWithIntl = injectIntl(FloatingToolbarTextFormat);
@@ -3,9 +3,10 @@ import { useIntl } from 'react-intl-next';
3
3
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
4
  import { clearFormatting, getAriaKeyshortcuts, tooltip } from '@atlaskit/editor-common/keymaps';
5
5
  import { toolbarMessages } from '@atlaskit/editor-common/messages';
6
+ import { getInputMethodFromParentKeys } from '@atlaskit/editor-common/toolbar';
6
7
  import { ToolbarButton, ToolbarDropdownItem, ClearFormattingIcon, ToolbarKeyboardShortcutHint, ToolbarDropdownMenu, MoreItemsIcon, ToolbarTooltip } from '@atlaskit/editor-toolbar';
7
8
  import { clearFormattingWithAnalyticsNext } from '../../../editor-commands/clear-formatting';
8
- import { getInputMethodFromParentKeys, useComponentInfo } from './utils';
9
+ import { useComponentInfo } from './utils';
9
10
  export var FormatMenuItem = function FormatMenuItem(_ref) {
10
11
  var parents = _ref.parents,
11
12
  api = _ref.api,
@@ -107,7 +108,6 @@ export var ClearFormatMenuItem = function ClearFormatMenuItem(_ref3) {
107
108
  }
108
109
  var formatTitle = formatMessage(toolbarMessages.clearFormatting);
109
110
  var shortcutContent = tooltip(clearFormatting);
110
- var ariaLabel = tooltip(clearFormatting, formatTitle);
111
111
  var onClick = function onClick() {
112
112
  var _api$analytics;
113
113
  api === null || api === void 0 || api.core.actions.execute(clearFormattingWithAnalyticsNext(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(getInputMethodFromParentKeys(parents)));
@@ -121,8 +121,7 @@ export var ClearFormatMenuItem = function ClearFormatMenuItem(_ref3) {
121
121
  }),
122
122
  isDisabled: !isFormattingPresent,
123
123
  onClick: onClick,
124
- "aria-keyshortcuts": getAriaKeyshortcuts(clearFormatting),
125
- "aria-label": ariaLabel
124
+ ariaKeyshortcuts: getAriaKeyshortcuts(clearFormatting)
126
125
  }, formatTitle);
127
126
  };
128
127
  export var MoreFormattingMenu = function MoreFormattingMenu(_ref4) {
@@ -133,9 +132,10 @@ export var MoreFormattingMenu = function MoreFormattingMenu(_ref4) {
133
132
  var content = formatMessage(toolbarMessages.moreFormatting);
134
133
  return /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
135
134
  iconBefore: /*#__PURE__*/React.createElement(MoreItemsIcon, {
136
- label: content,
135
+ label: "",
137
136
  testId: "more-formatting"
138
137
  }),
139
- groupLocation: groupLocation
138
+ groupLocation: groupLocation,
139
+ label: content
140
140
  }, children);
141
141
  };
@@ -5,15 +5,9 @@ import { useIntl } from 'react-intl-next';
5
5
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
6
6
  import { toggleBold, toggleCode, toggleItalic, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleUnderline, tooltip } from '@atlaskit/editor-common/keymaps';
7
7
  import { toolbarMessages } from '@atlaskit/editor-common/messages';
8
- import { BOLD_MENU_ITEM, CODE_MENU_ITEM, ITALIC_MENU_ITEM, STRIKE_MENU_ITEM, SUBSCRIPT_MENU_ITEM, SUPERSCRIPT_MENU_ITEM, TEXT_FORMATTING_MENU_SECTION_RANK, TOOLBARS, UNDERLINE_MENU_ITEM } from '@atlaskit/editor-common/toolbar';
8
+ import { BOLD_MENU_ITEM, CODE_MENU_ITEM, ITALIC_MENU_ITEM, STRIKE_MENU_ITEM, SUBSCRIPT_MENU_ITEM, SUPERSCRIPT_MENU_ITEM, TEXT_FORMATTING_MENU_SECTION_RANK, UNDERLINE_MENU_ITEM, getInputMethodFromParentKeys } from '@atlaskit/editor-common/toolbar';
9
9
  import { BoldIcon, ItalicIcon, UnderlineIcon, CodeIcon, StrikeThroughIcon, SubscriptIcon, SuperscriptIcon } from '@atlaskit/editor-toolbar';
10
10
  import { toggleStrongWithAnalytics, toggleEmWithAnalytics, toggleUnderlineWithAnalytics, toggleCodeWithAnalytics, toggleStrikeWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics } from '../../../editor-commands/toggle-mark';
11
- import { getInputMethod } from '../input-method-utils';
12
- import { ToolbarType } from '../types';
13
- export var getInputMethodFromParentKeys = function getInputMethodFromParentKeys(parentKeys) {
14
- var _parentKeys$at;
15
- return getInputMethod(((_parentKeys$at = parentKeys.at(-1)) === null || _parentKeys$at === void 0 ? void 0 : _parentKeys$at.key) === TOOLBARS.INLINE_TEXT_TOOLBAR ? ToolbarType.FLOATING : ToolbarType.PRIMARY);
16
- };
17
11
  var FormatMarkSchema = {
18
12
  strong: 'strong',
19
13
  em: 'em',
@@ -20,7 +20,6 @@ export var FormattingTextDropdownMenu = /*#__PURE__*/React.memo(function (_ref)
20
20
  hasMoreButton = _ref.hasMoreButton,
21
21
  intl = _ref.intl,
22
22
  toolbarType = _ref.toolbarType,
23
- hasMultiplePartsWithFormattingSelected = _ref.hasMultiplePartsWithFormattingSelected,
24
23
  isDisabled = _ref.isDisabled;
25
24
  var _useMenuState = useMenuState(),
26
25
  _useMenuState2 = _slicedToArray(_useMenuState, 3),
@@ -47,14 +46,8 @@ export var FormattingTextDropdownMenu = /*#__PURE__*/React.memo(function (_ref)
47
46
  });
48
47
  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;
49
48
  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;
50
- var iconBefore;
51
- var activeIconName = defaultIconName;
52
- if (hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1')) {
53
- iconBefore = defaultIcon;
54
- } else {
55
- iconBefore = activeItem ? activeItem === null || activeItem === void 0 ? void 0 : activeItem.elemBefore : defaultIcon;
56
- activeIconName = (activeItem === null || activeItem === void 0 ? void 0 : activeItem.value.name) || defaultIconName;
57
- }
49
+ var iconBefore = activeItem ? activeItem === null || activeItem === void 0 ? void 0 : activeItem.elemBefore : defaultIcon;
50
+ var activeIconName = (activeItem === null || activeItem === void 0 ? void 0 : activeItem.value.name) || defaultIconName;
58
51
  return /*#__PURE__*/React.createElement(DropdownMenu, {
59
52
  mountTo: popupsMountPoint,
60
53
  onOpenChange: closeMenu,
@@ -167,7 +167,7 @@ var getIcon = function getIcon(_ref) {
167
167
  };
168
168
  };
169
169
  var IconsMarkSchema = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, IconTypes.strong, 'strong'), IconTypes.em, 'em'), IconTypes.strike, 'strike'), IconTypes.code, 'code'), IconTypes.underline, 'underline'), IconTypes.superscript, 'subsup'), IconTypes.subscript, 'subsup');
170
- var buildMenuIconState = function buildMenuIconState(iconMark, hasMultiplePartsWithFormattingSelected, commonActiveMarks) {
170
+ var buildMenuIconState = function buildMenuIconState(iconMark) {
171
171
  return function (_ref2) {
172
172
  var schema = _ref2.schema,
173
173
  textFormattingState = _ref2.textFormattingState;
@@ -182,7 +182,7 @@ var buildMenuIconState = function buildMenuIconState(iconMark, hasMultiplePartsW
182
182
  hasSchemaMark: hasSchemaMark
183
183
  };
184
184
  }
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")];
185
+ var isActive = textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState["".concat(iconMark, "Active")];
186
186
  var isDisabled = textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState["".concat(iconMark, "Disabled")];
187
187
  var isHidden = textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState["".concat(iconMark, "Hidden")];
188
188
  return {
@@ -193,8 +193,8 @@ var buildMenuIconState = function buildMenuIconState(iconMark, hasMultiplePartsW
193
193
  };
194
194
  };
195
195
  };
196
- var buildIcon = function buildIcon(iconMark, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks) {
197
- var getState = buildMenuIconState(iconMark, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
196
+ var buildIcon = function buildIcon(iconMark, editorAnalyticsAPI, toolbarType) {
197
+ var getState = buildMenuIconState(iconMark);
198
198
  return function (_ref3) {
199
199
  var schema = _ref3.schema,
200
200
  textFormattingState = _ref3.textFormattingState,
@@ -230,25 +230,21 @@ export var useFormattingIcons = function useFormattingIcons(_ref4) {
230
230
  schema = _ref4.schema,
231
231
  intl = _ref4.intl,
232
232
  editorAnalyticsAPI = _ref4.editorAnalyticsAPI,
233
- toolbarType = _ref4.toolbarType,
234
- hasMultiplePartsWithFormattingSelected = _ref4.hasMultiplePartsWithFormattingSelected,
235
- commonActiveMarks = _ref4.commonActiveMarks;
233
+ toolbarType = _ref4.toolbarType;
236
234
  var props = {
237
235
  schema: schema,
238
236
  textFormattingState: textFormattingState,
239
237
  intl: intl,
240
238
  isToolbarDisabled: Boolean(isToolbarDisabled),
241
- toolbarType: toolbarType,
242
- hasMultiplePartsWithFormattingSelected: hasMultiplePartsWithFormattingSelected,
243
- commonActiveMarks: commonActiveMarks
239
+ toolbarType: toolbarType
244
240
  };
245
- var buildStrongIcon = buildIcon(IconTypes.strong, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
246
- var buildEmIcon = buildIcon(IconTypes.em, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
247
- var buildUnderlineIcon = buildIcon(IconTypes.underline, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
248
- var buildStrikeIcon = buildIcon(IconTypes.strike, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
249
- var buildCodeIcon = buildIcon(IconTypes.code, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
250
- var buildSubscriptIcon = buildIcon(IconTypes.subscript, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
251
- var buildSuperscriptIcon = buildIcon(IconTypes.superscript, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks);
241
+ var buildStrongIcon = buildIcon(IconTypes.strong, editorAnalyticsAPI, toolbarType);
242
+ var buildEmIcon = buildIcon(IconTypes.em, editorAnalyticsAPI, toolbarType);
243
+ var buildUnderlineIcon = buildIcon(IconTypes.underline, editorAnalyticsAPI, toolbarType);
244
+ var buildStrikeIcon = buildIcon(IconTypes.strike, editorAnalyticsAPI, toolbarType);
245
+ var buildCodeIcon = buildIcon(IconTypes.code, editorAnalyticsAPI, toolbarType);
246
+ var buildSubscriptIcon = buildIcon(IconTypes.subscript, editorAnalyticsAPI, toolbarType);
247
+ var buildSuperscriptIcon = buildIcon(IconTypes.superscript, editorAnalyticsAPI, toolbarType);
252
248
  var strongIcon = buildStrongIcon(props);
253
249
  var emIcon = buildEmIcon(props);
254
250
  var underlineIcon = buildUnderlineIcon(props);
@@ -12,8 +12,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
12
12
  export var SingleToolbarButtons = /*#__PURE__*/React.memo(function (_ref) {
13
13
  var items = _ref.items,
14
14
  isReducedSpacing = _ref.isReducedSpacing,
15
- editorView = _ref.editorView,
16
- hasMultiplePartsWithFormattingSelected = _ref.hasMultiplePartsWithFormattingSelected;
15
+ editorView = _ref.editorView;
17
16
  var onClick = useCallback(function (command) {
18
17
  return function () {
19
18
  command(editorView.state, editorView.dispatch);
@@ -17,7 +17,6 @@ export type FormatComponentProps = {
17
17
  ariaLabel?: string;
18
18
  groupLocation?: ToolbarButtonGroupLocation;
19
19
  };
20
- export declare const getInputMethodFromParentKeys: (parentKeys: ToolbarComponentTypes) => import("@atlaskit/editor-common/types").InputMethodToolbar;
21
20
  export declare const useComponentInfo: ({ api, optionType, title, shortcut, toggleMarkWithAnalyticsCallback, parents, }: Omit<FormatComponentProps, "icon" | "ariaLabel" | "groupLocation">) => {
22
21
  formatTitle: string;
23
22
  shortcutContent: string | undefined;
@@ -15,8 +15,7 @@ type DropdownMenuProps = {
15
15
  popupsScrollableElement?: HTMLElement;
16
16
  hasMoreButton: boolean;
17
17
  toolbarType: ToolbarType;
18
- hasMultiplePartsWithFormattingSelected?: boolean;
19
18
  isDisabled?: boolean;
20
19
  } & WrappedComponentProps;
21
- export declare const FormattingTextDropdownMenu: React.MemoExoticComponent<({ editorView, moreButtonLabel, isReducedSpacing, items, hasFormattingActive, popupsBoundariesElement, popupsMountPoint, popupsScrollableElement, hasMoreButton, intl, toolbarType, hasMultiplePartsWithFormattingSelected, isDisabled, }: DropdownMenuProps) => React.JSX.Element>;
20
+ export declare const FormattingTextDropdownMenu: React.MemoExoticComponent<({ editorView, moreButtonLabel, isReducedSpacing, items, hasFormattingActive, popupsBoundariesElement, popupsMountPoint, popupsScrollableElement, hasMoreButton, intl, toolbarType, isDisabled, }: DropdownMenuProps) => React.JSX.Element>;
22
21
  export {};
@@ -2,7 +2,7 @@
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
4
  */
5
- import React, { type ReactElement } from 'react';
5
+ import React from 'react';
6
6
  import { jsx } from '@emotion/react';
7
7
  import { ToolbarType } from './types';
8
8
  type DropdownButtonProps = {
@@ -14,7 +14,7 @@ type DropdownButtonProps = {
14
14
  onClick?: (event: React.MouseEvent<HTMLElement>) => void;
15
15
  onKeyDown?: (event: React.KeyboardEvent) => void;
16
16
  toolbarType: ToolbarType;
17
- iconBefore?: ReactElement;
17
+ iconBefore?: React.ReactElement;
18
18
  activeIconName?: string;
19
19
  };
20
20
  export declare const DropdownToolbarButton: ({ label, isReducedSpacing, isDisabled, isSelected, "aria-expanded": ariaExpanded, onClick, onKeyDown, toolbarType, iconBefore, activeIconName, }: DropdownButtonProps) => jsx.JSX.Element;
@@ -8,10 +8,8 @@ interface FormattingIconHookProps extends IconHookProps {
8
8
  textFormattingState: TextFormattingState | undefined;
9
9
  schema: Schema;
10
10
  toolbarType: ToolbarType;
11
- hasMultiplePartsWithFormattingSelected?: boolean;
12
- commonActiveMarks?: string[];
13
11
  }
14
- export declare const useFormattingIcons: ({ isToolbarDisabled, textFormattingState, schema, intl, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks, }: FormattingIconHookProps) => Array<MenuIconItem | null>;
12
+ export declare const useFormattingIcons: ({ isToolbarDisabled, textFormattingState, schema, intl, editorAnalyticsAPI, toolbarType, }: FormattingIconHookProps) => Array<MenuIconItem | null>;
15
13
  type Props = {
16
14
  textFormattingState: TextFormattingState | undefined;
17
15
  iconTypeList: IconTypes[];
@@ -6,9 +6,8 @@ import React from 'react';
6
6
  import { jsx } from '@emotion/react';
7
7
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
8
  import type { MenuIconItem } from './types';
9
- export declare const SingleToolbarButtons: React.MemoExoticComponent<({ items, isReducedSpacing, editorView, hasMultiplePartsWithFormattingSelected, }: {
9
+ export declare const SingleToolbarButtons: React.MemoExoticComponent<({ items, isReducedSpacing, editorView, }: {
10
10
  items: MenuIconItem[];
11
11
  isReducedSpacing: boolean;
12
12
  editorView: EditorView;
13
- hasMultiplePartsWithFormattingSelected?: boolean;
14
13
  }) => jsx.JSX.Element>;
@@ -17,7 +17,6 @@ export type FormatComponentProps = {
17
17
  ariaLabel?: string;
18
18
  groupLocation?: ToolbarButtonGroupLocation;
19
19
  };
20
- export declare const getInputMethodFromParentKeys: (parentKeys: ToolbarComponentTypes) => import("@atlaskit/editor-common/types").InputMethodToolbar;
21
20
  export declare const useComponentInfo: ({ api, optionType, title, shortcut, toggleMarkWithAnalyticsCallback, parents, }: Omit<FormatComponentProps, "icon" | "ariaLabel" | "groupLocation">) => {
22
21
  formatTitle: string;
23
22
  shortcutContent: string | undefined;
@@ -15,8 +15,7 @@ type DropdownMenuProps = {
15
15
  popupsScrollableElement?: HTMLElement;
16
16
  hasMoreButton: boolean;
17
17
  toolbarType: ToolbarType;
18
- hasMultiplePartsWithFormattingSelected?: boolean;
19
18
  isDisabled?: boolean;
20
19
  } & WrappedComponentProps;
21
- export declare const FormattingTextDropdownMenu: React.MemoExoticComponent<({ editorView, moreButtonLabel, isReducedSpacing, items, hasFormattingActive, popupsBoundariesElement, popupsMountPoint, popupsScrollableElement, hasMoreButton, intl, toolbarType, hasMultiplePartsWithFormattingSelected, isDisabled, }: DropdownMenuProps) => React.JSX.Element>;
20
+ export declare const FormattingTextDropdownMenu: React.MemoExoticComponent<({ editorView, moreButtonLabel, isReducedSpacing, items, hasFormattingActive, popupsBoundariesElement, popupsMountPoint, popupsScrollableElement, hasMoreButton, intl, toolbarType, isDisabled, }: DropdownMenuProps) => React.JSX.Element>;
22
21
  export {};
@@ -2,7 +2,7 @@
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
4
  */
5
- import React, { type ReactElement } from 'react';
5
+ import React from 'react';
6
6
  import { jsx } from '@emotion/react';
7
7
  import { ToolbarType } from './types';
8
8
  type DropdownButtonProps = {
@@ -14,7 +14,7 @@ type DropdownButtonProps = {
14
14
  onClick?: (event: React.MouseEvent<HTMLElement>) => void;
15
15
  onKeyDown?: (event: React.KeyboardEvent) => void;
16
16
  toolbarType: ToolbarType;
17
- iconBefore?: ReactElement;
17
+ iconBefore?: React.ReactElement;
18
18
  activeIconName?: string;
19
19
  };
20
20
  export declare const DropdownToolbarButton: ({ label, isReducedSpacing, isDisabled, isSelected, "aria-expanded": ariaExpanded, onClick, onKeyDown, toolbarType, iconBefore, activeIconName, }: DropdownButtonProps) => jsx.JSX.Element;
@@ -8,10 +8,8 @@ interface FormattingIconHookProps extends IconHookProps {
8
8
  textFormattingState: TextFormattingState | undefined;
9
9
  schema: Schema;
10
10
  toolbarType: ToolbarType;
11
- hasMultiplePartsWithFormattingSelected?: boolean;
12
- commonActiveMarks?: string[];
13
11
  }
14
- export declare const useFormattingIcons: ({ isToolbarDisabled, textFormattingState, schema, intl, editorAnalyticsAPI, toolbarType, hasMultiplePartsWithFormattingSelected, commonActiveMarks, }: FormattingIconHookProps) => Array<MenuIconItem | null>;
12
+ export declare const useFormattingIcons: ({ isToolbarDisabled, textFormattingState, schema, intl, editorAnalyticsAPI, toolbarType, }: FormattingIconHookProps) => Array<MenuIconItem | null>;
15
13
  type Props = {
16
14
  textFormattingState: TextFormattingState | undefined;
17
15
  iconTypeList: IconTypes[];
@@ -6,9 +6,8 @@ import React from 'react';
6
6
  import { jsx } from '@emotion/react';
7
7
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
8
  import type { MenuIconItem } from './types';
9
- export declare const SingleToolbarButtons: React.MemoExoticComponent<({ items, isReducedSpacing, editorView, hasMultiplePartsWithFormattingSelected, }: {
9
+ export declare const SingleToolbarButtons: React.MemoExoticComponent<({ items, isReducedSpacing, editorView, }: {
10
10
  items: MenuIconItem[];
11
11
  isReducedSpacing: boolean;
12
12
  editorView: EditorView;
13
- hasMultiplePartsWithFormattingSelected?: boolean;
14
13
  }) => jsx.JSX.Element>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-formatting",
3
- "version": "3.0.11",
3
+ "version": "3.0.13",
4
4
  "description": "Text-formatting plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -53,7 +53,7 @@
53
53
  "react-intl-next": "npm:react-intl@^5.18.1"
54
54
  },
55
55
  "peerDependencies": {
56
- "@atlaskit/editor-common": "^107.20.0",
56
+ "@atlaskit/editor-common": "^107.21.0",
57
57
  "react": "^18.2.0"
58
58
  },
59
59
  "devDependencies": {
@@ -113,9 +113,6 @@
113
113
  },
114
114
  "platform_editor_use_preferences_plugin": {
115
115
  "type": "boolean"
116
- },
117
- "platform_editor_common_marks": {
118
- "type": "boolean"
119
116
  }
120
117
  }
121
118
  }
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.hasMultiplePartsWithFormattingInSelection = exports.getCommonActiveMarks = void 0;
7
- var _types = require("./types");
8
- var isMarkInIconTypes = function isMarkInIconTypes(node) {
9
- return node.marks.some(function (mark) {
10
- return Object.values(_types.IconTypes).includes(mark.type.name);
11
- });
12
- };
13
- var hasMultiplePartsWithFormattingInSelection = exports.hasMultiplePartsWithFormattingInSelection = function hasMultiplePartsWithFormattingInSelection(_ref) {
14
- var selectedContent = _ref.selectedContent;
15
- if (!selectedContent) {
16
- return false;
17
- }
18
-
19
- // Check if there are multiple parts with formatting or if only one part has formatting and the rest have none
20
- var contentWithMarks = selectedContent.filter(function (child) {
21
- return isMarkInIconTypes(child);
22
- });
23
- var hasFormatting = contentWithMarks.length > 0;
24
- var allPartsHaveFormatting = contentWithMarks.length === selectedContent.length;
25
- return hasFormatting && (!allPartsHaveFormatting || contentWithMarks.length > 1);
26
- };
27
-
28
- // Clean up when platform_editor_common_marks is removed
29
- var getCommonActiveMarks = exports.getCommonActiveMarks = function getCommonActiveMarks(_ref2) {
30
- var selectedContent = _ref2.selectedContent;
31
- if (!selectedContent || selectedContent.length === 0) {
32
- return [];
33
- }
34
- // filter out fragment node contains only spaces
35
- var filteredSelectedContent = selectedContent.filter(function (child) {
36
- var _child$text;
37
- return ((_child$text = child.text) === null || _child$text === void 0 ? void 0 : _child$text.trim()) !== '';
38
- });
39
- // find the active mark type in first part
40
- var firstPartMarks = selectedContent[0].marks.map(function (mark) {
41
- return mark.type.name;
42
- });
43
- // check if all other parts have the same mark type as the first part and return the common mark types
44
- var commonMarkTypes = firstPartMarks.filter(function (mark) {
45
- return filteredSelectedContent.every(function (child) {
46
- return child.marks.some(function (m) {
47
- return m.type.name === mark;
48
- });
49
- });
50
- });
51
- return commonMarkTypes;
52
- };
@@ -1,34 +0,0 @@
1
- import { IconTypes } from './types';
2
- const isMarkInIconTypes = node => node.marks.some(mark => Object.values(IconTypes).includes(mark.type.name));
3
- export const hasMultiplePartsWithFormattingInSelection = ({
4
- selectedContent
5
- }) => {
6
- if (!selectedContent) {
7
- return false;
8
- }
9
-
10
- // Check if there are multiple parts with formatting or if only one part has formatting and the rest have none
11
- const contentWithMarks = selectedContent.filter(child => isMarkInIconTypes(child));
12
- const hasFormatting = contentWithMarks.length > 0;
13
- const allPartsHaveFormatting = contentWithMarks.length === selectedContent.length;
14
- return hasFormatting && (!allPartsHaveFormatting || contentWithMarks.length > 1);
15
- };
16
-
17
- // Clean up when platform_editor_common_marks is removed
18
- export const getCommonActiveMarks = ({
19
- selectedContent
20
- }) => {
21
- if (!selectedContent || selectedContent.length === 0) {
22
- return [];
23
- }
24
- // filter out fragment node contains only spaces
25
- const filteredSelectedContent = selectedContent.filter(child => {
26
- var _child$text;
27
- return ((_child$text = child.text) === null || _child$text === void 0 ? void 0 : _child$text.trim()) !== '';
28
- });
29
- // find the active mark type in first part
30
- const firstPartMarks = selectedContent[0].marks.map(mark => mark.type.name);
31
- // check if all other parts have the same mark type as the first part and return the common mark types
32
- const commonMarkTypes = firstPartMarks.filter(mark => filteredSelectedContent.every(child => child.marks.some(m => m.type.name === mark)));
33
- return commonMarkTypes;
34
- };
@@ -1,46 +0,0 @@
1
- import { IconTypes } from './types';
2
- var isMarkInIconTypes = function isMarkInIconTypes(node) {
3
- return node.marks.some(function (mark) {
4
- return Object.values(IconTypes).includes(mark.type.name);
5
- });
6
- };
7
- export var hasMultiplePartsWithFormattingInSelection = function hasMultiplePartsWithFormattingInSelection(_ref) {
8
- var selectedContent = _ref.selectedContent;
9
- if (!selectedContent) {
10
- return false;
11
- }
12
-
13
- // Check if there are multiple parts with formatting or if only one part has formatting and the rest have none
14
- var contentWithMarks = selectedContent.filter(function (child) {
15
- return isMarkInIconTypes(child);
16
- });
17
- var hasFormatting = contentWithMarks.length > 0;
18
- var allPartsHaveFormatting = contentWithMarks.length === selectedContent.length;
19
- return hasFormatting && (!allPartsHaveFormatting || contentWithMarks.length > 1);
20
- };
21
-
22
- // Clean up when platform_editor_common_marks is removed
23
- export var getCommonActiveMarks = function getCommonActiveMarks(_ref2) {
24
- var selectedContent = _ref2.selectedContent;
25
- if (!selectedContent || selectedContent.length === 0) {
26
- return [];
27
- }
28
- // filter out fragment node contains only spaces
29
- var filteredSelectedContent = selectedContent.filter(function (child) {
30
- var _child$text;
31
- return ((_child$text = child.text) === null || _child$text === void 0 ? void 0 : _child$text.trim()) !== '';
32
- });
33
- // find the active mark type in first part
34
- var firstPartMarks = selectedContent[0].marks.map(function (mark) {
35
- return mark.type.name;
36
- });
37
- // check if all other parts have the same mark type as the first part and return the common mark types
38
- var commonMarkTypes = firstPartMarks.filter(function (mark) {
39
- return filteredSelectedContent.every(function (child) {
40
- return child.marks.some(function (m) {
41
- return m.type.name === mark;
42
- });
43
- });
44
- });
45
- return commonMarkTypes;
46
- };
@@ -1,7 +0,0 @@
1
- import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
- export declare const hasMultiplePartsWithFormattingInSelection: ({ selectedContent, }: {
3
- selectedContent?: PMNode[];
4
- }) => boolean;
5
- export declare const getCommonActiveMarks: ({ selectedContent }: {
6
- selectedContent?: PMNode[];
7
- }) => string[];
@@ -1,7 +0,0 @@
1
- import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
- export declare const hasMultiplePartsWithFormattingInSelection: ({ selectedContent, }: {
3
- selectedContent?: PMNode[];
4
- }) => boolean;
5
- export declare const getCommonActiveMarks: ({ selectedContent }: {
6
- selectedContent?: PMNode[];
7
- }) => string[];