@atlaskit/editor-plugin-toolbar-lists-indentation 23.0.2 → 23.0.4
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 +14 -0
- package/dist/cjs/ui/onItemActivated.js +1 -13
- package/dist/cjs/ui/toolbar-components/BulletedListMenuItem.js +6 -27
- package/dist/cjs/ui/toolbar-components/ListsIndentationHeroButton.js +13 -38
- package/dist/cjs/ui/toolbar-components/ListsIndentationMenu.js +5 -10
- package/dist/cjs/ui/toolbar-components/NumberedListMenuItem.js +6 -27
- package/dist/cjs/ui/toolbar-components/TaskListMenuItem.js +6 -29
- package/dist/es2019/ui/onItemActivated.js +1 -13
- package/dist/es2019/ui/toolbar-components/BulletedListMenuItem.js +6 -27
- package/dist/es2019/ui/toolbar-components/ListsIndentationHeroButton.js +13 -38
- package/dist/es2019/ui/toolbar-components/ListsIndentationMenu.js +5 -10
- package/dist/es2019/ui/toolbar-components/NumberedListMenuItem.js +6 -27
- package/dist/es2019/ui/toolbar-components/TaskListMenuItem.js +6 -29
- package/dist/esm/ui/onItemActivated.js +1 -13
- package/dist/esm/ui/toolbar-components/BulletedListMenuItem.js +6 -27
- package/dist/esm/ui/toolbar-components/ListsIndentationHeroButton.js +13 -38
- package/dist/esm/ui/toolbar-components/ListsIndentationMenu.js +5 -10
- package/dist/esm/ui/toolbar-components/NumberedListMenuItem.js +6 -27
- package/dist/esm/ui/toolbar-components/TaskListMenuItem.js +6 -29
- package/dist/types/toolbarListsIndentationPluginType.d.ts +1 -2
- package/package.json +3 -8
- package/dist/cjs/ui/utils/markdown-compatible-toolbar.js +0 -11
- package/dist/es2019/ui/utils/markdown-compatible-toolbar.js +0 -3
- package/dist/esm/ui/utils/markdown-compatible-toolbar.js +0 -5
- package/dist/types/ui/utils/markdown-compatible-toolbar.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-toolbar-lists-indentation
|
|
2
2
|
|
|
3
|
+
## 23.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 23.0.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`85394203c5e0a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/85394203c5e0a) -
|
|
14
|
+
Cleanup `platform_editor_markdown_compatible_toolbar`.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 23.0.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -4,28 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.onItemActivated = void 0;
|
|
7
|
-
var _markdownCompatibleToolbar = require("./utils/markdown-compatible-toolbar");
|
|
8
7
|
var onItemActivated = exports.onItemActivated = function onItemActivated(pluginInjectionApi, indentationStateNode, inputMethod) {
|
|
9
8
|
return function (_ref) {
|
|
10
|
-
var _pluginInjectionApi$
|
|
9
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$l, _pluginInjectionApi$c2, _pluginInjectionApi$l2;
|
|
11
10
|
var buttonName = _ref.buttonName,
|
|
12
11
|
editorView = _ref.editorView;
|
|
13
|
-
var isInSourceView = (0, _markdownCompatibleToolbar.isMarkdownCompatibleToolbarEnabled)() && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.markdownMode) === null || _pluginInjectionApi$m === void 0 || (_pluginInjectionApi$m = _pluginInjectionApi$m.sharedState.currentState()) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.view) === 'syntax';
|
|
14
12
|
switch (buttonName) {
|
|
15
13
|
case 'bullet_list':
|
|
16
|
-
if (isInSourceView) {
|
|
17
|
-
var _pluginInjectionApi$m2;
|
|
18
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m2 = pluginInjectionApi.markdownMode) === null || _pluginInjectionApi$m2 === void 0 || _pluginInjectionApi$m2.actions.toggleSourceBulletList();
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
14
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$l = pluginInjectionApi.list) === null || _pluginInjectionApi$l === void 0 ? void 0 : _pluginInjectionApi$l.commands.toggleBulletList(inputMethod));
|
|
22
15
|
break;
|
|
23
16
|
case 'ordered_list':
|
|
24
|
-
if (isInSourceView) {
|
|
25
|
-
var _pluginInjectionApi$m3;
|
|
26
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m3 = pluginInjectionApi.markdownMode) === null || _pluginInjectionApi$m3 === void 0 || _pluginInjectionApi$m3.actions.toggleSourceOrderedList();
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
17
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 || _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$l2 = pluginInjectionApi.list) === null || _pluginInjectionApi$l2 === void 0 ? void 0 : _pluginInjectionApi$l2.commands.toggleOrderedList(inputMethod));
|
|
30
18
|
break;
|
|
31
19
|
case 'indent':
|
|
@@ -12,47 +12,26 @@ 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 _markdownCompatibleToolbar = require("../utils/markdown-compatible-toolbar");
|
|
16
15
|
var useBulletedListInfo = exports.useBulletedListInfo = function useBulletedListInfo(_ref) {
|
|
17
16
|
var api = _ref.api,
|
|
18
17
|
parents = _ref.parents;
|
|
19
18
|
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
20
19
|
formatMessage = _useIntl.formatMessage;
|
|
21
20
|
var bulletMessage = formatMessage(_messages.listMessages.bulletedList);
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
var _states$listState, _states$listState2, _states$taskDecisionS, _states$markdownModeS, _states$markdownModeS2, _states$markdownModeS3;
|
|
21
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['list', 'taskDecision'], function (states) {
|
|
22
|
+
var _states$listState, _states$listState2, _states$taskDecisionS;
|
|
25
23
|
return {
|
|
26
24
|
bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
|
|
27
25
|
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
|
|
28
|
-
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
29
|
-
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined,
|
|
30
|
-
sourceBlockFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS2 = states.markdownModeState) === null || _states$markdownModeS2 === void 0 ? void 0 : _states$markdownModeS2.sourceBlockFormatState : null,
|
|
31
|
-
sourceListFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS3 = states.markdownModeState) === null || _states$markdownModeS3 === void 0 ? void 0 : _states$markdownModeS3.sourceListFormatState : null
|
|
26
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
32
27
|
};
|
|
33
28
|
}),
|
|
34
29
|
bulletListActive = _useSharedPluginState.bulletListActive,
|
|
35
30
|
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
36
|
-
taskListActive = _useSharedPluginState.taskListActive
|
|
37
|
-
|
|
38
|
-
sourceListFormatState = _useSharedPluginState.sourceListFormatState,
|
|
39
|
-
markdownView = _useSharedPluginState.markdownView;
|
|
40
|
-
var isInSourceView = isMarkdownToolbarEnabled && markdownView === 'syntax';
|
|
41
|
-
var isSourceTaskListActive = Boolean(sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inTaskList);
|
|
42
|
-
var isDisabled = isInSourceView ? Boolean((sourceBlockFormatState === null || sourceBlockFormatState === void 0 ? void 0 : sourceBlockFormatState.inCodeBlock) || isSourceTaskListActive) : bulletListDisabled && !taskListActive;
|
|
31
|
+
taskListActive = _useSharedPluginState.taskListActive;
|
|
32
|
+
var isDisabled = bulletListDisabled && !taskListActive;
|
|
43
33
|
var onClick = function onClick() {
|
|
44
34
|
var _api$taskDecision;
|
|
45
|
-
if (isInSourceView) {
|
|
46
|
-
var _api$markdownMode;
|
|
47
|
-
if (sourceBlockFormatState !== null && sourceBlockFormatState !== void 0 && sourceBlockFormatState.inCodeBlock) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
if (isSourceTaskListActive) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
api === null || api === void 0 || (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 || _api$markdownMode.actions.toggleSourceBulletList();
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
35
|
api === null || api === void 0 || api.core.actions.execute(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)));
|
|
57
36
|
};
|
|
58
37
|
var shortcut = (0, _keymaps.formatShortcut)(_keymaps.toggleBulletList);
|
|
@@ -60,7 +39,7 @@ var useBulletedListInfo = exports.useBulletedListInfo = function useBulletedList
|
|
|
60
39
|
bulletMessage: bulletMessage,
|
|
61
40
|
onClick: onClick,
|
|
62
41
|
isDisabled: isDisabled,
|
|
63
|
-
isSelected:
|
|
42
|
+
isSelected: bulletListActive,
|
|
64
43
|
shortcut: shortcut
|
|
65
44
|
};
|
|
66
45
|
};
|
|
@@ -14,39 +14,27 @@ var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
|
14
14
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
15
|
var _task = _interopRequireDefault(require("@atlaskit/icon/core/task"));
|
|
16
16
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
17
|
-
var _markdownCompatibleToolbar = require("../utils/markdown-compatible-toolbar");
|
|
18
17
|
function useListsIndentationHeroButtonInfo(_ref) {
|
|
19
18
|
var api = _ref.api,
|
|
20
19
|
parents = _ref.parents,
|
|
21
20
|
defaultListType = _ref.defaultListType;
|
|
22
21
|
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
23
22
|
formatMessage = _useIntl.formatMessage;
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
var _states$interactionSt, _states$listState, _states$listState2, _states$listState3, _states$taskDecisionS, _states$markdownModeS, _states$markdownModeS2, _states$markdownModeS3;
|
|
23
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['list', 'taskDecision', 'interaction'], function (states) {
|
|
24
|
+
var _states$interactionSt, _states$listState, _states$listState2, _states$listState3, _states$taskDecisionS;
|
|
27
25
|
var useDefaultToolbarState = ((_states$interactionSt = states.interactionState) === null || _states$interactionSt === void 0 ? void 0 : _states$interactionSt.interactionState) === 'hasNotHadInteraction' && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_default_toolbar_state');
|
|
28
26
|
return {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined,
|
|
34
|
-
sourceBlockFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS2 = states.markdownModeState) === null || _states$markdownModeS2 === void 0 ? void 0 : _states$markdownModeS2.sourceBlockFormatState : null,
|
|
35
|
-
sourceListFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS3 = states.markdownModeState) === null || _states$markdownModeS3 === void 0 ? void 0 : _states$markdownModeS3.sourceListFormatState : null
|
|
27
|
+
bulletListActive: useDefaultToolbarState ? false : (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
|
|
28
|
+
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
|
|
29
|
+
orderedListActive: useDefaultToolbarState ? false : (_states$listState3 = states.listState) === null || _states$listState3 === void 0 ? void 0 : _states$listState3.orderedListActive,
|
|
30
|
+
taskListActive: useDefaultToolbarState ? false : (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
36
31
|
};
|
|
37
32
|
}),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
sourceListFormatState = _useSharedPluginState.sourceListFormatState,
|
|
44
|
-
markdownView = _useSharedPluginState.markdownView;
|
|
45
|
-
var isInSourceView = isMarkdownToolbarEnabled && markdownView === 'syntax';
|
|
46
|
-
var isBulletListActive = isInSourceView ? sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inBulletList : pmBulletListActive;
|
|
47
|
-
var isOrderedListActive = isInSourceView ? sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inOrderedList : pmOrderedListActive;
|
|
48
|
-
var taskListActive = isInSourceView ? Boolean(sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inTaskList) : pmTaskListActive;
|
|
49
|
-
var getListType = taskListActive ? 'taskList' : isOrderedListActive ? 'orderedList' : defaultListType;
|
|
33
|
+
bulletListActive = _useSharedPluginState.bulletListActive,
|
|
34
|
+
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
35
|
+
orderedListActive = _useSharedPluginState.orderedListActive,
|
|
36
|
+
taskListActive = _useSharedPluginState.taskListActive;
|
|
37
|
+
var getListType = taskListActive ? 'taskList' : orderedListActive ? 'orderedList' : defaultListType;
|
|
50
38
|
var taskListKeymap = _keymaps.toggleTaskList;
|
|
51
39
|
var getKeymap = getListType === 'taskList' ? taskListKeymap : getListType === 'orderedList' ? _keymaps.toggleOrderedList : _keymaps.toggleBulletList;
|
|
52
40
|
var shortcut = (0, _keymaps.formatShortcut)(getKeymap);
|
|
@@ -54,19 +42,6 @@ function useListsIndentationHeroButtonInfo(_ref) {
|
|
|
54
42
|
var message = getListType === 'taskList' ? formatMessage(_messages.tasksAndDecisionsMessages.taskList) : getListType === 'orderedList' ? formatMessage(_messages.listMessages.orderedList) : formatMessage(_messages.listMessages.bulletedList);
|
|
55
43
|
var onClick = function onClick() {
|
|
56
44
|
var inputMethod = (0, _toolbar.getInputMethodFromParentKeys)(parents);
|
|
57
|
-
if (isInSourceView) {
|
|
58
|
-
if (sourceBlockFormatState !== null && sourceBlockFormatState !== void 0 && sourceBlockFormatState.inCodeBlock || getListType === 'taskList') {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (getListType === 'orderedList') {
|
|
62
|
-
var _api$markdownMode;
|
|
63
|
-
api === null || api === void 0 || (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 || _api$markdownMode.actions.toggleSourceOrderedList();
|
|
64
|
-
} else {
|
|
65
|
-
var _api$markdownMode2;
|
|
66
|
-
api === null || api === void 0 || (_api$markdownMode2 = api.markdownMode) === null || _api$markdownMode2 === void 0 || _api$markdownMode2.actions.toggleSourceBulletList();
|
|
67
|
-
}
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
45
|
if (getListType === 'taskList') {
|
|
71
46
|
var _api$taskDecision;
|
|
72
47
|
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());
|
|
@@ -86,8 +61,8 @@ function useListsIndentationHeroButtonInfo(_ref) {
|
|
|
86
61
|
label: formatMessage(_messages.listMessages.bulletedList),
|
|
87
62
|
size: "small"
|
|
88
63
|
});
|
|
89
|
-
var isSelected = getListType === 'bulletList' ?
|
|
90
|
-
var isDisabled =
|
|
64
|
+
var isSelected = getListType === 'bulletList' ? bulletListActive : getListType === 'orderedList' ? orderedListActive : taskListActive;
|
|
65
|
+
var isDisabled = !orderedListActive && !taskListActive && bulletListDisabled;
|
|
91
66
|
return {
|
|
92
67
|
shortcut: shortcut,
|
|
93
68
|
keymap: keymap,
|
|
@@ -12,7 +12,6 @@ var _lists = require("@atlaskit/editor-common/lists");
|
|
|
12
12
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
13
13
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
14
14
|
var _hooks2 = require("../utils/hooks");
|
|
15
|
-
var _markdownCompatibleToolbar = require("../utils/markdown-compatible-toolbar");
|
|
16
15
|
var ListsIndentationMenu = exports.ListsIndentationMenu = function ListsIndentationMenu(_ref) {
|
|
17
16
|
var children = _ref.children,
|
|
18
17
|
api = _ref.api,
|
|
@@ -26,22 +25,18 @@ var ListsIndentationMenu = exports.ListsIndentationMenu = function ListsIndentat
|
|
|
26
25
|
allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation,
|
|
27
26
|
state: editorView === null || editorView === void 0 ? void 0 : editorView.state
|
|
28
27
|
});
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
var _states$listState, _states$listState2, _states$taskDecisionS, _states$markdownModeS;
|
|
28
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['list', 'taskDecision'], function (states) {
|
|
29
|
+
var _states$listState, _states$listState2, _states$taskDecisionS;
|
|
32
30
|
return {
|
|
33
31
|
bulletListDisabled: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListDisabled,
|
|
34
32
|
orderedListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.orderedListDisabled,
|
|
35
|
-
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
36
|
-
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined
|
|
33
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
37
34
|
};
|
|
38
35
|
}),
|
|
39
36
|
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
40
37
|
orderedListDisabled = _useSharedPluginState.orderedListDisabled,
|
|
41
|
-
taskListActive = _useSharedPluginState.taskListActive
|
|
42
|
-
|
|
43
|
-
var isInSourceView = isMarkdownToolbarEnabled && markdownView === 'syntax';
|
|
44
|
-
var allItemsDisabled = !isInSourceView && bulletListDisabled && orderedListDisabled && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled) && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled) && !taskListActive;
|
|
38
|
+
taskListActive = _useSharedPluginState.taskListActive;
|
|
39
|
+
var allItemsDisabled = bulletListDisabled && orderedListDisabled && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled) && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled) && !taskListActive;
|
|
45
40
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownMenu, {
|
|
46
41
|
iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.MoreItemsIcon, {
|
|
47
42
|
label: formatMessage(_lists.messages.lists)
|
|
@@ -12,45 +12,24 @@ 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 _markdownCompatibleToolbar = require("../utils/markdown-compatible-toolbar");
|
|
16
15
|
var NumberedListMenuItem = exports.NumberedListMenuItem = function NumberedListMenuItem(_ref) {
|
|
17
16
|
var api = _ref.api,
|
|
18
17
|
parents = _ref.parents;
|
|
19
18
|
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
20
19
|
formatMessage = _useIntl.formatMessage;
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
var _states$listState, _states$listState2, _states$taskDecisionS, _states$markdownModeS, _states$markdownModeS2, _states$markdownModeS3;
|
|
20
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['list', 'taskDecision'], function (states) {
|
|
21
|
+
var _states$listState, _states$listState2, _states$taskDecisionS;
|
|
24
22
|
return {
|
|
25
23
|
orderedListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.orderedListActive,
|
|
26
24
|
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
|
|
28
|
-
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined,
|
|
29
|
-
sourceBlockFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS2 = states.markdownModeState) === null || _states$markdownModeS2 === void 0 ? void 0 : _states$markdownModeS2.sourceBlockFormatState : null,
|
|
30
|
-
sourceListFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS3 = states.markdownModeState) === null || _states$markdownModeS3 === void 0 ? void 0 : _states$markdownModeS3.sourceListFormatState : null
|
|
25
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
31
26
|
};
|
|
32
27
|
}),
|
|
33
28
|
orderedListActive = _useSharedPluginState.orderedListActive,
|
|
34
29
|
orderedListDisabled = _useSharedPluginState.orderedListDisabled,
|
|
35
|
-
taskListActive = _useSharedPluginState.taskListActive
|
|
36
|
-
sourceBlockFormatState = _useSharedPluginState.sourceBlockFormatState,
|
|
37
|
-
sourceListFormatState = _useSharedPluginState.sourceListFormatState,
|
|
38
|
-
markdownView = _useSharedPluginState.markdownView;
|
|
39
|
-
var isInSourceView = isMarkdownToolbarEnabled && markdownView === 'syntax';
|
|
40
|
-
var isSourceTaskListActive = Boolean(sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inTaskList);
|
|
30
|
+
taskListActive = _useSharedPluginState.taskListActive;
|
|
41
31
|
var onClick = function onClick() {
|
|
42
32
|
var _api$taskDecision;
|
|
43
|
-
if (isInSourceView) {
|
|
44
|
-
var _api$markdownMode;
|
|
45
|
-
if (sourceBlockFormatState !== null && sourceBlockFormatState !== void 0 && sourceBlockFormatState.inCodeBlock) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (isSourceTaskListActive) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
api === null || api === void 0 || (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 || _api$markdownMode.actions.toggleSourceOrderedList();
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
33
|
api === null || api === void 0 || api.core.actions.execute(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)));
|
|
55
34
|
};
|
|
56
35
|
var shortcut = (0, _keymaps.formatShortcut)(_keymaps.toggleOrderedList);
|
|
@@ -62,8 +41,8 @@ var NumberedListMenuItem = exports.NumberedListMenuItem = function NumberedListM
|
|
|
62
41
|
elemAfter: shortcut ? /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarKeyboardShortcutHint, {
|
|
63
42
|
shortcut: shortcut
|
|
64
43
|
}) : undefined,
|
|
65
|
-
isSelected:
|
|
66
|
-
isDisabled:
|
|
44
|
+
isSelected: orderedListActive,
|
|
45
|
+
isDisabled: orderedListDisabled && !taskListActive,
|
|
67
46
|
onClick: onClick,
|
|
68
47
|
ariaKeyshortcuts: shortcut
|
|
69
48
|
}, formatMessage(_messages.listMessages.orderedList));
|
|
@@ -12,47 +12,24 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
12
12
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
13
13
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
14
14
|
var _task = _interopRequireDefault(require("@atlaskit/icon/core/task"));
|
|
15
|
-
var _markdownCompatibleToolbar = require("../utils/markdown-compatible-toolbar");
|
|
16
15
|
var TaskListMenuItem = exports.TaskListMenuItem = function TaskListMenuItem(_ref) {
|
|
17
16
|
var api = _ref.api;
|
|
18
17
|
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
19
18
|
formatMessage = _useIntl.formatMessage;
|
|
20
19
|
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
21
20
|
editorView = _useEditorToolbar.editorView;
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
// gate the markdown-mode field reads behind the feature flag inside the
|
|
25
|
-
// selector so we don't trigger re-renders on CM6 state changes for users
|
|
26
|
-
// who don't have the markdown-compatible toolbar enabled.
|
|
27
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['taskDecision', 'markdownMode'], function (states) {
|
|
28
|
-
var _states$taskDecisionS, _states$markdownModeS, _states$markdownModeS2, _states$markdownModeS3;
|
|
21
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['taskDecision'], function (states) {
|
|
22
|
+
var _states$taskDecisionS;
|
|
29
23
|
return {
|
|
30
|
-
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
31
|
-
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined,
|
|
32
|
-
sourceBlockFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS2 = states.markdownModeState) === null || _states$markdownModeS2 === void 0 ? void 0 : _states$markdownModeS2.sourceBlockFormatState : null,
|
|
33
|
-
sourceListFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS3 = states.markdownModeState) === null || _states$markdownModeS3 === void 0 ? void 0 : _states$markdownModeS3.sourceListFormatState : null
|
|
24
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
34
25
|
};
|
|
35
26
|
}),
|
|
36
|
-
taskListActive = _useSharedPluginState.taskListActive
|
|
37
|
-
markdownView = _useSharedPluginState.markdownView,
|
|
38
|
-
sourceBlockFormatState = _useSharedPluginState.sourceBlockFormatState,
|
|
39
|
-
sourceListFormatState = _useSharedPluginState.sourceListFormatState;
|
|
27
|
+
taskListActive = _useSharedPluginState.taskListActive;
|
|
40
28
|
if (!(editorView !== null && editorView !== void 0 && editorView.state.schema.nodes.taskItem)) {
|
|
41
29
|
return null;
|
|
42
30
|
}
|
|
43
|
-
var isInSourceView = isMarkdownToolbarEnabled && markdownView === 'syntax';
|
|
44
|
-
var isSelected = isInSourceView ? sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inTaskList : taskListActive;
|
|
45
|
-
var isDisabled = Boolean(isInSourceView && (sourceBlockFormatState === null || sourceBlockFormatState === void 0 ? void 0 : sourceBlockFormatState.inCodeBlock));
|
|
46
31
|
var handleClick = function handleClick() {
|
|
47
32
|
var _api$taskDecision;
|
|
48
|
-
if (isDisabled) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (isInSourceView) {
|
|
52
|
-
var _api$markdownMode;
|
|
53
|
-
api === null || api === void 0 || (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 || _api$markdownMode.actions.toggleSourceTaskList();
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
33
|
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());
|
|
57
34
|
};
|
|
58
35
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
@@ -63,8 +40,8 @@ var TaskListMenuItem = exports.TaskListMenuItem = function TaskListMenuItem(_ref
|
|
|
63
40
|
elemAfter: /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarKeyboardShortcutHint, {
|
|
64
41
|
shortcut: "[]"
|
|
65
42
|
}),
|
|
66
|
-
isSelected:
|
|
67
|
-
isDisabled:
|
|
43
|
+
isSelected: taskListActive,
|
|
44
|
+
isDisabled: false,
|
|
68
45
|
onClick: handleClick
|
|
69
46
|
}, formatMessage(_messages.tasksAndDecisionsMessages.taskList));
|
|
70
47
|
};
|
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
import { isMarkdownCompatibleToolbarEnabled } from './utils/markdown-compatible-toolbar';
|
|
2
1
|
export const onItemActivated = (pluginInjectionApi, indentationStateNode, inputMethod) => ({
|
|
3
2
|
buttonName,
|
|
4
3
|
editorView
|
|
5
4
|
}) => {
|
|
6
|
-
var _pluginInjectionApi$
|
|
7
|
-
const isInSourceView = isMarkdownCompatibleToolbarEnabled() && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$m = pluginInjectionApi.markdownMode) === null || _pluginInjectionApi$m === void 0 ? void 0 : (_pluginInjectionApi$m2 = _pluginInjectionApi$m.sharedState.currentState()) === null || _pluginInjectionApi$m2 === void 0 ? void 0 : _pluginInjectionApi$m2.view) === 'syntax';
|
|
5
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$l, _pluginInjectionApi$c2, _pluginInjectionApi$l2;
|
|
8
6
|
switch (buttonName) {
|
|
9
7
|
case 'bullet_list':
|
|
10
|
-
if (isInSourceView) {
|
|
11
|
-
var _pluginInjectionApi$m3;
|
|
12
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$m3 = pluginInjectionApi.markdownMode) === null || _pluginInjectionApi$m3 === void 0 ? void 0 : _pluginInjectionApi$m3.actions.toggleSourceBulletList();
|
|
13
|
-
break;
|
|
14
|
-
}
|
|
15
8
|
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$l = pluginInjectionApi.list) === null || _pluginInjectionApi$l === void 0 ? void 0 : _pluginInjectionApi$l.commands.toggleBulletList(inputMethod));
|
|
16
9
|
break;
|
|
17
10
|
case 'ordered_list':
|
|
18
|
-
if (isInSourceView) {
|
|
19
|
-
var _pluginInjectionApi$m4;
|
|
20
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$m4 = pluginInjectionApi.markdownMode) === null || _pluginInjectionApi$m4 === void 0 ? void 0 : _pluginInjectionApi$m4.actions.toggleSourceOrderedList();
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
11
|
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$l2 = pluginInjectionApi.list) === null || _pluginInjectionApi$l2 === void 0 ? void 0 : _pluginInjectionApi$l2.commands.toggleOrderedList(inputMethod));
|
|
24
12
|
break;
|
|
25
13
|
case 'indent':
|
|
@@ -5,7 +5,6 @@ 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 { isMarkdownCompatibleToolbarEnabled } from '../utils/markdown-compatible-toolbar';
|
|
9
8
|
export const useBulletedListInfo = ({
|
|
10
9
|
api,
|
|
11
10
|
parents
|
|
@@ -14,41 +13,21 @@ export const useBulletedListInfo = ({
|
|
|
14
13
|
formatMessage
|
|
15
14
|
} = useIntl();
|
|
16
15
|
const bulletMessage = formatMessage(listMessages.bulletedList);
|
|
17
|
-
const isMarkdownToolbarEnabled = isMarkdownCompatibleToolbarEnabled();
|
|
18
16
|
const {
|
|
19
17
|
bulletListActive,
|
|
20
18
|
bulletListDisabled,
|
|
21
|
-
taskListActive
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
markdownView
|
|
25
|
-
} = useSharedPluginStateWithSelector(api, ['list', 'taskDecision', 'markdownMode'], states => {
|
|
26
|
-
var _states$listState, _states$listState2, _states$taskDecisionS, _states$markdownModeS, _states$markdownModeS2, _states$markdownModeS3;
|
|
19
|
+
taskListActive
|
|
20
|
+
} = useSharedPluginStateWithSelector(api, ['list', 'taskDecision'], states => {
|
|
21
|
+
var _states$listState, _states$listState2, _states$taskDecisionS;
|
|
27
22
|
return {
|
|
28
23
|
bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
|
|
29
24
|
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
|
|
30
|
-
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
31
|
-
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined,
|
|
32
|
-
sourceBlockFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS2 = states.markdownModeState) === null || _states$markdownModeS2 === void 0 ? void 0 : _states$markdownModeS2.sourceBlockFormatState : null,
|
|
33
|
-
sourceListFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS3 = states.markdownModeState) === null || _states$markdownModeS3 === void 0 ? void 0 : _states$markdownModeS3.sourceListFormatState : null
|
|
25
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
34
26
|
};
|
|
35
27
|
});
|
|
36
|
-
const
|
|
37
|
-
const isSourceTaskListActive = Boolean(sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inTaskList);
|
|
38
|
-
const isDisabled = isInSourceView ? Boolean((sourceBlockFormatState === null || sourceBlockFormatState === void 0 ? void 0 : sourceBlockFormatState.inCodeBlock) || isSourceTaskListActive) : bulletListDisabled && !taskListActive;
|
|
28
|
+
const isDisabled = bulletListDisabled && !taskListActive;
|
|
39
29
|
const onClick = () => {
|
|
40
30
|
var _api$taskDecision;
|
|
41
|
-
if (isInSourceView) {
|
|
42
|
-
var _api$markdownMode;
|
|
43
|
-
if (sourceBlockFormatState !== null && sourceBlockFormatState !== void 0 && sourceBlockFormatState.inCodeBlock) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (isSourceTaskListActive) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
api === null || api === void 0 ? void 0 : (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 ? void 0 : _api$markdownMode.actions.toggleSourceBulletList();
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
31
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(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)));
|
|
53
32
|
};
|
|
54
33
|
const shortcut = formatShortcut(toggleBulletListKeymap);
|
|
@@ -56,7 +35,7 @@ export const useBulletedListInfo = ({
|
|
|
56
35
|
bulletMessage,
|
|
57
36
|
onClick,
|
|
58
37
|
isDisabled,
|
|
59
|
-
isSelected:
|
|
38
|
+
isSelected: bulletListActive,
|
|
60
39
|
shortcut
|
|
61
40
|
};
|
|
62
41
|
};
|
|
@@ -7,7 +7,6 @@ import { getInputMethodFromParentKeys } from '@atlaskit/editor-common/toolbar';
|
|
|
7
7
|
import { ListBulletedIcon, ListNumberedIcon, ToolbarButton, ToolbarTooltip } from '@atlaskit/editor-toolbar';
|
|
8
8
|
import TaskIcon from '@atlaskit/icon/core/task';
|
|
9
9
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
10
|
-
import { isMarkdownCompatibleToolbarEnabled } from '../utils/markdown-compatible-toolbar';
|
|
11
10
|
function useListsIndentationHeroButtonInfo({
|
|
12
11
|
api,
|
|
13
12
|
parents,
|
|
@@ -16,33 +15,22 @@ function useListsIndentationHeroButtonInfo({
|
|
|
16
15
|
const {
|
|
17
16
|
formatMessage
|
|
18
17
|
} = useIntl();
|
|
19
|
-
const isMarkdownToolbarEnabled = isMarkdownCompatibleToolbarEnabled();
|
|
20
18
|
const {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
markdownView
|
|
28
|
-
} = useSharedPluginStateWithSelector(api, ['list', 'taskDecision', 'interaction', 'markdownMode'], states => {
|
|
29
|
-
var _states$interactionSt, _states$listState, _states$listState2, _states$listState3, _states$taskDecisionS, _states$markdownModeS, _states$markdownModeS2, _states$markdownModeS3;
|
|
19
|
+
bulletListActive,
|
|
20
|
+
bulletListDisabled,
|
|
21
|
+
orderedListActive,
|
|
22
|
+
taskListActive
|
|
23
|
+
} = useSharedPluginStateWithSelector(api, ['list', 'taskDecision', 'interaction'], states => {
|
|
24
|
+
var _states$interactionSt, _states$listState, _states$listState2, _states$listState3, _states$taskDecisionS;
|
|
30
25
|
const useDefaultToolbarState = ((_states$interactionSt = states.interactionState) === null || _states$interactionSt === void 0 ? void 0 : _states$interactionSt.interactionState) === 'hasNotHadInteraction' && isExperimentEnabled('platform_editor_default_toolbar_state');
|
|
31
26
|
return {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined,
|
|
37
|
-
sourceBlockFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS2 = states.markdownModeState) === null || _states$markdownModeS2 === void 0 ? void 0 : _states$markdownModeS2.sourceBlockFormatState : null,
|
|
38
|
-
sourceListFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS3 = states.markdownModeState) === null || _states$markdownModeS3 === void 0 ? void 0 : _states$markdownModeS3.sourceListFormatState : null
|
|
27
|
+
bulletListActive: useDefaultToolbarState ? false : (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
|
|
28
|
+
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
|
|
29
|
+
orderedListActive: useDefaultToolbarState ? false : (_states$listState3 = states.listState) === null || _states$listState3 === void 0 ? void 0 : _states$listState3.orderedListActive,
|
|
30
|
+
taskListActive: useDefaultToolbarState ? false : (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
39
31
|
};
|
|
40
32
|
});
|
|
41
|
-
const
|
|
42
|
-
const isBulletListActive = isInSourceView ? sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inBulletList : pmBulletListActive;
|
|
43
|
-
const isOrderedListActive = isInSourceView ? sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inOrderedList : pmOrderedListActive;
|
|
44
|
-
const taskListActive = isInSourceView ? Boolean(sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inTaskList) : pmTaskListActive;
|
|
45
|
-
const getListType = taskListActive ? 'taskList' : isOrderedListActive ? 'orderedList' : defaultListType;
|
|
33
|
+
const getListType = taskListActive ? 'taskList' : orderedListActive ? 'orderedList' : defaultListType;
|
|
46
34
|
const taskListKeymap = toggleTaskListKeymap;
|
|
47
35
|
const getKeymap = getListType === 'taskList' ? taskListKeymap : getListType === 'orderedList' ? toggleOrderedListKeymap : toggleBulletListKeymap;
|
|
48
36
|
const shortcut = formatShortcut(getKeymap);
|
|
@@ -50,19 +38,6 @@ function useListsIndentationHeroButtonInfo({
|
|
|
50
38
|
const message = getListType === 'taskList' ? formatMessage(tasksAndDecisionsMessages.taskList) : getListType === 'orderedList' ? formatMessage(listMessages.orderedList) : formatMessage(listMessages.bulletedList);
|
|
51
39
|
const onClick = () => {
|
|
52
40
|
const inputMethod = getInputMethodFromParentKeys(parents);
|
|
53
|
-
if (isInSourceView) {
|
|
54
|
-
if (sourceBlockFormatState !== null && sourceBlockFormatState !== void 0 && sourceBlockFormatState.inCodeBlock || getListType === 'taskList') {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (getListType === 'orderedList') {
|
|
58
|
-
var _api$markdownMode;
|
|
59
|
-
api === null || api === void 0 ? void 0 : (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 ? void 0 : _api$markdownMode.actions.toggleSourceOrderedList();
|
|
60
|
-
} else {
|
|
61
|
-
var _api$markdownMode2;
|
|
62
|
-
api === null || api === void 0 ? void 0 : (_api$markdownMode2 = api.markdownMode) === null || _api$markdownMode2 === void 0 ? void 0 : _api$markdownMode2.actions.toggleSourceBulletList();
|
|
63
|
-
}
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
41
|
if (getListType === 'taskList') {
|
|
67
42
|
var _api$taskDecision;
|
|
68
43
|
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());
|
|
@@ -82,8 +57,8 @@ function useListsIndentationHeroButtonInfo({
|
|
|
82
57
|
label: formatMessage(listMessages.bulletedList),
|
|
83
58
|
size: "small"
|
|
84
59
|
});
|
|
85
|
-
const isSelected = getListType === 'bulletList' ?
|
|
86
|
-
const isDisabled =
|
|
60
|
+
const isSelected = getListType === 'bulletList' ? bulletListActive : getListType === 'orderedList' ? orderedListActive : taskListActive;
|
|
61
|
+
const isDisabled = !orderedListActive && !taskListActive && bulletListDisabled;
|
|
87
62
|
return {
|
|
88
63
|
shortcut,
|
|
89
64
|
keymap,
|
|
@@ -5,7 +5,6 @@ import { messages } from '@atlaskit/editor-common/lists';
|
|
|
5
5
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
6
6
|
import { MoreItemsIcon, ToolbarDropdownMenu, ToolbarTooltip } from '@atlaskit/editor-toolbar';
|
|
7
7
|
import { useIndentationState } from '../utils/hooks';
|
|
8
|
-
import { isMarkdownCompatibleToolbarEnabled } from '../utils/markdown-compatible-toolbar';
|
|
9
8
|
export const ListsIndentationMenu = ({
|
|
10
9
|
children,
|
|
11
10
|
api,
|
|
@@ -22,23 +21,19 @@ export const ListsIndentationMenu = ({
|
|
|
22
21
|
allowHeadingAndParagraphIndentation,
|
|
23
22
|
state: editorView === null || editorView === void 0 ? void 0 : editorView.state
|
|
24
23
|
});
|
|
25
|
-
const isMarkdownToolbarEnabled = isMarkdownCompatibleToolbarEnabled();
|
|
26
24
|
const {
|
|
27
25
|
bulletListDisabled,
|
|
28
26
|
orderedListDisabled,
|
|
29
|
-
taskListActive
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var _states$listState, _states$listState2, _states$taskDecisionS, _states$markdownModeS;
|
|
27
|
+
taskListActive
|
|
28
|
+
} = useSharedPluginStateWithSelector(api, ['list', 'taskDecision'], states => {
|
|
29
|
+
var _states$listState, _states$listState2, _states$taskDecisionS;
|
|
33
30
|
return {
|
|
34
31
|
bulletListDisabled: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListDisabled,
|
|
35
32
|
orderedListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.orderedListDisabled,
|
|
36
|
-
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
37
|
-
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined
|
|
33
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
38
34
|
};
|
|
39
35
|
});
|
|
40
|
-
const
|
|
41
|
-
const allItemsDisabled = !isInSourceView && bulletListDisabled && orderedListDisabled && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled) && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled) && !taskListActive;
|
|
36
|
+
const allItemsDisabled = bulletListDisabled && orderedListDisabled && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled) && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled) && !taskListActive;
|
|
42
37
|
return /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
|
|
43
38
|
iconBefore: /*#__PURE__*/React.createElement(MoreItemsIcon, {
|
|
44
39
|
label: formatMessage(messages.lists)
|
|
@@ -5,7 +5,6 @@ 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 { isMarkdownCompatibleToolbarEnabled } from '../utils/markdown-compatible-toolbar';
|
|
9
8
|
export const NumberedListMenuItem = ({
|
|
10
9
|
api,
|
|
11
10
|
parents
|
|
@@ -13,40 +12,20 @@ export const NumberedListMenuItem = ({
|
|
|
13
12
|
const {
|
|
14
13
|
formatMessage
|
|
15
14
|
} = useIntl();
|
|
16
|
-
const isMarkdownToolbarEnabled = isMarkdownCompatibleToolbarEnabled();
|
|
17
15
|
const {
|
|
18
16
|
orderedListActive,
|
|
19
17
|
orderedListDisabled,
|
|
20
|
-
taskListActive
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
markdownView
|
|
24
|
-
} = useSharedPluginStateWithSelector(api, ['list', 'taskDecision', 'markdownMode'], states => {
|
|
25
|
-
var _states$listState, _states$listState2, _states$taskDecisionS, _states$markdownModeS, _states$markdownModeS2, _states$markdownModeS3;
|
|
18
|
+
taskListActive
|
|
19
|
+
} = useSharedPluginStateWithSelector(api, ['list', 'taskDecision'], states => {
|
|
20
|
+
var _states$listState, _states$listState2, _states$taskDecisionS;
|
|
26
21
|
return {
|
|
27
22
|
orderedListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.orderedListActive,
|
|
28
23
|
orderedListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.orderedListDisabled,
|
|
29
|
-
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
30
|
-
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined,
|
|
31
|
-
sourceBlockFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS2 = states.markdownModeState) === null || _states$markdownModeS2 === void 0 ? void 0 : _states$markdownModeS2.sourceBlockFormatState : null,
|
|
32
|
-
sourceListFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS3 = states.markdownModeState) === null || _states$markdownModeS3 === void 0 ? void 0 : _states$markdownModeS3.sourceListFormatState : null
|
|
24
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
33
25
|
};
|
|
34
26
|
});
|
|
35
|
-
const isInSourceView = isMarkdownToolbarEnabled && markdownView === 'syntax';
|
|
36
|
-
const isSourceTaskListActive = Boolean(sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inTaskList);
|
|
37
27
|
const onClick = () => {
|
|
38
28
|
var _api$taskDecision;
|
|
39
|
-
if (isInSourceView) {
|
|
40
|
-
var _api$markdownMode;
|
|
41
|
-
if (sourceBlockFormatState !== null && sourceBlockFormatState !== void 0 && sourceBlockFormatState.inCodeBlock) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (isSourceTaskListActive) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
api === null || api === void 0 ? void 0 : (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 ? void 0 : _api$markdownMode.actions.toggleSourceOrderedList();
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
29
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(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)));
|
|
51
30
|
};
|
|
52
31
|
const shortcut = formatShortcut(toggleOrderedListKeymap);
|
|
@@ -58,8 +37,8 @@ export const NumberedListMenuItem = ({
|
|
|
58
37
|
elemAfter: shortcut ? /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
59
38
|
shortcut: shortcut
|
|
60
39
|
}) : undefined,
|
|
61
|
-
isSelected:
|
|
62
|
-
isDisabled:
|
|
40
|
+
isSelected: orderedListActive,
|
|
41
|
+
isDisabled: orderedListDisabled && !taskListActive,
|
|
63
42
|
onClick: onClick,
|
|
64
43
|
ariaKeyshortcuts: shortcut
|
|
65
44
|
}, formatMessage(listMessages.orderedList));
|
|
@@ -5,7 +5,6 @@ import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
|
5
5
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
6
6
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
7
7
|
import TaskIcon from '@atlaskit/icon/core/task';
|
|
8
|
-
import { isMarkdownCompatibleToolbarEnabled } from '../utils/markdown-compatible-toolbar';
|
|
9
8
|
export const TaskListMenuItem = ({
|
|
10
9
|
api
|
|
11
10
|
}) => {
|
|
@@ -15,41 +14,19 @@ export const TaskListMenuItem = ({
|
|
|
15
14
|
const {
|
|
16
15
|
editorView
|
|
17
16
|
} = useEditorToolbar();
|
|
18
|
-
const isMarkdownToolbarEnabled = isMarkdownCompatibleToolbarEnabled();
|
|
19
|
-
// Mirror the sibling BulletedListMenuItem / NumberedListMenuItem pattern:
|
|
20
|
-
// gate the markdown-mode field reads behind the feature flag inside the
|
|
21
|
-
// selector so we don't trigger re-renders on CM6 state changes for users
|
|
22
|
-
// who don't have the markdown-compatible toolbar enabled.
|
|
23
17
|
const {
|
|
24
|
-
taskListActive
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
sourceListFormatState
|
|
28
|
-
} = useSharedPluginStateWithSelector(api, ['taskDecision', 'markdownMode'], states => {
|
|
29
|
-
var _states$taskDecisionS, _states$markdownModeS, _states$markdownModeS2, _states$markdownModeS3;
|
|
18
|
+
taskListActive
|
|
19
|
+
} = useSharedPluginStateWithSelector(api, ['taskDecision'], states => {
|
|
20
|
+
var _states$taskDecisionS;
|
|
30
21
|
return {
|
|
31
|
-
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
32
|
-
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined,
|
|
33
|
-
sourceBlockFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS2 = states.markdownModeState) === null || _states$markdownModeS2 === void 0 ? void 0 : _states$markdownModeS2.sourceBlockFormatState : null,
|
|
34
|
-
sourceListFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS3 = states.markdownModeState) === null || _states$markdownModeS3 === void 0 ? void 0 : _states$markdownModeS3.sourceListFormatState : null
|
|
22
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
35
23
|
};
|
|
36
24
|
});
|
|
37
25
|
if (!(editorView !== null && editorView !== void 0 && editorView.state.schema.nodes.taskItem)) {
|
|
38
26
|
return null;
|
|
39
27
|
}
|
|
40
|
-
const isInSourceView = isMarkdownToolbarEnabled && markdownView === 'syntax';
|
|
41
|
-
const isSelected = isInSourceView ? sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inTaskList : taskListActive;
|
|
42
|
-
const isDisabled = Boolean(isInSourceView && (sourceBlockFormatState === null || sourceBlockFormatState === void 0 ? void 0 : sourceBlockFormatState.inCodeBlock));
|
|
43
28
|
const handleClick = () => {
|
|
44
29
|
var _api$taskDecision;
|
|
45
|
-
if (isDisabled) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (isInSourceView) {
|
|
49
|
-
var _api$markdownMode;
|
|
50
|
-
api === null || api === void 0 ? void 0 : (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 ? void 0 : _api$markdownMode.actions.toggleSourceTaskList();
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
30
|
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());
|
|
54
31
|
};
|
|
55
32
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -60,8 +37,8 @@ export const TaskListMenuItem = ({
|
|
|
60
37
|
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
61
38
|
shortcut: "[]"
|
|
62
39
|
}),
|
|
63
|
-
isSelected:
|
|
64
|
-
isDisabled:
|
|
40
|
+
isSelected: taskListActive,
|
|
41
|
+
isDisabled: false,
|
|
65
42
|
onClick: handleClick
|
|
66
43
|
}, formatMessage(tasksAndDecisionsMessages.taskList));
|
|
67
44
|
};
|
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
import { isMarkdownCompatibleToolbarEnabled } from './utils/markdown-compatible-toolbar';
|
|
2
1
|
export var onItemActivated = function onItemActivated(pluginInjectionApi, indentationStateNode, inputMethod) {
|
|
3
2
|
return function (_ref) {
|
|
4
|
-
var _pluginInjectionApi$
|
|
3
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$l, _pluginInjectionApi$c2, _pluginInjectionApi$l2;
|
|
5
4
|
var buttonName = _ref.buttonName,
|
|
6
5
|
editorView = _ref.editorView;
|
|
7
|
-
var isInSourceView = isMarkdownCompatibleToolbarEnabled() && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.markdownMode) === null || _pluginInjectionApi$m === void 0 || (_pluginInjectionApi$m = _pluginInjectionApi$m.sharedState.currentState()) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.view) === 'syntax';
|
|
8
6
|
switch (buttonName) {
|
|
9
7
|
case 'bullet_list':
|
|
10
|
-
if (isInSourceView) {
|
|
11
|
-
var _pluginInjectionApi$m2;
|
|
12
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m2 = pluginInjectionApi.markdownMode) === null || _pluginInjectionApi$m2 === void 0 || _pluginInjectionApi$m2.actions.toggleSourceBulletList();
|
|
13
|
-
break;
|
|
14
|
-
}
|
|
15
8
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$l = pluginInjectionApi.list) === null || _pluginInjectionApi$l === void 0 ? void 0 : _pluginInjectionApi$l.commands.toggleBulletList(inputMethod));
|
|
16
9
|
break;
|
|
17
10
|
case 'ordered_list':
|
|
18
|
-
if (isInSourceView) {
|
|
19
|
-
var _pluginInjectionApi$m3;
|
|
20
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m3 = pluginInjectionApi.markdownMode) === null || _pluginInjectionApi$m3 === void 0 || _pluginInjectionApi$m3.actions.toggleSourceOrderedList();
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
11
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 || _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$l2 = pluginInjectionApi.list) === null || _pluginInjectionApi$l2 === void 0 ? void 0 : _pluginInjectionApi$l2.commands.toggleOrderedList(inputMethod));
|
|
24
12
|
break;
|
|
25
13
|
case 'indent':
|
|
@@ -5,47 +5,26 @@ 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 { isMarkdownCompatibleToolbarEnabled } from '../utils/markdown-compatible-toolbar';
|
|
9
8
|
export var useBulletedListInfo = function useBulletedListInfo(_ref) {
|
|
10
9
|
var api = _ref.api,
|
|
11
10
|
parents = _ref.parents;
|
|
12
11
|
var _useIntl = useIntl(),
|
|
13
12
|
formatMessage = _useIntl.formatMessage;
|
|
14
13
|
var bulletMessage = formatMessage(listMessages.bulletedList);
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
var _states$listState, _states$listState2, _states$taskDecisionS, _states$markdownModeS, _states$markdownModeS2, _states$markdownModeS3;
|
|
14
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['list', 'taskDecision'], function (states) {
|
|
15
|
+
var _states$listState, _states$listState2, _states$taskDecisionS;
|
|
18
16
|
return {
|
|
19
17
|
bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
|
|
20
18
|
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
|
|
21
|
-
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
22
|
-
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined,
|
|
23
|
-
sourceBlockFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS2 = states.markdownModeState) === null || _states$markdownModeS2 === void 0 ? void 0 : _states$markdownModeS2.sourceBlockFormatState : null,
|
|
24
|
-
sourceListFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS3 = states.markdownModeState) === null || _states$markdownModeS3 === void 0 ? void 0 : _states$markdownModeS3.sourceListFormatState : null
|
|
19
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
25
20
|
};
|
|
26
21
|
}),
|
|
27
22
|
bulletListActive = _useSharedPluginState.bulletListActive,
|
|
28
23
|
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
29
|
-
taskListActive = _useSharedPluginState.taskListActive
|
|
30
|
-
|
|
31
|
-
sourceListFormatState = _useSharedPluginState.sourceListFormatState,
|
|
32
|
-
markdownView = _useSharedPluginState.markdownView;
|
|
33
|
-
var isInSourceView = isMarkdownToolbarEnabled && markdownView === 'syntax';
|
|
34
|
-
var isSourceTaskListActive = Boolean(sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inTaskList);
|
|
35
|
-
var isDisabled = isInSourceView ? Boolean((sourceBlockFormatState === null || sourceBlockFormatState === void 0 ? void 0 : sourceBlockFormatState.inCodeBlock) || isSourceTaskListActive) : bulletListDisabled && !taskListActive;
|
|
24
|
+
taskListActive = _useSharedPluginState.taskListActive;
|
|
25
|
+
var isDisabled = bulletListDisabled && !taskListActive;
|
|
36
26
|
var onClick = function onClick() {
|
|
37
27
|
var _api$taskDecision;
|
|
38
|
-
if (isInSourceView) {
|
|
39
|
-
var _api$markdownMode;
|
|
40
|
-
if (sourceBlockFormatState !== null && sourceBlockFormatState !== void 0 && sourceBlockFormatState.inCodeBlock) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (isSourceTaskListActive) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
api === null || api === void 0 || (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 || _api$markdownMode.actions.toggleSourceBulletList();
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
28
|
api === null || api === void 0 || api.core.actions.execute(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)));
|
|
50
29
|
};
|
|
51
30
|
var shortcut = formatShortcut(toggleBulletListKeymap);
|
|
@@ -53,7 +32,7 @@ export var useBulletedListInfo = function useBulletedListInfo(_ref) {
|
|
|
53
32
|
bulletMessage: bulletMessage,
|
|
54
33
|
onClick: onClick,
|
|
55
34
|
isDisabled: isDisabled,
|
|
56
|
-
isSelected:
|
|
35
|
+
isSelected: bulletListActive,
|
|
57
36
|
shortcut: shortcut
|
|
58
37
|
};
|
|
59
38
|
};
|
|
@@ -7,39 +7,27 @@ import { getInputMethodFromParentKeys } from '@atlaskit/editor-common/toolbar';
|
|
|
7
7
|
import { ListBulletedIcon, ListNumberedIcon, ToolbarButton, ToolbarTooltip } from '@atlaskit/editor-toolbar';
|
|
8
8
|
import TaskIcon from '@atlaskit/icon/core/task';
|
|
9
9
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
10
|
-
import { isMarkdownCompatibleToolbarEnabled } from '../utils/markdown-compatible-toolbar';
|
|
11
10
|
function useListsIndentationHeroButtonInfo(_ref) {
|
|
12
11
|
var api = _ref.api,
|
|
13
12
|
parents = _ref.parents,
|
|
14
13
|
defaultListType = _ref.defaultListType;
|
|
15
14
|
var _useIntl = useIntl(),
|
|
16
15
|
formatMessage = _useIntl.formatMessage;
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
var _states$interactionSt, _states$listState, _states$listState2, _states$listState3, _states$taskDecisionS, _states$markdownModeS, _states$markdownModeS2, _states$markdownModeS3;
|
|
16
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['list', 'taskDecision', 'interaction'], function (states) {
|
|
17
|
+
var _states$interactionSt, _states$listState, _states$listState2, _states$listState3, _states$taskDecisionS;
|
|
20
18
|
var useDefaultToolbarState = ((_states$interactionSt = states.interactionState) === null || _states$interactionSt === void 0 ? void 0 : _states$interactionSt.interactionState) === 'hasNotHadInteraction' && isExperimentEnabled('platform_editor_default_toolbar_state');
|
|
21
19
|
return {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined,
|
|
27
|
-
sourceBlockFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS2 = states.markdownModeState) === null || _states$markdownModeS2 === void 0 ? void 0 : _states$markdownModeS2.sourceBlockFormatState : null,
|
|
28
|
-
sourceListFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS3 = states.markdownModeState) === null || _states$markdownModeS3 === void 0 ? void 0 : _states$markdownModeS3.sourceListFormatState : null
|
|
20
|
+
bulletListActive: useDefaultToolbarState ? false : (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
|
|
21
|
+
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
|
|
22
|
+
orderedListActive: useDefaultToolbarState ? false : (_states$listState3 = states.listState) === null || _states$listState3 === void 0 ? void 0 : _states$listState3.orderedListActive,
|
|
23
|
+
taskListActive: useDefaultToolbarState ? false : (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
29
24
|
};
|
|
30
25
|
}),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
sourceListFormatState = _useSharedPluginState.sourceListFormatState,
|
|
37
|
-
markdownView = _useSharedPluginState.markdownView;
|
|
38
|
-
var isInSourceView = isMarkdownToolbarEnabled && markdownView === 'syntax';
|
|
39
|
-
var isBulletListActive = isInSourceView ? sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inBulletList : pmBulletListActive;
|
|
40
|
-
var isOrderedListActive = isInSourceView ? sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inOrderedList : pmOrderedListActive;
|
|
41
|
-
var taskListActive = isInSourceView ? Boolean(sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inTaskList) : pmTaskListActive;
|
|
42
|
-
var getListType = taskListActive ? 'taskList' : isOrderedListActive ? 'orderedList' : defaultListType;
|
|
26
|
+
bulletListActive = _useSharedPluginState.bulletListActive,
|
|
27
|
+
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
28
|
+
orderedListActive = _useSharedPluginState.orderedListActive,
|
|
29
|
+
taskListActive = _useSharedPluginState.taskListActive;
|
|
30
|
+
var getListType = taskListActive ? 'taskList' : orderedListActive ? 'orderedList' : defaultListType;
|
|
43
31
|
var taskListKeymap = toggleTaskListKeymap;
|
|
44
32
|
var getKeymap = getListType === 'taskList' ? taskListKeymap : getListType === 'orderedList' ? toggleOrderedListKeymap : toggleBulletListKeymap;
|
|
45
33
|
var shortcut = formatShortcut(getKeymap);
|
|
@@ -47,19 +35,6 @@ function useListsIndentationHeroButtonInfo(_ref) {
|
|
|
47
35
|
var message = getListType === 'taskList' ? formatMessage(tasksAndDecisionsMessages.taskList) : getListType === 'orderedList' ? formatMessage(listMessages.orderedList) : formatMessage(listMessages.bulletedList);
|
|
48
36
|
var onClick = function onClick() {
|
|
49
37
|
var inputMethod = getInputMethodFromParentKeys(parents);
|
|
50
|
-
if (isInSourceView) {
|
|
51
|
-
if (sourceBlockFormatState !== null && sourceBlockFormatState !== void 0 && sourceBlockFormatState.inCodeBlock || getListType === 'taskList') {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (getListType === 'orderedList') {
|
|
55
|
-
var _api$markdownMode;
|
|
56
|
-
api === null || api === void 0 || (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 || _api$markdownMode.actions.toggleSourceOrderedList();
|
|
57
|
-
} else {
|
|
58
|
-
var _api$markdownMode2;
|
|
59
|
-
api === null || api === void 0 || (_api$markdownMode2 = api.markdownMode) === null || _api$markdownMode2 === void 0 || _api$markdownMode2.actions.toggleSourceBulletList();
|
|
60
|
-
}
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
38
|
if (getListType === 'taskList') {
|
|
64
39
|
var _api$taskDecision;
|
|
65
40
|
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());
|
|
@@ -79,8 +54,8 @@ function useListsIndentationHeroButtonInfo(_ref) {
|
|
|
79
54
|
label: formatMessage(listMessages.bulletedList),
|
|
80
55
|
size: "small"
|
|
81
56
|
});
|
|
82
|
-
var isSelected = getListType === 'bulletList' ?
|
|
83
|
-
var isDisabled =
|
|
57
|
+
var isSelected = getListType === 'bulletList' ? bulletListActive : getListType === 'orderedList' ? orderedListActive : taskListActive;
|
|
58
|
+
var isDisabled = !orderedListActive && !taskListActive && bulletListDisabled;
|
|
84
59
|
return {
|
|
85
60
|
shortcut: shortcut,
|
|
86
61
|
keymap: keymap,
|
|
@@ -5,7 +5,6 @@ import { messages } from '@atlaskit/editor-common/lists';
|
|
|
5
5
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
6
6
|
import { MoreItemsIcon, ToolbarDropdownMenu, ToolbarTooltip } from '@atlaskit/editor-toolbar';
|
|
7
7
|
import { useIndentationState } from '../utils/hooks';
|
|
8
|
-
import { isMarkdownCompatibleToolbarEnabled } from '../utils/markdown-compatible-toolbar';
|
|
9
8
|
export var ListsIndentationMenu = function ListsIndentationMenu(_ref) {
|
|
10
9
|
var children = _ref.children,
|
|
11
10
|
api = _ref.api,
|
|
@@ -19,22 +18,18 @@ export var ListsIndentationMenu = function ListsIndentationMenu(_ref) {
|
|
|
19
18
|
allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation,
|
|
20
19
|
state: editorView === null || editorView === void 0 ? void 0 : editorView.state
|
|
21
20
|
});
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
var _states$listState, _states$listState2, _states$taskDecisionS, _states$markdownModeS;
|
|
21
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['list', 'taskDecision'], function (states) {
|
|
22
|
+
var _states$listState, _states$listState2, _states$taskDecisionS;
|
|
25
23
|
return {
|
|
26
24
|
bulletListDisabled: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListDisabled,
|
|
27
25
|
orderedListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.orderedListDisabled,
|
|
28
|
-
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
29
|
-
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined
|
|
26
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
30
27
|
};
|
|
31
28
|
}),
|
|
32
29
|
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
33
30
|
orderedListDisabled = _useSharedPluginState.orderedListDisabled,
|
|
34
|
-
taskListActive = _useSharedPluginState.taskListActive
|
|
35
|
-
|
|
36
|
-
var isInSourceView = isMarkdownToolbarEnabled && markdownView === 'syntax';
|
|
37
|
-
var allItemsDisabled = !isInSourceView && bulletListDisabled && orderedListDisabled && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled) && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled) && !taskListActive;
|
|
31
|
+
taskListActive = _useSharedPluginState.taskListActive;
|
|
32
|
+
var allItemsDisabled = bulletListDisabled && orderedListDisabled && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled) && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled) && !taskListActive;
|
|
38
33
|
return /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
|
|
39
34
|
iconBefore: /*#__PURE__*/React.createElement(MoreItemsIcon, {
|
|
40
35
|
label: formatMessage(messages.lists)
|
|
@@ -5,45 +5,24 @@ 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 { isMarkdownCompatibleToolbarEnabled } from '../utils/markdown-compatible-toolbar';
|
|
9
8
|
export var NumberedListMenuItem = function NumberedListMenuItem(_ref) {
|
|
10
9
|
var api = _ref.api,
|
|
11
10
|
parents = _ref.parents;
|
|
12
11
|
var _useIntl = useIntl(),
|
|
13
12
|
formatMessage = _useIntl.formatMessage;
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var _states$listState, _states$listState2, _states$taskDecisionS, _states$markdownModeS, _states$markdownModeS2, _states$markdownModeS3;
|
|
13
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['list', 'taskDecision'], function (states) {
|
|
14
|
+
var _states$listState, _states$listState2, _states$taskDecisionS;
|
|
17
15
|
return {
|
|
18
16
|
orderedListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.orderedListActive,
|
|
19
17
|
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
|
|
21
|
-
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined,
|
|
22
|
-
sourceBlockFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS2 = states.markdownModeState) === null || _states$markdownModeS2 === void 0 ? void 0 : _states$markdownModeS2.sourceBlockFormatState : null,
|
|
23
|
-
sourceListFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS3 = states.markdownModeState) === null || _states$markdownModeS3 === void 0 ? void 0 : _states$markdownModeS3.sourceListFormatState : null
|
|
18
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
24
19
|
};
|
|
25
20
|
}),
|
|
26
21
|
orderedListActive = _useSharedPluginState.orderedListActive,
|
|
27
22
|
orderedListDisabled = _useSharedPluginState.orderedListDisabled,
|
|
28
|
-
taskListActive = _useSharedPluginState.taskListActive
|
|
29
|
-
sourceBlockFormatState = _useSharedPluginState.sourceBlockFormatState,
|
|
30
|
-
sourceListFormatState = _useSharedPluginState.sourceListFormatState,
|
|
31
|
-
markdownView = _useSharedPluginState.markdownView;
|
|
32
|
-
var isInSourceView = isMarkdownToolbarEnabled && markdownView === 'syntax';
|
|
33
|
-
var isSourceTaskListActive = Boolean(sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inTaskList);
|
|
23
|
+
taskListActive = _useSharedPluginState.taskListActive;
|
|
34
24
|
var onClick = function onClick() {
|
|
35
25
|
var _api$taskDecision;
|
|
36
|
-
if (isInSourceView) {
|
|
37
|
-
var _api$markdownMode;
|
|
38
|
-
if (sourceBlockFormatState !== null && sourceBlockFormatState !== void 0 && sourceBlockFormatState.inCodeBlock) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (isSourceTaskListActive) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
api === null || api === void 0 || (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 || _api$markdownMode.actions.toggleSourceOrderedList();
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
26
|
api === null || api === void 0 || api.core.actions.execute(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)));
|
|
48
27
|
};
|
|
49
28
|
var shortcut = formatShortcut(toggleOrderedListKeymap);
|
|
@@ -55,8 +34,8 @@ export var NumberedListMenuItem = function NumberedListMenuItem(_ref) {
|
|
|
55
34
|
elemAfter: shortcut ? /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
56
35
|
shortcut: shortcut
|
|
57
36
|
}) : undefined,
|
|
58
|
-
isSelected:
|
|
59
|
-
isDisabled:
|
|
37
|
+
isSelected: orderedListActive,
|
|
38
|
+
isDisabled: orderedListDisabled && !taskListActive,
|
|
60
39
|
onClick: onClick,
|
|
61
40
|
ariaKeyshortcuts: shortcut
|
|
62
41
|
}, formatMessage(listMessages.orderedList));
|
|
@@ -5,47 +5,24 @@ import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
|
5
5
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
6
6
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
7
7
|
import TaskIcon from '@atlaskit/icon/core/task';
|
|
8
|
-
import { isMarkdownCompatibleToolbarEnabled } from '../utils/markdown-compatible-toolbar';
|
|
9
8
|
export var TaskListMenuItem = function TaskListMenuItem(_ref) {
|
|
10
9
|
var api = _ref.api;
|
|
11
10
|
var _useIntl = useIntl(),
|
|
12
11
|
formatMessage = _useIntl.formatMessage;
|
|
13
12
|
var _useEditorToolbar = useEditorToolbar(),
|
|
14
13
|
editorView = _useEditorToolbar.editorView;
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
// gate the markdown-mode field reads behind the feature flag inside the
|
|
18
|
-
// selector so we don't trigger re-renders on CM6 state changes for users
|
|
19
|
-
// who don't have the markdown-compatible toolbar enabled.
|
|
20
|
-
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['taskDecision', 'markdownMode'], function (states) {
|
|
21
|
-
var _states$taskDecisionS, _states$markdownModeS, _states$markdownModeS2, _states$markdownModeS3;
|
|
14
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['taskDecision'], function (states) {
|
|
15
|
+
var _states$taskDecisionS;
|
|
22
16
|
return {
|
|
23
|
-
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
24
|
-
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined,
|
|
25
|
-
sourceBlockFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS2 = states.markdownModeState) === null || _states$markdownModeS2 === void 0 ? void 0 : _states$markdownModeS2.sourceBlockFormatState : null,
|
|
26
|
-
sourceListFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS3 = states.markdownModeState) === null || _states$markdownModeS3 === void 0 ? void 0 : _states$markdownModeS3.sourceListFormatState : null
|
|
17
|
+
taskListActive: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
27
18
|
};
|
|
28
19
|
}),
|
|
29
|
-
taskListActive = _useSharedPluginState.taskListActive
|
|
30
|
-
markdownView = _useSharedPluginState.markdownView,
|
|
31
|
-
sourceBlockFormatState = _useSharedPluginState.sourceBlockFormatState,
|
|
32
|
-
sourceListFormatState = _useSharedPluginState.sourceListFormatState;
|
|
20
|
+
taskListActive = _useSharedPluginState.taskListActive;
|
|
33
21
|
if (!(editorView !== null && editorView !== void 0 && editorView.state.schema.nodes.taskItem)) {
|
|
34
22
|
return null;
|
|
35
23
|
}
|
|
36
|
-
var isInSourceView = isMarkdownToolbarEnabled && markdownView === 'syntax';
|
|
37
|
-
var isSelected = isInSourceView ? sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inTaskList : taskListActive;
|
|
38
|
-
var isDisabled = Boolean(isInSourceView && (sourceBlockFormatState === null || sourceBlockFormatState === void 0 ? void 0 : sourceBlockFormatState.inCodeBlock));
|
|
39
24
|
var handleClick = function handleClick() {
|
|
40
25
|
var _api$taskDecision;
|
|
41
|
-
if (isDisabled) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (isInSourceView) {
|
|
45
|
-
var _api$markdownMode;
|
|
46
|
-
api === null || api === void 0 || (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 || _api$markdownMode.actions.toggleSourceTaskList();
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
26
|
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());
|
|
50
27
|
};
|
|
51
28
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -56,8 +33,8 @@ export var TaskListMenuItem = function TaskListMenuItem(_ref) {
|
|
|
56
33
|
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
57
34
|
shortcut: "[]"
|
|
58
35
|
}),
|
|
59
|
-
isSelected:
|
|
60
|
-
isDisabled:
|
|
36
|
+
isSelected: taskListActive,
|
|
37
|
+
isDisabled: false,
|
|
61
38
|
onClick: handleClick
|
|
62
39
|
}, formatMessage(tasksAndDecisionsMessages.taskList));
|
|
63
40
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
3
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
4
4
|
import type { IndentationPlugin } from '@atlaskit/editor-plugin-indentation';
|
|
@@ -14,7 +14,6 @@ export type ToolbarListsIndentationPluginOptions = {
|
|
|
14
14
|
showIndentationButtons: boolean;
|
|
15
15
|
};
|
|
16
16
|
export type ToolbarListsIndentationPluginDependencies = [
|
|
17
|
-
OptionalPlugin<_MarkdownModePluginStub>,
|
|
18
17
|
OptionalPlugin<FeatureFlagsPlugin>,
|
|
19
18
|
ListPlugin,
|
|
20
19
|
OptionalPlugin<IndentationPlugin>,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-toolbar-lists-indentation",
|
|
3
|
-
"version": "23.0.
|
|
3
|
+
"version": "23.0.4",
|
|
4
4
|
"description": "Toolbar lists and indentation plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"@atlaskit/icon": "^38.0.0",
|
|
39
39
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
40
40
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
41
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
41
|
+
"@atlaskit/tmp-editor-statsig": "^213.0.0",
|
|
42
42
|
"@atlaskit/tokens": "^20.1.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@atlaskit/editor-common": "^126.
|
|
46
|
+
"@atlaskit/editor-common": "^126.2.0",
|
|
47
47
|
"react": "^18.2.0 || ^19.2.0",
|
|
48
48
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
49
49
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -55,10 +55,5 @@
|
|
|
55
55
|
"react-dom": "^19.2.0",
|
|
56
56
|
"react-intl": "^7.0.0",
|
|
57
57
|
"wait-for-expect": "^1.2.0"
|
|
58
|
-
},
|
|
59
|
-
"platform-feature-flags": {
|
|
60
|
-
"platform_editor_markdown_compatible_toolbar": {
|
|
61
|
-
"type": "boolean"
|
|
62
|
-
}
|
|
63
58
|
}
|
|
64
59
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isMarkdownCompatibleToolbarEnabled = void 0;
|
|
7
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
8
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
9
|
-
var isMarkdownCompatibleToolbarEnabled = exports.isMarkdownCompatibleToolbarEnabled = function isMarkdownCompatibleToolbarEnabled() {
|
|
10
|
-
return (0, _expValEqualsNoExposure.expValEqualsNoExposure)('cc-markdown-mode', 'isEnabled', true) && (0, _fg.fg)('platform_editor_markdown_compatible_toolbar');
|
|
11
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
3
|
-
export const isMarkdownCompatibleToolbarEnabled = () => expValEqualsNoExposure('cc-markdown-mode', 'isEnabled', true) && fg('platform_editor_markdown_compatible_toolbar');
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
3
|
-
export var isMarkdownCompatibleToolbarEnabled = function isMarkdownCompatibleToolbarEnabled() {
|
|
4
|
-
return expValEqualsNoExposure('cc-markdown-mode', 'isEnabled', true) && fg('platform_editor_markdown_compatible_toolbar');
|
|
5
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isMarkdownCompatibleToolbarEnabled: () => boolean;
|