@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,23 +1,55 @@
1
1
  import { indentation } from '@atlaskit/adf-schema';
2
2
  import { keymapPlugin } from './pm-plugins/keymap';
3
+ import { getOutdentCommand, getIndentCommand, isIndentationAllowed } from './commands';
4
+ import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
3
5
  const indentationPlugin = ({
4
6
  api
5
- }) => ({
6
- name: 'indentation',
7
- marks() {
8
- return [{
9
- name: 'indentation',
10
- mark: indentation
11
- }];
12
- },
13
- pmPlugins() {
14
- return [{
15
- name: 'indentationKeymap',
16
- plugin: () => {
17
- var _api$analytics;
18
- return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
7
+ }) => {
8
+ var _api$analytics, _api$analytics2;
9
+ return {
10
+ name: 'indentation',
11
+ marks() {
12
+ return [{
13
+ name: 'indentation',
14
+ mark: indentation
15
+ }];
16
+ },
17
+ actions: {
18
+ indentParagraphOrHeading: getIndentCommand(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions),
19
+ outdentParagraphOrHeading: getOutdentCommand(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
20
+ },
21
+ getSharedState(editorState) {
22
+ var _ref;
23
+ if (!editorState) {
24
+ return undefined;
19
25
  }
20
- }];
21
- }
22
- });
26
+ const {
27
+ tr: {
28
+ selection
29
+ },
30
+ schema: {
31
+ marks: {
32
+ indentation
33
+ }
34
+ }
35
+ } = editorState;
36
+ const node = selection.$from.node();
37
+ const indentationMark = node.marks.find(mark => mark.type === indentation);
38
+ return {
39
+ isIndentationAllowed: isIndentationAllowed(editorState.schema, node),
40
+ indentDisabled: (_ref = (indentationMark === null || indentationMark === void 0 ? void 0 : indentationMark.attrs.level) >= MAX_INDENTATION_LEVEL) !== null && _ref !== void 0 ? _ref : false,
41
+ outdentDisabled: !indentationMark
42
+ };
43
+ },
44
+ pmPlugins() {
45
+ return [{
46
+ name: 'indentationKeymap',
47
+ plugin: () => {
48
+ var _api$analytics3;
49
+ return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
50
+ }
51
+ }];
52
+ }
53
+ };
54
+ };
23
55
  export default indentationPlugin;
@@ -1,6 +1,6 @@
1
1
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
2
2
  import { bindKeymapWithCommand, findShortcutByKeymap, outdent, indent, backspace } from '@atlaskit/editor-common/keymaps';
3
- import { isTextSelection } from '../../../utils';
3
+ import { isTextSelection } from '@atlaskit/editor-common/utils';
4
4
  import { getIndentCommand, getOutdentCommand } from '../commands';
5
5
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
6
6
  export function keymapPlugin(editorAnalyticsAPI) {
@@ -11,6 +11,8 @@ import keymap from './pm-plugins/keymaps';
11
11
  import { createPlugin } from './pm-plugins/main';
12
12
  import ToolbarDecision from './ui/ToolbarDecision';
13
13
  import ToolbarTask from './ui/ToolbarTask';
14
+ import { getCurrentIndentLevel, getTaskItemIndex, isInsideTask } from './pm-plugins/helpers';
15
+ import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
14
16
  const taskDecisionToolbarGroup = css`
15
17
  display: flex;
16
18
  `;
@@ -57,8 +59,13 @@ const tasksAndDecisionsPlugin = ({
57
59
  return undefined;
58
60
  }
59
61
  const pluginState = taskPluginKey.getState(editorState);
62
+ const indentLevel = getCurrentIndentLevel(editorState.selection) || 0;
63
+ const itemIndex = getTaskItemIndex(editorState);
60
64
  return {
61
- focusedTaskItemLocalId: (pluginState === null || pluginState === void 0 ? void 0 : pluginState.focusedTaskItemLocalId) || null
65
+ focusedTaskItemLocalId: (pluginState === null || pluginState === void 0 ? void 0 : pluginState.focusedTaskItemLocalId) || null,
66
+ isInsideTask: isInsideTask(editorState),
67
+ indentDisabled: itemIndex === 0 || indentLevel >= MAX_INDENTATION_LEVEL,
68
+ outdentDisabled: indentLevel <= 1
62
69
  };
63
70
  },
64
71
  pmPlugins() {
@@ -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
  const toolbarListsIndentationPlugin = ({
8
8
  config,
@@ -22,19 +22,6 @@ const toolbarListsIndentationPlugin = ({
22
22
  }
23
23
  return indentationButtonPluginKey.getState(editorState);
24
24
  },
25
- pmPlugins() {
26
- return [{
27
- name: 'indentationButtons',
28
- plugin: ({
29
- dispatch
30
- }) => indentationButtonsPlugin({
31
- dispatch,
32
- showIndentationButtons,
33
- allowHeadingAndParagraphIndentation,
34
- api
35
- })
36
- }];
37
- },
38
25
  primaryToolbarComponent({
39
26
  editorView,
40
27
  popupsMountPoint,
@@ -55,12 +42,13 @@ const toolbarListsIndentationPlugin = ({
55
42
  disabled: disabled,
56
43
  editorView: editorView,
57
44
  showIndentationButtons: showIndentationButtons,
58
- pluginInjectionApi: api
45
+ pluginInjectionApi: api,
46
+ allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation
59
47
  });
60
48
  }
61
49
  };
62
50
  };
63
- function PrimaryToolbarComponent({
51
+ export function PrimaryToolbarComponent({
64
52
  featureFlags,
65
53
  popupsMountPoint,
66
54
  popupsBoundariesElement,
@@ -70,12 +58,17 @@ function PrimaryToolbarComponent({
70
58
  disabled,
71
59
  editorView,
72
60
  showIndentationButtons,
73
- pluginInjectionApi
61
+ pluginInjectionApi,
62
+ allowHeadingAndParagraphIndentation
74
63
  }) {
75
64
  const {
76
65
  listState,
77
- toolbarListsIndentationState
78
- } = useSharedPluginState(pluginInjectionApi, ['list', 'toolbarListsIndentation']);
66
+ indentationState,
67
+ taskDecisionState
68
+ } = useSharedPluginState(pluginInjectionApi, ['list', 'indentation', 'taskDecision']);
69
+ const toolbarListsIndentationState = useMemo(() => {
70
+ return getIndentationButtonsState(editorView.state, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.actions.isInsideListItem);
71
+ }, [editorView.state, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.actions.isInsideListItem]);
79
72
  if (!listState) {
80
73
  return null;
81
74
  }
@@ -95,6 +88,7 @@ function PrimaryToolbarComponent({
95
88
  showIndentationButtons: !!showIndentationButtons,
96
89
  indentDisabled: toolbarListsIndentationState.indentDisabled,
97
90
  outdentDisabled: toolbarListsIndentationState.outdentDisabled,
91
+ indentationStateNode: toolbarListsIndentationState === null || toolbarListsIndentationState === void 0 ? void 0 : toolbarListsIndentationState.node,
98
92
  pluginInjectionApi: pluginInjectionApi
99
93
  });
100
94
  }
@@ -1,12 +1,10 @@
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 const 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
  const state = {
11
9
  indentDisabled: true,
12
10
  outdentDisabled: true,
@@ -15,13 +13,12 @@ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndenta
15
13
  const {
16
14
  selection
17
15
  } = editorState;
18
- const node = selection.$from.node();
19
16
 
20
17
  // Handle bullet and numbered lists seperately as they do
21
18
  // not use the indentation mark.
22
19
  // Check for lists before paragraphs and headings in case
23
20
  // the selection is in a list nested in a layout column.
24
- if (api !== null && api !== void 0 && api.list.actions.isInsideListItem(editorState.tr)) {
21
+ if (isInsideListItem !== null && isInsideListItem !== void 0 && isInsideListItem(editorState.tr)) {
25
22
  const {
26
23
  indentLevel,
27
24
  itemIndex
@@ -36,12 +33,10 @@ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndenta
36
33
 
37
34
  // Handle tasks seperately as they do not use the indentation mark
38
35
  // and have different behaviour for outdent compared to lists
39
- if (isInsideTask(editorState)) {
40
- const indentLevel = getTaskListIndentLevel(selection) || 0;
41
- const itemIndex = getTaskItemIndex(editorState);
36
+ if (taskDecisionState !== null && taskDecisionState !== void 0 && taskDecisionState.isInsideTask) {
42
37
  return {
43
- indentDisabled: itemIndex === 0 || indentLevel >= MAX_INDENTATION_LEVEL,
44
- outdentDisabled: indentLevel <= 1,
38
+ indentDisabled: taskDecisionState.indentDisabled,
39
+ outdentDisabled: taskDecisionState.outdentDisabled,
45
40
  node: 'taskList'
46
41
  };
47
42
  }
@@ -49,48 +44,12 @@ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndenta
49
44
  const isInLayoutNode = hasParentNodeOfType(editorState.schema.nodes.layoutColumn)(selection) &&
50
45
  // depth of non-nested paragraphs and headings in layouts will always be 3
51
46
  selection.$from.depth === 3;
52
- if (allowHeadingAndParagraphIndentation && isIndentationAllowed(editorState.schema, node) && (isTopLevelParagraphOrHeading || isInLayoutNode)) {
53
- const indentationMark = node.marks.find(mark => mark.type === editorState.schema.marks.indentation);
54
- if (!indentationMark) {
55
- return {
56
- outdentDisabled: true,
57
- indentDisabled: false,
58
- node: 'paragraph_heading'
59
- };
60
- }
47
+ if (allowHeadingAndParagraphIndentation && ((_indentationState$isI = indentationState === null || indentationState === void 0 ? void 0 : indentationState.isIndentationAllowed) !== null && _indentationState$isI !== void 0 ? _indentationState$isI : false) && (isTopLevelParagraphOrHeading || isInLayoutNode) && indentationState) {
61
48
  return {
62
- indentDisabled: indentationMark.attrs.level >= MAX_INDENTATION_LEVEL,
63
- outdentDisabled: false,
49
+ indentDisabled: indentationState.indentDisabled,
50
+ outdentDisabled: indentationState.outdentDisabled,
64
51
  node: 'paragraph_heading'
65
52
  };
66
53
  }
67
54
  return state;
68
- }
69
- export const createPlugin = ({
70
- dispatch,
71
- showIndentationButtons,
72
- allowHeadingAndParagraphIndentation,
73
- api
74
- }) => new SafePlugin({
75
- state: {
76
- init(_config, state) {
77
- const initialState = {
78
- indentDisabled: true,
79
- outdentDisabled: true,
80
- node: null
81
- };
82
- return showIndentationButtons ? getIndentationButtonsState(state, allowHeadingAndParagraphIndentation, api) : initialState;
83
- },
84
- apply(_tr, pluginState, _oldState, newState) {
85
- if (showIndentationButtons) {
86
- const state = getIndentationButtonsState(newState, allowHeadingAndParagraphIndentation, api);
87
- if (!shallowEqual(pluginState, state)) {
88
- dispatch(pluginKey, state);
89
- return state;
90
- }
91
- }
92
- return pluginState;
93
- }
94
- },
95
- key: pluginKey
96
- });
55
+ }
@@ -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';
@@ -10,8 +10,7 @@ import ToolbarButton from '../../../ui/ToolbarButton';
10
10
  import { shortcutStyle } from '../../../ui/styles';
11
11
  import { expandIconWrapperStyle } from '@atlaskit/editor-common/styles';
12
12
  import { wrapperStyle, separatorStyles } from '@atlaskit/editor-common/styles';
13
- import { listMessages } from '@atlaskit/editor-common/messages';
14
- import { messages as indentationMessages } from '../../indentation/messages';
13
+ import { listMessages, indentationMessages } from '@atlaskit/editor-common/messages';
15
14
  export function ToolbarDropdown(props) {
16
15
  const {
17
16
  formatMessage
@@ -18,6 +18,7 @@ export default function ToolbarListsIndentation(props) {
18
18
  popupsScrollableElement,
19
19
  indentDisabled,
20
20
  outdentDisabled,
21
+ indentationStateNode,
21
22
  featureFlags,
22
23
  pluginInjectionApi
23
24
  } = props;
@@ -36,7 +37,7 @@ export default function ToolbarListsIndentation(props) {
36
37
  indentDisabled: indentDisabled,
37
38
  outdentDisabled: outdentDisabled,
38
39
  disabled: disabled,
39
- onItemActivated: onItemActivated(pluginInjectionApi),
40
+ onItemActivated: onItemActivated(pluginInjectionApi, indentationStateNode),
40
41
  featureFlags: featureFlags
41
42
  });
42
43
  }
@@ -51,7 +52,7 @@ export default function ToolbarListsIndentation(props) {
51
52
  indentDisabled: indentDisabled,
52
53
  outdentDisabled: outdentDisabled,
53
54
  disabled: disabled,
54
- onItemActivated: onItemActivated(pluginInjectionApi),
55
+ onItemActivated: onItemActivated(pluginInjectionApi, indentationStateNode),
55
56
  featureFlags: featureFlags
56
57
  });
57
58
  }
@@ -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 const onItemActivated = pluginInjectionApi => ({
3
+ export const onItemActivated = (pluginInjectionApi, indentationStateNode) => ({
6
4
  buttonName,
7
5
  editorView
8
6
  }) => {
@@ -15,35 +13,33 @@ export const onItemActivated = pluginInjectionApi => ({
15
13
  break;
16
14
  case 'indent':
17
15
  {
18
- var _indentationButtonsPl;
19
- const node = (_indentationButtonsPl = indentationButtonsPluginKey.getState(editorView.state)) === null || _indentationButtonsPl === void 0 ? void 0 : _indentationButtonsPl.node;
16
+ const node = indentationStateNode;
20
17
  if (node === 'paragraph_heading') {
21
- var _pluginInjectionApi$a;
22
- indentParagraphOrHeading(pluginInjectionApi === null || pluginInjectionApi === void 0 ? 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 ? void 0 : (_pluginInjectionApi$i = pluginInjectionApi.indentation) === null || _pluginInjectionApi$i === void 0 ? 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 ? 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 ? 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 ? 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
- const node = (_indentationButtonsPl2 = indentationButtonsPluginKey.getState(editorView.state)) === null || _indentationButtonsPl2 === void 0 ? void 0 : _indentationButtonsPl2.node;
32
+ const node = indentationStateNode;
37
33
  if (node === 'paragraph_heading') {
38
- var _pluginInjectionApi$a3;
39
- outdentParagraphOrHeading(pluginInjectionApi === null || pluginInjectionApi === void 0 ? 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 ? void 0 : (_pluginInjectionApi$i2 = pluginInjectionApi.indentation) === null || _pluginInjectionApi$i2 === void 0 ? 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 ? 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 ? 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 ? 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 const name = "@atlaskit/editor-core";
2
- export const version = "189.3.20";
2
+ export const version = "189.3.23";
@@ -17,7 +17,7 @@ import ChevronDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-down';
17
17
  import ChevronUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-up';
18
18
  import MatchCaseIcon from '@atlaskit/icon/glyph/emoji/keyboard';
19
19
  import Textfield from '@atlaskit/textfield';
20
- import { countStyles, sectionWrapperStyles } from './styles';
20
+ import { countStyles, countWrapperStyles, sectionWrapperStyles } from './styles';
21
21
  import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
22
22
  import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
23
23
  import rafSchd from 'raf-schd';
@@ -266,10 +266,13 @@ var Find = /*#__PURE__*/function (_React$Component) {
266
266
  onBlur: this.props.onFindBlur,
267
267
  onCompositionStart: this.handleCompositionStart,
268
268
  onCompositionEnd: this.handleCompositionEnd
269
- }), findText && jsx("span", {
269
+ }), jsx("div", {
270
+ css: countWrapperStyles,
271
+ "aria-live": "polite"
272
+ }, findText && jsx("span", {
270
273
  "data-testid": "textfield-count",
271
274
  css: countStyles
272
- }, count.total === 0 ? this.noResultsFound : resultsCount), allowMatchCase && jsx(FindReplaceTooltipButton, {
275
+ }, count.total === 0 ? this.noResultsFound : resultsCount)), allowMatchCase && jsx(FindReplaceTooltipButton, {
273
276
  title: this.matchCase,
274
277
  icon: this.matchCaseIcon,
275
278
  onClick: this.handleMatchCaseClick,
@@ -5,13 +5,13 @@ import { css } from '@emotion/react';
5
5
  import { N60, N30A } from '@atlaskit/theme/colors';
6
6
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
7
7
  export var replaceSectionButtonStyles = css({
8
- marginLeft: '4px'
8
+ marginLeft: "var(--ds-space-050, 4px)"
9
9
  });
10
10
  export var ruleStyles = css({
11
11
  width: '100%',
12
12
  border: 'none',
13
13
  backgroundColor: "".concat("var(--ds-border, ".concat(N30A, ")")),
14
- margin: '4px 0px',
14
+ margin: "var(--ds-space-050, 4px)".concat(" 0px"),
15
15
  height: '1px',
16
16
  borderRadius: '1px'
17
17
  });
@@ -19,7 +19,7 @@ export var wrapperStyles = css({
19
19
  display: 'flex',
20
20
  flexDirection: 'column',
21
21
  '> *:not(#replace-hr-element)': {
22
- margin: '0px 4px'
22
+ margin: "0px ".concat("var(--ds-space-050, 4px)")
23
23
  }
24
24
  });
25
25
  export var sectionWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n\n & > * {\n display: inline-flex;\n height: 32px;\n flex: 0 0 auto;\n }\n\n & > [data-ds--text-field--container] {\n display: flex;\n flex: 1 1 auto;\n }\n"])));
@@ -29,6 +29,9 @@ export var countStyles = css({
29
29
  flex: '0 0 auto',
30
30
  justifyContent: 'center',
31
31
  alignItems: 'center',
32
- marginLeft: '4px',
33
- marginRight: '8px'
32
+ marginLeft: "var(--ds-space-050, 4px)",
33
+ marginRight: "var(--ds-space-100, 8px)"
34
+ });
35
+ export var countWrapperStyles = css({
36
+ alignItems: 'center'
34
37
  });
@@ -1,8 +1,8 @@
1
- import { toggleBlockMark } from '../../../commands';
1
+ import { toggleBlockMark } from '@atlaskit/editor-common/commands';
2
2
  import { createAnalyticsDispatch } from './utils';
3
3
  import { INDENT_DIRECTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import getAttrsWithChangesRecorder from '../../../utils/getAttrsWithChangesRecorder';
5
- export var MAX_INDENTATION_LEVEL = 6;
4
+ import getAttrsWithChangesRecorder from '../getAttrsWithChangesRecorder';
5
+ import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
6
6
  export var isIndentationAllowed = function isIndentationAllowed(schema, node) {
7
7
  var _schema$nodes = schema.nodes,
8
8
  paragraph = _schema$nodes.paragraph,
@@ -1,6 +1,9 @@
1
1
  import { indentation } from '@atlaskit/adf-schema';
2
2
  import { keymapPlugin } from './pm-plugins/keymap';
3
+ import { getOutdentCommand, getIndentCommand, isIndentationAllowed } from './commands';
4
+ import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
3
5
  var indentationPlugin = function indentationPlugin(_ref) {
6
+ var _api$analytics, _api$analytics2;
4
7
  var api = _ref.api;
5
8
  return {
6
9
  name: 'indentation',
@@ -10,12 +13,33 @@ var indentationPlugin = function indentationPlugin(_ref) {
10
13
  mark: indentation
11
14
  }];
12
15
  },
16
+ actions: {
17
+ indentParagraphOrHeading: getIndentCommand(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions),
18
+ outdentParagraphOrHeading: getOutdentCommand(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
19
+ },
20
+ getSharedState: function getSharedState(editorState) {
21
+ var _ref2;
22
+ if (!editorState) {
23
+ return undefined;
24
+ }
25
+ var selection = editorState.tr.selection,
26
+ indentation = editorState.schema.marks.indentation;
27
+ var node = selection.$from.node();
28
+ var indentationMark = node.marks.find(function (mark) {
29
+ return mark.type === indentation;
30
+ });
31
+ return {
32
+ isIndentationAllowed: isIndentationAllowed(editorState.schema, node),
33
+ indentDisabled: (_ref2 = (indentationMark === null || indentationMark === void 0 ? void 0 : indentationMark.attrs.level) >= MAX_INDENTATION_LEVEL) !== null && _ref2 !== void 0 ? _ref2 : false,
34
+ outdentDisabled: !indentationMark
35
+ };
36
+ },
13
37
  pmPlugins: function pmPlugins() {
14
38
  return [{
15
39
  name: 'indentationKeymap',
16
40
  plugin: function plugin() {
17
- var _api$analytics;
18
- return keymapPlugin(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
41
+ var _api$analytics3;
42
+ return keymapPlugin(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
19
43
  }
20
44
  }];
21
45
  }
@@ -1,6 +1,6 @@
1
1
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
2
2
  import { bindKeymapWithCommand, findShortcutByKeymap, outdent, indent, backspace } from '@atlaskit/editor-common/keymaps';
3
- import { isTextSelection } from '../../../utils';
3
+ import { isTextSelection } from '@atlaskit/editor-common/utils';
4
4
  import { getIndentCommand, getOutdentCommand } from '../commands';
5
5
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
6
6
  export function keymapPlugin(editorAnalyticsAPI) {
@@ -13,6 +13,8 @@ import keymap from './pm-plugins/keymaps';
13
13
  import { createPlugin } from './pm-plugins/main';
14
14
  import ToolbarDecision from './ui/ToolbarDecision';
15
15
  import ToolbarTask from './ui/ToolbarTask';
16
+ import { getCurrentIndentLevel, getTaskItemIndex, isInsideTask } from './pm-plugins/helpers';
17
+ import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
16
18
  var taskDecisionToolbarGroup = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n"])));
17
19
  var addItem = function addItem(insert, listType, schema) {
18
20
  return function (_ref) {
@@ -57,8 +59,13 @@ var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
57
59
  return undefined;
58
60
  }
59
61
  var pluginState = taskPluginKey.getState(editorState);
62
+ var indentLevel = getCurrentIndentLevel(editorState.selection) || 0;
63
+ var itemIndex = getTaskItemIndex(editorState);
60
64
  return {
61
- focusedTaskItemLocalId: (pluginState === null || pluginState === void 0 ? void 0 : pluginState.focusedTaskItemLocalId) || null
65
+ focusedTaskItemLocalId: (pluginState === null || pluginState === void 0 ? void 0 : pluginState.focusedTaskItemLocalId) || null,
66
+ isInsideTask: isInsideTask(editorState),
67
+ indentDisabled: itemIndex === 0 || indentLevel >= MAX_INDENTATION_LEVEL,
68
+ outdentDisabled: indentLevel <= 1
62
69
  };
63
70
  },
64
71
  pmPlugins: function pmPlugins() {