@atlaskit/editor-core 197.5.2 → 197.6.0

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 (28) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/composable-editor/editor-internal.js +3 -16
  3. package/dist/cjs/composable-editor/hooks/useProviders.js +10 -1
  4. package/dist/cjs/composable-editor/utils/handleProviders.js +3 -1
  5. package/dist/cjs/create-editor/ReactEditorView.js +0 -5
  6. package/dist/cjs/presets/universal.js +3 -1
  7. package/dist/cjs/version-wrapper.js +1 -1
  8. package/dist/es2019/composable-editor/editor-internal.js +3 -18
  9. package/dist/es2019/composable-editor/hooks/useProviders.js +10 -1
  10. package/dist/es2019/composable-editor/utils/handleProviders.js +3 -1
  11. package/dist/es2019/create-editor/ReactEditorView.js +0 -5
  12. package/dist/es2019/presets/universal.js +3 -1
  13. package/dist/es2019/version-wrapper.js +1 -1
  14. package/dist/esm/composable-editor/editor-internal.js +3 -16
  15. package/dist/esm/composable-editor/hooks/useProviders.js +10 -1
  16. package/dist/esm/composable-editor/utils/handleProviders.js +3 -1
  17. package/dist/esm/create-editor/ReactEditorView.js +0 -5
  18. package/dist/esm/presets/universal.js +3 -1
  19. package/dist/esm/version-wrapper.js +1 -1
  20. package/dist/types/composable-editor/hooks/useProviders.d.ts +3 -2
  21. package/dist/types/create-editor/create-universal-preset.d.ts +7 -1
  22. package/dist/types/presets/universal.d.ts +7 -1
  23. package/dist/types/presets/useUniversalPreset.d.ts +7 -1
  24. package/dist/types-ts4.5/composable-editor/hooks/useProviders.d.ts +3 -2
  25. package/dist/types-ts4.5/create-editor/create-universal-preset.d.ts +7 -1
  26. package/dist/types-ts4.5/presets/universal.d.ts +7 -1
  27. package/dist/types-ts4.5/presets/useUniversalPreset.d.ts +7 -1
  28. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 197.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#139831](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/139831)
8
+ [`181c907365d7d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/181c907365d7d) -
9
+ Pass autoformat provider via preset
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 197.5.3
16
+
17
+ ### Patch Changes
18
+
19
+ - [#138334](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/138334)
20
+ [`5bc7950824d2d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5bc7950824d2d) -
21
+ Removing dangerous and deprecated internal API
22
+
3
23
  ## 197.5.2
4
24
 
5
25
  ### Patch Changes
@@ -12,7 +12,6 @@ var _react = require("react");
12
12
  var _react2 = require("@emotion/react");
13
13
  var _analytics = require("@atlaskit/editor-common/analytics");
14
14
  var _portal = require("@atlaskit/editor-common/portal");
15
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
15
  var _ErrorBoundary = _interopRequireDefault(require("../create-editor/ErrorBoundary"));
17
16
  var _featureFlagsFromProps = require("../create-editor/feature-flags-from-props");
18
17
  var _ReactEditorView = _interopRequireDefault(require("../create-editor/ReactEditorView"));
@@ -51,16 +50,6 @@ var EditorInternal = exports.EditorInternal = /*#__PURE__*/(0, _react.memo)(func
51
50
  onEditorDestroyed = _ref.onEditorDestroyed,
52
51
  preset = _ref.preset,
53
52
  AppearanceComponent = _ref.AppearanceComponent;
54
- var setEditorApi = (0, _react.useCallback)(
55
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
56
- function (api) {
57
- if (!(0, _platformFeatureFlags.fg)('platform_editor_remove_editor_actions_workaround')) {
58
- // This is an workaround to unblock Editor Lego Decoupling project, if you have questions ping us #cc-editor-lego
59
- // We may clean up this code when EditorActions deprecation process starts
60
- // @ts-expect-error 2339: Property '__EDITOR_INTERNALS_DO_NOT_USE__API' does not exist on type 'EditorActions<any>'.
61
- editorActions.__EDITOR_INTERNALS_DO_NOT_USE__API = api;
62
- }
63
- }, [editorActions]);
64
53
  var overriddenEditorProps = _objectSpread(_objectSpread({}, props), {}, {
65
54
  onSave: props.onSave ? handleSave : undefined,
66
55
  // noop all analytic events, even if a handler is still passed.
@@ -104,7 +93,6 @@ var EditorInternal = exports.EditorInternal = /*#__PURE__*/(0, _react.memo)(func
104
93
  onEditorDestroyed: onEditorDestroyed,
105
94
  disabled: props.disabled,
106
95
  preset: preset,
107
- setEditorApi: setEditorApi,
108
96
  render: function render(_ref2) {
109
97
  var _props$featureFlags, _props$featureFlags2;
110
98
  var editor = _ref2.editor,
@@ -155,7 +143,6 @@ var EditorInternal = exports.EditorInternal = /*#__PURE__*/(0, _react.memo)(func
155
143
  function ReactEditorViewContextWrapper(props) {
156
144
  var _props$editorProps$me, _props$editorProps$li;
157
145
  var setInternalEditorAPI = (0, _context.useSetPresetContext)();
158
- var setExternalEditorAPI = props.setEditorApi;
159
146
 
160
147
  /**
161
148
  * We use the context to retrieve the editorAPI
@@ -169,8 +156,7 @@ function ReactEditorViewContextWrapper(props) {
169
156
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
170
157
  function (api) {
171
158
  setInternalEditorAPI === null || setInternalEditorAPI === void 0 || setInternalEditorAPI(api);
172
- setExternalEditorAPI === null || setExternalEditorAPI === void 0 || setExternalEditorAPI(api);
173
- }, [setInternalEditorAPI, setExternalEditorAPI]);
159
+ }, [setInternalEditorAPI]);
174
160
 
175
161
  // TODO: Remove these when we deprecate these props from editor-props - smartLinks is unfortunately still used in some places, we can sidestep this problem if we move everyone across to ComposableEditor and deprecate Editor
176
162
  var UNSAFE_cards = props.editorProps.UNSAFE_cards;
@@ -179,7 +165,8 @@ function ReactEditorViewContextWrapper(props) {
179
165
  contextIdentifierProvider: props.editorProps.contextIdentifierProvider,
180
166
  mediaProvider: (_props$editorProps$me = props.editorProps.media) === null || _props$editorProps$me === void 0 ? void 0 : _props$editorProps$me.provider,
181
167
  cardProvider: ((_props$editorProps$li = props.editorProps.linking) === null || _props$editorProps$li === void 0 || (_props$editorProps$li = _props$editorProps$li.smartLinks) === null || _props$editorProps$li === void 0 ? void 0 : _props$editorProps$li.provider) || smartLinks && smartLinks.provider || UNSAFE_cards && UNSAFE_cards.provider,
182
- emojiProvider: props.editorProps.emojiProvider
168
+ emojiProvider: props.editorProps.emojiProvider,
169
+ autoformattingProvider: props.editorProps.autoformattingProvider
183
170
  });
184
171
  return (0, _react2.jsx)(_ReactEditorView.default, (0, _extends2.default)({}, props, {
185
172
  setEditorApi: setEditorAPI
@@ -22,7 +22,8 @@ var useProviders = exports.useProviders = function useProviders(_ref) {
22
22
  var contextIdentifierProvider = _ref.contextIdentifierProvider,
23
23
  mediaProvider = _ref.mediaProvider,
24
24
  cardProvider = _ref.cardProvider,
25
- emojiProvider = _ref.emojiProvider;
25
+ emojiProvider = _ref.emojiProvider,
26
+ autoformattingProvider = _ref.autoformattingProvider;
26
27
  var editorApi = (0, _context2.usePresetContext)();
27
28
  (0, _react.useEffect)(function () {
28
29
  function setProvider() {
@@ -78,4 +79,12 @@ var useProviders = exports.useProviders = function useProviders(_ref) {
78
79
  }
79
80
  }
80
81
  }, [emojiProvider, editorApi]);
82
+ (0, _react.useEffect)(function () {
83
+ if ((0, _platformFeatureFlags.fg)('platform_editor_autoformatting_provider_from_plugin_config')) {
84
+ if (autoformattingProvider) {
85
+ var _editorApi$customAuto;
86
+ editorApi === null || editorApi === void 0 || (_editorApi$customAuto = editorApi.customAutoformat) === null || _editorApi$customAuto === void 0 || _editorApi$customAuto.actions.setProvider(autoformattingProvider);
87
+ }
88
+ }
89
+ }, [autoformattingProvider, editorApi]);
81
90
  };
@@ -43,7 +43,9 @@ function handleProviders(providerFactory, _ref, extensionProvider, quickInsertPr
43
43
  if (!(0, _platformFeatureFlags.fg)('platform_editor_card_provider_from_plugin_config')) {
44
44
  providerFactory.setProvider('cardProvider', cardProvider);
45
45
  }
46
- providerFactory.setProvider('autoformattingProvider', autoformattingProvider);
46
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_autoformatting_provider_from_plugin_config')) {
47
+ providerFactory.setProvider('autoformattingProvider', autoformattingProvider);
48
+ }
47
49
  if (extensionProvider) {
48
50
  providerFactory.setProvider('extensionProvider', Promise.resolve(extensionProvider));
49
51
  }
@@ -30,7 +30,6 @@ var _ufo = require("@atlaskit/editor-common/ufo");
30
30
  var _analytics2 = require("@atlaskit/editor-common/utils/analytics");
31
31
  var _state2 = require("@atlaskit/editor-prosemirror/state");
32
32
  var _view = require("@atlaskit/editor-prosemirror/view");
33
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
34
33
  var _eventDispatcher = require("../event-dispatcher");
35
34
  var _context = require("../presets/context");
36
35
  var _findChangedNodesFromTransaction = require("../utils/findChangedNodesFromTransaction");
@@ -558,10 +557,6 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
558
557
  });
559
558
  var _api = _this.pluginInjectionAPI.api();
560
559
  (_props$setEditorApi = props.setEditorApi) === null || _props$setEditorApi === void 0 || _props$setEditorApi.call(props, _api);
561
- if (props.editorProps.editorActions && !(0, _platformFeatureFlags.fg)('platform_editor_remove_editor_actions_workaround')) {
562
- // @ts-expect-error
563
- props.editorProps.editorActions.__EDITOR_INTERNALS_DO_NOT_USE__API = _api;
564
- }
565
560
  _this.eventDispatcher = new _eventDispatcher.EventDispatcher();
566
561
  _this.dispatch = (0, _eventDispatcher.createDispatch)(_this.eventDispatcher);
567
562
  _this.errorReporter = (0, _createEditor.createErrorReporter)(props.editorProps.errorReporterHandler);
@@ -208,7 +208,9 @@ function createUniversalPresetInternal(_ref) {
208
208
  editorAppearance: appearance,
209
209
  // @ts-ignore Temporary solution to check for Live Page editor.
210
210
  __livePage: props.__livePage
211
- })], Boolean(((_props$linking3 = props.linking) === null || _props$linking3 === void 0 ? void 0 : _props$linking3.smartLinks) || props.smartLinks || props.UNSAFE_cards)).maybeAdd(_customAutoformat.customAutoformatPlugin, Boolean(props.autoformattingProvider)).maybeAdd([_status.statusPlugin, {
211
+ })], Boolean(((_props$linking3 = props.linking) === null || _props$linking3 === void 0 ? void 0 : _props$linking3.smartLinks) || props.smartLinks || props.UNSAFE_cards)).maybeAdd([_customAutoformat.customAutoformatPlugin, {
212
+ autoformattingProvider: props.autoformattingProvider
213
+ }], Boolean(props.autoformattingProvider)).maybeAdd([_status.statusPlugin, {
212
214
  menuDisabled: statusMenuDisabled,
213
215
  allowZeroWidthSpaceAfter: true
214
216
  }], Boolean(props.allowStatus)).maybeAdd(_indentation.indentationPlugin, Boolean(props.allowIndentation)).maybeAdd(_scrollIntoView.scrollIntoViewPlugin, Boolean(props.autoScrollIntoView !== false)).add([_toolbarListsIndentation.toolbarListsIndentationPlugin, {
@@ -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 = "197.5.2";
8
+ var version = exports.version = "197.6.0";
@@ -9,7 +9,6 @@ import { Fragment, memo, useCallback } from 'react';
9
9
  import { css, jsx } from '@emotion/react';
10
10
  import { ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
11
11
  import { usePortalProvider } from '@atlaskit/editor-common/portal';
12
- import { fg } from '@atlaskit/platform-feature-flags';
13
12
  import ErrorBoundary from '../create-editor/ErrorBoundary';
14
13
  import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
15
14
  import ReactEditorView from '../create-editor/ReactEditorView';
@@ -44,16 +43,6 @@ export const EditorInternal = /*#__PURE__*/memo(({
44
43
  AppearanceComponent
45
44
  }) => {
46
45
  var _props$performanceTra, _props$performanceTra2, _props$performanceTra3, _props$performanceTra4;
47
- const setEditorApi = useCallback(
48
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
- api => {
50
- if (!fg('platform_editor_remove_editor_actions_workaround')) {
51
- // This is an workaround to unblock Editor Lego Decoupling project, if you have questions ping us #cc-editor-lego
52
- // We may clean up this code when EditorActions deprecation process starts
53
- // @ts-expect-error 2339: Property '__EDITOR_INTERNALS_DO_NOT_USE__API' does not exist on type 'EditorActions<any>'.
54
- editorActions.__EDITOR_INTERNALS_DO_NOT_USE__API = api;
55
- }
56
- }, [editorActions]);
57
46
  const overriddenEditorProps = {
58
47
  ...props,
59
48
  onSave: props.onSave ? handleSave : undefined,
@@ -95,7 +84,6 @@ export const EditorInternal = /*#__PURE__*/memo(({
95
84
  onEditorDestroyed: onEditorDestroyed,
96
85
  disabled: props.disabled,
97
86
  preset: preset,
98
- setEditorApi: setEditorApi,
99
87
  render: ({
100
88
  editor,
101
89
  view,
@@ -147,9 +135,6 @@ export const EditorInternal = /*#__PURE__*/memo(({
147
135
  function ReactEditorViewContextWrapper(props) {
148
136
  var _props$editorProps$me, _props$editorProps$li, _props$editorProps$li2;
149
137
  const setInternalEditorAPI = useSetPresetContext();
150
- const {
151
- setEditorApi: setExternalEditorAPI
152
- } = props;
153
138
 
154
139
  /**
155
140
  * We use the context to retrieve the editorAPI
@@ -163,8 +148,7 @@ function ReactEditorViewContextWrapper(props) {
163
148
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
164
149
  api => {
165
150
  setInternalEditorAPI === null || setInternalEditorAPI === void 0 ? void 0 : setInternalEditorAPI(api);
166
- setExternalEditorAPI === null || setExternalEditorAPI === void 0 ? void 0 : setExternalEditorAPI(api);
167
- }, [setInternalEditorAPI, setExternalEditorAPI]);
151
+ }, [setInternalEditorAPI]);
168
152
 
169
153
  // TODO: Remove these when we deprecate these props from editor-props - smartLinks is unfortunately still used in some places, we can sidestep this problem if we move everyone across to ComposableEditor and deprecate Editor
170
154
  const UNSAFE_cards = props.editorProps.UNSAFE_cards;
@@ -173,7 +157,8 @@ function ReactEditorViewContextWrapper(props) {
173
157
  contextIdentifierProvider: props.editorProps.contextIdentifierProvider,
174
158
  mediaProvider: (_props$editorProps$me = props.editorProps.media) === null || _props$editorProps$me === void 0 ? void 0 : _props$editorProps$me.provider,
175
159
  cardProvider: ((_props$editorProps$li = props.editorProps.linking) === null || _props$editorProps$li === void 0 ? void 0 : (_props$editorProps$li2 = _props$editorProps$li.smartLinks) === null || _props$editorProps$li2 === void 0 ? void 0 : _props$editorProps$li2.provider) || smartLinks && smartLinks.provider || UNSAFE_cards && UNSAFE_cards.provider,
176
- emojiProvider: props.editorProps.emojiProvider
160
+ emojiProvider: props.editorProps.emojiProvider,
161
+ autoformattingProvider: props.editorProps.autoformattingProvider
177
162
  });
178
163
  return jsx(ReactEditorView, _extends({}, props, {
179
164
  setEditorApi: setEditorAPI
@@ -13,7 +13,8 @@ export const useProviders = ({
13
13
  contextIdentifierProvider,
14
14
  mediaProvider,
15
15
  cardProvider,
16
- emojiProvider
16
+ emojiProvider,
17
+ autoformattingProvider
17
18
  }) => {
18
19
  const editorApi = usePresetContext();
19
20
  useEffect(() => {
@@ -49,4 +50,12 @@ export const useProviders = ({
49
50
  }
50
51
  }
51
52
  }, [emojiProvider, editorApi]);
53
+ useEffect(() => {
54
+ if (fg('platform_editor_autoformatting_provider_from_plugin_config')) {
55
+ if (autoformattingProvider) {
56
+ var _editorApi$customAuto;
57
+ editorApi === null || editorApi === void 0 ? void 0 : (_editorApi$customAuto = editorApi.customAutoformat) === null || _editorApi$customAuto === void 0 ? void 0 : _editorApi$customAuto.actions.setProvider(autoformattingProvider);
58
+ }
59
+ }
60
+ }, [autoformattingProvider, editorApi]);
52
61
  };
@@ -39,7 +39,9 @@ export default function handleProviders(providerFactory, {
39
39
  if (!fg('platform_editor_card_provider_from_plugin_config')) {
40
40
  providerFactory.setProvider('cardProvider', cardProvider);
41
41
  }
42
- providerFactory.setProvider('autoformattingProvider', autoformattingProvider);
42
+ if (!fg('platform_editor_autoformatting_provider_from_plugin_config')) {
43
+ providerFactory.setProvider('autoformattingProvider', autoformattingProvider);
44
+ }
43
45
  if (extensionProvider) {
44
46
  providerFactory.setProvider('extensionProvider', Promise.resolve(extensionProvider));
45
47
  }
@@ -16,7 +16,6 @@ import { EditorExperience, ExperienceStore, RELIABILITY_INTERVAL } from '@atlask
16
16
  import { analyticsEventKey, getAnalyticsEventSeverity } from '@atlaskit/editor-common/utils/analytics';
17
17
  import { EditorState, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
18
18
  import { EditorView } from '@atlaskit/editor-prosemirror/view';
19
- import { fg } from '@atlaskit/platform-feature-flags';
20
19
  import { createDispatch, EventDispatcher } from '../event-dispatcher';
21
20
  import { EditorAPIContext } from '../presets/context';
22
21
  import { findChangedNodesFromTransaction } from '../utils/findChangedNodesFromTransaction';
@@ -557,10 +556,6 @@ export class ReactEditorView extends React.Component {
557
556
  });
558
557
  const _api = this.pluginInjectionAPI.api();
559
558
  (_props$setEditorApi = props.setEditorApi) === null || _props$setEditorApi === void 0 ? void 0 : _props$setEditorApi.call(props, _api);
560
- if (props.editorProps.editorActions && !fg('platform_editor_remove_editor_actions_workaround')) {
561
- // @ts-expect-error
562
- props.editorProps.editorActions.__EDITOR_INTERNALS_DO_NOT_USE__API = _api;
563
- }
564
559
  this.eventDispatcher = new EventDispatcher();
565
560
  this.dispatch = createDispatch(this.eventDispatcher);
566
561
  this.errorReporter = createErrorReporter(props.editorProps.errorReporterHandler);
@@ -207,7 +207,9 @@ export default function createUniversalPresetInternal({
207
207
  editorAppearance: appearance,
208
208
  // @ts-ignore Temporary solution to check for Live Page editor.
209
209
  __livePage: props.__livePage
210
- }], Boolean(((_props$linking3 = props.linking) === null || _props$linking3 === void 0 ? void 0 : _props$linking3.smartLinks) || props.smartLinks || props.UNSAFE_cards)).maybeAdd(customAutoformatPlugin, Boolean(props.autoformattingProvider)).maybeAdd([statusPlugin, {
210
+ }], Boolean(((_props$linking3 = props.linking) === null || _props$linking3 === void 0 ? void 0 : _props$linking3.smartLinks) || props.smartLinks || props.UNSAFE_cards)).maybeAdd([customAutoformatPlugin, {
211
+ autoformattingProvider: props.autoformattingProvider
212
+ }], Boolean(props.autoformattingProvider)).maybeAdd([statusPlugin, {
211
213
  menuDisabled: statusMenuDisabled,
212
214
  allowZeroWidthSpaceAfter: true
213
215
  }], Boolean(props.allowStatus)).maybeAdd(indentationPlugin, Boolean(props.allowIndentation)).maybeAdd(scrollIntoViewPlugin, Boolean(props.autoScrollIntoView !== false)).add([toolbarListsIndentationPlugin, {
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "197.5.2";
2
+ export const version = "197.6.0";
@@ -13,7 +13,6 @@ import { Fragment, memo, useCallback } from 'react';
13
13
  import { css, jsx } from '@emotion/react';
14
14
  import { ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
15
15
  import { usePortalProvider } from '@atlaskit/editor-common/portal';
16
- import { fg } from '@atlaskit/platform-feature-flags';
17
16
  import ErrorBoundary from '../create-editor/ErrorBoundary';
18
17
  import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
19
18
  import ReactEditorView from '../create-editor/ReactEditorView';
@@ -47,16 +46,6 @@ export var EditorInternal = /*#__PURE__*/memo(function (_ref) {
47
46
  onEditorDestroyed = _ref.onEditorDestroyed,
48
47
  preset = _ref.preset,
49
48
  AppearanceComponent = _ref.AppearanceComponent;
50
- var setEditorApi = useCallback(
51
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
- function (api) {
53
- if (!fg('platform_editor_remove_editor_actions_workaround')) {
54
- // This is an workaround to unblock Editor Lego Decoupling project, if you have questions ping us #cc-editor-lego
55
- // We may clean up this code when EditorActions deprecation process starts
56
- // @ts-expect-error 2339: Property '__EDITOR_INTERNALS_DO_NOT_USE__API' does not exist on type 'EditorActions<any>'.
57
- editorActions.__EDITOR_INTERNALS_DO_NOT_USE__API = api;
58
- }
59
- }, [editorActions]);
60
49
  var overriddenEditorProps = _objectSpread(_objectSpread({}, props), {}, {
61
50
  onSave: props.onSave ? handleSave : undefined,
62
51
  // noop all analytic events, even if a handler is still passed.
@@ -100,7 +89,6 @@ export var EditorInternal = /*#__PURE__*/memo(function (_ref) {
100
89
  onEditorDestroyed: onEditorDestroyed,
101
90
  disabled: props.disabled,
102
91
  preset: preset,
103
- setEditorApi: setEditorApi,
104
92
  render: function render(_ref2) {
105
93
  var _props$featureFlags, _props$featureFlags2;
106
94
  var editor = _ref2.editor,
@@ -151,7 +139,6 @@ export var EditorInternal = /*#__PURE__*/memo(function (_ref) {
151
139
  function ReactEditorViewContextWrapper(props) {
152
140
  var _props$editorProps$me, _props$editorProps$li;
153
141
  var setInternalEditorAPI = useSetPresetContext();
154
- var setExternalEditorAPI = props.setEditorApi;
155
142
 
156
143
  /**
157
144
  * We use the context to retrieve the editorAPI
@@ -165,8 +152,7 @@ function ReactEditorViewContextWrapper(props) {
165
152
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
166
153
  function (api) {
167
154
  setInternalEditorAPI === null || setInternalEditorAPI === void 0 || setInternalEditorAPI(api);
168
- setExternalEditorAPI === null || setExternalEditorAPI === void 0 || setExternalEditorAPI(api);
169
- }, [setInternalEditorAPI, setExternalEditorAPI]);
155
+ }, [setInternalEditorAPI]);
170
156
 
171
157
  // TODO: Remove these when we deprecate these props from editor-props - smartLinks is unfortunately still used in some places, we can sidestep this problem if we move everyone across to ComposableEditor and deprecate Editor
172
158
  var UNSAFE_cards = props.editorProps.UNSAFE_cards;
@@ -175,7 +161,8 @@ function ReactEditorViewContextWrapper(props) {
175
161
  contextIdentifierProvider: props.editorProps.contextIdentifierProvider,
176
162
  mediaProvider: (_props$editorProps$me = props.editorProps.media) === null || _props$editorProps$me === void 0 ? void 0 : _props$editorProps$me.provider,
177
163
  cardProvider: ((_props$editorProps$li = props.editorProps.linking) === null || _props$editorProps$li === void 0 || (_props$editorProps$li = _props$editorProps$li.smartLinks) === null || _props$editorProps$li === void 0 ? void 0 : _props$editorProps$li.provider) || smartLinks && smartLinks.provider || UNSAFE_cards && UNSAFE_cards.provider,
178
- emojiProvider: props.editorProps.emojiProvider
164
+ emojiProvider: props.editorProps.emojiProvider,
165
+ autoformattingProvider: props.editorProps.autoformattingProvider
179
166
  });
180
167
  return jsx(ReactEditorView, _extends({}, props, {
181
168
  setEditorApi: setEditorAPI
@@ -15,7 +15,8 @@ export var useProviders = function useProviders(_ref) {
15
15
  var contextIdentifierProvider = _ref.contextIdentifierProvider,
16
16
  mediaProvider = _ref.mediaProvider,
17
17
  cardProvider = _ref.cardProvider,
18
- emojiProvider = _ref.emojiProvider;
18
+ emojiProvider = _ref.emojiProvider,
19
+ autoformattingProvider = _ref.autoformattingProvider;
19
20
  var editorApi = usePresetContext();
20
21
  useEffect(function () {
21
22
  function setProvider() {
@@ -71,4 +72,12 @@ export var useProviders = function useProviders(_ref) {
71
72
  }
72
73
  }
73
74
  }, [emojiProvider, editorApi]);
75
+ useEffect(function () {
76
+ if (fg('platform_editor_autoformatting_provider_from_plugin_config')) {
77
+ if (autoformattingProvider) {
78
+ var _editorApi$customAuto;
79
+ editorApi === null || editorApi === void 0 || (_editorApi$customAuto = editorApi.customAutoformat) === null || _editorApi$customAuto === void 0 || _editorApi$customAuto.actions.setProvider(autoformattingProvider);
80
+ }
81
+ }
82
+ }, [autoformattingProvider, editorApi]);
74
83
  };
@@ -38,7 +38,9 @@ export default function handleProviders(providerFactory, _ref, extensionProvider
38
38
  if (!fg('platform_editor_card_provider_from_plugin_config')) {
39
39
  providerFactory.setProvider('cardProvider', cardProvider);
40
40
  }
41
- providerFactory.setProvider('autoformattingProvider', autoformattingProvider);
41
+ if (!fg('platform_editor_autoformatting_provider_from_plugin_config')) {
42
+ providerFactory.setProvider('autoformattingProvider', autoformattingProvider);
43
+ }
42
44
  if (extensionProvider) {
43
45
  providerFactory.setProvider('extensionProvider', Promise.resolve(extensionProvider));
44
46
  }
@@ -27,7 +27,6 @@ import { EditorExperience, ExperienceStore, RELIABILITY_INTERVAL } from '@atlask
27
27
  import { analyticsEventKey, getAnalyticsEventSeverity } from '@atlaskit/editor-common/utils/analytics';
28
28
  import { EditorState, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
29
29
  import { EditorView } from '@atlaskit/editor-prosemirror/view';
30
- import { fg } from '@atlaskit/platform-feature-flags';
31
30
  import { createDispatch, EventDispatcher } from '../event-dispatcher';
32
31
  import { EditorAPIContext } from '../presets/context';
33
32
  import { findChangedNodesFromTransaction } from '../utils/findChangedNodesFromTransaction';
@@ -551,10 +550,6 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
551
550
  });
552
551
  var _api = _this.pluginInjectionAPI.api();
553
552
  (_props$setEditorApi = props.setEditorApi) === null || _props$setEditorApi === void 0 || _props$setEditorApi.call(props, _api);
554
- if (props.editorProps.editorActions && !fg('platform_editor_remove_editor_actions_workaround')) {
555
- // @ts-expect-error
556
- props.editorProps.editorActions.__EDITOR_INTERNALS_DO_NOT_USE__API = _api;
557
- }
558
553
  _this.eventDispatcher = new EventDispatcher();
559
554
  _this.dispatch = createDispatch(_this.eventDispatcher);
560
555
  _this.errorReporter = createErrorReporter(props.editorProps.errorReporterHandler);
@@ -201,7 +201,9 @@ export default function createUniversalPresetInternal(_ref) {
201
201
  editorAppearance: appearance,
202
202
  // @ts-ignore Temporary solution to check for Live Page editor.
203
203
  __livePage: props.__livePage
204
- })], Boolean(((_props$linking3 = props.linking) === null || _props$linking3 === void 0 ? void 0 : _props$linking3.smartLinks) || props.smartLinks || props.UNSAFE_cards)).maybeAdd(customAutoformatPlugin, Boolean(props.autoformattingProvider)).maybeAdd([statusPlugin, {
204
+ })], Boolean(((_props$linking3 = props.linking) === null || _props$linking3 === void 0 ? void 0 : _props$linking3.smartLinks) || props.smartLinks || props.UNSAFE_cards)).maybeAdd([customAutoformatPlugin, {
205
+ autoformattingProvider: props.autoformattingProvider
206
+ }], Boolean(props.autoformattingProvider)).maybeAdd([statusPlugin, {
205
207
  menuDisabled: statusMenuDisabled,
206
208
  allowZeroWidthSpaceAfter: true
207
209
  }], Boolean(props.allowStatus)).maybeAdd(indentationPlugin, Boolean(props.allowIndentation)).maybeAdd(scrollIntoViewPlugin, Boolean(props.autoScrollIntoView !== false)).add([toolbarListsIndentationPlugin, {
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "197.5.2";
2
+ export var version = "197.6.0";
@@ -1,10 +1,11 @@
1
- import type { CardProvider, ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
1
+ import type { AutoformattingProvider, CardProvider, ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
2
2
  import { type EmojiProvider } from '@atlaskit/emoji';
3
3
  interface UseProvidersProps {
4
4
  contextIdentifierProvider: Promise<ContextIdentifierProvider> | undefined;
5
5
  mediaProvider: Promise<MediaProvider> | undefined;
6
6
  cardProvider: Promise<CardProvider> | undefined;
7
7
  emojiProvider: Promise<EmojiProvider> | undefined;
8
+ autoformattingProvider: Promise<AutoformattingProvider> | undefined;
8
9
  }
9
10
  /**
10
11
  * This hook is used to replace the old approach of using the `providerFactory`.
@@ -14,5 +15,5 @@ interface UseProvidersProps {
14
15
  *
15
16
  * In the future ideally consumers implement this behaviour themselves.
16
17
  */
17
- export declare const useProviders: ({ contextIdentifierProvider, mediaProvider, cardProvider, emojiProvider, }: UseProvidersProps) => void;
18
+ export declare const useProviders: ({ contextIdentifierProvider, mediaProvider, cardProvider, emojiProvider, autoformattingProvider, }: UseProvidersProps) => void;
18
19
  export {};
@@ -1381,7 +1381,13 @@ export declare function createUniversalPreset({ props, prevProps, initialPluginC
1381
1381
  insertStatus: (inputMethod?: import("@atlaskit/editor-common/analytics").INPUT_METHOD.INSERT_MENU | import("@atlaskit/editor-common/analytics").INPUT_METHOD.QUICK_INSERT | import("@atlaskit/editor-common/analytics").INPUT_METHOD.TOOLBAR | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
1382
1382
  };
1383
1383
  sharedState: import("@atlaskit/editor-plugin-status").StatusState | undefined;
1384
- }, import("@atlaskit/editor-plugin-status").StatusPluginOptions | undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"customAutoformat", {}, undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"card", {
1384
+ }, import("@atlaskit/editor-plugin-status").StatusPluginOptions | undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"customAutoformat", {
1385
+ sharedState: import("@atlaskit/editor-plugin-custom-autoformat").CustomAutoformatPluginSharedState | undefined;
1386
+ pluginConfiguration: import("@atlaskit/editor-plugin-custom-autoformat").CustomAutoformatPluginOptions;
1387
+ actions: {
1388
+ setProvider: (provider: Promise<import("@atlaskit/editor-common/provider-factory").AutoformattingProvider>) => Promise<boolean>;
1389
+ };
1390
+ }, import("@atlaskit/editor-plugin-custom-autoformat").CustomAutoformatPluginOptions> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"card", {
1385
1391
  pluginConfiguration: import("@atlaskit/editor-plugin-card").CardPluginOptions | undefined;
1386
1392
  dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
1387
1393
  pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
@@ -1428,7 +1428,13 @@ export default function createUniversalPresetInternal({ appearance, props, featu
1428
1428
  insertStatus: (inputMethod?: import("@atlaskit/editor-common/analytics").INPUT_METHOD.INSERT_MENU | import("@atlaskit/editor-common/analytics").INPUT_METHOD.QUICK_INSERT | import("@atlaskit/editor-common/analytics").INPUT_METHOD.TOOLBAR | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
1429
1429
  };
1430
1430
  sharedState: import("@atlaskit/editor-plugins/status").StatusState | undefined;
1431
- }, import("@atlaskit/editor-plugins/status").StatusPluginOptions | undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"customAutoformat", {}, undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"card", {
1431
+ }, import("@atlaskit/editor-plugins/status").StatusPluginOptions | undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"customAutoformat", {
1432
+ sharedState: import("@atlaskit/editor-plugins/custom-autoformat").CustomAutoformatPluginSharedState | undefined;
1433
+ pluginConfiguration: import("@atlaskit/editor-plugins/custom-autoformat").CustomAutoformatPluginOptions;
1434
+ actions: {
1435
+ setProvider: (provider: Promise<import("@atlaskit/editor-common/provider-factory").AutoformattingProvider>) => Promise<boolean>;
1436
+ };
1437
+ }, import("@atlaskit/editor-plugins/custom-autoformat").CustomAutoformatPluginOptions> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"card", {
1432
1438
  pluginConfiguration: import("@atlaskit/editor-plugins/card").CardPluginOptions | undefined;
1433
1439
  dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
1434
1440
  pluginConfiguration: FeatureFlags;
@@ -1381,7 +1381,13 @@ export default function useUniversalPreset({ props, initialPluginConfiguration }
1381
1381
  insertStatus: (inputMethod?: import("@atlaskit/editor-common/analytics").INPUT_METHOD.INSERT_MENU | import("@atlaskit/editor-common/analytics").INPUT_METHOD.QUICK_INSERT | import("@atlaskit/editor-common/analytics").INPUT_METHOD.TOOLBAR | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
1382
1382
  };
1383
1383
  sharedState: import("@atlaskit/editor-plugin-status").StatusState | undefined;
1384
- }, import("@atlaskit/editor-plugin-status").StatusPluginOptions | undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"customAutoformat", {}, undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"card", {
1384
+ }, import("@atlaskit/editor-plugin-status").StatusPluginOptions | undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"customAutoformat", {
1385
+ sharedState: import("@atlaskit/editor-plugin-custom-autoformat").CustomAutoformatPluginSharedState | undefined;
1386
+ pluginConfiguration: import("@atlaskit/editor-plugin-custom-autoformat").CustomAutoformatPluginOptions;
1387
+ actions: {
1388
+ setProvider: (provider: Promise<import("@atlaskit/editor-common/provider-factory").AutoformattingProvider>) => Promise<boolean>;
1389
+ };
1390
+ }, import("@atlaskit/editor-plugin-custom-autoformat").CustomAutoformatPluginOptions> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"card", {
1385
1391
  pluginConfiguration: import("@atlaskit/editor-plugin-card").CardPluginOptions | undefined;
1386
1392
  dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
1387
1393
  pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
@@ -1,10 +1,11 @@
1
- import type { CardProvider, ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
1
+ import type { AutoformattingProvider, CardProvider, ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
2
2
  import { type EmojiProvider } from '@atlaskit/emoji';
3
3
  interface UseProvidersProps {
4
4
  contextIdentifierProvider: Promise<ContextIdentifierProvider> | undefined;
5
5
  mediaProvider: Promise<MediaProvider> | undefined;
6
6
  cardProvider: Promise<CardProvider> | undefined;
7
7
  emojiProvider: Promise<EmojiProvider> | undefined;
8
+ autoformattingProvider: Promise<AutoformattingProvider> | undefined;
8
9
  }
9
10
  /**
10
11
  * This hook is used to replace the old approach of using the `providerFactory`.
@@ -14,5 +15,5 @@ interface UseProvidersProps {
14
15
  *
15
16
  * In the future ideally consumers implement this behaviour themselves.
16
17
  */
17
- export declare const useProviders: ({ contextIdentifierProvider, mediaProvider, cardProvider, emojiProvider, }: UseProvidersProps) => void;
18
+ export declare const useProviders: ({ contextIdentifierProvider, mediaProvider, cardProvider, emojiProvider, autoformattingProvider, }: UseProvidersProps) => void;
18
19
  export {};
@@ -1742,7 +1742,13 @@ export declare function createUniversalPreset({ props, prevProps, initialPluginC
1742
1742
  };
1743
1743
  sharedState: import("@atlaskit/editor-plugin-status").StatusState | undefined;
1744
1744
  }, import("@atlaskit/editor-plugin-status").StatusPluginOptions | undefined> | undefined,
1745
- import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"customAutoformat", {}, undefined> | undefined,
1745
+ import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"customAutoformat", {
1746
+ sharedState: import("@atlaskit/editor-plugin-custom-autoformat").CustomAutoformatPluginSharedState | undefined;
1747
+ pluginConfiguration: import("@atlaskit/editor-plugin-custom-autoformat").CustomAutoformatPluginOptions;
1748
+ actions: {
1749
+ setProvider: (provider: Promise<import("@atlaskit/editor-common/provider-factory").AutoformattingProvider>) => Promise<boolean>;
1750
+ };
1751
+ }, import("@atlaskit/editor-plugin-custom-autoformat").CustomAutoformatPluginOptions> | undefined,
1746
1752
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"card", {
1747
1753
  pluginConfiguration: import("@atlaskit/editor-plugin-card").CardPluginOptions | undefined;
1748
1754
  dependencies: [
@@ -1789,7 +1789,13 @@ export default function createUniversalPresetInternal({ appearance, props, featu
1789
1789
  };
1790
1790
  sharedState: import("@atlaskit/editor-plugins/status").StatusState | undefined;
1791
1791
  }, import("@atlaskit/editor-plugins/status").StatusPluginOptions | undefined> | undefined,
1792
- import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"customAutoformat", {}, undefined> | undefined,
1792
+ import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"customAutoformat", {
1793
+ sharedState: import("@atlaskit/editor-plugins/custom-autoformat").CustomAutoformatPluginSharedState | undefined;
1794
+ pluginConfiguration: import("@atlaskit/editor-plugins/custom-autoformat").CustomAutoformatPluginOptions;
1795
+ actions: {
1796
+ setProvider: (provider: Promise<import("@atlaskit/editor-common/provider-factory").AutoformattingProvider>) => Promise<boolean>;
1797
+ };
1798
+ }, import("@atlaskit/editor-plugins/custom-autoformat").CustomAutoformatPluginOptions> | undefined,
1793
1799
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"card", {
1794
1800
  pluginConfiguration: import("@atlaskit/editor-plugins/card").CardPluginOptions | undefined;
1795
1801
  dependencies: [
@@ -1742,7 +1742,13 @@ export default function useUniversalPreset({ props, initialPluginConfiguration }
1742
1742
  };
1743
1743
  sharedState: import("@atlaskit/editor-plugin-status").StatusState | undefined;
1744
1744
  }, import("@atlaskit/editor-plugin-status").StatusPluginOptions | undefined> | undefined,
1745
- import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"customAutoformat", {}, undefined> | undefined,
1745
+ import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"customAutoformat", {
1746
+ sharedState: import("@atlaskit/editor-plugin-custom-autoformat").CustomAutoformatPluginSharedState | undefined;
1747
+ pluginConfiguration: import("@atlaskit/editor-plugin-custom-autoformat").CustomAutoformatPluginOptions;
1748
+ actions: {
1749
+ setProvider: (provider: Promise<import("@atlaskit/editor-common/provider-factory").AutoformattingProvider>) => Promise<boolean>;
1750
+ };
1751
+ }, import("@atlaskit/editor-plugin-custom-autoformat").CustomAutoformatPluginOptions> | undefined,
1746
1752
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"card", {
1747
1753
  pluginConfiguration: import("@atlaskit/editor-plugin-card").CardPluginOptions | undefined;
1748
1754
  dependencies: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "197.5.2",
3
+ "version": "197.6.0",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -43,13 +43,13 @@
43
43
  "@atlaskit/analytics-next": "^10.1.0",
44
44
  "@atlaskit/analytics-next-stable-react-context": "1.0.1",
45
45
  "@atlaskit/button": "^20.1.0",
46
- "@atlaskit/editor-common": "^89.0.0",
46
+ "@atlaskit/editor-common": "^89.1.0",
47
47
  "@atlaskit/editor-json-transformer": "^8.18.0",
48
- "@atlaskit/editor-plugins": "^4.4.0",
48
+ "@atlaskit/editor-plugins": "^4.5.0",
49
49
  "@atlaskit/editor-prosemirror": "6.0.0",
50
50
  "@atlaskit/editor-shared-styles": "^2.13.0",
51
51
  "@atlaskit/emoji": "^67.7.0",
52
- "@atlaskit/icon": "^22.16.0",
52
+ "@atlaskit/icon": "^22.17.0",
53
53
  "@atlaskit/media-card": "^78.2.0",
54
54
  "@atlaskit/mention": "^23.2.0",
55
55
  "@atlaskit/platform-feature-flags": "^0.3.0",
@@ -188,9 +188,6 @@
188
188
  "type": "boolean",
189
189
  "referenceOnly": "true"
190
190
  },
191
- "platform_editor_remove_editor_actions_workaround": {
192
- "type": "boolean"
193
- },
194
191
  "platform.editor.table.use-shared-state-hook": {
195
192
  "type": "boolean",
196
193
  "referenceOnly": true
@@ -264,6 +261,9 @@
264
261
  },
265
262
  "platform_editor_breakout_use_css": {
266
263
  "type": "boolean"
264
+ },
265
+ "platform_editor_autoformatting_provider_from_plugin_config": {
266
+ "type": "boolean"
267
267
  }
268
268
  },
269
269
  "stricter": {