@atlaskit/editor-plugin-toolbar-lists-indentation 6.0.0 → 6.1.2
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 +25 -0
- package/dist/cjs/toolbarListsIndentationPlugin.js +3 -0
- package/dist/cjs/ui/toolbar-components/BulletedListMenuItem.js +11 -6
- package/dist/cjs/ui/toolbar-components/ListsIndentationHeroButton.js +9 -9
- package/dist/cjs/ui/toolbar-components/ListsIndentationMenu.js +2 -2
- package/dist/cjs/ui/toolbar-components/NumberedListMenuItem.js +11 -6
- package/dist/cjs/ui/toolbar-components/TaskListMenuItem.js +9 -4
- package/dist/cjs/ui/toolbar-components.js +1 -1
- package/dist/es2019/toolbarListsIndentationPlugin.js +3 -0
- package/dist/es2019/ui/toolbar-components/BulletedListMenuItem.js +11 -6
- package/dist/es2019/ui/toolbar-components/ListsIndentationHeroButton.js +9 -9
- package/dist/es2019/ui/toolbar-components/ListsIndentationMenu.js +2 -2
- package/dist/es2019/ui/toolbar-components/NumberedListMenuItem.js +11 -6
- package/dist/es2019/ui/toolbar-components/TaskListMenuItem.js +10 -4
- package/dist/es2019/ui/toolbar-components.js +1 -1
- package/dist/esm/toolbarListsIndentationPlugin.js +3 -0
- package/dist/esm/ui/toolbar-components/BulletedListMenuItem.js +11 -6
- package/dist/esm/ui/toolbar-components/ListsIndentationHeroButton.js +9 -9
- package/dist/esm/ui/toolbar-components/ListsIndentationMenu.js +2 -2
- package/dist/esm/ui/toolbar-components/NumberedListMenuItem.js +11 -6
- package/dist/esm/ui/toolbar-components/TaskListMenuItem.js +9 -4
- package/dist/esm/ui/toolbar-components.js +1 -1
- package/dist/types/toolbarListsIndentationPlugin.d.ts +4 -1
- package/dist/types/ui/toolbar-components/TaskListMenuItem.d.ts +2 -2
- package/dist/types-ts4.5/toolbarListsIndentationPlugin.d.ts +4 -1
- package/dist/types-ts4.5/ui/toolbar-components/TaskListMenuItem.d.ts +2 -2
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-toolbar-lists-indentation
|
|
2
2
|
|
|
3
|
+
## 6.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 6.1.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`a1f108aecc0d2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a1f108aecc0d2) -
|
|
14
|
+
ED-29302 [SoftServ] Task list is available from Page comment editor toolbar
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
17
|
+
## 6.1.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- [`cebd8f9171426`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cebd8f9171426) -
|
|
22
|
+
[ux] ED-29159 Implement transform task inside lists - handle logic
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
|
|
3
28
|
## 6.0.0
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -44,6 +44,9 @@ var toolbarListsIndentationPlugin = exports.toolbarListsIndentationPlugin = func
|
|
|
44
44
|
toolbarSize = _ref3.toolbarSize,
|
|
45
45
|
disabled = _ref3.disabled,
|
|
46
46
|
isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing;
|
|
47
|
+
if (!editorView) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
47
50
|
return /*#__PURE__*/_react.default.createElement(PrimaryToolbarComponent, {
|
|
48
51
|
featureFlags: featureFlags,
|
|
49
52
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -12,22 +12,27 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
13
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
14
14
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
16
|
var BulletedListMenuItem = exports.BulletedListMenuItem = function BulletedListMenuItem(_ref) {
|
|
16
17
|
var api = _ref.api,
|
|
17
18
|
parents = _ref.parents;
|
|
18
19
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
19
20
|
formatMessage = _useIntl.formatMessage;
|
|
20
|
-
var
|
|
21
|
-
|
|
21
|
+
var isTaskListItemEnabled = (0, _expValEquals.expValEquals)('platform_editor_toolbar_task_list_menu_item', 'isEnabled', true);
|
|
22
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['list', 'taskDecision'], function (states) {
|
|
23
|
+
var _states$listState, _states$listState2, _states$taskDecisionS;
|
|
22
24
|
return {
|
|
23
25
|
bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
|
|
24
|
-
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled
|
|
26
|
+
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
|
|
27
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
25
28
|
};
|
|
26
29
|
}),
|
|
27
30
|
bulletListActive = _useSharedPluginState.bulletListActive,
|
|
28
|
-
bulletListDisabled = _useSharedPluginState.bulletListDisabled
|
|
31
|
+
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
32
|
+
taskListActive = _useSharedPluginState.taskListActive;
|
|
29
33
|
var onClick = function onClick() {
|
|
30
|
-
|
|
34
|
+
var _api$taskDecision;
|
|
35
|
+
api === null || api === void 0 || api.core.actions.execute(isTaskListItemEnabled && taskListActive ? api === null || api === void 0 || (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 ? void 0 : _api$taskDecision.commands.toggleTaskList('bulletList') : api === null || api === void 0 ? void 0 : api.list.commands.toggleBulletList((0, _toolbar.getInputMethodFromParentKeys)(parents)));
|
|
31
36
|
};
|
|
32
37
|
var shortcut = (0, _keymaps.formatShortcut)(_keymaps.toggleBulletList);
|
|
33
38
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
@@ -39,7 +44,7 @@ var BulletedListMenuItem = exports.BulletedListMenuItem = function BulletedListM
|
|
|
39
44
|
shortcut: shortcut
|
|
40
45
|
}) : undefined,
|
|
41
46
|
isSelected: bulletListActive,
|
|
42
|
-
isDisabled: bulletListDisabled,
|
|
47
|
+
isDisabled: isTaskListItemEnabled ? bulletListDisabled && !taskListActive : bulletListDisabled,
|
|
43
48
|
onClick: onClick,
|
|
44
49
|
ariaKeyshortcuts: shortcut
|
|
45
50
|
}, formatMessage(_messages.listMessages.bulletedList));
|
|
@@ -19,7 +19,7 @@ var ListsIndentationHeroButton = exports.ListsIndentationHeroButton = function L
|
|
|
19
19
|
parents = _ref.parents;
|
|
20
20
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
21
21
|
formatMessage = _useIntl.formatMessage;
|
|
22
|
-
var
|
|
22
|
+
var isTaskListItemEnabled = (0, _expValEquals.expValEquals)('platform_editor_toolbar_task_list_menu_item', 'isEnabled', true);
|
|
23
23
|
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['list', 'taskDecision'], function (states) {
|
|
24
24
|
var _states$listState, _states$listState2, _states$listState3, _states$taskDecisionS;
|
|
25
25
|
return {
|
|
@@ -33,12 +33,12 @@ var ListsIndentationHeroButton = exports.ListsIndentationHeroButton = function L
|
|
|
33
33
|
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
34
34
|
orderedListActive = _useSharedPluginState.orderedListActive,
|
|
35
35
|
taskListActive = _useSharedPluginState.taskListActive;
|
|
36
|
-
var shortcut =
|
|
36
|
+
var shortcut = isTaskListItemEnabled && taskListActive ? (0, _keymaps.formatShortcut)(_keymaps.toggleTaskItemCheckbox) : orderedListActive ? (0, _keymaps.formatShortcut)(_keymaps.toggleOrderedList) : (0, _keymaps.formatShortcut)(_keymaps.toggleBulletList);
|
|
37
37
|
var onClick = function onClick() {
|
|
38
38
|
var inputMethod = (0, _toolbar.getInputMethodFromParentKeys)(parents);
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
if (isTaskListItemEnabled && taskListActive) {
|
|
40
|
+
var _api$taskDecision;
|
|
41
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 ? void 0 : _api$taskDecision.commands.toggleTaskList());
|
|
42
42
|
} else if (orderedListActive) {
|
|
43
43
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.list.commands.toggleOrderedList(inputMethod));
|
|
44
44
|
} else {
|
|
@@ -46,9 +46,9 @@ var ListsIndentationHeroButton = exports.ListsIndentationHeroButton = function L
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarTooltip, {
|
|
49
|
-
content:
|
|
49
|
+
content: isTaskListItemEnabled && taskListActive ? formatMessage(_messages.tasksAndDecisionsMessages.taskList) : orderedListActive ? formatMessage(_messages.listMessages.orderedList) : formatMessage(_messages.listMessages.bulletedList)
|
|
50
50
|
}, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButton, {
|
|
51
|
-
iconBefore:
|
|
51
|
+
iconBefore: isTaskListItemEnabled && taskListActive ? /*#__PURE__*/_react.default.createElement(_task.default, {
|
|
52
52
|
label: formatMessage(_messages.tasksAndDecisionsMessages.taskList),
|
|
53
53
|
size: "small"
|
|
54
54
|
}) : orderedListActive ? /*#__PURE__*/_react.default.createElement(_editorToolbar.ListNumberedIcon, {
|
|
@@ -58,8 +58,8 @@ var ListsIndentationHeroButton = exports.ListsIndentationHeroButton = function L
|
|
|
58
58
|
label: formatMessage(_messages.listMessages.bulletedList),
|
|
59
59
|
size: "small"
|
|
60
60
|
}),
|
|
61
|
-
isSelected: bulletListActive || orderedListActive ||
|
|
62
|
-
isDisabled: !orderedListActive && !(
|
|
61
|
+
isSelected: bulletListActive || orderedListActive || isTaskListItemEnabled && taskListActive,
|
|
62
|
+
isDisabled: !orderedListActive && !(isTaskListItemEnabled && taskListActive) && bulletListDisabled,
|
|
63
63
|
ariaKeyshortcuts: shortcut,
|
|
64
64
|
onClick: onClick
|
|
65
65
|
}));
|
|
@@ -19,7 +19,7 @@ var ListsIndentationMenu = exports.ListsIndentationMenu = function ListsIndentat
|
|
|
19
19
|
allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation;
|
|
20
20
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
21
21
|
formatMessage = _useIntl.formatMessage;
|
|
22
|
-
var
|
|
22
|
+
var isTaskListItemEnabled = (0, _expValEquals.expValEquals)('platform_editor_toolbar_task_list_menu_item', 'isEnabled', true);
|
|
23
23
|
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
24
24
|
editorView = _useEditorToolbar.editorView;
|
|
25
25
|
var indentationState = (0, _hooks2.useIndentationState)({
|
|
@@ -38,7 +38,7 @@ var ListsIndentationMenu = exports.ListsIndentationMenu = function ListsIndentat
|
|
|
38
38
|
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
39
39
|
orderedListDisabled = _useSharedPluginState.orderedListDisabled,
|
|
40
40
|
taskListActive = _useSharedPluginState.taskListActive;
|
|
41
|
-
var allItemsDisabled = bulletListDisabled && orderedListDisabled && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled) && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled) && !(
|
|
41
|
+
var allItemsDisabled = bulletListDisabled && orderedListDisabled && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled) && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled) && !(isTaskListItemEnabled && taskListActive);
|
|
42
42
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownMenu, {
|
|
43
43
|
iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.MoreItemsIcon, {
|
|
44
44
|
label: formatMessage(_lists.messages.lists)
|
|
@@ -12,22 +12,27 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
13
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
14
14
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
16
|
var NumberedListMenuItem = exports.NumberedListMenuItem = function NumberedListMenuItem(_ref) {
|
|
16
17
|
var api = _ref.api,
|
|
17
18
|
parents = _ref.parents;
|
|
18
19
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
19
20
|
formatMessage = _useIntl.formatMessage;
|
|
20
|
-
var
|
|
21
|
-
|
|
21
|
+
var isTaskListItemEnabled = (0, _expValEquals.expValEquals)('platform_editor_toolbar_task_list_menu_item', 'isEnabled', true);
|
|
22
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['list', 'taskDecision'], function (states) {
|
|
23
|
+
var _states$listState, _states$listState2, _states$taskDecisionS;
|
|
22
24
|
return {
|
|
23
25
|
orderedListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.orderedListActive,
|
|
24
|
-
orderedListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.orderedListDisabled
|
|
26
|
+
orderedListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.orderedListDisabled,
|
|
27
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
25
28
|
};
|
|
26
29
|
}),
|
|
27
30
|
orderedListActive = _useSharedPluginState.orderedListActive,
|
|
28
|
-
orderedListDisabled = _useSharedPluginState.orderedListDisabled
|
|
31
|
+
orderedListDisabled = _useSharedPluginState.orderedListDisabled,
|
|
32
|
+
taskListActive = _useSharedPluginState.taskListActive;
|
|
29
33
|
var onClick = function onClick() {
|
|
30
|
-
|
|
34
|
+
var _api$taskDecision;
|
|
35
|
+
api === null || api === void 0 || api.core.actions.execute(isTaskListItemEnabled && taskListActive ? api === null || api === void 0 || (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 ? void 0 : _api$taskDecision.commands.toggleTaskList('orderedList') : api === null || api === void 0 ? void 0 : api.list.commands.toggleOrderedList((0, _toolbar.getInputMethodFromParentKeys)(parents)));
|
|
31
36
|
};
|
|
32
37
|
var shortcut = (0, _keymaps.formatShortcut)(_keymaps.toggleOrderedList);
|
|
33
38
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
@@ -39,7 +44,7 @@ var NumberedListMenuItem = exports.NumberedListMenuItem = function NumberedListM
|
|
|
39
44
|
shortcut: shortcut
|
|
40
45
|
}) : undefined,
|
|
41
46
|
isSelected: orderedListActive,
|
|
42
|
-
isDisabled: orderedListDisabled,
|
|
47
|
+
isDisabled: isTaskListItemEnabled ? orderedListDisabled && !taskListActive : orderedListDisabled,
|
|
43
48
|
onClick: onClick,
|
|
44
49
|
ariaKeyshortcuts: shortcut
|
|
45
50
|
}, formatMessage(_messages.listMessages.orderedList));
|
|
@@ -8,18 +8,23 @@ exports.TaskListMenuItem = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
10
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
|
+
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
11
12
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
12
13
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
13
14
|
var _task = _interopRequireDefault(require("@atlaskit/icon/core/task"));
|
|
14
15
|
var TaskListMenuItem = exports.TaskListMenuItem = function TaskListMenuItem(_ref) {
|
|
15
|
-
var api = _ref.api
|
|
16
|
-
parents = _ref.parents;
|
|
16
|
+
var api = _ref.api;
|
|
17
17
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
18
18
|
formatMessage = _useIntl.formatMessage;
|
|
19
|
+
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
20
|
+
editorView = _useEditorToolbar.editorView;
|
|
19
21
|
var taskListActive = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'taskDecision.isInsideTask');
|
|
22
|
+
if (!(editorView !== null && editorView !== void 0 && editorView.state.schema.nodes.taskItem)) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
20
25
|
var handleClick = function handleClick() {
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
var _api$taskDecision;
|
|
27
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 ? void 0 : _api$taskDecision.commands.toggleTaskList());
|
|
23
28
|
};
|
|
24
29
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
25
30
|
elemBefore: /*#__PURE__*/_react.default.createElement(_task.default, {
|
|
@@ -110,7 +110,7 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
|
|
|
110
110
|
key: _toolbar.LISTS_INDENTATION_MENU_SECTION.key,
|
|
111
111
|
rank: _toolbar.LISTS_INDENTATION_MENU_SECTION_RANK[_toolbar.TASK_LIST_MENU_ITEM.key]
|
|
112
112
|
}],
|
|
113
|
-
component: (0, _expValEquals.expValEquals)('
|
|
113
|
+
component: (0, _expValEquals.expValEquals)('platform_editor_toolbar_task_list_menu_item', 'isEnabled', true) ? function (_ref6) {
|
|
114
114
|
var parents = _ref6.parents;
|
|
115
115
|
return /*#__PURE__*/_react.default.createElement(_TaskListMenuItem.TaskListMenuItem, {
|
|
116
116
|
api: api,
|
|
@@ -31,6 +31,9 @@ export const toolbarListsIndentationPlugin = ({
|
|
|
31
31
|
disabled,
|
|
32
32
|
isToolbarReducedSpacing
|
|
33
33
|
}) => {
|
|
34
|
+
if (!editorView) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
34
37
|
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
35
38
|
featureFlags: featureFlags,
|
|
36
39
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -5,6 +5,7 @@ import { toggleBulletList as toggleBulletListKeymap, formatShortcut } from '@atl
|
|
|
5
5
|
import { listMessages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { getInputMethodFromParentKeys } from '@atlaskit/editor-common/toolbar';
|
|
7
7
|
import { ListBulletedIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
8
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
9
|
export const BulletedListMenuItem = ({
|
|
9
10
|
api,
|
|
10
11
|
parents
|
|
@@ -12,18 +13,22 @@ export const BulletedListMenuItem = ({
|
|
|
12
13
|
const {
|
|
13
14
|
formatMessage
|
|
14
15
|
} = useIntl();
|
|
16
|
+
const isTaskListItemEnabled = expValEquals('platform_editor_toolbar_task_list_menu_item', 'isEnabled', true);
|
|
15
17
|
const {
|
|
16
18
|
bulletListActive,
|
|
17
|
-
bulletListDisabled
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
bulletListDisabled,
|
|
20
|
+
taskListActive
|
|
21
|
+
} = useSharedPluginStateWithSelector(api, ['list', 'taskDecision'], states => {
|
|
22
|
+
var _states$listState, _states$listState2, _states$taskDecisionS;
|
|
20
23
|
return {
|
|
21
24
|
bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
|
|
22
|
-
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled
|
|
25
|
+
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
|
|
26
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
23
27
|
};
|
|
24
28
|
});
|
|
25
29
|
const onClick = () => {
|
|
26
|
-
|
|
30
|
+
var _api$taskDecision;
|
|
31
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(isTaskListItemEnabled && taskListActive ? api === null || api === void 0 ? void 0 : (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 ? void 0 : _api$taskDecision.commands.toggleTaskList('bulletList') : api === null || api === void 0 ? void 0 : api.list.commands.toggleBulletList(getInputMethodFromParentKeys(parents)));
|
|
27
32
|
};
|
|
28
33
|
const shortcut = formatShortcut(toggleBulletListKeymap);
|
|
29
34
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -35,7 +40,7 @@ export const BulletedListMenuItem = ({
|
|
|
35
40
|
shortcut: shortcut
|
|
36
41
|
}) : undefined,
|
|
37
42
|
isSelected: bulletListActive,
|
|
38
|
-
isDisabled: bulletListDisabled,
|
|
43
|
+
isDisabled: isTaskListItemEnabled ? bulletListDisabled && !taskListActive : bulletListDisabled,
|
|
39
44
|
onClick: onClick,
|
|
40
45
|
ariaKeyshortcuts: shortcut
|
|
41
46
|
}, formatMessage(listMessages.bulletedList));
|
|
@@ -14,7 +14,7 @@ export const ListsIndentationHeroButton = ({
|
|
|
14
14
|
const {
|
|
15
15
|
formatMessage
|
|
16
16
|
} = useIntl();
|
|
17
|
-
const
|
|
17
|
+
const isTaskListItemEnabled = expValEquals('platform_editor_toolbar_task_list_menu_item', 'isEnabled', true);
|
|
18
18
|
const {
|
|
19
19
|
bulletListActive,
|
|
20
20
|
bulletListDisabled,
|
|
@@ -29,12 +29,12 @@ export const ListsIndentationHeroButton = ({
|
|
|
29
29
|
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
30
30
|
};
|
|
31
31
|
});
|
|
32
|
-
const shortcut =
|
|
32
|
+
const shortcut = isTaskListItemEnabled && taskListActive ? formatShortcut(toggleTaskItemCheckboxKeymap) : orderedListActive ? formatShortcut(toggleOrderedListKeymap) : formatShortcut(toggleBulletListKeymap);
|
|
33
33
|
const onClick = () => {
|
|
34
34
|
const inputMethod = getInputMethodFromParentKeys(parents);
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
if (isTaskListItemEnabled && taskListActive) {
|
|
36
|
+
var _api$taskDecision;
|
|
37
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 ? void 0 : _api$taskDecision.commands.toggleTaskList());
|
|
38
38
|
} else if (orderedListActive) {
|
|
39
39
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.list.commands.toggleOrderedList(inputMethod));
|
|
40
40
|
} else {
|
|
@@ -42,9 +42,9 @@ export const ListsIndentationHeroButton = ({
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
return /*#__PURE__*/React.createElement(ToolbarTooltip, {
|
|
45
|
-
content:
|
|
45
|
+
content: isTaskListItemEnabled && taskListActive ? formatMessage(tasksAndDecisionsMessages.taskList) : orderedListActive ? formatMessage(listMessages.orderedList) : formatMessage(listMessages.bulletedList)
|
|
46
46
|
}, /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
47
|
-
iconBefore:
|
|
47
|
+
iconBefore: isTaskListItemEnabled && taskListActive ? /*#__PURE__*/React.createElement(TaskIcon, {
|
|
48
48
|
label: formatMessage(tasksAndDecisionsMessages.taskList),
|
|
49
49
|
size: "small"
|
|
50
50
|
}) : orderedListActive ? /*#__PURE__*/React.createElement(ListNumberedIcon, {
|
|
@@ -54,8 +54,8 @@ export const ListsIndentationHeroButton = ({
|
|
|
54
54
|
label: formatMessage(listMessages.bulletedList),
|
|
55
55
|
size: "small"
|
|
56
56
|
}),
|
|
57
|
-
isSelected: bulletListActive || orderedListActive ||
|
|
58
|
-
isDisabled: !orderedListActive && !(
|
|
57
|
+
isSelected: bulletListActive || orderedListActive || isTaskListItemEnabled && taskListActive,
|
|
58
|
+
isDisabled: !orderedListActive && !(isTaskListItemEnabled && taskListActive) && bulletListDisabled,
|
|
59
59
|
ariaKeyshortcuts: shortcut,
|
|
60
60
|
onClick: onClick
|
|
61
61
|
}));
|
|
@@ -14,7 +14,7 @@ export const ListsIndentationMenu = ({
|
|
|
14
14
|
const {
|
|
15
15
|
formatMessage
|
|
16
16
|
} = useIntl();
|
|
17
|
-
const
|
|
17
|
+
const isTaskListItemEnabled = expValEquals('platform_editor_toolbar_task_list_menu_item', 'isEnabled', true);
|
|
18
18
|
const {
|
|
19
19
|
editorView
|
|
20
20
|
} = useEditorToolbar();
|
|
@@ -35,7 +35,7 @@ export const ListsIndentationMenu = ({
|
|
|
35
35
|
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
36
36
|
};
|
|
37
37
|
});
|
|
38
|
-
const allItemsDisabled = bulletListDisabled && orderedListDisabled && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled) && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled) && !(
|
|
38
|
+
const allItemsDisabled = bulletListDisabled && orderedListDisabled && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled) && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled) && !(isTaskListItemEnabled && taskListActive);
|
|
39
39
|
return /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
|
|
40
40
|
iconBefore: /*#__PURE__*/React.createElement(MoreItemsIcon, {
|
|
41
41
|
label: formatMessage(messages.lists)
|
|
@@ -5,6 +5,7 @@ import { toggleOrderedList as toggleOrderedListKeymap, formatShortcut } from '@a
|
|
|
5
5
|
import { listMessages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { getInputMethodFromParentKeys } from '@atlaskit/editor-common/toolbar';
|
|
7
7
|
import { ListNumberedIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
8
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
9
|
export const NumberedListMenuItem = ({
|
|
9
10
|
api,
|
|
10
11
|
parents
|
|
@@ -12,18 +13,22 @@ export const NumberedListMenuItem = ({
|
|
|
12
13
|
const {
|
|
13
14
|
formatMessage
|
|
14
15
|
} = useIntl();
|
|
16
|
+
const isTaskListItemEnabled = expValEquals('platform_editor_toolbar_task_list_menu_item', 'isEnabled', true);
|
|
15
17
|
const {
|
|
16
18
|
orderedListActive,
|
|
17
|
-
orderedListDisabled
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
orderedListDisabled,
|
|
20
|
+
taskListActive
|
|
21
|
+
} = useSharedPluginStateWithSelector(api, ['list', 'taskDecision'], states => {
|
|
22
|
+
var _states$listState, _states$listState2, _states$taskDecisionS;
|
|
20
23
|
return {
|
|
21
24
|
orderedListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.orderedListActive,
|
|
22
|
-
orderedListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.orderedListDisabled
|
|
25
|
+
orderedListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.orderedListDisabled,
|
|
26
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
23
27
|
};
|
|
24
28
|
});
|
|
25
29
|
const onClick = () => {
|
|
26
|
-
|
|
30
|
+
var _api$taskDecision;
|
|
31
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(isTaskListItemEnabled && taskListActive ? api === null || api === void 0 ? void 0 : (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 ? void 0 : _api$taskDecision.commands.toggleTaskList('orderedList') : api === null || api === void 0 ? void 0 : api.list.commands.toggleOrderedList(getInputMethodFromParentKeys(parents)));
|
|
27
32
|
};
|
|
28
33
|
const shortcut = formatShortcut(toggleOrderedListKeymap);
|
|
29
34
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -35,7 +40,7 @@ export const NumberedListMenuItem = ({
|
|
|
35
40
|
shortcut: shortcut
|
|
36
41
|
}) : undefined,
|
|
37
42
|
isSelected: orderedListActive,
|
|
38
|
-
isDisabled: orderedListDisabled,
|
|
43
|
+
isDisabled: isTaskListItemEnabled ? orderedListDisabled && !taskListActive : orderedListDisabled,
|
|
39
44
|
onClick: onClick,
|
|
40
45
|
ariaKeyshortcuts: shortcut
|
|
41
46
|
}, formatMessage(listMessages.orderedList));
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
4
5
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
5
6
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
6
7
|
import TaskIcon from '@atlaskit/icon/core/task';
|
|
7
8
|
export const TaskListMenuItem = ({
|
|
8
|
-
api
|
|
9
|
-
parents
|
|
9
|
+
api
|
|
10
10
|
}) => {
|
|
11
11
|
const {
|
|
12
12
|
formatMessage
|
|
13
13
|
} = useIntl();
|
|
14
|
+
const {
|
|
15
|
+
editorView
|
|
16
|
+
} = useEditorToolbar();
|
|
14
17
|
const taskListActive = useSharedPluginStateSelector(api, 'taskDecision.isInsideTask');
|
|
18
|
+
if (!(editorView !== null && editorView !== void 0 && editorView.state.schema.nodes.taskItem)) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
15
21
|
const handleClick = () => {
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
var _api$taskDecision;
|
|
23
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 ? void 0 : _api$taskDecision.commands.toggleTaskList());
|
|
18
24
|
};
|
|
19
25
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
20
26
|
elemBefore: /*#__PURE__*/React.createElement(TaskIcon, {
|
|
@@ -99,7 +99,7 @@ export const getToolbarComponents = ({
|
|
|
99
99
|
key: LISTS_INDENTATION_MENU_SECTION.key,
|
|
100
100
|
rank: LISTS_INDENTATION_MENU_SECTION_RANK[TASK_LIST_MENU_ITEM.key]
|
|
101
101
|
}],
|
|
102
|
-
component: expValEquals('
|
|
102
|
+
component: expValEquals('platform_editor_toolbar_task_list_menu_item', 'isEnabled', true) ? ({
|
|
103
103
|
parents
|
|
104
104
|
}) => /*#__PURE__*/React.createElement(TaskListMenuItem, {
|
|
105
105
|
api: api,
|
|
@@ -34,6 +34,9 @@ export var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugi
|
|
|
34
34
|
toolbarSize = _ref3.toolbarSize,
|
|
35
35
|
disabled = _ref3.disabled,
|
|
36
36
|
isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing;
|
|
37
|
+
if (!editorView) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
37
40
|
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
38
41
|
featureFlags: featureFlags,
|
|
39
42
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -5,22 +5,27 @@ import { toggleBulletList as toggleBulletListKeymap, formatShortcut } from '@atl
|
|
|
5
5
|
import { listMessages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { getInputMethodFromParentKeys } from '@atlaskit/editor-common/toolbar';
|
|
7
7
|
import { ListBulletedIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
8
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
9
|
export var BulletedListMenuItem = function BulletedListMenuItem(_ref) {
|
|
9
10
|
var api = _ref.api,
|
|
10
11
|
parents = _ref.parents;
|
|
11
12
|
var _useIntl = useIntl(),
|
|
12
13
|
formatMessage = _useIntl.formatMessage;
|
|
13
|
-
var
|
|
14
|
-
|
|
14
|
+
var isTaskListItemEnabled = expValEquals('platform_editor_toolbar_task_list_menu_item', 'isEnabled', true);
|
|
15
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['list', 'taskDecision'], function (states) {
|
|
16
|
+
var _states$listState, _states$listState2, _states$taskDecisionS;
|
|
15
17
|
return {
|
|
16
18
|
bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
|
|
17
|
-
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled
|
|
19
|
+
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
|
|
20
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
18
21
|
};
|
|
19
22
|
}),
|
|
20
23
|
bulletListActive = _useSharedPluginState.bulletListActive,
|
|
21
|
-
bulletListDisabled = _useSharedPluginState.bulletListDisabled
|
|
24
|
+
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
25
|
+
taskListActive = _useSharedPluginState.taskListActive;
|
|
22
26
|
var onClick = function onClick() {
|
|
23
|
-
|
|
27
|
+
var _api$taskDecision;
|
|
28
|
+
api === null || api === void 0 || api.core.actions.execute(isTaskListItemEnabled && taskListActive ? api === null || api === void 0 || (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 ? void 0 : _api$taskDecision.commands.toggleTaskList('bulletList') : api === null || api === void 0 ? void 0 : api.list.commands.toggleBulletList(getInputMethodFromParentKeys(parents)));
|
|
24
29
|
};
|
|
25
30
|
var shortcut = formatShortcut(toggleBulletListKeymap);
|
|
26
31
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -32,7 +37,7 @@ export var BulletedListMenuItem = function BulletedListMenuItem(_ref) {
|
|
|
32
37
|
shortcut: shortcut
|
|
33
38
|
}) : undefined,
|
|
34
39
|
isSelected: bulletListActive,
|
|
35
|
-
isDisabled: bulletListDisabled,
|
|
40
|
+
isDisabled: isTaskListItemEnabled ? bulletListDisabled && !taskListActive : bulletListDisabled,
|
|
36
41
|
onClick: onClick,
|
|
37
42
|
ariaKeyshortcuts: shortcut
|
|
38
43
|
}, formatMessage(listMessages.bulletedList));
|
|
@@ -12,7 +12,7 @@ export var ListsIndentationHeroButton = function ListsIndentationHeroButton(_ref
|
|
|
12
12
|
parents = _ref.parents;
|
|
13
13
|
var _useIntl = useIntl(),
|
|
14
14
|
formatMessage = _useIntl.formatMessage;
|
|
15
|
-
var
|
|
15
|
+
var isTaskListItemEnabled = expValEquals('platform_editor_toolbar_task_list_menu_item', 'isEnabled', true);
|
|
16
16
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['list', 'taskDecision'], function (states) {
|
|
17
17
|
var _states$listState, _states$listState2, _states$listState3, _states$taskDecisionS;
|
|
18
18
|
return {
|
|
@@ -26,12 +26,12 @@ export var ListsIndentationHeroButton = function ListsIndentationHeroButton(_ref
|
|
|
26
26
|
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
27
27
|
orderedListActive = _useSharedPluginState.orderedListActive,
|
|
28
28
|
taskListActive = _useSharedPluginState.taskListActive;
|
|
29
|
-
var shortcut =
|
|
29
|
+
var shortcut = isTaskListItemEnabled && taskListActive ? formatShortcut(toggleTaskItemCheckboxKeymap) : orderedListActive ? formatShortcut(toggleOrderedListKeymap) : formatShortcut(toggleBulletListKeymap);
|
|
30
30
|
var onClick = function onClick() {
|
|
31
31
|
var inputMethod = getInputMethodFromParentKeys(parents);
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
if (isTaskListItemEnabled && taskListActive) {
|
|
33
|
+
var _api$taskDecision;
|
|
34
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 ? void 0 : _api$taskDecision.commands.toggleTaskList());
|
|
35
35
|
} else if (orderedListActive) {
|
|
36
36
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.list.commands.toggleOrderedList(inputMethod));
|
|
37
37
|
} else {
|
|
@@ -39,9 +39,9 @@ export var ListsIndentationHeroButton = function ListsIndentationHeroButton(_ref
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
return /*#__PURE__*/React.createElement(ToolbarTooltip, {
|
|
42
|
-
content:
|
|
42
|
+
content: isTaskListItemEnabled && taskListActive ? formatMessage(tasksAndDecisionsMessages.taskList) : orderedListActive ? formatMessage(listMessages.orderedList) : formatMessage(listMessages.bulletedList)
|
|
43
43
|
}, /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
44
|
-
iconBefore:
|
|
44
|
+
iconBefore: isTaskListItemEnabled && taskListActive ? /*#__PURE__*/React.createElement(TaskIcon, {
|
|
45
45
|
label: formatMessage(tasksAndDecisionsMessages.taskList),
|
|
46
46
|
size: "small"
|
|
47
47
|
}) : orderedListActive ? /*#__PURE__*/React.createElement(ListNumberedIcon, {
|
|
@@ -51,8 +51,8 @@ export var ListsIndentationHeroButton = function ListsIndentationHeroButton(_ref
|
|
|
51
51
|
label: formatMessage(listMessages.bulletedList),
|
|
52
52
|
size: "small"
|
|
53
53
|
}),
|
|
54
|
-
isSelected: bulletListActive || orderedListActive ||
|
|
55
|
-
isDisabled: !orderedListActive && !(
|
|
54
|
+
isSelected: bulletListActive || orderedListActive || isTaskListItemEnabled && taskListActive,
|
|
55
|
+
isDisabled: !orderedListActive && !(isTaskListItemEnabled && taskListActive) && bulletListDisabled,
|
|
56
56
|
ariaKeyshortcuts: shortcut,
|
|
57
57
|
onClick: onClick
|
|
58
58
|
}));
|
|
@@ -12,7 +12,7 @@ export var ListsIndentationMenu = function ListsIndentationMenu(_ref) {
|
|
|
12
12
|
allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation;
|
|
13
13
|
var _useIntl = useIntl(),
|
|
14
14
|
formatMessage = _useIntl.formatMessage;
|
|
15
|
-
var
|
|
15
|
+
var isTaskListItemEnabled = expValEquals('platform_editor_toolbar_task_list_menu_item', 'isEnabled', true);
|
|
16
16
|
var _useEditorToolbar = useEditorToolbar(),
|
|
17
17
|
editorView = _useEditorToolbar.editorView;
|
|
18
18
|
var indentationState = useIndentationState({
|
|
@@ -31,7 +31,7 @@ export var ListsIndentationMenu = function ListsIndentationMenu(_ref) {
|
|
|
31
31
|
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
32
32
|
orderedListDisabled = _useSharedPluginState.orderedListDisabled,
|
|
33
33
|
taskListActive = _useSharedPluginState.taskListActive;
|
|
34
|
-
var allItemsDisabled = bulletListDisabled && orderedListDisabled && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled) && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled) && !(
|
|
34
|
+
var allItemsDisabled = bulletListDisabled && orderedListDisabled && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled) && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled) && !(isTaskListItemEnabled && taskListActive);
|
|
35
35
|
return /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
|
|
36
36
|
iconBefore: /*#__PURE__*/React.createElement(MoreItemsIcon, {
|
|
37
37
|
label: formatMessage(messages.lists)
|
|
@@ -5,22 +5,27 @@ import { toggleOrderedList as toggleOrderedListKeymap, formatShortcut } from '@a
|
|
|
5
5
|
import { listMessages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { getInputMethodFromParentKeys } from '@atlaskit/editor-common/toolbar';
|
|
7
7
|
import { ListNumberedIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
8
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
9
|
export var NumberedListMenuItem = function NumberedListMenuItem(_ref) {
|
|
9
10
|
var api = _ref.api,
|
|
10
11
|
parents = _ref.parents;
|
|
11
12
|
var _useIntl = useIntl(),
|
|
12
13
|
formatMessage = _useIntl.formatMessage;
|
|
13
|
-
var
|
|
14
|
-
|
|
14
|
+
var isTaskListItemEnabled = expValEquals('platform_editor_toolbar_task_list_menu_item', 'isEnabled', true);
|
|
15
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['list', 'taskDecision'], function (states) {
|
|
16
|
+
var _states$listState, _states$listState2, _states$taskDecisionS;
|
|
15
17
|
return {
|
|
16
18
|
orderedListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.orderedListActive,
|
|
17
|
-
orderedListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.orderedListDisabled
|
|
19
|
+
orderedListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.orderedListDisabled,
|
|
20
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
18
21
|
};
|
|
19
22
|
}),
|
|
20
23
|
orderedListActive = _useSharedPluginState.orderedListActive,
|
|
21
|
-
orderedListDisabled = _useSharedPluginState.orderedListDisabled
|
|
24
|
+
orderedListDisabled = _useSharedPluginState.orderedListDisabled,
|
|
25
|
+
taskListActive = _useSharedPluginState.taskListActive;
|
|
22
26
|
var onClick = function onClick() {
|
|
23
|
-
|
|
27
|
+
var _api$taskDecision;
|
|
28
|
+
api === null || api === void 0 || api.core.actions.execute(isTaskListItemEnabled && taskListActive ? api === null || api === void 0 || (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 ? void 0 : _api$taskDecision.commands.toggleTaskList('orderedList') : api === null || api === void 0 ? void 0 : api.list.commands.toggleOrderedList(getInputMethodFromParentKeys(parents)));
|
|
24
29
|
};
|
|
25
30
|
var shortcut = formatShortcut(toggleOrderedListKeymap);
|
|
26
31
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -32,7 +37,7 @@ export var NumberedListMenuItem = function NumberedListMenuItem(_ref) {
|
|
|
32
37
|
shortcut: shortcut
|
|
33
38
|
}) : undefined,
|
|
34
39
|
isSelected: orderedListActive,
|
|
35
|
-
isDisabled: orderedListDisabled,
|
|
40
|
+
isDisabled: isTaskListItemEnabled ? orderedListDisabled && !taskListActive : orderedListDisabled,
|
|
36
41
|
onClick: onClick,
|
|
37
42
|
ariaKeyshortcuts: shortcut
|
|
38
43
|
}, formatMessage(listMessages.orderedList));
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
4
5
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
5
6
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
6
7
|
import TaskIcon from '@atlaskit/icon/core/task';
|
|
7
8
|
export var TaskListMenuItem = function TaskListMenuItem(_ref) {
|
|
8
|
-
var api = _ref.api
|
|
9
|
-
parents = _ref.parents;
|
|
9
|
+
var api = _ref.api;
|
|
10
10
|
var _useIntl = useIntl(),
|
|
11
11
|
formatMessage = _useIntl.formatMessage;
|
|
12
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
13
|
+
editorView = _useEditorToolbar.editorView;
|
|
12
14
|
var taskListActive = useSharedPluginStateSelector(api, 'taskDecision.isInsideTask');
|
|
15
|
+
if (!(editorView !== null && editorView !== void 0 && editorView.state.schema.nodes.taskItem)) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
13
18
|
var handleClick = function handleClick() {
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
var _api$taskDecision;
|
|
20
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 ? void 0 : _api$taskDecision.commands.toggleTaskList());
|
|
16
21
|
};
|
|
17
22
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
18
23
|
elemBefore: /*#__PURE__*/React.createElement(TaskIcon, {
|
|
@@ -103,7 +103,7 @@ export var getToolbarComponents = function getToolbarComponents(_ref) {
|
|
|
103
103
|
key: LISTS_INDENTATION_MENU_SECTION.key,
|
|
104
104
|
rank: LISTS_INDENTATION_MENU_SECTION_RANK[TASK_LIST_MENU_ITEM.key]
|
|
105
105
|
}],
|
|
106
|
-
component: expValEquals('
|
|
106
|
+
component: expValEquals('platform_editor_toolbar_task_list_menu_item', 'isEnabled', true) ? function (_ref6) {
|
|
107
107
|
var parents = _ref6.parents;
|
|
108
108
|
return /*#__PURE__*/React.createElement(TaskListMenuItem, {
|
|
109
109
|
api: api,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ExtractInjectionAPI, FeatureFlags, ToolbarUiComponentFactoryParams } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
4
|
import type { ToolbarListsIndentationPlugin } from './toolbarListsIndentationPluginType';
|
|
4
5
|
export declare const toolbarListsIndentationPlugin: ToolbarListsIndentationPlugin;
|
|
5
6
|
type PrimaryToolbarComponentProps = Pick<ToolbarUiComponentFactoryParams, 'editorView' | 'popupsMountPoint' | 'popupsBoundariesElement' | 'popupsScrollableElement' | 'disabled' | 'isToolbarReducedSpacing'> & {
|
|
@@ -9,5 +10,7 @@ type PrimaryToolbarComponentProps = Pick<ToolbarUiComponentFactoryParams, 'edito
|
|
|
9
10
|
pluginInjectionApi: ExtractInjectionAPI<typeof toolbarListsIndentationPlugin> | undefined;
|
|
10
11
|
showIndentationButtons?: boolean;
|
|
11
12
|
};
|
|
12
|
-
export declare function PrimaryToolbarComponent({ featureFlags, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, isSmall, isToolbarReducedSpacing, disabled, editorView, showIndentationButtons, pluginInjectionApi, allowHeadingAndParagraphIndentation, }: PrimaryToolbarComponentProps
|
|
13
|
+
export declare function PrimaryToolbarComponent({ featureFlags, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, isSmall, isToolbarReducedSpacing, disabled, editorView, showIndentationButtons, pluginInjectionApi, allowHeadingAndParagraphIndentation, }: PrimaryToolbarComponentProps & {
|
|
14
|
+
editorView: EditorView;
|
|
15
|
+
}): React.JSX.Element | null;
|
|
13
16
|
export {};
|
|
@@ -4,7 +4,7 @@ import type { ToolbarComponentTypes } from '@atlaskit/editor-toolbar-model';
|
|
|
4
4
|
import type { ToolbarListsIndentationPlugin } from '../../toolbarListsIndentationPluginType';
|
|
5
5
|
type TaskListMenuItemProps = {
|
|
6
6
|
api?: ExtractInjectionAPI<ToolbarListsIndentationPlugin>;
|
|
7
|
-
parents
|
|
7
|
+
parents?: ToolbarComponentTypes;
|
|
8
8
|
};
|
|
9
|
-
export declare const TaskListMenuItem: ({ api
|
|
9
|
+
export declare const TaskListMenuItem: ({ api }: TaskListMenuItemProps) => React.JSX.Element | null;
|
|
10
10
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ExtractInjectionAPI, FeatureFlags, ToolbarUiComponentFactoryParams } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
4
|
import type { ToolbarListsIndentationPlugin } from './toolbarListsIndentationPluginType';
|
|
4
5
|
export declare const toolbarListsIndentationPlugin: ToolbarListsIndentationPlugin;
|
|
5
6
|
type PrimaryToolbarComponentProps = Pick<ToolbarUiComponentFactoryParams, 'editorView' | 'popupsMountPoint' | 'popupsBoundariesElement' | 'popupsScrollableElement' | 'disabled' | 'isToolbarReducedSpacing'> & {
|
|
@@ -9,5 +10,7 @@ type PrimaryToolbarComponentProps = Pick<ToolbarUiComponentFactoryParams, 'edito
|
|
|
9
10
|
pluginInjectionApi: ExtractInjectionAPI<typeof toolbarListsIndentationPlugin> | undefined;
|
|
10
11
|
showIndentationButtons?: boolean;
|
|
11
12
|
};
|
|
12
|
-
export declare function PrimaryToolbarComponent({ featureFlags, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, isSmall, isToolbarReducedSpacing, disabled, editorView, showIndentationButtons, pluginInjectionApi, allowHeadingAndParagraphIndentation, }: PrimaryToolbarComponentProps
|
|
13
|
+
export declare function PrimaryToolbarComponent({ featureFlags, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, isSmall, isToolbarReducedSpacing, disabled, editorView, showIndentationButtons, pluginInjectionApi, allowHeadingAndParagraphIndentation, }: PrimaryToolbarComponentProps & {
|
|
14
|
+
editorView: EditorView;
|
|
15
|
+
}): React.JSX.Element | null;
|
|
13
16
|
export {};
|
|
@@ -4,7 +4,7 @@ import type { ToolbarComponentTypes } from '@atlaskit/editor-toolbar-model';
|
|
|
4
4
|
import type { ToolbarListsIndentationPlugin } from '../../toolbarListsIndentationPluginType';
|
|
5
5
|
type TaskListMenuItemProps = {
|
|
6
6
|
api?: ExtractInjectionAPI<ToolbarListsIndentationPlugin>;
|
|
7
|
-
parents
|
|
7
|
+
parents?: ToolbarComponentTypes;
|
|
8
8
|
};
|
|
9
|
-
export declare const TaskListMenuItem: ({ api
|
|
9
|
+
export declare const TaskListMenuItem: ({ api }: TaskListMenuItemProps) => React.JSX.Element | null;
|
|
10
10
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-toolbar-lists-indentation",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.2",
|
|
4
4
|
"description": "Toolbar lists and indentation plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,27 +30,27 @@
|
|
|
30
30
|
"atlaskit:src": "src/index.ts",
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@atlaskit/css": "^0.14.0",
|
|
33
|
-
"@atlaskit/editor-plugin-analytics": "^5.
|
|
34
|
-
"@atlaskit/editor-plugin-block-type": "^8.
|
|
33
|
+
"@atlaskit/editor-plugin-analytics": "^5.2.0",
|
|
34
|
+
"@atlaskit/editor-plugin-block-type": "^8.2.0",
|
|
35
35
|
"@atlaskit/editor-plugin-feature-flags": "^4.0.0",
|
|
36
|
-
"@atlaskit/editor-plugin-indentation": "^5.
|
|
37
|
-
"@atlaskit/editor-plugin-list": "^7.
|
|
36
|
+
"@atlaskit/editor-plugin-indentation": "^5.2.0",
|
|
37
|
+
"@atlaskit/editor-plugin-list": "^7.2.0",
|
|
38
38
|
"@atlaskit/editor-plugin-primary-toolbar": "^6.0.0",
|
|
39
|
-
"@atlaskit/editor-plugin-selection-toolbar": "^6.
|
|
40
|
-
"@atlaskit/editor-plugin-tasks-and-decisions": "^8.
|
|
41
|
-
"@atlaskit/editor-plugin-toolbar": "^2.
|
|
39
|
+
"@atlaskit/editor-plugin-selection-toolbar": "^6.1.0",
|
|
40
|
+
"@atlaskit/editor-plugin-tasks-and-decisions": "^8.4.0",
|
|
41
|
+
"@atlaskit/editor-plugin-toolbar": "^2.1.0",
|
|
42
42
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
43
43
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
44
|
-
"@atlaskit/editor-toolbar": "^0.
|
|
44
|
+
"@atlaskit/editor-toolbar": "^0.9.0",
|
|
45
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": "^12.
|
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^12.21.0",
|
|
49
49
|
"@atlaskit/tokens": "^6.3.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@atlaskit/editor-common": "^109.
|
|
53
|
+
"@atlaskit/editor-common": "^109.6.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,10 +58,10 @@
|
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@af/integration-testing": "workspace:^",
|
|
60
60
|
"@af/visual-regression": "workspace:^",
|
|
61
|
-
"@atlaskit/adf-schema": "^51.
|
|
61
|
+
"@atlaskit/adf-schema": "^51.1.2",
|
|
62
62
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
63
|
-
"@atlaskit/editor-plugin-base": "^6.
|
|
64
|
-
"@atlaskit/editor-plugin-text-formatting": "^5.
|
|
63
|
+
"@atlaskit/editor-plugin-base": "^6.2.0",
|
|
64
|
+
"@atlaskit/editor-plugin-text-formatting": "^5.2.0",
|
|
65
65
|
"@atlaskit/ssr": "workspace:^",
|
|
66
66
|
"@testing-library/react": "^13.4.0",
|
|
67
67
|
"wait-for-expect": "^1.2.0"
|