@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 189.3.23
4
+
5
+ ### Patch Changes
6
+
7
+ - [#42651](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42651) [`92e9957a8bf`](https://bitbucket.org/atlassian/atlassian-frontend/commits/92e9957a8bf) - [ux] [ECA11Y-148] Added screen reader announcement for Find and Replace search results count
8
+ - [#43111](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43111) [`d71dda4f834`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d71dda4f834) - Decouple indentation plugin from editor-core.
9
+ - Updated dependencies
10
+
11
+ ## 189.3.22
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 189.3.20
4
18
 
5
19
  ### Patch Changes
@@ -272,10 +272,13 @@ var Find = /*#__PURE__*/function (_React$Component) {
272
272
  onBlur: this.props.onFindBlur,
273
273
  onCompositionStart: this.handleCompositionStart,
274
274
  onCompositionEnd: this.handleCompositionEnd
275
- }), findText && (0, _react2.jsx)("span", {
275
+ }), (0, _react2.jsx)("div", {
276
+ css: _styles.countWrapperStyles,
277
+ "aria-live": "polite"
278
+ }, findText && (0, _react2.jsx)("span", {
276
279
  "data-testid": "textfield-count",
277
280
  css: _styles.countStyles
278
- }, count.total === 0 ? this.noResultsFound : resultsCount), allowMatchCase && (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
281
+ }, count.total === 0 ? this.noResultsFound : resultsCount)), allowMatchCase && (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
279
282
  title: this.matchCase,
280
283
  icon: this.matchCaseIcon,
281
284
  onClick: this.handleMatchCaseClick,
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.wrapperStyles = exports.sectionWrapperStyles = exports.ruleStyles = exports.replaceSectionButtonStyles = exports.countStyles = void 0;
7
+ exports.wrapperStyles = exports.sectionWrapperStyles = exports.ruleStyles = exports.replaceSectionButtonStyles = exports.countWrapperStyles = exports.countStyles = void 0;
8
8
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
9
  var _react = require("@emotion/react");
10
10
  var _colors = require("@atlaskit/theme/colors");
@@ -12,13 +12,13 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
12
  var _templateObject;
13
13
  /** @jsx jsx */
14
14
  var replaceSectionButtonStyles = exports.replaceSectionButtonStyles = (0, _react.css)({
15
- marginLeft: '4px'
15
+ marginLeft: "var(--ds-space-050, 4px)"
16
16
  });
17
17
  var ruleStyles = exports.ruleStyles = (0, _react.css)({
18
18
  width: '100%',
19
19
  border: 'none',
20
20
  backgroundColor: "".concat("var(--ds-border, ".concat(_colors.N30A, ")")),
21
- margin: '4px 0px',
21
+ margin: "var(--ds-space-050, 4px)".concat(" 0px"),
22
22
  height: '1px',
23
23
  borderRadius: '1px'
24
24
  });
@@ -26,7 +26,7 @@ var wrapperStyles = exports.wrapperStyles = (0, _react.css)({
26
26
  display: 'flex',
27
27
  flexDirection: 'column',
28
28
  '> *:not(#replace-hr-element)': {
29
- margin: '0px 4px'
29
+ margin: "0px ".concat("var(--ds-space-050, 4px)")
30
30
  }
31
31
  });
32
32
  var sectionWrapperStyles = exports.sectionWrapperStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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"])));
@@ -36,6 +36,9 @@ var countStyles = exports.countStyles = (0, _react.css)({
36
36
  flex: '0 0 auto',
37
37
  justifyContent: 'center',
38
38
  alignItems: 'center',
39
- marginLeft: '4px',
40
- marginRight: '8px'
39
+ marginLeft: "var(--ds-space-050, 4px)",
40
+ marginRight: "var(--ds-space-100, 8px)"
41
+ });
42
+ var countWrapperStyles = exports.countWrapperStyles = (0, _react.css)({
43
+ alignItems: 'center'
41
44
  });
@@ -4,12 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.removeIndentation = exports.isIndentationAllowed = exports.getOutdentCommand = exports.getIndentCommand = exports.MAX_INDENTATION_LEVEL = void 0;
8
- var _commands = require("../../../commands");
7
+ exports.removeIndentation = exports.isIndentationAllowed = exports.getOutdentCommand = exports.getIndentCommand = void 0;
8
+ var _commands = require("@atlaskit/editor-common/commands");
9
9
  var _utils = require("./utils");
10
10
  var _analytics = require("@atlaskit/editor-common/analytics");
11
- var _getAttrsWithChangesRecorder = _interopRequireDefault(require("../../../utils/getAttrsWithChangesRecorder"));
12
- var MAX_INDENTATION_LEVEL = exports.MAX_INDENTATION_LEVEL = 6;
11
+ var _getAttrsWithChangesRecorder = _interopRequireDefault(require("../getAttrsWithChangesRecorder"));
12
+ var _indentation = require("@atlaskit/editor-common/indentation");
13
13
  var isIndentationAllowed = exports.isIndentationAllowed = function isIndentationAllowed(schema, node) {
14
14
  var _schema$nodes = schema.nodes,
15
15
  paragraph = _schema$nodes.paragraph,
@@ -79,7 +79,7 @@ var getIndentAttrs = function getIndentAttrs(oldAttr) {
79
79
  }
80
80
 
81
81
  var level = oldAttr.level;
82
- if (level >= MAX_INDENTATION_LEVEL) {
82
+ if (level >= _indentation.MAX_INDENTATION_LEVEL) {
83
83
  return undefined; // Max indentation level reached, do nothing.
84
84
  }
85
85
 
@@ -6,7 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _adfSchema = require("@atlaskit/adf-schema");
8
8
  var _keymap = require("./pm-plugins/keymap");
9
+ var _commands = require("./commands");
10
+ var _indentation = require("@atlaskit/editor-common/indentation");
9
11
  var indentationPlugin = function indentationPlugin(_ref) {
12
+ var _api$analytics, _api$analytics2;
10
13
  var api = _ref.api;
11
14
  return {
12
15
  name: 'indentation',
@@ -16,12 +19,33 @@ var indentationPlugin = function indentationPlugin(_ref) {
16
19
  mark: _adfSchema.indentation
17
20
  }];
18
21
  },
22
+ actions: {
23
+ indentParagraphOrHeading: (0, _commands.getIndentCommand)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions),
24
+ outdentParagraphOrHeading: (0, _commands.getOutdentCommand)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
25
+ },
26
+ getSharedState: function getSharedState(editorState) {
27
+ var _ref2;
28
+ if (!editorState) {
29
+ return undefined;
30
+ }
31
+ var selection = editorState.tr.selection,
32
+ indentation = editorState.schema.marks.indentation;
33
+ var node = selection.$from.node();
34
+ var indentationMark = node.marks.find(function (mark) {
35
+ return mark.type === indentation;
36
+ });
37
+ return {
38
+ isIndentationAllowed: (0, _commands.isIndentationAllowed)(editorState.schema, node),
39
+ indentDisabled: (_ref2 = (indentationMark === null || indentationMark === void 0 ? void 0 : indentationMark.attrs.level) >= _indentation.MAX_INDENTATION_LEVEL) !== null && _ref2 !== void 0 ? _ref2 : false,
40
+ outdentDisabled: !indentationMark
41
+ };
42
+ },
19
43
  pmPlugins: function pmPlugins() {
20
44
  return [{
21
45
  name: 'indentationKeymap',
22
46
  plugin: function plugin() {
23
- var _api$analytics;
24
- return (0, _keymap.keymapPlugin)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
47
+ var _api$analytics3;
48
+ return (0, _keymap.keymapPlugin)(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
25
49
  }
26
50
  }];
27
51
  }
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
  exports.keymapPlugin = keymapPlugin;
8
8
  var _keymap = require("@atlaskit/editor-prosemirror/keymap");
9
9
  var _keymaps = require("@atlaskit/editor-common/keymaps");
10
- var _utils = require("../../../utils");
10
+ var _utils = require("@atlaskit/editor-common/utils");
11
11
  var _commands = require("../commands");
12
12
  var _analytics = require("@atlaskit/editor-common/analytics");
13
13
  function keymapPlugin(editorAnalyticsAPI) {
@@ -18,6 +18,8 @@ var _keymaps = _interopRequireDefault(require("./pm-plugins/keymaps"));
18
18
  var _main = require("./pm-plugins/main");
19
19
  var _ToolbarDecision = _interopRequireDefault(require("./ui/ToolbarDecision"));
20
20
  var _ToolbarTask = _interopRequireDefault(require("./ui/ToolbarTask"));
21
+ var _helpers = require("./pm-plugins/helpers");
22
+ var _indentation = require("@atlaskit/editor-common/indentation");
21
23
  var _templateObject;
22
24
  /** @jsx jsx */
23
25
  var taskDecisionToolbarGroup = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n"])));
@@ -64,8 +66,13 @@ var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
64
66
  return undefined;
65
67
  }
66
68
  var pluginState = _pluginKey.stateKey.getState(editorState);
69
+ var indentLevel = (0, _helpers.getCurrentIndentLevel)(editorState.selection) || 0;
70
+ var itemIndex = (0, _helpers.getTaskItemIndex)(editorState);
67
71
  return {
68
- focusedTaskItemLocalId: (pluginState === null || pluginState === void 0 ? void 0 : pluginState.focusedTaskItemLocalId) || null
72
+ focusedTaskItemLocalId: (pluginState === null || pluginState === void 0 ? void 0 : pluginState.focusedTaskItemLocalId) || null,
73
+ isInsideTask: (0, _helpers.isInsideTask)(editorState),
74
+ indentDisabled: itemIndex === 0 || indentLevel >= _indentation.MAX_INDENTATION_LEVEL,
75
+ outdentDisabled: indentLevel <= 1
69
76
  };
70
77
  },
71
78
  pmPlugins: function pmPlugins() {
@@ -1,15 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
8
+ exports.PrimaryToolbarComponent = PrimaryToolbarComponent;
7
9
  exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
10
+ var _react = _interopRequireWildcard(require("react"));
9
11
  var _hooks = require("@atlaskit/editor-common/hooks");
10
12
  var _ui = _interopRequireDefault(require("./ui"));
11
13
  var _types = require("../../ui/Toolbar/types");
12
14
  var _indentationButtons = require("./pm-plugins/indentation-buttons");
15
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
17
  var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref) {
14
18
  var _api$featureFlags;
15
19
  var config = _ref.config,
@@ -28,28 +32,14 @@ var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref)
28
32
  }
29
33
  return _indentationButtons.pluginKey.getState(editorState);
30
34
  },
31
- pmPlugins: function pmPlugins() {
32
- return [{
33
- name: 'indentationButtons',
34
- plugin: function plugin(_ref3) {
35
- var dispatch = _ref3.dispatch;
36
- return (0, _indentationButtons.createPlugin)({
37
- dispatch: dispatch,
38
- showIndentationButtons: showIndentationButtons,
39
- allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation,
40
- api: api
41
- });
42
- }
43
- }];
44
- },
45
- primaryToolbarComponent: function primaryToolbarComponent(_ref4) {
46
- var editorView = _ref4.editorView,
47
- popupsMountPoint = _ref4.popupsMountPoint,
48
- popupsBoundariesElement = _ref4.popupsBoundariesElement,
49
- popupsScrollableElement = _ref4.popupsScrollableElement,
50
- toolbarSize = _ref4.toolbarSize,
51
- disabled = _ref4.disabled,
52
- isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing;
35
+ primaryToolbarComponent: function primaryToolbarComponent(_ref3) {
36
+ var editorView = _ref3.editorView,
37
+ popupsMountPoint = _ref3.popupsMountPoint,
38
+ popupsBoundariesElement = _ref3.popupsBoundariesElement,
39
+ popupsScrollableElement = _ref3.popupsScrollableElement,
40
+ toolbarSize = _ref3.toolbarSize,
41
+ disabled = _ref3.disabled,
42
+ isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing;
53
43
  var isSmall = toolbarSize < _types.ToolbarSize.L;
54
44
  return /*#__PURE__*/_react.default.createElement(PrimaryToolbarComponent, {
55
45
  featureFlags: featureFlags,
@@ -61,25 +51,31 @@ var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref)
61
51
  disabled: disabled,
62
52
  editorView: editorView,
63
53
  showIndentationButtons: showIndentationButtons,
64
- pluginInjectionApi: api
54
+ pluginInjectionApi: api,
55
+ allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation
65
56
  });
66
57
  }
67
58
  };
68
59
  };
69
- function PrimaryToolbarComponent(_ref5) {
70
- var featureFlags = _ref5.featureFlags,
71
- popupsMountPoint = _ref5.popupsMountPoint,
72
- popupsBoundariesElement = _ref5.popupsBoundariesElement,
73
- popupsScrollableElement = _ref5.popupsScrollableElement,
74
- isSmall = _ref5.isSmall,
75
- isToolbarReducedSpacing = _ref5.isToolbarReducedSpacing,
76
- disabled = _ref5.disabled,
77
- editorView = _ref5.editorView,
78
- showIndentationButtons = _ref5.showIndentationButtons,
79
- pluginInjectionApi = _ref5.pluginInjectionApi;
80
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['list', 'toolbarListsIndentation']),
60
+ function PrimaryToolbarComponent(_ref4) {
61
+ var featureFlags = _ref4.featureFlags,
62
+ popupsMountPoint = _ref4.popupsMountPoint,
63
+ popupsBoundariesElement = _ref4.popupsBoundariesElement,
64
+ popupsScrollableElement = _ref4.popupsScrollableElement,
65
+ isSmall = _ref4.isSmall,
66
+ isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing,
67
+ disabled = _ref4.disabled,
68
+ editorView = _ref4.editorView,
69
+ showIndentationButtons = _ref4.showIndentationButtons,
70
+ pluginInjectionApi = _ref4.pluginInjectionApi,
71
+ allowHeadingAndParagraphIndentation = _ref4.allowHeadingAndParagraphIndentation;
72
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['list', 'indentation', 'taskDecision']),
81
73
  listState = _useSharedPluginState.listState,
82
- toolbarListsIndentationState = _useSharedPluginState.toolbarListsIndentationState;
74
+ indentationState = _useSharedPluginState.indentationState,
75
+ taskDecisionState = _useSharedPluginState.taskDecisionState;
76
+ var toolbarListsIndentationState = (0, _react.useMemo)(function () {
77
+ return (0, _indentationButtons.getIndentationButtonsState)(editorView.state, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.actions.isInsideListItem);
78
+ }, [editorView.state, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.actions.isInsideListItem]);
83
79
  if (!listState) {
84
80
  return null;
85
81
  }
@@ -99,6 +95,7 @@ function PrimaryToolbarComponent(_ref5) {
99
95
  showIndentationButtons: !!showIndentationButtons,
100
96
  indentDisabled: toolbarListsIndentationState.indentDisabled,
101
97
  outdentDisabled: toolbarListsIndentationState.outdentDisabled,
98
+ indentationStateNode: toolbarListsIndentationState === null || toolbarListsIndentationState === void 0 ? void 0 : toolbarListsIndentationState.node,
102
99
  pluginInjectionApi: pluginInjectionApi
103
100
  });
104
101
  }
@@ -3,35 +3,33 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.pluginKey = exports.createPlugin = void 0;
6
+ exports.getIndentationButtonsState = getIndentationButtonsState;
7
+ exports.pluginKey = void 0;
7
8
  var _state = require("@atlaskit/editor-prosemirror/state");
8
9
  var _utils = require("@atlaskit/editor-prosemirror/utils");
9
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
10
- var _utils2 = require("@atlaskit/editor-common/utils");
11
- var _helpers = require("../../tasks-and-decisions/pm-plugins/helpers");
12
- var _commands = require("../../indentation/commands");
13
10
  var _lists = require("@atlaskit/editor-common/lists");
11
+ var _indentation = require("@atlaskit/editor-common/indentation");
14
12
  var pluginKey = exports.pluginKey = new _state.PluginKey('indentationButtonsPlugin');
15
- function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation, api) {
13
+ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, isInsideListItem) {
14
+ var _indentationState$isI;
16
15
  var state = {
17
16
  indentDisabled: true,
18
17
  outdentDisabled: true,
19
18
  node: null
20
19
  };
21
20
  var selection = editorState.selection;
22
- var node = selection.$from.node();
23
21
 
24
22
  // Handle bullet and numbered lists seperately as they do
25
23
  // not use the indentation mark.
26
24
  // Check for lists before paragraphs and headings in case
27
25
  // the selection is in a list nested in a layout column.
28
- if (api !== null && api !== void 0 && api.list.actions.isInsideListItem(editorState.tr)) {
26
+ if (isInsideListItem !== null && isInsideListItem !== void 0 && isInsideListItem(editorState.tr)) {
29
27
  var _getListItemAttribute = (0, _lists.getListItemAttributes)(selection.$head),
30
28
  indentLevel = _getListItemAttribute.indentLevel,
31
29
  itemIndex = _getListItemAttribute.itemIndex;
32
30
  return {
33
31
  // List indent levels are zero indexed so we need to subtract 1
34
- indentDisabled: itemIndex === 0 || indentLevel >= _commands.MAX_INDENTATION_LEVEL - 1,
32
+ indentDisabled: itemIndex === 0 || indentLevel >= _indentation.MAX_INDENTATION_LEVEL - 1,
35
33
  outdentDisabled: false,
36
34
  node: 'list'
37
35
  };
@@ -39,12 +37,10 @@ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndenta
39
37
 
40
38
  // Handle tasks seperately as they do not use the indentation mark
41
39
  // and have different behaviour for outdent compared to lists
42
- if ((0, _helpers.isInsideTask)(editorState)) {
43
- var _indentLevel = (0, _helpers.getCurrentIndentLevel)(selection) || 0;
44
- var _itemIndex = (0, _helpers.getTaskItemIndex)(editorState);
40
+ if (taskDecisionState !== null && taskDecisionState !== void 0 && taskDecisionState.isInsideTask) {
45
41
  return {
46
- indentDisabled: _itemIndex === 0 || _indentLevel >= _commands.MAX_INDENTATION_LEVEL,
47
- outdentDisabled: _indentLevel <= 1,
42
+ indentDisabled: taskDecisionState.indentDisabled,
43
+ outdentDisabled: taskDecisionState.outdentDisabled,
48
44
  node: 'taskList'
49
45
  };
50
46
  }
@@ -52,51 +48,12 @@ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndenta
52
48
  var isInLayoutNode = (0, _utils.hasParentNodeOfType)(editorState.schema.nodes.layoutColumn)(selection) &&
53
49
  // depth of non-nested paragraphs and headings in layouts will always be 3
54
50
  selection.$from.depth === 3;
55
- if (allowHeadingAndParagraphIndentation && (0, _commands.isIndentationAllowed)(editorState.schema, node) && (isTopLevelParagraphOrHeading || isInLayoutNode)) {
56
- var indentationMark = node.marks.find(function (mark) {
57
- return mark.type === editorState.schema.marks.indentation;
58
- });
59
- if (!indentationMark) {
60
- return {
61
- outdentDisabled: true,
62
- indentDisabled: false,
63
- node: 'paragraph_heading'
64
- };
65
- }
51
+ if (allowHeadingAndParagraphIndentation && ((_indentationState$isI = indentationState === null || indentationState === void 0 ? void 0 : indentationState.isIndentationAllowed) !== null && _indentationState$isI !== void 0 ? _indentationState$isI : false) && (isTopLevelParagraphOrHeading || isInLayoutNode) && indentationState) {
66
52
  return {
67
- indentDisabled: indentationMark.attrs.level >= _commands.MAX_INDENTATION_LEVEL,
68
- outdentDisabled: false,
53
+ indentDisabled: indentationState.indentDisabled,
54
+ outdentDisabled: indentationState.outdentDisabled,
69
55
  node: 'paragraph_heading'
70
56
  };
71
57
  }
72
58
  return state;
73
- }
74
- var createPlugin = exports.createPlugin = function createPlugin(_ref) {
75
- var dispatch = _ref.dispatch,
76
- showIndentationButtons = _ref.showIndentationButtons,
77
- allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation,
78
- api = _ref.api;
79
- return new _safePlugin.SafePlugin({
80
- state: {
81
- init: function init(_config, state) {
82
- var initialState = {
83
- indentDisabled: true,
84
- outdentDisabled: true,
85
- node: null
86
- };
87
- return showIndentationButtons ? getIndentationButtonsState(state, allowHeadingAndParagraphIndentation, api) : initialState;
88
- },
89
- apply: function apply(_tr, pluginState, _oldState, newState) {
90
- if (showIndentationButtons) {
91
- var state = getIndentationButtonsState(newState, allowHeadingAndParagraphIndentation, api);
92
- if (!(0, _utils2.shallowEqual)(pluginState, state)) {
93
- dispatch(pluginKey, state);
94
- return state;
95
- }
96
- }
97
- return pluginState;
98
- }
99
- },
100
- key: pluginKey
101
- });
102
- };
59
+ }
@@ -15,7 +15,6 @@ var _outdent = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/outde
15
15
  var _keymaps = require("../../../keymaps");
16
16
  var _ToolbarButton = _interopRequireWildcard(require("../../../ui/ToolbarButton"));
17
17
  var _messages = require("@atlaskit/editor-common/messages");
18
- var _messages2 = require("../../indentation/messages");
19
18
  var _styles = require("@atlaskit/editor-common/styles");
20
19
  var _keymaps2 = require("@atlaskit/editor-common/keymaps");
21
20
  var _react2 = require("react");
@@ -40,8 +39,8 @@ function Toolbar(props) {
40
39
  onItemActivated = props.onItemActivated;
41
40
  var labelUnorderedList = formatMessage(_messages.listMessages.unorderedList);
42
41
  var labelOrderedList = formatMessage(_messages.listMessages.orderedList);
43
- var indentMessage = formatMessage(_messages2.messages.indent);
44
- var outdentMessage = formatMessage(_messages2.messages.outdent);
42
+ var indentMessage = formatMessage(_messages.indentationMessages.indent);
43
+ var outdentMessage = formatMessage(_messages.indentationMessages.outdent);
45
44
  var isIndentButtonFocused = document.activeElement === indentButtonRef.current;
46
45
  var isOutdentButtonFocused = document.activeElement === outdentButtonRef.current;
47
46
  var handleOnItemActivated = function handleOnItemActivated(buttonName) {
@@ -17,7 +17,6 @@ var _ToolbarButton = _interopRequireDefault(require("../../../ui/ToolbarButton")
17
17
  var _styles = require("../../../ui/styles");
18
18
  var _styles2 = require("@atlaskit/editor-common/styles");
19
19
  var _messages = require("@atlaskit/editor-common/messages");
20
- var _messages2 = require("../../indentation/messages");
21
20
  /** @jsx jsx */
22
21
 
23
22
  function ToolbarDropdown(props) {
@@ -137,8 +136,8 @@ function useItems(props) {
137
136
  }, (0, _keymaps.tooltip)(_keymaps.toggleOrderedList))
138
137
  }];
139
138
  if (props.showIndentationButtons) {
140
- var labelIndent = formatMessage(_messages2.messages.indent);
141
- var labelOutdent = formatMessage(_messages2.messages.outdent);
139
+ var labelIndent = formatMessage(_messages.indentationMessages.indent);
140
+ var labelOutdent = formatMessage(_messages.indentationMessages.outdent);
142
141
  items.push({
143
142
  key: 'outdent',
144
143
  content: labelOutdent,
@@ -24,6 +24,7 @@ function ToolbarListsIndentation(props) {
24
24
  popupsScrollableElement = props.popupsScrollableElement,
25
25
  indentDisabled = props.indentDisabled,
26
26
  outdentDisabled = props.outdentDisabled,
27
+ indentationStateNode = props.indentationStateNode,
27
28
  featureFlags = props.featureFlags,
28
29
  pluginInjectionApi = props.pluginInjectionApi;
29
30
  if (isSmall) {
@@ -41,7 +42,7 @@ function ToolbarListsIndentation(props) {
41
42
  indentDisabled: indentDisabled,
42
43
  outdentDisabled: outdentDisabled,
43
44
  disabled: disabled,
44
- onItemActivated: (0, _onItemActivated.onItemActivated)(pluginInjectionApi),
45
+ onItemActivated: (0, _onItemActivated.onItemActivated)(pluginInjectionApi, indentationStateNode),
45
46
  featureFlags: featureFlags
46
47
  });
47
48
  }
@@ -56,7 +57,7 @@ function ToolbarListsIndentation(props) {
56
57
  indentDisabled: indentDisabled,
57
58
  outdentDisabled: outdentDisabled,
58
59
  disabled: disabled,
59
- onItemActivated: (0, _onItemActivated.onItemActivated)(pluginInjectionApi),
60
+ onItemActivated: (0, _onItemActivated.onItemActivated)(pluginInjectionApi, indentationStateNode),
60
61
  featureFlags: featureFlags
61
62
  });
62
63
  }
@@ -4,11 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.onItemActivated = void 0;
7
- var _commands = require("../../indentation/commands");
8
7
  var _keymaps = require("../../tasks-and-decisions/pm-plugins/keymaps");
9
8
  var _analytics = require("@atlaskit/editor-common/analytics");
10
- var _indentationButtons = require("../pm-plugins/indentation-buttons");
11
- var onItemActivated = exports.onItemActivated = function onItemActivated(pluginInjectionApi) {
9
+ var onItemActivated = exports.onItemActivated = function onItemActivated(pluginInjectionApi, indentationStateNode) {
12
10
  return function (_ref) {
13
11
  var buttonName = _ref.buttonName,
14
12
  editorView = _ref.editorView;
@@ -21,35 +19,33 @@ var onItemActivated = exports.onItemActivated = function onItemActivated(pluginI
21
19
  break;
22
20
  case 'indent':
23
21
  {
24
- var _indentationButtonsPl;
25
- var node = (_indentationButtonsPl = _indentationButtons.pluginKey.getState(editorView.state)) === null || _indentationButtonsPl === void 0 ? void 0 : _indentationButtonsPl.node;
22
+ var node = indentationStateNode;
26
23
  if (node === 'paragraph_heading') {
27
- var _pluginInjectionApi$a;
28
- (0, _commands.getIndentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
24
+ var _pluginInjectionApi$i;
25
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i = pluginInjectionApi.indentation) === null || _pluginInjectionApi$i === void 0 || _pluginInjectionApi$i.actions.indentParagraphOrHeading(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
29
26
  }
30
27
  if (node === 'list') {
31
28
  pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.indentList(_analytics.INPUT_METHOD.TOOLBAR));
32
29
  }
33
30
  if (node === 'taskList') {
34
- var _pluginInjectionApi$a2;
35
- (0, _keymaps.getIndentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
31
+ var _pluginInjectionApi$a;
32
+ (0, _keymaps.getIndentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
36
33
  }
37
34
  break;
38
35
  }
39
36
  case 'outdent':
40
37
  {
41
- var _indentationButtonsPl2;
42
- var _node = (_indentationButtonsPl2 = _indentationButtons.pluginKey.getState(editorView.state)) === null || _indentationButtonsPl2 === void 0 ? void 0 : _indentationButtonsPl2.node;
38
+ var _node = indentationStateNode;
43
39
  if (_node === 'paragraph_heading') {
44
- var _pluginInjectionApi$a3;
45
- (0, _commands.getOutdentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
40
+ var _pluginInjectionApi$i2;
41
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i2 = pluginInjectionApi.indentation) === null || _pluginInjectionApi$i2 === void 0 || _pluginInjectionApi$i2.actions.outdentParagraphOrHeading(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
46
42
  }
47
43
  if (_node === 'list') {
48
44
  pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.outdentList(_analytics.INPUT_METHOD.TOOLBAR));
49
45
  }
50
46
  if (_node === 'taskList') {
51
- var _pluginInjectionApi$a4;
52
- (0, _keymaps.getUnindentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
47
+ var _pluginInjectionApi$a2;
48
+ (0, _keymaps.getUnindentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
53
49
  }
54
50
  break;
55
51
  }
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "189.3.20";
8
+ var version = exports.version = "189.3.23";
@@ -9,7 +9,7 @@ import ChevronDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-down';
9
9
  import ChevronUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-up';
10
10
  import MatchCaseIcon from '@atlaskit/icon/glyph/emoji/keyboard';
11
11
  import Textfield from '@atlaskit/textfield';
12
- import { countStyles, sectionWrapperStyles } from './styles';
12
+ import { countStyles, countWrapperStyles, sectionWrapperStyles } from './styles';
13
13
  import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
14
14
  import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
15
15
  import rafSchd from 'raf-schd';
@@ -250,10 +250,13 @@ class Find extends React.Component {
250
250
  onBlur: this.props.onFindBlur,
251
251
  onCompositionStart: this.handleCompositionStart,
252
252
  onCompositionEnd: this.handleCompositionEnd
253
- }), findText && jsx("span", {
253
+ }), jsx("div", {
254
+ css: countWrapperStyles,
255
+ "aria-live": "polite"
256
+ }, findText && jsx("span", {
254
257
  "data-testid": "textfield-count",
255
258
  css: countStyles
256
- }, count.total === 0 ? this.noResultsFound : resultsCount), allowMatchCase && jsx(FindReplaceTooltipButton, {
259
+ }, count.total === 0 ? this.noResultsFound : resultsCount)), allowMatchCase && jsx(FindReplaceTooltipButton, {
257
260
  title: this.matchCase,
258
261
  icon: this.matchCaseIcon,
259
262
  onClick: this.handleMatchCaseClick,
@@ -3,13 +3,13 @@ import { css } from '@emotion/react';
3
3
  import { N60, N30A } from '@atlaskit/theme/colors';
4
4
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
5
5
  export const replaceSectionButtonStyles = css({
6
- marginLeft: '4px'
6
+ marginLeft: "var(--ds-space-050, 4px)"
7
7
  });
8
8
  export const ruleStyles = css({
9
9
  width: '100%',
10
10
  border: 'none',
11
11
  backgroundColor: `${`var(--ds-border, ${N30A})`}`,
12
- margin: '4px 0px',
12
+ margin: `${"var(--ds-space-050, 4px)"} 0px`,
13
13
  height: '1px',
14
14
  borderRadius: '1px'
15
15
  });
@@ -17,7 +17,7 @@ export const wrapperStyles = css({
17
17
  display: 'flex',
18
18
  flexDirection: 'column',
19
19
  '> *:not(#replace-hr-element)': {
20
- margin: '0px 4px'
20
+ margin: `0px ${"var(--ds-space-050, 4px)"}`
21
21
  }
22
22
  });
23
23
  export const sectionWrapperStyles = css`
@@ -40,6 +40,9 @@ export const countStyles = css({
40
40
  flex: '0 0 auto',
41
41
  justifyContent: 'center',
42
42
  alignItems: 'center',
43
- marginLeft: '4px',
44
- marginRight: '8px'
43
+ marginLeft: "var(--ds-space-050, 4px)",
44
+ marginRight: "var(--ds-space-100, 8px)"
45
+ });
46
+ export const countWrapperStyles = css({
47
+ alignItems: 'center'
45
48
  });
@@ -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 const MAX_INDENTATION_LEVEL = 6;
4
+ import getAttrsWithChangesRecorder from '../getAttrsWithChangesRecorder';
5
+ import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
6
6
  export const isIndentationAllowed = (schema, node) => {
7
7
  const {
8
8
  nodes: {