@atlaskit/editor-core 189.3.22 → 189.3.24

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 (74) 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/ui/ConfigPanel/ConfigPanel.js +3 -43
  15. package/dist/cjs/version-wrapper.js +1 -1
  16. package/dist/es2019/plugins/find-replace/ui/Find.js +6 -3
  17. package/dist/es2019/plugins/find-replace/ui/styles.js +8 -5
  18. package/dist/es2019/plugins/indentation/commands/index.js +3 -3
  19. package/dist/es2019/plugins/indentation/index.js +49 -17
  20. package/dist/es2019/plugins/indentation/pm-plugins/keymap.js +1 -1
  21. package/dist/es2019/plugins/tasks-and-decisions/index.js +8 -1
  22. package/dist/es2019/plugins/toolbar-lists-indentation/index.js +14 -20
  23. package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +11 -52
  24. package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +1 -2
  25. package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +1 -2
  26. package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +3 -2
  27. package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +11 -15
  28. package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +1 -42
  29. package/dist/es2019/version-wrapper.js +1 -1
  30. package/dist/esm/plugins/find-replace/ui/Find.js +6 -3
  31. package/dist/esm/plugins/find-replace/ui/styles.js +8 -5
  32. package/dist/esm/plugins/indentation/commands/index.js +3 -3
  33. package/dist/esm/plugins/indentation/index.js +26 -2
  34. package/dist/esm/plugins/indentation/pm-plugins/keymap.js +1 -1
  35. package/dist/esm/plugins/tasks-and-decisions/index.js +8 -1
  36. package/dist/esm/plugins/toolbar-lists-indentation/index.js +31 -38
  37. package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +11 -55
  38. package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +1 -2
  39. package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +1 -2
  40. package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +3 -2
  41. package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +11 -15
  42. package/dist/esm/ui/ConfigPanel/ConfigPanel.js +2 -42
  43. package/dist/esm/version-wrapper.js +1 -1
  44. package/dist/types/plugins/find-replace/ui/styles.d.ts +1 -0
  45. package/dist/types/plugins/indentation/commands/index.d.ts +1 -2
  46. package/dist/types/plugins/indentation/commands/utils.d.ts +1 -1
  47. package/dist/types/plugins/indentation/index.d.ts +14 -2
  48. package/dist/types/plugins/tasks-and-decisions/types.d.ts +3 -0
  49. package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +18 -2
  50. package/dist/types/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +15 -11
  51. package/dist/types/plugins/toolbar-lists-indentation/ui/index.d.ts +2 -0
  52. package/dist/types/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +2 -1
  53. package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +4 -3
  54. package/dist/types-ts4.5/plugins/find-replace/ui/styles.d.ts +1 -0
  55. package/dist/types-ts4.5/plugins/indentation/commands/index.d.ts +1 -2
  56. package/dist/types-ts4.5/plugins/indentation/commands/utils.d.ts +1 -1
  57. package/dist/types-ts4.5/plugins/indentation/index.d.ts +14 -2
  58. package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +3 -0
  59. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/index.d.ts +18 -2
  60. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +15 -11
  61. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/ui/index.d.ts +2 -0
  62. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +2 -1
  63. package/dist/types-ts4.5/ui/ConfigPanel/ConfigPanel.d.ts +4 -3
  64. package/package.json +2 -2
  65. package/dist/cjs/plugins/indentation/messages.js +0 -21
  66. package/dist/es2019/plugins/indentation/messages.js +0 -14
  67. package/dist/esm/plugins/indentation/messages.js +0 -14
  68. package/dist/types/plugins/indentation/messages.d.ts +0 -12
  69. package/dist/types-ts4.5/plugins/indentation/messages.d.ts +0 -12
  70. /package/dist/cjs/{utils → plugins/indentation}/getAttrsWithChangesRecorder.js +0 -0
  71. /package/dist/es2019/{utils → plugins/indentation}/getAttrsWithChangesRecorder.js +0 -0
  72. /package/dist/esm/{utils → plugins/indentation}/getAttrsWithChangesRecorder.js +0 -0
  73. /package/dist/types/{utils → plugins/indentation}/getAttrsWithChangesRecorder.d.ts +0 -0
  74. /package/dist/types-ts4.5/{utils → plugins/indentation}/getAttrsWithChangesRecorder.d.ts +0 -0
@@ -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() {
@@ -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,5 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
4
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -8,9 +7,6 @@ import _inherits from "@babel/runtime/helpers/inherits";
8
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
9
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
10
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
11
- var _excluded = ["page", "labels", "types", "name", "width"];
12
- 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; }
13
- 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) { _defineProperty(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; }
14
10
  import _regeneratorRuntime from "@babel/runtime/regenerator";
15
11
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
16
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
@@ -35,7 +31,6 @@ import WithPluginState from '../WithPluginState';
35
31
  import FormContent from './FormContent';
36
32
  import { messages } from './messages';
37
33
  import { FormErrorBoundary } from './FormErrorBoundary';
38
- var LOGGED_MACRO_KEYS = ['children', 'recently-updated', 'excerpt'];
39
34
  function ConfigForm(_ref) {
40
35
  var canSave = _ref.canSave,
41
36
  errorMessage = _ref.errorMessage,
@@ -333,50 +328,15 @@ var ConfigPanel = /*#__PURE__*/function (_React$Component) {
333
328
  var _this$props4 = this.props,
334
329
  createAnalyticsEvent = _this$props4.createAnalyticsEvent,
335
330
  extensionManifest = _this$props4.extensionManifest;
336
- var currentParameters = this.state.currentParameters;
337
-
338
- // PGXT-4393 We need to collect configuration analytics for the macros in LOGGED_MACRO_KEYS.
339
- // This function takes the parameters and filters out anything which might have UGC.
340
- var getMacroParameters = function getMacroParameters() {
341
- var page = currentParameters.page,
342
- labels = currentParameters.labels,
343
- types = currentParameters.types,
344
- name = currentParameters.name,
345
- width = currentParameters.width,
346
- safeParams = _objectWithoutProperties(currentParameters, _excluded);
347
- var ugcFreeParams = _objectSpread({}, safeParams);
348
- // Parse types field as an array of valid content types and include in the result
349
- if (types) {
350
- var contentTypes = ['page', 'blogpost', 'comment', 'attachment'];
351
- var parsedTypes = types.split(',').map(function (type) {
352
- return type.trim();
353
- }).filter(function (type) {
354
- return contentTypes.includes(type);
355
- });
356
- ugcFreeParams = _objectSpread({
357
- types: parsedTypes
358
- }, ugcFreeParams);
359
- }
360
- // Since width is a raw string input, parse then return
361
- if (width) {
362
- var parsedWidth = parseFloat(width);
363
- ugcFreeParams = _objectSpread({
364
- width: parsedWidth
365
- }, ugcFreeParams);
366
- }
367
- return ugcFreeParams;
368
- };
369
331
  fireAnalyticsEvent(createAnalyticsEvent)({
370
332
  payload: {
371
333
  action: ACTION.CLOSED,
372
334
  actionSubject: ACTION_SUBJECT.CONFIG_PANEL,
373
335
  eventType: EVENT_TYPE.UI,
374
- attributes: _objectSpread({
336
+ attributes: {
375
337
  extensionKey: extensionManifest === null || extensionManifest === void 0 ? void 0 : extensionManifest.key,
376
338
  extensionType: extensionManifest === null || extensionManifest === void 0 ? void 0 : extensionManifest.type
377
- }, extensionManifest !== null && extensionManifest !== void 0 && extensionManifest.key && LOGGED_MACRO_KEYS.includes(extensionManifest.key) ? {
378
- parameters: getMacroParameters()
379
- } : {})
339
+ }
380
340
  }
381
341
  });
382
342
  }
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "189.3.22";
2
+ export var version = "189.3.24";
@@ -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;