@atlaskit/editor-core 210.1.3 → 210.1.5

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 (36) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/presets/default.js +1 -1
  3. package/dist/cjs/ui/Appearance/FullPage/FullPage.js +8 -3
  4. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +2 -2
  5. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbarNext.compiled.css +4 -1
  6. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbarNext.js +61 -30
  7. package/dist/cjs/ui/ContextPanel/index.js +2 -2
  8. package/dist/cjs/ui/Toolbar/Toolbar.js +7 -3
  9. package/dist/cjs/version-wrapper.js +1 -1
  10. package/dist/es2019/presets/default.js +1 -1
  11. package/dist/es2019/ui/Appearance/FullPage/FullPage.js +8 -3
  12. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +1 -1
  13. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbarNext.compiled.css +4 -1
  14. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbarNext.js +52 -23
  15. package/dist/es2019/ui/ContextPanel/index.js +1 -1
  16. package/dist/es2019/ui/Toolbar/Toolbar.js +7 -3
  17. package/dist/es2019/version-wrapper.js +1 -1
  18. package/dist/esm/presets/default.js +1 -1
  19. package/dist/esm/ui/Appearance/FullPage/FullPage.js +8 -3
  20. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +1 -1
  21. package/dist/esm/ui/Appearance/FullPage/FullPageToolbarNext.compiled.css +4 -1
  22. package/dist/esm/ui/Appearance/FullPage/FullPageToolbarNext.js +59 -29
  23. package/dist/esm/ui/ContextPanel/index.js +1 -1
  24. package/dist/esm/ui/Toolbar/Toolbar.js +7 -3
  25. package/dist/esm/version-wrapper.js +1 -1
  26. package/dist/types/create-editor/create-universal-preset.d.ts +3 -0
  27. package/dist/types/presets/universal.d.ts +3 -0
  28. package/dist/types/presets/useUniversalPreset.d.ts +3 -0
  29. package/dist/types/ui/Appearance/FullPage/FullPageToolbarNext.d.ts +3 -14
  30. package/dist/types/ui/Toolbar/Toolbar.d.ts +4 -2
  31. package/dist/types-ts4.5/create-editor/create-universal-preset.d.ts +3 -0
  32. package/dist/types-ts4.5/presets/universal.d.ts +3 -0
  33. package/dist/types-ts4.5/presets/useUniversalPreset.d.ts +3 -0
  34. package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageToolbarNext.d.ts +3 -14
  35. package/dist/types-ts4.5/ui/Toolbar/Toolbar.d.ts +4 -2
  36. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 210.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e73faa5a52300`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e73faa5a52300) -
8
+ [ux] ED-28735 Fix selection toolbar opening and closing state
9
+ - Updated dependencies
10
+
11
+ ## 210.1.4
12
+
13
+ ### Patch Changes
14
+
15
+ - [`286abb4d35eba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/286abb4d35eba) -
16
+ [ux] [ED-28960] Finish full page primary toolbar migration
17
+
18
+ - Align with design update (separator, gap, height, icon size)
19
+ - Add keyboard shortcut to focus toolbar and arrow key navigation
20
+ - Address accessibility
21
+
22
+ - Updated dependencies
23
+
3
24
  ## 210.1.3
4
25
 
5
26
  ### Patch Changes
@@ -69,7 +69,7 @@ function createDefaultPreset(options) {
69
69
  return (0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin');
70
70
  }).maybeAdd(_interaction.interactionPlugin, Boolean(options === null || options === void 0 ? void 0 : options.__livePage) || (0, _expValEquals.expValEquals)('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true)).add(_composition.compositionPlugin).add([_contextIdentifier.contextIdentifierPlugin, {
71
71
  contextIdentifierProvider: options.contextIdentifierProvider
72
- }]).add([_base.basePlugin, options.base]).add(_decorations.decorationsPlugin).add([_typeAhead.typeAheadPlugin, options.typeAhead]).maybeAdd(_history.historyPlugin, Boolean(options.allowUndoRedoButtons)).maybeAdd([_toolbar.toolbarPlugin, options.toolbar], (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc', 'isEnabled', true)).add([_primaryToolbar.primaryToolbarPlugin, {
72
+ }]).add([_base.basePlugin, options.base]).add(_decorations.decorationsPlugin).add([_typeAhead.typeAheadPlugin, options.typeAhead]).maybeAdd(_history.historyPlugin, Boolean(options.allowUndoRedoButtons)).maybeAdd([_toolbar.toolbarPlugin, options.toolbar || {}], (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc', 'isEnabled', true)).add([_primaryToolbar.primaryToolbarPlugin, {
73
73
  contextualFormattingEnabled: isFullPage
74
74
  }]).maybeAdd(_undoRedo.undoRedoPlugin, Boolean((_options$featureFlags = (_options$featureFlags2 = options.featureFlags) === null || _options$featureFlags2 === void 0 ? void 0 : _options$featureFlags2.undoRedoButtons) !== null && _options$featureFlags !== void 0 ? _options$featureFlags : options.allowUndoRedoButtons)).add([_blockType.blockTypePlugin, _objectSpread(_objectSpread({}, options.blockType), {}, {
75
75
  includeBlockQuoteAsTextstyleOption: isFullPage
@@ -9,6 +9,7 @@ exports.FullPageEditor = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _react2 = require("@emotion/react");
12
+ var _reactIntlNext = require("react-intl-next");
12
13
  var _browser = require("@atlaskit/editor-common/browser");
13
14
  var _hooks = require("@atlaskit/editor-common/hooks");
14
15
  var _ui = require("@atlaskit/editor-common/ui");
@@ -171,12 +172,16 @@ var FullPageEditor = exports.FullPageEditor = function FullPageEditor(props) {
171
172
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
172
173
  '--ak-editor-fullpage-toolbar-height': (0, _editorSharedStyles.FULL_PAGE_EDITOR_TOOLBAR_HEIGHT)()
173
174
  }
174
- }, !isEditorToolbarHidden && ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc', 'isEnabled', true) ? (0, _react2.jsx)(_FullPageToolbarNext.FullPageToolbarNext, {
175
+ }, !isEditorToolbarHidden && ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc', 'isEnabled', true) ? (0, _react2.jsx)(_reactIntlNext.IntlProvider, {
176
+ locale: "en"
177
+ }, (0, _react2.jsx)(_FullPageToolbarNext.FullPageToolbarNext, {
175
178
  toolbarDockingPosition: toolbarDockingPosition !== null && toolbarDockingPosition !== void 0 ? toolbarDockingPosition : toolbarDocking,
176
179
  beforeIcon: props.primaryToolbarIconBefore,
177
180
  editorAPI: editorAPI,
178
- editorView: props.editorView
179
- }) : (0, _react2.jsx)(_FullPageToolbar.FullPageToolbar, {
181
+ editorView: props.editorView,
182
+ popupsMountPoint: props.popupsMountPoint,
183
+ showKeyline: showKeyline
184
+ })) : (0, _react2.jsx)(_FullPageToolbar.FullPageToolbar, {
180
185
  appearance: props.appearance,
181
186
  editorAPI: editorAPI,
182
187
  beforeIcon: props.primaryToolbarIconBefore,
@@ -10,8 +10,8 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _react2 = require("@emotion/react");
12
12
  var _reactIntlNext = require("react-intl-next");
13
+ var _contextPanel = require("@atlaskit/editor-common/context-panel");
13
14
  var _messages = require("@atlaskit/editor-common/messages");
14
- var _ui = require("@atlaskit/editor-common/ui");
15
15
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
16
16
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
17
17
  var _ToolbarPortal = require("../../Toolbar/ToolbarPortal");
@@ -124,7 +124,7 @@ var EditorToolbar = exports.EditorToolbar = /*#__PURE__*/_react.default.memo(fun
124
124
  event.stopPropagation();
125
125
  }, [props.editorView]);
126
126
  var handleEscape = (0, _experiments.editorExperiment)('platform_editor_toolbar_rerender_optimization_exp', true) ? handleEscapeMemoized : handleEscapeRaw;
127
- return (0, _react2.jsx)(_ui.ContextPanelConsumer, null, function (_ref2) {
127
+ return (0, _react2.jsx)(_contextPanel.ContextPanelConsumer, null, function (_ref2) {
128
128
  var contextPanelWidth = _ref2.width;
129
129
  return (0, _react2.jsx)(_uiMenu.ToolbarArrowKeyNavigationProvider, {
130
130
  editorView: props.editorView,
@@ -1,4 +1,7 @@
1
1
 
2
- ._n7zl7r9e{border-bottom:var(--ds-border-width,1px) solid var(--ds-border,#091e4224)}._19pkpxbi{margin-top:var(--ds-space-200,1pc)}
2
+ ._18zrutpp{padding-inline:var(--ds-space-150,9pt)}
3
+ ._1rjc12x7{padding-block:var(--ds-space-075,6px)}
4
+ ._n7zl7r9e{border-bottom:var(--ds-border-width,1px) solid var(--ds-border,#091e4224)}._16qs9g9j{box-shadow:var(--ds-shadow-overflow,0 0 8px #091e4228,0 0 1px #091e421e)}
5
+ ._19pkpxbi{margin-top:var(--ds-space-200,1pc)}
3
6
  ._2hwxpxbi{margin-right:var(--ds-space-200,1pc)}
4
7
  ._otyrpxbi{margin-bottom:var(--ds-space-200,1pc)}
@@ -1,51 +1,47 @@
1
1
  /* FullPageToolbarNext.tsx generated by @compiled/babel-plugin v0.36.1 */
2
2
  "use strict";
3
3
 
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.FullPageToolbarNext = void 0;
9
9
  require("./FullPageToolbarNext.compiled.css");
10
10
  var _runtime = require("@compiled/react/runtime");
11
- var _react = _interopRequireDefault(require("react"));
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var _reactIntlNext = require("react-intl-next");
13
+ var _contextPanel = require("@atlaskit/editor-common/context-panel");
12
14
  var _toolbar = require("@atlaskit/editor-common/toolbar");
15
+ var _uiMenu = require("@atlaskit/editor-common/ui-menu");
16
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
13
17
  var _toolbar2 = require("../../../utils/toolbar");
14
18
  var _Toolbar = require("../../Toolbar/Toolbar");
15
19
  var _ToolbarPortal = require("../../Toolbar/ToolbarPortal");
20
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
16
21
  var styles = {
17
22
  mainToolbarIconBefore: "_19pkpxbi _2hwxpxbi _otyrpxbi",
18
- mainToolbarWrapper: "_n7zl7r9e"
23
+ mainToolbarWrapper: "_1rjc12x7 _18zrutpp _n7zl7r9e",
24
+ mainToolbarWithKeyline: "_16qs9g9j"
19
25
  };
20
26
  var MainToolbarWrapper = function MainToolbarWrapper(_ref) {
21
27
  var children = _ref.children,
22
- testId = _ref.testId;
28
+ testId = _ref.testId,
29
+ showKeyline = _ref.showKeyline;
23
30
  return /*#__PURE__*/_react.default.createElement("div", {
24
31
  "data-testid": testId,
25
- className: (0, _runtime.ax)([styles.mainToolbarWrapper])
32
+ className: (0, _runtime.ax)([styles.mainToolbarWrapper, showKeyline && styles.mainToolbarWithKeyline])
26
33
  }, children);
27
34
  };
28
-
29
- /**
30
- * TODO: ED-28732 - This component is a work in progress, re-writing `FullPageToolbar` and is not yet complete.
31
- *
32
- * [ ] Add support for custom toolbar + splitting into two lines
33
- *
34
- * [ ] Add support for toolbar keyboard shortcuts
35
- *
36
- * [ ] Add support for toolbar analytics
37
- *
38
- * [ ] Add support for toolbar accessibility
39
- *
40
- * [ ] Add support for toolbar localization
41
- */
42
35
  var FullPageToolbarNext = exports.FullPageToolbarNext = function FullPageToolbarNext(_ref2) {
43
36
  var _editorAPI$toolbar, _useToolbarPortal;
44
37
  var editorAPI = _ref2.editorAPI,
45
38
  beforeIcon = _ref2.beforeIcon,
46
39
  toolbarDockingPosition = _ref2.toolbarDockingPosition,
47
- editorView = _ref2.editorView;
40
+ editorView = _ref2.editorView,
41
+ popupsMountPoint = _ref2.popupsMountPoint,
42
+ showKeyline = _ref2.showKeyline;
48
43
  var components = editorAPI === null || editorAPI === void 0 || (_editorAPI$toolbar = editorAPI.toolbar) === null || _editorAPI$toolbar === void 0 ? void 0 : _editorAPI$toolbar.actions.getComponents();
44
+ var intl = (0, _reactIntlNext.useIntl)();
49
45
  var toolbar = components === null || components === void 0 ? void 0 : components.find(function (component) {
50
46
  return component.key === _toolbar.TOOLBARS.PRIMARY_TOOLBAR;
51
47
  });
@@ -56,14 +52,49 @@ var FullPageToolbarNext = exports.FullPageToolbarNext = function FullPageToolbar
56
52
  Portal: _react.default.Fragment
57
53
  },
58
54
  ToolbarPortal = _ref3.Portal;
59
- return /*#__PURE__*/_react.default.createElement(ToolbarPortal, null, /*#__PURE__*/_react.default.createElement(MainToolbarWrapper, {
60
- testId: "full-page-primary-toolbar"
61
- }, beforeIcon && /*#__PURE__*/_react.default.createElement("div", {
62
- className: (0, _runtime.ax)([styles.mainToolbarIconBefore])
63
- }, beforeIcon), toolbarDockingPosition !== 'none' && components && (0, _toolbar2.isToolbar)(toolbar) && /*#__PURE__*/_react.default.createElement(_Toolbar.ToolbarNext, {
64
- toolbar: toolbar,
65
- components: components,
66
- editorView: editorView,
67
- editorAPI: editorAPI
68
- })));
55
+ var hasToolbarPortal = ToolbarPortal !== _react.default.Fragment;
56
+ var mountPoint = hasToolbarPortal ? undefined : popupsMountPoint;
57
+ var isShortcutToFocusToolbarRaw = function isShortcutToFocusToolbarRaw(event) {
58
+ //Alt + F9 to reach first element in this main toolbar
59
+ return event.altKey && event.key === 'F9';
60
+ };
61
+ var isShortcutToFocusToolbarMemoized = (0, _react.useCallback)(isShortcutToFocusToolbarRaw, []);
62
+ var isShortcutToFocusToolbar = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_toolbar_rerender_optimization_exp', 'isEnabled', true) ? isShortcutToFocusToolbarMemoized : isShortcutToFocusToolbarRaw;
63
+ var handleEscapeRaw = function handleEscapeRaw(event) {
64
+ if (!(editorView !== null && editorView !== void 0 && editorView.hasFocus())) {
65
+ editorView === null || editorView === void 0 || editorView.focus();
66
+ }
67
+ event.preventDefault();
68
+ event.stopPropagation();
69
+ };
70
+ var handleEscapeMemoized = (0, _react.useCallback)(function (event) {
71
+ if (!(editorView !== null && editorView !== void 0 && editorView.hasFocus())) {
72
+ editorView === null || editorView === void 0 || editorView.focus();
73
+ }
74
+ event.preventDefault();
75
+ event.stopPropagation();
76
+ }, [editorView]);
77
+ var handleEscape = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_toolbar_rerender_optimization_exp', 'isEnabled', true) ? handleEscapeMemoized : handleEscapeRaw;
78
+ return /*#__PURE__*/_react.default.createElement(_contextPanel.ContextPanelConsumer, null, function (_ref4) {
79
+ var ContextPanelWidth = _ref4.width;
80
+ return /*#__PURE__*/_react.default.createElement(_uiMenu.ToolbarArrowKeyNavigationProvider, {
81
+ editorView: editorView,
82
+ childComponentSelector: "[data-testid='ak-editor-main-toolbar']",
83
+ isShortcutToFocusToolbar: isShortcutToFocusToolbar,
84
+ handleEscape: handleEscape,
85
+ intl: intl
86
+ }, /*#__PURE__*/_react.default.createElement(ToolbarPortal, null, /*#__PURE__*/_react.default.createElement(MainToolbarWrapper, {
87
+ testId: "ak-editor-main-toolbar",
88
+ showKeyline: showKeyline || ContextPanelWidth > 0
89
+ }, beforeIcon && /*#__PURE__*/_react.default.createElement("div", {
90
+ className: (0, _runtime.ax)([styles.mainToolbarIconBefore])
91
+ }, beforeIcon), toolbarDockingPosition !== 'none' && components && (0, _toolbar2.isToolbar)(toolbar) && /*#__PURE__*/_react.default.createElement(_Toolbar.ToolbarNext, {
92
+ toolbar: toolbar,
93
+ components: components,
94
+ editorView: editorView,
95
+ editorAPI: editorAPI,
96
+ popupsMountPoint: mountPoint,
97
+ editorAppearance: "full-page"
98
+ }))));
99
+ });
69
100
  };
@@ -17,9 +17,9 @@ var _react = _interopRequireDefault(require("react"));
17
17
  var _react2 = require("@emotion/react");
18
18
  var _reactIntlNext = require("react-intl-next");
19
19
  var _Transition = _interopRequireDefault(require("react-transition-group/Transition"));
20
+ var _contextPanel = require("@atlaskit/editor-common/context-panel");
20
21
  var _hooks = require("@atlaskit/editor-common/hooks");
21
22
  var _messages = require("@atlaskit/editor-common/messages");
22
- var _ui = require("@atlaskit/editor-common/ui");
23
23
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
24
24
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
25
25
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -145,7 +145,7 @@ var SwappableContentAreaInner = /*#__PURE__*/function (_React$PureComponent) {
145
145
  width: "".concat(this.props.customWidth, "px"),
146
146
  overflowX: 'hidden'
147
147
  });
148
- return (0, _react2.jsx)(_ui.ContextPanelConsumer, null, function (_ref) {
148
+ return (0, _react2.jsx)(_contextPanel.ContextPanelConsumer, null, function (_ref) {
149
149
  var _this2$props$intl;
150
150
  var broadcastWidth = _ref.broadcastWidth;
151
151
  var contextPanelWidth = visible ? width : 0;
@@ -45,14 +45,18 @@ var ToolbarNext = exports.ToolbarNext = function ToolbarNext(_ref) {
45
45
  var toolbar = _ref.toolbar,
46
46
  components = _ref.components,
47
47
  editorView = _ref.editorView,
48
- editorAPI = _ref.editorAPI;
48
+ editorAPI = _ref.editorAPI,
49
+ popupsMountPoint = _ref.popupsMountPoint,
50
+ editorAppearance = _ref.editorAppearance;
49
51
  var connectivityStateMode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(editorAPI, 'connectivity.mode');
50
52
  var isOffline = connectivityStateMode === 'offline';
51
53
  return /*#__PURE__*/_react.default.createElement(_toolbar.EditorToolbarProvider, {
52
- editorView: editorView !== null && editorView !== void 0 ? editorView : null
54
+ editorView: editorView !== null && editorView !== void 0 ? editorView : null,
55
+ editorAppearance: editorAppearance
53
56
  }, /*#__PURE__*/_react.default.createElement(_toolbar.EditorToolbarUIProvider, {
54
57
  api: editorAPI,
55
- isDisabled: isOffline
58
+ isDisabled: isOffline,
59
+ popupsMountPoint: popupsMountPoint
56
60
  }, /*#__PURE__*/_react.default.createElement(_editorToolbarModel.ToolbarModelRenderer, {
57
61
  toolbar: toolbar,
58
62
  components: components,
@@ -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 = "210.1.2";
8
+ var version = exports.version = "210.1.4";
@@ -60,7 +60,7 @@ export function createDefaultPreset(options) {
60
60
  }
61
61
  }], () => fg('platform_editor_use_preferences_plugin')).maybeAdd(interactionPlugin, Boolean(options === null || options === void 0 ? void 0 : options.__livePage) || expValEquals('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true)).add(compositionPlugin).add([contextIdentifierPlugin, {
62
62
  contextIdentifierProvider: options.contextIdentifierProvider
63
- }]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead]).maybeAdd(historyPlugin, Boolean(options.allowUndoRedoButtons)).maybeAdd([toolbarPlugin, options.toolbar], expValEquals('platform_editor_toolbar_aifc', 'isEnabled', true)).add([primaryToolbarPlugin, {
63
+ }]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead]).maybeAdd(historyPlugin, Boolean(options.allowUndoRedoButtons)).maybeAdd([toolbarPlugin, options.toolbar || {}], expValEquals('platform_editor_toolbar_aifc', 'isEnabled', true)).add([primaryToolbarPlugin, {
64
64
  contextualFormattingEnabled: isFullPage
65
65
  }]).maybeAdd(undoRedoPlugin, Boolean((_options$featureFlags = (_options$featureFlags2 = options.featureFlags) === null || _options$featureFlags2 === void 0 ? void 0 : _options$featureFlags2.undoRedoButtons) !== null && _options$featureFlags !== void 0 ? _options$featureFlags : options.allowUndoRedoButtons)).add([blockTypePlugin, {
66
66
  ...options.blockType,
@@ -6,6 +6,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
6
6
 
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { jsx } from '@emotion/react';
9
+ import { IntlProvider } from 'react-intl-next';
9
10
  import { browser } from '@atlaskit/editor-common/browser';
10
11
  import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
11
12
  import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
@@ -158,12 +159,16 @@ export const FullPageEditor = props => {
158
159
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
159
160
  '--ak-editor-fullpage-toolbar-height': FULL_PAGE_EDITOR_TOOLBAR_HEIGHT()
160
161
  }
161
- }, !isEditorToolbarHidden && (expValEquals('platform_editor_toolbar_aifc', 'isEnabled', true) ? jsx(FullPageToolbarNext, {
162
+ }, !isEditorToolbarHidden && (expValEquals('platform_editor_toolbar_aifc', 'isEnabled', true) ? jsx(IntlProvider, {
163
+ locale: "en"
164
+ }, jsx(FullPageToolbarNext, {
162
165
  toolbarDockingPosition: toolbarDockingPosition !== null && toolbarDockingPosition !== void 0 ? toolbarDockingPosition : toolbarDocking,
163
166
  beforeIcon: props.primaryToolbarIconBefore,
164
167
  editorAPI: editorAPI,
165
- editorView: props.editorView
166
- }) : jsx(FullPageToolbar, {
168
+ editorView: props.editorView,
169
+ popupsMountPoint: props.popupsMountPoint,
170
+ showKeyline: showKeyline
171
+ })) : jsx(FullPageToolbar, {
167
172
  appearance: props.appearance,
168
173
  editorAPI: editorAPI,
169
174
  beforeIcon: props.primaryToolbarIconBefore,
@@ -8,8 +8,8 @@ import React, { useEffect, useCallback, useState } from 'react';
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
9
  import { jsx } from '@emotion/react';
10
10
  import { injectIntl } from 'react-intl-next';
11
+ import { ContextPanelConsumer } from '@atlaskit/editor-common/context-panel';
11
12
  import { fullPageMessages as messages } from '@atlaskit/editor-common/messages';
12
- import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
13
13
  import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
14
14
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
15
15
  import { ToolbarPortalMountPoint, useToolbarPortal } from '../../Toolbar/ToolbarPortal';
@@ -1,4 +1,7 @@
1
1
 
2
- ._n7zl7r9e{border-bottom:var(--ds-border-width,1px) solid var(--ds-border,#091e4224)}._19pkpxbi{margin-top:var(--ds-space-200,1pc)}
2
+ ._18zrutpp{padding-inline:var(--ds-space-150,9pt)}
3
+ ._1rjc12x7{padding-block:var(--ds-space-075,6px)}
4
+ ._n7zl7r9e{border-bottom:var(--ds-border-width,1px) solid var(--ds-border,#091e4224)}._16qs9g9j{box-shadow:var(--ds-shadow-overflow,0 0 8px #091e4228,0 0 1px #091e421e)}
5
+ ._19pkpxbi{margin-top:var(--ds-space-200,1pc)}
3
6
  ._2hwxpxbi{margin-right:var(--ds-space-200,1pc)}
4
7
  ._otyrpxbi{margin-bottom:var(--ds-space-200,1pc)}
@@ -1,46 +1,41 @@
1
1
  /* FullPageToolbarNext.tsx generated by @compiled/babel-plugin v0.36.1 */
2
2
  import "./FullPageToolbarNext.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
- import React from 'react';
4
+ import React, { useCallback } from 'react';
5
+ import { useIntl } from 'react-intl-next';
6
+ import { ContextPanelConsumer } from '@atlaskit/editor-common/context-panel';
5
7
  import { TOOLBARS } from '@atlaskit/editor-common/toolbar';
8
+ import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
9
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
6
10
  import { isToolbar } from '../../../utils/toolbar';
7
11
  import { ToolbarNext } from '../../Toolbar/Toolbar';
8
12
  import { useToolbarPortal } from '../../Toolbar/ToolbarPortal';
9
13
  const styles = {
10
14
  mainToolbarIconBefore: "_19pkpxbi _2hwxpxbi _otyrpxbi",
11
- mainToolbarWrapper: "_n7zl7r9e"
15
+ mainToolbarWrapper: "_1rjc12x7 _18zrutpp _n7zl7r9e",
16
+ mainToolbarWithKeyline: "_16qs9g9j"
12
17
  };
13
18
  const MainToolbarWrapper = ({
14
19
  children,
15
- testId
20
+ testId,
21
+ showKeyline
16
22
  }) => {
17
23
  return /*#__PURE__*/React.createElement("div", {
18
24
  "data-testid": testId,
19
- className: ax([styles.mainToolbarWrapper])
25
+ className: ax([styles.mainToolbarWrapper, showKeyline && styles.mainToolbarWithKeyline])
20
26
  }, children);
21
27
  };
22
-
23
- /**
24
- * TODO: ED-28732 - This component is a work in progress, re-writing `FullPageToolbar` and is not yet complete.
25
- *
26
- * [ ] Add support for custom toolbar + splitting into two lines
27
- *
28
- * [ ] Add support for toolbar keyboard shortcuts
29
- *
30
- * [ ] Add support for toolbar analytics
31
- *
32
- * [ ] Add support for toolbar accessibility
33
- *
34
- * [ ] Add support for toolbar localization
35
- */
36
28
  export const FullPageToolbarNext = ({
37
29
  editorAPI,
38
30
  beforeIcon,
39
31
  toolbarDockingPosition,
40
- editorView
32
+ editorView,
33
+ popupsMountPoint,
34
+ showKeyline
41
35
  }) => {
42
36
  var _editorAPI$toolbar, _useToolbarPortal;
43
37
  const components = editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$toolbar = editorAPI.toolbar) === null || _editorAPI$toolbar === void 0 ? void 0 : _editorAPI$toolbar.actions.getComponents();
38
+ const intl = useIntl();
44
39
  const toolbar = components === null || components === void 0 ? void 0 : components.find(component => component.key === TOOLBARS.PRIMARY_TOOLBAR);
45
40
 
46
41
  // When a toolbar portal context is provided, render the toolbar inside a portal.
@@ -50,14 +45,48 @@ export const FullPageToolbarNext = ({
50
45
  } = (_useToolbarPortal = useToolbarPortal()) !== null && _useToolbarPortal !== void 0 ? _useToolbarPortal : {
51
46
  Portal: React.Fragment
52
47
  };
53
- return /*#__PURE__*/React.createElement(ToolbarPortal, null, /*#__PURE__*/React.createElement(MainToolbarWrapper, {
54
- testId: "full-page-primary-toolbar"
48
+ const hasToolbarPortal = ToolbarPortal !== React.Fragment;
49
+ const mountPoint = hasToolbarPortal ? undefined : popupsMountPoint;
50
+ const isShortcutToFocusToolbarRaw = event => {
51
+ //Alt + F9 to reach first element in this main toolbar
52
+ return event.altKey && event.key === 'F9';
53
+ };
54
+ const isShortcutToFocusToolbarMemoized = useCallback(isShortcutToFocusToolbarRaw, []);
55
+ const isShortcutToFocusToolbar = expValEqualsNoExposure('platform_editor_toolbar_rerender_optimization_exp', 'isEnabled', true) ? isShortcutToFocusToolbarMemoized : isShortcutToFocusToolbarRaw;
56
+ const handleEscapeRaw = event => {
57
+ if (!(editorView !== null && editorView !== void 0 && editorView.hasFocus())) {
58
+ editorView === null || editorView === void 0 ? void 0 : editorView.focus();
59
+ }
60
+ event.preventDefault();
61
+ event.stopPropagation();
62
+ };
63
+ const handleEscapeMemoized = useCallback(event => {
64
+ if (!(editorView !== null && editorView !== void 0 && editorView.hasFocus())) {
65
+ editorView === null || editorView === void 0 ? void 0 : editorView.focus();
66
+ }
67
+ event.preventDefault();
68
+ event.stopPropagation();
69
+ }, [editorView]);
70
+ const handleEscape = expValEqualsNoExposure('platform_editor_toolbar_rerender_optimization_exp', 'isEnabled', true) ? handleEscapeMemoized : handleEscapeRaw;
71
+ return /*#__PURE__*/React.createElement(ContextPanelConsumer, null, ({
72
+ width: ContextPanelWidth
73
+ }) => /*#__PURE__*/React.createElement(ToolbarArrowKeyNavigationProvider, {
74
+ editorView: editorView,
75
+ childComponentSelector: "[data-testid='ak-editor-main-toolbar']",
76
+ isShortcutToFocusToolbar: isShortcutToFocusToolbar,
77
+ handleEscape: handleEscape,
78
+ intl: intl
79
+ }, /*#__PURE__*/React.createElement(ToolbarPortal, null, /*#__PURE__*/React.createElement(MainToolbarWrapper, {
80
+ testId: "ak-editor-main-toolbar",
81
+ showKeyline: showKeyline || ContextPanelWidth > 0
55
82
  }, beforeIcon && /*#__PURE__*/React.createElement("div", {
56
83
  className: ax([styles.mainToolbarIconBefore])
57
84
  }, beforeIcon), toolbarDockingPosition !== 'none' && components && isToolbar(toolbar) && /*#__PURE__*/React.createElement(ToolbarNext, {
58
85
  toolbar: toolbar,
59
86
  components: components,
60
87
  editorView: editorView,
61
- editorAPI: editorAPI
62
- })));
88
+ editorAPI: editorAPI,
89
+ popupsMountPoint: mountPoint,
90
+ editorAppearance: "full-page"
91
+ })))));
63
92
  };
@@ -10,9 +10,9 @@ import React from 'react';
10
10
  import { css, jsx } from '@emotion/react';
11
11
  import { injectIntl } from 'react-intl-next';
12
12
  import Transition from 'react-transition-group/Transition';
13
+ import { ContextPanelConsumer } from '@atlaskit/editor-common/context-panel';
13
14
  import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
14
15
  import { contextPanelMessages } from '@atlaskit/editor-common/messages';
15
- import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
16
16
  import { akEditorContextPanelWidth, akEditorSwoopCubicBezier } from '@atlaskit/editor-shared-styles';
17
17
  import { fg } from '@atlaskit/platform-feature-flags';
18
18
  const ANIM_SPEED_MS = 500;
@@ -39,15 +39,19 @@ export const ToolbarNext = ({
39
39
  toolbar,
40
40
  components,
41
41
  editorView,
42
- editorAPI
42
+ editorAPI,
43
+ popupsMountPoint,
44
+ editorAppearance
43
45
  }) => {
44
46
  const connectivityStateMode = useSharedPluginStateSelector(editorAPI, 'connectivity.mode');
45
47
  const isOffline = connectivityStateMode === 'offline';
46
48
  return /*#__PURE__*/React.createElement(EditorToolbarProvider, {
47
- editorView: editorView !== null && editorView !== void 0 ? editorView : null
49
+ editorView: editorView !== null && editorView !== void 0 ? editorView : null,
50
+ editorAppearance: editorAppearance
48
51
  }, /*#__PURE__*/React.createElement(EditorToolbarUIProvider, {
49
52
  api: editorAPI,
50
- isDisabled: isOffline
53
+ isDisabled: isOffline,
54
+ popupsMountPoint: popupsMountPoint
51
55
  }, /*#__PURE__*/React.createElement(ToolbarModelRenderer, {
52
56
  toolbar: toolbar,
53
57
  components: components,
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "210.1.2";
2
+ export const version = "210.1.4";
@@ -64,7 +64,7 @@ export function createDefaultPreset(options) {
64
64
  return fg('platform_editor_use_preferences_plugin');
65
65
  }).maybeAdd(interactionPlugin, Boolean(options === null || options === void 0 ? void 0 : options.__livePage) || expValEquals('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true)).add(compositionPlugin).add([contextIdentifierPlugin, {
66
66
  contextIdentifierProvider: options.contextIdentifierProvider
67
- }]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead]).maybeAdd(historyPlugin, Boolean(options.allowUndoRedoButtons)).maybeAdd([toolbarPlugin, options.toolbar], expValEquals('platform_editor_toolbar_aifc', 'isEnabled', true)).add([primaryToolbarPlugin, {
67
+ }]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead]).maybeAdd(historyPlugin, Boolean(options.allowUndoRedoButtons)).maybeAdd([toolbarPlugin, options.toolbar || {}], expValEquals('platform_editor_toolbar_aifc', 'isEnabled', true)).add([primaryToolbarPlugin, {
68
68
  contextualFormattingEnabled: isFullPage
69
69
  }]).maybeAdd(undoRedoPlugin, Boolean((_options$featureFlags = (_options$featureFlags2 = options.featureFlags) === null || _options$featureFlags2 === void 0 ? void 0 : _options$featureFlags2.undoRedoButtons) !== null && _options$featureFlags !== void 0 ? _options$featureFlags : options.allowUndoRedoButtons)).add([blockTypePlugin, _objectSpread(_objectSpread({}, options.blockType), {}, {
70
70
  includeBlockQuoteAsTextstyleOption: isFullPage
@@ -7,6 +7,7 @@ import React, { useEffect, useMemo, useRef, 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 { jsx } from '@emotion/react';
10
+ import { IntlProvider } from 'react-intl-next';
10
11
  import { browser } from '@atlaskit/editor-common/browser';
11
12
  import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
12
13
  import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
@@ -161,12 +162,16 @@ export var FullPageEditor = function FullPageEditor(props) {
161
162
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
162
163
  '--ak-editor-fullpage-toolbar-height': FULL_PAGE_EDITOR_TOOLBAR_HEIGHT()
163
164
  }
164
- }, !isEditorToolbarHidden && (expValEquals('platform_editor_toolbar_aifc', 'isEnabled', true) ? jsx(FullPageToolbarNext, {
165
+ }, !isEditorToolbarHidden && (expValEquals('platform_editor_toolbar_aifc', 'isEnabled', true) ? jsx(IntlProvider, {
166
+ locale: "en"
167
+ }, jsx(FullPageToolbarNext, {
165
168
  toolbarDockingPosition: toolbarDockingPosition !== null && toolbarDockingPosition !== void 0 ? toolbarDockingPosition : toolbarDocking,
166
169
  beforeIcon: props.primaryToolbarIconBefore,
167
170
  editorAPI: editorAPI,
168
- editorView: props.editorView
169
- }) : jsx(FullPageToolbar, {
171
+ editorView: props.editorView,
172
+ popupsMountPoint: props.popupsMountPoint,
173
+ showKeyline: showKeyline
174
+ })) : jsx(FullPageToolbar, {
170
175
  appearance: props.appearance,
171
176
  editorAPI: editorAPI,
172
177
  beforeIcon: props.primaryToolbarIconBefore,
@@ -9,8 +9,8 @@ import React, { useEffect, useCallback, useState } from 'react';
9
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
10
  import { jsx } from '@emotion/react';
11
11
  import { injectIntl } from 'react-intl-next';
12
+ import { ContextPanelConsumer } from '@atlaskit/editor-common/context-panel';
12
13
  import { fullPageMessages as messages } from '@atlaskit/editor-common/messages';
13
- import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
14
14
  import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
15
15
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
16
16
  import { ToolbarPortalMountPoint, useToolbarPortal } from '../../Toolbar/ToolbarPortal';
@@ -1,4 +1,7 @@
1
1
 
2
- ._n7zl7r9e{border-bottom:var(--ds-border-width,1px) solid var(--ds-border,#091e4224)}._19pkpxbi{margin-top:var(--ds-space-200,1pc)}
2
+ ._18zrutpp{padding-inline:var(--ds-space-150,9pt)}
3
+ ._1rjc12x7{padding-block:var(--ds-space-075,6px)}
4
+ ._n7zl7r9e{border-bottom:var(--ds-border-width,1px) solid var(--ds-border,#091e4224)}._16qs9g9j{box-shadow:var(--ds-shadow-overflow,0 0 8px #091e4228,0 0 1px #091e421e)}
5
+ ._19pkpxbi{margin-top:var(--ds-space-200,1pc)}
3
6
  ._2hwxpxbi{margin-right:var(--ds-space-200,1pc)}
4
7
  ._otyrpxbi{margin-bottom:var(--ds-space-200,1pc)}
@@ -1,44 +1,39 @@
1
1
  /* FullPageToolbarNext.tsx generated by @compiled/babel-plugin v0.36.1 */
2
2
  import "./FullPageToolbarNext.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
- import React from 'react';
4
+ import React, { useCallback } from 'react';
5
+ import { useIntl } from 'react-intl-next';
6
+ import { ContextPanelConsumer } from '@atlaskit/editor-common/context-panel';
5
7
  import { TOOLBARS } from '@atlaskit/editor-common/toolbar';
8
+ import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
9
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
6
10
  import { isToolbar } from '../../../utils/toolbar';
7
11
  import { ToolbarNext } from '../../Toolbar/Toolbar';
8
12
  import { useToolbarPortal } from '../../Toolbar/ToolbarPortal';
9
13
  var styles = {
10
14
  mainToolbarIconBefore: "_19pkpxbi _2hwxpxbi _otyrpxbi",
11
- mainToolbarWrapper: "_n7zl7r9e"
15
+ mainToolbarWrapper: "_1rjc12x7 _18zrutpp _n7zl7r9e",
16
+ mainToolbarWithKeyline: "_16qs9g9j"
12
17
  };
13
18
  var MainToolbarWrapper = function MainToolbarWrapper(_ref) {
14
19
  var children = _ref.children,
15
- testId = _ref.testId;
20
+ testId = _ref.testId,
21
+ showKeyline = _ref.showKeyline;
16
22
  return /*#__PURE__*/React.createElement("div", {
17
23
  "data-testid": testId,
18
- className: ax([styles.mainToolbarWrapper])
24
+ className: ax([styles.mainToolbarWrapper, showKeyline && styles.mainToolbarWithKeyline])
19
25
  }, children);
20
26
  };
21
-
22
- /**
23
- * TODO: ED-28732 - This component is a work in progress, re-writing `FullPageToolbar` and is not yet complete.
24
- *
25
- * [ ] Add support for custom toolbar + splitting into two lines
26
- *
27
- * [ ] Add support for toolbar keyboard shortcuts
28
- *
29
- * [ ] Add support for toolbar analytics
30
- *
31
- * [ ] Add support for toolbar accessibility
32
- *
33
- * [ ] Add support for toolbar localization
34
- */
35
27
  export var FullPageToolbarNext = function FullPageToolbarNext(_ref2) {
36
28
  var _editorAPI$toolbar, _useToolbarPortal;
37
29
  var editorAPI = _ref2.editorAPI,
38
30
  beforeIcon = _ref2.beforeIcon,
39
31
  toolbarDockingPosition = _ref2.toolbarDockingPosition,
40
- editorView = _ref2.editorView;
32
+ editorView = _ref2.editorView,
33
+ popupsMountPoint = _ref2.popupsMountPoint,
34
+ showKeyline = _ref2.showKeyline;
41
35
  var components = editorAPI === null || editorAPI === void 0 || (_editorAPI$toolbar = editorAPI.toolbar) === null || _editorAPI$toolbar === void 0 ? void 0 : _editorAPI$toolbar.actions.getComponents();
36
+ var intl = useIntl();
42
37
  var toolbar = components === null || components === void 0 ? void 0 : components.find(function (component) {
43
38
  return component.key === TOOLBARS.PRIMARY_TOOLBAR;
44
39
  });
@@ -49,14 +44,49 @@ export var FullPageToolbarNext = function FullPageToolbarNext(_ref2) {
49
44
  Portal: React.Fragment
50
45
  },
51
46
  ToolbarPortal = _ref3.Portal;
52
- return /*#__PURE__*/React.createElement(ToolbarPortal, null, /*#__PURE__*/React.createElement(MainToolbarWrapper, {
53
- testId: "full-page-primary-toolbar"
54
- }, beforeIcon && /*#__PURE__*/React.createElement("div", {
55
- className: ax([styles.mainToolbarIconBefore])
56
- }, beforeIcon), toolbarDockingPosition !== 'none' && components && isToolbar(toolbar) && /*#__PURE__*/React.createElement(ToolbarNext, {
57
- toolbar: toolbar,
58
- components: components,
59
- editorView: editorView,
60
- editorAPI: editorAPI
61
- })));
47
+ var hasToolbarPortal = ToolbarPortal !== React.Fragment;
48
+ var mountPoint = hasToolbarPortal ? undefined : popupsMountPoint;
49
+ var isShortcutToFocusToolbarRaw = function isShortcutToFocusToolbarRaw(event) {
50
+ //Alt + F9 to reach first element in this main toolbar
51
+ return event.altKey && event.key === 'F9';
52
+ };
53
+ var isShortcutToFocusToolbarMemoized = useCallback(isShortcutToFocusToolbarRaw, []);
54
+ var isShortcutToFocusToolbar = expValEqualsNoExposure('platform_editor_toolbar_rerender_optimization_exp', 'isEnabled', true) ? isShortcutToFocusToolbarMemoized : isShortcutToFocusToolbarRaw;
55
+ var handleEscapeRaw = function handleEscapeRaw(event) {
56
+ if (!(editorView !== null && editorView !== void 0 && editorView.hasFocus())) {
57
+ editorView === null || editorView === void 0 || editorView.focus();
58
+ }
59
+ event.preventDefault();
60
+ event.stopPropagation();
61
+ };
62
+ var handleEscapeMemoized = useCallback(function (event) {
63
+ if (!(editorView !== null && editorView !== void 0 && editorView.hasFocus())) {
64
+ editorView === null || editorView === void 0 || editorView.focus();
65
+ }
66
+ event.preventDefault();
67
+ event.stopPropagation();
68
+ }, [editorView]);
69
+ var handleEscape = expValEqualsNoExposure('platform_editor_toolbar_rerender_optimization_exp', 'isEnabled', true) ? handleEscapeMemoized : handleEscapeRaw;
70
+ return /*#__PURE__*/React.createElement(ContextPanelConsumer, null, function (_ref4) {
71
+ var ContextPanelWidth = _ref4.width;
72
+ return /*#__PURE__*/React.createElement(ToolbarArrowKeyNavigationProvider, {
73
+ editorView: editorView,
74
+ childComponentSelector: "[data-testid='ak-editor-main-toolbar']",
75
+ isShortcutToFocusToolbar: isShortcutToFocusToolbar,
76
+ handleEscape: handleEscape,
77
+ intl: intl
78
+ }, /*#__PURE__*/React.createElement(ToolbarPortal, null, /*#__PURE__*/React.createElement(MainToolbarWrapper, {
79
+ testId: "ak-editor-main-toolbar",
80
+ showKeyline: showKeyline || ContextPanelWidth > 0
81
+ }, beforeIcon && /*#__PURE__*/React.createElement("div", {
82
+ className: ax([styles.mainToolbarIconBefore])
83
+ }, beforeIcon), toolbarDockingPosition !== 'none' && components && isToolbar(toolbar) && /*#__PURE__*/React.createElement(ToolbarNext, {
84
+ toolbar: toolbar,
85
+ components: components,
86
+ editorView: editorView,
87
+ editorAPI: editorAPI,
88
+ popupsMountPoint: mountPoint,
89
+ editorAppearance: "full-page"
90
+ }))));
91
+ });
62
92
  };
@@ -19,9 +19,9 @@ import React from 'react';
19
19
  import { css, jsx } from '@emotion/react';
20
20
  import { injectIntl } from 'react-intl-next';
21
21
  import Transition from 'react-transition-group/Transition';
22
+ import { ContextPanelConsumer } from '@atlaskit/editor-common/context-panel';
22
23
  import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
23
24
  import { contextPanelMessages } from '@atlaskit/editor-common/messages';
24
- import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
25
25
  import { akEditorContextPanelWidth, akEditorSwoopCubicBezier } from '@atlaskit/editor-shared-styles';
26
26
  import { fg } from '@atlaskit/platform-feature-flags';
27
27
  var ANIM_SPEED_MS = 500;
@@ -39,14 +39,18 @@ export var ToolbarNext = function ToolbarNext(_ref) {
39
39
  var toolbar = _ref.toolbar,
40
40
  components = _ref.components,
41
41
  editorView = _ref.editorView,
42
- editorAPI = _ref.editorAPI;
42
+ editorAPI = _ref.editorAPI,
43
+ popupsMountPoint = _ref.popupsMountPoint,
44
+ editorAppearance = _ref.editorAppearance;
43
45
  var connectivityStateMode = useSharedPluginStateSelector(editorAPI, 'connectivity.mode');
44
46
  var isOffline = connectivityStateMode === 'offline';
45
47
  return /*#__PURE__*/React.createElement(EditorToolbarProvider, {
46
- editorView: editorView !== null && editorView !== void 0 ? editorView : null
48
+ editorView: editorView !== null && editorView !== void 0 ? editorView : null,
49
+ editorAppearance: editorAppearance
47
50
  }, /*#__PURE__*/React.createElement(EditorToolbarUIProvider, {
48
51
  api: editorAPI,
49
- isDisabled: isOffline
52
+ isDisabled: isOffline,
53
+ popupsMountPoint: popupsMountPoint
50
54
  }, /*#__PURE__*/React.createElement(ToolbarModelRenderer, {
51
55
  toolbar: toolbar,
52
56
  components: components,
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "210.1.2";
2
+ export var version = "210.1.4";
@@ -487,6 +487,9 @@ export declare function createUniversalPreset({ props, prevProps, initialPluginC
487
487
  pluginConfiguration?: import("@atlaskit/editor-plugins/primary-toolbar").PrimaryToolbarPluginOptions;
488
488
  }, import("@atlaskit/editor-plugins/primary-toolbar").PrimaryToolbarPluginOptions | undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"toolbar", {
489
489
  pluginConfiguration?: import("@atlaskit/editor-plugins/toolbar").ToolbarPluginOptions;
490
+ sharedState: {
491
+ shouldShowToolbar: boolean;
492
+ };
490
493
  dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/user-intent").UserIntentPlugin>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/selection").SelectionPlugin>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugin-user-preferences").UserPreferencesPlugin>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/editor-viewmode").EditorViewModePlugin>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/connectivity").ConnectivityPlugin>];
491
494
  actions: {
492
495
  registerComponents: (toolbarComponents: Array<import("@atlaskit/editor-toolbar-model").RegisterComponent>) => void;
@@ -545,6 +545,9 @@ export default function createUniversalPresetInternal({ appearance, props, featu
545
545
  pluginConfiguration?: import("@atlaskit/editor-plugins/primary-toolbar").PrimaryToolbarPluginOptions;
546
546
  }, import("@atlaskit/editor-plugins/primary-toolbar").PrimaryToolbarPluginOptions | undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"toolbar", {
547
547
  pluginConfiguration?: import("@atlaskit/editor-plugins/toolbar").ToolbarPluginOptions;
548
+ sharedState: {
549
+ shouldShowToolbar: boolean;
550
+ };
548
551
  dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/user-intent").UserIntentPlugin>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/selection").SelectionPlugin>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugin-user-preferences").UserPreferencesPlugin>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/editor-viewmode").EditorViewModePlugin>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/connectivity").ConnectivityPlugin>];
549
552
  actions: {
550
553
  registerComponents: (toolbarComponents: Array<import("@atlaskit/editor-toolbar-model").RegisterComponent>) => void;
@@ -487,6 +487,9 @@ export default function useUniversalPreset({ props, initialPluginConfiguration }
487
487
  pluginConfiguration?: import("@atlaskit/editor-plugins/primary-toolbar").PrimaryToolbarPluginOptions;
488
488
  }, import("@atlaskit/editor-plugins/primary-toolbar").PrimaryToolbarPluginOptions | undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"toolbar", {
489
489
  pluginConfiguration?: import("@atlaskit/editor-plugins/toolbar").ToolbarPluginOptions;
490
+ sharedState: {
491
+ shouldShowToolbar: boolean;
492
+ };
490
493
  dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/user-intent").UserIntentPlugin>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/selection").SelectionPlugin>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugin-user-preferences").UserPreferencesPlugin>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/editor-viewmode").EditorViewModePlugin>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/connectivity").ConnectivityPlugin>];
491
494
  actions: {
492
495
  registerComponents: (toolbarComponents: Array<import("@atlaskit/editor-toolbar-model").RegisterComponent>) => void;
@@ -11,19 +11,8 @@ type FullPageToolbarNextProps = {
11
11
  editorAPI?: PublicPluginAPI<[ToolbarPlugin]>;
12
12
  toolbarDockingPosition?: 'top' | 'none';
13
13
  editorView?: EditorView;
14
+ popupsMountPoint?: HTMLElement;
15
+ showKeyline: boolean;
14
16
  };
15
- /**
16
- * TODO: ED-28732 - This component is a work in progress, re-writing `FullPageToolbar` and is not yet complete.
17
- *
18
- * [ ] Add support for custom toolbar + splitting into two lines
19
- *
20
- * [ ] Add support for toolbar keyboard shortcuts
21
- *
22
- * [ ] Add support for toolbar analytics
23
- *
24
- * [ ] Add support for toolbar accessibility
25
- *
26
- * [ ] Add support for toolbar localization
27
- */
28
- export declare const FullPageToolbarNext: ({ editorAPI, beforeIcon, toolbarDockingPosition, editorView, }: FullPageToolbarNextProps) => JSX.Element;
17
+ export declare const FullPageToolbarNext: ({ editorAPI, beforeIcon, toolbarDockingPosition, editorView, popupsMountPoint, showKeyline, }: FullPageToolbarNextProps) => JSX.Element;
29
18
  export {};
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
+ import type { EditorToolbarContextType } from '@atlaskit/editor-common/toolbar';
2
3
  import type { PublicPluginAPI } from '@atlaskit/editor-common/types';
3
4
  import type { ToolbarPlugin } from '@atlaskit/editor-plugins/toolbar';
4
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
+ import { type ToolbarUIContextType } from '@atlaskit/editor-toolbar';
5
7
  import type { RegisterComponent, RegisterToolbar } from '@atlaskit/editor-toolbar-model';
6
8
  import type { ToolbarProps } from './toolbar-types';
7
9
  /**
@@ -10,7 +12,7 @@ import type { ToolbarProps } from './toolbar-types';
10
12
  * If making changes to this component please ensure to also update `<ToolbarNext />`.
11
13
  */
12
14
  export declare const Toolbar: (props: ToolbarProps) => JSX.Element;
13
- type NewToolbarProps = {
15
+ type NewToolbarProps = Pick<ToolbarUIContextType, 'popupsMountPoint'> & Pick<EditorToolbarContextType, 'editorAppearance'> & {
14
16
  toolbar: RegisterToolbar;
15
17
  components: RegisterComponent[];
16
18
  editorView?: EditorView;
@@ -22,5 +24,5 @@ type NewToolbarProps = {
22
24
  *
23
25
  * The majority of components UI should use `@atlaskit/editor-toolbar` components.
24
26
  */
25
- export declare const ToolbarNext: ({ toolbar, components, editorView, editorAPI }: NewToolbarProps) => React.JSX.Element;
27
+ export declare const ToolbarNext: ({ toolbar, components, editorView, editorAPI, popupsMountPoint, editorAppearance, }: NewToolbarProps) => React.JSX.Element;
26
28
  export {};
@@ -698,6 +698,9 @@ export declare function createUniversalPreset({ props, prevProps, initialPluginC
698
698
  }, import("@atlaskit/editor-plugins/primary-toolbar").PrimaryToolbarPluginOptions | undefined>,
699
699
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"toolbar", {
700
700
  pluginConfiguration?: import("@atlaskit/editor-plugins/toolbar").ToolbarPluginOptions;
701
+ sharedState: {
702
+ shouldShowToolbar: boolean;
703
+ };
701
704
  dependencies: [
702
705
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/user-intent").UserIntentPlugin>,
703
706
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/selection").SelectionPlugin>,
@@ -756,6 +756,9 @@ export default function createUniversalPresetInternal({ appearance, props, featu
756
756
  }, import("@atlaskit/editor-plugins/primary-toolbar").PrimaryToolbarPluginOptions | undefined>,
757
757
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"toolbar", {
758
758
  pluginConfiguration?: import("@atlaskit/editor-plugins/toolbar").ToolbarPluginOptions;
759
+ sharedState: {
760
+ shouldShowToolbar: boolean;
761
+ };
759
762
  dependencies: [
760
763
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/user-intent").UserIntentPlugin>,
761
764
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/selection").SelectionPlugin>,
@@ -698,6 +698,9 @@ export default function useUniversalPreset({ props, initialPluginConfiguration }
698
698
  }, import("@atlaskit/editor-plugins/primary-toolbar").PrimaryToolbarPluginOptions | undefined>,
699
699
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"toolbar", {
700
700
  pluginConfiguration?: import("@atlaskit/editor-plugins/toolbar").ToolbarPluginOptions;
701
+ sharedState: {
702
+ shouldShowToolbar: boolean;
703
+ };
701
704
  dependencies: [
702
705
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/user-intent").UserIntentPlugin>,
703
706
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-plugins/selection").SelectionPlugin>,
@@ -13,19 +13,8 @@ type FullPageToolbarNextProps = {
13
13
  ]>;
14
14
  toolbarDockingPosition?: 'top' | 'none';
15
15
  editorView?: EditorView;
16
+ popupsMountPoint?: HTMLElement;
17
+ showKeyline: boolean;
16
18
  };
17
- /**
18
- * TODO: ED-28732 - This component is a work in progress, re-writing `FullPageToolbar` and is not yet complete.
19
- *
20
- * [ ] Add support for custom toolbar + splitting into two lines
21
- *
22
- * [ ] Add support for toolbar keyboard shortcuts
23
- *
24
- * [ ] Add support for toolbar analytics
25
- *
26
- * [ ] Add support for toolbar accessibility
27
- *
28
- * [ ] Add support for toolbar localization
29
- */
30
- export declare const FullPageToolbarNext: ({ editorAPI, beforeIcon, toolbarDockingPosition, editorView, }: FullPageToolbarNextProps) => JSX.Element;
19
+ export declare const FullPageToolbarNext: ({ editorAPI, beforeIcon, toolbarDockingPosition, editorView, popupsMountPoint, showKeyline, }: FullPageToolbarNextProps) => JSX.Element;
31
20
  export {};
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
+ import type { EditorToolbarContextType } from '@atlaskit/editor-common/toolbar';
2
3
  import type { PublicPluginAPI } from '@atlaskit/editor-common/types';
3
4
  import type { ToolbarPlugin } from '@atlaskit/editor-plugins/toolbar';
4
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
+ import { type ToolbarUIContextType } from '@atlaskit/editor-toolbar';
5
7
  import type { RegisterComponent, RegisterToolbar } from '@atlaskit/editor-toolbar-model';
6
8
  import type { ToolbarProps } from './toolbar-types';
7
9
  /**
@@ -10,7 +12,7 @@ import type { ToolbarProps } from './toolbar-types';
10
12
  * If making changes to this component please ensure to also update `<ToolbarNext />`.
11
13
  */
12
14
  export declare const Toolbar: (props: ToolbarProps) => JSX.Element;
13
- type NewToolbarProps = {
15
+ type NewToolbarProps = Pick<ToolbarUIContextType, 'popupsMountPoint'> & Pick<EditorToolbarContextType, 'editorAppearance'> & {
14
16
  toolbar: RegisterToolbar;
15
17
  components: RegisterComponent[];
16
18
  editorView?: EditorView;
@@ -24,5 +26,5 @@ type NewToolbarProps = {
24
26
  *
25
27
  * The majority of components UI should use `@atlaskit/editor-toolbar` components.
26
28
  */
27
- export declare const ToolbarNext: ({ toolbar, components, editorView, editorAPI }: NewToolbarProps) => React.JSX.Element;
29
+ export declare const ToolbarNext: ({ toolbar, components, editorView, editorAPI, popupsMountPoint, editorAppearance, }: NewToolbarProps) => React.JSX.Element;
28
30
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "210.1.3",
3
+ "version": "210.1.5",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -63,7 +63,7 @@
63
63
  "@atlaskit/platform-feature-flags-react": "^0.2.0",
64
64
  "@atlaskit/react-ufo": "^4.4.0",
65
65
  "@atlaskit/task-decision": "^19.2.0",
66
- "@atlaskit/tmp-editor-statsig": "^11.4.0",
66
+ "@atlaskit/tmp-editor-statsig": "^11.5.0",
67
67
  "@atlaskit/tokens": "^6.0.0",
68
68
  "@atlaskit/tooltip": "^20.4.0",
69
69
  "@atlaskit/width-detector": "^5.0.0",
@@ -80,7 +80,7 @@
80
80
  "uuid": "^3.1.0"
81
81
  },
82
82
  "peerDependencies": {
83
- "@atlaskit/editor-common": "^107.27.0",
83
+ "@atlaskit/editor-common": "^107.28.0",
84
84
  "@atlaskit/link-provider": "^3.7.0",
85
85
  "@atlaskit/media-core": "^37.0.0",
86
86
  "react": "^18.2.0",
@@ -104,7 +104,7 @@
104
104
  "@atlaskit/media-test-helpers": "^39.0.0",
105
105
  "@atlaskit/modal-dialog": "^14.3.0",
106
106
  "@atlaskit/primitives": "^14.11.0",
107
- "@atlaskit/renderer": "^120.4.0",
107
+ "@atlaskit/renderer": "^120.5.0",
108
108
  "@atlaskit/section-message": "^8.5.0",
109
109
  "@atlaskit/smart-card": "^40.12.0",
110
110
  "@atlaskit/synchrony-test-helpers": "workspace:^",