@atlaskit/editor-plugin-toolbar-lists-indentation 4.2.10 → 4.2.12

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,21 @@
1
1
  # @atlaskit/editor-plugin-toolbar-lists-indentation
2
2
 
3
+ ## 4.2.12
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
+
11
+ ## 4.2.11
12
+
13
+ ### Patch Changes
14
+
15
+ - [`4895a8b78c504`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4895a8b78c504) -
16
+ ED-29115: clean up sharedPluginStateHookMigratorFactory in toolbar-lists-indentations
17
+ - Updated dependencies
18
+
3
19
  ## 4.2.10
4
20
 
5
21
  ### Patch Changes
@@ -109,8 +109,20 @@ var toolbarListsIndentationPlugin = exports.toolbarListsIndentationPlugin = func
109
109
  primaryToolbarComponent: !(0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc', 'isEnabled', true) && !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
110
110
  };
111
111
  };
112
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
113
- var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['list', 'indentation'], function (states) {
112
+ function PrimaryToolbarComponent(_ref4) {
113
+ var _pluginInjectionApi$l;
114
+ var featureFlags = _ref4.featureFlags,
115
+ popupsMountPoint = _ref4.popupsMountPoint,
116
+ popupsBoundariesElement = _ref4.popupsBoundariesElement,
117
+ popupsScrollableElement = _ref4.popupsScrollableElement,
118
+ isSmall = _ref4.isSmall,
119
+ isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing,
120
+ disabled = _ref4.disabled,
121
+ editorView = _ref4.editorView,
122
+ showIndentationButtons = _ref4.showIndentationButtons,
123
+ pluginInjectionApi = _ref4.pluginInjectionApi,
124
+ allowHeadingAndParagraphIndentation = _ref4.allowHeadingAndParagraphIndentation;
125
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['list', 'indentation'], function (states) {
114
126
  var _states$listState, _states$listState2, _states$listState3, _states$listState4, _states$indentationSt, _states$indentationSt2, _states$indentationSt3, _states$listState5;
115
127
  return {
116
128
  bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
@@ -131,50 +143,6 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
131
143
  isIndentationAllowed = _useSharedPluginState.isIndentationAllowed,
132
144
  indentDisabled = _useSharedPluginState.indentDisabled,
133
145
  outdentDisabled = _useSharedPluginState.outdentDisabled;
134
- return {
135
- bulletListActive: bulletListActive,
136
- bulletListDisabled: bulletListDisabled,
137
- orderedListActive: orderedListActive,
138
- orderedListDisabled: orderedListDisabled,
139
- isIndentationAllowed: isIndentationAllowed,
140
- indentDisabled: indentDisabled,
141
- outdentDisabled: outdentDisabled
142
- };
143
- }, function (api) {
144
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['list', 'indentation']),
145
- listState = _useSharedPluginState2.listState,
146
- indentationState = _useSharedPluginState2.indentationState;
147
- return {
148
- bulletListActive: listState === null || listState === void 0 ? void 0 : listState.bulletListActive,
149
- bulletListDisabled: listState === null || listState === void 0 ? void 0 : listState.bulletListDisabled,
150
- orderedListActive: listState === null || listState === void 0 ? void 0 : listState.orderedListActive,
151
- orderedListDisabled: listState === null || listState === void 0 ? void 0 : listState.orderedListDisabled,
152
- isIndentationAllowed: indentationState === null || indentationState === void 0 ? void 0 : indentationState.isIndentationAllowed,
153
- indentDisabled: indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled,
154
- outdentDisabled: indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled
155
- };
156
- });
157
- function PrimaryToolbarComponent(_ref4) {
158
- var _pluginInjectionApi$l;
159
- var featureFlags = _ref4.featureFlags,
160
- popupsMountPoint = _ref4.popupsMountPoint,
161
- popupsBoundariesElement = _ref4.popupsBoundariesElement,
162
- popupsScrollableElement = _ref4.popupsScrollableElement,
163
- isSmall = _ref4.isSmall,
164
- isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing,
165
- disabled = _ref4.disabled,
166
- editorView = _ref4.editorView,
167
- showIndentationButtons = _ref4.showIndentationButtons,
168
- pluginInjectionApi = _ref4.pluginInjectionApi,
169
- allowHeadingAndParagraphIndentation = _ref4.allowHeadingAndParagraphIndentation;
170
- var _useSharedState = useSharedState(pluginInjectionApi),
171
- bulletListActive = _useSharedState.bulletListActive,
172
- bulletListDisabled = _useSharedState.bulletListDisabled,
173
- orderedListActive = _useSharedState.orderedListActive,
174
- orderedListDisabled = _useSharedState.orderedListDisabled,
175
- isIndentationAllowed = _useSharedState.isIndentationAllowed,
176
- indentDisabled = _useSharedState.indentDisabled,
177
- outdentDisabled = _useSharedState.outdentDisabled;
178
146
  var _useState = (0, _react.useState)(),
179
147
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
180
148
  taskDecisionState = _useState2[0],
@@ -20,8 +20,14 @@ var FloatingToolbarSettings = {
20
20
  isToolbarReducedSpacing: true,
21
21
  isSmall: true
22
22
  };
23
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
24
- var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['list', 'indentation'], function (states) {
23
+ function FloatingToolbarComponent(_ref) {
24
+ var _pluginInjectionApi$l;
25
+ var featureFlags = _ref.featureFlags,
26
+ editorView = _ref.editorView,
27
+ showIndentationButtons = _ref.showIndentationButtons,
28
+ pluginInjectionApi = _ref.pluginInjectionApi,
29
+ allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation;
30
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['list', 'indentation'], function (states) {
25
31
  var _states$listState, _states$listState2, _states$listState3, _states$listState4, _states$indentationSt, _states$indentationSt2, _states$indentationSt3, _states$listState5;
26
32
  return {
27
33
  bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
@@ -42,44 +48,6 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
42
48
  isIndentationAllowed = _useSharedPluginState.isIndentationAllowed,
43
49
  indentDisabled = _useSharedPluginState.indentDisabled,
44
50
  outdentDisabled = _useSharedPluginState.outdentDisabled;
45
- return {
46
- bulletListActive: bulletListActive,
47
- bulletListDisabled: bulletListDisabled,
48
- orderedListActive: orderedListActive,
49
- orderedListDisabled: orderedListDisabled,
50
- isIndentationAllowed: isIndentationAllowed,
51
- indentDisabled: indentDisabled,
52
- outdentDisabled: outdentDisabled
53
- };
54
- }, function (api) {
55
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['list', 'indentation']),
56
- listState = _useSharedPluginState2.listState,
57
- indentationState = _useSharedPluginState2.indentationState;
58
- return {
59
- bulletListActive: listState === null || listState === void 0 ? void 0 : listState.bulletListActive,
60
- bulletListDisabled: listState === null || listState === void 0 ? void 0 : listState.bulletListDisabled,
61
- orderedListActive: listState === null || listState === void 0 ? void 0 : listState.orderedListActive,
62
- orderedListDisabled: listState === null || listState === void 0 ? void 0 : listState.orderedListDisabled,
63
- isIndentationAllowed: indentationState === null || indentationState === void 0 ? void 0 : indentationState.isIndentationAllowed,
64
- indentDisabled: indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled,
65
- outdentDisabled: indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled
66
- };
67
- });
68
- function FloatingToolbarComponent(_ref) {
69
- var _pluginInjectionApi$l;
70
- var featureFlags = _ref.featureFlags,
71
- editorView = _ref.editorView,
72
- showIndentationButtons = _ref.showIndentationButtons,
73
- pluginInjectionApi = _ref.pluginInjectionApi,
74
- allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation;
75
- var _useSharedState = useSharedState(pluginInjectionApi),
76
- bulletListActive = _useSharedState.bulletListActive,
77
- bulletListDisabled = _useSharedState.bulletListDisabled,
78
- orderedListActive = _useSharedState.orderedListActive,
79
- orderedListDisabled = _useSharedState.orderedListDisabled,
80
- isIndentationAllowed = _useSharedState.isIndentationAllowed,
81
- indentDisabled = _useSharedState.indentDisabled,
82
- outdentDisabled = _useSharedState.outdentDisabled;
83
51
  var _useState = (0, _react.useState)(),
84
52
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
85
53
  taskDecisionState = _useState2[0],
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.MenuSection = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _toolbar = require("@atlaskit/editor-common/toolbar");
10
+ var _editorToolbar = require("@atlaskit/editor-toolbar");
11
+ var MenuSection = exports.MenuSection = function MenuSection(_ref) {
12
+ var children = _ref.children,
13
+ title = _ref.title,
14
+ parents = _ref.parents;
15
+ var hasSeparator = parents.some(function (parent) {
16
+ return parent.key === _toolbar.TEXT_COLLAPSED_MENU.key;
17
+ });
18
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
19
+ hasSeparator: hasSeparator,
20
+ title: title
21
+ }, children);
22
+ };
@@ -5,12 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.getToolbarComponents = void 0;
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
8
9
  var _react = _interopRequireDefault(require("react"));
9
10
  var _toolbar = require("@atlaskit/editor-common/toolbar");
11
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
10
12
  var _BulletedListMenuItem = require("./toolbar-components/BulletedListMenuItem");
11
13
  var _IndentMenuItem = require("./toolbar-components/IndentMenuItem");
12
14
  var _ListsIndentationHeroButton = require("./toolbar-components/ListsIndentationHeroButton");
13
15
  var _ListsIndentationMenu = require("./toolbar-components/ListsIndentationMenu");
16
+ var _MenuSection = require("./toolbar-components/MenuSection");
14
17
  var _NumberedListMenuItem = require("./toolbar-components/NumberedListMenuItem");
15
18
  var _OutdentMenuItem = require("./toolbar-components/OutdentMenuItem");
16
19
  var getToolbarComponents = exports.getToolbarComponents = function getToolbarComponents(_ref) {
@@ -62,7 +65,12 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
62
65
  type: _toolbar.LISTS_INDENTATION_MENU.type,
63
66
  key: _toolbar.LISTS_INDENTATION_MENU.key,
64
67
  rank: _toolbar.LISTS_INDENTATION_MENU_RANK[_toolbar.LISTS_INDENTATION_MENU_SECTION.key]
65
- }]
68
+ }].concat((0, _toConsumableArray2.default)((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? [{
69
+ type: _toolbar.TEXT_COLLAPSED_MENU.type,
70
+ key: _toolbar.TEXT_COLLAPSED_MENU.key,
71
+ rank: _toolbar.TEXT_COLLAPSED_MENU_RANK[_toolbar.LISTS_INDENTATION_MENU_SECTION.key]
72
+ }] : [])),
73
+ component: (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? _MenuSection.MenuSection : undefined
66
74
  }, {
67
75
  type: _toolbar.BULLETED_LIST_MENU_ITEM.type,
68
76
  key: _toolbar.BULLETED_LIST_MENU_ITEM.key,
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react';
2
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
2
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { ToolbarSize } from '@atlaskit/editor-common/types';
4
4
  import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -98,53 +98,6 @@ export const toolbarListsIndentationPlugin = ({
98
98
  primaryToolbarComponent: !expValEquals('platform_editor_toolbar_aifc', 'isEnabled', true) && !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
99
99
  };
100
100
  };
101
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
102
- const {
103
- bulletListActive,
104
- bulletListDisabled,
105
- orderedListActive,
106
- orderedListDisabled,
107
- isIndentationAllowed,
108
- indentDisabled,
109
- outdentDisabled
110
- } = useSharedPluginStateWithSelector(api, ['list', 'indentation'], states => {
111
- var _states$listState, _states$listState2, _states$listState3, _states$listState4, _states$indentationSt, _states$indentationSt2, _states$indentationSt3, _states$listState5;
112
- return {
113
- bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
114
- bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
115
- orderedListActive: (_states$listState3 = states.listState) === null || _states$listState3 === void 0 ? void 0 : _states$listState3.orderedListActive,
116
- orderedListDisabled: (_states$listState4 = states.listState) === null || _states$listState4 === void 0 ? void 0 : _states$listState4.orderedListDisabled,
117
- isIndentationAllowed: (_states$indentationSt = states.indentationState) === null || _states$indentationSt === void 0 ? void 0 : _states$indentationSt.isIndentationAllowed,
118
- indentDisabled: (_states$indentationSt2 = states.indentationState) === null || _states$indentationSt2 === void 0 ? void 0 : _states$indentationSt2.indentDisabled,
119
- outdentDisabled: (_states$indentationSt3 = states.indentationState) === null || _states$indentationSt3 === void 0 ? void 0 : _states$indentationSt3.outdentDisabled,
120
- // decorationSet is required to re-render PrimaryToolbarComponent component, so that the toolbar states updates regularly
121
- decorationSet: (_states$listState5 = states.listState) === null || _states$listState5 === void 0 ? void 0 : _states$listState5.decorationSet
122
- };
123
- });
124
- return {
125
- bulletListActive,
126
- bulletListDisabled,
127
- orderedListActive,
128
- orderedListDisabled,
129
- isIndentationAllowed,
130
- indentDisabled,
131
- outdentDisabled
132
- };
133
- }, api => {
134
- const {
135
- listState,
136
- indentationState
137
- } = useSharedPluginState(api, ['list', 'indentation']);
138
- return {
139
- bulletListActive: listState === null || listState === void 0 ? void 0 : listState.bulletListActive,
140
- bulletListDisabled: listState === null || listState === void 0 ? void 0 : listState.bulletListDisabled,
141
- orderedListActive: listState === null || listState === void 0 ? void 0 : listState.orderedListActive,
142
- orderedListDisabled: listState === null || listState === void 0 ? void 0 : listState.orderedListDisabled,
143
- isIndentationAllowed: indentationState === null || indentationState === void 0 ? void 0 : indentationState.isIndentationAllowed,
144
- indentDisabled: indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled,
145
- outdentDisabled: indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled
146
- };
147
- });
148
101
  export function PrimaryToolbarComponent({
149
102
  featureFlags,
150
103
  popupsMountPoint,
@@ -167,7 +120,20 @@ export function PrimaryToolbarComponent({
167
120
  isIndentationAllowed,
168
121
  indentDisabled,
169
122
  outdentDisabled
170
- } = useSharedState(pluginInjectionApi);
123
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['list', 'indentation'], states => {
124
+ var _states$listState, _states$listState2, _states$listState3, _states$listState4, _states$indentationSt, _states$indentationSt2, _states$indentationSt3, _states$listState5;
125
+ return {
126
+ bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
127
+ bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
128
+ orderedListActive: (_states$listState3 = states.listState) === null || _states$listState3 === void 0 ? void 0 : _states$listState3.orderedListActive,
129
+ orderedListDisabled: (_states$listState4 = states.listState) === null || _states$listState4 === void 0 ? void 0 : _states$listState4.orderedListDisabled,
130
+ isIndentationAllowed: (_states$indentationSt = states.indentationState) === null || _states$indentationSt === void 0 ? void 0 : _states$indentationSt.isIndentationAllowed,
131
+ indentDisabled: (_states$indentationSt2 = states.indentationState) === null || _states$indentationSt2 === void 0 ? void 0 : _states$indentationSt2.indentDisabled,
132
+ outdentDisabled: (_states$indentationSt3 = states.indentationState) === null || _states$indentationSt3 === void 0 ? void 0 : _states$indentationSt3.outdentDisabled,
133
+ // decorationSet is required to re-render PrimaryToolbarComponent component, so that the toolbar states updates regularly
134
+ decorationSet: (_states$listState5 = states.listState) === null || _states$listState5 === void 0 ? void 0 : _states$listState5.decorationSet
135
+ };
136
+ });
171
137
  const [taskDecisionState, setTaskDecisionState] = useState();
172
138
  usePluginStateEffect(pluginInjectionApi, ['taskDecision'], ({
173
139
  taskDecisionState: newTaskDecisionState
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react';
2
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
2
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
4
4
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
5
  import { getIndentationButtonsState } from '../pm-plugins/indentation-buttons';
@@ -10,7 +10,14 @@ const FloatingToolbarSettings = {
10
10
  isToolbarReducedSpacing: true,
11
11
  isSmall: true
12
12
  };
13
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
13
+ export function FloatingToolbarComponent({
14
+ featureFlags,
15
+ editorView,
16
+ showIndentationButtons,
17
+ pluginInjectionApi,
18
+ allowHeadingAndParagraphIndentation
19
+ }) {
20
+ var _pluginInjectionApi$l;
14
21
  const {
15
22
  bulletListActive,
16
23
  bulletListDisabled,
@@ -19,7 +26,7 @@ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
19
26
  isIndentationAllowed,
20
27
  indentDisabled,
21
28
  outdentDisabled
22
- } = useSharedPluginStateWithSelector(api, ['list', 'indentation'], states => {
29
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['list', 'indentation'], states => {
23
30
  var _states$listState, _states$listState2, _states$listState3, _states$listState4, _states$indentationSt, _states$indentationSt2, _states$indentationSt3, _states$listState5;
24
31
  return {
25
32
  bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
@@ -33,47 +40,6 @@ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
33
40
  decorationSet: (_states$listState5 = states.listState) === null || _states$listState5 === void 0 ? void 0 : _states$listState5.decorationSet
34
41
  };
35
42
  });
36
- return {
37
- bulletListActive,
38
- bulletListDisabled,
39
- orderedListActive,
40
- orderedListDisabled,
41
- isIndentationAllowed,
42
- indentDisabled,
43
- outdentDisabled
44
- };
45
- }, api => {
46
- const {
47
- listState,
48
- indentationState
49
- } = useSharedPluginState(api, ['list', 'indentation']);
50
- return {
51
- bulletListActive: listState === null || listState === void 0 ? void 0 : listState.bulletListActive,
52
- bulletListDisabled: listState === null || listState === void 0 ? void 0 : listState.bulletListDisabled,
53
- orderedListActive: listState === null || listState === void 0 ? void 0 : listState.orderedListActive,
54
- orderedListDisabled: listState === null || listState === void 0 ? void 0 : listState.orderedListDisabled,
55
- isIndentationAllowed: indentationState === null || indentationState === void 0 ? void 0 : indentationState.isIndentationAllowed,
56
- indentDisabled: indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled,
57
- outdentDisabled: indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled
58
- };
59
- });
60
- export function FloatingToolbarComponent({
61
- featureFlags,
62
- editorView,
63
- showIndentationButtons,
64
- pluginInjectionApi,
65
- allowHeadingAndParagraphIndentation
66
- }) {
67
- var _pluginInjectionApi$l;
68
- const {
69
- bulletListActive,
70
- bulletListDisabled,
71
- orderedListActive,
72
- orderedListDisabled,
73
- isIndentationAllowed,
74
- indentDisabled,
75
- outdentDisabled
76
- } = useSharedState(pluginInjectionApi);
77
43
  const [taskDecisionState, setTaskDecisionState] = useState();
78
44
  usePluginStateEffect(pluginInjectionApi, ['taskDecision'], ({
79
45
  taskDecisionState: newTaskDecisionState
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { TEXT_COLLAPSED_MENU } from '@atlaskit/editor-common/toolbar';
3
+ import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
4
+ export const MenuSection = ({
5
+ children,
6
+ title,
7
+ parents
8
+ }) => {
9
+ const hasSeparator = parents.some(parent => parent.key === TEXT_COLLAPSED_MENU.key);
10
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
11
+ hasSeparator: hasSeparator,
12
+ title: title
13
+ }, children);
14
+ };
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
- import { BULLETED_LIST_MENU_ITEM, INDENT_MENU_ITEM, LISTS_INDENTATION_GROUP, LISTS_INDENTATION_HERO_BUTTON, LISTS_INDENTATION_MENU, LISTS_INDENTATION_MENU_SECTION, NUMBERED_LIST_MENU_ITEM, OUTDENT_MENU_ITEM, TEXT_SECTION, TEXT_SECTION_RANK, LISTS_INDENTATION_GROUP_RANK, LISTS_INDENTATION_MENU_RANK, LISTS_INDENTATION_MENU_SECTION_RANK } from '@atlaskit/editor-common/toolbar';
2
+ import { BULLETED_LIST_MENU_ITEM, INDENT_MENU_ITEM, LISTS_INDENTATION_GROUP, LISTS_INDENTATION_HERO_BUTTON, LISTS_INDENTATION_MENU, LISTS_INDENTATION_MENU_SECTION, NUMBERED_LIST_MENU_ITEM, OUTDENT_MENU_ITEM, TEXT_SECTION, TEXT_SECTION_RANK, LISTS_INDENTATION_GROUP_RANK, LISTS_INDENTATION_MENU_RANK, LISTS_INDENTATION_MENU_SECTION_RANK, TEXT_COLLAPSED_MENU, TEXT_COLLAPSED_MENU_RANK } from '@atlaskit/editor-common/toolbar';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
4
  import { BulletedListMenuItem } from './toolbar-components/BulletedListMenuItem';
4
5
  import { IndentMenuItem } from './toolbar-components/IndentMenuItem';
5
6
  import { ListsIndentationHeroButton } from './toolbar-components/ListsIndentationHeroButton';
6
7
  import { ListsIndentationMenu } from './toolbar-components/ListsIndentationMenu';
8
+ import { MenuSection } from './toolbar-components/MenuSection';
7
9
  import { NumberedListMenuItem } from './toolbar-components/NumberedListMenuItem';
8
10
  import { OutdentMenuItem } from './toolbar-components/OutdentMenuItem';
9
11
  export const getToolbarComponents = ({
@@ -54,7 +56,12 @@ export const getToolbarComponents = ({
54
56
  type: LISTS_INDENTATION_MENU.type,
55
57
  key: LISTS_INDENTATION_MENU.key,
56
58
  rank: LISTS_INDENTATION_MENU_RANK[LISTS_INDENTATION_MENU_SECTION.key]
57
- }]
59
+ }, ...(expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? [{
60
+ type: TEXT_COLLAPSED_MENU.type,
61
+ key: TEXT_COLLAPSED_MENU.key,
62
+ rank: TEXT_COLLAPSED_MENU_RANK[LISTS_INDENTATION_MENU_SECTION.key]
63
+ }] : [])],
64
+ component: expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? MenuSection : undefined
58
65
  }, {
59
66
  type: BULLETED_LIST_MENU_ITEM.type,
60
67
  key: BULLETED_LIST_MENU_ITEM.key,
@@ -3,7 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  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; }
4
4
  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) { _defineProperty(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; }
5
5
  import React, { useState } from 'react';
6
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
6
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
7
7
  import { ToolbarSize } from '@atlaskit/editor-common/types';
8
8
  import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -99,8 +99,20 @@ export var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugi
99
99
  primaryToolbarComponent: !expValEquals('platform_editor_toolbar_aifc', 'isEnabled', true) && !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
100
100
  };
101
101
  };
102
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
103
- var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['list', 'indentation'], function (states) {
102
+ export function PrimaryToolbarComponent(_ref4) {
103
+ var _pluginInjectionApi$l;
104
+ var featureFlags = _ref4.featureFlags,
105
+ popupsMountPoint = _ref4.popupsMountPoint,
106
+ popupsBoundariesElement = _ref4.popupsBoundariesElement,
107
+ popupsScrollableElement = _ref4.popupsScrollableElement,
108
+ isSmall = _ref4.isSmall,
109
+ isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing,
110
+ disabled = _ref4.disabled,
111
+ editorView = _ref4.editorView,
112
+ showIndentationButtons = _ref4.showIndentationButtons,
113
+ pluginInjectionApi = _ref4.pluginInjectionApi,
114
+ allowHeadingAndParagraphIndentation = _ref4.allowHeadingAndParagraphIndentation;
115
+ var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['list', 'indentation'], function (states) {
104
116
  var _states$listState, _states$listState2, _states$listState3, _states$listState4, _states$indentationSt, _states$indentationSt2, _states$indentationSt3, _states$listState5;
105
117
  return {
106
118
  bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
@@ -121,50 +133,6 @@ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
121
133
  isIndentationAllowed = _useSharedPluginState.isIndentationAllowed,
122
134
  indentDisabled = _useSharedPluginState.indentDisabled,
123
135
  outdentDisabled = _useSharedPluginState.outdentDisabled;
124
- return {
125
- bulletListActive: bulletListActive,
126
- bulletListDisabled: bulletListDisabled,
127
- orderedListActive: orderedListActive,
128
- orderedListDisabled: orderedListDisabled,
129
- isIndentationAllowed: isIndentationAllowed,
130
- indentDisabled: indentDisabled,
131
- outdentDisabled: outdentDisabled
132
- };
133
- }, function (api) {
134
- var _useSharedPluginState2 = useSharedPluginState(api, ['list', 'indentation']),
135
- listState = _useSharedPluginState2.listState,
136
- indentationState = _useSharedPluginState2.indentationState;
137
- return {
138
- bulletListActive: listState === null || listState === void 0 ? void 0 : listState.bulletListActive,
139
- bulletListDisabled: listState === null || listState === void 0 ? void 0 : listState.bulletListDisabled,
140
- orderedListActive: listState === null || listState === void 0 ? void 0 : listState.orderedListActive,
141
- orderedListDisabled: listState === null || listState === void 0 ? void 0 : listState.orderedListDisabled,
142
- isIndentationAllowed: indentationState === null || indentationState === void 0 ? void 0 : indentationState.isIndentationAllowed,
143
- indentDisabled: indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled,
144
- outdentDisabled: indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled
145
- };
146
- });
147
- export function PrimaryToolbarComponent(_ref4) {
148
- var _pluginInjectionApi$l;
149
- var featureFlags = _ref4.featureFlags,
150
- popupsMountPoint = _ref4.popupsMountPoint,
151
- popupsBoundariesElement = _ref4.popupsBoundariesElement,
152
- popupsScrollableElement = _ref4.popupsScrollableElement,
153
- isSmall = _ref4.isSmall,
154
- isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing,
155
- disabled = _ref4.disabled,
156
- editorView = _ref4.editorView,
157
- showIndentationButtons = _ref4.showIndentationButtons,
158
- pluginInjectionApi = _ref4.pluginInjectionApi,
159
- allowHeadingAndParagraphIndentation = _ref4.allowHeadingAndParagraphIndentation;
160
- var _useSharedState = useSharedState(pluginInjectionApi),
161
- bulletListActive = _useSharedState.bulletListActive,
162
- bulletListDisabled = _useSharedState.bulletListDisabled,
163
- orderedListActive = _useSharedState.orderedListActive,
164
- orderedListDisabled = _useSharedState.orderedListDisabled,
165
- isIndentationAllowed = _useSharedState.isIndentationAllowed,
166
- indentDisabled = _useSharedState.indentDisabled,
167
- outdentDisabled = _useSharedState.outdentDisabled;
168
136
  var _useState = useState(),
169
137
  _useState2 = _slicedToArray(_useState, 2),
170
138
  taskDecisionState = _useState2[0],
@@ -1,6 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { useState } from 'react';
3
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
4
  import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
5
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
6
  import { getIndentationButtonsState } from '../pm-plugins/indentation-buttons';
@@ -11,8 +11,14 @@ var FloatingToolbarSettings = {
11
11
  isToolbarReducedSpacing: true,
12
12
  isSmall: true
13
13
  };
14
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
15
- var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['list', 'indentation'], function (states) {
14
+ export function FloatingToolbarComponent(_ref) {
15
+ var _pluginInjectionApi$l;
16
+ var featureFlags = _ref.featureFlags,
17
+ editorView = _ref.editorView,
18
+ showIndentationButtons = _ref.showIndentationButtons,
19
+ pluginInjectionApi = _ref.pluginInjectionApi,
20
+ allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation;
21
+ var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['list', 'indentation'], function (states) {
16
22
  var _states$listState, _states$listState2, _states$listState3, _states$listState4, _states$indentationSt, _states$indentationSt2, _states$indentationSt3, _states$listState5;
17
23
  return {
18
24
  bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
@@ -33,44 +39,6 @@ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
33
39
  isIndentationAllowed = _useSharedPluginState.isIndentationAllowed,
34
40
  indentDisabled = _useSharedPluginState.indentDisabled,
35
41
  outdentDisabled = _useSharedPluginState.outdentDisabled;
36
- return {
37
- bulletListActive: bulletListActive,
38
- bulletListDisabled: bulletListDisabled,
39
- orderedListActive: orderedListActive,
40
- orderedListDisabled: orderedListDisabled,
41
- isIndentationAllowed: isIndentationAllowed,
42
- indentDisabled: indentDisabled,
43
- outdentDisabled: outdentDisabled
44
- };
45
- }, function (api) {
46
- var _useSharedPluginState2 = useSharedPluginState(api, ['list', 'indentation']),
47
- listState = _useSharedPluginState2.listState,
48
- indentationState = _useSharedPluginState2.indentationState;
49
- return {
50
- bulletListActive: listState === null || listState === void 0 ? void 0 : listState.bulletListActive,
51
- bulletListDisabled: listState === null || listState === void 0 ? void 0 : listState.bulletListDisabled,
52
- orderedListActive: listState === null || listState === void 0 ? void 0 : listState.orderedListActive,
53
- orderedListDisabled: listState === null || listState === void 0 ? void 0 : listState.orderedListDisabled,
54
- isIndentationAllowed: indentationState === null || indentationState === void 0 ? void 0 : indentationState.isIndentationAllowed,
55
- indentDisabled: indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled,
56
- outdentDisabled: indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled
57
- };
58
- });
59
- export function FloatingToolbarComponent(_ref) {
60
- var _pluginInjectionApi$l;
61
- var featureFlags = _ref.featureFlags,
62
- editorView = _ref.editorView,
63
- showIndentationButtons = _ref.showIndentationButtons,
64
- pluginInjectionApi = _ref.pluginInjectionApi,
65
- allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation;
66
- var _useSharedState = useSharedState(pluginInjectionApi),
67
- bulletListActive = _useSharedState.bulletListActive,
68
- bulletListDisabled = _useSharedState.bulletListDisabled,
69
- orderedListActive = _useSharedState.orderedListActive,
70
- orderedListDisabled = _useSharedState.orderedListDisabled,
71
- isIndentationAllowed = _useSharedState.isIndentationAllowed,
72
- indentDisabled = _useSharedState.indentDisabled,
73
- outdentDisabled = _useSharedState.outdentDisabled;
74
42
  var _useState = useState(),
75
43
  _useState2 = _slicedToArray(_useState, 2),
76
44
  taskDecisionState = _useState2[0],
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { TEXT_COLLAPSED_MENU } from '@atlaskit/editor-common/toolbar';
3
+ import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
4
+ export var MenuSection = function MenuSection(_ref) {
5
+ var children = _ref.children,
6
+ title = _ref.title,
7
+ parents = _ref.parents;
8
+ var hasSeparator = parents.some(function (parent) {
9
+ return parent.key === TEXT_COLLAPSED_MENU.key;
10
+ });
11
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
12
+ hasSeparator: hasSeparator,
13
+ title: title
14
+ }, children);
15
+ };
@@ -1,9 +1,12 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
2
  import React from 'react';
2
- import { BULLETED_LIST_MENU_ITEM, INDENT_MENU_ITEM, LISTS_INDENTATION_GROUP, LISTS_INDENTATION_HERO_BUTTON, LISTS_INDENTATION_MENU, LISTS_INDENTATION_MENU_SECTION, NUMBERED_LIST_MENU_ITEM, OUTDENT_MENU_ITEM, TEXT_SECTION, TEXT_SECTION_RANK, LISTS_INDENTATION_GROUP_RANK, LISTS_INDENTATION_MENU_RANK, LISTS_INDENTATION_MENU_SECTION_RANK } from '@atlaskit/editor-common/toolbar';
3
+ import { BULLETED_LIST_MENU_ITEM, INDENT_MENU_ITEM, LISTS_INDENTATION_GROUP, LISTS_INDENTATION_HERO_BUTTON, LISTS_INDENTATION_MENU, LISTS_INDENTATION_MENU_SECTION, NUMBERED_LIST_MENU_ITEM, OUTDENT_MENU_ITEM, TEXT_SECTION, TEXT_SECTION_RANK, LISTS_INDENTATION_GROUP_RANK, LISTS_INDENTATION_MENU_RANK, LISTS_INDENTATION_MENU_SECTION_RANK, TEXT_COLLAPSED_MENU, TEXT_COLLAPSED_MENU_RANK } from '@atlaskit/editor-common/toolbar';
4
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
5
  import { BulletedListMenuItem } from './toolbar-components/BulletedListMenuItem';
4
6
  import { IndentMenuItem } from './toolbar-components/IndentMenuItem';
5
7
  import { ListsIndentationHeroButton } from './toolbar-components/ListsIndentationHeroButton';
6
8
  import { ListsIndentationMenu } from './toolbar-components/ListsIndentationMenu';
9
+ import { MenuSection } from './toolbar-components/MenuSection';
7
10
  import { NumberedListMenuItem } from './toolbar-components/NumberedListMenuItem';
8
11
  import { OutdentMenuItem } from './toolbar-components/OutdentMenuItem';
9
12
  export var getToolbarComponents = function getToolbarComponents(_ref) {
@@ -55,7 +58,12 @@ export var getToolbarComponents = function getToolbarComponents(_ref) {
55
58
  type: LISTS_INDENTATION_MENU.type,
56
59
  key: LISTS_INDENTATION_MENU.key,
57
60
  rank: LISTS_INDENTATION_MENU_RANK[LISTS_INDENTATION_MENU_SECTION.key]
58
- }]
61
+ }].concat(_toConsumableArray(expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? [{
62
+ type: TEXT_COLLAPSED_MENU.type,
63
+ key: TEXT_COLLAPSED_MENU.key,
64
+ rank: TEXT_COLLAPSED_MENU_RANK[LISTS_INDENTATION_MENU_SECTION.key]
65
+ }] : [])),
66
+ component: expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? MenuSection : undefined
59
67
  }, {
60
68
  type: BULLETED_LIST_MENU_ITEM.type,
61
69
  key: BULLETED_LIST_MENU_ITEM.key,
@@ -0,0 +1,7 @@
1
+ import React, { type ReactNode } from 'react';
2
+ import type { CommonComponentProps } from '@atlaskit/editor-toolbar-model';
3
+ export declare const MenuSection: ({ children, title, parents, }: {
4
+ children?: ReactNode;
5
+ parents: CommonComponentProps["parents"];
6
+ title?: string;
7
+ }) => React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import React, { type ReactNode } from 'react';
2
+ import type { CommonComponentProps } from '@atlaskit/editor-toolbar-model';
3
+ export declare const MenuSection: ({ children, title, parents, }: {
4
+ children?: ReactNode;
5
+ parents: CommonComponentProps["parents"];
6
+ title?: string;
7
+ }) => React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-toolbar-lists-indentation",
3
- "version": "4.2.10",
3
+ "version": "4.2.12",
4
4
  "description": "Toolbar lists and indentation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -41,16 +41,16 @@
41
41
  "@atlaskit/editor-plugin-toolbar": "^0.4.0",
42
42
  "@atlaskit/editor-prosemirror": "7.0.0",
43
43
  "@atlaskit/editor-shared-styles": "^3.6.0",
44
- "@atlaskit/editor-toolbar": "^0.4.0",
45
- "@atlaskit/editor-toolbar-model": "^0.1.0",
44
+ "@atlaskit/editor-toolbar": "^0.6.0",
45
+ "@atlaskit/editor-toolbar-model": "^0.2.0",
46
46
  "@atlaskit/icon": "^28.1.0",
47
47
  "@atlaskit/platform-feature-flags": "^1.1.0",
48
- "@atlaskit/tmp-editor-statsig": "^11.8.0",
48
+ "@atlaskit/tmp-editor-statsig": "^11.11.0",
49
49
  "@atlaskit/tokens": "^6.1.0",
50
50
  "@babel/runtime": "^7.0.0"
51
51
  },
52
52
  "peerDependencies": {
53
- "@atlaskit/editor-common": "^107.32.0",
53
+ "@atlaskit/editor-common": "^107.34.0",
54
54
  "react": "^18.2.0",
55
55
  "react-dom": "^18.2.0",
56
56
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -58,7 +58,7 @@
58
58
  "devDependencies": {
59
59
  "@af/integration-testing": "workspace:^",
60
60
  "@af/visual-regression": "workspace:^",
61
- "@atlaskit/adf-schema": "^50.2.2",
61
+ "@atlaskit/adf-schema": "^50.2.3",
62
62
  "@atlaskit/analytics-next": "^11.1.0",
63
63
  "@atlaskit/editor-plugin-base": "^4.1.0",
64
64
  "@atlaskit/editor-plugin-text-formatting": "^3.0.0",