@atlaskit/editor-core 189.3.20 → 189.3.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/plugins/find-replace/ui/Find.js +5 -2
  3. package/dist/cjs/plugins/find-replace/ui/styles.js +9 -6
  4. package/dist/cjs/plugins/indentation/commands/index.js +5 -5
  5. package/dist/cjs/plugins/indentation/index.js +26 -2
  6. package/dist/cjs/plugins/indentation/pm-plugins/keymap.js +1 -1
  7. package/dist/cjs/plugins/tasks-and-decisions/index.js +8 -1
  8. package/dist/cjs/plugins/toolbar-lists-indentation/index.js +34 -37
  9. package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +14 -57
  10. package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +2 -3
  11. package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -3
  12. package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +3 -2
  13. package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +11 -15
  14. package/dist/cjs/version-wrapper.js +1 -1
  15. package/dist/es2019/plugins/find-replace/ui/Find.js +6 -3
  16. package/dist/es2019/plugins/find-replace/ui/styles.js +8 -5
  17. package/dist/es2019/plugins/indentation/commands/index.js +3 -3
  18. package/dist/es2019/plugins/indentation/index.js +49 -17
  19. package/dist/es2019/plugins/indentation/pm-plugins/keymap.js +1 -1
  20. package/dist/es2019/plugins/tasks-and-decisions/index.js +8 -1
  21. package/dist/es2019/plugins/toolbar-lists-indentation/index.js +14 -20
  22. package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +11 -52
  23. package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +1 -2
  24. package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +1 -2
  25. package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +3 -2
  26. package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +11 -15
  27. package/dist/es2019/version-wrapper.js +1 -1
  28. package/dist/esm/plugins/find-replace/ui/Find.js +6 -3
  29. package/dist/esm/plugins/find-replace/ui/styles.js +8 -5
  30. package/dist/esm/plugins/indentation/commands/index.js +3 -3
  31. package/dist/esm/plugins/indentation/index.js +26 -2
  32. package/dist/esm/plugins/indentation/pm-plugins/keymap.js +1 -1
  33. package/dist/esm/plugins/tasks-and-decisions/index.js +8 -1
  34. package/dist/esm/plugins/toolbar-lists-indentation/index.js +31 -38
  35. package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +11 -55
  36. package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +1 -2
  37. package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +1 -2
  38. package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +3 -2
  39. package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +11 -15
  40. package/dist/esm/version-wrapper.js +1 -1
  41. package/dist/types/plugins/find-replace/ui/styles.d.ts +1 -0
  42. package/dist/types/plugins/indentation/commands/index.d.ts +1 -2
  43. package/dist/types/plugins/indentation/commands/utils.d.ts +1 -1
  44. package/dist/types/plugins/indentation/index.d.ts +14 -2
  45. package/dist/types/plugins/tasks-and-decisions/types.d.ts +3 -0
  46. package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +18 -2
  47. package/dist/types/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +15 -11
  48. package/dist/types/plugins/toolbar-lists-indentation/ui/index.d.ts +2 -0
  49. package/dist/types/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +2 -1
  50. package/dist/types-ts4.5/plugins/find-replace/ui/styles.d.ts +1 -0
  51. package/dist/types-ts4.5/plugins/indentation/commands/index.d.ts +1 -2
  52. package/dist/types-ts4.5/plugins/indentation/commands/utils.d.ts +1 -1
  53. package/dist/types-ts4.5/plugins/indentation/index.d.ts +14 -2
  54. package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +3 -0
  55. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/index.d.ts +18 -2
  56. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +15 -11
  57. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/ui/index.d.ts +2 -0
  58. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +2 -1
  59. package/package.json +5 -5
  60. package/dist/cjs/plugins/indentation/messages.js +0 -21
  61. package/dist/es2019/plugins/indentation/messages.js +0 -14
  62. package/dist/esm/plugins/indentation/messages.js +0 -14
  63. package/dist/types/plugins/indentation/messages.d.ts +0 -12
  64. package/dist/types-ts4.5/plugins/indentation/messages.d.ts +0 -12
  65. /package/dist/cjs/{utils → plugins/indentation}/getAttrsWithChangesRecorder.js +0 -0
  66. /package/dist/es2019/{utils → plugins/indentation}/getAttrsWithChangesRecorder.js +0 -0
  67. /package/dist/esm/{utils → plugins/indentation}/getAttrsWithChangesRecorder.js +0 -0
  68. /package/dist/types/{utils → plugins/indentation}/getAttrsWithChangesRecorder.d.ts +0 -0
  69. /package/dist/types-ts4.5/{utils → plugins/indentation}/getAttrsWithChangesRecorder.d.ts +0 -0
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
3
  import ToolbarListsIndentation from './ui';
4
4
  import { ToolbarSize } from '../../ui/Toolbar/types';
5
- import { createPlugin as indentationButtonsPlugin } from './pm-plugins/indentation-buttons';
5
+ import { getIndentationButtonsState } from './pm-plugins/indentation-buttons';
6
6
  import { pluginKey as indentationButtonPluginKey } from './pm-plugins/indentation-buttons';
7
7
  var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref) {
8
8
  var _api$featureFlags;
@@ -22,28 +22,14 @@ var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref)
22
22
  }
23
23
  return indentationButtonPluginKey.getState(editorState);
24
24
  },
25
- pmPlugins: function pmPlugins() {
26
- return [{
27
- name: 'indentationButtons',
28
- plugin: function plugin(_ref3) {
29
- var dispatch = _ref3.dispatch;
30
- return indentationButtonsPlugin({
31
- dispatch: dispatch,
32
- showIndentationButtons: showIndentationButtons,
33
- allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation,
34
- api: api
35
- });
36
- }
37
- }];
38
- },
39
- primaryToolbarComponent: function primaryToolbarComponent(_ref4) {
40
- var editorView = _ref4.editorView,
41
- popupsMountPoint = _ref4.popupsMountPoint,
42
- popupsBoundariesElement = _ref4.popupsBoundariesElement,
43
- popupsScrollableElement = _ref4.popupsScrollableElement,
44
- toolbarSize = _ref4.toolbarSize,
45
- disabled = _ref4.disabled,
46
- isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing;
25
+ primaryToolbarComponent: function primaryToolbarComponent(_ref3) {
26
+ var editorView = _ref3.editorView,
27
+ popupsMountPoint = _ref3.popupsMountPoint,
28
+ popupsBoundariesElement = _ref3.popupsBoundariesElement,
29
+ popupsScrollableElement = _ref3.popupsScrollableElement,
30
+ toolbarSize = _ref3.toolbarSize,
31
+ disabled = _ref3.disabled,
32
+ isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing;
47
33
  var isSmall = toolbarSize < ToolbarSize.L;
48
34
  return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
49
35
  featureFlags: featureFlags,
@@ -55,25 +41,31 @@ var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref)
55
41
  disabled: disabled,
56
42
  editorView: editorView,
57
43
  showIndentationButtons: showIndentationButtons,
58
- pluginInjectionApi: api
44
+ pluginInjectionApi: api,
45
+ allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation
59
46
  });
60
47
  }
61
48
  };
62
49
  };
63
- function PrimaryToolbarComponent(_ref5) {
64
- var featureFlags = _ref5.featureFlags,
65
- popupsMountPoint = _ref5.popupsMountPoint,
66
- popupsBoundariesElement = _ref5.popupsBoundariesElement,
67
- popupsScrollableElement = _ref5.popupsScrollableElement,
68
- isSmall = _ref5.isSmall,
69
- isToolbarReducedSpacing = _ref5.isToolbarReducedSpacing,
70
- disabled = _ref5.disabled,
71
- editorView = _ref5.editorView,
72
- showIndentationButtons = _ref5.showIndentationButtons,
73
- pluginInjectionApi = _ref5.pluginInjectionApi;
74
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['list', 'toolbarListsIndentation']),
50
+ export function PrimaryToolbarComponent(_ref4) {
51
+ var featureFlags = _ref4.featureFlags,
52
+ popupsMountPoint = _ref4.popupsMountPoint,
53
+ popupsBoundariesElement = _ref4.popupsBoundariesElement,
54
+ popupsScrollableElement = _ref4.popupsScrollableElement,
55
+ isSmall = _ref4.isSmall,
56
+ isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing,
57
+ disabled = _ref4.disabled,
58
+ editorView = _ref4.editorView,
59
+ showIndentationButtons = _ref4.showIndentationButtons,
60
+ pluginInjectionApi = _ref4.pluginInjectionApi,
61
+ allowHeadingAndParagraphIndentation = _ref4.allowHeadingAndParagraphIndentation;
62
+ var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['list', 'indentation', 'taskDecision']),
75
63
  listState = _useSharedPluginState.listState,
76
- toolbarListsIndentationState = _useSharedPluginState.toolbarListsIndentationState;
64
+ indentationState = _useSharedPluginState.indentationState,
65
+ taskDecisionState = _useSharedPluginState.taskDecisionState;
66
+ var toolbarListsIndentationState = useMemo(function () {
67
+ return getIndentationButtonsState(editorView.state, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.actions.isInsideListItem);
68
+ }, [editorView.state, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.actions.isInsideListItem]);
77
69
  if (!listState) {
78
70
  return null;
79
71
  }
@@ -93,6 +85,7 @@ function PrimaryToolbarComponent(_ref5) {
93
85
  showIndentationButtons: !!showIndentationButtons,
94
86
  indentDisabled: toolbarListsIndentationState.indentDisabled,
95
87
  outdentDisabled: toolbarListsIndentationState.outdentDisabled,
88
+ indentationStateNode: toolbarListsIndentationState === null || toolbarListsIndentationState === void 0 ? void 0 : toolbarListsIndentationState.node,
96
89
  pluginInjectionApi: pluginInjectionApi
97
90
  });
98
91
  }
@@ -1,25 +1,22 @@
1
1
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
2
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- import { shallowEqual } from '@atlaskit/editor-common/utils';
5
- import { getCurrentIndentLevel as getTaskListIndentLevel, getTaskItemIndex, isInsideTask } from '../../tasks-and-decisions/pm-plugins/helpers';
6
- import { isIndentationAllowed, MAX_INDENTATION_LEVEL } from '../../indentation/commands';
7
3
  import { getListItemAttributes } from '@atlaskit/editor-common/lists';
4
+ import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
8
5
  export var pluginKey = new PluginKey('indentationButtonsPlugin');
9
- function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation, api) {
6
+ export function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, isInsideListItem) {
7
+ var _indentationState$isI;
10
8
  var state = {
11
9
  indentDisabled: true,
12
10
  outdentDisabled: true,
13
11
  node: null
14
12
  };
15
13
  var selection = editorState.selection;
16
- var node = selection.$from.node();
17
14
 
18
15
  // Handle bullet and numbered lists seperately as they do
19
16
  // not use the indentation mark.
20
17
  // Check for lists before paragraphs and headings in case
21
18
  // the selection is in a list nested in a layout column.
22
- if (api !== null && api !== void 0 && api.list.actions.isInsideListItem(editorState.tr)) {
19
+ if (isInsideListItem !== null && isInsideListItem !== void 0 && isInsideListItem(editorState.tr)) {
23
20
  var _getListItemAttribute = getListItemAttributes(selection.$head),
24
21
  indentLevel = _getListItemAttribute.indentLevel,
25
22
  itemIndex = _getListItemAttribute.itemIndex;
@@ -33,12 +30,10 @@ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndenta
33
30
 
34
31
  // Handle tasks seperately as they do not use the indentation mark
35
32
  // and have different behaviour for outdent compared to lists
36
- if (isInsideTask(editorState)) {
37
- var _indentLevel = getTaskListIndentLevel(selection) || 0;
38
- var _itemIndex = getTaskItemIndex(editorState);
33
+ if (taskDecisionState !== null && taskDecisionState !== void 0 && taskDecisionState.isInsideTask) {
39
34
  return {
40
- indentDisabled: _itemIndex === 0 || _indentLevel >= MAX_INDENTATION_LEVEL,
41
- outdentDisabled: _indentLevel <= 1,
35
+ indentDisabled: taskDecisionState.indentDisabled,
36
+ outdentDisabled: taskDecisionState.outdentDisabled,
42
37
  node: 'taskList'
43
38
  };
44
39
  }
@@ -46,51 +41,12 @@ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndenta
46
41
  var isInLayoutNode = hasParentNodeOfType(editorState.schema.nodes.layoutColumn)(selection) &&
47
42
  // depth of non-nested paragraphs and headings in layouts will always be 3
48
43
  selection.$from.depth === 3;
49
- if (allowHeadingAndParagraphIndentation && isIndentationAllowed(editorState.schema, node) && (isTopLevelParagraphOrHeading || isInLayoutNode)) {
50
- var indentationMark = node.marks.find(function (mark) {
51
- return mark.type === editorState.schema.marks.indentation;
52
- });
53
- if (!indentationMark) {
54
- return {
55
- outdentDisabled: true,
56
- indentDisabled: false,
57
- node: 'paragraph_heading'
58
- };
59
- }
44
+ if (allowHeadingAndParagraphIndentation && ((_indentationState$isI = indentationState === null || indentationState === void 0 ? void 0 : indentationState.isIndentationAllowed) !== null && _indentationState$isI !== void 0 ? _indentationState$isI : false) && (isTopLevelParagraphOrHeading || isInLayoutNode) && indentationState) {
60
45
  return {
61
- indentDisabled: indentationMark.attrs.level >= MAX_INDENTATION_LEVEL,
62
- outdentDisabled: false,
46
+ indentDisabled: indentationState.indentDisabled,
47
+ outdentDisabled: indentationState.outdentDisabled,
63
48
  node: 'paragraph_heading'
64
49
  };
65
50
  }
66
51
  return state;
67
- }
68
- export var createPlugin = function createPlugin(_ref) {
69
- var dispatch = _ref.dispatch,
70
- showIndentationButtons = _ref.showIndentationButtons,
71
- allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation,
72
- api = _ref.api;
73
- return new SafePlugin({
74
- state: {
75
- init: function init(_config, state) {
76
- var initialState = {
77
- indentDisabled: true,
78
- outdentDisabled: true,
79
- node: null
80
- };
81
- return showIndentationButtons ? getIndentationButtonsState(state, allowHeadingAndParagraphIndentation, api) : initialState;
82
- },
83
- apply: function apply(_tr, pluginState, _oldState, newState) {
84
- if (showIndentationButtons) {
85
- var state = getIndentationButtonsState(newState, allowHeadingAndParagraphIndentation, api);
86
- if (!shallowEqual(pluginState, state)) {
87
- dispatch(pluginKey, state);
88
- return state;
89
- }
90
- }
91
- return pluginState;
92
- }
93
- },
94
- key: pluginKey
95
- });
96
- };
52
+ }
@@ -7,8 +7,7 @@ import IndentIcon from '@atlaskit/icon/glyph/editor/indent';
7
7
  import OutdentIcon from '@atlaskit/icon/glyph/editor/outdent';
8
8
  import { toggleBulletList as toggleBulletListKeymap, toggleOrderedList as toggleOrderedListKeymap, indent as toggleIndentKeymap, outdent as toggleOutdentKeymap, ToolTipContent, tooltip } from '../../../keymaps';
9
9
  import ToolbarButton, { TOOLBAR_BUTTON } from '../../../ui/ToolbarButton';
10
- import { listMessages as messages } from '@atlaskit/editor-common/messages';
11
- import { messages as indentationMessages } from '../../indentation/messages';
10
+ import { listMessages as messages, indentationMessages } from '@atlaskit/editor-common/messages';
12
11
  import { separatorStyles, buttonGroupStyle } from '@atlaskit/editor-common/styles';
13
12
  import { getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
14
13
  import { useEffect, useRef } from 'react';
@@ -11,8 +11,7 @@ import ToolbarButton from '../../../ui/ToolbarButton';
11
11
  import { shortcutStyle } from '../../../ui/styles';
12
12
  import { expandIconWrapperStyle } from '@atlaskit/editor-common/styles';
13
13
  import { wrapperStyle, separatorStyles } from '@atlaskit/editor-common/styles';
14
- import { listMessages } from '@atlaskit/editor-common/messages';
15
- import { messages as indentationMessages } from '../../indentation/messages';
14
+ import { listMessages, indentationMessages } from '@atlaskit/editor-common/messages';
16
15
  export function ToolbarDropdown(props) {
17
16
  var _useIntl = useIntl(),
18
17
  formatMessage = _useIntl.formatMessage;
@@ -17,6 +17,7 @@ export default function ToolbarListsIndentation(props) {
17
17
  popupsScrollableElement = props.popupsScrollableElement,
18
18
  indentDisabled = props.indentDisabled,
19
19
  outdentDisabled = props.outdentDisabled,
20
+ indentationStateNode = props.indentationStateNode,
20
21
  featureFlags = props.featureFlags,
21
22
  pluginInjectionApi = props.pluginInjectionApi;
22
23
  if (isSmall) {
@@ -34,7 +35,7 @@ export default function ToolbarListsIndentation(props) {
34
35
  indentDisabled: indentDisabled,
35
36
  outdentDisabled: outdentDisabled,
36
37
  disabled: disabled,
37
- onItemActivated: onItemActivated(pluginInjectionApi),
38
+ onItemActivated: onItemActivated(pluginInjectionApi, indentationStateNode),
38
39
  featureFlags: featureFlags
39
40
  });
40
41
  }
@@ -49,7 +50,7 @@ export default function ToolbarListsIndentation(props) {
49
50
  indentDisabled: indentDisabled,
50
51
  outdentDisabled: outdentDisabled,
51
52
  disabled: disabled,
52
- onItemActivated: onItemActivated(pluginInjectionApi),
53
+ onItemActivated: onItemActivated(pluginInjectionApi, indentationStateNode),
53
54
  featureFlags: featureFlags
54
55
  });
55
56
  }
@@ -1,8 +1,6 @@
1
- import { getIndentCommand as indentParagraphOrHeading, getOutdentCommand as outdentParagraphOrHeading } from '../../indentation/commands';
2
1
  import { getIndentCommand as indentTaskList, getUnindentCommand as outdentTaskList } from '../../tasks-and-decisions/pm-plugins/keymaps';
3
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { pluginKey as indentationButtonsPluginKey } from '../pm-plugins/indentation-buttons';
5
- export var onItemActivated = function onItemActivated(pluginInjectionApi) {
3
+ export var onItemActivated = function onItemActivated(pluginInjectionApi, indentationStateNode) {
6
4
  return function (_ref) {
7
5
  var buttonName = _ref.buttonName,
8
6
  editorView = _ref.editorView;
@@ -15,35 +13,33 @@ export var onItemActivated = function onItemActivated(pluginInjectionApi) {
15
13
  break;
16
14
  case 'indent':
17
15
  {
18
- var _indentationButtonsPl;
19
- var node = (_indentationButtonsPl = indentationButtonsPluginKey.getState(editorView.state)) === null || _indentationButtonsPl === void 0 ? void 0 : _indentationButtonsPl.node;
16
+ var node = indentationStateNode;
20
17
  if (node === 'paragraph_heading') {
21
- var _pluginInjectionApi$a;
22
- indentParagraphOrHeading(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
18
+ var _pluginInjectionApi$i;
19
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i = pluginInjectionApi.indentation) === null || _pluginInjectionApi$i === void 0 || _pluginInjectionApi$i.actions.indentParagraphOrHeading(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
23
20
  }
24
21
  if (node === 'list') {
25
22
  pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.indentList(INPUT_METHOD.TOOLBAR));
26
23
  }
27
24
  if (node === 'taskList') {
28
- var _pluginInjectionApi$a2;
29
- indentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
25
+ var _pluginInjectionApi$a;
26
+ indentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
30
27
  }
31
28
  break;
32
29
  }
33
30
  case 'outdent':
34
31
  {
35
- var _indentationButtonsPl2;
36
- var _node = (_indentationButtonsPl2 = indentationButtonsPluginKey.getState(editorView.state)) === null || _indentationButtonsPl2 === void 0 ? void 0 : _indentationButtonsPl2.node;
32
+ var _node = indentationStateNode;
37
33
  if (_node === 'paragraph_heading') {
38
- var _pluginInjectionApi$a3;
39
- outdentParagraphOrHeading(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
34
+ var _pluginInjectionApi$i2;
35
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i2 = pluginInjectionApi.indentation) === null || _pluginInjectionApi$i2 === void 0 || _pluginInjectionApi$i2.actions.outdentParagraphOrHeading(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
40
36
  }
41
37
  if (_node === 'list') {
42
38
  pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.outdentList(INPUT_METHOD.TOOLBAR));
43
39
  }
44
40
  if (_node === 'taskList') {
45
- var _pluginInjectionApi$a4;
46
- outdentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
41
+ var _pluginInjectionApi$a2;
42
+ outdentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
47
43
  }
48
44
  break;
49
45
  }
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "189.3.20";
2
+ export var version = "189.3.23";
@@ -3,3 +3,4 @@ export declare const ruleStyles: import("@emotion/react").SerializedStyles;
3
3
  export declare const wrapperStyles: import("@emotion/react").SerializedStyles;
4
4
  export declare const sectionWrapperStyles: import("@emotion/react").SerializedStyles;
5
5
  export declare const countStyles: import("@emotion/react").SerializedStyles;
6
+ export declare const countWrapperStyles: import("@emotion/react").SerializedStyles;
@@ -1,8 +1,7 @@
1
1
  import type { Node as PmNode, Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- import type { Command } from '../../../types/command';
3
+ import type { Command } from '@atlaskit/editor-common/types';
4
4
  import type { IndentationInputMethod } from './utils';
5
- export declare const MAX_INDENTATION_LEVEL = 6;
6
5
  export declare const isIndentationAllowed: (schema: Schema, node: PmNode) => boolean;
7
6
  export declare const getIndentCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: IndentationInputMethod) => Command;
8
7
  export declare const getOutdentCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: IndentationInputMethod) => Command;
@@ -1,7 +1,7 @@
1
1
  import type { IndentationMarkAttributes } from '@atlaskit/adf-schema';
2
2
  import type { INDENT_DIRECTION, INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
3
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
- import type { GetAttrsChange } from '../../../utils/getAttrsWithChangesRecorder';
4
+ import type { GetAttrsChange } from '../getAttrsWithChangesRecorder';
5
5
  export type PrevAttributes = IndentationMarkAttributes | undefined;
6
6
  export type NewAttributes = IndentationMarkAttributes | undefined | false;
7
7
  export type IndentationChangesOptions = {
@@ -1,6 +1,18 @@
1
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
1
+ import type { NextEditorPlugin, OptionalPlugin, Command } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
- declare const indentationPlugin: NextEditorPlugin<'indentation', {
3
+ import type { IndentationInputMethod } from './commands/utils';
4
+ type IndentationPluginSharedState = {
5
+ isIndentationAllowed: boolean;
6
+ indentDisabled: boolean;
7
+ outdentDisabled: boolean;
8
+ };
9
+ export type IndentationPlugin = NextEditorPlugin<'indentation', {
4
10
  dependencies: [OptionalPlugin<AnalyticsPlugin>];
11
+ actions: {
12
+ indentParagraphOrHeading: (inputMethod: IndentationInputMethod) => Command;
13
+ outdentParagraphOrHeading: (inputMethod: IndentationInputMethod) => Command;
14
+ };
15
+ sharedState: IndentationPluginSharedState | undefined;
5
16
  }>;
17
+ declare const indentationPlugin: IndentationPlugin;
6
18
  export default indentationPlugin;
@@ -28,6 +28,9 @@ export interface TaskDecisionPluginOptions extends LongPressSelectionPluginOptio
28
28
  }
29
29
  export type TaskAndDecisionsSharedState = {
30
30
  focusedTaskItemLocalId: string | null;
31
+ indentDisabled: boolean;
32
+ outdentDisabled: boolean;
33
+ isInsideTask: boolean;
31
34
  };
32
35
  export type TaskAndDecisionsPlugin = NextEditorPlugin<'taskDecision', {
33
36
  pluginConfiguration: TaskDecisionPluginOptions | undefined;
@@ -1,19 +1,35 @@
1
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
1
+ /// <reference types="react" />
2
+ import type { FeatureFlags, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
3
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
3
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
5
  import type { ListPlugin } from '@atlaskit/editor-plugin-list';
5
6
  import type { IndentationButtons } from './pm-plugins/indentation-buttons';
7
+ import type { ToolbarUiComponentFactoryParams } from '../../types';
8
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
9
+ import type { IndentationPlugin } from '../indentation';
10
+ import type { TaskAndDecisionsPlugin } from '../tasks-and-decisions/types';
6
11
  type Config = {
7
12
  showIndentationButtons: boolean;
8
13
  allowHeadingAndParagraphIndentation: boolean;
9
14
  };
10
- declare const toolbarListsIndentationPlugin: NextEditorPlugin<'toolbarListsIndentation', {
15
+ type ToolbarListsIndentationPlugin = NextEditorPlugin<'toolbarListsIndentation', {
11
16
  pluginConfiguration: Config;
12
17
  dependencies: [
13
18
  FeatureFlagsPlugin,
14
19
  ListPlugin,
20
+ OptionalPlugin<IndentationPlugin>,
21
+ OptionalPlugin<TaskAndDecisionsPlugin>,
15
22
  OptionalPlugin<AnalyticsPlugin>
16
23
  ];
17
24
  sharedState: IndentationButtons | undefined;
18
25
  }>;
26
+ declare const toolbarListsIndentationPlugin: ToolbarListsIndentationPlugin;
27
+ type PrimaryToolbarComponentProps = Pick<ToolbarUiComponentFactoryParams, 'editorView' | 'popupsMountPoint' | 'popupsBoundariesElement' | 'popupsScrollableElement' | 'disabled' | 'isToolbarReducedSpacing'> & {
28
+ featureFlags: FeatureFlags;
29
+ isSmall: boolean;
30
+ showIndentationButtons?: boolean;
31
+ pluginInjectionApi: ExtractInjectionAPI<typeof toolbarListsIndentationPlugin> | undefined;
32
+ allowHeadingAndParagraphIndentation: boolean;
33
+ };
34
+ export declare function PrimaryToolbarComponent({ featureFlags, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, isSmall, isToolbarReducedSpacing, disabled, editorView, showIndentationButtons, pluginInjectionApi, allowHeadingAndParagraphIndentation, }: PrimaryToolbarComponentProps): JSX.Element | null;
19
35
  export default toolbarListsIndentationPlugin;
@@ -1,17 +1,21 @@
1
+ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
1
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { Dispatch } from '../../../event-dispatcher';
4
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
- import type toolbarListsIndentationPlugin from '../index';
3
+ export type IndentationButtonNode = null | 'paragraph_heading' | 'list' | 'taskList';
6
4
  export interface IndentationButtons {
7
5
  indentDisabled: boolean;
8
6
  outdentDisabled: boolean;
9
- node: null | 'paragraph_heading' | 'list' | 'taskList';
7
+ node: IndentationButtonNode;
10
8
  }
11
9
  export declare const pluginKey: PluginKey<IndentationButtons>;
12
- export declare const createPlugin: ({ dispatch, showIndentationButtons, allowHeadingAndParagraphIndentation, api, }: {
13
- dispatch: Dispatch;
14
- showIndentationButtons: boolean;
15
- allowHeadingAndParagraphIndentation: boolean;
16
- api: ExtractInjectionAPI<typeof toolbarListsIndentationPlugin> | undefined;
17
- }) => SafePlugin<IndentationButtons>;
10
+ interface TaskDecisionState {
11
+ isInsideTask: boolean;
12
+ indentDisabled: boolean;
13
+ outdentDisabled: boolean;
14
+ }
15
+ interface IndentationState {
16
+ isIndentationAllowed: boolean;
17
+ indentDisabled: boolean;
18
+ outdentDisabled: boolean;
19
+ }
20
+ export declare function getIndentationButtonsState(editorState: EditorState, allowHeadingAndParagraphIndentation: boolean, taskDecisionState: TaskDecisionState | undefined, indentationState: IndentationState | undefined, isInsideListItem: ((tr: Transaction) => boolean | undefined) | undefined): IndentationButtons;
21
+ export {};
@@ -3,6 +3,7 @@ import { jsx } from '@emotion/react';
3
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { ExtractInjectionAPI, FeatureFlags } from '@atlaskit/editor-common/types';
5
5
  import type toolbarListsIndentationPlugin from '../index';
6
+ import type { IndentationButtonNode } from '../pm-plugins/indentation-buttons';
6
7
  export interface Props {
7
8
  editorView: EditorView;
8
9
  featureFlags: FeatureFlags;
@@ -19,6 +20,7 @@ export interface Props {
19
20
  showIndentationButtons?: boolean;
20
21
  indentDisabled?: boolean;
21
22
  outdentDisabled?: boolean;
23
+ indentationStateNode?: IndentationButtonNode;
22
24
  pluginInjectionApi?: ExtractInjectionAPI<typeof toolbarListsIndentationPlugin> | undefined;
23
25
  }
24
26
  export default function ToolbarListsIndentation(props: Props): jsx.JSX.Element;
@@ -1,8 +1,9 @@
1
1
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ import type { IndentationButtonNode } from '../pm-plugins/indentation-buttons';
2
3
  import type { ButtonName } from '../types';
3
4
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
5
  import type toolbarListsIndentationPlugin from '../index';
5
- export declare const onItemActivated: (pluginInjectionApi: ExtractInjectionAPI<typeof toolbarListsIndentationPlugin> | undefined) => ({ buttonName, editorView, }: {
6
+ export declare const onItemActivated: (pluginInjectionApi: ExtractInjectionAPI<typeof toolbarListsIndentationPlugin> | undefined, indentationStateNode: IndentationButtonNode | undefined) => ({ buttonName, editorView, }: {
6
7
  buttonName: ButtonName;
7
8
  editorView: EditorView;
8
9
  }) => void;
@@ -3,3 +3,4 @@ export declare const ruleStyles: import("@emotion/react").SerializedStyles;
3
3
  export declare const wrapperStyles: import("@emotion/react").SerializedStyles;
4
4
  export declare const sectionWrapperStyles: import("@emotion/react").SerializedStyles;
5
5
  export declare const countStyles: import("@emotion/react").SerializedStyles;
6
+ export declare const countWrapperStyles: import("@emotion/react").SerializedStyles;
@@ -1,8 +1,7 @@
1
1
  import type { Node as PmNode, Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- import type { Command } from '../../../types/command';
3
+ import type { Command } from '@atlaskit/editor-common/types';
4
4
  import type { IndentationInputMethod } from './utils';
5
- export declare const MAX_INDENTATION_LEVEL = 6;
6
5
  export declare const isIndentationAllowed: (schema: Schema, node: PmNode) => boolean;
7
6
  export declare const getIndentCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: IndentationInputMethod) => Command;
8
7
  export declare const getOutdentCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: IndentationInputMethod) => Command;
@@ -1,7 +1,7 @@
1
1
  import type { IndentationMarkAttributes } from '@atlaskit/adf-schema';
2
2
  import type { INDENT_DIRECTION, INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
3
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
- import type { GetAttrsChange } from '../../../utils/getAttrsWithChangesRecorder';
4
+ import type { GetAttrsChange } from '../getAttrsWithChangesRecorder';
5
5
  export type PrevAttributes = IndentationMarkAttributes | undefined;
6
6
  export type NewAttributes = IndentationMarkAttributes | undefined | false;
7
7
  export type IndentationChangesOptions = {
@@ -1,8 +1,20 @@
1
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
1
+ import type { NextEditorPlugin, OptionalPlugin, Command } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
- declare const indentationPlugin: NextEditorPlugin<'indentation', {
3
+ import type { IndentationInputMethod } from './commands/utils';
4
+ type IndentationPluginSharedState = {
5
+ isIndentationAllowed: boolean;
6
+ indentDisabled: boolean;
7
+ outdentDisabled: boolean;
8
+ };
9
+ export type IndentationPlugin = NextEditorPlugin<'indentation', {
4
10
  dependencies: [
5
11
  OptionalPlugin<AnalyticsPlugin>
6
12
  ];
13
+ actions: {
14
+ indentParagraphOrHeading: (inputMethod: IndentationInputMethod) => Command;
15
+ outdentParagraphOrHeading: (inputMethod: IndentationInputMethod) => Command;
16
+ };
17
+ sharedState: IndentationPluginSharedState | undefined;
7
18
  }>;
19
+ declare const indentationPlugin: IndentationPlugin;
8
20
  export default indentationPlugin;
@@ -28,6 +28,9 @@ export interface TaskDecisionPluginOptions extends LongPressSelectionPluginOptio
28
28
  }
29
29
  export type TaskAndDecisionsSharedState = {
30
30
  focusedTaskItemLocalId: string | null;
31
+ indentDisabled: boolean;
32
+ outdentDisabled: boolean;
33
+ isInsideTask: boolean;
31
34
  };
32
35
  export type TaskAndDecisionsPlugin = NextEditorPlugin<'taskDecision', {
33
36
  pluginConfiguration: TaskDecisionPluginOptions | undefined;
@@ -1,19 +1,35 @@
1
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
1
+ /// <reference types="react" />
2
+ import type { FeatureFlags, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
3
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
3
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
5
  import type { ListPlugin } from '@atlaskit/editor-plugin-list';
5
6
  import type { IndentationButtons } from './pm-plugins/indentation-buttons';
7
+ import type { ToolbarUiComponentFactoryParams } from '../../types';
8
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
9
+ import type { IndentationPlugin } from '../indentation';
10
+ import type { TaskAndDecisionsPlugin } from '../tasks-and-decisions/types';
6
11
  type Config = {
7
12
  showIndentationButtons: boolean;
8
13
  allowHeadingAndParagraphIndentation: boolean;
9
14
  };
10
- declare const toolbarListsIndentationPlugin: NextEditorPlugin<'toolbarListsIndentation', {
15
+ type ToolbarListsIndentationPlugin = NextEditorPlugin<'toolbarListsIndentation', {
11
16
  pluginConfiguration: Config;
12
17
  dependencies: [
13
18
  FeatureFlagsPlugin,
14
19
  ListPlugin,
20
+ OptionalPlugin<IndentationPlugin>,
21
+ OptionalPlugin<TaskAndDecisionsPlugin>,
15
22
  OptionalPlugin<AnalyticsPlugin>
16
23
  ];
17
24
  sharedState: IndentationButtons | undefined;
18
25
  }>;
26
+ declare const toolbarListsIndentationPlugin: ToolbarListsIndentationPlugin;
27
+ type PrimaryToolbarComponentProps = Pick<ToolbarUiComponentFactoryParams, 'editorView' | 'popupsMountPoint' | 'popupsBoundariesElement' | 'popupsScrollableElement' | 'disabled' | 'isToolbarReducedSpacing'> & {
28
+ featureFlags: FeatureFlags;
29
+ isSmall: boolean;
30
+ showIndentationButtons?: boolean;
31
+ pluginInjectionApi: ExtractInjectionAPI<typeof toolbarListsIndentationPlugin> | undefined;
32
+ allowHeadingAndParagraphIndentation: boolean;
33
+ };
34
+ export declare function PrimaryToolbarComponent({ featureFlags, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, isSmall, isToolbarReducedSpacing, disabled, editorView, showIndentationButtons, pluginInjectionApi, allowHeadingAndParagraphIndentation, }: PrimaryToolbarComponentProps): JSX.Element | null;
19
35
  export default toolbarListsIndentationPlugin;
@@ -1,17 +1,21 @@
1
+ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
1
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { Dispatch } from '../../../event-dispatcher';
4
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
- import type toolbarListsIndentationPlugin from '../index';
3
+ export type IndentationButtonNode = null | 'paragraph_heading' | 'list' | 'taskList';
6
4
  export interface IndentationButtons {
7
5
  indentDisabled: boolean;
8
6
  outdentDisabled: boolean;
9
- node: null | 'paragraph_heading' | 'list' | 'taskList';
7
+ node: IndentationButtonNode;
10
8
  }
11
9
  export declare const pluginKey: PluginKey<IndentationButtons>;
12
- export declare const createPlugin: ({ dispatch, showIndentationButtons, allowHeadingAndParagraphIndentation, api, }: {
13
- dispatch: Dispatch;
14
- showIndentationButtons: boolean;
15
- allowHeadingAndParagraphIndentation: boolean;
16
- api: ExtractInjectionAPI<typeof toolbarListsIndentationPlugin> | undefined;
17
- }) => SafePlugin<IndentationButtons>;
10
+ interface TaskDecisionState {
11
+ isInsideTask: boolean;
12
+ indentDisabled: boolean;
13
+ outdentDisabled: boolean;
14
+ }
15
+ interface IndentationState {
16
+ isIndentationAllowed: boolean;
17
+ indentDisabled: boolean;
18
+ outdentDisabled: boolean;
19
+ }
20
+ export declare function getIndentationButtonsState(editorState: EditorState, allowHeadingAndParagraphIndentation: boolean, taskDecisionState: TaskDecisionState | undefined, indentationState: IndentationState | undefined, isInsideListItem: ((tr: Transaction) => boolean | undefined) | undefined): IndentationButtons;
21
+ export {};