@atlaskit/editor-plugin-text-formatting 5.2.2 → 5.3.1

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 (32) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/ui/Toolbar/components/BoldButtonGroup.js +63 -0
  3. package/dist/cjs/ui/Toolbar/components/TextFormattingGroupForInlineToolbar.js +53 -0
  4. package/dist/cjs/ui/Toolbar/components/TextFormattingGroups.js +111 -0
  5. package/dist/cjs/ui/Toolbar/components/TextFormattingMenuGroup.js +118 -0
  6. package/dist/cjs/ui/Toolbar/components/UnderlineButtonGroup.js +63 -0
  7. package/dist/cjs/ui/toolbar-components.js +20 -47
  8. package/dist/es2019/ui/Toolbar/components/BoldButtonGroup.js +59 -0
  9. package/dist/es2019/ui/Toolbar/components/TextFormattingGroupForInlineToolbar.js +47 -0
  10. package/dist/es2019/ui/Toolbar/components/TextFormattingGroups.js +112 -0
  11. package/dist/es2019/ui/Toolbar/components/TextFormattingMenuGroup.js +109 -0
  12. package/dist/es2019/ui/Toolbar/components/UnderlineButtonGroup.js +59 -0
  13. package/dist/es2019/ui/toolbar-components.js +12 -37
  14. package/dist/esm/ui/Toolbar/components/BoldButtonGroup.js +56 -0
  15. package/dist/esm/ui/Toolbar/components/TextFormattingGroupForInlineToolbar.js +46 -0
  16. package/dist/esm/ui/Toolbar/components/TextFormattingGroups.js +104 -0
  17. package/dist/esm/ui/Toolbar/components/TextFormattingMenuGroup.js +111 -0
  18. package/dist/esm/ui/Toolbar/components/UnderlineButtonGroup.js +56 -0
  19. package/dist/esm/ui/toolbar-components.js +20 -47
  20. package/dist/types/ui/Toolbar/components/BoldButtonGroup.d.ts +4 -0
  21. package/dist/types/ui/Toolbar/components/TextFormattingGroupForInlineToolbar.d.ts +4 -0
  22. package/dist/types/ui/Toolbar/components/TextFormattingGroups.d.ts +4 -0
  23. package/dist/types/ui/Toolbar/components/TextFormattingMenuGroup.d.ts +4 -0
  24. package/dist/types/ui/Toolbar/components/UnderlineButtonGroup.d.ts +4 -0
  25. package/dist/types/ui/toolbar-components.d.ts +1 -0
  26. package/dist/types-ts4.5/ui/Toolbar/components/BoldButtonGroup.d.ts +4 -0
  27. package/dist/types-ts4.5/ui/Toolbar/components/TextFormattingGroupForInlineToolbar.d.ts +4 -0
  28. package/dist/types-ts4.5/ui/Toolbar/components/TextFormattingGroups.d.ts +4 -0
  29. package/dist/types-ts4.5/ui/Toolbar/components/TextFormattingMenuGroup.d.ts +4 -0
  30. package/dist/types-ts4.5/ui/Toolbar/components/UnderlineButtonGroup.d.ts +4 -0
  31. package/dist/types-ts4.5/ui/toolbar-components.d.ts +1 -0
  32. package/package.json +7 -7
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+ import { UNDERLINE_BUTTON_GROUP, UNDERLINE_BUTTON, TEXT_SECTION_PRIMARY_TOOLBAR, TEXT_FORMAT_GROUP_RANK, useEditorToolbar } from '@atlaskit/editor-common/toolbar';
3
+ import { Show, ToolbarButtonGroup } from '@atlaskit/editor-toolbar';
4
+ import { FormatOptions } from '../types';
5
+ import { FormatButton } from './Component';
6
+ import { formatOptions } from './utils';
7
+ var UnderlineButtonGroup = function UnderlineButtonGroup(_ref) {
8
+ var children = _ref.children;
9
+ var _useEditorToolbar = useEditorToolbar(),
10
+ editorAppearance = _useEditorToolbar.editorAppearance;
11
+ if (editorAppearance === 'full-page') {
12
+ return /*#__PURE__*/React.createElement(Show, {
13
+ above: "xl"
14
+ }, /*#__PURE__*/React.createElement(ToolbarButtonGroup, null, children));
15
+ }
16
+ };
17
+ export var underlineButtonGroup = function underlineButtonGroup(api) {
18
+ return [{
19
+ type: UNDERLINE_BUTTON_GROUP.type,
20
+ key: UNDERLINE_BUTTON_GROUP.key,
21
+ parents: [{
22
+ type: TEXT_SECTION_PRIMARY_TOOLBAR.type,
23
+ key: TEXT_SECTION_PRIMARY_TOOLBAR.key,
24
+ rank: TEXT_FORMAT_GROUP_RANK[UNDERLINE_BUTTON_GROUP.key]
25
+ }],
26
+ component: function component(_ref2) {
27
+ var children = _ref2.children;
28
+ return /*#__PURE__*/React.createElement(UnderlineButtonGroup, null, children);
29
+ }
30
+ }, {
31
+ type: UNDERLINE_BUTTON.type,
32
+ key: UNDERLINE_BUTTON.key,
33
+ parents: [{
34
+ type: UNDERLINE_BUTTON_GROUP.type,
35
+ key: UNDERLINE_BUTTON_GROUP.key,
36
+ rank: 100
37
+ }],
38
+ component: function component(_ref3) {
39
+ var parents = _ref3.parents;
40
+ var _formatOptions$underl = formatOptions().underline,
41
+ icon = _formatOptions$underl.icon,
42
+ command = _formatOptions$underl.command,
43
+ shortcut = _formatOptions$underl.shortcut,
44
+ title = _formatOptions$underl.title;
45
+ return /*#__PURE__*/React.createElement(FormatButton, {
46
+ api: api,
47
+ parents: parents,
48
+ icon: icon,
49
+ title: title,
50
+ shortcut: shortcut,
51
+ optionType: FormatOptions.underline,
52
+ toggleMarkWithAnalyticsCallback: command
53
+ });
54
+ }
55
+ }];
56
+ };
@@ -1,48 +1,18 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
2
  import React from 'react';
4
3
  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
4
  import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
6
5
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
- import { FormatMenuItem, FormatButton, ClearFormatMenuItem, MoreFormattingMenu, MenuSection } from './Toolbar/components/Component';
6
+ import { boldButtonGroup } from './Toolbar/components/BoldButtonGroup';
7
+ import { FormatButton, ClearFormatMenuItem, MoreFormattingMenu, MenuSection } from './Toolbar/components/Component';
8
+ import { textFormattingGroupForInlineToolbar } from './Toolbar/components/TextFormattingGroupForInlineToolbar';
9
+ import { textFormattingGroupForPrimaryToolbar } from './Toolbar/components/TextFormattingGroups';
10
+ import { textFormattingMenuGroup } from './Toolbar/components/TextFormattingMenuGroup';
11
+ import { underlineButtonGroup } from './Toolbar/components/UnderlineButtonGroup';
8
12
  import { formatOptions } from './Toolbar/components/utils';
9
13
  import { FormatOptions } from './Toolbar/types';
10
- var getFormatMenuItems = function getFormatMenuItems(api) {
11
- return Object.entries(formatOptions()).map(function (_ref) {
12
- var _ref2 = _slicedToArray(_ref, 2),
13
- optionType = _ref2[0],
14
- _ref2$ = _ref2[1],
15
- icon = _ref2$.icon,
16
- shortcut = _ref2$.shortcut,
17
- title = _ref2$.title,
18
- command = _ref2$.command,
19
- rank = _ref2$.rank,
20
- key = _ref2$.key;
21
- return {
22
- type: 'menu-item',
23
- key: key,
24
- parents: [{
25
- type: TEXT_FORMATTING_MENU_SECTION.type,
26
- key: TEXT_FORMATTING_MENU_SECTION.key,
27
- rank: rank
28
- }],
29
- component: function component(_ref3) {
30
- var parents = _ref3.parents;
31
- return /*#__PURE__*/React.createElement(FormatMenuItem, {
32
- api: api,
33
- parents: parents,
34
- icon: icon,
35
- shortcut: shortcut,
36
- title: title,
37
- optionType: optionType,
38
- toggleMarkWithAnalyticsCallback: command
39
- });
40
- }
41
- };
42
- });
43
- };
44
14
  export var getToolbarComponents = function getToolbarComponents(api) {
45
- return [{
15
+ return expValEquals('platform_editor_toolbar_aifc_responsiveness_update', 'isEnabled', true) ? getToolbarComponentsResponsivenessUpdate(api) : [{
46
16
  type: TEXT_FORMATTING_GROUP.type,
47
17
  key: TEXT_FORMATTING_GROUP.key,
48
18
  parents: [{
@@ -58,8 +28,8 @@ export var getToolbarComponents = function getToolbarComponents(api) {
58
28
  key: TEXT_FORMATTING_GROUP.key,
59
29
  rank: TEXT_FORMAT_GROUP_RANK[TEXT_FORMATTING_HERO_BUTTON.key]
60
30
  }],
61
- component: function component(_ref4) {
62
- var parents = _ref4.parents;
31
+ component: function component(_ref) {
32
+ var parents = _ref.parents;
63
33
  var _formatOptions$strong = formatOptions().strong,
64
34
  icon = _formatOptions$strong.icon,
65
35
  command = _formatOptions$strong.command,
@@ -83,8 +53,8 @@ export var getToolbarComponents = function getToolbarComponents(api) {
83
53
  key: TEXT_FORMATTING_GROUP.key,
84
54
  rank: TEXT_FORMAT_GROUP_RANK[TEXT_FORMATTING_MENU.key]
85
55
  }],
86
- component: function component(_ref5) {
87
- var children = _ref5.children;
56
+ component: function component(_ref2) {
57
+ var children = _ref2.children;
88
58
  return /*#__PURE__*/React.createElement(MoreFormattingMenu, null, children);
89
59
  }
90
60
  }, {
@@ -100,7 +70,7 @@ export var getToolbarComponents = function getToolbarComponents(api) {
100
70
  rank: TEXT_COLLAPSED_MENU_RANK[TEXT_FORMATTING_MENU_SECTION.key]
101
71
  }] : [])),
102
72
  component: expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? MenuSection : undefined
103
- }].concat(_toConsumableArray(getFormatMenuItems(api)), [{
73
+ }, {
104
74
  type: CLEAR_FORMARTTING_MENU_SECTION.type,
105
75
  key: CLEAR_FORMARTTING_MENU_SECTION.key,
106
76
  parents: [{
@@ -112,8 +82,8 @@ export var getToolbarComponents = function getToolbarComponents(api) {
112
82
  key: TEXT_COLLAPSED_MENU.key,
113
83
  rank: TEXT_COLLAPSED_MENU_RANK[CLEAR_FORMARTTING_MENU_SECTION.key]
114
84
  }] : [])),
115
- component: function component(_ref6) {
116
- var children = _ref6.children;
85
+ component: function component(_ref3) {
86
+ var children = _ref3.children;
117
87
  return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
118
88
  hasSeparator: true
119
89
  }, children);
@@ -126,12 +96,15 @@ export var getToolbarComponents = function getToolbarComponents(api) {
126
96
  key: CLEAR_FORMARTTING_MENU_SECTION.key,
127
97
  rank: CLEAR_FORMARTTING_MENU_SECTION_RANK[CLEAR_FORMATTING_MENU_ITEM.key]
128
98
  }],
129
- component: function component(_ref7) {
130
- var parents = _ref7.parents;
99
+ component: function component(_ref4) {
100
+ var parents = _ref4.parents;
131
101
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ClearFormatMenuItem, {
132
102
  parents: parents,
133
103
  api: api
134
104
  }));
135
105
  }
136
- }]);
106
+ }];
107
+ };
108
+ export var getToolbarComponentsResponsivenessUpdate = function getToolbarComponentsResponsivenessUpdate(api) {
109
+ return [].concat(_toConsumableArray(textFormattingGroupForPrimaryToolbar(api)), _toConsumableArray(textFormattingGroupForInlineToolbar(api)), _toConsumableArray(boldButtonGroup(api)), _toConsumableArray(underlineButtonGroup(api)), _toConsumableArray(textFormattingMenuGroup(api)));
137
110
  };
@@ -0,0 +1,4 @@
1
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import { type RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
+ import { type TextFormattingPlugin } from '../../../textFormattingPluginType';
4
+ export declare const boldButtonGroup: (api?: ExtractInjectionAPI<TextFormattingPlugin>) => RegisterComponent[];
@@ -0,0 +1,4 @@
1
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import { type RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
+ import { type TextFormattingPlugin } from '../../../textFormattingPluginType';
4
+ export declare const textFormattingGroupForInlineToolbar: (api?: ExtractInjectionAPI<TextFormattingPlugin>) => RegisterComponent[];
@@ -0,0 +1,4 @@
1
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import { type RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
+ import { type TextFormattingPlugin } from '../../../textFormattingPluginType';
4
+ export declare const textFormattingGroupForPrimaryToolbar: (api?: ExtractInjectionAPI<TextFormattingPlugin>) => RegisterComponent[];
@@ -0,0 +1,4 @@
1
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import { type RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
+ import { type TextFormattingPlugin } from '../../../textFormattingPluginType';
4
+ export declare const textFormattingMenuGroup: (api?: ExtractInjectionAPI<TextFormattingPlugin>) => RegisterComponent[];
@@ -0,0 +1,4 @@
1
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import { type RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
+ import { type TextFormattingPlugin } from '../../../textFormattingPluginType';
4
+ export declare const underlineButtonGroup: (api?: ExtractInjectionAPI<TextFormattingPlugin>) => RegisterComponent[];
@@ -2,3 +2,4 @@ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
2
  import { type RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
3
  import { type TextFormattingPlugin } from '../textFormattingPluginType';
4
4
  export declare const getToolbarComponents: (api?: ExtractInjectionAPI<TextFormattingPlugin>) => RegisterComponent[];
5
+ export declare const getToolbarComponentsResponsivenessUpdate: (api?: ExtractInjectionAPI<TextFormattingPlugin>) => RegisterComponent[];
@@ -0,0 +1,4 @@
1
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import { type RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
+ import { type TextFormattingPlugin } from '../../../textFormattingPluginType';
4
+ export declare const boldButtonGroup: (api?: ExtractInjectionAPI<TextFormattingPlugin>) => RegisterComponent[];
@@ -0,0 +1,4 @@
1
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import { type RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
+ import { type TextFormattingPlugin } from '../../../textFormattingPluginType';
4
+ export declare const textFormattingGroupForInlineToolbar: (api?: ExtractInjectionAPI<TextFormattingPlugin>) => RegisterComponent[];
@@ -0,0 +1,4 @@
1
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import { type RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
+ import { type TextFormattingPlugin } from '../../../textFormattingPluginType';
4
+ export declare const textFormattingGroupForPrimaryToolbar: (api?: ExtractInjectionAPI<TextFormattingPlugin>) => RegisterComponent[];
@@ -0,0 +1,4 @@
1
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import { type RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
+ import { type TextFormattingPlugin } from '../../../textFormattingPluginType';
4
+ export declare const textFormattingMenuGroup: (api?: ExtractInjectionAPI<TextFormattingPlugin>) => RegisterComponent[];
@@ -0,0 +1,4 @@
1
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import { type RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
+ import { type TextFormattingPlugin } from '../../../textFormattingPluginType';
4
+ export declare const underlineButtonGroup: (api?: ExtractInjectionAPI<TextFormattingPlugin>) => RegisterComponent[];
@@ -2,3 +2,4 @@ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
2
  import { type RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
3
  import { type TextFormattingPlugin } from '../textFormattingPluginType';
4
4
  export declare const getToolbarComponents: (api?: ExtractInjectionAPI<TextFormattingPlugin>) => RegisterComponent[];
5
+ export declare const getToolbarComponentsResponsivenessUpdate: (api?: ExtractInjectionAPI<TextFormattingPlugin>) => RegisterComponent[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-formatting",
3
- "version": "5.2.2",
3
+ "version": "5.3.1",
4
4
  "description": "Text-formatting plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -29,9 +29,9 @@
29
29
  ],
30
30
  "atlaskit:src": "src/index.ts",
31
31
  "dependencies": {
32
- "@atlaskit/adf-schema": "^51.1.2",
33
- "@atlaskit/editor-plugin-analytics": "^5.2.0",
34
- "@atlaskit/editor-plugin-base": "^6.2.0",
32
+ "@atlaskit/adf-schema": "^51.2.0",
33
+ "@atlaskit/editor-plugin-analytics": "^5.3.0",
34
+ "@atlaskit/editor-plugin-base": "^6.3.0",
35
35
  "@atlaskit/editor-plugin-primary-toolbar": "^6.0.0",
36
36
  "@atlaskit/editor-plugin-selection-toolbar": "^6.1.0",
37
37
  "@atlaskit/editor-plugin-toolbar": "^2.1.0",
@@ -40,17 +40,17 @@
40
40
  "@atlaskit/editor-tables": "^2.9.0",
41
41
  "@atlaskit/editor-toolbar": "^0.9.0",
42
42
  "@atlaskit/editor-toolbar-model": "^0.2.0",
43
- "@atlaskit/icon": "^28.2.0",
43
+ "@atlaskit/icon": "^28.3.0",
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
45
  "@atlaskit/prosemirror-input-rules": "^3.4.0",
46
- "@atlaskit/tmp-editor-statsig": "^12.25.0",
46
+ "@atlaskit/tmp-editor-statsig": "^12.31.0",
47
47
  "@atlaskit/tokens": "^6.3.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": "^109.10.0",
53
+ "@atlaskit/editor-common": "^109.16.0",
54
54
  "react": "^18.2.0"
55
55
  },
56
56
  "devDependencies": {