@atlaskit/editor-plugin-toolbar-lists-indentation 4.1.1 → 4.2.0
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 +19 -0
- package/dist/cjs/toolbarListsIndentationPlugin.js +23 -8
- package/dist/cjs/ui/toolbar-components/BulletedListMenuItem.js +45 -0
- package/dist/cjs/ui/toolbar-components/IndentMenuItem.js +64 -0
- package/dist/cjs/ui/toolbar-components/ListsIndentationHeroButton.js +55 -0
- package/dist/cjs/ui/toolbar-components/ListsIndentationMenu.js +47 -0
- package/dist/cjs/ui/toolbar-components/NumberedListMenuItem.js +45 -0
- package/dist/cjs/ui/toolbar-components/OutdentMenuItem.js +63 -0
- package/dist/cjs/ui/toolbar-components.js +135 -0
- package/dist/cjs/ui/utils/hooks.js +47 -0
- package/dist/es2019/toolbarListsIndentationPlugin.js +51 -37
- package/dist/es2019/ui/toolbar-components/BulletedListMenuItem.js +41 -0
- package/dist/es2019/ui/toolbar-components/IndentMenuItem.js +60 -0
- package/dist/es2019/ui/toolbar-components/ListsIndentationHeroButton.js +51 -0
- package/dist/es2019/ui/toolbar-components/ListsIndentationMenu.js +44 -0
- package/dist/es2019/ui/toolbar-components/NumberedListMenuItem.js +41 -0
- package/dist/es2019/ui/toolbar-components/OutdentMenuItem.js +59 -0
- package/dist/es2019/ui/toolbar-components.js +123 -0
- package/dist/es2019/ui/utils/hooks.js +44 -0
- package/dist/esm/toolbarListsIndentationPlugin.js +23 -8
- package/dist/esm/ui/toolbar-components/BulletedListMenuItem.js +38 -0
- package/dist/esm/ui/toolbar-components/IndentMenuItem.js +57 -0
- package/dist/esm/ui/toolbar-components/ListsIndentationHeroButton.js +48 -0
- package/dist/esm/ui/toolbar-components/ListsIndentationMenu.js +40 -0
- package/dist/esm/ui/toolbar-components/NumberedListMenuItem.js +38 -0
- package/dist/esm/ui/toolbar-components/OutdentMenuItem.js +56 -0
- package/dist/esm/ui/toolbar-components.js +128 -0
- package/dist/esm/ui/utils/hooks.js +41 -0
- package/dist/types/toolbarListsIndentationPluginType.d.ts +3 -1
- package/dist/types/ui/Toolbar.d.ts +0 -1
- package/dist/types/ui/ToolbarDropdown.d.ts +0 -1
- package/dist/types/ui/index.d.ts +0 -1
- package/dist/types/ui/toolbar-components/BulletedListMenuItem.d.ts +10 -0
- package/dist/types/ui/toolbar-components/IndentMenuItem.d.ts +12 -0
- package/dist/types/ui/toolbar-components/ListsIndentationHeroButton.d.ts +12 -0
- package/dist/types/ui/toolbar-components/ListsIndentationMenu.d.ts +12 -0
- package/dist/types/ui/toolbar-components/NumberedListMenuItem.d.ts +10 -0
- package/dist/types/ui/toolbar-components/OutdentMenuItem.d.ts +12 -0
- package/dist/types/ui/toolbar-components.d.ts +10 -0
- package/dist/types/ui/utils/hooks.d.ts +10 -0
- package/dist/types-ts4.5/toolbarListsIndentationPluginType.d.ts +3 -1
- package/dist/types-ts4.5/ui/Toolbar.d.ts +0 -1
- package/dist/types-ts4.5/ui/ToolbarDropdown.d.ts +0 -1
- package/dist/types-ts4.5/ui/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/toolbar-components/BulletedListMenuItem.d.ts +10 -0
- package/dist/types-ts4.5/ui/toolbar-components/IndentMenuItem.d.ts +12 -0
- package/dist/types-ts4.5/ui/toolbar-components/ListsIndentationHeroButton.d.ts +12 -0
- package/dist/types-ts4.5/ui/toolbar-components/ListsIndentationMenu.d.ts +12 -0
- package/dist/types-ts4.5/ui/toolbar-components/NumberedListMenuItem.d.ts +10 -0
- package/dist/types-ts4.5/ui/toolbar-components/OutdentMenuItem.d.ts +12 -0
- package/dist/types-ts4.5/ui/toolbar-components.d.ts +10 -0
- package/dist/types-ts4.5/ui/utils/hooks.d.ts +10 -0
- package/package.json +13 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-toolbar-lists-indentation
|
|
2
2
|
|
|
3
|
+
## 4.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#198479](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/198479)
|
|
8
|
+
[`a427f04593fbd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a427f04593fbd) -
|
|
9
|
+
[ux] ED-28685 register list and indentation menu to the new toolbar behind
|
|
10
|
+
platform_editor_toolbar_aifc
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
16
|
+
## 4.1.2
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 4.1.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -8,19 +8,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.PrimaryToolbarComponent = PrimaryToolbarComponent;
|
|
9
9
|
exports.toolbarListsIndentationPlugin = void 0;
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
13
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
14
|
var _types = require("@atlaskit/editor-common/types");
|
|
14
15
|
var _usePluginStateEffect = require("@atlaskit/editor-common/use-plugin-state-effect");
|
|
15
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
18
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
17
19
|
var _indentationButtons = require("./pm-plugins/indentation-buttons");
|
|
18
20
|
var _types2 = require("./types");
|
|
19
21
|
var _ui = _interopRequireDefault(require("./ui"));
|
|
20
22
|
var _FloatingToolbarComponent = require("./ui/FloatingToolbarComponent");
|
|
23
|
+
var _toolbarComponents = require("./ui/toolbar-components");
|
|
21
24
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
25
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
26
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
27
|
var toolbarListsIndentationPlugin = exports.toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref) {
|
|
23
|
-
var _api$featureFlags
|
|
28
|
+
var _api$featureFlags;
|
|
24
29
|
var config = _ref.config,
|
|
25
30
|
api = _ref.api;
|
|
26
31
|
var _ref2 = config !== null && config !== void 0 ? config : {},
|
|
@@ -51,13 +56,23 @@ var toolbarListsIndentationPlugin = exports.toolbarListsIndentationPlugin = func
|
|
|
51
56
|
allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation
|
|
52
57
|
});
|
|
53
58
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc', 'isEnabled', true)) {
|
|
60
|
+
var _api$toolbar;
|
|
61
|
+
api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)({
|
|
62
|
+
api: api,
|
|
63
|
+
showIndentationButtons: showIndentationButtons,
|
|
64
|
+
allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation
|
|
65
|
+
}));
|
|
66
|
+
} else {
|
|
67
|
+
var _api$primaryToolbar;
|
|
68
|
+
api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 || _api$primaryToolbar.actions.registerComponent({
|
|
69
|
+
name: 'toolbarListsIndentation',
|
|
70
|
+
component: primaryToolbarComponent
|
|
71
|
+
});
|
|
72
|
+
}
|
|
58
73
|
return {
|
|
59
74
|
name: 'toolbarListsIndentation',
|
|
60
|
-
pluginsOptions: {
|
|
75
|
+
pluginsOptions: _objectSpread({}, !(0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc', 'isEnabled', true) && {
|
|
61
76
|
selectionToolbar: function selectionToolbar() {
|
|
62
77
|
var _api$userPreferences, _api$selectionToolbar;
|
|
63
78
|
var toolbarDocking = (0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin') ? api === null || api === void 0 || (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 || (_api$userPreferences = _api$userPreferences.sharedState.currentState()) === null || _api$userPreferences === void 0 ? void 0 : _api$userPreferences.preferences.toolbarDockingPosition : api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking;
|
|
@@ -90,8 +105,8 @@ var toolbarListsIndentationPlugin = exports.toolbarListsIndentationPlugin = func
|
|
|
90
105
|
return undefined;
|
|
91
106
|
}
|
|
92
107
|
}
|
|
93
|
-
},
|
|
94
|
-
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
|
|
108
|
+
}),
|
|
109
|
+
primaryToolbarComponent: !(0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc', 'isEnabled', true) && !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
|
|
95
110
|
};
|
|
96
111
|
};
|
|
97
112
|
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.BulletedListMenuItem = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
11
|
+
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
12
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
|
+
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
14
|
+
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
|
+
var BulletedListMenuItem = exports.BulletedListMenuItem = function BulletedListMenuItem(_ref) {
|
|
16
|
+
var api = _ref.api,
|
|
17
|
+
parents = _ref.parents;
|
|
18
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
19
|
+
formatMessage = _useIntl.formatMessage;
|
|
20
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['list'], function (states) {
|
|
21
|
+
var _states$listState, _states$listState2;
|
|
22
|
+
return {
|
|
23
|
+
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
|
|
25
|
+
};
|
|
26
|
+
}),
|
|
27
|
+
bulletListActive = _useSharedPluginState.bulletListActive,
|
|
28
|
+
bulletListDisabled = _useSharedPluginState.bulletListDisabled;
|
|
29
|
+
var onClick = function onClick() {
|
|
30
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.list.commands.toggleBulletList((0, _toolbar.getInputMethodFromParentKeys)(parents)));
|
|
31
|
+
};
|
|
32
|
+
var shortcut = (0, _keymaps.formatShortcut)(_keymaps.toggleBulletList);
|
|
33
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
34
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.ListBulletedIcon, {
|
|
35
|
+
label: ""
|
|
36
|
+
}),
|
|
37
|
+
elemAfter: shortcut ? /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarKeyboardShortcutHint, {
|
|
38
|
+
shortcut: shortcut
|
|
39
|
+
}) : undefined,
|
|
40
|
+
isSelected: bulletListActive,
|
|
41
|
+
isDisabled: bulletListDisabled,
|
|
42
|
+
onClick: onClick,
|
|
43
|
+
ariaKeyshortcuts: shortcut
|
|
44
|
+
}, formatMessage(_messages.listMessages.bulletedList));
|
|
45
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.IndentMenuItem = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
11
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
|
+
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
13
|
+
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
14
|
+
var _hooks = require("../utils/hooks");
|
|
15
|
+
var IndentMenuItem = exports.IndentMenuItem = function IndentMenuItem(_ref) {
|
|
16
|
+
var api = _ref.api,
|
|
17
|
+
showIndentationButtons = _ref.showIndentationButtons,
|
|
18
|
+
allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation,
|
|
19
|
+
parents = _ref.parents;
|
|
20
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
21
|
+
formatMessage = _useIntl.formatMessage;
|
|
22
|
+
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
23
|
+
editorView = _useEditorToolbar.editorView;
|
|
24
|
+
var indentationState = (0, _hooks.useIndentationState)({
|
|
25
|
+
api: api,
|
|
26
|
+
allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation,
|
|
27
|
+
state: editorView === null || editorView === void 0 ? void 0 : editorView.state
|
|
28
|
+
});
|
|
29
|
+
if (!showIndentationButtons) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
var onClick = function onClick() {
|
|
33
|
+
var inputMethod = (0, _toolbar.getInputMethodFromParentKeys)(parents);
|
|
34
|
+
var node = indentationState === null || indentationState === void 0 ? void 0 : indentationState.node;
|
|
35
|
+
if (node === 'paragraph_heading') {
|
|
36
|
+
if (editorView !== null && editorView !== void 0 && editorView.state) {
|
|
37
|
+
var _api$indentation;
|
|
38
|
+
api === null || api === void 0 || (_api$indentation = api.indentation) === null || _api$indentation === void 0 || _api$indentation.actions.indentParagraphOrHeading(inputMethod)(editorView === null || editorView === void 0 ? void 0 : editorView.state, editorView === null || editorView === void 0 ? void 0 : editorView.dispatch);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (node === 'list') {
|
|
42
|
+
var _api$core, _api$list;
|
|
43
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$list = api.list) === null || _api$list === void 0 ? void 0 : _api$list.commands.indentList(inputMethod));
|
|
44
|
+
}
|
|
45
|
+
if (node === 'taskList') {
|
|
46
|
+
if (editorView !== null && editorView !== void 0 && editorView.state) {
|
|
47
|
+
var _api$taskDecision;
|
|
48
|
+
api === null || api === void 0 || (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 || _api$taskDecision.actions.indentTaskList(inputMethod)(editorView === null || editorView === void 0 ? void 0 : editorView.state, editorView === null || editorView === void 0 ? void 0 : editorView.dispatch);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var shortcut = (0, _keymaps.formatShortcut)(_keymaps.indent);
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
54
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.IndentIcon, {
|
|
55
|
+
label: ""
|
|
56
|
+
}),
|
|
57
|
+
elemAfter: shortcut ? /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarKeyboardShortcutHint, {
|
|
58
|
+
shortcut: shortcut
|
|
59
|
+
}) : undefined,
|
|
60
|
+
isDisabled: indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled,
|
|
61
|
+
ariaKeyshortcuts: shortcut,
|
|
62
|
+
onClick: onClick
|
|
63
|
+
}, formatMessage(_messages.indentationMessages.indent));
|
|
64
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ListsIndentationHeroButton = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
11
|
+
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
12
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
|
+
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
14
|
+
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
|
+
var ListsIndentationHeroButton = exports.ListsIndentationHeroButton = function ListsIndentationHeroButton(_ref) {
|
|
16
|
+
var api = _ref.api,
|
|
17
|
+
groupLocation = _ref.groupLocation,
|
|
18
|
+
parents = _ref.parents;
|
|
19
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
20
|
+
formatMessage = _useIntl.formatMessage;
|
|
21
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['list'], function (states) {
|
|
22
|
+
var _states$listState, _states$listState2, _states$listState3;
|
|
23
|
+
return {
|
|
24
|
+
bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
|
|
25
|
+
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
|
|
26
|
+
orderedListActive: (_states$listState3 = states.listState) === null || _states$listState3 === void 0 ? void 0 : _states$listState3.orderedListActive
|
|
27
|
+
};
|
|
28
|
+
}),
|
|
29
|
+
bulletListActive = _useSharedPluginState.bulletListActive,
|
|
30
|
+
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
31
|
+
orderedListActive = _useSharedPluginState.orderedListActive;
|
|
32
|
+
var shortcut = orderedListActive ? (0, _keymaps.formatShortcut)(_keymaps.toggleOrderedList) : (0, _keymaps.formatShortcut)(_keymaps.toggleBulletList);
|
|
33
|
+
var onClick = function onClick() {
|
|
34
|
+
var inputMethod = (0, _toolbar.getInputMethodFromParentKeys)(parents);
|
|
35
|
+
if (orderedListActive) {
|
|
36
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.list.commands.toggleOrderedList(inputMethod));
|
|
37
|
+
} else {
|
|
38
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.list.commands.toggleBulletList(inputMethod));
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarTooltip, {
|
|
42
|
+
content: orderedListActive ? formatMessage(_messages.listMessages.orderedList) : formatMessage(_messages.listMessages.bulletedList)
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButton, {
|
|
44
|
+
iconBefore: orderedListActive ? /*#__PURE__*/_react.default.createElement(_editorToolbar.ListNumberedIcon, {
|
|
45
|
+
label: formatMessage(_messages.listMessages.orderedList)
|
|
46
|
+
}) : /*#__PURE__*/_react.default.createElement(_editorToolbar.ListBulletedIcon, {
|
|
47
|
+
label: formatMessage(_messages.listMessages.bulletedList)
|
|
48
|
+
}),
|
|
49
|
+
groupLocation: groupLocation,
|
|
50
|
+
isSelected: bulletListActive || orderedListActive,
|
|
51
|
+
isDisabled: !orderedListActive && bulletListDisabled,
|
|
52
|
+
ariaKeyshortcuts: shortcut,
|
|
53
|
+
onClick: onClick
|
|
54
|
+
}));
|
|
55
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ListsIndentationMenu = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
11
|
+
var _lists = require("@atlaskit/editor-common/lists");
|
|
12
|
+
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
13
|
+
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
14
|
+
var _hooks2 = require("../utils/hooks");
|
|
15
|
+
var ListsIndentationMenu = exports.ListsIndentationMenu = function ListsIndentationMenu(_ref) {
|
|
16
|
+
var children = _ref.children,
|
|
17
|
+
api = _ref.api,
|
|
18
|
+
groupLocation = _ref.groupLocation,
|
|
19
|
+
allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation;
|
|
20
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
21
|
+
formatMessage = _useIntl.formatMessage;
|
|
22
|
+
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
23
|
+
editorView = _useEditorToolbar.editorView;
|
|
24
|
+
var indentationState = (0, _hooks2.useIndentationState)({
|
|
25
|
+
api: api,
|
|
26
|
+
allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation,
|
|
27
|
+
state: editorView === null || editorView === void 0 ? void 0 : editorView.state
|
|
28
|
+
});
|
|
29
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['list'], function (states) {
|
|
30
|
+
var _states$listState, _states$listState2;
|
|
31
|
+
return {
|
|
32
|
+
bulletListDisabled: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListDisabled,
|
|
33
|
+
orderedListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.orderedListDisabled
|
|
34
|
+
};
|
|
35
|
+
}),
|
|
36
|
+
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
37
|
+
orderedListDisabled = _useSharedPluginState.orderedListDisabled;
|
|
38
|
+
var allItemsDisabled = bulletListDisabled && orderedListDisabled && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.indentDisabled) && (indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled);
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownMenu, {
|
|
40
|
+
iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.MoreItemsIcon, {
|
|
41
|
+
label: formatMessage(_lists.messages.lists)
|
|
42
|
+
}),
|
|
43
|
+
groupLocation: groupLocation,
|
|
44
|
+
isDisabled: allItemsDisabled,
|
|
45
|
+
testId: "editor-toolbar__lists-and-indentation-menu"
|
|
46
|
+
}, children);
|
|
47
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.NumberedListMenuItem = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
11
|
+
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
12
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
|
+
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
14
|
+
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
|
+
var NumberedListMenuItem = exports.NumberedListMenuItem = function NumberedListMenuItem(_ref) {
|
|
16
|
+
var api = _ref.api,
|
|
17
|
+
parents = _ref.parents;
|
|
18
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
19
|
+
formatMessage = _useIntl.formatMessage;
|
|
20
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['list'], function (states) {
|
|
21
|
+
var _states$listState, _states$listState2;
|
|
22
|
+
return {
|
|
23
|
+
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
|
|
25
|
+
};
|
|
26
|
+
}),
|
|
27
|
+
orderedListActive = _useSharedPluginState.orderedListActive,
|
|
28
|
+
orderedListDisabled = _useSharedPluginState.orderedListDisabled;
|
|
29
|
+
var onClick = function onClick() {
|
|
30
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.list.commands.toggleOrderedList((0, _toolbar.getInputMethodFromParentKeys)(parents)));
|
|
31
|
+
};
|
|
32
|
+
var shortcut = (0, _keymaps.formatShortcut)(_keymaps.toggleOrderedList);
|
|
33
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
34
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.ListNumberedIcon, {
|
|
35
|
+
label: ""
|
|
36
|
+
}),
|
|
37
|
+
elemAfter: shortcut ? /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarKeyboardShortcutHint, {
|
|
38
|
+
shortcut: shortcut
|
|
39
|
+
}) : undefined,
|
|
40
|
+
isSelected: orderedListActive,
|
|
41
|
+
isDisabled: orderedListDisabled,
|
|
42
|
+
onClick: onClick,
|
|
43
|
+
ariaKeyshortcuts: shortcut
|
|
44
|
+
}, formatMessage(_messages.listMessages.orderedList));
|
|
45
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.OutdentMenuItem = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
11
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
|
+
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
13
|
+
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
14
|
+
var _hooks = require("../utils/hooks");
|
|
15
|
+
var OutdentMenuItem = exports.OutdentMenuItem = function OutdentMenuItem(_ref) {
|
|
16
|
+
var api = _ref.api,
|
|
17
|
+
allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation,
|
|
18
|
+
showIndentationButtons = _ref.showIndentationButtons,
|
|
19
|
+
parents = _ref.parents;
|
|
20
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
21
|
+
formatMessage = _useIntl.formatMessage;
|
|
22
|
+
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
23
|
+
editorView = _useEditorToolbar.editorView;
|
|
24
|
+
var indentationState = (0, _hooks.useIndentationState)({
|
|
25
|
+
api: api,
|
|
26
|
+
allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation,
|
|
27
|
+
state: editorView === null || editorView === void 0 ? void 0 : editorView.state
|
|
28
|
+
});
|
|
29
|
+
if (!showIndentationButtons) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
var onClick = function onClick() {
|
|
33
|
+
var inputMethod = (0, _toolbar.getInputMethodFromParentKeys)(parents);
|
|
34
|
+
var node = indentationState === null || indentationState === void 0 ? void 0 : indentationState.node;
|
|
35
|
+
if (node === 'paragraph_heading') {
|
|
36
|
+
if (editorView !== null && editorView !== void 0 && editorView.state) {
|
|
37
|
+
var _api$indentation;
|
|
38
|
+
api === null || api === void 0 || (_api$indentation = api.indentation) === null || _api$indentation === void 0 || _api$indentation.actions.outdentParagraphOrHeading(inputMethod)(editorView === null || editorView === void 0 ? void 0 : editorView.state, editorView === null || editorView === void 0 ? void 0 : editorView.dispatch);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (node === 'list') {
|
|
42
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.list.commands.outdentList(inputMethod));
|
|
43
|
+
}
|
|
44
|
+
if (node === 'taskList') {
|
|
45
|
+
if (editorView !== null && editorView !== void 0 && editorView.state) {
|
|
46
|
+
var _api$taskDecision;
|
|
47
|
+
api === null || api === void 0 || (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 || _api$taskDecision.actions.outdentTaskList(inputMethod)(editorView === null || editorView === void 0 ? void 0 : editorView.state, editorView === null || editorView === void 0 ? void 0 : editorView.dispatch);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var shortcut = (0, _keymaps.formatShortcut)(_keymaps.outdent);
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
53
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.OutdentIcon, {
|
|
54
|
+
label: ""
|
|
55
|
+
}),
|
|
56
|
+
elemAfter: shortcut ? /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarKeyboardShortcutHint, {
|
|
57
|
+
shortcut: shortcut
|
|
58
|
+
}) : undefined,
|
|
59
|
+
isDisabled: indentationState === null || indentationState === void 0 ? void 0 : indentationState.outdentDisabled,
|
|
60
|
+
ariaKeyshortcuts: shortcut,
|
|
61
|
+
onClick: onClick
|
|
62
|
+
}, formatMessage(_messages.indentationMessages.outdent));
|
|
63
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getToolbarComponents = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
10
|
+
var _BulletedListMenuItem = require("./toolbar-components/BulletedListMenuItem");
|
|
11
|
+
var _IndentMenuItem = require("./toolbar-components/IndentMenuItem");
|
|
12
|
+
var _ListsIndentationHeroButton = require("./toolbar-components/ListsIndentationHeroButton");
|
|
13
|
+
var _ListsIndentationMenu = require("./toolbar-components/ListsIndentationMenu");
|
|
14
|
+
var _NumberedListMenuItem = require("./toolbar-components/NumberedListMenuItem");
|
|
15
|
+
var _OutdentMenuItem = require("./toolbar-components/OutdentMenuItem");
|
|
16
|
+
var getToolbarComponents = exports.getToolbarComponents = function getToolbarComponents(_ref) {
|
|
17
|
+
var api = _ref.api,
|
|
18
|
+
showIndentationButtons = _ref.showIndentationButtons,
|
|
19
|
+
allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation;
|
|
20
|
+
return [{
|
|
21
|
+
type: _toolbar.LISTS_INDENTATION_GROUP.type,
|
|
22
|
+
key: _toolbar.LISTS_INDENTATION_GROUP.key,
|
|
23
|
+
parents: [{
|
|
24
|
+
type: _toolbar.TEXT_SECTION.type,
|
|
25
|
+
key: _toolbar.TEXT_SECTION.key,
|
|
26
|
+
rank: _toolbar.TEXT_SECTION_RANK[_toolbar.LISTS_INDENTATION_GROUP.key]
|
|
27
|
+
}]
|
|
28
|
+
}, {
|
|
29
|
+
type: _toolbar.LISTS_INDENTATION_HERO_BUTTON.type,
|
|
30
|
+
key: _toolbar.LISTS_INDENTATION_HERO_BUTTON.key,
|
|
31
|
+
parents: [{
|
|
32
|
+
type: _toolbar.LISTS_INDENTATION_GROUP.type,
|
|
33
|
+
key: _toolbar.LISTS_INDENTATION_GROUP.key,
|
|
34
|
+
rank: _toolbar.LISTS_INDENTATION_GROUP_RANK[_toolbar.LISTS_INDENTATION_HERO_BUTTON.key]
|
|
35
|
+
}],
|
|
36
|
+
component: function component(_ref2) {
|
|
37
|
+
var groupLocation = _ref2.groupLocation,
|
|
38
|
+
parents = _ref2.parents;
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(_ListsIndentationHeroButton.ListsIndentationHeroButton, {
|
|
40
|
+
api: api,
|
|
41
|
+
groupLocation: groupLocation,
|
|
42
|
+
parents: parents
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
46
|
+
type: _toolbar.LISTS_INDENTATION_MENU.type,
|
|
47
|
+
key: _toolbar.LISTS_INDENTATION_MENU.key,
|
|
48
|
+
parents: [{
|
|
49
|
+
type: _toolbar.LISTS_INDENTATION_GROUP.type,
|
|
50
|
+
key: _toolbar.LISTS_INDENTATION_GROUP.key,
|
|
51
|
+
rank: _toolbar.LISTS_INDENTATION_GROUP_RANK[_toolbar.LISTS_INDENTATION_MENU.key]
|
|
52
|
+
}],
|
|
53
|
+
component: function component(_ref3) {
|
|
54
|
+
var children = _ref3.children,
|
|
55
|
+
groupLocation = _ref3.groupLocation;
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement(_ListsIndentationMenu.ListsIndentationMenu, {
|
|
57
|
+
api: api,
|
|
58
|
+
groupLocation: groupLocation,
|
|
59
|
+
allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation
|
|
60
|
+
}, children);
|
|
61
|
+
}
|
|
62
|
+
}, {
|
|
63
|
+
type: _toolbar.LISTS_INDENTATION_MENU_SECTION.type,
|
|
64
|
+
key: _toolbar.LISTS_INDENTATION_MENU_SECTION.key,
|
|
65
|
+
parents: [{
|
|
66
|
+
type: _toolbar.LISTS_INDENTATION_MENU.type,
|
|
67
|
+
key: _toolbar.LISTS_INDENTATION_MENU.key,
|
|
68
|
+
rank: _toolbar.LISTS_INDENTATION_MENU_RANK[_toolbar.LISTS_INDENTATION_MENU_SECTION.key]
|
|
69
|
+
}]
|
|
70
|
+
}, {
|
|
71
|
+
type: _toolbar.BULLETED_LIST_MENU_ITEM.type,
|
|
72
|
+
key: _toolbar.BULLETED_LIST_MENU_ITEM.key,
|
|
73
|
+
parents: [{
|
|
74
|
+
type: _toolbar.LISTS_INDENTATION_MENU_SECTION.type,
|
|
75
|
+
key: _toolbar.LISTS_INDENTATION_MENU_SECTION.key,
|
|
76
|
+
rank: _toolbar.LISTS_INDENTATION_MENU_SECTION_RANK[_toolbar.BULLETED_LIST_MENU_ITEM.key]
|
|
77
|
+
}],
|
|
78
|
+
component: function component(_ref4) {
|
|
79
|
+
var parents = _ref4.parents;
|
|
80
|
+
return /*#__PURE__*/_react.default.createElement(_BulletedListMenuItem.BulletedListMenuItem, {
|
|
81
|
+
api: api,
|
|
82
|
+
parents: parents
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
type: _toolbar.NUMBERED_LIST_MENU_ITEM.type,
|
|
87
|
+
key: _toolbar.NUMBERED_LIST_MENU_ITEM.key,
|
|
88
|
+
parents: [{
|
|
89
|
+
type: _toolbar.LISTS_INDENTATION_MENU_SECTION.type,
|
|
90
|
+
key: _toolbar.LISTS_INDENTATION_MENU_SECTION.key,
|
|
91
|
+
rank: _toolbar.LISTS_INDENTATION_MENU_SECTION_RANK[_toolbar.NUMBERED_LIST_MENU_ITEM.key]
|
|
92
|
+
}],
|
|
93
|
+
component: function component(_ref5) {
|
|
94
|
+
var parents = _ref5.parents;
|
|
95
|
+
return /*#__PURE__*/_react.default.createElement(_NumberedListMenuItem.NumberedListMenuItem, {
|
|
96
|
+
api: api,
|
|
97
|
+
parents: parents
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
type: _toolbar.OUTDENT_MENU_ITEM.type,
|
|
102
|
+
key: _toolbar.OUTDENT_MENU_ITEM.key,
|
|
103
|
+
parents: [{
|
|
104
|
+
type: _toolbar.LISTS_INDENTATION_MENU_SECTION.type,
|
|
105
|
+
key: _toolbar.LISTS_INDENTATION_MENU_SECTION.key,
|
|
106
|
+
rank: _toolbar.LISTS_INDENTATION_MENU_SECTION_RANK[_toolbar.OUTDENT_MENU_ITEM.key]
|
|
107
|
+
}],
|
|
108
|
+
component: function component(_ref6) {
|
|
109
|
+
var parents = _ref6.parents;
|
|
110
|
+
return /*#__PURE__*/_react.default.createElement(_OutdentMenuItem.OutdentMenuItem, {
|
|
111
|
+
api: api,
|
|
112
|
+
allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation,
|
|
113
|
+
showIndentationButtons: showIndentationButtons,
|
|
114
|
+
parents: parents
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
type: _toolbar.INDENT_MENU_ITEM.type,
|
|
119
|
+
key: _toolbar.INDENT_MENU_ITEM.key,
|
|
120
|
+
parents: [{
|
|
121
|
+
type: _toolbar.LISTS_INDENTATION_MENU_SECTION.type,
|
|
122
|
+
key: _toolbar.LISTS_INDENTATION_MENU_SECTION.key,
|
|
123
|
+
rank: _toolbar.LISTS_INDENTATION_MENU_SECTION_RANK[_toolbar.INDENT_MENU_ITEM.key]
|
|
124
|
+
}],
|
|
125
|
+
component: function component(_ref7) {
|
|
126
|
+
var parents = _ref7.parents;
|
|
127
|
+
return /*#__PURE__*/_react.default.createElement(_IndentMenuItem.IndentMenuItem, {
|
|
128
|
+
api: api,
|
|
129
|
+
allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation,
|
|
130
|
+
showIndentationButtons: showIndentationButtons,
|
|
131
|
+
parents: parents
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}];
|
|
135
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useIndentationState = void 0;
|
|
7
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
8
|
+
var _indentationButtons = require("../../pm-plugins/indentation-buttons");
|
|
9
|
+
var useIndentationState = exports.useIndentationState = function useIndentationState(_ref) {
|
|
10
|
+
var api = _ref.api,
|
|
11
|
+
allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation,
|
|
12
|
+
state = _ref.state;
|
|
13
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['indentation'], function (states) {
|
|
14
|
+
var _states$indentationSt, _states$indentationSt2, _states$indentationSt3;
|
|
15
|
+
return {
|
|
16
|
+
isIndentationAllowed: (_states$indentationSt = states.indentationState) === null || _states$indentationSt === void 0 ? void 0 : _states$indentationSt.isIndentationAllowed,
|
|
17
|
+
outdentDisabled: (_states$indentationSt2 = states.indentationState) === null || _states$indentationSt2 === void 0 ? void 0 : _states$indentationSt2.outdentDisabled,
|
|
18
|
+
indentDisabled: (_states$indentationSt3 = states.indentationState) === null || _states$indentationSt3 === void 0 ? void 0 : _states$indentationSt3.indentDisabled
|
|
19
|
+
};
|
|
20
|
+
}),
|
|
21
|
+
isIndentationAllowed = _useSharedPluginState.isIndentationAllowed,
|
|
22
|
+
indentDisabled = _useSharedPluginState.indentDisabled,
|
|
23
|
+
outdentDisabled = _useSharedPluginState.outdentDisabled;
|
|
24
|
+
var _useSharedPluginState2 = (0, _hooks.useSharedPluginStateWithSelector)(api, ['taskDecision'], function (states) {
|
|
25
|
+
var _states$taskDecisionS, _states$taskDecisionS2, _states$taskDecisionS3;
|
|
26
|
+
return {
|
|
27
|
+
isInsideTask: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask,
|
|
28
|
+
outdentDisabled: (_states$taskDecisionS2 = states.taskDecisionState) === null || _states$taskDecisionS2 === void 0 ? void 0 : _states$taskDecisionS2.outdentDisabled,
|
|
29
|
+
indentDisabled: (_states$taskDecisionS3 = states.taskDecisionState) === null || _states$taskDecisionS3 === void 0 ? void 0 : _states$taskDecisionS3.indentDisabled
|
|
30
|
+
};
|
|
31
|
+
}),
|
|
32
|
+
isInsideTask = _useSharedPluginState2.isInsideTask,
|
|
33
|
+
taskIndentDisabled = _useSharedPluginState2.indentDisabled,
|
|
34
|
+
taskOutdentDisabled = _useSharedPluginState2.outdentDisabled;
|
|
35
|
+
if (!state) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
return (0, _indentationButtons.getIndentationButtonsState)(state, allowHeadingAndParagraphIndentation, {
|
|
39
|
+
isInsideTask: isInsideTask !== null && isInsideTask !== void 0 ? isInsideTask : false,
|
|
40
|
+
indentDisabled: taskIndentDisabled !== null && taskIndentDisabled !== void 0 ? taskIndentDisabled : false,
|
|
41
|
+
outdentDisabled: taskOutdentDisabled !== null && taskOutdentDisabled !== void 0 ? taskOutdentDisabled : false
|
|
42
|
+
}, {
|
|
43
|
+
isIndentationAllowed: isIndentationAllowed,
|
|
44
|
+
indentDisabled: indentDisabled,
|
|
45
|
+
outdentDisabled: outdentDisabled
|
|
46
|
+
}, api === null || api === void 0 ? void 0 : api.list.actions.isInsideListItem);
|
|
47
|
+
};
|