@atlaskit/editor-plugin-text-formatting 1.15.7 → 1.16.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/input-method-utils.js +15 -0
  3. package/dist/cjs/plugin.js +39 -8
  4. package/dist/cjs/ui/FloatingToolbarComponent.js +71 -0
  5. package/dist/cjs/ui/PrimaryToolbarComponent.js +3 -1
  6. package/dist/cjs/ui/Toolbar/bold-button.js +61 -0
  7. package/dist/cjs/ui/Toolbar/dropdown-menu.js +24 -2
  8. package/dist/cjs/ui/Toolbar/hooks/clear-formatting-icon.js +5 -4
  9. package/dist/cjs/ui/Toolbar/hooks/formatting-icons.js +28 -23
  10. package/dist/cjs/ui/Toolbar/index.js +13 -6
  11. package/dist/cjs/ui/Toolbar/types.js +6 -1
  12. package/dist/es2019/input-method-utils.js +7 -0
  13. package/dist/es2019/plugin.js +39 -8
  14. package/dist/es2019/ui/FloatingToolbarComponent.js +64 -0
  15. package/dist/es2019/ui/PrimaryToolbarComponent.js +3 -1
  16. package/dist/es2019/ui/Toolbar/bold-button.js +54 -0
  17. package/dist/es2019/ui/Toolbar/dropdown-menu.js +24 -2
  18. package/dist/es2019/ui/Toolbar/hooks/clear-formatting-icon.js +4 -3
  19. package/dist/es2019/ui/Toolbar/hooks/formatting-icons.js +28 -23
  20. package/dist/es2019/ui/Toolbar/index.js +13 -6
  21. package/dist/es2019/ui/Toolbar/types.js +5 -0
  22. package/dist/esm/input-method-utils.js +8 -0
  23. package/dist/esm/plugin.js +39 -8
  24. package/dist/esm/ui/FloatingToolbarComponent.js +63 -0
  25. package/dist/esm/ui/PrimaryToolbarComponent.js +3 -1
  26. package/dist/esm/ui/Toolbar/bold-button.js +53 -0
  27. package/dist/esm/ui/Toolbar/dropdown-menu.js +24 -2
  28. package/dist/esm/ui/Toolbar/hooks/clear-formatting-icon.js +5 -4
  29. package/dist/esm/ui/Toolbar/hooks/formatting-icons.js +29 -24
  30. package/dist/esm/ui/Toolbar/index.js +13 -6
  31. package/dist/esm/ui/Toolbar/types.js +5 -0
  32. package/dist/types/commands/clear-formatting.d.ts +2 -2
  33. package/dist/types/input-method-utils.d.ts +6 -0
  34. package/dist/types/ui/FloatingToolbarComponent.d.ts +17 -0
  35. package/dist/types/ui/Toolbar/bold-button.d.ts +17 -0
  36. package/dist/types/ui/Toolbar/dropdown-menu.d.ts +4 -2
  37. package/dist/types/ui/Toolbar/hooks/clear-formatting-icon.d.ts +3 -2
  38. package/dist/types/ui/Toolbar/hooks/formatting-icons.d.ts +3 -2
  39. package/dist/types/ui/Toolbar/index.d.ts +2 -0
  40. package/dist/types/ui/Toolbar/types.d.ts +4 -0
  41. package/dist/types-ts4.5/commands/clear-formatting.d.ts +2 -2
  42. package/dist/types-ts4.5/input-method-utils.d.ts +6 -0
  43. package/dist/types-ts4.5/ui/FloatingToolbarComponent.d.ts +17 -0
  44. package/dist/types-ts4.5/ui/Toolbar/bold-button.d.ts +17 -0
  45. package/dist/types-ts4.5/ui/Toolbar/dropdown-menu.d.ts +4 -2
  46. package/dist/types-ts4.5/ui/Toolbar/hooks/clear-formatting-icon.d.ts +3 -2
  47. package/dist/types-ts4.5/ui/Toolbar/hooks/formatting-icons.d.ts +3 -2
  48. package/dist/types-ts4.5/ui/Toolbar/index.d.ts +2 -0
  49. package/dist/types-ts4.5/ui/Toolbar/types.d.ts +4 -0
  50. package/package.json +6 -5
@@ -1,7 +1,9 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { useCallback, useMemo, useState } from 'react';
3
+ import { toolbarMessages } from '@atlaskit/editor-common/messages';
3
4
  import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
4
5
  import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
6
+ import { BoldToolbarButton } from './bold-button';
5
7
  import { useMenuState } from './hooks/menu-state';
6
8
  import { MoreButton } from './more-button';
7
9
  export var FormattingTextDropdownMenu = /*#__PURE__*/React.memo(function (_ref) {
@@ -12,7 +14,9 @@ export var FormattingTextDropdownMenu = /*#__PURE__*/React.memo(function (_ref)
12
14
  hasFormattingActive = _ref.hasFormattingActive,
13
15
  popupsBoundariesElement = _ref.popupsBoundariesElement,
14
16
  popupsMountPoint = _ref.popupsMountPoint,
15
- popupsScrollableElement = _ref.popupsScrollableElement;
17
+ popupsScrollableElement = _ref.popupsScrollableElement,
18
+ hasMoreButton = _ref.hasMoreButton,
19
+ intl = _ref.intl;
16
20
  var _useMenuState = useMenuState(),
17
21
  _useMenuState2 = _slicedToArray(_useMenuState, 3),
18
22
  isMenuOpen = _useMenuState2[0],
@@ -56,7 +60,7 @@ export var FormattingTextDropdownMenu = /*#__PURE__*/React.memo(function (_ref)
56
60
  }
57
61
  return isOpenedByKeyboard;
58
62
  }
59
- }, /*#__PURE__*/React.createElement(MoreButton, {
63
+ }, hasMoreButton ? /*#__PURE__*/React.createElement(MoreButton, {
60
64
  isSelected: isMenuOpen || hasFormattingActive,
61
65
  label: moreButtonLabel,
62
66
  isReducedSpacing: isReducedSpacing,
@@ -73,5 +77,23 @@ export var FormattingTextDropdownMenu = /*#__PURE__*/React.memo(function (_ref)
73
77
  }
74
78
  },
75
79
  "aria-expanded": isMenuOpen
80
+ }) : /*#__PURE__*/React.createElement(BoldToolbarButton, {
81
+ isReducedSpacing: isReducedSpacing,
82
+ isDisabled: false,
83
+ isSelected: isMenuOpen,
84
+ label: intl.formatMessage(toolbarMessages.textFormat),
85
+ "aria-expanded": isMenuOpen,
86
+ "aria-haspopup": true,
87
+ onClick: function onClick() {
88
+ toggleMenu();
89
+ setIsOpenedByKeyboard(false);
90
+ },
91
+ onKeyDown: function onKeyDown(event) {
92
+ if (event.key === 'Enter' || event.key === ' ') {
93
+ event.preventDefault();
94
+ toggleMenu();
95
+ setIsOpenedByKeyboard(true);
96
+ }
97
+ }
76
98
  }));
77
99
  });
@@ -6,21 +6,22 @@ import { useCallback, useMemo } from 'react';
6
6
 
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { jsx } from '@emotion/react';
9
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
10
9
  import { clearFormatting as clearFormattingKeymap, tooltip } from '@atlaskit/editor-common/keymaps';
11
10
  import { toolbarMessages } from '@atlaskit/editor-common/messages';
12
11
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
13
12
  import { clearFormattingWithAnalytics } from '../../../commands/clear-formatting';
13
+ import { getInputMethod } from '../../../input-method-utils';
14
14
  export var useClearIcon = function useClearIcon(_ref) {
15
15
  var intl = _ref.intl,
16
16
  textFormattingState = _ref.textFormattingState,
17
- editorAnalyticsAPI = _ref.editorAnalyticsAPI;
17
+ editorAnalyticsAPI = _ref.editorAnalyticsAPI,
18
+ toolbarType = _ref.toolbarType;
18
19
  var isPluginAvailable = Boolean(textFormattingState);
19
20
  var formattingIsPresent = Boolean(textFormattingState === null || textFormattingState === void 0 ? void 0 : textFormattingState.formattingIsPresent);
20
21
  var clearFormattingLabel = intl.formatMessage(toolbarMessages.clearFormatting);
21
22
  var clearFormattingToolbar = useCallback(function (state, dispatch) {
22
- return clearFormattingWithAnalytics(INPUT_METHOD.TOOLBAR, editorAnalyticsAPI)(state, dispatch);
23
- }, [editorAnalyticsAPI]);
23
+ return clearFormattingWithAnalytics(getInputMethod(toolbarType), editorAnalyticsAPI)(state, dispatch);
24
+ }, [editorAnalyticsAPI, toolbarType]);
24
25
  return useMemo(function () {
25
26
  if (!isPluginAvailable) {
26
27
  return null;
@@ -8,7 +8,7 @@ import React, { useMemo } from 'react';
8
8
 
9
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
10
  import { jsx } from '@emotion/react';
11
- import { INPUT_METHOD, TOOLBAR_ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
11
+ import { TOOLBAR_ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
12
12
  import { getAriaKeyshortcuts, toggleBold, toggleCode, toggleItalic, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleUnderline, tooltip, ToolTipContent } from '@atlaskit/editor-common/keymaps';
13
13
  import { toolbarMessages } from '@atlaskit/editor-common/messages';
14
14
  import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
@@ -16,15 +16,16 @@ import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
16
16
  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 { toggleCodeWithAnalytics, toggleEmWithAnalytics, toggleStrikeWithAnalytics, toggleStrongWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics, toggleUnderlineWithAnalytics } from '../../../commands';
19
+ import { getInputMethod } from '../../../input-method-utils';
19
20
  import { IconTypes } from '../types';
20
- var withToolbarInputMethod = function withToolbarInputMethod(func) {
21
- return editorCommandToPMCommand(func(INPUT_METHOD.TOOLBAR));
21
+ var withInputMethod = function withInputMethod(toolbarType, func) {
22
+ return editorCommandToPMCommand(func(getInputMethod(toolbarType)));
22
23
  };
23
- var IconButtons = function IconButtons(editorAnalyticsAPI) {
24
+ var IconButtons = function IconButtons(editorAnalyticsAPI, toolbarType) {
24
25
  return {
25
26
  strong: {
26
27
  buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_STRONG,
27
- command: withToolbarInputMethod(toggleStrongWithAnalytics(editorAnalyticsAPI)),
28
+ command: withInputMethod(toolbarType, toggleStrongWithAnalytics(editorAnalyticsAPI)),
28
29
  message: toolbarMessages.bold,
29
30
  tooltipKeymap: toggleBold,
30
31
  component: function component() {
@@ -37,7 +38,7 @@ var IconButtons = function IconButtons(editorAnalyticsAPI) {
37
38
  },
38
39
  em: {
39
40
  buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_ITALIC,
40
- command: withToolbarInputMethod(toggleEmWithAnalytics(editorAnalyticsAPI)),
41
+ command: withInputMethod(toolbarType, toggleEmWithAnalytics(editorAnalyticsAPI)),
41
42
  message: toolbarMessages.italic,
42
43
  tooltipKeymap: toggleItalic,
43
44
  component: function component() {
@@ -49,27 +50,27 @@ var IconButtons = function IconButtons(editorAnalyticsAPI) {
49
50
  }
50
51
  },
51
52
  underline: {
52
- command: withToolbarInputMethod(toggleUnderlineWithAnalytics(editorAnalyticsAPI)),
53
+ command: withInputMethod(toolbarType, toggleUnderlineWithAnalytics(editorAnalyticsAPI)),
53
54
  message: toolbarMessages.underline,
54
55
  tooltipKeymap: toggleUnderline
55
56
  },
56
57
  strike: {
57
- command: withToolbarInputMethod(toggleStrikeWithAnalytics(editorAnalyticsAPI)),
58
+ command: withInputMethod(toolbarType, toggleStrikeWithAnalytics(editorAnalyticsAPI)),
58
59
  message: toolbarMessages.strike,
59
60
  tooltipKeymap: toggleStrikethrough
60
61
  },
61
62
  code: {
62
- command: withToolbarInputMethod(toggleCodeWithAnalytics(editorAnalyticsAPI)),
63
+ command: withInputMethod(toolbarType, toggleCodeWithAnalytics(editorAnalyticsAPI)),
63
64
  message: toolbarMessages.code,
64
65
  tooltipKeymap: toggleCode
65
66
  },
66
67
  subscript: {
67
- command: withToolbarInputMethod(toggleSubscriptWithAnalytics(editorAnalyticsAPI)),
68
+ command: withInputMethod(toolbarType, toggleSubscriptWithAnalytics(editorAnalyticsAPI)),
68
69
  message: toolbarMessages.subscript,
69
70
  tooltipKeymap: toggleSubscript
70
71
  },
71
72
  superscript: {
72
- command: withToolbarInputMethod(toggleSuperscriptWithAnalytics(editorAnalyticsAPI)),
73
+ command: withInputMethod(toolbarType, toggleSuperscriptWithAnalytics(editorAnalyticsAPI)),
73
74
  message: toolbarMessages.superscript,
74
75
  tooltipKeymap: toggleSuperscript
75
76
  }
@@ -80,8 +81,9 @@ var getIcon = function getIcon(_ref) {
80
81
  isDisabled = _ref.isDisabled,
81
82
  isActive = _ref.isActive,
82
83
  intl = _ref.intl,
83
- editorAnalyticsAPI = _ref.editorAnalyticsAPI;
84
- var icon = IconButtons(editorAnalyticsAPI)[iconType];
84
+ editorAnalyticsAPI = _ref.editorAnalyticsAPI,
85
+ toolbarType = _ref.toolbarType;
86
+ var icon = IconButtons(editorAnalyticsAPI, toolbarType)[iconType];
85
87
  var content = intl.formatMessage(icon.message);
86
88
  var tooltipKeymap = icon.tooltipKeymap;
87
89
  return {
@@ -136,7 +138,7 @@ var buildMenuIconState = function buildMenuIconState(iconMark) {
136
138
  };
137
139
  };
138
140
  };
139
- var buildIcon = function buildIcon(iconMark, editorAnalyticsAPI) {
141
+ var buildIcon = function buildIcon(iconMark, editorAnalyticsAPI, toolbarType) {
140
142
  var getState = buildMenuIconState(iconMark);
141
143
  return function (_ref3) {
142
144
  var schema = _ref3.schema,
@@ -157,7 +159,8 @@ var buildIcon = function buildIcon(iconMark, editorAnalyticsAPI) {
157
159
  isDisabled: isToolbarDisabled || isDisabled,
158
160
  isActive: isActive,
159
161
  intl: intl,
160
- editorAnalyticsAPI: editorAnalyticsAPI
162
+ editorAnalyticsAPI: editorAnalyticsAPI,
163
+ toolbarType: toolbarType
161
164
  });
162
165
  }, [isToolbarDisabled, isDisabled, isActive, intl]);
163
166
  var shouldRenderIcon = hasSchemaMark && !isHidden;
@@ -171,20 +174,22 @@ export var useFormattingIcons = function useFormattingIcons(_ref4) {
171
174
  textFormattingState = _ref4.textFormattingState,
172
175
  schema = _ref4.schema,
173
176
  intl = _ref4.intl,
174
- editorAnalyticsAPI = _ref4.editorAnalyticsAPI;
177
+ editorAnalyticsAPI = _ref4.editorAnalyticsAPI,
178
+ toolbarType = _ref4.toolbarType;
175
179
  var props = {
176
180
  schema: schema,
177
181
  textFormattingState: textFormattingState,
178
182
  intl: intl,
179
- isToolbarDisabled: Boolean(isToolbarDisabled)
183
+ isToolbarDisabled: Boolean(isToolbarDisabled),
184
+ toolbarType: toolbarType
180
185
  };
181
- var buildStrongIcon = buildIcon(IconTypes.strong, editorAnalyticsAPI);
182
- var buildEmIcon = buildIcon(IconTypes.em, editorAnalyticsAPI);
183
- var buildUnderlineIcon = buildIcon(IconTypes.underline, editorAnalyticsAPI);
184
- var buildStrikeIcon = buildIcon(IconTypes.strike, editorAnalyticsAPI);
185
- var buildCodeIcon = buildIcon(IconTypes.code, editorAnalyticsAPI);
186
- var buildSubscriptIcon = buildIcon(IconTypes.subscript, editorAnalyticsAPI);
187
- var buildSuperscriptIcon = buildIcon(IconTypes.superscript, editorAnalyticsAPI);
186
+ var buildStrongIcon = buildIcon(IconTypes.strong, editorAnalyticsAPI, toolbarType);
187
+ var buildEmIcon = buildIcon(IconTypes.em, editorAnalyticsAPI, toolbarType);
188
+ var buildUnderlineIcon = buildIcon(IconTypes.underline, editorAnalyticsAPI, toolbarType);
189
+ var buildStrikeIcon = buildIcon(IconTypes.strike, editorAnalyticsAPI, toolbarType);
190
+ var buildCodeIcon = buildIcon(IconTypes.code, editorAnalyticsAPI, toolbarType);
191
+ var buildSubscriptIcon = buildIcon(IconTypes.subscript, editorAnalyticsAPI, toolbarType);
192
+ var buildSuperscriptIcon = buildIcon(IconTypes.superscript, editorAnalyticsAPI, toolbarType);
188
193
  var strongIcon = buildStrongIcon(props);
189
194
  var emIcon = buildEmIcon(props);
190
195
  var underlineIcon = buildUnderlineIcon(props);
@@ -33,7 +33,8 @@ var ToolbarFormatting = function ToolbarFormatting(_ref) {
33
33
  intl = _ref.intl,
34
34
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
35
35
  textFormattingState = _ref.textFormattingState,
36
- api = _ref.api;
36
+ api = _ref.api,
37
+ toolbarType = _ref.toolbarType;
37
38
  var _useState = useState(''),
38
39
  _useState2 = _slicedToArray(_useState, 2),
39
40
  message = _useState2[0],
@@ -43,12 +44,14 @@ var ToolbarFormatting = function ToolbarFormatting(_ref) {
43
44
  intl: intl,
44
45
  isToolbarDisabled: isToolbarDisabled,
45
46
  editorAnalyticsAPI: editorAnalyticsAPI,
46
- textFormattingState: textFormattingState
47
+ textFormattingState: textFormattingState,
48
+ toolbarType: toolbarType
47
49
  });
48
50
  var clearIcon = useClearIcon({
49
51
  textFormattingState: textFormattingState,
50
52
  intl: intl,
51
- editorAnalyticsAPI: editorAnalyticsAPI
53
+ editorAnalyticsAPI: editorAnalyticsAPI,
54
+ toolbarType: toolbarType
52
55
  });
53
56
  var menuIconTypeList = useResponsiveIconTypeMenu({
54
57
  toolbarSize: toolbarSize,
@@ -155,7 +158,9 @@ var ToolbarFormatting = function ToolbarFormatting(_ref) {
155
158
  isReducedSpacing: isReducedSpacing,
156
159
  moreButtonLabel: moreFormattingButtonLabel,
157
160
  hasFormattingActive: hasFormattingActive,
158
- items: items
161
+ hasMoreButton: true,
162
+ items: items,
163
+ intl: intl
159
164
  }))), !(api !== null && api !== void 0 && api.primaryToolbar) && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
160
165
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
161
166
  jsx("span", {
@@ -174,7 +179,8 @@ var Toolbar = function Toolbar(_ref2) {
174
179
  intl = _ref2.intl,
175
180
  editorAnalyticsAPI = _ref2.editorAnalyticsAPI,
176
181
  textFormattingState = _ref2.textFormattingState,
177
- api = _ref2.api;
182
+ api = _ref2.api,
183
+ toolbarType = _ref2.toolbarType;
178
184
  return jsx(ToolbarFormatting, {
179
185
  textFormattingState: textFormattingState,
180
186
  popupsMountPoint: popupsMountPoint,
@@ -186,7 +192,8 @@ var Toolbar = function Toolbar(_ref2) {
186
192
  shouldUseResponsiveToolbar: shouldUseResponsiveToolbar,
187
193
  intl: intl,
188
194
  editorAnalyticsAPI: editorAnalyticsAPI,
189
- api: api
195
+ api: api,
196
+ toolbarType: toolbarType
190
197
  });
191
198
  };
192
199
  export default injectIntl(Toolbar);
@@ -7,4 +7,9 @@ export var IconTypes = /*#__PURE__*/function (IconTypes) {
7
7
  IconTypes["subscript"] = "subscript";
8
8
  IconTypes["superscript"] = "superscript";
9
9
  return IconTypes;
10
+ }({});
11
+ export var ToolbarType = /*#__PURE__*/function (ToolbarType) {
12
+ ToolbarType["PRIMARY"] = "primaryToolbar";
13
+ ToolbarType["FLOATING"] = "floatingToolbar";
14
+ return ToolbarType;
10
15
  }({});
@@ -2,5 +2,5 @@ import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/a
2
2
  import type { Command } from '@atlaskit/editor-common/types';
3
3
  export declare const FORMATTING_NODE_TYPES: string[];
4
4
  export declare const FORMATTING_MARK_TYPES: string[];
5
- export declare function clearFormattingWithAnalytics(inputMethod: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): Command;
6
- export declare function clearFormatting(inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined): Command;
5
+ export declare function clearFormattingWithAnalytics(inputMethod: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): Command;
6
+ export declare function clearFormatting(inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined): Command;
@@ -0,0 +1,6 @@
1
+ import type { InputMethodToolbar } from '@atlaskit/editor-common/types';
2
+ import { ToolbarType } from './ui/Toolbar/types';
3
+ type ToolbarTypeToInputMethodMap = Record<ToolbarType, InputMethodToolbar>;
4
+ export declare const toolbarTypeToInputMethod: ToolbarTypeToInputMethodMap;
5
+ export declare const getInputMethod: (toolbarType: ToolbarType) => InputMethodToolbar;
6
+ export {};
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import type { WrappedComponentProps } from 'react-intl-next';
3
+ import { type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
+ import type { TextFormattingPlugin } from '../plugin';
7
+ export declare const FloatingToolbarTextFormalWithIntl: import("react").FC<import("react-intl-next").WithIntlProps<{
8
+ editorView: EditorView;
9
+ api: ExtractInjectionAPI<TextFormattingPlugin> | undefined;
10
+ editorAnalyticsAPI?: EditorAnalyticsAPI | undefined;
11
+ } & WrappedComponentProps>> & {
12
+ WrappedComponent: import("react").ComponentType<{
13
+ editorView: EditorView;
14
+ api: ExtractInjectionAPI<TextFormattingPlugin> | undefined;
15
+ editorAnalyticsAPI?: EditorAnalyticsAPI | undefined;
16
+ } & WrappedComponentProps>;
17
+ };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import React from 'react';
6
+ import { jsx } from '@emotion/react';
7
+ type BoldButtonProps = {
8
+ label: string;
9
+ isReducedSpacing: boolean;
10
+ isSelected: boolean;
11
+ isDisabled: boolean;
12
+ 'aria-expanded': React.AriaAttributes['aria-expanded'];
13
+ onClick?: (event: React.MouseEvent<HTMLElement>) => void;
14
+ onKeyDown?: (event: React.KeyboardEvent) => void;
15
+ };
16
+ export declare const BoldToolbarButton: ({ label, isReducedSpacing, isDisabled, isSelected, "aria-expanded": ariaExpanded, onClick, onKeyDown, }: BoldButtonProps) => jsx.JSX.Element;
17
+ export {};
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import type { WrappedComponentProps } from 'react-intl-next';
2
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
4
  import type { MenuIconItem } from './types';
4
5
  type DropdownMenuProps = {
@@ -10,6 +11,7 @@ type DropdownMenuProps = {
10
11
  popupsBoundariesElement?: HTMLElement;
11
12
  popupsMountPoint?: HTMLElement;
12
13
  popupsScrollableElement?: HTMLElement;
13
- };
14
- export declare const FormattingTextDropdownMenu: React.MemoExoticComponent<({ editorView, moreButtonLabel, isReducedSpacing, items, hasFormattingActive, popupsBoundariesElement, popupsMountPoint, popupsScrollableElement, }: DropdownMenuProps) => JSX.Element>;
14
+ hasMoreButton: boolean;
15
+ } & WrappedComponentProps;
16
+ export declare const FormattingTextDropdownMenu: React.MemoExoticComponent<({ editorView, moreButtonLabel, isReducedSpacing, items, hasFormattingActive, popupsBoundariesElement, popupsMountPoint, popupsScrollableElement, hasMoreButton, intl, }: DropdownMenuProps) => JSX.Element>;
15
17
  export {};
@@ -1,9 +1,10 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { TextFormattingState } from '@atlaskit/editor-common/types';
3
- import type { IconHookProps, MenuIconItem } from '../types';
3
+ import type { IconHookProps, MenuIconItem, ToolbarType } from '../types';
4
4
  interface ClearIconHookProps extends IconHookProps {
5
5
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
6
6
  textFormattingState: TextFormattingState | undefined;
7
+ toolbarType: ToolbarType;
7
8
  }
8
- export declare const useClearIcon: ({ intl, textFormattingState, editorAnalyticsAPI, }: ClearIconHookProps) => MenuIconItem | null;
9
+ export declare const useClearIcon: ({ intl, textFormattingState, editorAnalyticsAPI, toolbarType, }: ClearIconHookProps) => MenuIconItem | null;
9
10
  export {};
@@ -2,13 +2,14 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { TextFormattingState } from '@atlaskit/editor-common/types';
3
3
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { IconHookProps, MenuIconItem } from '../types';
5
- import { IconTypes } from '../types';
5
+ import { IconTypes, type ToolbarType } from '../types';
6
6
  interface FormattingIconHookProps extends IconHookProps {
7
7
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
8
8
  textFormattingState: TextFormattingState | undefined;
9
9
  schema: Schema;
10
+ toolbarType: ToolbarType;
10
11
  }
11
- export declare const useFormattingIcons: ({ isToolbarDisabled, textFormattingState, schema, intl, editorAnalyticsAPI, }: FormattingIconHookProps) => Array<MenuIconItem | null>;
12
+ export declare const useFormattingIcons: ({ isToolbarDisabled, textFormattingState, schema, intl, editorAnalyticsAPI, toolbarType, }: FormattingIconHookProps) => Array<MenuIconItem | null>;
12
13
  type Props = {
13
14
  textFormattingState: TextFormattingState | undefined;
14
15
  iconTypeList: IconTypes[];
@@ -4,6 +4,7 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
4
  import type { ExtractInjectionAPI, TextFormattingState, ToolbarSize } from '@atlaskit/editor-common/types';
5
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { TextFormattingPlugin } from '../../plugin';
7
+ import type { ToolbarType } from './types';
7
8
  export type ToolbarFormattingProps = {
8
9
  editorView: EditorView;
9
10
  isToolbarDisabled: boolean;
@@ -16,6 +17,7 @@ export type ToolbarFormattingProps = {
16
17
  editorAnalyticsAPI?: EditorAnalyticsAPI;
17
18
  textFormattingState: TextFormattingState | undefined;
18
19
  api: ExtractInjectionAPI<TextFormattingPlugin> | undefined;
20
+ toolbarType: ToolbarType;
19
21
  };
20
22
  declare const _default: import("react").FC<import("react-intl-next").WithIntlProps<ToolbarFormattingProps & WrappedComponentProps>> & {
21
23
  WrappedComponent: import("react").ComponentType<ToolbarFormattingProps & WrappedComponentProps>;
@@ -28,3 +28,7 @@ export type MenuIconState = {
28
28
  export type IconHookProps = {
29
29
  isToolbarDisabled?: boolean;
30
30
  } & WrappedComponentProps;
31
+ export declare enum ToolbarType {
32
+ PRIMARY = "primaryToolbar",
33
+ FLOATING = "floatingToolbar"
34
+ }
@@ -2,5 +2,5 @@ import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/a
2
2
  import type { Command } from '@atlaskit/editor-common/types';
3
3
  export declare const FORMATTING_NODE_TYPES: string[];
4
4
  export declare const FORMATTING_MARK_TYPES: string[];
5
- export declare function clearFormattingWithAnalytics(inputMethod: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): Command;
6
- export declare function clearFormatting(inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined): Command;
5
+ export declare function clearFormattingWithAnalytics(inputMethod: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): Command;
6
+ export declare function clearFormatting(inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined): Command;
@@ -0,0 +1,6 @@
1
+ import type { InputMethodToolbar } from '@atlaskit/editor-common/types';
2
+ import { ToolbarType } from './ui/Toolbar/types';
3
+ type ToolbarTypeToInputMethodMap = Record<ToolbarType, InputMethodToolbar>;
4
+ export declare const toolbarTypeToInputMethod: ToolbarTypeToInputMethodMap;
5
+ export declare const getInputMethod: (toolbarType: ToolbarType) => InputMethodToolbar;
6
+ export {};
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import type { WrappedComponentProps } from 'react-intl-next';
3
+ import { type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
+ import type { TextFormattingPlugin } from '../plugin';
7
+ export declare const FloatingToolbarTextFormalWithIntl: import("react").FC<import("react-intl-next").WithIntlProps<{
8
+ editorView: EditorView;
9
+ api: ExtractInjectionAPI<TextFormattingPlugin> | undefined;
10
+ editorAnalyticsAPI?: EditorAnalyticsAPI | undefined;
11
+ } & WrappedComponentProps>> & {
12
+ WrappedComponent: import("react").ComponentType<{
13
+ editorView: EditorView;
14
+ api: ExtractInjectionAPI<TextFormattingPlugin> | undefined;
15
+ editorAnalyticsAPI?: EditorAnalyticsAPI | undefined;
16
+ } & WrappedComponentProps>;
17
+ };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import React from 'react';
6
+ import { jsx } from '@emotion/react';
7
+ type BoldButtonProps = {
8
+ label: string;
9
+ isReducedSpacing: boolean;
10
+ isSelected: boolean;
11
+ isDisabled: boolean;
12
+ 'aria-expanded': React.AriaAttributes['aria-expanded'];
13
+ onClick?: (event: React.MouseEvent<HTMLElement>) => void;
14
+ onKeyDown?: (event: React.KeyboardEvent) => void;
15
+ };
16
+ export declare const BoldToolbarButton: ({ label, isReducedSpacing, isDisabled, isSelected, "aria-expanded": ariaExpanded, onClick, onKeyDown, }: BoldButtonProps) => jsx.JSX.Element;
17
+ export {};
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import type { WrappedComponentProps } from 'react-intl-next';
2
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
4
  import type { MenuIconItem } from './types';
4
5
  type DropdownMenuProps = {
@@ -10,6 +11,7 @@ type DropdownMenuProps = {
10
11
  popupsBoundariesElement?: HTMLElement;
11
12
  popupsMountPoint?: HTMLElement;
12
13
  popupsScrollableElement?: HTMLElement;
13
- };
14
- export declare const FormattingTextDropdownMenu: React.MemoExoticComponent<({ editorView, moreButtonLabel, isReducedSpacing, items, hasFormattingActive, popupsBoundariesElement, popupsMountPoint, popupsScrollableElement, }: DropdownMenuProps) => JSX.Element>;
14
+ hasMoreButton: boolean;
15
+ } & WrappedComponentProps;
16
+ export declare const FormattingTextDropdownMenu: React.MemoExoticComponent<({ editorView, moreButtonLabel, isReducedSpacing, items, hasFormattingActive, popupsBoundariesElement, popupsMountPoint, popupsScrollableElement, hasMoreButton, intl, }: DropdownMenuProps) => JSX.Element>;
15
17
  export {};
@@ -1,9 +1,10 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { TextFormattingState } from '@atlaskit/editor-common/types';
3
- import type { IconHookProps, MenuIconItem } from '../types';
3
+ import type { IconHookProps, MenuIconItem, ToolbarType } from '../types';
4
4
  interface ClearIconHookProps extends IconHookProps {
5
5
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
6
6
  textFormattingState: TextFormattingState | undefined;
7
+ toolbarType: ToolbarType;
7
8
  }
8
- export declare const useClearIcon: ({ intl, textFormattingState, editorAnalyticsAPI, }: ClearIconHookProps) => MenuIconItem | null;
9
+ export declare const useClearIcon: ({ intl, textFormattingState, editorAnalyticsAPI, toolbarType, }: ClearIconHookProps) => MenuIconItem | null;
9
10
  export {};
@@ -2,13 +2,14 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { TextFormattingState } from '@atlaskit/editor-common/types';
3
3
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { IconHookProps, MenuIconItem } from '../types';
5
- import { IconTypes } from '../types';
5
+ import { IconTypes, type ToolbarType } from '../types';
6
6
  interface FormattingIconHookProps extends IconHookProps {
7
7
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
8
8
  textFormattingState: TextFormattingState | undefined;
9
9
  schema: Schema;
10
+ toolbarType: ToolbarType;
10
11
  }
11
- export declare const useFormattingIcons: ({ isToolbarDisabled, textFormattingState, schema, intl, editorAnalyticsAPI, }: FormattingIconHookProps) => Array<MenuIconItem | null>;
12
+ export declare const useFormattingIcons: ({ isToolbarDisabled, textFormattingState, schema, intl, editorAnalyticsAPI, toolbarType, }: FormattingIconHookProps) => Array<MenuIconItem | null>;
12
13
  type Props = {
13
14
  textFormattingState: TextFormattingState | undefined;
14
15
  iconTypeList: IconTypes[];
@@ -4,6 +4,7 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
4
  import type { ExtractInjectionAPI, TextFormattingState, ToolbarSize } from '@atlaskit/editor-common/types';
5
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { TextFormattingPlugin } from '../../plugin';
7
+ import type { ToolbarType } from './types';
7
8
  export type ToolbarFormattingProps = {
8
9
  editorView: EditorView;
9
10
  isToolbarDisabled: boolean;
@@ -16,6 +17,7 @@ export type ToolbarFormattingProps = {
16
17
  editorAnalyticsAPI?: EditorAnalyticsAPI;
17
18
  textFormattingState: TextFormattingState | undefined;
18
19
  api: ExtractInjectionAPI<TextFormattingPlugin> | undefined;
20
+ toolbarType: ToolbarType;
19
21
  };
20
22
  declare const _default: import("react").FC<import("react-intl-next").WithIntlProps<ToolbarFormattingProps & WrappedComponentProps>> & {
21
23
  WrappedComponent: import("react").ComponentType<ToolbarFormattingProps & WrappedComponentProps>;
@@ -28,3 +28,7 @@ export type MenuIconState = {
28
28
  export type IconHookProps = {
29
29
  isToolbarDisabled?: boolean;
30
30
  } & WrappedComponentProps;
31
+ export declare enum ToolbarType {
32
+ PRIMARY = "primaryToolbar",
33
+ FLOATING = "floatingToolbar"
34
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-formatting",
3
- "version": "1.15.7",
3
+ "version": "1.16.0",
4
4
  "description": "Text-formatting plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,16 +32,17 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^46.1.0",
35
- "@atlaskit/editor-common": "^95.7.0",
35
+ "@atlaskit/editor-common": "^95.10.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
37
  "@atlaskit/editor-plugin-primary-toolbar": "^2.0.0",
38
- "@atlaskit/editor-prosemirror": "6.0.0",
38
+ "@atlaskit/editor-prosemirror": "6.2.1",
39
39
  "@atlaskit/editor-shared-styles": "^3.2.0",
40
40
  "@atlaskit/editor-tables": "^2.8.0",
41
- "@atlaskit/icon": "^22.26.0",
41
+ "@atlaskit/icon": "^22.28.0",
42
42
  "@atlaskit/platform-feature-flags": "^0.3.0",
43
43
  "@atlaskit/prosemirror-input-rules": "^3.2.0",
44
- "@atlaskit/tokens": "^2.3.0",
44
+ "@atlaskit/tmp-editor-statsig": "^2.21.0",
45
+ "@atlaskit/tokens": "^2.4.0",
45
46
  "@babel/runtime": "^7.0.0",
46
47
  "@emotion/react": "^11.7.1",
47
48
  "react-intl-next": "npm:react-intl@^5.18.1"