@atlaskit/editor-core 189.1.15 → 189.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/composable-editor/editor-internal.js +24 -2
  3. package/dist/cjs/create-editor/feature-flags-from-props.js +4 -5
  4. package/dist/cjs/plugins/index.js +0 -7
  5. package/dist/cjs/presets/universal.js +11 -6
  6. package/dist/cjs/ui/Appearance/FullPage/FullPage.js +2 -1
  7. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +19 -12
  8. package/dist/cjs/version-wrapper.js +1 -1
  9. package/dist/es2019/composable-editor/editor-internal.js +27 -3
  10. package/dist/es2019/create-editor/feature-flags-from-props.js +4 -5
  11. package/dist/es2019/plugins/index.js +0 -1
  12. package/dist/es2019/presets/universal.js +11 -6
  13. package/dist/es2019/ui/Appearance/FullPage/FullPage.js +2 -1
  14. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +35 -30
  15. package/dist/es2019/version-wrapper.js +1 -1
  16. package/dist/esm/composable-editor/editor-internal.js +25 -3
  17. package/dist/esm/create-editor/feature-flags-from-props.js +4 -5
  18. package/dist/esm/plugins/index.js +0 -1
  19. package/dist/esm/presets/universal.js +11 -6
  20. package/dist/esm/ui/Appearance/FullPage/FullPage.js +2 -1
  21. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +19 -12
  22. package/dist/esm/version-wrapper.js +1 -1
  23. package/dist/types/create-editor/get-ui-component.d.ts +1 -1
  24. package/dist/types/plugins/index.d.ts +0 -1
  25. package/dist/types/plugins/insert-block/types.d.ts +1 -1
  26. package/dist/types/types/editor-appearance-component.d.ts +1 -0
  27. package/dist/types/types/editor-props.d.ts +2 -1
  28. package/dist/types/ui/Appearance/FullPage/FullPageToolbar.d.ts +2 -1
  29. package/dist/types-ts4.5/create-editor/get-ui-component.d.ts +1 -1
  30. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  31. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +1 -1
  32. package/dist/types-ts4.5/types/editor-appearance-component.d.ts +1 -0
  33. package/dist/types-ts4.5/types/editor-props.d.ts +2 -1
  34. package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageToolbar.d.ts +2 -1
  35. package/package.json +5 -7
  36. package/report.api.md +3 -8
  37. package/tmp/api-report-tmp.d.ts +3 -8
  38. package/dist/cjs/plugins/panel/actions.js +0 -125
  39. package/dist/cjs/plugins/panel/index.js +0 -215
  40. package/dist/cjs/plugins/panel/message.js +0 -44
  41. package/dist/cjs/plugins/panel/nodeviews/panel.js +0 -94
  42. package/dist/cjs/plugins/panel/pm-plugins/keymaps.js +0 -81
  43. package/dist/cjs/plugins/panel/pm-plugins/main.js +0 -28
  44. package/dist/cjs/plugins/panel/toolbar.js +0 -293
  45. package/dist/cjs/plugins/panel/types.js +0 -8
  46. package/dist/cjs/plugins/panel/utils.js +0 -53
  47. package/dist/es2019/plugins/panel/actions.js +0 -116
  48. package/dist/es2019/plugins/panel/index.js +0 -192
  49. package/dist/es2019/plugins/panel/message.js +0 -38
  50. package/dist/es2019/plugins/panel/nodeviews/panel.js +0 -82
  51. package/dist/es2019/plugins/panel/pm-plugins/keymaps.js +0 -82
  52. package/dist/es2019/plugins/panel/pm-plugins/main.js +0 -21
  53. package/dist/es2019/plugins/panel/toolbar.js +0 -279
  54. package/dist/es2019/plugins/panel/types.js +0 -2
  55. package/dist/es2019/plugins/panel/utils.js +0 -48
  56. package/dist/esm/plugins/panel/actions.js +0 -116
  57. package/dist/esm/plugins/panel/index.js +0 -209
  58. package/dist/esm/plugins/panel/message.js +0 -38
  59. package/dist/esm/plugins/panel/nodeviews/panel.js +0 -87
  60. package/dist/esm/plugins/panel/pm-plugins/keymaps.js +0 -74
  61. package/dist/esm/plugins/panel/pm-plugins/main.js +0 -22
  62. package/dist/esm/plugins/panel/toolbar.js +0 -286
  63. package/dist/esm/plugins/panel/types.js +0 -2
  64. package/dist/esm/plugins/panel/utils.js +0 -46
  65. package/dist/types/plugins/panel/actions.d.ts +0 -12
  66. package/dist/types/plugins/panel/index.d.ts +0 -17
  67. package/dist/types/plugins/panel/message.d.ts +0 -37
  68. package/dist/types/plugins/panel/nodeviews/panel.d.ts +0 -36
  69. package/dist/types/plugins/panel/pm-plugins/keymaps.d.ts +0 -3
  70. package/dist/types/plugins/panel/pm-plugins/main.d.ts +0 -11
  71. package/dist/types/plugins/panel/toolbar.d.ts +0 -15
  72. package/dist/types/plugins/panel/types.d.ts +0 -21
  73. package/dist/types/plugins/panel/utils.d.ts +0 -5
  74. package/dist/types-ts4.5/plugins/panel/actions.d.ts +0 -12
  75. package/dist/types-ts4.5/plugins/panel/index.d.ts +0 -17
  76. package/dist/types-ts4.5/plugins/panel/message.d.ts +0 -37
  77. package/dist/types-ts4.5/plugins/panel/nodeviews/panel.d.ts +0 -36
  78. package/dist/types-ts4.5/plugins/panel/pm-plugins/keymaps.d.ts +0 -3
  79. package/dist/types-ts4.5/plugins/panel/pm-plugins/main.d.ts +0 -11
  80. package/dist/types-ts4.5/plugins/panel/toolbar.d.ts +0 -15
  81. package/dist/types-ts4.5/plugins/panel/types.d.ts +0 -21
  82. package/dist/types-ts4.5/plugins/panel/utils.d.ts +0 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 189.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#42535](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42535) [`39770b766f1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/39770b766f1) - [ux] MODES-3618 Use hideAvatarGroup instead of feature flag to determine whether avatar should be hidden
8
+
9
+ ## 189.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#42452](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42452) [`bdbe13c80c9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bdbe13c80c9) - ED-19900 Removing indentationButtonsInTheToolbar FF fallback from showIndentationButtons editor prop.
14
+
15
+ ### Patch Changes
16
+
17
+ - [#42352](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42352) [`965649a4121`](https://bitbucket.org/atlassian/atlassian-frontend/commits/965649a4121) - Decouple find replace prop from the full page toolbar.
18
+ - [#42604](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42604) [`182627d0f5e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/182627d0f5e) - Extracted panel plugin from editor-core as @atlaskit/editor-plugin-panel
19
+ - Updated dependencies
20
+
3
21
  ## 189.1.15
4
22
 
5
23
  ### Patch Changes
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.EditorInternal = EditorInternal;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
10
  var _react = require("react");
10
11
  var _react2 = require("@emotion/react");
@@ -74,7 +75,7 @@ function EditorInternal(_ref) {
74
75
  onAnalyticsEvent: handleAnalyticsEvent,
75
76
  useAnalyticsContext: props.UNSAFE_useAnalyticsContext,
76
77
  render: function render(portalProviderAPI) {
77
- return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_ReactEditorView.default, {
78
+ return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(ReactEditorViewContextWrapper, {
78
79
  editorProps: overriddenEditorProps,
79
80
  createAnalyticsEvent: createAnalyticsEvent,
80
81
  portalProviderAPI: portalProviderAPI,
@@ -124,7 +125,8 @@ function EditorInternal(_ref) {
124
125
  enableToolbarMinWidth: ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.toolbarMinWidthOverflow) != null ? !!((_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.toolbarMinWidthOverflow) : props.allowUndoRedoButtons,
125
126
  useStickyToolbar: props.useStickyToolbar,
126
127
  featureFlags: featureFlags,
127
- pluginHooks: config.pluginHooks
128
+ pluginHooks: config.pluginHooks,
129
+ hideAvatarGroup: props.hideAvatarGroup
128
130
  }));
129
131
  }
130
132
  }), (0, _react2.jsx)(_portalProvider.PortalRenderer, {
@@ -132,4 +134,24 @@ function EditorInternal(_ref) {
132
134
  }));
133
135
  }
134
136
  }))))));
137
+ }
138
+ function ReactEditorViewContextWrapper(props) {
139
+ var setInternalEditorAPI = (0, _context.useSetPresetContext)();
140
+ var setExternalEditorAPI = props.setEditorApi;
141
+
142
+ /**
143
+ * We use the context to retrieve the editorAPI
144
+ * externally for consumers via `usePreset`.
145
+ *
146
+ * However we also may need to retrieve this value internally via context
147
+ * so we should also set the value for the `EditorContext` that is used in
148
+ * `EditorInternal`.
149
+ */
150
+ var setEditorAPI = (0, _react.useCallback)(function (api) {
151
+ setInternalEditorAPI === null || setInternalEditorAPI === void 0 || setInternalEditorAPI(api);
152
+ setExternalEditorAPI === null || setExternalEditorAPI === void 0 || setExternalEditorAPI(api);
153
+ }, [setInternalEditorAPI, setExternalEditorAPI]);
154
+ return (0, _react2.jsx)(_ReactEditorView.default, (0, _extends2.default)({}, props, {
155
+ setEditorApi: setEditorAPI
156
+ }));
135
157
  }
@@ -32,7 +32,7 @@ function getSpellCheck(featureFlags) {
32
32
  * which is used by both current and archv3 editors.
33
33
  */
34
34
  function createFeatureFlagsFromProps(props) {
35
- var _props$allowLayouts, _props$performanceTra, _props$allowExtension, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$featureFlags5, _props$featureFlags6, _props$featureFlags7, _props$featureFlags8, _props$featureFlags9, _props$featureFlags10, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$collabEdit, _props$collabEdit2, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22;
35
+ var _props$allowLayouts, _props$performanceTra, _props$allowExtension, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$featureFlags5, _props$featureFlags6, _props$featureFlags7, _props$featureFlags8, _props$featureFlags9, _props$featureFlags10, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$collabEdit, _props$collabEdit2, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20;
36
36
  var normalizedFeatureFlags = (0, _normalizeFeatureFlags.normalizeFeatureFlags)(props.featureFlags);
37
37
  return _objectSpread(_objectSpread({}, normalizedFeatureFlags), {}, {
38
38
  newInsertionBehaviour: props.allowNewInsertionBehaviour,
@@ -54,13 +54,12 @@ function createFeatureFlagsFromProps(props) {
54
54
  twoLineEditorToolbar: Boolean(typeof ((_props$featureFlags13 = props.featureFlags) === null || _props$featureFlags13 === void 0 ? void 0 : _props$featureFlags13.twoLineEditorToolbar) === 'boolean' ? !!((_props$featureFlags14 = props.featureFlags) !== null && _props$featureFlags14 !== void 0 && _props$featureFlags14.twoLineEditorToolbar) : false),
55
55
  useNativeCollabPlugin: Boolean(typeof ((_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.useNativePlugin) === 'boolean' ? !!((_props$collabEdit2 = props.collabEdit) !== null && _props$collabEdit2 !== void 0 && _props$collabEdit2.useNativePlugin) : false),
56
56
  showHoverPreview: Boolean(typeof ((_props$featureFlags15 = props.featureFlags) === null || _props$featureFlags15 === void 0 ? void 0 : _props$featureFlags15.showHoverPreview) === 'boolean' ? !!((_props$featureFlags16 = props.featureFlags) !== null && _props$featureFlags16 !== void 0 && _props$featureFlags16.showHoverPreview) : false),
57
- indentationButtonsInTheToolbar: typeof props.showIndentationButtons === 'boolean' ? props.showIndentationButtons : Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$featureFlags17 = props.featureFlags) === null || _props$featureFlags17 === void 0 ? void 0 : _props$featureFlags17.indentationButtonsInTheToolbar) === 'boolean' ? !!((_props$featureFlags18 = props.featureFlags) !== null && _props$featureFlags18 !== void 0 && _props$featureFlags18.indentationButtonsInTheToolbar) : false)),
58
- floatingToolbarLinkSettingsButton: typeof ((_props$featureFlags19 = props.featureFlags) === null || _props$featureFlags19 === void 0 ? void 0 : _props$featureFlags19['floating-toolbar-link-settings-button']) === 'string' ? props.featureFlags['floating-toolbar-link-settings-button'] || undefined : undefined,
57
+ floatingToolbarLinkSettingsButton: typeof ((_props$featureFlags17 = props.featureFlags) === null || _props$featureFlags17 === void 0 ? void 0 : _props$featureFlags17['floating-toolbar-link-settings-button']) === 'string' ? props.featureFlags['floating-toolbar-link-settings-button'] || undefined : undefined,
59
58
  disableSpellcheckByBrowser: getSpellCheck(props.featureFlags),
60
59
  // Including fallback to props.featureFlags so that mobile feature flags
61
60
  // are included (they are not kebab cased)
62
- restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags20 = props.featureFlags) === null || _props$featureFlags20 === void 0 ? void 0 : _props$featureFlags20.restartNumberedLists) === true,
61
+ restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags18 = props.featureFlags) === null || _props$featureFlags18 === void 0 ? void 0 : _props$featureFlags18.restartNumberedLists) === true,
63
62
  lpLinkPickerFocusTrap: Boolean(normalizedFeatureFlags.lpLinkPickerFocusTrap),
64
- preventPopupOverflow: Boolean(typeof ((_props$featureFlags21 = props.featureFlags) === null || _props$featureFlags21 === void 0 ? void 0 : _props$featureFlags21['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags22 = props.featureFlags) !== null && _props$featureFlags22 !== void 0 && _props$featureFlags22['prevent-popup-overflow']) : false)
63
+ preventPopupOverflow: Boolean(typeof ((_props$featureFlags19 = props.featureFlags) === null || _props$featureFlags19 === void 0 ? void 0 : _props$featureFlags19['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags20 = props.featureFlags) !== null && _props$featureFlags20 !== void 0 && _props$featureFlags20['prevent-popup-overflow']) : false)
65
64
  });
66
65
  }
@@ -149,12 +149,6 @@ Object.defineProperty(exports, "mobileSelectionPlugin", {
149
149
  return _mobileSelection.default;
150
150
  }
151
151
  });
152
- Object.defineProperty(exports, "panelPlugin", {
153
- enumerable: true,
154
- get: function get() {
155
- return _panel.default;
156
- }
157
- });
158
152
  Object.defineProperty(exports, "pastePlugin", {
159
153
  enumerable: true,
160
154
  get: function get() {
@@ -194,7 +188,6 @@ var _jiraIssue = _interopRequireDefault(require("./jira-issue"));
194
188
  var _toolbarListsIndentation = _interopRequireDefault(require("./toolbar-lists-indentation"));
195
189
  var _macro = _interopRequireDefault(require("./macro"));
196
190
  var _maxContentSize = _interopRequireDefault(require("./max-content-size"));
197
- var _panel = _interopRequireDefault(require("./panel"));
198
191
  var _paste = _interopRequireDefault(require("./paste"));
199
192
  var _tasksAndDecisions = _interopRequireDefault(require("./tasks-and-decisions"));
200
193
  var _breakout = _interopRequireDefault(require("./breakout"));
@@ -8,6 +8,7 @@ exports.default = createUniversalPreset;
8
8
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _plugins = require("../plugins");
11
+ var _editorPluginPanel = require("@atlaskit/editor-plugin-panel");
11
12
  var _editorPluginTextColor = require("@atlaskit/editor-plugin-text-color");
12
13
  var _editorPluginHistory = require("@atlaskit/editor-plugin-history");
13
14
  var _editorPluginStatus = require("@atlaskit/editor-plugin-status");
@@ -243,7 +244,7 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
243
244
  return builder.add(plugin);
244
245
  }
245
246
  return builder;
246
- }).maybeAdd(_plugins.panelPlugin, function (plugin, builder) {
247
+ }).maybeAdd(_editorPluginPanel.panelPlugin, function (plugin, builder) {
247
248
  if (props.allowPanel) {
248
249
  var allowPanel = (0, _typeof2.default)(props.allowPanel) === 'object' ? props.allowPanel : {};
249
250
  return builder.add([plugin, {
@@ -356,7 +357,7 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
356
357
  }
357
358
  return builder;
358
359
  }).add([_plugins.toolbarListsIndentationPlugin, {
359
- showIndentationButtons: !!featureFlags.indentationButtonsInTheToolbar,
360
+ showIndentationButtons: !!props.showIndentationButtons,
360
361
  allowHeadingAndParagraphIndentation: !!props.allowIndentation
361
362
  }]).add([_plugins.insertBlockPlugin, {
362
363
  allowTables: !!props.allowTables,
@@ -367,14 +368,18 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
367
368
  showElementBrowserLink: props.elementBrowser && props.elementBrowser.showModal || false,
368
369
  replacePlusMenuWithElementBrowser: props.elementBrowser && props.elementBrowser.replacePlusMenu || false
369
370
  }]).maybeAdd(_plugins.beforePrimaryToolbarPlugin, function (plugin, builder) {
370
- if (!(0, _platformFeatureFlags.getBooleanFF)('platform.confluence.frontend.editor.no.platform.avatar.group') && hasBeforePrimaryToolbar(props.primaryToolbarComponents) && !featureFlags.twoLineEditorToolbar) {
371
+ if (hasBeforePrimaryToolbar(props.primaryToolbarComponents) && !featureFlags.twoLineEditorToolbar) {
371
372
  return builder.add([plugin, {
372
373
  beforePrimaryToolbarComponents: props.primaryToolbarComponents.before
373
374
  }]);
374
375
  }
375
376
  return builder;
376
377
  }).maybeAdd(_plugins.avatarGroupPlugin, function (plugin, builder) {
377
- if (!(0, _platformFeatureFlags.getBooleanFF)('platform.confluence.frontend.editor.no.platform.avatar.group') && featureFlags.showAvatarGroupAsPlugin === true && !featureFlags.twoLineEditorToolbar) {
378
+ if (!props.hideAvatarGroup && featureFlags.showAvatarGroupAsPlugin === true && !featureFlags.twoLineEditorToolbar) {
379
+ // Avatars are moved to Confluence codebase for Edit in Context
380
+ // When Edit in Context is enabled primaryToolbarComponents is undefined
381
+ // For more details please check
382
+ // https://hello.atlassian.net/wiki/spaces/PCG/pages/2851572180/Editor+toolbar+for+live+pages+and+edit+in+context+projects
378
383
  return builder.add([plugin, {
379
384
  collabEdit: props.collabEdit,
380
385
  takeFullWidth: !hasBeforePrimaryToolbar(props.primaryToolbarComponents)
@@ -384,8 +389,8 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
384
389
  }).maybeAdd(_plugins.findReplacePlugin, function (plugin, builder) {
385
390
  if (props.allowFindReplace) {
386
391
  return builder.add([plugin, {
387
- takeFullWidth: !(0, _platformFeatureFlags.getBooleanFF)('platform.confluence.frontend.editor.no.platform.avatar.group') && !!featureFlags.showAvatarGroupAsPlugin === false && !hasBeforePrimaryToolbar(props.primaryToolbarComponents),
388
- twoLineEditorToolbar: !!featureFlags.twoLineEditorToolbar
392
+ takeFullWidth: !props.hideAvatarGroup && !!featureFlags.showAvatarGroupAsPlugin === false && !hasBeforePrimaryToolbar(props.primaryToolbarComponents),
393
+ twoLineEditorToolbar: !!props.primaryToolbarComponents && !!featureFlags.twoLineEditorToolbar
389
394
  }]);
390
395
  }
391
396
  return builder;
@@ -77,7 +77,8 @@ var FullPageEditor = exports.FullPageEditor = function FullPageEditor(props) {
77
77
  primaryToolbarComponents: props.primaryToolbarComponents,
78
78
  providerFactory: props.providerFactory,
79
79
  showKeyline: showKeyline,
80
- featureFlags: props.featureFlags
80
+ featureFlags: props.featureFlags,
81
+ hideAvatarGroup: props.hideAvatarGroup
81
82
  }), (0, _react2.jsx)(_FullPageContentArea.FullPageContentArea, {
82
83
  ref: scrollContentContainerRef,
83
84
  appearance: props.appearance,
@@ -18,17 +18,21 @@ var _MainToolbar = require("./MainToolbar");
18
18
  var _ui2 = require("@atlaskit/editor-common/ui");
19
19
  var _messages = require("@atlaskit/editor-common/messages");
20
20
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
21
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
+ var _context = require("../../../presets/context");
22
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
23
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
24
24
  /** @jsx jsx */
25
25
 
26
26
  var EditorToolbar = exports.EditorToolbar = /*#__PURE__*/_react.default.memo(function (props) {
27
- var _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$collabEdit, _props$collabEdit2, _props$collabEdit3, _props$featureFlags5, _props$featureFlags6;
27
+ var _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$collabEdit, _props$collabEdit2, _props$collabEdit3;
28
28
  var _useState = (0, _react.useState)(false),
29
29
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
30
30
  shouldSplitToolbar = _useState2[0],
31
31
  setShouldSplitToolbar = _useState2[1];
32
+ var editorAPI = (0, _context.usePresetContext)();
33
+
34
+ // When primary toolbar components is undefined, do not show two line editor toolbar
35
+ var twoLineEditorToolbar = !!props.customPrimaryToolbarComponents && !!((_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.twoLineEditorToolbar);
32
36
  var nonCustomToolbar = (0, _react2.jsx)("div", {
33
37
  css: _MainToolbar.nonCustomToolbarWrapperStyle
34
38
  }, props.beforeIcon && (0, _react2.jsx)("div", {
@@ -47,20 +51,25 @@ var EditorToolbar = exports.EditorToolbar = /*#__PURE__*/_react.default.memo(fun
47
51
  dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
48
52
  containerElement: props.containerElement,
49
53
  hasMinWidth: props.hasMinWidth,
50
- twoLineEditorToolbar: !!((_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.twoLineEditorToolbar)
54
+ twoLineEditorToolbar: twoLineEditorToolbar
51
55
  }));
52
56
  var customToolbar = (0, _react2.jsx)("div", {
53
57
  css: _MainToolbar.customToolbarWrapperStyle
54
- }, (_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.twoLineEditorToolbar && !!props.customPrimaryToolbarComponents && 'before' in props.customPrimaryToolbarComponents ? (0, _react2.jsx)(_BeforePrimaryToolbarWrapper.BeforePrimaryToolbarWrapper, {
58
+ }, twoLineEditorToolbar && !!props.customPrimaryToolbarComponents && 'before' in props.customPrimaryToolbarComponents ? (0, _react2.jsx)(_BeforePrimaryToolbarWrapper.BeforePrimaryToolbarWrapper, {
55
59
  beforePrimaryToolbarComponents: props.customPrimaryToolbarComponents.before
56
- }) : null, (0, _platformFeatureFlags.getBooleanFF)('platform.confluence.frontend.editor.no.platform.avatar.group') || (props === null || props === void 0 || (_props$featureFlags3 = props.featureFlags) === null || _props$featureFlags3 === void 0 ? void 0 : _props$featureFlags3.showAvatarGroupAsPlugin) === true && !((_props$featureFlags4 = props.featureFlags) !== null && _props$featureFlags4 !== void 0 && _props$featureFlags4.twoLineEditorToolbar) ? null : (0, _react2.jsx)(_ui.default, {
60
+ }) : null, props.hideAvatarGroup || (props === null || props === void 0 || (_props$featureFlags2 = props.featureFlags) === null || _props$featureFlags2 === void 0 ? void 0 : _props$featureFlags2.showAvatarGroupAsPlugin) === true && !((_props$featureFlags3 = props.featureFlags) !== null && _props$featureFlags3 !== void 0 && _props$featureFlags3.twoLineEditorToolbar) ? null :
61
+ // Avatars are moved to Confluence codebase for Edit in Context
62
+ // When Edit in Context is enabled customPrimaryToolbarComponents is undefined
63
+ // For more details please check
64
+ // https://hello.atlassian.net/wiki/spaces/PCG/pages/2851572180/Editor+toolbar+for+live+pages+and+edit+in+context+projects
65
+ (0, _react2.jsx)(_ui.default, {
57
66
  editorView: props.editorView,
58
67
  eventDispatcher: props.eventDispatcher,
59
68
  inviteToEditComponent: (_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.inviteToEditComponent,
60
69
  inviteToEditHandler: (_props$collabEdit2 = props.collabEdit) === null || _props$collabEdit2 === void 0 ? void 0 : _props$collabEdit2.inviteToEditHandler,
61
70
  isInviteToEditButtonSelected: (_props$collabEdit3 = props.collabEdit) === null || _props$collabEdit3 === void 0 ? void 0 : _props$collabEdit3.isInviteToEditButtonSelected,
62
71
  featureFlags: props.featureFlags || {}
63
- }), (_props$featureFlags5 = props.featureFlags) !== null && _props$featureFlags5 !== void 0 && _props$featureFlags5.findReplace && (_props$featureFlags6 = props.featureFlags) !== null && _props$featureFlags6 !== void 0 && _props$featureFlags6.twoLineEditorToolbar ? (0, _react2.jsx)(_FindReplaceToolbarButtonWithState.default, {
72
+ }), editorAPI !== null && editorAPI !== void 0 && editorAPI.findReplace && twoLineEditorToolbar ? (0, _react2.jsx)(_FindReplaceToolbarButtonWithState.default, {
64
73
  popupsBoundariesElement: props.popupsBoundariesElement,
65
74
  popupsMountPoint: props.popupsMountPoint,
66
75
  popupsScrollableElement: props.popupsScrollableElement,
@@ -70,8 +79,7 @@ var EditorToolbar = exports.EditorToolbar = /*#__PURE__*/_react.default.memo(fun
70
79
  featureFlags: props.featureFlags
71
80
  }) : null, !!props.customPrimaryToolbarComponents && 'after' in props.customPrimaryToolbarComponents ? props.customPrimaryToolbarComponents.after : props.customPrimaryToolbarComponents);
72
81
  (0, _react.useEffect)(function () {
73
- var _props$featureFlags7;
74
- if ((_props$featureFlags7 = props.featureFlags) !== null && _props$featureFlags7 !== void 0 && _props$featureFlags7.twoLineEditorToolbar) {
82
+ if (twoLineEditorToolbar) {
75
83
  var updateOnResize = function updateOnResize() {
76
84
  setShouldSplitToolbar(window.innerWidth <= _MainToolbar.MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT);
77
85
  };
@@ -96,7 +104,6 @@ var EditorToolbar = exports.EditorToolbar = /*#__PURE__*/_react.default.memo(fun
96
104
  event.stopPropagation();
97
105
  };
98
106
  return (0, _react2.jsx)(_ui2.ContextPanelConsumer, null, function (_ref) {
99
- var _props$featureFlags8, _props$featureFlags9, _props$featureFlags10;
100
107
  var contextPanelWidth = _ref.width;
101
108
  return (0, _react2.jsx)(_uiMenu.ToolbarArrowKeyNavigationProvider, {
102
109
  editorView: props.editorView,
@@ -105,14 +112,14 @@ var EditorToolbar = exports.EditorToolbar = /*#__PURE__*/_react.default.memo(fun
105
112
  handleEscape: handleEscape,
106
113
  intl: props.intl
107
114
  }, (0, _react2.jsx)("div", {
108
- css: (0, _MainToolbar.mainToolbarStyle)(props.showKeyline || contextPanelWidth > 0, !!((_props$featureFlags8 = props.featureFlags) !== null && _props$featureFlags8 !== void 0 && _props$featureFlags8.twoLineEditorToolbar)),
115
+ css: (0, _MainToolbar.mainToolbarStyle)(props.showKeyline || contextPanelWidth > 0, twoLineEditorToolbar),
109
116
  "data-testid": "ak-editor-main-toolbar"
110
117
  }, (0, _react2.jsx)("div", {
111
- css: (0, _MainToolbar.mainToolbarFirstChildStyle)(!!((_props$featureFlags9 = props.featureFlags) !== null && _props$featureFlags9 !== void 0 && _props$featureFlags9.twoLineEditorToolbar)),
118
+ css: (0, _MainToolbar.mainToolbarFirstChildStyle)(twoLineEditorToolbar),
112
119
  role: "toolbar",
113
120
  "aria-label": props.intl.formatMessage(_messages.fullPageMessages.toolbarLabel)
114
121
  }, shouldSplitToolbar ? customToolbar : nonCustomToolbar), (0, _react2.jsx)("div", {
115
- css: (0, _MainToolbar.mainToolbarSecondChildStyle)(!!((_props$featureFlags10 = props.featureFlags) !== null && _props$featureFlags10 !== void 0 && _props$featureFlags10.twoLineEditorToolbar)),
122
+ css: (0, _MainToolbar.mainToolbarSecondChildStyle)(twoLineEditorToolbar),
116
123
  "data-testid": 'avatar-group-outside-plugin',
117
124
  role: "region",
118
125
  "aria-label": props.intl.formatMessage(_messages.fullPageMessages.pageActionsLabel)
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "189.1.15";
8
+ var version = exports.version = "189.3.0";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -1,5 +1,6 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  /** @jsx jsx */
2
- import { Fragment } from 'react';
3
+ import { Fragment, useCallback } from 'react';
3
4
  import { css, jsx } from '@emotion/react';
4
5
  import { ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
5
6
  import { PortalProviderWithThemeProviders, PortalRenderer } from '@atlaskit/editor-common/portal-provider';
@@ -66,7 +67,7 @@ export function EditorInternal({
66
67
  }, jsx(ContextAdapter, null, jsx(PortalProviderWithThemeProviders, {
67
68
  onAnalyticsEvent: handleAnalyticsEvent,
68
69
  useAnalyticsContext: props.UNSAFE_useAnalyticsContext,
69
- render: portalProviderAPI => jsx(Fragment, null, jsx(ReactEditorView, {
70
+ render: portalProviderAPI => jsx(Fragment, null, jsx(ReactEditorViewContextWrapper, {
70
71
  editorProps: overriddenEditorProps,
71
72
  createAnalyticsEvent: createAnalyticsEvent,
72
73
  portalProviderAPI: portalProviderAPI,
@@ -117,11 +118,34 @@ export function EditorInternal({
117
118
  enableToolbarMinWidth: ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.toolbarMinWidthOverflow) != null ? !!((_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.toolbarMinWidthOverflow) : props.allowUndoRedoButtons,
118
119
  useStickyToolbar: props.useStickyToolbar,
119
120
  featureFlags: featureFlags,
120
- pluginHooks: config.pluginHooks
121
+ pluginHooks: config.pluginHooks,
122
+ hideAvatarGroup: props.hideAvatarGroup
121
123
  }));
122
124
  }
123
125
  }), jsx(PortalRenderer, {
124
126
  portalProviderAPI: portalProviderAPI
125
127
  }))
126
128
  }))))));
129
+ }
130
+ function ReactEditorViewContextWrapper(props) {
131
+ const setInternalEditorAPI = useSetPresetContext();
132
+ const {
133
+ setEditorApi: setExternalEditorAPI
134
+ } = props;
135
+
136
+ /**
137
+ * We use the context to retrieve the editorAPI
138
+ * externally for consumers via `usePreset`.
139
+ *
140
+ * However we also may need to retrieve this value internally via context
141
+ * so we should also set the value for the `EditorContext` that is used in
142
+ * `EditorInternal`.
143
+ */
144
+ const setEditorAPI = useCallback(api => {
145
+ setInternalEditorAPI === null || setInternalEditorAPI === void 0 ? void 0 : setInternalEditorAPI(api);
146
+ setExternalEditorAPI === null || setExternalEditorAPI === void 0 ? void 0 : setExternalEditorAPI(api);
147
+ }, [setInternalEditorAPI, setExternalEditorAPI]);
148
+ return jsx(ReactEditorView, _extends({}, props, {
149
+ setEditorApi: setEditorAPI
150
+ }));
127
151
  }
@@ -21,7 +21,7 @@ function getSpellCheck(featureFlags) {
21
21
  * which is used by both current and archv3 editors.
22
22
  */
23
23
  export function createFeatureFlagsFromProps(props) {
24
- var _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$allowExtension, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$featureFlags5, _props$featureFlags6, _props$featureFlags7, _props$featureFlags8, _props$featureFlags9, _props$featureFlags10, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$collabEdit, _props$collabEdit2, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22;
24
+ var _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$allowExtension, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$featureFlags5, _props$featureFlags6, _props$featureFlags7, _props$featureFlags8, _props$featureFlags9, _props$featureFlags10, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$collabEdit, _props$collabEdit2, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20;
25
25
  const normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
26
26
  return {
27
27
  ...normalizedFeatureFlags,
@@ -44,13 +44,12 @@ export function createFeatureFlagsFromProps(props) {
44
44
  twoLineEditorToolbar: Boolean(typeof ((_props$featureFlags13 = props.featureFlags) === null || _props$featureFlags13 === void 0 ? void 0 : _props$featureFlags13.twoLineEditorToolbar) === 'boolean' ? !!((_props$featureFlags14 = props.featureFlags) !== null && _props$featureFlags14 !== void 0 && _props$featureFlags14.twoLineEditorToolbar) : false),
45
45
  useNativeCollabPlugin: Boolean(typeof ((_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.useNativePlugin) === 'boolean' ? !!((_props$collabEdit2 = props.collabEdit) !== null && _props$collabEdit2 !== void 0 && _props$collabEdit2.useNativePlugin) : false),
46
46
  showHoverPreview: Boolean(typeof ((_props$featureFlags15 = props.featureFlags) === null || _props$featureFlags15 === void 0 ? void 0 : _props$featureFlags15.showHoverPreview) === 'boolean' ? !!((_props$featureFlags16 = props.featureFlags) !== null && _props$featureFlags16 !== void 0 && _props$featureFlags16.showHoverPreview) : false),
47
- indentationButtonsInTheToolbar: typeof props.showIndentationButtons === 'boolean' ? props.showIndentationButtons : Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$featureFlags17 = props.featureFlags) === null || _props$featureFlags17 === void 0 ? void 0 : _props$featureFlags17.indentationButtonsInTheToolbar) === 'boolean' ? !!((_props$featureFlags18 = props.featureFlags) !== null && _props$featureFlags18 !== void 0 && _props$featureFlags18.indentationButtonsInTheToolbar) : false)),
48
- floatingToolbarLinkSettingsButton: typeof ((_props$featureFlags19 = props.featureFlags) === null || _props$featureFlags19 === void 0 ? void 0 : _props$featureFlags19['floating-toolbar-link-settings-button']) === 'string' ? props.featureFlags['floating-toolbar-link-settings-button'] || undefined : undefined,
47
+ floatingToolbarLinkSettingsButton: typeof ((_props$featureFlags17 = props.featureFlags) === null || _props$featureFlags17 === void 0 ? void 0 : _props$featureFlags17['floating-toolbar-link-settings-button']) === 'string' ? props.featureFlags['floating-toolbar-link-settings-button'] || undefined : undefined,
49
48
  disableSpellcheckByBrowser: getSpellCheck(props.featureFlags),
50
49
  // Including fallback to props.featureFlags so that mobile feature flags
51
50
  // are included (they are not kebab cased)
52
- restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags20 = props.featureFlags) === null || _props$featureFlags20 === void 0 ? void 0 : _props$featureFlags20.restartNumberedLists) === true,
51
+ restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags18 = props.featureFlags) === null || _props$featureFlags18 === void 0 ? void 0 : _props$featureFlags18.restartNumberedLists) === true,
53
52
  lpLinkPickerFocusTrap: Boolean(normalizedFeatureFlags.lpLinkPickerFocusTrap),
54
- preventPopupOverflow: Boolean(typeof ((_props$featureFlags21 = props.featureFlags) === null || _props$featureFlags21 === void 0 ? void 0 : _props$featureFlags21['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags22 = props.featureFlags) !== null && _props$featureFlags22 !== void 0 && _props$featureFlags22['prevent-popup-overflow']) : false)
53
+ preventPopupOverflow: Boolean(typeof ((_props$featureFlags19 = props.featureFlags) === null || _props$featureFlags19 === void 0 ? void 0 : _props$featureFlags19['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags20 = props.featureFlags) !== null && _props$featureFlags20 !== void 0 && _props$featureFlags20['prevent-popup-overflow']) : false)
55
54
  };
56
55
  }
@@ -7,7 +7,6 @@ export { default as jiraIssuePlugin } from './jira-issue';
7
7
  export { default as toolbarListsIndentationPlugin } from './toolbar-lists-indentation';
8
8
  export { default as macroPlugin } from './macro';
9
9
  export { default as maxContentSizePlugin } from './max-content-size';
10
- export { default as panelPlugin } from './panel';
11
10
  export { default as pastePlugin } from './paste';
12
11
  export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
13
12
  export { default as breakoutPlugin } from './breakout';
@@ -1,4 +1,5 @@
1
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, insertBlockPlugin, jiraIssuePlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, tasksAndDecisionsPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
1
+ import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, insertBlockPlugin, jiraIssuePlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, tasksAndDecisionsPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
2
+ import { panelPlugin } from '@atlaskit/editor-plugin-panel';
2
3
  import { textColorPlugin } from '@atlaskit/editor-plugin-text-color';
3
4
  import { historyPlugin } from '@atlaskit/editor-plugin-history';
4
5
  import { statusPlugin } from '@atlaskit/editor-plugin-status';
@@ -353,7 +354,7 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
353
354
  }
354
355
  return builder;
355
356
  }).add([toolbarListsIndentationPlugin, {
356
- showIndentationButtons: !!featureFlags.indentationButtonsInTheToolbar,
357
+ showIndentationButtons: !!props.showIndentationButtons,
357
358
  allowHeadingAndParagraphIndentation: !!props.allowIndentation
358
359
  }]).add([insertBlockPlugin, {
359
360
  allowTables: !!props.allowTables,
@@ -364,14 +365,18 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
364
365
  showElementBrowserLink: props.elementBrowser && props.elementBrowser.showModal || false,
365
366
  replacePlusMenuWithElementBrowser: props.elementBrowser && props.elementBrowser.replacePlusMenu || false
366
367
  }]).maybeAdd(beforePrimaryToolbarPlugin, (plugin, builder) => {
367
- if (!getBooleanFF('platform.confluence.frontend.editor.no.platform.avatar.group') && hasBeforePrimaryToolbar(props.primaryToolbarComponents) && !featureFlags.twoLineEditorToolbar) {
368
+ if (hasBeforePrimaryToolbar(props.primaryToolbarComponents) && !featureFlags.twoLineEditorToolbar) {
368
369
  return builder.add([plugin, {
369
370
  beforePrimaryToolbarComponents: props.primaryToolbarComponents.before
370
371
  }]);
371
372
  }
372
373
  return builder;
373
374
  }).maybeAdd(avatarGroupPlugin, (plugin, builder) => {
374
- if (!getBooleanFF('platform.confluence.frontend.editor.no.platform.avatar.group') && featureFlags.showAvatarGroupAsPlugin === true && !featureFlags.twoLineEditorToolbar) {
375
+ if (!props.hideAvatarGroup && featureFlags.showAvatarGroupAsPlugin === true && !featureFlags.twoLineEditorToolbar) {
376
+ // Avatars are moved to Confluence codebase for Edit in Context
377
+ // When Edit in Context is enabled primaryToolbarComponents is undefined
378
+ // For more details please check
379
+ // https://hello.atlassian.net/wiki/spaces/PCG/pages/2851572180/Editor+toolbar+for+live+pages+and+edit+in+context+projects
375
380
  return builder.add([plugin, {
376
381
  collabEdit: props.collabEdit,
377
382
  takeFullWidth: !hasBeforePrimaryToolbar(props.primaryToolbarComponents)
@@ -381,8 +386,8 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
381
386
  }).maybeAdd(findReplacePlugin, (plugin, builder) => {
382
387
  if (props.allowFindReplace) {
383
388
  return builder.add([plugin, {
384
- takeFullWidth: !getBooleanFF('platform.confluence.frontend.editor.no.platform.avatar.group') && !!featureFlags.showAvatarGroupAsPlugin === false && !hasBeforePrimaryToolbar(props.primaryToolbarComponents),
385
- twoLineEditorToolbar: !!featureFlags.twoLineEditorToolbar
389
+ takeFullWidth: !props.hideAvatarGroup && !!featureFlags.showAvatarGroupAsPlugin === false && !hasBeforePrimaryToolbar(props.primaryToolbarComponents),
390
+ twoLineEditorToolbar: !!props.primaryToolbarComponents && !!featureFlags.twoLineEditorToolbar
386
391
  }]);
387
392
  }
388
393
  return builder;
@@ -58,7 +58,8 @@ export const FullPageEditor = props => {
58
58
  primaryToolbarComponents: props.primaryToolbarComponents,
59
59
  providerFactory: props.providerFactory,
60
60
  showKeyline: showKeyline,
61
- featureFlags: props.featureFlags
61
+ featureFlags: props.featureFlags,
62
+ hideAvatarGroup: props.hideAvatarGroup
62
63
  }), jsx(FullPageContentArea, {
63
64
  ref: scrollContentContainerRef,
64
65
  appearance: props.appearance,
@@ -11,10 +11,14 @@ import { mainToolbarStyle, mainToolbarIconBeforeStyle, mainToolbarFirstChildStyl
11
11
  import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
12
12
  import { fullPageMessages as messages } from '@atlaskit/editor-common/messages';
13
13
  import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
14
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
+ import { usePresetContext } from '../../../presets/context';
15
15
  export const EditorToolbar = /*#__PURE__*/React.memo(props => {
16
- var _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$collabEdit, _props$collabEdit2, _props$collabEdit3, _props$featureFlags5, _props$featureFlags6;
16
+ var _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$collabEdit, _props$collabEdit2, _props$collabEdit3;
17
17
  const [shouldSplitToolbar, setShouldSplitToolbar] = useState(false);
18
+ const editorAPI = usePresetContext();
19
+
20
+ // When primary toolbar components is undefined, do not show two line editor toolbar
21
+ const twoLineEditorToolbar = !!props.customPrimaryToolbarComponents && !!((_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.twoLineEditorToolbar);
18
22
  const nonCustomToolbar = jsx("div", {
19
23
  css: nonCustomToolbarWrapperStyle
20
24
  }, props.beforeIcon && jsx("div", {
@@ -33,20 +37,25 @@ export const EditorToolbar = /*#__PURE__*/React.memo(props => {
33
37
  dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
34
38
  containerElement: props.containerElement,
35
39
  hasMinWidth: props.hasMinWidth,
36
- twoLineEditorToolbar: !!((_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.twoLineEditorToolbar)
40
+ twoLineEditorToolbar: twoLineEditorToolbar
37
41
  }));
38
42
  const customToolbar = jsx("div", {
39
43
  css: customToolbarWrapperStyle
40
- }, (_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.twoLineEditorToolbar && !!props.customPrimaryToolbarComponents && 'before' in props.customPrimaryToolbarComponents ? jsx(BeforePrimaryToolbarWrapper, {
44
+ }, twoLineEditorToolbar && !!props.customPrimaryToolbarComponents && 'before' in props.customPrimaryToolbarComponents ? jsx(BeforePrimaryToolbarWrapper, {
41
45
  beforePrimaryToolbarComponents: props.customPrimaryToolbarComponents.before
42
- }) : null, getBooleanFF('platform.confluence.frontend.editor.no.platform.avatar.group') || (props === null || props === void 0 ? void 0 : (_props$featureFlags3 = props.featureFlags) === null || _props$featureFlags3 === void 0 ? void 0 : _props$featureFlags3.showAvatarGroupAsPlugin) === true && !((_props$featureFlags4 = props.featureFlags) !== null && _props$featureFlags4 !== void 0 && _props$featureFlags4.twoLineEditorToolbar) ? null : jsx(AvatarsWithPluginState, {
46
+ }) : null, props.hideAvatarGroup || (props === null || props === void 0 ? void 0 : (_props$featureFlags2 = props.featureFlags) === null || _props$featureFlags2 === void 0 ? void 0 : _props$featureFlags2.showAvatarGroupAsPlugin) === true && !((_props$featureFlags3 = props.featureFlags) !== null && _props$featureFlags3 !== void 0 && _props$featureFlags3.twoLineEditorToolbar) ? null :
47
+ // Avatars are moved to Confluence codebase for Edit in Context
48
+ // When Edit in Context is enabled customPrimaryToolbarComponents is undefined
49
+ // For more details please check
50
+ // https://hello.atlassian.net/wiki/spaces/PCG/pages/2851572180/Editor+toolbar+for+live+pages+and+edit+in+context+projects
51
+ jsx(AvatarsWithPluginState, {
43
52
  editorView: props.editorView,
44
53
  eventDispatcher: props.eventDispatcher,
45
54
  inviteToEditComponent: (_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.inviteToEditComponent,
46
55
  inviteToEditHandler: (_props$collabEdit2 = props.collabEdit) === null || _props$collabEdit2 === void 0 ? void 0 : _props$collabEdit2.inviteToEditHandler,
47
56
  isInviteToEditButtonSelected: (_props$collabEdit3 = props.collabEdit) === null || _props$collabEdit3 === void 0 ? void 0 : _props$collabEdit3.isInviteToEditButtonSelected,
48
57
  featureFlags: props.featureFlags || {}
49
- }), (_props$featureFlags5 = props.featureFlags) !== null && _props$featureFlags5 !== void 0 && _props$featureFlags5.findReplace && (_props$featureFlags6 = props.featureFlags) !== null && _props$featureFlags6 !== void 0 && _props$featureFlags6.twoLineEditorToolbar ? jsx(FindReplaceToolbarButtonWithState, {
58
+ }), editorAPI !== null && editorAPI !== void 0 && editorAPI.findReplace && twoLineEditorToolbar ? jsx(FindReplaceToolbarButtonWithState, {
50
59
  popupsBoundariesElement: props.popupsBoundariesElement,
51
60
  popupsMountPoint: props.popupsMountPoint,
52
61
  popupsScrollableElement: props.popupsScrollableElement,
@@ -56,8 +65,7 @@ export const EditorToolbar = /*#__PURE__*/React.memo(props => {
56
65
  featureFlags: props.featureFlags
57
66
  }) : null, !!props.customPrimaryToolbarComponents && 'after' in props.customPrimaryToolbarComponents ? props.customPrimaryToolbarComponents.after : props.customPrimaryToolbarComponents);
58
67
  useEffect(() => {
59
- var _props$featureFlags7;
60
- if ((_props$featureFlags7 = props.featureFlags) !== null && _props$featureFlags7 !== void 0 && _props$featureFlags7.twoLineEditorToolbar) {
68
+ if (twoLineEditorToolbar) {
61
69
  const updateOnResize = () => {
62
70
  setShouldSplitToolbar(window.innerWidth <= MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT);
63
71
  };
@@ -81,27 +89,24 @@ export const EditorToolbar = /*#__PURE__*/React.memo(props => {
81
89
  };
82
90
  return jsx(ContextPanelConsumer, null, ({
83
91
  width: contextPanelWidth
84
- }) => {
85
- var _props$featureFlags8, _props$featureFlags9, _props$featureFlags10;
86
- return jsx(ToolbarArrowKeyNavigationProvider, {
87
- editorView: props.editorView,
88
- childComponentSelector: "[data-testid='ak-editor-main-toolbar']",
89
- isShortcutToFocusToolbar: isShortcutToFocusToolbar,
90
- handleEscape: handleEscape,
91
- intl: props.intl
92
- }, jsx("div", {
93
- css: mainToolbarStyle(props.showKeyline || contextPanelWidth > 0, !!((_props$featureFlags8 = props.featureFlags) !== null && _props$featureFlags8 !== void 0 && _props$featureFlags8.twoLineEditorToolbar)),
94
- "data-testid": "ak-editor-main-toolbar"
95
- }, jsx("div", {
96
- css: mainToolbarFirstChildStyle(!!((_props$featureFlags9 = props.featureFlags) !== null && _props$featureFlags9 !== void 0 && _props$featureFlags9.twoLineEditorToolbar)),
97
- role: "toolbar",
98
- "aria-label": props.intl.formatMessage(messages.toolbarLabel)
99
- }, shouldSplitToolbar ? customToolbar : nonCustomToolbar), jsx("div", {
100
- css: mainToolbarSecondChildStyle(!!((_props$featureFlags10 = props.featureFlags) !== null && _props$featureFlags10 !== void 0 && _props$featureFlags10.twoLineEditorToolbar)),
101
- "data-testid": 'avatar-group-outside-plugin',
102
- role: "region",
103
- "aria-label": props.intl.formatMessage(messages.pageActionsLabel)
104
- }, shouldSplitToolbar ? nonCustomToolbar : customToolbar)));
105
- });
92
+ }) => jsx(ToolbarArrowKeyNavigationProvider, {
93
+ editorView: props.editorView,
94
+ childComponentSelector: "[data-testid='ak-editor-main-toolbar']",
95
+ isShortcutToFocusToolbar: isShortcutToFocusToolbar,
96
+ handleEscape: handleEscape,
97
+ intl: props.intl
98
+ }, jsx("div", {
99
+ css: mainToolbarStyle(props.showKeyline || contextPanelWidth > 0, twoLineEditorToolbar),
100
+ "data-testid": "ak-editor-main-toolbar"
101
+ }, jsx("div", {
102
+ css: mainToolbarFirstChildStyle(twoLineEditorToolbar),
103
+ role: "toolbar",
104
+ "aria-label": props.intl.formatMessage(messages.toolbarLabel)
105
+ }, shouldSplitToolbar ? customToolbar : nonCustomToolbar), jsx("div", {
106
+ css: mainToolbarSecondChildStyle(twoLineEditorToolbar),
107
+ "data-testid": 'avatar-group-outside-plugin',
108
+ role: "region",
109
+ "aria-label": props.intl.formatMessage(messages.pageActionsLabel)
110
+ }, shouldSplitToolbar ? nonCustomToolbar : customToolbar))));
106
111
  });
107
112
  export const FullPageToolbar = injectIntl(EditorToolbar);
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "189.1.15";
2
+ export const version = "189.3.0";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };