@atlaskit/editor-core 189.3.24 → 189.3.25

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 (48) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/plugins/index.js +0 -7
  3. package/dist/cjs/plugins/toolbar-lists-indentation/index.js +2 -13
  4. package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +0 -3
  5. package/dist/cjs/presets/universal.js +2 -1
  6. package/dist/cjs/version-wrapper.js +1 -1
  7. package/dist/es2019/plugins/index.js +0 -1
  8. package/dist/es2019/plugins/toolbar-lists-indentation/index.js +2 -11
  9. package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +0 -2
  10. package/dist/es2019/presets/universal.js +2 -1
  11. package/dist/es2019/version-wrapper.js +1 -1
  12. package/dist/esm/plugins/index.js +0 -1
  13. package/dist/esm/plugins/toolbar-lists-indentation/index.js +2 -11
  14. package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +0 -2
  15. package/dist/esm/presets/universal.js +2 -1
  16. package/dist/esm/version-wrapper.js +1 -1
  17. package/dist/types/plugins/index.d.ts +0 -1
  18. package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +1 -3
  19. package/dist/types/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +0 -2
  20. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  21. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/index.d.ts +1 -3
  22. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +0 -2
  23. package/package.json +2 -1
  24. package/dist/cjs/plugins/indentation/commands/index.js +0 -140
  25. package/dist/cjs/plugins/indentation/commands/utils.js +0 -92
  26. package/dist/cjs/plugins/indentation/getAttrsWithChangesRecorder.js +0 -38
  27. package/dist/cjs/plugins/indentation/index.js +0 -54
  28. package/dist/cjs/plugins/indentation/pm-plugins/keymap.js +0 -26
  29. package/dist/es2019/plugins/indentation/commands/index.js +0 -130
  30. package/dist/es2019/plugins/indentation/commands/utils.js +0 -89
  31. package/dist/es2019/plugins/indentation/getAttrsWithChangesRecorder.js +0 -32
  32. package/dist/es2019/plugins/indentation/index.js +0 -55
  33. package/dist/es2019/plugins/indentation/pm-plugins/keymap.js +0 -21
  34. package/dist/esm/plugins/indentation/commands/index.js +0 -133
  35. package/dist/esm/plugins/indentation/commands/utils.js +0 -85
  36. package/dist/esm/plugins/indentation/getAttrsWithChangesRecorder.js +0 -32
  37. package/dist/esm/plugins/indentation/index.js +0 -48
  38. package/dist/esm/plugins/indentation/pm-plugins/keymap.js +0 -19
  39. package/dist/types/plugins/indentation/commands/index.d.ts +0 -8
  40. package/dist/types/plugins/indentation/commands/utils.d.ts +0 -37
  41. package/dist/types/plugins/indentation/getAttrsWithChangesRecorder.d.ts +0 -23
  42. package/dist/types/plugins/indentation/index.d.ts +0 -18
  43. package/dist/types/plugins/indentation/pm-plugins/keymap.d.ts +0 -4
  44. package/dist/types-ts4.5/plugins/indentation/commands/index.d.ts +0 -8
  45. package/dist/types-ts4.5/plugins/indentation/commands/utils.d.ts +0 -37
  46. package/dist/types-ts4.5/plugins/indentation/getAttrsWithChangesRecorder.d.ts +0 -23
  47. package/dist/types-ts4.5/plugins/indentation/index.d.ts +0 -20
  48. package/dist/types-ts4.5/plugins/indentation/pm-plugins/keymap.d.ts +0 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 189.3.25
4
+
5
+ ### Patch Changes
6
+
7
+ - [#43274](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43274) [`d162c359ccf`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d162c359ccf) - Move indentation plugin code from editor-core to editor-plugin-indentation.
8
+ - Updated dependencies
9
+
3
10
  ## 189.3.24
4
11
 
5
12
  ### Patch Changes
@@ -82,12 +82,6 @@ Object.defineProperty(exports, "findReplacePlugin", {
82
82
  return _findReplace.default;
83
83
  }
84
84
  });
85
- Object.defineProperty(exports, "indentationPlugin", {
86
- enumerable: true,
87
- get: function get() {
88
- return _indentation.default;
89
- }
90
- });
91
85
  Object.defineProperty(exports, "insertBlockPlugin", {
92
86
  enumerable: true,
93
87
  get: function get() {
@@ -153,7 +147,6 @@ var _tasksAndDecisions = _interopRequireDefault(require("./tasks-and-decisions")
153
147
  var _breakout = _interopRequireDefault(require("./breakout"));
154
148
  var _alignment = _interopRequireDefault(require("./alignment"));
155
149
  var _dataConsumer = _interopRequireDefault(require("./data-consumer"));
156
- var _indentation = _interopRequireDefault(require("./indentation"));
157
150
  var _annotation = _interopRequireDefault(require("./annotation"));
158
151
  var _customAutoformat = _interopRequireDefault(require("./custom-autoformat"));
159
152
  var _feedbackDialog = _interopRequireDefault(require("./feedback-dialog"));
@@ -1,19 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.PrimaryToolbarComponent = PrimaryToolbarComponent;
9
8
  exports.default = void 0;
10
- var _react = _interopRequireWildcard(require("react"));
9
+ var _react = _interopRequireDefault(require("react"));
11
10
  var _hooks = require("@atlaskit/editor-common/hooks");
12
11
  var _ui = _interopRequireDefault(require("./ui"));
13
12
  var _types = require("../../ui/Toolbar/types");
14
13
  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; }
17
14
  var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref) {
18
15
  var _api$featureFlags;
19
16
  var config = _ref.config,
@@ -26,12 +23,6 @@ var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref)
26
23
  var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
27
24
  return {
28
25
  name: 'toolbarListsIndentation',
29
- getSharedState: function getSharedState(editorState) {
30
- if (!editorState) {
31
- return undefined;
32
- }
33
- return _indentationButtons.pluginKey.getState(editorState);
34
- },
35
26
  primaryToolbarComponent: function primaryToolbarComponent(_ref3) {
36
27
  var editorView = _ref3.editorView,
37
28
  popupsMountPoint = _ref3.popupsMountPoint,
@@ -73,9 +64,7 @@ function PrimaryToolbarComponent(_ref4) {
73
64
  listState = _useSharedPluginState.listState,
74
65
  indentationState = _useSharedPluginState.indentationState,
75
66
  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]);
67
+ var toolbarListsIndentationState = (0, _indentationButtons.getIndentationButtonsState)(editorView.state, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.actions.isInsideListItem);
79
68
  if (!listState) {
80
69
  return null;
81
70
  }
@@ -4,12 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getIndentationButtonsState = getIndentationButtonsState;
7
- exports.pluginKey = void 0;
8
- var _state = require("@atlaskit/editor-prosemirror/state");
9
7
  var _utils = require("@atlaskit/editor-prosemirror/utils");
10
8
  var _lists = require("@atlaskit/editor-common/lists");
11
9
  var _indentation = require("@atlaskit/editor-common/indentation");
12
- var pluginKey = exports.pluginKey = new _state.PluginKey('indentationButtonsPlugin');
13
10
  function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, isInsideListItem) {
14
11
  var _indentationState$isI;
15
12
  var state = {
@@ -12,6 +12,7 @@ var _plugins = require("../plugins");
12
12
  var _editorPluginPanel = require("@atlaskit/editor-plugin-panel");
13
13
  var _editorPluginTextColor = require("@atlaskit/editor-plugin-text-color");
14
14
  var _editorPluginHistory = require("@atlaskit/editor-plugin-history");
15
+ var _editorPluginIndentation = require("@atlaskit/editor-plugin-indentation");
15
16
  var _editorPluginStatus = require("@atlaskit/editor-plugin-status");
16
17
  var _editorPluginDate = require("@atlaskit/editor-plugin-date");
17
18
  var _editorPluginMaxContentSize = require("@atlaskit/editor-plugin-max-content-size");
@@ -329,7 +330,7 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
329
330
  }]);
330
331
  }
331
332
  return builder;
332
- }).maybeAdd(_plugins.indentationPlugin, function (plugin, builder) {
333
+ }).maybeAdd(_editorPluginIndentation.indentationPlugin, function (plugin, builder) {
333
334
  if (props.allowIndentation) {
334
335
  return builder.add(plugin);
335
336
  }
@@ -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.24";
8
+ var version = exports.version = "189.3.25";
@@ -9,7 +9,6 @@ export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
9
9
  export { default as breakoutPlugin } from './breakout';
10
10
  export { default as alignmentPlugin } from './alignment';
11
11
  export { default as dataConsumerMarkPlugin } from './data-consumer';
12
- export { default as indentationPlugin } from './indentation';
13
12
  export { default as annotationPlugin } from './annotation';
14
13
  export { default as customAutoformatPlugin } from './custom-autoformat';
15
14
  export { default as feedbackDialogPlugin } from './feedback-dialog';
@@ -1,9 +1,8 @@
1
- import React, { useMemo } from 'react';
1
+ import React 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
5
  import { getIndentationButtonsState } from './pm-plugins/indentation-buttons';
6
- import { pluginKey as indentationButtonPluginKey } from './pm-plugins/indentation-buttons';
7
6
  const toolbarListsIndentationPlugin = ({
8
7
  config,
9
8
  api
@@ -16,12 +15,6 @@ const toolbarListsIndentationPlugin = ({
16
15
  const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
17
16
  return {
18
17
  name: 'toolbarListsIndentation',
19
- getSharedState(editorState) {
20
- if (!editorState) {
21
- return undefined;
22
- }
23
- return indentationButtonPluginKey.getState(editorState);
24
- },
25
18
  primaryToolbarComponent({
26
19
  editorView,
27
20
  popupsMountPoint,
@@ -66,9 +59,7 @@ export function PrimaryToolbarComponent({
66
59
  indentationState,
67
60
  taskDecisionState
68
61
  } = 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]);
62
+ const toolbarListsIndentationState = getIndentationButtonsState(editorView.state, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.actions.isInsideListItem);
72
63
  if (!listState) {
73
64
  return null;
74
65
  }
@@ -1,8 +1,6 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
1
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
2
  import { getListItemAttributes } from '@atlaskit/editor-common/lists';
4
3
  import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
5
- export const pluginKey = new PluginKey('indentationButtonsPlugin');
6
4
  export function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, isInsideListItem) {
7
5
  var _indentationState$isI;
8
6
  const state = {
@@ -1,7 +1,8 @@
1
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, insertBlockPlugin, jiraIssuePlugin, toolbarListsIndentationPlugin, tasksAndDecisionsPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
1
+ import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, insertBlockPlugin, jiraIssuePlugin, toolbarListsIndentationPlugin, tasksAndDecisionsPlugin, alignmentPlugin, customAutoformatPlugin, feedbackDialogPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
2
2
  import { panelPlugin } from '@atlaskit/editor-plugin-panel';
3
3
  import { textColorPlugin } from '@atlaskit/editor-plugin-text-color';
4
4
  import { historyPlugin } from '@atlaskit/editor-plugin-history';
5
+ import { indentationPlugin } from '@atlaskit/editor-plugin-indentation';
5
6
  import { statusPlugin } from '@atlaskit/editor-plugin-status';
6
7
  import { datePlugin } from '@atlaskit/editor-plugin-date';
7
8
  import { maxContentSizePlugin } from '@atlaskit/editor-plugin-max-content-size';
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "189.3.24";
2
+ export const version = "189.3.25";
@@ -9,7 +9,6 @@ export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
9
9
  export { default as breakoutPlugin } from './breakout';
10
10
  export { default as alignmentPlugin } from './alignment';
11
11
  export { default as dataConsumerMarkPlugin } from './data-consumer';
12
- export { default as indentationPlugin } from './indentation';
13
12
  export { default as annotationPlugin } from './annotation';
14
13
  export { default as customAutoformatPlugin } from './custom-autoformat';
15
14
  export { default as feedbackDialogPlugin } from './feedback-dialog';
@@ -1,9 +1,8 @@
1
- import React, { useMemo } from 'react';
1
+ import React 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
5
  import { getIndentationButtonsState } from './pm-plugins/indentation-buttons';
6
- import { pluginKey as indentationButtonPluginKey } from './pm-plugins/indentation-buttons';
7
6
  var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref) {
8
7
  var _api$featureFlags;
9
8
  var config = _ref.config,
@@ -16,12 +15,6 @@ var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref)
16
15
  var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
17
16
  return {
18
17
  name: 'toolbarListsIndentation',
19
- getSharedState: function getSharedState(editorState) {
20
- if (!editorState) {
21
- return undefined;
22
- }
23
- return indentationButtonPluginKey.getState(editorState);
24
- },
25
18
  primaryToolbarComponent: function primaryToolbarComponent(_ref3) {
26
19
  var editorView = _ref3.editorView,
27
20
  popupsMountPoint = _ref3.popupsMountPoint,
@@ -63,9 +56,7 @@ export function PrimaryToolbarComponent(_ref4) {
63
56
  listState = _useSharedPluginState.listState,
64
57
  indentationState = _useSharedPluginState.indentationState,
65
58
  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]);
59
+ var toolbarListsIndentationState = getIndentationButtonsState(editorView.state, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.actions.isInsideListItem);
69
60
  if (!listState) {
70
61
  return null;
71
62
  }
@@ -1,8 +1,6 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
1
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
2
  import { getListItemAttributes } from '@atlaskit/editor-common/lists';
4
3
  import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
5
- export var pluginKey = new PluginKey('indentationButtonsPlugin');
6
4
  export function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, isInsideListItem) {
7
5
  var _indentationState$isI;
8
6
  var state = {
@@ -2,10 +2,11 @@ import _typeof from "@babel/runtime/helpers/typeof";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  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; }
4
4
  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; }
5
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, insertBlockPlugin, jiraIssuePlugin, toolbarListsIndentationPlugin, tasksAndDecisionsPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
5
+ import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, insertBlockPlugin, jiraIssuePlugin, toolbarListsIndentationPlugin, tasksAndDecisionsPlugin, alignmentPlugin, customAutoformatPlugin, feedbackDialogPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
6
6
  import { panelPlugin } from '@atlaskit/editor-plugin-panel';
7
7
  import { textColorPlugin } from '@atlaskit/editor-plugin-text-color';
8
8
  import { historyPlugin } from '@atlaskit/editor-plugin-history';
9
+ import { indentationPlugin } from '@atlaskit/editor-plugin-indentation';
9
10
  import { statusPlugin } from '@atlaskit/editor-plugin-status';
10
11
  import { datePlugin } from '@atlaskit/editor-plugin-date';
11
12
  import { maxContentSizePlugin } from '@atlaskit/editor-plugin-max-content-size';
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "189.3.24";
2
+ export var version = "189.3.25";
@@ -9,7 +9,6 @@ export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
9
9
  export { default as breakoutPlugin } from './breakout';
10
10
  export { default as alignmentPlugin } from './alignment';
11
11
  export { default as dataConsumerMarkPlugin } from './data-consumer';
12
- export { default as indentationPlugin } from './indentation';
13
12
  export { default as annotationPlugin } from './annotation';
14
13
  export { default as customAutoformatPlugin } from './custom-autoformat';
15
14
  export { default as feedbackDialogPlugin } from './feedback-dialog';
@@ -3,10 +3,9 @@ import type { FeatureFlags, NextEditorPlugin, OptionalPlugin } from '@atlaskit/e
3
3
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
4
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
5
  import type { ListPlugin } from '@atlaskit/editor-plugin-list';
6
- import type { IndentationButtons } from './pm-plugins/indentation-buttons';
7
6
  import type { ToolbarUiComponentFactoryParams } from '../../types';
8
7
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
9
- import type { IndentationPlugin } from '../indentation';
8
+ import type { IndentationPlugin } from '@atlaskit/editor-plugin-indentation';
10
9
  import type { TaskAndDecisionsPlugin } from '../tasks-and-decisions/types';
11
10
  type Config = {
12
11
  showIndentationButtons: boolean;
@@ -21,7 +20,6 @@ type ToolbarListsIndentationPlugin = NextEditorPlugin<'toolbarListsIndentation',
21
20
  OptionalPlugin<TaskAndDecisionsPlugin>,
22
21
  OptionalPlugin<AnalyticsPlugin>
23
22
  ];
24
- sharedState: IndentationButtons | undefined;
25
23
  }>;
26
24
  declare const toolbarListsIndentationPlugin: ToolbarListsIndentationPlugin;
27
25
  type PrimaryToolbarComponentProps = Pick<ToolbarUiComponentFactoryParams, 'editorView' | 'popupsMountPoint' | 'popupsBoundariesElement' | 'popupsScrollableElement' | 'disabled' | 'isToolbarReducedSpacing'> & {
@@ -1,12 +1,10 @@
1
1
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
2
  export type IndentationButtonNode = null | 'paragraph_heading' | 'list' | 'taskList';
4
3
  export interface IndentationButtons {
5
4
  indentDisabled: boolean;
6
5
  outdentDisabled: boolean;
7
6
  node: IndentationButtonNode;
8
7
  }
9
- export declare const pluginKey: PluginKey<IndentationButtons>;
10
8
  interface TaskDecisionState {
11
9
  isInsideTask: boolean;
12
10
  indentDisabled: boolean;
@@ -9,7 +9,6 @@ export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
9
9
  export { default as breakoutPlugin } from './breakout';
10
10
  export { default as alignmentPlugin } from './alignment';
11
11
  export { default as dataConsumerMarkPlugin } from './data-consumer';
12
- export { default as indentationPlugin } from './indentation';
13
12
  export { default as annotationPlugin } from './annotation';
14
13
  export { default as customAutoformatPlugin } from './custom-autoformat';
15
14
  export { default as feedbackDialogPlugin } from './feedback-dialog';
@@ -3,10 +3,9 @@ import type { FeatureFlags, NextEditorPlugin, OptionalPlugin } from '@atlaskit/e
3
3
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
4
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
5
  import type { ListPlugin } from '@atlaskit/editor-plugin-list';
6
- import type { IndentationButtons } from './pm-plugins/indentation-buttons';
7
6
  import type { ToolbarUiComponentFactoryParams } from '../../types';
8
7
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
9
- import type { IndentationPlugin } from '../indentation';
8
+ import type { IndentationPlugin } from '@atlaskit/editor-plugin-indentation';
10
9
  import type { TaskAndDecisionsPlugin } from '../tasks-and-decisions/types';
11
10
  type Config = {
12
11
  showIndentationButtons: boolean;
@@ -21,7 +20,6 @@ type ToolbarListsIndentationPlugin = NextEditorPlugin<'toolbarListsIndentation',
21
20
  OptionalPlugin<TaskAndDecisionsPlugin>,
22
21
  OptionalPlugin<AnalyticsPlugin>
23
22
  ];
24
- sharedState: IndentationButtons | undefined;
25
23
  }>;
26
24
  declare const toolbarListsIndentationPlugin: ToolbarListsIndentationPlugin;
27
25
  type PrimaryToolbarComponentProps = Pick<ToolbarUiComponentFactoryParams, 'editorView' | 'popupsMountPoint' | 'popupsBoundariesElement' | 'popupsScrollableElement' | 'disabled' | 'isToolbarReducedSpacing'> & {
@@ -1,12 +1,10 @@
1
1
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
2
  export type IndentationButtonNode = null | 'paragraph_heading' | 'list' | 'taskList';
4
3
  export interface IndentationButtons {
5
4
  indentDisabled: boolean;
6
5
  outdentDisabled: boolean;
7
6
  node: IndentationButtonNode;
8
7
  }
9
- export declare const pluginKey: PluginKey<IndentationButtons>;
10
8
  interface TaskDecisionState {
11
9
  isInsideTask: boolean;
12
10
  indentDisabled: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "189.3.24",
3
+ "version": "189.3.25",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -84,6 +84,7 @@
84
84
  "@atlaskit/editor-plugin-history": "^0.1.0",
85
85
  "@atlaskit/editor-plugin-hyperlink": "^0.5.0",
86
86
  "@atlaskit/editor-plugin-image-upload": "^0.2.0",
87
+ "@atlaskit/editor-plugin-indentation": "^0.2.0",
87
88
  "@atlaskit/editor-plugin-layout": "^0.1.0",
88
89
  "@atlaskit/editor-plugin-list": "^1.3.0",
89
90
  "@atlaskit/editor-plugin-max-content-size": "^0.1.0",
@@ -1,140 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.removeIndentation = exports.isIndentationAllowed = exports.getOutdentCommand = exports.getIndentCommand = void 0;
8
- var _commands = require("@atlaskit/editor-common/commands");
9
- var _utils = require("./utils");
10
- var _analytics = require("@atlaskit/editor-common/analytics");
11
- var _getAttrsWithChangesRecorder = _interopRequireDefault(require("../getAttrsWithChangesRecorder"));
12
- var _indentation = require("@atlaskit/editor-common/indentation");
13
- var isIndentationAllowed = exports.isIndentationAllowed = function isIndentationAllowed(schema, node) {
14
- var _schema$nodes = schema.nodes,
15
- paragraph = _schema$nodes.paragraph,
16
- heading = _schema$nodes.heading,
17
- alignment = schema.marks.alignment;
18
- if ([paragraph, heading].indexOf(node.type) > -1) {
19
- if (alignment) {
20
- var hasAlignment = node.marks.filter(function (mark) {
21
- return mark.type === alignment;
22
- })[0];
23
- return !hasAlignment;
24
- }
25
- return true;
26
- }
27
- return false;
28
- };
29
-
30
- /**
31
- * Create new indentation command (Either indent or outdent depend of getArgsFn)
32
- * @param getNewIndentationAttrs Function to handle new indentation level
33
- */
34
- function createIndentationCommand(getNewIndentationAttrs) {
35
- return function (state, dispatch) {
36
- var indentation = state.schema.marks.indentation;
37
- return (0, _commands.toggleBlockMark)(indentation, getNewIndentationAttrs, isIndentationAllowed)(state, dispatch);
38
- };
39
- }
40
- function createIndentationCommandWithAnalytics(_ref) {
41
- var getNewIndentationAttrs = _ref.getNewIndentationAttrs,
42
- direction = _ref.direction,
43
- inputMethod = _ref.inputMethod,
44
- editorAnalyticsAPI = _ref.editorAnalyticsAPI;
45
- // Create a new getAttrs function to record the changes
46
- var _getAttrsWithChangesR = (0, _getAttrsWithChangesRecorder.default)(getNewIndentationAttrs, {
47
- direction: direction
48
- }),
49
- getAttrs = _getAttrsWithChangesR.getAttrs,
50
- getAndResetAttrsChanges = _getAttrsWithChangesR.getAndResetAttrsChanges;
51
-
52
- // Use new getAttrs wrapper
53
- var indentationCommand = createIndentationCommand(getAttrs);
54
-
55
- // Return a new command where we change dispatch for our analytics dispatch
56
- return function (state, dispatch) {
57
- return indentationCommand(state, (0, _utils.createAnalyticsDispatch)({
58
- getAttrsChanges: getAndResetAttrsChanges,
59
- inputMethod: inputMethod,
60
- editorAnalyticsAPI: editorAnalyticsAPI,
61
- state: state,
62
- dispatch: dispatch
63
- }));
64
- };
65
- }
66
-
67
- /**
68
- * Get new level for outdent
69
- * @param oldAttr Old attributes for the mark, undefined if the mark doesn't exit
70
- * @returns - undefined; No change required
71
- * - false; Remove the mark
72
- * - object; Update attributes
73
- */
74
- var getIndentAttrs = function getIndentAttrs(oldAttr) {
75
- if (!oldAttr) {
76
- return {
77
- level: 1
78
- }; // No mark exist, create a new one with level 1
79
- }
80
-
81
- var level = oldAttr.level;
82
- if (level >= _indentation.MAX_INDENTATION_LEVEL) {
83
- return undefined; // Max indentation level reached, do nothing.
84
- }
85
-
86
- return {
87
- level: level + 1
88
- }; // Otherwise, increase the level by one
89
- };
90
-
91
- var getIndentCommand = exports.getIndentCommand = function getIndentCommand(editorAnalyticsAPI) {
92
- return function () {
93
- var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
94
- return createIndentationCommandWithAnalytics({
95
- getNewIndentationAttrs: getIndentAttrs,
96
- direction: _analytics.INDENT_DIRECTION.INDENT,
97
- inputMethod: inputMethod,
98
- editorAnalyticsAPI: editorAnalyticsAPI
99
- });
100
- };
101
- };
102
-
103
- /**
104
- * Get new level for outdent
105
- * @param oldAttr Old attributes for the mark, undefined if the mark doesn't exit
106
- * @returns - undefined; No change required
107
- * - false; Remove the mark
108
- * - object; Update attributes
109
- */
110
- var getOutdentAttrs = function getOutdentAttrs(oldAttr) {
111
- if (!oldAttr) {
112
- return undefined; // Do nothing;
113
- }
114
-
115
- var level = oldAttr.level;
116
- if (level <= 1) {
117
- return false; // Remove the mark
118
- }
119
-
120
- return {
121
- level: level - 1
122
- }; // Decrease the level on other cases
123
- };
124
-
125
- var getOutdentCommand = exports.getOutdentCommand = function getOutdentCommand(editorAnalyticsAPI) {
126
- return function () {
127
- var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
128
- return createIndentationCommandWithAnalytics({
129
- getNewIndentationAttrs: getOutdentAttrs,
130
- direction: _analytics.INDENT_DIRECTION.OUTDENT,
131
- inputMethod: inputMethod,
132
- editorAnalyticsAPI: editorAnalyticsAPI
133
- });
134
- };
135
- };
136
- var removeIndentation = exports.removeIndentation = function removeIndentation(state, dispatch) {
137
- return (0, _commands.toggleBlockMark)(state.schema.marks.indentation, function () {
138
- return false;
139
- })(state, dispatch);
140
- };
@@ -1,92 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createAnalyticsDispatch = createAnalyticsDispatch;
7
- exports.getNewIndentLevel = getNewIndentLevel;
8
- exports.getPrevIndentLevel = getPrevIndentLevel;
9
- var _analytics = require("@atlaskit/editor-common/analytics");
10
- // Analytics GAS v3 Utils
11
-
12
- var indentTypes = {
13
- paragraph: _analytics.INDENT_TYPE.PARAGRAPH,
14
- heading: _analytics.INDENT_TYPE.HEADING
15
- };
16
-
17
- /**
18
- * Get the current indentation level given prev and new attributes
19
- * @param prevAttrs - Previous attributes from indentation
20
- * @param newAttrs - New attributes from indentation
21
- */
22
- function getNewIndentLevel(prevAttrs, newAttrs) {
23
- if (newAttrs === undefined) {
24
- return getPrevIndentLevel(prevAttrs);
25
- } else if (newAttrs === false) {
26
- return 0;
27
- }
28
- return newAttrs.level;
29
- }
30
-
31
- /**
32
- * Get the previous indentation level prev attributes
33
- * @param prevAttrs - Previous attributes from indentation
34
- */
35
- function getPrevIndentLevel(prevAttrs) {
36
- if (prevAttrs === undefined) {
37
- return 0;
38
- }
39
- return prevAttrs.level;
40
- }
41
-
42
- /**
43
- * Create a new dispatch function who add analytics events given a list of attributes changes
44
- *
45
- * @export
46
- * @param {*} getAttrsChanges
47
- * @param {*} state
48
- * @param dispatch
49
- * @returns
50
- */
51
- function createAnalyticsDispatch(_ref) {
52
- var getAttrsChanges = _ref.getAttrsChanges,
53
- inputMethod = _ref.inputMethod,
54
- editorAnalyticsAPI = _ref.editorAnalyticsAPI,
55
- state = _ref.state,
56
- dispatch = _ref.dispatch;
57
- return function (tr) {
58
- var currentTr = tr;
59
- var changes = getAttrsChanges(); // Get all attributes changes
60
-
61
- // Add analytics event for each change stored.
62
- changes.forEach(function (_ref2) {
63
- var node = _ref2.node,
64
- prevAttrs = _ref2.prevAttrs,
65
- newAttrs = _ref2.newAttrs,
66
- direction = _ref2.options.direction;
67
- var indentType = indentTypes[node.type.name];
68
- if (!indentType) {
69
- return; // If no valid indent type continue
70
- }
71
-
72
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
73
- action: _analytics.ACTION.FORMATTED,
74
- actionSubject: _analytics.ACTION_SUBJECT.TEXT,
75
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_INDENT,
76
- eventType: _analytics.EVENT_TYPE.TRACK,
77
- attributes: {
78
- inputMethod: inputMethod,
79
- previousIndentationLevel: getPrevIndentLevel(prevAttrs),
80
- newIndentLevel: getNewIndentLevel(prevAttrs, newAttrs),
81
- direction: direction,
82
- indentType: indentType
83
- }
84
- })(currentTr);
85
- });
86
-
87
- // Dispatch analytics if exist
88
- if (dispatch) {
89
- dispatch(tr);
90
- }
91
- };
92
- }
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = getAttrsWithChangesRecorder;
7
- /**
8
- * Create a new getAttrs handler who will wrap the original function,
9
- * and store the changes internally to be used for other
10
- * tools like Analytics later in the code.
11
- *
12
- * @param getAttrs - Function who gets the new attributes
13
- * @return object
14
- * @property handler - New handler to get indentation attributes (It wraps the original)
15
- * @property getChanges - Return all the stored changes.
16
- * @property clear - Clear the changes
17
- */
18
- function getAttrsWithChangesRecorder(getAttrs, options) {
19
- var changes = [];
20
- function getAttrsWithChangesRecorder(prevAttrs, node) {
21
- var newAttrs = getAttrs(prevAttrs, node);
22
- changes.push({
23
- node: node,
24
- prevAttrs: prevAttrs,
25
- newAttrs: newAttrs,
26
- options: options
27
- });
28
- return newAttrs;
29
- }
30
- return {
31
- getAttrs: getAttrsWithChangesRecorder,
32
- getAndResetAttrsChanges: function getAndResetAttrsChanges() {
33
- var oldChanges = changes;
34
- changes = [];
35
- return oldChanges;
36
- }
37
- };
38
- }