@atlaskit/editor-core 198.6.2 → 198.6.4

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 (30) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/ui/ContentStyles/index.js +6 -4
  3. package/dist/cjs/ui/EditorContext/index.js +47 -12
  4. package/dist/cjs/ui/WithEditorActions/index.js +70 -11
  5. package/dist/cjs/version-wrapper.js +1 -1
  6. package/dist/es2019/ui/ContentStyles/index.js +7 -5
  7. package/dist/es2019/ui/EditorContext/index.js +32 -3
  8. package/dist/es2019/ui/WithEditorActions/index.js +35 -1
  9. package/dist/es2019/version-wrapper.js +1 -1
  10. package/dist/esm/ui/ContentStyles/index.js +6 -4
  11. package/dist/esm/ui/EditorContext/index.js +44 -9
  12. package/dist/esm/ui/WithEditorActions/index.js +72 -13
  13. package/dist/esm/version-wrapper.js +1 -1
  14. package/dist/types/create-editor/create-universal-preset.d.ts +25 -0
  15. package/dist/types/presets/default.d.ts +16 -0
  16. package/dist/types/presets/universal.d.ts +25 -0
  17. package/dist/types/presets/useUniversalPreset.d.ts +25 -0
  18. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -0
  19. package/dist/types/ui/ContentStyles/index.d.ts +1 -0
  20. package/dist/types/ui/EditorContext/index.d.ts +9 -3
  21. package/dist/types/ui/WithEditorActions/index.d.ts +3 -12
  22. package/dist/types-ts4.5/create-editor/create-universal-preset.d.ts +25 -0
  23. package/dist/types-ts4.5/presets/default.d.ts +16 -0
  24. package/dist/types-ts4.5/presets/universal.d.ts +25 -0
  25. package/dist/types-ts4.5/presets/useUniversalPreset.d.ts +25 -0
  26. package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +2 -0
  27. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +1 -0
  28. package/dist/types-ts4.5/ui/EditorContext/index.d.ts +9 -3
  29. package/dist/types-ts4.5/ui/WithEditorActions/index.d.ts +3 -12
  30. package/package.json +13 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 198.6.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#151676](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/151676)
8
+ [`ed6d01983b0da`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ed6d01983b0da) -
9
+ ED-25183: Remediate WithEditorActions, WithPluginState & LegacyEditorContext context type
10
+
11
+ ## 198.6.3
12
+
13
+ ### Patch Changes
14
+
15
+ - [#151938](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/151938)
16
+ [`91b5768ef0c7c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/91b5768ef0c7c) -
17
+ [ux] ED-25203 refactor image previewer outside of floating toolbar
18
+ - [#152019](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152019)
19
+ [`5f7f23dd0c612`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5f7f23dd0c612) -
20
+ [ux] ED-25082: Added editor custom font tokens and use them for normal texts and paragraph texts"
21
+ - Updated dependencies
22
+
3
23
  ## 198.6.2
4
24
 
5
25
  ### Patch Changes
@@ -88,7 +88,7 @@ var akEditorBreakpointForSmallDevice = "1266px";
88
88
  var contentStyles = function contentStyles(props) {
89
89
  return (0, _react2.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n\t--ak-editor--default-gutter-padding: ", "px;\n\t/* 52 is from akEditorGutterPaddingDynamic via editor-shared-styles */\n\t--ak-editor--large-gutter-padding: 52px;\n\t--ak-editor--default-layout-width: ", "px;\n\t--ak-editor--full-width-layout-width: ", "px;\n\t/* calculate editor line length, 100cqw is the editor container width */\n\t--ak-editor--line-length: min(\n\t\tcalc(100cqw - var(--ak-editor--large-gutter-padding) * 2),\n\t\tvar(--ak-editor--default-layout-width)\n\t);\n\t--ak-editor--breakout-wide-layout-width: ", "px;\n\t--ak-editor--breakout-full-page-guttering-padding: calc(\n\t\tvar(--ak-editor--large-gutter-padding) * 2 + var(--ak-editor--default-gutter-padding)\n\t);\n\n\t.fabric-editor--full-width-mode {\n\t\t--ak-editor--line-length: min(\n\t\t\tcalc(100cqw - var(--ak-editor--large-gutter-padding) * 2),\n\t\t\tvar(--ak-editor--full-width-layout-width)\n\t\t);\n\t}\n\n\t.ProseMirror {\n\t\t--ak-editor-max-container-width: calc(100cqw - var(--ak-editor--large-gutter-padding));\n\t}\n\n\t/* We can't allow nodes that are inside other nodes to bleed from the parent container */\n\t.ProseMirror > div[data-prosemirror-node-block] [data-prosemirror-node-block] {\n\t\t--ak-editor-max-container-width: 100%;\n\t}\n\n\t/* container editor-area is defined in platform/packages/editor/editor-core/src/ui/Appearance/FullPage/StyledComponents.ts */\n\t@container editor-area (width >= ", ") {\n\t\t.ProseMirror {\n\t\t\t--ak-editor--breakout-wide-layout-width: ", "px;\n\t\t}\n\t}\n\n\t.ProseMirror {\n\t\toutline: none;\n\t\tfont-size: ", "px;\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t}\n\n\t", "\n\n\t.ProseMirror-hideselection *::selection {\n\t\tbackground: transparent;\n\t}\n\n\t.ProseMirror-hideselection *::-moz-selection {\n\t\tbackground: transparent;\n\t}\n\n\t.ProseMirror-selectednode {\n\t\toutline: none;\n\t}\n\n\t.ProseMirror-selectednode:empty {\n\t\toutline: 2px solid ", ";\n\t}\n\n\t", "\n\n\t", "\n\t", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n\t", "\n\t", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n\t\tbox-sizing: border-box;\n\t}\n\n\t.mediaGroupView-content-wrap ul {\n\t\tpadding: 0;\n\t}\n\n\t/** Needed to override any cleared floats, e.g. image wrapping */\n\n\tdiv.fabric-editor-block-mark[class^='fabric-editor-align'] {\n\t\tclear: none !important;\n\t}\n\n\t.fabric-editor-align-end {\n\t\ttext-align: right;\n\t}\n\n\t.fabric-editor-align-start {\n\t\ttext-align: left;\n\t}\n\n\t.fabric-editor-align-center {\n\t\ttext-align: center;\n\t}\n\n\t// For FullPage only when inside a table\n\t// Related code all lives inside: packages/editor/editor-core/src/ui/Appearance/FullPage/StyledComponents.ts\n\t// In the \"editorContentAreaContainerStyle\" function\n\t.fabric-editor--full-width-mode {\n\t\t.pm-table-container {\n\t\t\t.code-block,\n\t\t\t.extension-container,\n\t\t\t.multiBodiedExtension--container {\n\t\t\t\tmax-width: 100%;\n\t\t\t}\n\t\t}\n\t}\n\n\t.pm-table-header-content-wrap :not(.fabric-editor-alignment),\n\t.pm-table-header-content-wrap :not(p, .fabric-editor-block-mark) + div.fabric-editor-block-mark,\n\t.pm-table-cell-content-wrap :not(p, .fabric-editor-block-mark) + div.fabric-editor-block-mark {\n\t\tp:first-of-type {\n\t\t\tmargin-top: 0;\n\t\t}\n\t}\n\t.pm-table-cell-content-wrap .mediaGroupView-content-wrap {\n\t\tclear: both;\n\t}\n\n\t.hyperlink-floating-toolbar,\n\t.", " {\n\t\tpadding: 0;\n\t}\n\n\t/* Link icon in the Atlaskit package\n is bigger than the others\n */\n\t.hyperlink-open-link {\n\t\tmin-width: 24px;\n\t\tsvg {\n\t\t\tmax-width: 18px;\n\t\t}\n\t}\n"])), _editorSharedStyles.akEditorGutterPadding, _editorSharedStyles.akEditorDefaultLayoutWidth, _editorSharedStyles.akEditorFullWidthLayoutWidth, _editorSharedStyles.akEditorCalculatedWideLayoutWidthSmallViewport, akEditorBreakpointForSmallDevice, _editorSharedStyles.akEditorCalculatedWideLayoutWidth, (0, _editorSharedStyles.editorFontSize)({
90
90
  theme: props.theme
91
- }), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, (0, _platformFeatureFlags.fg)('editor_request_to_edit_task') ? null : (0, _react2.css)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t.ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n\t\t\t\t\tpointer-events: none;\n\t\t\t\t\topacity: 0.7;\n\t\t\t\t}\n\t\t\t"]))), "var(--ds-border-focused, #8cf)", (0, _platformFeatureFlags.fg)('platform_editor_mark_boundary_cursor') ? (0, _react2.css)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t.ProseMirror.ProseMirror-focused:has(.ProseMirror-mark-boundary-cursor) {\n\t\t\t\t\tcaret-color: transparent;\n\t\t\t\t}\n\t\t\t\t.ProseMirror:not(.ProseMirror-focused) .ProseMirror-mark-boundary-cursor {\n\t\t\t\t\tdisplay: none;\n\t\t\t\t}\n\t\t\t"]))) : null, _styles5.placeholderTextStyles, placeholderStyles, (0, _codeBlock.codeBlockStyles)(), (0, _styles2.blocktypeStyles)(), (0, _styles.codeMarkSharedStyles)(), _styles.textColorStyles, (0, _styles.backgroundColorStyles)(), listsStyles, ruleStyles(), _media.mediaStyles, (0, _layout.layoutStyles)(props.viewMode), _collab.telepointerStyle, _selection.gapCursorStyles, (0, _panel2.panelStyles)(), mentionsStyles, emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _extension.extensionStyles, (0, _expand.expandStyles)(), _styles3.findReplaceStyles, _styles4.textHighlightStyle, _tasksAndDecisions.taskDecisionStyles, _status.statusStyles, (0, _styles.annotationSharedStyles)(), (0, _styles.smartCardStyles)(), _styles.smartCardSharedStyles, _date.dateStyles, _styles.embedCardStyles, _styles.unsupportedStyles, _styles.resizerStyles, (0, _aiPanels.aiPanelStyles)(props.colorMode), fixBlockControlStylesSSR(), _styles.MediaSharedClassNames.FLOATING_TOOLBAR_COMPONENT);
91
+ }), _styles.whitespaceSharedStyles, (0, _styles.paragraphSharedStyles)(props.typographyTheme), _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, (0, _platformFeatureFlags.fg)('editor_request_to_edit_task') ? null : (0, _react2.css)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t.ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n\t\t\t\t\tpointer-events: none;\n\t\t\t\t\topacity: 0.7;\n\t\t\t\t}\n\t\t\t"]))), "var(--ds-border-focused, #8cf)", (0, _platformFeatureFlags.fg)('platform_editor_mark_boundary_cursor') ? (0, _react2.css)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t.ProseMirror.ProseMirror-focused:has(.ProseMirror-mark-boundary-cursor) {\n\t\t\t\t\tcaret-color: transparent;\n\t\t\t\t}\n\t\t\t\t.ProseMirror:not(.ProseMirror-focused) .ProseMirror-mark-boundary-cursor {\n\t\t\t\t\tdisplay: none;\n\t\t\t\t}\n\t\t\t"]))) : null, _styles5.placeholderTextStyles, placeholderStyles, (0, _codeBlock.codeBlockStyles)(), (0, _styles2.blocktypeStyles)(props.typographyTheme), (0, _styles.codeMarkSharedStyles)(), _styles.textColorStyles, (0, _styles.backgroundColorStyles)(), listsStyles, ruleStyles(), _media.mediaStyles, (0, _layout.layoutStyles)(props.viewMode), _collab.telepointerStyle, _selection.gapCursorStyles, (0, _panel2.panelStyles)(), mentionsStyles, emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _extension.extensionStyles, (0, _expand.expandStyles)(), _styles3.findReplaceStyles, _styles4.textHighlightStyle, _tasksAndDecisions.taskDecisionStyles, _status.statusStyles, (0, _styles.annotationSharedStyles)(), (0, _styles.smartCardStyles)(), _styles.smartCardSharedStyles, _date.dateStyles, _styles.embedCardStyles, _styles.unsupportedStyles, _styles.resizerStyles, (0, _aiPanels.aiPanelStyles)(props.colorMode), fixBlockControlStylesSSR(), _styles.MediaSharedClassNames.FLOATING_TOOLBAR_COMPONENT);
92
92
  };
93
93
  var createEditorContentStyle = exports.createEditorContentStyle = function createEditorContentStyle(styles) {
94
94
  return /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
@@ -97,7 +97,8 @@ var createEditorContentStyle = exports.createEditorContentStyle = function creat
97
97
  featureFlags = props.featureFlags;
98
98
  var theme = (0, _react2.useTheme)();
99
99
  var _useThemeObserver = (0, _tokens.useThemeObserver)(),
100
- colorMode = _useThemeObserver.colorMode;
100
+ colorMode = _useThemeObserver.colorMode,
101
+ typography = _useThemeObserver.typography;
101
102
  var editorAPI = (0, _context.usePresetContext)();
102
103
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(editorAPI, ['editorViewMode']),
103
104
  editorViewModeState = _useSharedPluginState.editorViewModeState;
@@ -106,9 +107,10 @@ var createEditorContentStyle = exports.createEditorContentStyle = function creat
106
107
  theme: theme,
107
108
  colorMode: colorMode,
108
109
  featureFlags: featureFlags,
109
- viewMode: (0, _platformFeatureFlags.fg)('platform_editor_remove_use_preset_context') ? props.viewMode : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
110
+ viewMode: (0, _platformFeatureFlags.fg)('platform_editor_remove_use_preset_context') ? props.viewMode : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
111
+ typographyTheme: typography
110
112
  });
111
- }, [theme, colorMode, featureFlags, editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode, props.viewMode]);
113
+ }, [theme, colorMode, featureFlags, editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode, props.viewMode, typography]);
112
114
  return (
113
115
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
114
116
  (0, _react2.jsx)("div", {
@@ -4,35 +4,70 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.useEditorContext = exports.default = void 0;
7
+ exports.useEditorContext = exports.default = exports.LegacyEditorContext = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
11
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
11
12
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
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 _UNSAFE_do_not_use_editor_context = require("@atlaskit/editor-common/UNSAFE_do_not_use_editor_context");
16
17
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
18
  var _actions = _interopRequireDefault(require("../../actions"));
18
19
  var _context = require("../../presets/context");
19
20
  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); }; }
20
21
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
21
- var EditorContext = /*#__PURE__*/_react.default.createContext({});
22
22
  var useEditorContext = exports.useEditorContext = function useEditorContext() {
23
- return _react.default.useContext(EditorContext);
23
+ return _react.default.useContext(_UNSAFE_do_not_use_editor_context.EditorContext);
24
24
  };
25
- var LegacyEditorContext = exports.default = /*#__PURE__*/function (_React$Component) {
25
+ var LegacyEditorContext = exports.LegacyEditorContext = /*#__PURE__*/function (_React$Component) {
26
26
  (0, _inherits2.default)(LegacyEditorContext, _React$Component);
27
27
  var _super = _createSuper(LegacyEditorContext);
28
28
  function LegacyEditorContext(props) {
29
- var _this;
30
29
  (0, _classCallCheck2.default)(this, LegacyEditorContext);
31
- _this = _super.call(this, props);
30
+ return _super.call(this, props);
31
+ }
32
+ (0, _createClass2.default)(LegacyEditorContext, [{
33
+ key: "render",
34
+ value: function render() {
35
+ if ((0, _platformFeatureFlags.fg)('platform_editor_react18_phase2')) {
36
+ return /*#__PURE__*/_react.default.createElement(LegacyEditorContextNew, this.props, this.props.children);
37
+ }
38
+ return /*#__PURE__*/_react.default.createElement(LegacyEditorContextOld, this.props, this.props.children);
39
+ }
40
+ }]);
41
+ return LegacyEditorContext;
42
+ }(_react.default.Component);
43
+ function LegacyEditorContextNew(_ref) {
44
+ var children = _ref.children,
45
+ editorActions = _ref.editorActions;
46
+ if ((0, _platformFeatureFlags.fg)('platform_editor_remove_use_preset_context')) {
47
+ return /*#__PURE__*/_react.default.createElement(_UNSAFE_do_not_use_editor_context.EditorContext.Provider, {
48
+ value: {
49
+ editorActions: editorActions !== null && editorActions !== void 0 ? editorActions : new _actions.default()
50
+ }
51
+ }, children);
52
+ } else {
53
+ return /*#__PURE__*/_react.default.createElement(_UNSAFE_do_not_use_editor_context.EditorContext.Provider, {
54
+ value: {
55
+ editorActions: editorActions !== null && editorActions !== void 0 ? editorActions : new _actions.default()
56
+ }
57
+ }, /*#__PURE__*/_react.default.createElement(_context.PresetContextProvider, null, children));
58
+ }
59
+ }
60
+ var LegacyEditorContextOld = exports.default = /*#__PURE__*/function (_React$Component2) {
61
+ (0, _inherits2.default)(LegacyEditorContextOld, _React$Component2);
62
+ var _super2 = _createSuper(LegacyEditorContextOld);
63
+ function LegacyEditorContextOld(props) {
64
+ var _this;
65
+ (0, _classCallCheck2.default)(this, LegacyEditorContextOld);
66
+ _this = _super2.call(this, props);
32
67
  _this.editorActions = props.editorActions || new _actions.default();
33
68
  return _this;
34
69
  }
35
- (0, _createClass2.default)(LegacyEditorContext, [{
70
+ (0, _createClass2.default)(LegacyEditorContextOld, [{
36
71
  key: "getChildContext",
37
72
  value: function getChildContext() {
38
73
  return {
@@ -43,18 +78,18 @@ var LegacyEditorContext = exports.default = /*#__PURE__*/function (_React$Compon
43
78
  key: "render",
44
79
  value: function render() {
45
80
  if ((0, _platformFeatureFlags.fg)('platform_editor_remove_use_preset_context')) {
46
- return /*#__PURE__*/_react.default.createElement(EditorContext.Provider, {
81
+ return /*#__PURE__*/_react.default.createElement(_UNSAFE_do_not_use_editor_context.EditorContext.Provider, {
47
82
  value: this.getChildContext()
48
83
  }, this.props.children);
49
84
  } else {
50
- return /*#__PURE__*/_react.default.createElement(EditorContext.Provider, {
85
+ return /*#__PURE__*/_react.default.createElement(_UNSAFE_do_not_use_editor_context.EditorContext.Provider, {
51
86
  value: this.getChildContext()
52
87
  }, /*#__PURE__*/_react.default.createElement(_context.PresetContextProvider, null, this.props.children));
53
88
  }
54
89
  }
55
90
  }]);
56
- return LegacyEditorContext;
91
+ return LegacyEditorContextOld;
57
92
  }(_react.default.Component);
58
- (0, _defineProperty2.default)(LegacyEditorContext, "childContextTypes", {
93
+ (0, _defineProperty2.default)(LegacyEditorContextOld, "childContextTypes", {
59
94
  editorActions: _propTypes.default.object
60
95
  });
@@ -5,34 +5,93 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
  var _react = _interopRequireDefault(require("react"));
16
16
  var _propTypes = _interopRequireDefault(require("prop-types"));
17
+ var _UNSAFE_do_not_use_editor_context = require("@atlaskit/editor-common/UNSAFE_do_not_use_editor_context");
18
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
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); }; }
18
20
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
19
21
  var WithEditorActions = exports.default = /*#__PURE__*/function (_React$Component) {
20
22
  (0, _inherits2.default)(WithEditorActions, _React$Component);
21
23
  var _super = _createSuper(WithEditorActions);
22
- function WithEditorActions() {
23
- var _this;
24
+ function WithEditorActions(props) {
24
25
  (0, _classCallCheck2.default)(this, WithEditorActions);
26
+ return _super.call(this, props);
27
+ }
28
+ (0, _createClass2.default)(WithEditorActions, [{
29
+ key: "render",
30
+ value: function render() {
31
+ if ((0, _platformFeatureFlags.fg)('platform_editor_react18_phase2')) {
32
+ return /*#__PURE__*/_react.default.createElement(WithEditorActionsNew, this.props);
33
+ }
34
+ return /*#__PURE__*/_react.default.createElement(WithEditorActionsOld, this.props);
35
+ }
36
+ }]);
37
+ return WithEditorActions;
38
+ }(_react.default.Component);
39
+ function WithEditorActionsNew(props) {
40
+ var render = props.render;
41
+ var context = _react.default.useContext(_UNSAFE_do_not_use_editor_context.EditorContext);
42
+ return /*#__PURE__*/_react.default.createElement(WithEditorActionsInner, {
43
+ render: render,
44
+ editorActions: context === null || context === void 0 ? void 0 : context.editorActions
45
+ });
46
+ }
47
+ var WithEditorActionsInner = /*#__PURE__*/function (_React$Component2) {
48
+ (0, _inherits2.default)(WithEditorActionsInner, _React$Component2);
49
+ var _super2 = _createSuper(WithEditorActionsInner);
50
+ function WithEditorActionsInner() {
51
+ (0, _classCallCheck2.default)(this, WithEditorActionsInner);
52
+ return _super2.apply(this, arguments);
53
+ }
54
+ (0, _createClass2.default)(WithEditorActionsInner, [{
55
+ key: "componentDidMount",
56
+ value: function componentDidMount() {
57
+ var _this = this;
58
+ this.props.editorActions._privateSubscribe(function () {
59
+ return _this.forceUpdate();
60
+ });
61
+ }
62
+ }, {
63
+ key: "componentWillUnmount",
64
+ value: function componentWillUnmount() {
65
+ var _this2 = this;
66
+ this.props.editorActions._privateUnsubscribe(function () {
67
+ return _this2.forceUpdate();
68
+ });
69
+ }
70
+ }, {
71
+ key: "render",
72
+ value: function render() {
73
+ return this.props.render(this.props.editorActions);
74
+ }
75
+ }]);
76
+ return WithEditorActionsInner;
77
+ }(_react.default.Component);
78
+ var WithEditorActionsOld = /*#__PURE__*/function (_React$Component3) {
79
+ (0, _inherits2.default)(WithEditorActionsOld, _React$Component3);
80
+ var _super3 = _createSuper(WithEditorActionsOld);
81
+ function WithEditorActionsOld() {
82
+ var _this3;
83
+ (0, _classCallCheck2.default)(this, WithEditorActionsOld);
25
84
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
26
85
  args[_key] = arguments[_key];
27
86
  }
28
- _this = _super.call.apply(_super, [this].concat(args));
29
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onContextUpdate", function () {
87
+ _this3 = _super3.call.apply(_super3, [this].concat(args));
88
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this3), "onContextUpdate", function () {
30
89
  // Re-render actions when editorActions changes...
31
- _this.forceUpdate();
90
+ _this3.forceUpdate();
32
91
  });
33
- return _this;
92
+ return _this3;
34
93
  }
35
- (0, _createClass2.default)(WithEditorActions, [{
94
+ (0, _createClass2.default)(WithEditorActionsOld, [{
36
95
  key: "componentDidMount",
37
96
  value: function componentDidMount() {
38
97
  this.context.editorActions._privateSubscribe(this.onContextUpdate);
@@ -48,8 +107,8 @@ var WithEditorActions = exports.default = /*#__PURE__*/function (_React$Componen
48
107
  return this.props.render(this.context.editorActions);
49
108
  }
50
109
  }]);
51
- return WithEditorActions;
110
+ return WithEditorActionsOld;
52
111
  }(_react.default.Component);
53
- (0, _defineProperty2.default)(WithEditorActions, "contextTypes", {
112
+ (0, _defineProperty2.default)(WithEditorActionsOld, "contextTypes", {
54
113
  editorActions: _propTypes.default.object.isRequired
55
114
  });
@@ -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 = "198.6.2";
8
+ var version = exports.version = "198.6.4";
@@ -222,7 +222,7 @@ const contentStyles = props => css`
222
222
  theme: props.theme
223
223
  })}px;
224
224
  ${whitespaceSharedStyles};
225
- ${paragraphSharedStyles};
225
+ ${paragraphSharedStyles(props.typographyTheme)};
226
226
  ${listsSharedStyles};
227
227
  ${indentationSharedStyles};
228
228
  ${shadowSharedStyle};
@@ -265,7 +265,7 @@ const contentStyles = props => css`
265
265
  ${placeholderStyles}
266
266
  ${codeBlockStyles()}
267
267
 
268
- ${blocktypeStyles()}
268
+ ${blocktypeStyles(props.typographyTheme)}
269
269
  ${codeMarkSharedStyles()}
270
270
  ${textColorStyles}
271
271
  ${backgroundColorStyles()}
@@ -373,7 +373,8 @@ export const createEditorContentStyle = styles => {
373
373
  } = props;
374
374
  const theme = useTheme();
375
375
  const {
376
- colorMode
376
+ colorMode,
377
+ typography
377
378
  } = useThemeObserver();
378
379
  const editorAPI = usePresetContext();
379
380
  const {
@@ -383,8 +384,9 @@ export const createEditorContentStyle = styles => {
383
384
  theme,
384
385
  colorMode,
385
386
  featureFlags,
386
- viewMode: fg('platform_editor_remove_use_preset_context') ? props.viewMode : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
387
- }), [theme, colorMode, featureFlags, editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode, props.viewMode]);
387
+ viewMode: fg('platform_editor_remove_use_preset_context') ? props.viewMode : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
388
+ typographyTheme: typography
389
+ }), [theme, colorMode, featureFlags, editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode, props.viewMode, typography]);
388
390
  return (
389
391
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
390
392
  jsx("div", {
@@ -1,12 +1,41 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
+ import { EditorContext } from '@atlaskit/editor-common/UNSAFE_do_not_use_editor_context';
4
5
  import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import EditorActions from '../../actions';
6
7
  import { PresetContextProvider } from '../../presets/context';
7
- const EditorContext = /*#__PURE__*/React.createContext({});
8
8
  export const useEditorContext = () => React.useContext(EditorContext);
9
- export default class LegacyEditorContext extends React.Component {
9
+ export class LegacyEditorContext extends React.Component {
10
+ constructor(props) {
11
+ super(props);
12
+ }
13
+ render() {
14
+ if (fg('platform_editor_react18_phase2')) {
15
+ return /*#__PURE__*/React.createElement(LegacyEditorContextNew, this.props, this.props.children);
16
+ }
17
+ return /*#__PURE__*/React.createElement(LegacyEditorContextOld, this.props, this.props.children);
18
+ }
19
+ }
20
+ function LegacyEditorContextNew({
21
+ children,
22
+ editorActions
23
+ }) {
24
+ if (fg('platform_editor_remove_use_preset_context')) {
25
+ return /*#__PURE__*/React.createElement(EditorContext.Provider, {
26
+ value: {
27
+ editorActions: editorActions !== null && editorActions !== void 0 ? editorActions : new EditorActions()
28
+ }
29
+ }, children);
30
+ } else {
31
+ return /*#__PURE__*/React.createElement(EditorContext.Provider, {
32
+ value: {
33
+ editorActions: editorActions !== null && editorActions !== void 0 ? editorActions : new EditorActions()
34
+ }
35
+ }, /*#__PURE__*/React.createElement(PresetContextProvider, null, children));
36
+ }
37
+ }
38
+ export default class LegacyEditorContextOld extends React.Component {
10
39
  constructor(props) {
11
40
  super(props);
12
41
  this.editorActions = props.editorActions || new EditorActions();
@@ -28,6 +57,6 @@ export default class LegacyEditorContext extends React.Component {
28
57
  }
29
58
  }
30
59
  }
31
- _defineProperty(LegacyEditorContext, "childContextTypes", {
60
+ _defineProperty(LegacyEditorContextOld, "childContextTypes", {
32
61
  editorActions: PropTypes.object
33
62
  });
@@ -1,7 +1,41 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
+ import { EditorContext } from '@atlaskit/editor-common/UNSAFE_do_not_use_editor_context';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
4
6
  export default class WithEditorActions extends React.Component {
7
+ constructor(props) {
8
+ super(props);
9
+ }
10
+ render() {
11
+ if (fg('platform_editor_react18_phase2')) {
12
+ return /*#__PURE__*/React.createElement(WithEditorActionsNew, this.props);
13
+ }
14
+ return /*#__PURE__*/React.createElement(WithEditorActionsOld, this.props);
15
+ }
16
+ }
17
+ function WithEditorActionsNew(props) {
18
+ const {
19
+ render
20
+ } = props;
21
+ const context = React.useContext(EditorContext);
22
+ return /*#__PURE__*/React.createElement(WithEditorActionsInner, {
23
+ render: render,
24
+ editorActions: context === null || context === void 0 ? void 0 : context.editorActions
25
+ });
26
+ }
27
+ class WithEditorActionsInner extends React.Component {
28
+ componentDidMount() {
29
+ this.props.editorActions._privateSubscribe(() => this.forceUpdate());
30
+ }
31
+ componentWillUnmount() {
32
+ this.props.editorActions._privateUnsubscribe(() => this.forceUpdate());
33
+ }
34
+ render() {
35
+ return this.props.render(this.props.editorActions);
36
+ }
37
+ }
38
+ class WithEditorActionsOld extends React.Component {
5
39
  constructor(...args) {
6
40
  super(...args);
7
41
  _defineProperty(this, "onContextUpdate", () => {
@@ -19,6 +53,6 @@ export default class WithEditorActions extends React.Component {
19
53
  return this.props.render(this.context.editorActions);
20
54
  }
21
55
  }
22
- _defineProperty(WithEditorActions, "contextTypes", {
56
+ _defineProperty(WithEditorActionsOld, "contextTypes", {
23
57
  editorActions: PropTypes.object.isRequired
24
58
  });
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "198.6.2";
2
+ export const version = "198.6.4";
@@ -80,7 +80,7 @@ var akEditorBreakpointForSmallDevice = "1266px";
80
80
  var contentStyles = function contentStyles(props) {
81
81
  return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n\t--ak-editor--default-gutter-padding: ", "px;\n\t/* 52 is from akEditorGutterPaddingDynamic via editor-shared-styles */\n\t--ak-editor--large-gutter-padding: 52px;\n\t--ak-editor--default-layout-width: ", "px;\n\t--ak-editor--full-width-layout-width: ", "px;\n\t/* calculate editor line length, 100cqw is the editor container width */\n\t--ak-editor--line-length: min(\n\t\tcalc(100cqw - var(--ak-editor--large-gutter-padding) * 2),\n\t\tvar(--ak-editor--default-layout-width)\n\t);\n\t--ak-editor--breakout-wide-layout-width: ", "px;\n\t--ak-editor--breakout-full-page-guttering-padding: calc(\n\t\tvar(--ak-editor--large-gutter-padding) * 2 + var(--ak-editor--default-gutter-padding)\n\t);\n\n\t.fabric-editor--full-width-mode {\n\t\t--ak-editor--line-length: min(\n\t\t\tcalc(100cqw - var(--ak-editor--large-gutter-padding) * 2),\n\t\t\tvar(--ak-editor--full-width-layout-width)\n\t\t);\n\t}\n\n\t.ProseMirror {\n\t\t--ak-editor-max-container-width: calc(100cqw - var(--ak-editor--large-gutter-padding));\n\t}\n\n\t/* We can't allow nodes that are inside other nodes to bleed from the parent container */\n\t.ProseMirror > div[data-prosemirror-node-block] [data-prosemirror-node-block] {\n\t\t--ak-editor-max-container-width: 100%;\n\t}\n\n\t/* container editor-area is defined in platform/packages/editor/editor-core/src/ui/Appearance/FullPage/StyledComponents.ts */\n\t@container editor-area (width >= ", ") {\n\t\t.ProseMirror {\n\t\t\t--ak-editor--breakout-wide-layout-width: ", "px;\n\t\t}\n\t}\n\n\t.ProseMirror {\n\t\toutline: none;\n\t\tfont-size: ", "px;\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t}\n\n\t", "\n\n\t.ProseMirror-hideselection *::selection {\n\t\tbackground: transparent;\n\t}\n\n\t.ProseMirror-hideselection *::-moz-selection {\n\t\tbackground: transparent;\n\t}\n\n\t.ProseMirror-selectednode {\n\t\toutline: none;\n\t}\n\n\t.ProseMirror-selectednode:empty {\n\t\toutline: 2px solid ", ";\n\t}\n\n\t", "\n\n\t", "\n\t", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n\t", "\n\t", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n\t\tbox-sizing: border-box;\n\t}\n\n\t.mediaGroupView-content-wrap ul {\n\t\tpadding: 0;\n\t}\n\n\t/** Needed to override any cleared floats, e.g. image wrapping */\n\n\tdiv.fabric-editor-block-mark[class^='fabric-editor-align'] {\n\t\tclear: none !important;\n\t}\n\n\t.fabric-editor-align-end {\n\t\ttext-align: right;\n\t}\n\n\t.fabric-editor-align-start {\n\t\ttext-align: left;\n\t}\n\n\t.fabric-editor-align-center {\n\t\ttext-align: center;\n\t}\n\n\t// For FullPage only when inside a table\n\t// Related code all lives inside: packages/editor/editor-core/src/ui/Appearance/FullPage/StyledComponents.ts\n\t// In the \"editorContentAreaContainerStyle\" function\n\t.fabric-editor--full-width-mode {\n\t\t.pm-table-container {\n\t\t\t.code-block,\n\t\t\t.extension-container,\n\t\t\t.multiBodiedExtension--container {\n\t\t\t\tmax-width: 100%;\n\t\t\t}\n\t\t}\n\t}\n\n\t.pm-table-header-content-wrap :not(.fabric-editor-alignment),\n\t.pm-table-header-content-wrap :not(p, .fabric-editor-block-mark) + div.fabric-editor-block-mark,\n\t.pm-table-cell-content-wrap :not(p, .fabric-editor-block-mark) + div.fabric-editor-block-mark {\n\t\tp:first-of-type {\n\t\t\tmargin-top: 0;\n\t\t}\n\t}\n\t.pm-table-cell-content-wrap .mediaGroupView-content-wrap {\n\t\tclear: both;\n\t}\n\n\t.hyperlink-floating-toolbar,\n\t.", " {\n\t\tpadding: 0;\n\t}\n\n\t/* Link icon in the Atlaskit package\n is bigger than the others\n */\n\t.hyperlink-open-link {\n\t\tmin-width: 24px;\n\t\tsvg {\n\t\t\tmax-width: 18px;\n\t\t}\n\t}\n"])), akEditorGutterPadding, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorBreakpointForSmallDevice, akEditorCalculatedWideLayoutWidth, editorFontSize({
82
82
  theme: props.theme
83
- }), whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, shadowSharedStyle, InlineNodeViewSharedStyles, fg('editor_request_to_edit_task') ? null : css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n\t\t\t\t.ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n\t\t\t\t\tpointer-events: none;\n\t\t\t\t\topacity: 0.7;\n\t\t\t\t}\n\t\t\t"]))), "var(--ds-border-focused, #8cf)", fg('platform_editor_mark_boundary_cursor') ? css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n\t\t\t\t.ProseMirror.ProseMirror-focused:has(.ProseMirror-mark-boundary-cursor) {\n\t\t\t\t\tcaret-color: transparent;\n\t\t\t\t}\n\t\t\t\t.ProseMirror:not(.ProseMirror-focused) .ProseMirror-mark-boundary-cursor {\n\t\t\t\t\tdisplay: none;\n\t\t\t\t}\n\t\t\t"]))) : null, placeholderTextStyles, placeholderStyles, codeBlockStyles(), blocktypeStyles(), codeMarkSharedStyles(), textColorStyles, backgroundColorStyles(), listsStyles, ruleStyles(), mediaStyles, layoutStyles(props.viewMode), telepointerStyle, gapCursorStyles, panelStyles(), mentionsStyles, emojiStyles, tasksAndDecisionsStyles, gridStyles, linkStyles, blockMarksSharedStyles, dateSharedStyle, extensionStyles, expandStyles(), findReplaceStyles, textHighlightStyle, taskDecisionStyles, statusStyles, annotationSharedStyles(), smartCardStyles(), smartCardSharedStyles, dateStyles, embedCardStyles, unsupportedStyles, resizerStyles, aiPanelStyles(props.colorMode), fixBlockControlStylesSSR(), MediaSharedClassNames.FLOATING_TOOLBAR_COMPONENT);
83
+ }), whitespaceSharedStyles, paragraphSharedStyles(props.typographyTheme), listsSharedStyles, indentationSharedStyles, shadowSharedStyle, InlineNodeViewSharedStyles, fg('editor_request_to_edit_task') ? null : css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n\t\t\t\t.ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n\t\t\t\t\tpointer-events: none;\n\t\t\t\t\topacity: 0.7;\n\t\t\t\t}\n\t\t\t"]))), "var(--ds-border-focused, #8cf)", fg('platform_editor_mark_boundary_cursor') ? css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n\t\t\t\t.ProseMirror.ProseMirror-focused:has(.ProseMirror-mark-boundary-cursor) {\n\t\t\t\t\tcaret-color: transparent;\n\t\t\t\t}\n\t\t\t\t.ProseMirror:not(.ProseMirror-focused) .ProseMirror-mark-boundary-cursor {\n\t\t\t\t\tdisplay: none;\n\t\t\t\t}\n\t\t\t"]))) : null, placeholderTextStyles, placeholderStyles, codeBlockStyles(), blocktypeStyles(props.typographyTheme), codeMarkSharedStyles(), textColorStyles, backgroundColorStyles(), listsStyles, ruleStyles(), mediaStyles, layoutStyles(props.viewMode), telepointerStyle, gapCursorStyles, panelStyles(), mentionsStyles, emojiStyles, tasksAndDecisionsStyles, gridStyles, linkStyles, blockMarksSharedStyles, dateSharedStyle, extensionStyles, expandStyles(), findReplaceStyles, textHighlightStyle, taskDecisionStyles, statusStyles, annotationSharedStyles(), smartCardStyles(), smartCardSharedStyles, dateStyles, embedCardStyles, unsupportedStyles, resizerStyles, aiPanelStyles(props.colorMode), fixBlockControlStylesSSR(), MediaSharedClassNames.FLOATING_TOOLBAR_COMPONENT);
84
84
  };
85
85
  export var createEditorContentStyle = function createEditorContentStyle(styles) {
86
86
  return /*#__PURE__*/React.forwardRef(function (props, ref) {
@@ -89,7 +89,8 @@ export var createEditorContentStyle = function createEditorContentStyle(styles)
89
89
  featureFlags = props.featureFlags;
90
90
  var theme = useTheme();
91
91
  var _useThemeObserver = useThemeObserver(),
92
- colorMode = _useThemeObserver.colorMode;
92
+ colorMode = _useThemeObserver.colorMode,
93
+ typography = _useThemeObserver.typography;
93
94
  var editorAPI = usePresetContext();
94
95
  var _useSharedPluginState = useSharedPluginState(editorAPI, ['editorViewMode']),
95
96
  editorViewModeState = _useSharedPluginState.editorViewModeState;
@@ -98,9 +99,10 @@ export var createEditorContentStyle = function createEditorContentStyle(styles)
98
99
  theme: theme,
99
100
  colorMode: colorMode,
100
101
  featureFlags: featureFlags,
101
- viewMode: fg('platform_editor_remove_use_preset_context') ? props.viewMode : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
102
+ viewMode: fg('platform_editor_remove_use_preset_context') ? props.viewMode : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
103
+ typographyTheme: typography
102
104
  });
103
- }, [theme, colorMode, featureFlags, editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode, props.viewMode]);
105
+ }, [theme, colorMode, featureFlags, editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode, props.viewMode, typography]);
104
106
  return (
105
107
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
106
108
  jsx("div", {
@@ -1,31 +1,66 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
3
  import _createClass from "@babel/runtime/helpers/createClass";
3
4
  import _inherits from "@babel/runtime/helpers/inherits";
4
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
7
  function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
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 { EditorContext } from '@atlaskit/editor-common/UNSAFE_do_not_use_editor_context';
11
12
  import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import EditorActions from '../../actions';
13
14
  import { PresetContextProvider } from '../../presets/context';
14
- var EditorContext = /*#__PURE__*/React.createContext({});
15
15
  export var useEditorContext = function useEditorContext() {
16
16
  return React.useContext(EditorContext);
17
17
  };
18
- var LegacyEditorContext = /*#__PURE__*/function (_React$Component) {
18
+ export var LegacyEditorContext = /*#__PURE__*/function (_React$Component) {
19
19
  _inherits(LegacyEditorContext, _React$Component);
20
20
  var _super = _createSuper(LegacyEditorContext);
21
21
  function LegacyEditorContext(props) {
22
- var _this;
23
22
  _classCallCheck(this, LegacyEditorContext);
24
- _this = _super.call(this, props);
23
+ return _super.call(this, props);
24
+ }
25
+ _createClass(LegacyEditorContext, [{
26
+ key: "render",
27
+ value: function render() {
28
+ if (fg('platform_editor_react18_phase2')) {
29
+ return /*#__PURE__*/React.createElement(LegacyEditorContextNew, this.props, this.props.children);
30
+ }
31
+ return /*#__PURE__*/React.createElement(LegacyEditorContextOld, this.props, this.props.children);
32
+ }
33
+ }]);
34
+ return LegacyEditorContext;
35
+ }(React.Component);
36
+ function LegacyEditorContextNew(_ref) {
37
+ var children = _ref.children,
38
+ editorActions = _ref.editorActions;
39
+ if (fg('platform_editor_remove_use_preset_context')) {
40
+ return /*#__PURE__*/React.createElement(EditorContext.Provider, {
41
+ value: {
42
+ editorActions: editorActions !== null && editorActions !== void 0 ? editorActions : new EditorActions()
43
+ }
44
+ }, children);
45
+ } else {
46
+ return /*#__PURE__*/React.createElement(EditorContext.Provider, {
47
+ value: {
48
+ editorActions: editorActions !== null && editorActions !== void 0 ? editorActions : new EditorActions()
49
+ }
50
+ }, /*#__PURE__*/React.createElement(PresetContextProvider, null, children));
51
+ }
52
+ }
53
+ var LegacyEditorContextOld = /*#__PURE__*/function (_React$Component2) {
54
+ _inherits(LegacyEditorContextOld, _React$Component2);
55
+ var _super2 = _createSuper(LegacyEditorContextOld);
56
+ function LegacyEditorContextOld(props) {
57
+ var _this;
58
+ _classCallCheck(this, LegacyEditorContextOld);
59
+ _this = _super2.call(this, props);
25
60
  _this.editorActions = props.editorActions || new EditorActions();
26
61
  return _this;
27
62
  }
28
- _createClass(LegacyEditorContext, [{
63
+ _createClass(LegacyEditorContextOld, [{
29
64
  key: "getChildContext",
30
65
  value: function getChildContext() {
31
66
  return {
@@ -46,9 +81,9 @@ var LegacyEditorContext = /*#__PURE__*/function (_React$Component) {
46
81
  }
47
82
  }
48
83
  }]);
49
- return LegacyEditorContext;
84
+ return LegacyEditorContextOld;
50
85
  }(React.Component);
51
- _defineProperty(LegacyEditorContext, "childContextTypes", {
86
+ _defineProperty(LegacyEditorContextOld, "childContextTypes", {
52
87
  editorActions: PropTypes.object
53
88
  });
54
- export { LegacyEditorContext as default };
89
+ export { LegacyEditorContextOld as default };