@atlaskit/editor-core 197.12.0 → 197.13.1

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 (47) hide show
  1. package/CHANGELOG.md +16 -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/ui/Appearance/Chromeless.js +7 -3
  6. package/dist/cjs/ui/Appearance/Comment/Comment.js +5 -3
  7. package/dist/cjs/ui/Appearance/Comment/Toolbar.js +4 -1
  8. package/dist/cjs/ui/Appearance/FullPage/FullPage.js +2 -1
  9. package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
  10. package/dist/cjs/ui/Appearance/FullPage/MainToolbar.js +9 -1
  11. package/dist/cjs/ui/ContentStyles/index.js +2 -3
  12. package/dist/cjs/ui/EditorContext/index.js +10 -3
  13. package/dist/cjs/version-wrapper.js +1 -1
  14. package/dist/es2019/composable-editor/editor-internal.js +18 -6
  15. package/dist/es2019/composable-editor/hooks/useProviders.js +1 -2
  16. package/dist/es2019/create-editor/ReactEditorView.js +28 -3
  17. package/dist/es2019/ui/Appearance/Chromeless.js +6 -1
  18. package/dist/es2019/ui/Appearance/Comment/Comment.js +5 -3
  19. package/dist/es2019/ui/Appearance/Comment/Toolbar.js +5 -0
  20. package/dist/es2019/ui/Appearance/FullPage/FullPage.js +2 -1
  21. package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
  22. package/dist/es2019/ui/Appearance/FullPage/MainToolbar.js +9 -1
  23. package/dist/es2019/ui/ContentStyles/index.js +2 -3
  24. package/dist/es2019/ui/EditorContext/index.js +10 -3
  25. package/dist/es2019/version-wrapper.js +1 -1
  26. package/dist/esm/composable-editor/editor-internal.js +21 -6
  27. package/dist/esm/composable-editor/hooks/useProviders.js +2 -3
  28. package/dist/esm/create-editor/ReactEditorView.js +25 -0
  29. package/dist/esm/ui/Appearance/Chromeless.js +7 -3
  30. package/dist/esm/ui/Appearance/Comment/Comment.js +5 -3
  31. package/dist/esm/ui/Appearance/Comment/Toolbar.js +4 -1
  32. package/dist/esm/ui/Appearance/FullPage/FullPage.js +2 -1
  33. package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
  34. package/dist/esm/ui/Appearance/FullPage/MainToolbar.js +9 -1
  35. package/dist/esm/ui/ContentStyles/index.js +2 -3
  36. package/dist/esm/ui/EditorContext/index.js +10 -3
  37. package/dist/esm/version-wrapper.js +1 -1
  38. package/dist/types/composable-editor/hooks/useProviders.d.ts +14 -1
  39. package/dist/types/create-editor/ReactEditorView.d.ts +1 -0
  40. package/dist/types/ui/Appearance/Chromeless.d.ts +5 -1
  41. package/dist/types/ui/Appearance/FullPage/FullPageContentArea.d.ts +2 -0
  42. package/dist/types-ts4.5/composable-editor/hooks/useProviders.d.ts +14 -1
  43. package/dist/types-ts4.5/create-editor/ReactEditorView.d.ts +1 -0
  44. package/dist/types-ts4.5/ui/Appearance/Chromeless.d.ts +3 -1
  45. package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageContentArea.d.ts +2 -0
  46. package/docs/0-intro.tsx +1 -0
  47. package/package.json +5 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 197.13.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#145587](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/145587)
8
+ [`fc390fa3a6b2a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fc390fa3a6b2a) -
9
+ [ux] Fix Editor toolbar overflow issue for new icons on small screen
10
+
11
+ ## 197.13.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#144103](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/144103)
16
+ [`fa7b54fa5353e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fa7b54fa5353e) -
17
+ Remove the use of usePresetContext in editor-core
18
+
3
19
  ## 197.12.0
4
20
 
5
21
  ### Minor Changes
@@ -12,6 +12,7 @@ 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");
15
16
  var _ErrorBoundary = _interopRequireDefault(require("../create-editor/ErrorBoundary"));
16
17
  var _featureFlagsFromProps = require("../create-editor/feature-flags-from-props");
17
18
  var _ReactEditorView = _interopRequireDefault(require("../create-editor/ReactEditorView"));
@@ -142,7 +143,15 @@ var EditorInternal = exports.EditorInternal = /*#__PURE__*/(0, _react.memo)(func
142
143
  });
143
144
  function ReactEditorViewContextWrapper(props) {
144
145
  var _props$editorProps$me, _props$editorProps$li;
146
+ // deprecated, unable to be FF due to hook usage
145
147
  var setInternalEditorAPI = (0, _context.useSetPresetContext)();
148
+ var presetContextEditorAPI = (0, _context.usePresetContext)();
149
+
150
+ // new way of storing the editorApi when FF platform_editor_remove_use_preset_context is enabled
151
+ var _useState = (0, _react.useState)(undefined),
152
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
153
+ editorAPI = _useState2[0],
154
+ setEditorAPI = _useState2[1];
146
155
 
147
156
  /**
148
157
  * We use the context to retrieve the editorAPI
@@ -152,16 +161,21 @@ function ReactEditorViewContextWrapper(props) {
152
161
  * so we should also set the value for the `EditorContext` that is used in
153
162
  * `EditorInternal`.
154
163
  */
155
- var setEditorAPI = (0, _react.useCallback)(
164
+ var setPresetContextEditorAPI = (0, _react.useCallback)(
156
165
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
157
166
  function (api) {
158
- setInternalEditorAPI === null || setInternalEditorAPI === void 0 || setInternalEditorAPI(api);
159
- }, [setInternalEditorAPI]);
167
+ if ((0, _platformFeatureFlags.fg)('platform_editor_remove_use_preset_context')) {
168
+ setEditorAPI(api);
169
+ } else {
170
+ setInternalEditorAPI === null || setInternalEditorAPI === void 0 || setInternalEditorAPI(api);
171
+ }
172
+ }, [setInternalEditorAPI, setEditorAPI]);
160
173
 
161
174
  // 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
162
175
  var UNSAFE_cards = props.editorProps.UNSAFE_cards;
163
176
  var smartLinks = props.editorProps.smartLinks;
164
177
  (0, _useProviders.useProviders)({
178
+ editorApi: (0, _platformFeatureFlags.fg)('platform_editor_remove_use_preset_context') ? editorAPI : presetContextEditorAPI,
165
179
  contextIdentifierProvider: props.editorProps.contextIdentifierProvider,
166
180
  mediaProvider: (_props$editorProps$me = props.editorProps.media) === null || _props$editorProps$me === void 0 ? void 0 : _props$editorProps$me.provider,
167
181
  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,
@@ -169,6 +183,7 @@ function ReactEditorViewContextWrapper(props) {
169
183
  autoformattingProvider: props.editorProps.autoformattingProvider
170
184
  });
171
185
  return (0, _react2.jsx)(_ReactEditorView.default, (0, _extends2.default)({}, props, {
172
- setEditorApi: setEditorAPI
186
+ editorAPI: editorAPI,
187
+ setEditorApi: setPresetContextEditorAPI
173
188
  }));
174
189
  }
@@ -9,7 +9,6 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _react = require("react");
11
11
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
- var _context2 = require("../../presets/context");
13
12
  /**
14
13
  * This hook is used to replace the old approach of using the `providerFactory`.
15
14
  *
@@ -19,12 +18,12 @@ var _context2 = require("../../presets/context");
19
18
  * In the future ideally consumers implement this behaviour themselves.
20
19
  */
21
20
  var useProviders = exports.useProviders = function useProviders(_ref) {
22
- var contextIdentifierProvider = _ref.contextIdentifierProvider,
21
+ var editorApi = _ref.editorApi,
22
+ contextIdentifierProvider = _ref.contextIdentifierProvider,
23
23
  mediaProvider = _ref.mediaProvider,
24
24
  cardProvider = _ref.cardProvider,
25
25
  emojiProvider = _ref.emojiProvider,
26
26
  autoformattingProvider = _ref.autoformattingProvider;
27
- var editorApi = (0, _context2.usePresetContext)();
28
27
  (0, _react.useEffect)(function () {
29
28
  function setProvider() {
30
29
  return _setProvider.apply(this, arguments);
@@ -769,6 +769,31 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
769
769
  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;
770
770
  var renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
771
771
  var useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
772
+ if ((0, _platformFeatureFlags.fg)('platform_editor_remove_use_preset_context')) {
773
+ var _this$props$render, _this$props$render2, _this$props;
774
+ return /*#__PURE__*/_react.default.createElement(_ReactEditorViewContext.default.Provider, {
775
+ value: {
776
+ editorRef: this.editorRef,
777
+ editorView: this.view,
778
+ popupsMountPoint: this.props.editorProps.popupsMountPoint
779
+ }
780
+ }, renderTrackingEnabled && /*#__PURE__*/_react.default.createElement(_RenderTracking.RenderTracking, {
781
+ componentProps: this.props,
782
+ action: _analytics.ACTION.RE_RENDERED,
783
+ actionSubject: _analytics.ACTION_SUBJECT.REACT_EDITOR_VIEW,
784
+ handleAnalyticsEvent: this.handleAnalyticsEvent,
785
+ useShallow: useShallow
786
+ }), 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, {
787
+ editor: this.editor,
788
+ view: this.view,
789
+ config: this.config,
790
+ eventDispatcher: this.eventDispatcher,
791
+ transformer: this.contentTransformer,
792
+ dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
793
+ editorRef: this.editorRef,
794
+ editorAPI: this.props.editorAPI
795
+ })) !== null && _this$props$render !== void 0 ? _this$props$render : this.editor : this.editor);
796
+ }
772
797
  return /*#__PURE__*/_react.default.createElement(_ReactEditorViewContext.default.Provider, {
773
798
  value: {
774
799
  editorRef: this.editorRef,
@@ -17,6 +17,7 @@ var _react = _interopRequireWildcard(require("react"));
17
17
  var _react2 = require("@emotion/react");
18
18
  var _hooks = require("@atlaskit/editor-common/hooks");
19
19
  var _scrollbar = require("@atlaskit/editor-shared-styles/scrollbar");
20
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
21
  var _ContentStyles = require("../ContentStyles");
21
22
  var _PluginSlot = _interopRequireDefault(require("../PluginSlot"));
22
23
  var _WithFlash = _interopRequireDefault(require("../WithFlash"));
@@ -85,6 +86,8 @@ var Editor = exports.default = /*#__PURE__*/function (_React$Component) {
85
86
  pluginHooks = _this$props.pluginHooks,
86
87
  featureFlags = _this$props.featureFlags;
87
88
  var maxContentSizeReached = Boolean(maxContentSize === null || maxContentSize === void 0 ? void 0 : maxContentSize.maxContentSizeReached);
89
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(_this.props.editorAPI, ['editorViewMode']),
90
+ editorViewModeState = _useSharedPluginState.editorViewModeState;
88
91
  return (0, _react2.jsx)(_WithFlash.default, {
89
92
  animate: maxContentSizeReached
90
93
  }, (0, _react2.jsx)("div", {
@@ -107,7 +110,8 @@ var Editor = exports.default = /*#__PURE__*/function (_React$Component) {
107
110
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
108
111
  , {
109
112
  className: "ak-editor-content-area",
110
- featureFlags: featureFlags
113
+ featureFlags: featureFlags,
114
+ viewMode: (0, _platformFeatureFlags.fg)('platform_editor_remove_use_preset_context') ? editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode : undefined
111
115
  }, customContentComponents && 'before' in customContentComponents ? customContentComponents.before : customContentComponents, (0, _react2.jsx)(_PluginSlot.default, {
112
116
  editorView: editorView,
113
117
  editorActions: editorActions,
@@ -142,8 +146,8 @@ var Editor = exports.default = /*#__PURE__*/function (_React$Component) {
142
146
  function RenderWithPluginState(_ref3) {
143
147
  var renderChrome = _ref3.renderChrome,
144
148
  editorAPI = _ref3.editorAPI;
145
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(editorAPI, ['maxContentSize']),
146
- maxContentSizeState = _useSharedPluginState.maxContentSizeState;
149
+ var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(editorAPI, ['maxContentSize']),
150
+ maxContentSizeState = _useSharedPluginState2.maxContentSizeState;
147
151
  return (0, _react2.jsx)(_react.Fragment, null, renderChrome({
148
152
  maxContentSize: maxContentSizeState
149
153
  }));
@@ -85,10 +85,11 @@ var secondaryToolbarStyles = (0, _react2.css)({
85
85
  var appearance = 'comment';
86
86
  var CommentEditorWithIntl = exports.CommentEditorWithIntl = function CommentEditorWithIntl(props) {
87
87
  var editorAPI = props.editorAPI;
88
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(editorAPI, ['media', 'maxContentSize', 'primaryToolbar']),
88
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(editorAPI, ['media', 'maxContentSize', 'primaryToolbar', 'editorViewMode']),
89
89
  mediaState = _useSharedPluginState.mediaState,
90
90
  maxContentSizeState = _useSharedPluginState.maxContentSizeState,
91
- primaryToolbarState = _useSharedPluginState.primaryToolbarState;
91
+ primaryToolbarState = _useSharedPluginState.primaryToolbarState,
92
+ editorViewModeState = _useSharedPluginState.editorViewModeState;
92
93
  var intl = (0, _reactIntlNext.useIntl)();
93
94
  var editorDOMElement = props.editorDOMElement,
94
95
  editorView = props.editorView,
@@ -218,7 +219,8 @@ var CommentEditorWithIntl = exports.CommentEditorWithIntl = function CommentEdit
218
219
  className: (0, _classnames.default)('ak-editor-content-area', {
219
220
  'less-margin': width < _editorSharedStyles.akEditorMobileBreakoutPoint
220
221
  }),
221
- featureFlags: featureFlags
222
+ featureFlags: featureFlags,
223
+ viewMode: (0, _platformFeatureFlags.fg)('platform_editor_remove_use_preset_context') ? editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode : undefined
222
224
  }, customContentComponents && 'before' in customContentComponents ? customContentComponents.before : customContentComponents, (0, _react2.jsx)(_PluginSlot.default, {
223
225
  editorView: editorView,
224
226
  editorActions: editorActions,
@@ -13,6 +13,7 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
13
13
  var _react = _interopRequireWildcard(require("react"));
14
14
  var _react2 = require("@emotion/react");
15
15
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
16
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
17
  var _templateObject, _templateObject2, _templateObject3;
17
18
  /**
18
19
  * @jsxRuntime classic
@@ -23,11 +24,13 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
23
24
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
24
25
  var MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT = 490;
25
26
 
27
+ /* eslint-disable @atlaskit/platform/ensure-feature-flag-registration */
26
28
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
27
29
  var mainToolbarWrapperStyle = function mainToolbarWrapperStyle() {
28
30
  var isTwoLineEditorToolbar = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
29
- return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\tposition: relative;\n\talign-items: center;\n\tpadding: ", " ", " 0;\n\tdisplay: flex;\n\theight: auto;\n\tbackground-color: ", ";\n\tbox-shadow: none;\n\tpadding-left: ", ";\n\n\t& > div {\n\t\t> :first-child:not(style),\n\t\t> style:first-child + * {\n\t\t\tmargin-left: 0;\n\t\t}\n\t\t", "\n\t}\n\n\t.block-type-btn {\n\t\tpadding-left: 0;\n\t}\n"])), "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", "var(--ds-surface, white)", "var(--ds-space-250, 20px)", isTwoLineEditorToolbar && "\n @media (max-width: ".concat(MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT, "px) {\n flex-direction: column-reverse;\n align-items: end;\n display: flex;\n justify-content: flex-end;\n }\n\n //make this more explicit for a toolbar\n > *:nth-child(1) {\n @media (max-width: ").concat(MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT, "px) {\n > div:nth-child(2) {\n justify-content: flex-end;\n display: flex;\n }\n }\n }\n "));
31
+ return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\tposition: relative;\n\talign-items: center;\n\tpadding: ", " ", " 0;\n\tdisplay: flex;\n\theight: auto;\n\tbackground-color: ", ";\n\tbox-shadow: none;\n\tpadding-left: ", ";\n\n\t& > div {\n\t\t> :first-child:not(style),\n\t\t> style:first-child + * {\n\t\t\tmargin-left: 0;\n\t\t}\n\t\t", "\n\t}\n\n\t.block-type-btn {\n\t\tpadding-left: 0;\n\t}\n\n\t", "\n"])), "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", "var(--ds-surface, white)", "var(--ds-space-250, 20px)", isTwoLineEditorToolbar && "\n @media (max-width: ".concat(MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT, "px) {\n flex-direction: column-reverse;\n align-items: end;\n display: flex;\n justify-content: flex-end;\n }\n\n //make this more explicit for a toolbar\n > *:nth-child(1) {\n @media (max-width: ").concat(MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT, "px) {\n > div:nth-child(2) {\n justify-content: flex-end;\n display: flex;\n }\n }\n }\n "), (0, _platformFeatureFlags.fg)('platform.design-system-team.enable-new-icons') && 'span svg { max-width: 100%; }');
30
32
  };
33
+ /* eslint-enable @atlaskit/platform/ensure-feature-flag-registration */
31
34
 
32
35
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
33
36
  var stickyToolbarWrapperStyle = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n\t/* stylelint-disable declaration-block-no-duplicate-properties */\n\tposition: relative;\n\tposition: sticky;\n\t/* stylelint-enable declaration-block-no-duplicate-properties */\n\tpadding-bottom: ", ";\n\tz-index: ", ";\n\ttransition: box-shadow ease-in-out 0.2s;\n\t&.show-keyline {\n\t\tbox-shadow: 0 ", "px 0 0\n\t\t\t", ";\n\t}\n"])), "var(--ds-space-100, 8px)", _editorSharedStyles.akEditorMenuZIndex, _editorSharedStyles.akEditorToolbarKeylineHeight, "var(--ds-background-accent-gray-subtlest, #F1F2F4)");
@@ -118,6 +118,7 @@ var FullPageEditor = exports.FullPageEditor = function FullPageEditor(props) {
118
118
  wrapperElement: (_wrapperElementRef$cu = wrapperElementRef === null || wrapperElementRef === void 0 ? void 0 : wrapperElementRef.current) !== null && _wrapperElementRef$cu !== void 0 ? _wrapperElementRef$cu : null,
119
119
  pluginHooks: props.pluginHooks,
120
120
  featureFlags: props.featureFlags,
121
- isEditorToolbarHidden: isEditorToolbarHidden
121
+ isEditorToolbarHidden: isEditorToolbarHidden,
122
+ viewMode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
122
123
  })));
123
124
  };
@@ -60,7 +60,8 @@ var Content = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
60
60
  , {
61
61
  className: "fabric-editor-popup-scroll-parent",
62
62
  featureFlags: props.featureFlags,
63
- ref: scrollContainerRef
63
+ ref: scrollContainerRef,
64
+ viewMode: (0, _platformFeatureFlags.fg)('platform_editor_remove_use_preset_context') ? props === null || props === void 0 ? void 0 : props.viewMode : undefined
64
65
  }, (0, _react2.jsx)(_Addon.ClickAreaBlock, {
65
66
  editorView: props.editorView,
66
67
  editorDisabled: props.disabled
@@ -27,6 +27,12 @@ var mainToolbarTwoLineStyle = function mainToolbarTwoLineStyle() {
27
27
  height: "calc(".concat(editorToolbarHeight, " * 2)")
28
28
  }));
29
29
  };
30
+ var flexibleIconSize = (0, _react.css)({
31
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
32
+ '& span svg': {
33
+ maxWidth: '100%'
34
+ }
35
+ });
30
36
  var mainToolbar = function mainToolbar() {
31
37
  var editorToolbarHeight = (0, _editorSharedStyles.FULL_PAGE_EDITOR_TOOLBAR_HEIGHT)();
32
38
  return (0, _react.css)((0, _defineProperty2.default)({
@@ -53,7 +59,9 @@ var mainToolbar = function mainToolbar() {
53
59
  display: 'grid',
54
60
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
55
61
  height: "calc(".concat(editorToolbarHeight, " * 2)")
56
- }));
62
+ }),
63
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/platform/ensure-feature-flag-registration, @atlaskit/ui-styling-standard/no-unsafe-values
64
+ (0, _platformFeatureFlags.fg)('platform.design-system-team.enable-new-icons') && flexibleIconSize);
57
65
  };
58
66
  var mainToolbarStyle = exports.mainToolbarStyle = function mainToolbarStyle(showKeyline, twoLineEditorToolbar) {
59
67
  return [mainToolbar, showKeyline && mainToolbarWithKeyline, twoLineEditorToolbar && mainToolbarTwoLineStyle];
@@ -101,15 +101,14 @@ var createEditorContentStyle = exports.createEditorContentStyle = function creat
101
101
  var editorAPI = (0, _context.usePresetContext)();
102
102
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(editorAPI, ['editorViewMode']),
103
103
  editorViewModeState = _useSharedPluginState.editorViewModeState;
104
- var viewMode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
105
104
  var memoizedStyle = (0, _react.useMemo)(function () {
106
105
  return contentStyles({
107
106
  theme: theme,
108
107
  colorMode: colorMode,
109
108
  featureFlags: featureFlags,
110
- viewMode: viewMode
109
+ viewMode: (0, _platformFeatureFlags.fg)('platform_editor_remove_use_preset_context') ? props.viewMode : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
111
110
  });
112
- }, [theme, colorMode, featureFlags, viewMode]);
111
+ }, [theme, colorMode, featureFlags, editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode, props.viewMode]);
113
112
  return (
114
113
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
115
114
  (0, _react2.jsx)("div", {
@@ -13,6 +13,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
14
  var _react = _interopRequireDefault(require("react"));
15
15
  var _propTypes = _interopRequireDefault(require("prop-types"));
16
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
17
  var _actions = _interopRequireDefault(require("../../actions"));
17
18
  var _context = require("../../presets/context");
18
19
  function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
@@ -41,9 +42,15 @@ var LegacyEditorContext = exports.default = /*#__PURE__*/function (_React$Compon
41
42
  }, {
42
43
  key: "render",
43
44
  value: function render() {
44
- return /*#__PURE__*/_react.default.createElement(EditorContext.Provider, {
45
- value: this.getChildContext()
46
- }, /*#__PURE__*/_react.default.createElement(_context.PresetContextProvider, null, this.props.children));
45
+ if ((0, _platformFeatureFlags.fg)('platform_editor_remove_use_preset_context')) {
46
+ return /*#__PURE__*/_react.default.createElement(EditorContext.Provider, {
47
+ value: this.getChildContext()
48
+ }, this.props.children);
49
+ } else {
50
+ return /*#__PURE__*/_react.default.createElement(EditorContext.Provider, {
51
+ value: this.getChildContext()
52
+ }, /*#__PURE__*/_react.default.createElement(_context.PresetContextProvider, null, this.props.children));
53
+ }
47
54
  }
48
55
  }]);
49
56
  return LegacyEditorContext;
@@ -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.12.0";
8
+ var version = exports.version = "197.13.1";
@@ -3,17 +3,18 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  * @jsxRuntime classic
4
4
  * @jsx jsx
5
5
  */
6
- import { Fragment, memo, useCallback } from 'react';
6
+ import { Fragment, memo, useCallback, useState } from 'react';
7
7
 
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
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';
12
13
  import ErrorBoundary from '../create-editor/ErrorBoundary';
13
14
  import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
14
15
  import ReactEditorView from '../create-editor/ReactEditorView';
15
16
  import { ContextAdapter } from '../nodeviews/context-adapter';
16
- import { useSetPresetContext } from '../presets/context';
17
+ import { usePresetContext, useSetPresetContext } from '../presets/context';
17
18
  import EditorContext from '../ui/EditorContext';
18
19
  import { IntlProviderIfMissingWrapper } from '../ui/IntlProviderIfMissingWrapper/IntlProviderIfMissingWrapper';
19
20
  import { RenderTracking } from '../utils/performance/components/RenderTracking';
@@ -134,7 +135,12 @@ export const EditorInternal = /*#__PURE__*/memo(({
134
135
  });
135
136
  function ReactEditorViewContextWrapper(props) {
136
137
  var _props$editorProps$me, _props$editorProps$li, _props$editorProps$li2;
138
+ // deprecated, unable to be FF due to hook usage
137
139
  const setInternalEditorAPI = useSetPresetContext();
140
+ const presetContextEditorAPI = usePresetContext();
141
+
142
+ // new way of storing the editorApi when FF platform_editor_remove_use_preset_context is enabled
143
+ const [editorAPI, setEditorAPI] = useState(undefined);
138
144
 
139
145
  /**
140
146
  * We use the context to retrieve the editorAPI
@@ -144,16 +150,21 @@ function ReactEditorViewContextWrapper(props) {
144
150
  * so we should also set the value for the `EditorContext` that is used in
145
151
  * `EditorInternal`.
146
152
  */
147
- const setEditorAPI = useCallback(
153
+ const setPresetContextEditorAPI = useCallback(
148
154
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
149
155
  api => {
150
- setInternalEditorAPI === null || setInternalEditorAPI === void 0 ? void 0 : setInternalEditorAPI(api);
151
- }, [setInternalEditorAPI]);
156
+ if (fg('platform_editor_remove_use_preset_context')) {
157
+ setEditorAPI(api);
158
+ } else {
159
+ setInternalEditorAPI === null || setInternalEditorAPI === void 0 ? void 0 : setInternalEditorAPI(api);
160
+ }
161
+ }, [setInternalEditorAPI, setEditorAPI]);
152
162
 
153
163
  // 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
154
164
  const UNSAFE_cards = props.editorProps.UNSAFE_cards;
155
165
  const smartLinks = props.editorProps.smartLinks;
156
166
  useProviders({
167
+ editorApi: fg('platform_editor_remove_use_preset_context') ? editorAPI : presetContextEditorAPI,
157
168
  contextIdentifierProvider: props.editorProps.contextIdentifierProvider,
158
169
  mediaProvider: (_props$editorProps$me = props.editorProps.media) === null || _props$editorProps$me === void 0 ? void 0 : _props$editorProps$me.provider,
159
170
  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,
@@ -161,6 +172,7 @@ function ReactEditorViewContextWrapper(props) {
161
172
  autoformattingProvider: props.editorProps.autoformattingProvider
162
173
  });
163
174
  return jsx(ReactEditorView, _extends({}, props, {
164
- setEditorApi: setEditorAPI
175
+ editorAPI: editorAPI,
176
+ setEditorApi: setPresetContextEditorAPI
165
177
  }));
166
178
  }
@@ -1,6 +1,5 @@
1
1
  import { useEffect } from 'react';
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
- import { usePresetContext } from '../../presets/context';
4
3
  /**
5
4
  * This hook is used to replace the old approach of using the `providerFactory`.
6
5
  *
@@ -10,13 +9,13 @@ import { usePresetContext } from '../../presets/context';
10
9
  * In the future ideally consumers implement this behaviour themselves.
11
10
  */
12
11
  export const useProviders = ({
12
+ editorApi,
13
13
  contextIdentifierProvider,
14
14
  mediaProvider,
15
15
  cardProvider,
16
16
  emojiProvider,
17
17
  autoformattingProvider
18
18
  }) => {
19
- const editorApi = usePresetContext();
20
19
  useEffect(() => {
21
20
  async function setProvider() {
22
21
  var _editorApi$core, _editorApi$contextIde;
@@ -712,6 +712,31 @@ export class ReactEditorView extends React.Component {
712
712
  const renderTracking = (_this$props$editorPro14 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro14 === void 0 ? void 0 : (_this$props$editorPro15 = _this$props$editorPro14.renderTracking) === null || _this$props$editorPro15 === void 0 ? void 0 : _this$props$editorPro15.reactEditorView;
713
713
  const renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
714
714
  const useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
715
+ if (fg('platform_editor_remove_use_preset_context')) {
716
+ var _this$props$render, _this$props$render2, _this$props;
717
+ return /*#__PURE__*/React.createElement(ReactEditorViewContext.Provider, {
718
+ value: {
719
+ editorRef: this.editorRef,
720
+ editorView: this.view,
721
+ popupsMountPoint: this.props.editorProps.popupsMountPoint
722
+ }
723
+ }, renderTrackingEnabled && /*#__PURE__*/React.createElement(RenderTracking, {
724
+ componentProps: this.props,
725
+ action: ACTION.RE_RENDERED,
726
+ actionSubject: ACTION_SUBJECT.REACT_EDITOR_VIEW,
727
+ handleAnalyticsEvent: this.handleAnalyticsEvent,
728
+ useShallow: useShallow
729
+ }), 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, {
730
+ editor: this.editor,
731
+ view: this.view,
732
+ config: this.config,
733
+ eventDispatcher: this.eventDispatcher,
734
+ transformer: this.contentTransformer,
735
+ dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
736
+ editorRef: this.editorRef,
737
+ editorAPI: this.props.editorAPI
738
+ })) !== null && _this$props$render !== void 0 ? _this$props$render : this.editor : this.editor);
739
+ }
715
740
  return /*#__PURE__*/React.createElement(ReactEditorViewContext.Provider, {
716
741
  value: {
717
742
  editorRef: this.editorRef,
@@ -727,8 +752,8 @@ export class ReactEditorView extends React.Component {
727
752
  }), this.props.render ? /*#__PURE__*/React.createElement(EditorAPIContext.Consumer, null, ({
728
753
  editorApi
729
754
  }) => {
730
- var _this$props$render, _this$props$render2, _this$props;
731
- return (_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, {
755
+ var _this$props$render3, _this$props$render4, _this$props2;
756
+ return (_this$props$render3 = (_this$props$render4 = (_this$props2 = this.props).render) === null || _this$props$render4 === void 0 ? void 0 : _this$props$render4.call(_this$props2, {
732
757
  editor: this.editor,
733
758
  view: this.view,
734
759
  config: this.config,
@@ -737,7 +762,7 @@ export class ReactEditorView extends React.Component {
737
762
  dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
738
763
  editorRef: this.editorRef,
739
764
  editorAPI: editorApi
740
- })) !== null && _this$props$render !== void 0 ? _this$props$render : this.editor;
765
+ })) !== null && _this$props$render3 !== void 0 ? _this$props$render3 : this.editor;
741
766
  }) : this.editor);
742
767
  }
743
768
  }
@@ -9,6 +9,7 @@ import React, { Fragment } from 'react';
9
9
  import { css, jsx } from '@emotion/react';
10
10
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
11
11
  import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
12
+ import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { createEditorContentStyle } from '../ContentStyles';
13
14
  import PluginSlot from '../PluginSlot';
14
15
  import WithFlash from '../WithFlash';
@@ -64,6 +65,9 @@ export default class Editor extends React.Component {
64
65
  featureFlags
65
66
  } = this.props;
66
67
  const maxContentSizeReached = Boolean(maxContentSize === null || maxContentSize === void 0 ? void 0 : maxContentSize.maxContentSizeReached);
68
+ const {
69
+ editorViewModeState
70
+ } = useSharedPluginState(this.props.editorAPI, ['editorViewMode']);
67
71
  return jsx(WithFlash, {
68
72
  animate: maxContentSizeReached
69
73
  }, jsx("div", {
@@ -84,7 +88,8 @@ export default class Editor extends React.Component {
84
88
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
85
89
  , {
86
90
  className: "ak-editor-content-area",
87
- featureFlags: featureFlags
91
+ featureFlags: featureFlags,
92
+ viewMode: fg('platform_editor_remove_use_preset_context') ? editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode : undefined
88
93
  }, customContentComponents && 'before' in customContentComponents ? customContentComponents.before : customContentComponents, jsx(PluginSlot, {
89
94
  editorView: editorView,
90
95
  editorActions: editorActions,
@@ -78,8 +78,9 @@ export const CommentEditorWithIntl = props => {
78
78
  const {
79
79
  mediaState,
80
80
  maxContentSizeState,
81
- primaryToolbarState
82
- } = useSharedPluginState(editorAPI, ['media', 'maxContentSize', 'primaryToolbar']);
81
+ primaryToolbarState,
82
+ editorViewModeState
83
+ } = useSharedPluginState(editorAPI, ['media', 'maxContentSize', 'primaryToolbar', 'editorViewMode']);
83
84
  const intl = useIntl();
84
85
  const {
85
86
  editorDOMElement,
@@ -204,7 +205,8 @@ export const CommentEditorWithIntl = props => {
204
205
  className: classnames('ak-editor-content-area', {
205
206
  'less-margin': width < akEditorMobileBreakoutPoint
206
207
  }),
207
- featureFlags: featureFlags
208
+ featureFlags: featureFlags,
209
+ viewMode: fg('platform_editor_remove_use_preset_context') ? editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode : undefined
208
210
  }, customContentComponents && 'before' in customContentComponents ? customContentComponents.before : customContentComponents, jsx(PluginSlot, {
209
211
  editorView: editorView,
210
212
  editorActions: editorActions,
@@ -9,8 +9,10 @@ import React, { useEffect, useState } from 'react';
9
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
10
  import { css, jsx } from '@emotion/react';
11
11
  import { akEditorMenuZIndex, akEditorToolbarKeylineHeight } from '@atlaskit/editor-shared-styles';
12
+ import { fg } from '@atlaskit/platform-feature-flags';
12
13
  const MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT = 490;
13
14
 
15
+ /* eslint-disable @atlaskit/platform/ensure-feature-flag-registration */
14
16
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
15
17
  const mainToolbarWrapperStyle = (isTwoLineEditorToolbar = false) => css`
16
18
  position: relative;
@@ -50,7 +52,10 @@ const mainToolbarWrapperStyle = (isTwoLineEditorToolbar = false) => css`
50
52
  .block-type-btn {
51
53
  padding-left: 0;
52
54
  }
55
+
56
+ ${fg('platform.design-system-team.enable-new-icons') && 'span svg { max-width: 100%; }'}
53
57
  `;
58
+ /* eslint-enable @atlaskit/platform/ensure-feature-flag-registration */
54
59
 
55
60
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
56
61
  const stickyToolbarWrapperStyle = css`
@@ -100,6 +100,7 @@ export const FullPageEditor = props => {
100
100
  wrapperElement: (_wrapperElementRef$cu = wrapperElementRef === null || wrapperElementRef === void 0 ? void 0 : wrapperElementRef.current) !== null && _wrapperElementRef$cu !== void 0 ? _wrapperElementRef$cu : null,
101
101
  pluginHooks: props.pluginHooks,
102
102
  featureFlags: props.featureFlags,
103
- isEditorToolbarHidden: isEditorToolbarHidden
103
+ isEditorToolbarHidden: isEditorToolbarHidden,
104
+ viewMode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
104
105
  })));
105
106
  };
@@ -48,7 +48,8 @@ const Content = /*#__PURE__*/React.forwardRef((props, ref) => {
48
48
  , {
49
49
  className: "fabric-editor-popup-scroll-parent",
50
50
  featureFlags: props.featureFlags,
51
- ref: scrollContainerRef
51
+ ref: scrollContainerRef,
52
+ viewMode: fg('platform_editor_remove_use_preset_context') ? props === null || props === void 0 ? void 0 : props.viewMode : undefined
52
53
  }, jsx(ClickAreaBlock, {
53
54
  editorView: props.editorView,
54
55
  editorDisabled: props.disabled
@@ -22,6 +22,12 @@ const mainToolbarTwoLineStyle = () => {
22
22
  }
23
23
  });
24
24
  };
25
+ const flexibleIconSize = css({
26
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
27
+ '& span svg': {
28
+ maxWidth: '100%'
29
+ }
30
+ });
25
31
  const mainToolbar = () => {
26
32
  const editorToolbarHeight = FULL_PAGE_EDITOR_TOOLBAR_HEIGHT();
27
33
  return css({
@@ -50,7 +56,9 @@ const mainToolbar = () => {
50
56
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
51
57
  height: `calc(${editorToolbarHeight} * 2)`
52
58
  }
53
- });
59
+ },
60
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/platform/ensure-feature-flag-registration, @atlaskit/ui-styling-standard/no-unsafe-values
61
+ fg('platform.design-system-team.enable-new-icons') && flexibleIconSize);
54
62
  };
55
63
  export const mainToolbarStyle = (showKeyline, twoLineEditorToolbar) => [mainToolbar, showKeyline && mainToolbarWithKeyline, twoLineEditorToolbar && mainToolbarTwoLineStyle];
56
64
 
@@ -372,13 +372,12 @@ export const createEditorContentStyle = styles => {
372
372
  const {
373
373
  editorViewModeState
374
374
  } = useSharedPluginState(editorAPI, ['editorViewMode']);
375
- const viewMode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
376
375
  const memoizedStyle = useMemo(() => contentStyles({
377
376
  theme,
378
377
  colorMode,
379
378
  featureFlags,
380
- viewMode
381
- }), [theme, colorMode, featureFlags, viewMode]);
379
+ viewMode: fg('platform_editor_remove_use_preset_context') ? props.viewMode : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
380
+ }), [theme, colorMode, featureFlags, editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode, props.viewMode]);
382
381
  return (
383
382
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
384
383
  jsx("div", {
@@ -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,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "197.12.0";
2
+ export const version = "197.13.1";
@@ -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,
@@ -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,
@@ -13,13 +13,16 @@ import React, { useEffect, useState } from 'react';
13
13
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
14
14
  import { css, jsx } from '@emotion/react';
15
15
  import { akEditorMenuZIndex, akEditorToolbarKeylineHeight } from '@atlaskit/editor-shared-styles';
16
+ import { fg } from '@atlaskit/platform-feature-flags';
16
17
  var MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT = 490;
17
18
 
19
+ /* eslint-disable @atlaskit/platform/ensure-feature-flag-registration */
18
20
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
19
21
  var mainToolbarWrapperStyle = function mainToolbarWrapperStyle() {
20
22
  var isTwoLineEditorToolbar = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
21
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tposition: relative;\n\talign-items: center;\n\tpadding: ", " ", " 0;\n\tdisplay: flex;\n\theight: auto;\n\tbackground-color: ", ";\n\tbox-shadow: none;\n\tpadding-left: ", ";\n\n\t& > div {\n\t\t> :first-child:not(style),\n\t\t> style:first-child + * {\n\t\t\tmargin-left: 0;\n\t\t}\n\t\t", "\n\t}\n\n\t.block-type-btn {\n\t\tpadding-left: 0;\n\t}\n"])), "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", "var(--ds-surface, white)", "var(--ds-space-250, 20px)", isTwoLineEditorToolbar && "\n @media (max-width: ".concat(MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT, "px) {\n flex-direction: column-reverse;\n align-items: end;\n display: flex;\n justify-content: flex-end;\n }\n\n //make this more explicit for a toolbar\n > *:nth-child(1) {\n @media (max-width: ").concat(MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT, "px) {\n > div:nth-child(2) {\n justify-content: flex-end;\n display: flex;\n }\n }\n }\n "));
23
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tposition: relative;\n\talign-items: center;\n\tpadding: ", " ", " 0;\n\tdisplay: flex;\n\theight: auto;\n\tbackground-color: ", ";\n\tbox-shadow: none;\n\tpadding-left: ", ";\n\n\t& > div {\n\t\t> :first-child:not(style),\n\t\t> style:first-child + * {\n\t\t\tmargin-left: 0;\n\t\t}\n\t\t", "\n\t}\n\n\t.block-type-btn {\n\t\tpadding-left: 0;\n\t}\n\n\t", "\n"])), "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", "var(--ds-surface, white)", "var(--ds-space-250, 20px)", isTwoLineEditorToolbar && "\n @media (max-width: ".concat(MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT, "px) {\n flex-direction: column-reverse;\n align-items: end;\n display: flex;\n justify-content: flex-end;\n }\n\n //make this more explicit for a toolbar\n > *:nth-child(1) {\n @media (max-width: ").concat(MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT, "px) {\n > div:nth-child(2) {\n justify-content: flex-end;\n display: flex;\n }\n }\n }\n "), fg('platform.design-system-team.enable-new-icons') && 'span svg { max-width: 100%; }');
22
24
  };
25
+ /* eslint-enable @atlaskit/platform/ensure-feature-flag-registration */
23
26
 
24
27
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
25
28
  var stickyToolbarWrapperStyle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n\t/* stylelint-disable declaration-block-no-duplicate-properties */\n\tposition: relative;\n\tposition: sticky;\n\t/* stylelint-enable declaration-block-no-duplicate-properties */\n\tpadding-bottom: ", ";\n\tz-index: ", ";\n\ttransition: box-shadow ease-in-out 0.2s;\n\t&.show-keyline {\n\t\tbox-shadow: 0 ", "px 0 0\n\t\t\t", ";\n\t}\n"])), "var(--ds-space-100, 8px)", akEditorMenuZIndex, akEditorToolbarKeylineHeight, "var(--ds-background-accent-gray-subtlest, #F1F2F4)");
@@ -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
@@ -19,6 +19,12 @@ var mainToolbarTwoLineStyle = function mainToolbarTwoLineStyle() {
19
19
  height: "calc(".concat(editorToolbarHeight, " * 2)")
20
20
  }));
21
21
  };
22
+ var flexibleIconSize = css({
23
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
24
+ '& span svg': {
25
+ maxWidth: '100%'
26
+ }
27
+ });
22
28
  var mainToolbar = function mainToolbar() {
23
29
  var editorToolbarHeight = FULL_PAGE_EDITOR_TOOLBAR_HEIGHT();
24
30
  return css(_defineProperty({
@@ -45,7 +51,9 @@ var mainToolbar = function mainToolbar() {
45
51
  display: 'grid',
46
52
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
47
53
  height: "calc(".concat(editorToolbarHeight, " * 2)")
48
- }));
54
+ }),
55
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/platform/ensure-feature-flag-registration, @atlaskit/ui-styling-standard/no-unsafe-values
56
+ fg('platform.design-system-team.enable-new-icons') && flexibleIconSize);
49
57
  };
50
58
  export var mainToolbarStyle = function mainToolbarStyle(showKeyline, twoLineEditorToolbar) {
51
59
  return [mainToolbar, showKeyline && mainToolbarWithKeyline, twoLineEditorToolbar && mainToolbarTwoLineStyle];
@@ -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,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "197.12.0";
2
+ export var version = "197.13.1";
@@ -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;
@@ -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,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;
@@ -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";
package/docs/0-intro.tsx CHANGED
@@ -34,6 +34,7 @@ ${(<AtlassianInternalWarning />)}
34
34
  ## Usage
35
35
 
36
36
  ### [Legacy Editor](editor-core/docs/legacy-editor)
37
+ Note: The legacy editor is deprecated. There is an example to help with migration at https://atlaskit.atlassian.com/examples/editor/editor-core/legacy-editor-migrator
37
38
 
38
39
 
39
40
  ### Composable Editor
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "197.12.0",
3
+ "version": "197.13.1",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -87,7 +87,6 @@
87
87
  "@atlaskit/collab-provider": "9.42.0",
88
88
  "@atlaskit/editor-plugin-annotation": "1.19.8",
89
89
  "@atlaskit/editor-plugin-card": "^3.2.0",
90
- "@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
91
90
  "@atlaskit/editor-plugin-list": "^3.8.0",
92
91
  "@atlaskit/editor-plugin-paste": "^1.12.0",
93
92
  "@atlaskit/editor-test-helpers": "*",
@@ -99,7 +98,7 @@
99
98
  "@atlaskit/modal-dialog": "^12.17.0",
100
99
  "@atlaskit/primitives": "^12.2.0",
101
100
  "@atlaskit/renderer": "^110.5.0",
102
- "@atlaskit/smart-card": "^28.2.0",
101
+ "@atlaskit/smart-card": "^28.3.0",
103
102
  "@atlaskit/synchrony-test-helpers": "^2.5.0",
104
103
  "@atlaskit/toggle": "^13.4.0",
105
104
  "@atlaskit/util-data-test": "^17.9.0",
@@ -285,6 +284,9 @@
285
284
  },
286
285
  "platform_editor_ssr_fix_block_controls": {
287
286
  "type": "boolean"
287
+ },
288
+ "platform_editor_remove_use_preset_context": {
289
+ "type": "boolean"
288
290
  }
289
291
  },
290
292
  "stricter": {