@atlaskit/editor-core 197.11.1 → 197.13.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 (61) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/composable-editor/editor-internal.js +19 -4
  3. package/dist/cjs/composable-editor/hooks/useProviders.js +2 -3
  4. package/dist/cjs/create-editor/ReactEditorView.js +25 -0
  5. package/dist/cjs/editor-appearances/FullPageEditor.js +2 -1
  6. package/dist/cjs/editor-appearances/FullWidthEditor.js +1 -0
  7. package/dist/cjs/presets/universal.js +1 -4
  8. package/dist/cjs/ui/Appearance/Chromeless.js +7 -3
  9. package/dist/cjs/ui/Appearance/Comment/Comment.js +5 -3
  10. package/dist/cjs/ui/Appearance/FullPage/FullPage.js +2 -1
  11. package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
  12. package/dist/cjs/ui/ContentStyles/index.js +2 -3
  13. package/dist/cjs/ui/EditorContext/index.js +10 -3
  14. package/dist/cjs/ui/Toolbar/toolbar-size.js +19 -1
  15. package/dist/cjs/ui/Toolbar/types.js +6 -0
  16. package/dist/cjs/version-wrapper.js +1 -1
  17. package/dist/es2019/composable-editor/editor-internal.js +18 -6
  18. package/dist/es2019/composable-editor/hooks/useProviders.js +1 -2
  19. package/dist/es2019/create-editor/ReactEditorView.js +28 -3
  20. package/dist/es2019/editor-appearances/FullPageEditor.js +2 -1
  21. package/dist/es2019/editor-appearances/FullWidthEditor.js +1 -0
  22. package/dist/es2019/presets/universal.js +1 -4
  23. package/dist/es2019/ui/Appearance/Chromeless.js +6 -1
  24. package/dist/es2019/ui/Appearance/Comment/Comment.js +5 -3
  25. package/dist/es2019/ui/Appearance/FullPage/FullPage.js +2 -1
  26. package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
  27. package/dist/es2019/ui/ContentStyles/index.js +2 -3
  28. package/dist/es2019/ui/EditorContext/index.js +10 -3
  29. package/dist/es2019/ui/Toolbar/toolbar-size.js +19 -2
  30. package/dist/es2019/ui/Toolbar/types.js +1 -1
  31. package/dist/es2019/version-wrapper.js +1 -1
  32. package/dist/esm/composable-editor/editor-internal.js +21 -6
  33. package/dist/esm/composable-editor/hooks/useProviders.js +2 -3
  34. package/dist/esm/create-editor/ReactEditorView.js +25 -0
  35. package/dist/esm/editor-appearances/FullPageEditor.js +2 -1
  36. package/dist/esm/editor-appearances/FullWidthEditor.js +1 -0
  37. package/dist/esm/presets/universal.js +1 -4
  38. package/dist/esm/ui/Appearance/Chromeless.js +7 -3
  39. package/dist/esm/ui/Appearance/Comment/Comment.js +5 -3
  40. package/dist/esm/ui/Appearance/FullPage/FullPage.js +2 -1
  41. package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
  42. package/dist/esm/ui/ContentStyles/index.js +2 -3
  43. package/dist/esm/ui/EditorContext/index.js +10 -3
  44. package/dist/esm/ui/Toolbar/toolbar-size.js +19 -2
  45. package/dist/esm/ui/Toolbar/types.js +1 -1
  46. package/dist/esm/version-wrapper.js +1 -1
  47. package/dist/types/composable-editor/hooks/useProviders.d.ts +14 -1
  48. package/dist/types/create-editor/ReactEditorView.d.ts +1 -0
  49. package/dist/types/editor-appearances/FullPageEditor.d.ts +1 -0
  50. package/dist/types/editor-appearances/FullWidthEditor.d.ts +1 -0
  51. package/dist/types/ui/Appearance/Chromeless.d.ts +5 -1
  52. package/dist/types/ui/Appearance/FullPage/FullPageContentArea.d.ts +2 -0
  53. package/dist/types/ui/Toolbar/types.d.ts +1 -1
  54. package/dist/types-ts4.5/composable-editor/hooks/useProviders.d.ts +14 -1
  55. package/dist/types-ts4.5/create-editor/ReactEditorView.d.ts +1 -0
  56. package/dist/types-ts4.5/editor-appearances/FullPageEditor.d.ts +1 -0
  57. package/dist/types-ts4.5/editor-appearances/FullWidthEditor.d.ts +1 -0
  58. package/dist/types-ts4.5/ui/Appearance/Chromeless.d.ts +3 -1
  59. package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageContentArea.d.ts +2 -0
  60. package/dist/types-ts4.5/ui/Toolbar/types.d.ts +1 -1
  61. package/package.json +12 -7
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import EditorActions from '../../actions';
5
6
  import { PresetContextProvider } from '../../presets/context';
6
7
  const EditorContext = /*#__PURE__*/React.createContext({});
@@ -16,9 +17,15 @@ export default class LegacyEditorContext extends React.Component {
16
17
  };
17
18
  }
18
19
  render() {
19
- return /*#__PURE__*/React.createElement(EditorContext.Provider, {
20
- value: this.getChildContext()
21
- }, /*#__PURE__*/React.createElement(PresetContextProvider, null, this.props.children));
20
+ if (fg('platform_editor_remove_use_preset_context')) {
21
+ return /*#__PURE__*/React.createElement(EditorContext.Provider, {
22
+ value: this.getChildContext()
23
+ }, this.props.children);
24
+ } else {
25
+ return /*#__PURE__*/React.createElement(EditorContext.Provider, {
26
+ value: this.getChildContext()
27
+ }, /*#__PURE__*/React.createElement(PresetContextProvider, null, this.props.children));
28
+ }
22
29
  }
23
30
  }
24
31
  _defineProperty(LegacyEditorContext, "childContextTypes", {
@@ -1,5 +1,22 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  import { isFullPage } from '../../utils/is-full-page';
2
- import { ToolbarSize, ToolbarWidths, ToolbarWidthsFullPage } from './types';
3
+ import { ToolbarSize, ToolbarWidths, ToolbarWidthsFullPage, ToolbarWidthsFullPageNext } from './types';
4
+ const toolbarSizesFullPageNext = [{
5
+ width: ToolbarWidthsFullPageNext.XXL,
6
+ size: ToolbarSize.XXL
7
+ }, {
8
+ width: ToolbarWidthsFullPageNext.XL,
9
+ size: ToolbarSize.XL
10
+ }, {
11
+ width: ToolbarWidthsFullPageNext.L,
12
+ size: ToolbarSize.L
13
+ }, {
14
+ width: ToolbarWidthsFullPageNext.M,
15
+ size: ToolbarSize.M
16
+ }, {
17
+ width: ToolbarWidthsFullPageNext.S,
18
+ size: ToolbarSize.S
19
+ }];
3
20
 
4
21
  // Toolbar sizes for full page editor a little bit different, because it has more buttons e.g. actions button...
5
22
  const toolbarSizesFullPage = [{
@@ -34,7 +51,7 @@ const toolbarSizes = [{
34
51
  width: ToolbarWidths.S,
35
52
  size: ToolbarSize.S
36
53
  }];
37
- const toolbarSizesForAppearance = appearance => isFullPage(appearance) ? toolbarSizesFullPage : toolbarSizes;
54
+ const toolbarSizesForAppearance = appearance => isFullPage(appearance) ? fg('platform_editor_toolbar_responsive_fixes') ? toolbarSizesFullPageNext : toolbarSizesFullPage : toolbarSizes;
38
55
  export const toolbarSizeToWidth = (toolbarSize, appearance) => {
39
56
  return (toolbarSizesForAppearance(appearance).find(({
40
57
  size
@@ -1 +1 @@
1
- export { ToolbarSize, ToolbarWidths, ToolbarWidthsFullPage } from '@atlaskit/editor-common/types';
1
+ export { ToolbarSize, ToolbarWidths, ToolbarWidthsFullPage, ToolbarWidthsFullPageNext } from '@atlaskit/editor-common/types';
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "197.11.1";
2
+ export const version = "197.13.0";
@@ -7,17 +7,18 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  * @jsxRuntime classic
8
8
  * @jsx jsx
9
9
  */
10
- import { Fragment, memo, useCallback } from 'react';
10
+ import { Fragment, memo, useCallback, useState } from 'react';
11
11
 
12
12
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
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';
16
17
  import ErrorBoundary from '../create-editor/ErrorBoundary';
17
18
  import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
18
19
  import ReactEditorView from '../create-editor/ReactEditorView';
19
20
  import { ContextAdapter } from '../nodeviews/context-adapter';
20
- import { useSetPresetContext } from '../presets/context';
21
+ import { usePresetContext, useSetPresetContext } from '../presets/context';
21
22
  import EditorContext from '../ui/EditorContext';
22
23
  import { IntlProviderIfMissingWrapper } from '../ui/IntlProviderIfMissingWrapper/IntlProviderIfMissingWrapper';
23
24
  import { RenderTracking } from '../utils/performance/components/RenderTracking';
@@ -138,7 +139,15 @@ export var EditorInternal = /*#__PURE__*/memo(function (_ref) {
138
139
  });
139
140
  function ReactEditorViewContextWrapper(props) {
140
141
  var _props$editorProps$me, _props$editorProps$li;
142
+ // deprecated, unable to be FF due to hook usage
141
143
  var setInternalEditorAPI = useSetPresetContext();
144
+ var presetContextEditorAPI = usePresetContext();
145
+
146
+ // new way of storing the editorApi when FF platform_editor_remove_use_preset_context is enabled
147
+ var _useState = useState(undefined),
148
+ _useState2 = _slicedToArray(_useState, 2),
149
+ editorAPI = _useState2[0],
150
+ setEditorAPI = _useState2[1];
142
151
 
143
152
  /**
144
153
  * We use the context to retrieve the editorAPI
@@ -148,16 +157,21 @@ function ReactEditorViewContextWrapper(props) {
148
157
  * so we should also set the value for the `EditorContext` that is used in
149
158
  * `EditorInternal`.
150
159
  */
151
- var setEditorAPI = useCallback(
160
+ var setPresetContextEditorAPI = useCallback(
152
161
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
153
162
  function (api) {
154
- setInternalEditorAPI === null || setInternalEditorAPI === void 0 || setInternalEditorAPI(api);
155
- }, [setInternalEditorAPI]);
163
+ if (fg('platform_editor_remove_use_preset_context')) {
164
+ setEditorAPI(api);
165
+ } else {
166
+ setInternalEditorAPI === null || setInternalEditorAPI === void 0 || setInternalEditorAPI(api);
167
+ }
168
+ }, [setInternalEditorAPI, setEditorAPI]);
156
169
 
157
170
  // 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
158
171
  var UNSAFE_cards = props.editorProps.UNSAFE_cards;
159
172
  var smartLinks = props.editorProps.smartLinks;
160
173
  useProviders({
174
+ editorApi: fg('platform_editor_remove_use_preset_context') ? editorAPI : presetContextEditorAPI,
161
175
  contextIdentifierProvider: props.editorProps.contextIdentifierProvider,
162
176
  mediaProvider: (_props$editorProps$me = props.editorProps.media) === null || _props$editorProps$me === void 0 ? void 0 : _props$editorProps$me.provider,
163
177
  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,
@@ -165,6 +179,7 @@ function ReactEditorViewContextWrapper(props) {
165
179
  autoformattingProvider: props.editorProps.autoformattingProvider
166
180
  });
167
181
  return jsx(ReactEditorView, _extends({}, props, {
168
- setEditorApi: setEditorAPI
182
+ editorAPI: editorAPI,
183
+ setEditorApi: setPresetContextEditorAPI
169
184
  }));
170
185
  }
@@ -2,7 +2,6 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { useEffect } from 'react';
4
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
- import { usePresetContext } from '../../presets/context';
6
5
  /**
7
6
  * This hook is used to replace the old approach of using the `providerFactory`.
8
7
  *
@@ -12,12 +11,12 @@ import { usePresetContext } from '../../presets/context';
12
11
  * In the future ideally consumers implement this behaviour themselves.
13
12
  */
14
13
  export var useProviders = function useProviders(_ref) {
15
- var contextIdentifierProvider = _ref.contextIdentifierProvider,
14
+ var editorApi = _ref.editorApi,
15
+ contextIdentifierProvider = _ref.contextIdentifierProvider,
16
16
  mediaProvider = _ref.mediaProvider,
17
17
  cardProvider = _ref.cardProvider,
18
18
  emojiProvider = _ref.emojiProvider,
19
19
  autoformattingProvider = _ref.autoformattingProvider;
20
- var editorApi = usePresetContext();
21
20
  useEffect(function () {
22
21
  function setProvider() {
23
22
  return _setProvider.apply(this, arguments);
@@ -762,6 +762,31 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
762
762
  var renderTracking = (_this$props$editorPro10 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro10 === void 0 || (_this$props$editorPro10 = _this$props$editorPro10.renderTracking) === null || _this$props$editorPro10 === void 0 ? void 0 : _this$props$editorPro10.reactEditorView;
763
763
  var renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
764
764
  var useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
765
+ if (fg('platform_editor_remove_use_preset_context')) {
766
+ var _this$props$render, _this$props$render2, _this$props;
767
+ return /*#__PURE__*/React.createElement(ReactEditorViewContext.Provider, {
768
+ value: {
769
+ editorRef: this.editorRef,
770
+ editorView: this.view,
771
+ popupsMountPoint: this.props.editorProps.popupsMountPoint
772
+ }
773
+ }, renderTrackingEnabled && /*#__PURE__*/React.createElement(RenderTracking, {
774
+ componentProps: this.props,
775
+ action: ACTION.RE_RENDERED,
776
+ actionSubject: ACTION_SUBJECT.REACT_EDITOR_VIEW,
777
+ handleAnalyticsEvent: this.handleAnalyticsEvent,
778
+ useShallow: useShallow
779
+ }), this.props.render ? (_this$props$render = (_this$props$render2 = (_this$props = this.props).render) === null || _this$props$render2 === void 0 ? void 0 : _this$props$render2.call(_this$props, {
780
+ editor: this.editor,
781
+ view: this.view,
782
+ config: this.config,
783
+ eventDispatcher: this.eventDispatcher,
784
+ transformer: this.contentTransformer,
785
+ dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
786
+ editorRef: this.editorRef,
787
+ editorAPI: this.props.editorAPI
788
+ })) !== null && _this$props$render !== void 0 ? _this$props$render : this.editor : this.editor);
789
+ }
765
790
  return /*#__PURE__*/React.createElement(ReactEditorViewContext.Provider, {
766
791
  value: {
767
792
  editorRef: this.editorRef,
@@ -13,8 +13,9 @@ import FullPage from '../ui/Appearance/FullPage';
13
13
  * @returns Editor component
14
14
  */
15
15
  export function FullPageEditor(props) {
16
+ var _props$appearance;
16
17
  return /*#__PURE__*/React.createElement(CoreEditor, _extends({}, props, {
17
- appearance: "full-page",
18
+ appearance: (_props$appearance = props.appearance) !== null && _props$appearance !== void 0 ? _props$appearance : 'full-page',
18
19
  AppearanceComponent: FullPage
19
20
  }));
20
21
  }
@@ -11,6 +11,7 @@ import FullPage from '../ui/Appearance/FullPage';
11
11
  *
12
12
  * @param props FullWidthEditorProps
13
13
  * @returns Editor component
14
+ * @deprecated In favour of `FullPageEditor` with appearance "full-width"
14
15
  */
15
16
  export function FullWidthEditor(props) {
16
17
  return /*#__PURE__*/React.createElement(CoreEditor, _extends({}, props, {
@@ -216,10 +216,7 @@ export default function createUniversalPresetInternal(_ref) {
216
216
  tableSelectorSupported: (featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.tableSelector) && isFullPage,
217
217
  nativeStatusSupported: !statusMenuDisabled,
218
218
  showElementBrowserLink: props.elementBrowser && props.elementBrowser.showModal || false,
219
- // @ts-ignore
220
- // For platform_editor_element_level_templates experiment only
221
- // clean up ticket ED-24873
222
- UNSAFE_editorAppearance: appearance
219
+ appearance: appearance
223
220
  }]).maybeAdd([beforePrimaryToolbarPlugin, {
224
221
  beforePrimaryToolbarComponents: // @ts-expect-error 2339: Property 'before' does not exist on type 'PrimaryToolbarComponents'.
225
222
  (_props$primaryToolbar = props.primaryToolbarComponents) === null || _props$primaryToolbar === void 0 ? void 0 : _props$primaryToolbar.before
@@ -17,6 +17,7 @@ import React, { Fragment } from 'react';
17
17
  import { css, jsx } from '@emotion/react';
18
18
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
19
19
  import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
20
+ import { fg } from '@atlaskit/platform-feature-flags';
20
21
  import { createEditorContentStyle } from '../ContentStyles';
21
22
  import PluginSlot from '../PluginSlot';
22
23
  import WithFlash from '../WithFlash';
@@ -78,6 +79,8 @@ var Editor = /*#__PURE__*/function (_React$Component) {
78
79
  pluginHooks = _this$props.pluginHooks,
79
80
  featureFlags = _this$props.featureFlags;
80
81
  var maxContentSizeReached = Boolean(maxContentSize === null || maxContentSize === void 0 ? void 0 : maxContentSize.maxContentSizeReached);
82
+ var _useSharedPluginState = useSharedPluginState(_this.props.editorAPI, ['editorViewMode']),
83
+ editorViewModeState = _useSharedPluginState.editorViewModeState;
81
84
  return jsx(WithFlash, {
82
85
  animate: maxContentSizeReached
83
86
  }, jsx("div", {
@@ -100,7 +103,8 @@ var Editor = /*#__PURE__*/function (_React$Component) {
100
103
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
101
104
  , {
102
105
  className: "ak-editor-content-area",
103
- featureFlags: featureFlags
106
+ featureFlags: featureFlags,
107
+ viewMode: fg('platform_editor_remove_use_preset_context') ? editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode : undefined
104
108
  }, customContentComponents && 'before' in customContentComponents ? customContentComponents.before : customContentComponents, jsx(PluginSlot, {
105
109
  editorView: editorView,
106
110
  editorActions: editorActions,
@@ -136,8 +140,8 @@ export { Editor as default };
136
140
  function RenderWithPluginState(_ref3) {
137
141
  var renderChrome = _ref3.renderChrome,
138
142
  editorAPI = _ref3.editorAPI;
139
- var _useSharedPluginState = useSharedPluginState(editorAPI, ['maxContentSize']),
140
- maxContentSizeState = _useSharedPluginState.maxContentSizeState;
143
+ var _useSharedPluginState2 = useSharedPluginState(editorAPI, ['maxContentSize']),
144
+ maxContentSizeState = _useSharedPluginState2.maxContentSizeState;
141
145
  return jsx(Fragment, null, renderChrome({
142
146
  maxContentSize: maxContentSizeState
143
147
  }));
@@ -74,10 +74,11 @@ var secondaryToolbarStyles = css({
74
74
  var appearance = 'comment';
75
75
  export var CommentEditorWithIntl = function CommentEditorWithIntl(props) {
76
76
  var editorAPI = props.editorAPI;
77
- var _useSharedPluginState = useSharedPluginState(editorAPI, ['media', 'maxContentSize', 'primaryToolbar']),
77
+ var _useSharedPluginState = useSharedPluginState(editorAPI, ['media', 'maxContentSize', 'primaryToolbar', 'editorViewMode']),
78
78
  mediaState = _useSharedPluginState.mediaState,
79
79
  maxContentSizeState = _useSharedPluginState.maxContentSizeState,
80
- primaryToolbarState = _useSharedPluginState.primaryToolbarState;
80
+ primaryToolbarState = _useSharedPluginState.primaryToolbarState,
81
+ editorViewModeState = _useSharedPluginState.editorViewModeState;
81
82
  var intl = useIntl();
82
83
  var editorDOMElement = props.editorDOMElement,
83
84
  editorView = props.editorView,
@@ -207,7 +208,8 @@ export var CommentEditorWithIntl = function CommentEditorWithIntl(props) {
207
208
  className: classnames('ak-editor-content-area', {
208
209
  'less-margin': width < akEditorMobileBreakoutPoint
209
210
  }),
210
- featureFlags: featureFlags
211
+ featureFlags: featureFlags,
212
+ viewMode: fg('platform_editor_remove_use_preset_context') ? editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode : undefined
211
213
  }, customContentComponents && 'before' in customContentComponents ? customContentComponents.before : customContentComponents, jsx(PluginSlot, {
212
214
  editorView: editorView,
213
215
  editorActions: editorActions,
@@ -107,6 +107,7 @@ export var FullPageEditor = function FullPageEditor(props) {
107
107
  wrapperElement: (_wrapperElementRef$cu = wrapperElementRef === null || wrapperElementRef === void 0 ? void 0 : wrapperElementRef.current) !== null && _wrapperElementRef$cu !== void 0 ? _wrapperElementRef$cu : null,
108
108
  pluginHooks: props.pluginHooks,
109
109
  featureFlags: props.featureFlags,
110
- isEditorToolbarHidden: isEditorToolbarHidden
110
+ isEditorToolbarHidden: isEditorToolbarHidden,
111
+ viewMode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
111
112
  })));
112
113
  };
@@ -50,7 +50,8 @@ var Content = /*#__PURE__*/React.forwardRef(function (props, ref) {
50
50
  , {
51
51
  className: "fabric-editor-popup-scroll-parent",
52
52
  featureFlags: props.featureFlags,
53
- ref: scrollContainerRef
53
+ ref: scrollContainerRef,
54
+ viewMode: fg('platform_editor_remove_use_preset_context') ? props === null || props === void 0 ? void 0 : props.viewMode : undefined
54
55
  }, jsx(ClickAreaBlock, {
55
56
  editorView: props.editorView,
56
57
  editorDisabled: props.disabled
@@ -93,15 +93,14 @@ export var createEditorContentStyle = function createEditorContentStyle(styles)
93
93
  var editorAPI = usePresetContext();
94
94
  var _useSharedPluginState = useSharedPluginState(editorAPI, ['editorViewMode']),
95
95
  editorViewModeState = _useSharedPluginState.editorViewModeState;
96
- var viewMode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
97
96
  var memoizedStyle = useMemo(function () {
98
97
  return contentStyles({
99
98
  theme: theme,
100
99
  colorMode: colorMode,
101
100
  featureFlags: featureFlags,
102
- viewMode: viewMode
101
+ viewMode: fg('platform_editor_remove_use_preset_context') ? props.viewMode : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
103
102
  });
104
- }, [theme, colorMode, featureFlags, viewMode]);
103
+ }, [theme, colorMode, featureFlags, editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode, props.viewMode]);
105
104
  return (
106
105
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
107
106
  jsx("div", {
@@ -8,6 +8,7 @@ function _createSuper(t) { var r = _isNativeReflectConstruct(); return function
8
8
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
9
  import React from 'react';
10
10
  import PropTypes from 'prop-types';
11
+ import { fg } from '@atlaskit/platform-feature-flags';
11
12
  import EditorActions from '../../actions';
12
13
  import { PresetContextProvider } from '../../presets/context';
13
14
  var EditorContext = /*#__PURE__*/React.createContext({});
@@ -34,9 +35,15 @@ var LegacyEditorContext = /*#__PURE__*/function (_React$Component) {
34
35
  }, {
35
36
  key: "render",
36
37
  value: function render() {
37
- return /*#__PURE__*/React.createElement(EditorContext.Provider, {
38
- value: this.getChildContext()
39
- }, /*#__PURE__*/React.createElement(PresetContextProvider, null, this.props.children));
38
+ if (fg('platform_editor_remove_use_preset_context')) {
39
+ return /*#__PURE__*/React.createElement(EditorContext.Provider, {
40
+ value: this.getChildContext()
41
+ }, this.props.children);
42
+ } else {
43
+ return /*#__PURE__*/React.createElement(EditorContext.Provider, {
44
+ value: this.getChildContext()
45
+ }, /*#__PURE__*/React.createElement(PresetContextProvider, null, this.props.children));
46
+ }
40
47
  }
41
48
  }]);
42
49
  return LegacyEditorContext;
@@ -1,5 +1,22 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  import { isFullPage } from '../../utils/is-full-page';
2
- import { ToolbarSize, ToolbarWidths, ToolbarWidthsFullPage } from './types';
3
+ import { ToolbarSize, ToolbarWidths, ToolbarWidthsFullPage, ToolbarWidthsFullPageNext } from './types';
4
+ var toolbarSizesFullPageNext = [{
5
+ width: ToolbarWidthsFullPageNext.XXL,
6
+ size: ToolbarSize.XXL
7
+ }, {
8
+ width: ToolbarWidthsFullPageNext.XL,
9
+ size: ToolbarSize.XL
10
+ }, {
11
+ width: ToolbarWidthsFullPageNext.L,
12
+ size: ToolbarSize.L
13
+ }, {
14
+ width: ToolbarWidthsFullPageNext.M,
15
+ size: ToolbarSize.M
16
+ }, {
17
+ width: ToolbarWidthsFullPageNext.S,
18
+ size: ToolbarSize.S
19
+ }];
3
20
 
4
21
  // Toolbar sizes for full page editor a little bit different, because it has more buttons e.g. actions button...
5
22
  var toolbarSizesFullPage = [{
@@ -35,7 +52,7 @@ var toolbarSizes = [{
35
52
  size: ToolbarSize.S
36
53
  }];
37
54
  var toolbarSizesForAppearance = function toolbarSizesForAppearance(appearance) {
38
- return isFullPage(appearance) ? toolbarSizesFullPage : toolbarSizes;
55
+ return isFullPage(appearance) ? fg('platform_editor_toolbar_responsive_fixes') ? toolbarSizesFullPageNext : toolbarSizesFullPage : toolbarSizes;
39
56
  };
40
57
  export var toolbarSizeToWidth = function toolbarSizeToWidth(toolbarSize, appearance) {
41
58
  return (toolbarSizesForAppearance(appearance).find(function (_ref) {
@@ -1 +1 @@
1
- export { ToolbarSize, ToolbarWidths, ToolbarWidthsFullPage } from '@atlaskit/editor-common/types';
1
+ export { ToolbarSize, ToolbarWidths, ToolbarWidthsFullPage, ToolbarWidthsFullPageNext } from '@atlaskit/editor-common/types';
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "197.11.1";
2
+ export var version = "197.13.0";
@@ -1,6 +1,19 @@
1
1
  import type { AutoformattingProvider, CardProvider, ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
2
+ import type { OptionalPlugin, PublicPluginAPI } from '@atlaskit/editor-common/types';
3
+ import type { CardPlugin } from '@atlaskit/editor-plugins/card';
4
+ import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugins/context-identifier';
5
+ import { type CustomAutoformatPlugin } from '@atlaskit/editor-plugins/custom-autoformat';
6
+ import { type EmojiPlugin } from '@atlaskit/editor-plugins/emoji';
7
+ import type { MediaPlugin } from '@atlaskit/editor-plugins/media';
2
8
  import { type EmojiProvider } from '@atlaskit/emoji';
3
9
  interface UseProvidersProps {
10
+ editorApi: PublicPluginAPI<[
11
+ OptionalPlugin<ContextIdentifierPlugin>,
12
+ OptionalPlugin<MediaPlugin>,
13
+ OptionalPlugin<CardPlugin>,
14
+ OptionalPlugin<EmojiPlugin>,
15
+ OptionalPlugin<CustomAutoformatPlugin>
16
+ ]> | undefined;
4
17
  contextIdentifierProvider: Promise<ContextIdentifierProvider> | undefined;
5
18
  mediaProvider: Promise<MediaProvider> | undefined;
6
19
  cardProvider: Promise<CardProvider> | undefined;
@@ -15,5 +28,5 @@ interface UseProvidersProps {
15
28
  *
16
29
  * In the future ideally consumers implement this behaviour themselves.
17
30
  */
18
- export declare const useProviders: ({ contextIdentifierProvider, mediaProvider, cardProvider, emojiProvider, autoformattingProvider, }: UseProvidersProps) => void;
31
+ export declare const useProviders: ({ editorApi, contextIdentifierProvider, mediaProvider, cardProvider, emojiProvider, autoformattingProvider, }: UseProvidersProps) => void;
19
32
  export {};
@@ -30,6 +30,7 @@ export interface EditorViewProps {
30
30
  portalProviderAPI: PortalProviderAPI;
31
31
  disabled?: boolean;
32
32
  experienceStore?: ExperienceStore;
33
+ editorAPI: PublicPluginAPI<any> | undefined;
33
34
  setEditorApi?: SetEditorAPI;
34
35
  render?: (props: {
35
36
  editor: JSX.Element;
@@ -3,6 +3,7 @@ import { type EditorNextProps } from '../types/editor-props';
3
3
  export type FullPageEditorProps = Pick<EditorNextProps, 'preset' | 'defaultValue' | 'disabled' | 'mentionProvider' | 'contextIdentifierProvider' | 'searchProvider' | 'annotationProviders' | 'collabEditProvider' | 'collabEdit' | 'taskDecisionProvider' | 'extensionProviders' | 'shouldFocus' | 'performanceTracking' | 'quickInsert' | 'secondaryToolbarComponents' | 'featureFlags' | 'trackValidTransactions' | 'primaryToolbarComponents' | 'contextPanel' | 'contentComponents' | 'primaryToolbarIconBefore' | 'sanitizePrivateContent'> & {
4
4
  onChange?: () => void;
5
5
  onEditorReady?: () => void;
6
+ appearance: 'full-page' | 'full-width';
6
7
  };
7
8
  /**
8
9
  * Editor component based on `ComposableEditor` which sets the `appearance` to "full-page".
@@ -13,5 +13,6 @@ export type FullWidthEditorProps = Pick<EditorNextProps, 'preset' | 'defaultValu
13
13
  *
14
14
  * @param props FullWidthEditorProps
15
15
  * @returns Editor component
16
+ * @deprecated In favour of `FullPageEditor` with appearance "full-width"
16
17
  */
17
18
  export declare function FullWidthEditor(props: FullWidthEditorProps): JSX.Element;
@@ -5,9 +5,13 @@
5
5
  import React from 'react';
6
6
  import { jsx } from '@emotion/react';
7
7
  import { type OptionalPlugin } from '@atlaskit/editor-common/types';
8
+ import { type EditorViewModePlugin } from '@atlaskit/editor-plugins/editor-viewmode';
8
9
  import type { MaxContentSizePlugin } from '@atlaskit/editor-plugins/max-content-size';
9
10
  import type { EditorAppearanceComponentProps } from '../../types';
10
- type AppearanceProps = EditorAppearanceComponentProps<[OptionalPlugin<MaxContentSizePlugin>]>;
11
+ type AppearanceProps = EditorAppearanceComponentProps<[
12
+ OptionalPlugin<MaxContentSizePlugin>,
13
+ OptionalPlugin<EditorViewModePlugin>
14
+ ]>;
11
15
  export default class Editor extends React.Component<AppearanceProps> {
12
16
  static displayName: string;
13
17
  private appearance;
@@ -9,6 +9,7 @@ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
9
9
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
10
10
  import type { OptionalPlugin, PublicPluginAPI, ReactHookFactory } from '@atlaskit/editor-common/types';
11
11
  import { type ContextPanelPlugin } from '@atlaskit/editor-plugins/context-panel';
12
+ import { type ViewMode } from '@atlaskit/editor-plugins/editor-viewmode';
12
13
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
13
14
  import type EditorActions from '../../../actions';
14
15
  import type { EventDispatcher } from '../../../event-dispatcher';
@@ -34,6 +35,7 @@ interface FullPageEditorContentAreaProps {
34
35
  providerFactory: ProviderFactory;
35
36
  wrapperElement: HTMLElement | null;
36
37
  featureFlags?: FeatureFlags;
38
+ viewMode: ViewMode | undefined;
37
39
  isEditorToolbarHidden?: boolean;
38
40
  }
39
41
  export declare const CONTENT_AREA_TEST_ID = "ak-editor-fp-content-area";
@@ -1,2 +1,2 @@
1
- export { ToolbarSize, ToolbarWidths, ToolbarWidthsFullPage } from '@atlaskit/editor-common/types';
1
+ export { ToolbarSize, ToolbarWidths, ToolbarWidthsFullPage, ToolbarWidthsFullPageNext, } from '@atlaskit/editor-common/types';
2
2
  export type { ToolbarUiComponentFactoryParams, ToolbarUIComponentFactory, } from '@atlaskit/editor-common/types';
@@ -1,6 +1,19 @@
1
1
  import type { AutoformattingProvider, CardProvider, ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
2
+ import type { OptionalPlugin, PublicPluginAPI } from '@atlaskit/editor-common/types';
3
+ import type { CardPlugin } from '@atlaskit/editor-plugins/card';
4
+ import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugins/context-identifier';
5
+ import { type CustomAutoformatPlugin } from '@atlaskit/editor-plugins/custom-autoformat';
6
+ import { type EmojiPlugin } from '@atlaskit/editor-plugins/emoji';
7
+ import type { MediaPlugin } from '@atlaskit/editor-plugins/media';
2
8
  import { type EmojiProvider } from '@atlaskit/emoji';
3
9
  interface UseProvidersProps {
10
+ editorApi: PublicPluginAPI<[
11
+ OptionalPlugin<ContextIdentifierPlugin>,
12
+ OptionalPlugin<MediaPlugin>,
13
+ OptionalPlugin<CardPlugin>,
14
+ OptionalPlugin<EmojiPlugin>,
15
+ OptionalPlugin<CustomAutoformatPlugin>
16
+ ]> | undefined;
4
17
  contextIdentifierProvider: Promise<ContextIdentifierProvider> | undefined;
5
18
  mediaProvider: Promise<MediaProvider> | undefined;
6
19
  cardProvider: Promise<CardProvider> | undefined;
@@ -15,5 +28,5 @@ interface UseProvidersProps {
15
28
  *
16
29
  * In the future ideally consumers implement this behaviour themselves.
17
30
  */
18
- export declare const useProviders: ({ contextIdentifierProvider, mediaProvider, cardProvider, emojiProvider, autoformattingProvider, }: UseProvidersProps) => void;
31
+ export declare const useProviders: ({ editorApi, contextIdentifierProvider, mediaProvider, cardProvider, emojiProvider, autoformattingProvider, }: UseProvidersProps) => void;
19
32
  export {};
@@ -30,6 +30,7 @@ export interface EditorViewProps {
30
30
  portalProviderAPI: PortalProviderAPI;
31
31
  disabled?: boolean;
32
32
  experienceStore?: ExperienceStore;
33
+ editorAPI: PublicPluginAPI<any> | undefined;
33
34
  setEditorApi?: SetEditorAPI;
34
35
  render?: (props: {
35
36
  editor: JSX.Element;
@@ -3,6 +3,7 @@ import { type EditorNextProps } from '../types/editor-props';
3
3
  export type FullPageEditorProps = Pick<EditorNextProps, 'preset' | 'defaultValue' | 'disabled' | 'mentionProvider' | 'contextIdentifierProvider' | 'searchProvider' | 'annotationProviders' | 'collabEditProvider' | 'collabEdit' | 'taskDecisionProvider' | 'extensionProviders' | 'shouldFocus' | 'performanceTracking' | 'quickInsert' | 'secondaryToolbarComponents' | 'featureFlags' | 'trackValidTransactions' | 'primaryToolbarComponents' | 'contextPanel' | 'contentComponents' | 'primaryToolbarIconBefore' | 'sanitizePrivateContent'> & {
4
4
  onChange?: () => void;
5
5
  onEditorReady?: () => void;
6
+ appearance: 'full-page' | 'full-width';
6
7
  };
7
8
  /**
8
9
  * Editor component based on `ComposableEditor` which sets the `appearance` to "full-page".
@@ -13,5 +13,6 @@ export type FullWidthEditorProps = Pick<EditorNextProps, 'preset' | 'defaultValu
13
13
  *
14
14
  * @param props FullWidthEditorProps
15
15
  * @returns Editor component
16
+ * @deprecated In favour of `FullPageEditor` with appearance "full-width"
16
17
  */
17
18
  export declare function FullWidthEditor(props: FullWidthEditorProps): JSX.Element;
@@ -5,10 +5,12 @@
5
5
  import React from 'react';
6
6
  import { jsx } from '@emotion/react';
7
7
  import { type OptionalPlugin } from '@atlaskit/editor-common/types';
8
+ import { type EditorViewModePlugin } from '@atlaskit/editor-plugins/editor-viewmode';
8
9
  import type { MaxContentSizePlugin } from '@atlaskit/editor-plugins/max-content-size';
9
10
  import type { EditorAppearanceComponentProps } from '../../types';
10
11
  type AppearanceProps = EditorAppearanceComponentProps<[
11
- OptionalPlugin<MaxContentSizePlugin>
12
+ OptionalPlugin<MaxContentSizePlugin>,
13
+ OptionalPlugin<EditorViewModePlugin>
12
14
  ]>;
13
15
  export default class Editor extends React.Component<AppearanceProps> {
14
16
  static displayName: string;
@@ -9,6 +9,7 @@ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
9
9
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
10
10
  import type { OptionalPlugin, PublicPluginAPI, ReactHookFactory } from '@atlaskit/editor-common/types';
11
11
  import { type ContextPanelPlugin } from '@atlaskit/editor-plugins/context-panel';
12
+ import { type ViewMode } from '@atlaskit/editor-plugins/editor-viewmode';
12
13
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
13
14
  import type EditorActions from '../../../actions';
14
15
  import type { EventDispatcher } from '../../../event-dispatcher';
@@ -36,6 +37,7 @@ interface FullPageEditorContentAreaProps {
36
37
  providerFactory: ProviderFactory;
37
38
  wrapperElement: HTMLElement | null;
38
39
  featureFlags?: FeatureFlags;
40
+ viewMode: ViewMode | undefined;
39
41
  isEditorToolbarHidden?: boolean;
40
42
  }
41
43
  export declare const CONTENT_AREA_TEST_ID = "ak-editor-fp-content-area";
@@ -1,2 +1,2 @@
1
- export { ToolbarSize, ToolbarWidths, ToolbarWidthsFullPage } from '@atlaskit/editor-common/types';
1
+ export { ToolbarSize, ToolbarWidths, ToolbarWidthsFullPage, ToolbarWidthsFullPageNext, } from '@atlaskit/editor-common/types';
2
2
  export type { ToolbarUiComponentFactoryParams, ToolbarUIComponentFactory, } from '@atlaskit/editor-common/types';