@atlaskit/editor-plugin-text-formatting 3.0.26 → 3.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-text-formatting
2
2
 
3
+ ## 3.0.27
4
+
5
+ ### Patch Changes
6
+
7
+ - [`51f3f2db61f6e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/51f3f2db61f6e) -
8
+ Update toolbar config across plugins
9
+ - Updated dependencies
10
+
3
11
  ## 3.0.26
4
12
 
5
13
  ### Patch Changes
@@ -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.MoreFormattingMenu = exports.FormatMenuItem = exports.FormatButton = exports.ClearFormatMenuItem = void 0;
7
+ exports.MoreFormattingMenu = exports.MenuSection = exports.FormatMenuItem = exports.FormatButton = exports.ClearFormatMenuItem = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _reactIntlNext = require("react-intl-next");
10
10
  var _hooks = require("@atlaskit/editor-common/hooks");
@@ -140,4 +140,16 @@ var MoreFormattingMenu = exports.MoreFormattingMenu = function MoreFormattingMen
140
140
  }),
141
141
  label: content
142
142
  }, children);
143
+ };
144
+ var MenuSection = exports.MenuSection = function MenuSection(_ref5) {
145
+ var children = _ref5.children,
146
+ title = _ref5.title,
147
+ parents = _ref5.parents;
148
+ var hasSeparator = parents.some(function (parent) {
149
+ return parent.key === _toolbar.TEXT_COLLAPSED_MENU.key;
150
+ });
151
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
152
+ hasSeparator: hasSeparator,
153
+ title: title
154
+ }, children);
143
155
  };
@@ -10,6 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
  var _toolbar = require("@atlaskit/editor-common/toolbar");
12
12
  var _editorToolbar = require("@atlaskit/editor-toolbar");
13
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
14
  var _Component = require("./Toolbar/components/Component");
14
15
  var _utils = require("./Toolbar/components/utils");
15
16
  var _types = require("./Toolbar/types");
@@ -100,7 +101,12 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
100
101
  type: _toolbar.TEXT_FORMATTING_MENU.type,
101
102
  key: _toolbar.TEXT_FORMATTING_MENU.key,
102
103
  rank: _toolbar.TEXT_FORMAT_MENU_RANK[_toolbar.TEXT_FORMATTING_MENU_SECTION.key]
103
- }]
104
+ }].concat((0, _toConsumableArray2.default)((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? [{
105
+ type: _toolbar.TEXT_COLLAPSED_MENU.type,
106
+ key: _toolbar.TEXT_COLLAPSED_MENU.key,
107
+ rank: _toolbar.TEXT_COLLAPSED_MENU_RANK[_toolbar.TEXT_FORMATTING_MENU_SECTION.key]
108
+ }] : [])),
109
+ component: (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? _Component.MenuSection : undefined
104
110
  }].concat((0, _toConsumableArray2.default)(getFormatMenuItems(api)), [{
105
111
  type: _toolbar.CLEAR_FORMARTTING_MENU_SECTION.type,
106
112
  key: _toolbar.CLEAR_FORMARTTING_MENU_SECTION.key,
@@ -108,7 +114,11 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
108
114
  type: _toolbar.TEXT_FORMATTING_MENU.type,
109
115
  key: _toolbar.TEXT_FORMATTING_MENU.key,
110
116
  rank: _toolbar.TEXT_FORMAT_MENU_RANK[_toolbar.CLEAR_FORMARTTING_MENU_SECTION.key]
111
- }],
117
+ }].concat((0, _toConsumableArray2.default)((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? [{
118
+ type: _toolbar.TEXT_COLLAPSED_MENU.type,
119
+ key: _toolbar.TEXT_COLLAPSED_MENU.key,
120
+ rank: _toolbar.TEXT_COLLAPSED_MENU_RANK[_toolbar.CLEAR_FORMARTTING_MENU_SECTION.key]
121
+ }] : [])),
112
122
  component: function component(_ref6) {
113
123
  var children = _ref6.children;
114
124
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
@@ -3,8 +3,8 @@ import { useIntl } from 'react-intl-next';
3
3
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
4
  import { ToolTipContent, 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';
7
- import { ToolbarButton, ToolbarDropdownItem, ClearFormattingIcon, ToolbarKeyboardShortcutHint, ToolbarDropdownMenu, MoreItemsIcon, ToolbarTooltip } from '@atlaskit/editor-toolbar';
6
+ import { getInputMethodFromParentKeys, TEXT_COLLAPSED_MENU } from '@atlaskit/editor-common/toolbar';
7
+ import { ToolbarButton, ToolbarDropdownItem, ClearFormattingIcon, ToolbarKeyboardShortcutHint, ToolbarDropdownMenu, MoreItemsIcon, ToolbarTooltip, ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
8
8
  import { clearFormattingWithAnalyticsNext } from '../../../editor-commands/clear-formatting';
9
9
  import { useComponentInfo } from './utils';
10
10
  export const FormatMenuItem = ({
@@ -142,4 +142,15 @@ export const MoreFormattingMenu = ({
142
142
  }),
143
143
  label: content
144
144
  }, children);
145
+ };
146
+ export const MenuSection = ({
147
+ children,
148
+ title,
149
+ parents
150
+ }) => {
151
+ const hasSeparator = parents.some(parent => parent.key === TEXT_COLLAPSED_MENU.key);
152
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
153
+ hasSeparator: hasSeparator,
154
+ title: title
155
+ }, children);
145
156
  };
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- import { CLEAR_FORMARTTING_MENU_SECTION, CLEAR_FORMATTING_MENU_ITEM, TEXT_FORMATTING_GROUP, TEXT_FORMATTING_HERO_BUTTON, TEXT_FORMATTING_MENU, TEXT_FORMATTING_MENU_SECTION, TEXT_SECTION, TEXT_SECTION_RANK, TEXT_FORMAT_GROUP_RANK, TEXT_FORMAT_MENU_RANK, CLEAR_FORMARTTING_MENU_SECTION_RANK } from '@atlaskit/editor-common/toolbar';
2
+ import { CLEAR_FORMARTTING_MENU_SECTION, CLEAR_FORMATTING_MENU_ITEM, TEXT_FORMATTING_GROUP, TEXT_FORMATTING_HERO_BUTTON, TEXT_FORMATTING_MENU, TEXT_FORMATTING_MENU_SECTION, TEXT_SECTION, TEXT_SECTION_RANK, TEXT_FORMAT_GROUP_RANK, TEXT_FORMAT_MENU_RANK, CLEAR_FORMARTTING_MENU_SECTION_RANK, TEXT_COLLAPSED_MENU_RANK, TEXT_COLLAPSED_MENU } from '@atlaskit/editor-common/toolbar';
3
3
  import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
4
- import { FormatMenuItem, FormatButton, ClearFormatMenuItem, MoreFormattingMenu } from './Toolbar/components/Component';
4
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
+ import { FormatMenuItem, FormatButton, ClearFormatMenuItem, MoreFormattingMenu, MenuSection } from './Toolbar/components/Component';
5
6
  import { formatOptions } from './Toolbar/components/utils';
6
7
  import { FormatOptions } from './Toolbar/types';
7
8
  const getFormatMenuItems = api => {
@@ -92,7 +93,12 @@ export const getToolbarComponents = api => [{
92
93
  type: TEXT_FORMATTING_MENU.type,
93
94
  key: TEXT_FORMATTING_MENU.key,
94
95
  rank: TEXT_FORMAT_MENU_RANK[TEXT_FORMATTING_MENU_SECTION.key]
95
- }]
96
+ }, ...(expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? [{
97
+ type: TEXT_COLLAPSED_MENU.type,
98
+ key: TEXT_COLLAPSED_MENU.key,
99
+ rank: TEXT_COLLAPSED_MENU_RANK[TEXT_FORMATTING_MENU_SECTION.key]
100
+ }] : [])],
101
+ component: expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? MenuSection : undefined
96
102
  }, ...getFormatMenuItems(api), {
97
103
  type: CLEAR_FORMARTTING_MENU_SECTION.type,
98
104
  key: CLEAR_FORMARTTING_MENU_SECTION.key,
@@ -100,7 +106,11 @@ export const getToolbarComponents = api => [{
100
106
  type: TEXT_FORMATTING_MENU.type,
101
107
  key: TEXT_FORMATTING_MENU.key,
102
108
  rank: TEXT_FORMAT_MENU_RANK[CLEAR_FORMARTTING_MENU_SECTION.key]
103
- }],
109
+ }, ...(expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? [{
110
+ type: TEXT_COLLAPSED_MENU.type,
111
+ key: TEXT_COLLAPSED_MENU.key,
112
+ rank: TEXT_COLLAPSED_MENU_RANK[CLEAR_FORMARTTING_MENU_SECTION.key]
113
+ }] : [])],
104
114
  component: ({
105
115
  children
106
116
  }) => {
@@ -3,8 +3,8 @@ import { useIntl } from 'react-intl-next';
3
3
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
4
  import { ToolTipContent, 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';
7
- import { ToolbarButton, ToolbarDropdownItem, ClearFormattingIcon, ToolbarKeyboardShortcutHint, ToolbarDropdownMenu, MoreItemsIcon, ToolbarTooltip } from '@atlaskit/editor-toolbar';
6
+ import { getInputMethodFromParentKeys, TEXT_COLLAPSED_MENU } from '@atlaskit/editor-common/toolbar';
7
+ import { ToolbarButton, ToolbarDropdownItem, ClearFormattingIcon, ToolbarKeyboardShortcutHint, ToolbarDropdownMenu, MoreItemsIcon, ToolbarTooltip, ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
8
8
  import { clearFormattingWithAnalyticsNext } from '../../../editor-commands/clear-formatting';
9
9
  import { useComponentInfo } from './utils';
10
10
  export var FormatMenuItem = function FormatMenuItem(_ref) {
@@ -133,4 +133,16 @@ export var MoreFormattingMenu = function MoreFormattingMenu(_ref4) {
133
133
  }),
134
134
  label: content
135
135
  }, children);
136
+ };
137
+ export var MenuSection = function MenuSection(_ref5) {
138
+ var children = _ref5.children,
139
+ title = _ref5.title,
140
+ parents = _ref5.parents;
141
+ var hasSeparator = parents.some(function (parent) {
142
+ return parent.key === TEXT_COLLAPSED_MENU.key;
143
+ });
144
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
145
+ hasSeparator: hasSeparator,
146
+ title: title
147
+ }, children);
136
148
  };
@@ -1,9 +1,10 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import React from 'react';
4
- import { CLEAR_FORMARTTING_MENU_SECTION, CLEAR_FORMATTING_MENU_ITEM, TEXT_FORMATTING_GROUP, TEXT_FORMATTING_HERO_BUTTON, TEXT_FORMATTING_MENU, TEXT_FORMATTING_MENU_SECTION, TEXT_SECTION, TEXT_SECTION_RANK, TEXT_FORMAT_GROUP_RANK, TEXT_FORMAT_MENU_RANK, CLEAR_FORMARTTING_MENU_SECTION_RANK } from '@atlaskit/editor-common/toolbar';
4
+ import { CLEAR_FORMARTTING_MENU_SECTION, CLEAR_FORMATTING_MENU_ITEM, TEXT_FORMATTING_GROUP, TEXT_FORMATTING_HERO_BUTTON, TEXT_FORMATTING_MENU, TEXT_FORMATTING_MENU_SECTION, TEXT_SECTION, TEXT_SECTION_RANK, TEXT_FORMAT_GROUP_RANK, TEXT_FORMAT_MENU_RANK, CLEAR_FORMARTTING_MENU_SECTION_RANK, TEXT_COLLAPSED_MENU_RANK, TEXT_COLLAPSED_MENU } from '@atlaskit/editor-common/toolbar';
5
5
  import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
6
- import { FormatMenuItem, FormatButton, ClearFormatMenuItem, MoreFormattingMenu } from './Toolbar/components/Component';
6
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
+ import { FormatMenuItem, FormatButton, ClearFormatMenuItem, MoreFormattingMenu, MenuSection } from './Toolbar/components/Component';
7
8
  import { formatOptions } from './Toolbar/components/utils';
8
9
  import { FormatOptions } from './Toolbar/types';
9
10
  var getFormatMenuItems = function getFormatMenuItems(api) {
@@ -93,7 +94,12 @@ export var getToolbarComponents = function getToolbarComponents(api) {
93
94
  type: TEXT_FORMATTING_MENU.type,
94
95
  key: TEXT_FORMATTING_MENU.key,
95
96
  rank: TEXT_FORMAT_MENU_RANK[TEXT_FORMATTING_MENU_SECTION.key]
96
- }]
97
+ }].concat(_toConsumableArray(expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? [{
98
+ type: TEXT_COLLAPSED_MENU.type,
99
+ key: TEXT_COLLAPSED_MENU.key,
100
+ rank: TEXT_COLLAPSED_MENU_RANK[TEXT_FORMATTING_MENU_SECTION.key]
101
+ }] : [])),
102
+ component: expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? MenuSection : undefined
97
103
  }].concat(_toConsumableArray(getFormatMenuItems(api)), [{
98
104
  type: CLEAR_FORMARTTING_MENU_SECTION.type,
99
105
  key: CLEAR_FORMARTTING_MENU_SECTION.key,
@@ -101,7 +107,11 @@ export var getToolbarComponents = function getToolbarComponents(api) {
101
107
  type: TEXT_FORMATTING_MENU.type,
102
108
  key: TEXT_FORMATTING_MENU.key,
103
109
  rank: TEXT_FORMAT_MENU_RANK[CLEAR_FORMARTTING_MENU_SECTION.key]
104
- }],
110
+ }].concat(_toConsumableArray(expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? [{
111
+ type: TEXT_COLLAPSED_MENU.type,
112
+ key: TEXT_COLLAPSED_MENU.key,
113
+ rank: TEXT_COLLAPSED_MENU_RANK[CLEAR_FORMARTTING_MENU_SECTION.key]
114
+ }] : [])),
105
115
  component: function component(_ref6) {
106
116
  var children = _ref6.children;
107
117
  return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import React from 'react';
3
+ import type { CommonComponentProps } from '@atlaskit/editor-toolbar-model';
3
4
  import type { FormatComponentProps } from './utils';
4
5
  export declare const FormatMenuItem: ({ parents, api, optionType, toggleMarkWithAnalyticsCallback, icon, shortcut, title, }: FormatComponentProps) => React.JSX.Element | null;
5
6
  export declare const FormatButton: ({ parents, api, optionType, toggleMarkWithAnalyticsCallback, icon, shortcut, title, }: FormatComponentProps) => React.JSX.Element;
@@ -7,3 +8,8 @@ export declare const ClearFormatMenuItem: ({ api, parents, }: Pick<FormatCompone
7
8
  export declare const MoreFormattingMenu: ({ children }: {
8
9
  children?: ReactNode;
9
10
  }) => React.JSX.Element;
11
+ export declare const MenuSection: ({ children, title, parents, }: {
12
+ children?: ReactNode;
13
+ parents: CommonComponentProps["parents"];
14
+ title?: string;
15
+ }) => React.JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import React from 'react';
3
+ import type { CommonComponentProps } from '@atlaskit/editor-toolbar-model';
3
4
  import type { FormatComponentProps } from './utils';
4
5
  export declare const FormatMenuItem: ({ parents, api, optionType, toggleMarkWithAnalyticsCallback, icon, shortcut, title, }: FormatComponentProps) => React.JSX.Element | null;
5
6
  export declare const FormatButton: ({ parents, api, optionType, toggleMarkWithAnalyticsCallback, icon, shortcut, title, }: FormatComponentProps) => React.JSX.Element;
@@ -7,3 +8,8 @@ export declare const ClearFormatMenuItem: ({ api, parents, }: Pick<FormatCompone
7
8
  export declare const MoreFormattingMenu: ({ children }: {
8
9
  children?: ReactNode;
9
10
  }) => React.JSX.Element;
11
+ export declare const MenuSection: ({ children, title, parents, }: {
12
+ children?: ReactNode;
13
+ parents: CommonComponentProps["parents"];
14
+ title?: string;
15
+ }) => React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-formatting",
3
- "version": "3.0.26",
3
+ "version": "3.0.27",
4
4
  "description": "Text-formatting plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -38,19 +38,19 @@
38
38
  "@atlaskit/editor-prosemirror": "7.0.0",
39
39
  "@atlaskit/editor-shared-styles": "^3.6.0",
40
40
  "@atlaskit/editor-tables": "^2.9.0",
41
- "@atlaskit/editor-toolbar": "^0.5.0",
42
- "@atlaskit/editor-toolbar-model": "^0.1.0",
41
+ "@atlaskit/editor-toolbar": "^0.6.0",
42
+ "@atlaskit/editor-toolbar-model": "^0.2.0",
43
43
  "@atlaskit/icon": "^28.1.0",
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
45
  "@atlaskit/prosemirror-input-rules": "^3.4.0",
46
- "@atlaskit/tmp-editor-statsig": "^11.9.0",
46
+ "@atlaskit/tmp-editor-statsig": "^11.11.0",
47
47
  "@atlaskit/tokens": "^6.1.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@emotion/react": "^11.7.1",
50
50
  "react-intl-next": "npm:react-intl@^5.18.1"
51
51
  },
52
52
  "peerDependencies": {
53
- "@atlaskit/editor-common": "^107.33.0",
53
+ "@atlaskit/editor-common": "^107.34.0",
54
54
  "react": "^18.2.0"
55
55
  },
56
56
  "devDependencies": {