@atlaskit/editor-core 193.22.0 → 193.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 193.23.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#103741](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/103741)
8
+ [`fb1acc6fb09b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fb1acc6fb09b) -
9
+ Remove inline image preview ff
10
+
11
+ ## 193.23.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#101406](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101406)
16
+ [`6daffd65aec4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6daffd65aec4) -
17
+ [ED-23298] Extract primary toolbar components to editor plugin to allow for custom ordering
18
+
19
+ ### Patch Changes
20
+
21
+ - [#102478](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102478)
22
+ [`3378951608b0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3378951608b0) -
23
+ [ED-23332] Update adf-schema package to 36.10.1
24
+ - Updated dependencies
25
+
3
26
  ## 193.22.0
4
27
 
5
28
  ### Minor Changes
package/codemods/utils.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import type {
2
2
  API,
3
3
  ASTPath,
4
+ default as core,
4
5
  FileInfo,
5
6
  ImportDeclaration,
6
7
  Options,
7
8
  } from 'jscodeshift';
8
- import type core from 'jscodeshift';
9
9
  import type { Collection } from 'jscodeshift/src/Collection';
10
10
 
11
11
  function hasImportDeclaration(
@@ -27,6 +27,7 @@ var _history = require("@atlaskit/editor-plugins/history");
27
27
  var _hyperlink = require("@atlaskit/editor-plugins/hyperlink");
28
28
  var _paste = require("@atlaskit/editor-plugins/paste");
29
29
  var _placeholder = require("@atlaskit/editor-plugins/placeholder");
30
+ var _primaryToolbar = require("@atlaskit/editor-plugins/primary-toolbar");
30
31
  var _quickInsert = require("@atlaskit/editor-plugins/quick-insert");
31
32
  var _selection = require("@atlaskit/editor-plugins/selection");
32
33
  var _selectionToolbar = require("@atlaskit/editor-plugins/selection-toolbar");
@@ -53,7 +54,9 @@ function createDefaultPreset(options) {
53
54
  performanceTracking: options.performanceTracking
54
55
  }], Boolean(options.allowAnalyticsGASV3)).add(_betterTypeHistory.betterTypeHistoryPlugin).add([_paste.pastePlugin, _objectSpread({}, options === null || options === void 0 ? void 0 : options.paste)]).add(_clipboard.clipboardPlugin).add(_focus.focusPlugin).add(_composition.compositionPlugin).add([_contextIdentifier.contextIdentifierPlugin, {
55
56
  contextIdentifierProvider: options.contextIdentifierProvider
56
- }]).add([_base.basePlugin, options.base]).add(_decorations.decorationsPlugin).add([_typeAhead.typeAheadPlugin, options.typeAhead]).maybeAdd(_history.historyPlugin, Boolean(isMobile || options.allowUndoRedoButtons)).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, options.blockType]).add(_clearMarksOnEmptyDoc.clearMarksOnEmptyDocPlugin).maybeAdd([_selectionToolbar.selectionToolbarPlugin, {
57
+ }]).add([_base.basePlugin, options.base]).add(_decorations.decorationsPlugin).add([_typeAhead.typeAheadPlugin, options.typeAhead]).maybeAdd(_history.historyPlugin, Boolean(isMobile || options.allowUndoRedoButtons)).maybeAdd(_primaryToolbar.primaryToolbarPlugin, function () {
58
+ return !!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.primary-toolbar-ordering');
59
+ }).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, options.blockType]).add(_clearMarksOnEmptyDoc.clearMarksOnEmptyDocPlugin).maybeAdd([_selectionToolbar.selectionToolbarPlugin, {
57
60
  preferenceToolbarAboveSelection: false
58
61
  }], function () {
59
62
  if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.enable-selection-toolbar_ucdwd')) {
@@ -103,7 +103,8 @@ var Editor = /*#__PURE__*/function (_React$Component) {
103
103
  });
104
104
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderChrome", function (_ref) {
105
105
  var maxContentSize = _ref.maxContentSize,
106
- mediaState = _ref.mediaState;
106
+ mediaState = _ref.mediaState,
107
+ primaryToolbarState = _ref.primaryToolbarState;
107
108
  var _this$props = _this.props,
108
109
  editorDOMElement = _this$props.editorDOMElement,
109
110
  editorView = _this$props.editorView,
@@ -113,7 +114,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
113
114
  contentComponents = _this$props.contentComponents,
114
115
  customContentComponents = _this$props.customContentComponents,
115
116
  customPrimaryToolbarComponents = _this$props.customPrimaryToolbarComponents,
116
- primaryToolbarComponents = _this$props.primaryToolbarComponents,
117
+ primaryToolbarComponentsProp = _this$props.primaryToolbarComponents,
117
118
  customSecondaryToolbarComponents = _this$props.customSecondaryToolbarComponents,
118
119
  popupsMountPoint = _this$props.popupsMountPoint,
119
120
  popupsBoundariesElement = _this$props.popupsBoundariesElement,
@@ -143,6 +144,12 @@ var Editor = /*#__PURE__*/function (_React$Component) {
143
144
  event.preventDefault();
144
145
  event.stopPropagation();
145
146
  };
147
+ var primaryToolbarComponents = primaryToolbarComponentsProp;
148
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.primary-toolbar-ordering')) {
149
+ if (Array.isArray(primaryToolbarState === null || primaryToolbarState === void 0 ? void 0 : primaryToolbarState.components) && Array.isArray(primaryToolbarComponents)) {
150
+ primaryToolbarComponents = primaryToolbarState.components.concat(primaryToolbarComponents);
151
+ }
152
+ }
146
153
  return (0, _react2.jsx)(_WithFlash.default, {
147
154
  animate: maxContentSizeReached
148
155
  }, (0, _react2.jsx)("div", {
@@ -247,19 +254,22 @@ var Editor = /*#__PURE__*/function (_React$Component) {
247
254
  function RenderWithPluginState(_ref4) {
248
255
  var renderChrome = _ref4.renderChrome;
249
256
  var api = (0, _context.usePresetContext)();
250
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['media', 'maxContentSize']),
257
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['media', 'maxContentSize', 'primaryToolbar']),
251
258
  mediaState = _useSharedPluginState.mediaState,
252
- maxContentSizeState = _useSharedPluginState.maxContentSizeState;
259
+ maxContentSizeState = _useSharedPluginState.maxContentSizeState,
260
+ primaryToolbarState = _useSharedPluginState.primaryToolbarState;
253
261
  return (0, _react2.jsx)(_react.Fragment, null, renderChrome({
254
262
  maxContentSize: maxContentSizeState,
255
- mediaState: mediaState !== null && mediaState !== void 0 ? mediaState : undefined
263
+ mediaState: mediaState !== null && mediaState !== void 0 ? mediaState : undefined,
264
+ primaryToolbarState: primaryToolbarState
256
265
  }));
257
266
  }
258
267
  var EditorNext = function EditorNext(props) {
259
268
  var api = (0, _context.usePresetContext)();
260
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['media', 'maxContentSize']),
269
+ var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['media', 'maxContentSize', 'primaryToolbar']),
261
270
  mediaState = _useSharedPluginState2.mediaState,
262
- maxContentSizeState = _useSharedPluginState2.maxContentSizeState;
271
+ maxContentSizeState = _useSharedPluginState2.maxContentSizeState,
272
+ primaryToolbarState = _useSharedPluginState2.primaryToolbarState;
263
273
  var editorDOMElement = props.editorDOMElement,
264
274
  editorView = props.editorView,
265
275
  editorActions = props.editorActions,
@@ -268,7 +278,7 @@ var EditorNext = function EditorNext(props) {
268
278
  contentComponents = props.contentComponents,
269
279
  customContentComponents = props.customContentComponents,
270
280
  customPrimaryToolbarComponents = props.customPrimaryToolbarComponents,
271
- primaryToolbarComponents = props.primaryToolbarComponents,
281
+ primaryToolbarComponentsProp = props.primaryToolbarComponents,
272
282
  customSecondaryToolbarComponents = props.customSecondaryToolbarComponents,
273
283
  popupsMountPoint = props.popupsMountPoint,
274
284
  popupsBoundariesElement = props.popupsBoundariesElement,
@@ -327,6 +337,12 @@ var EditorNext = function EditorNext(props) {
327
337
  event.preventDefault();
328
338
  event.stopPropagation();
329
339
  }, [editorView]);
340
+ var primaryToolbarComponents = primaryToolbarComponentsProp;
341
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.primary-toolbar-ordering')) {
342
+ if (Array.isArray(primaryToolbarState === null || primaryToolbarState === void 0 ? void 0 : primaryToolbarState.components) && Array.isArray(primaryToolbarComponents)) {
343
+ primaryToolbarComponents = primaryToolbarState.components.concat(primaryToolbarComponents);
344
+ }
345
+ }
330
346
  return (0, _react2.jsx)(_WithFlash.default, {
331
347
  animate: maxContentSizeReached
332
348
  }, (0, _react2.jsx)("div", {
@@ -12,6 +12,7 @@ var _react2 = require("@emotion/react");
12
12
  var _hooks = require("@atlaskit/editor-common/hooks");
13
13
  var _ui = require("@atlaskit/editor-common/ui");
14
14
  var _utils = require("@atlaskit/editor-common/utils");
15
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
16
  var _context = require("../../../presets/context");
16
17
  var _FullPageContentArea = require("./FullPageContentArea");
17
18
  var _FullPageToolbar = require("./FullPageToolbar");
@@ -57,8 +58,15 @@ var FullPageEditor = exports.FullPageEditor = function FullPageEditor(props) {
57
58
  var scrollContentContainerRef = (0, _react.useRef)(null);
58
59
  var showKeyline = useShowKeyline(scrollContentContainerRef);
59
60
  var editorAPI = (0, _context.usePresetContext)();
60
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(editorAPI, ['editorViewMode']),
61
- editorViewModeState = _useSharedPluginState.editorViewModeState;
61
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(editorAPI, ['editorViewMode', 'primaryToolbar']),
62
+ editorViewModeState = _useSharedPluginState.editorViewModeState,
63
+ primaryToolbarState = _useSharedPluginState.primaryToolbarState;
64
+ var primaryToolbarComponents = props.primaryToolbarComponents;
65
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.primary-toolbar-ordering')) {
66
+ if (Array.isArray(primaryToolbarState === null || primaryToolbarState === void 0 ? void 0 : primaryToolbarState.components) && Array.isArray(primaryToolbarComponents)) {
67
+ primaryToolbarComponents = primaryToolbarState.components.concat(primaryToolbarComponents);
68
+ }
69
+ }
62
70
  var isEditorToolbarHidden = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
63
71
  return (0, _react2.jsx)(_ui.ContextPanelWidthProvider, null, (0, _react2.jsx)("div", {
64
72
  css: _StyledComponents.fullPageEditorWrapper,
@@ -80,7 +88,7 @@ var FullPageEditor = exports.FullPageEditor = function FullPageEditor(props) {
80
88
  popupsBoundariesElement: props.popupsBoundariesElement,
81
89
  popupsMountPoint: props.popupsMountPoint,
82
90
  popupsScrollableElement: props.popupsScrollableElement,
83
- primaryToolbarComponents: props.primaryToolbarComponents,
91
+ primaryToolbarComponents: primaryToolbarComponents,
84
92
  providerFactory: props.providerFactory,
85
93
  showKeyline: showKeyline,
86
94
  featureFlags: props.featureFlags,
@@ -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 = "193.22.0";
8
+ var version = exports.version = "193.23.1";
@@ -20,6 +20,7 @@ import { historyPlugin } from '@atlaskit/editor-plugins/history';
20
20
  import { hyperlinkPlugin } from '@atlaskit/editor-plugins/hyperlink';
21
21
  import { pastePlugin } from '@atlaskit/editor-plugins/paste';
22
22
  import { placeholderPlugin } from '@atlaskit/editor-plugins/placeholder';
23
+ import { primaryToolbarPlugin } from '@atlaskit/editor-plugins/primary-toolbar';
23
24
  import { quickInsertPlugin } from '@atlaskit/editor-plugins/quick-insert';
24
25
  import { selectionPlugin } from '@atlaskit/editor-plugins/selection';
25
26
  import { selectionToolbarPlugin } from '@atlaskit/editor-plugins/selection-toolbar';
@@ -30,7 +31,6 @@ import { undoRedoPlugin } from '@atlaskit/editor-plugins/undo-redo';
30
31
  import { unsupportedContentPlugin } from '@atlaskit/editor-plugins/unsupported-content';
31
32
  import { widthPlugin } from '@atlaskit/editor-plugins/width';
32
33
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
33
-
34
34
  // #endregion
35
35
 
36
36
  /**
@@ -47,7 +47,7 @@ export function createDefaultPreset(options) {
47
47
  ...(options === null || options === void 0 ? void 0 : options.paste)
48
48
  }]).add(clipboardPlugin).add(focusPlugin).add(compositionPlugin).add([contextIdentifierPlugin, {
49
49
  contextIdentifierProvider: options.contextIdentifierProvider
50
- }]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead]).maybeAdd(historyPlugin, Boolean(isMobile || options.allowUndoRedoButtons)).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, options.blockType]).add(clearMarksOnEmptyDocPlugin).maybeAdd([selectionToolbarPlugin, {
50
+ }]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead]).maybeAdd(historyPlugin, Boolean(isMobile || options.allowUndoRedoButtons)).maybeAdd(primaryToolbarPlugin, () => !!getBooleanFF('platform.editor.primary-toolbar-ordering')).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, options.blockType]).add(clearMarksOnEmptyDocPlugin).maybeAdd([selectionToolbarPlugin, {
51
51
  preferenceToolbarAboveSelection: false
52
52
  }], () => {
53
53
  if (getBooleanFF('platform.editor.enable-selection-toolbar_ucdwd')) {
@@ -81,7 +81,8 @@ class Editor extends React.Component {
81
81
  });
82
82
  _defineProperty(this, "renderChrome", ({
83
83
  maxContentSize,
84
- mediaState
84
+ mediaState,
85
+ primaryToolbarState
85
86
  }) => {
86
87
  const {
87
88
  editorDOMElement,
@@ -92,7 +93,7 @@ class Editor extends React.Component {
92
93
  contentComponents,
93
94
  customContentComponents,
94
95
  customPrimaryToolbarComponents,
95
- primaryToolbarComponents,
96
+ primaryToolbarComponents: primaryToolbarComponentsProp,
96
97
  customSecondaryToolbarComponents,
97
98
  popupsMountPoint,
98
99
  popupsBoundariesElement,
@@ -122,6 +123,12 @@ class Editor extends React.Component {
122
123
  event.preventDefault();
123
124
  event.stopPropagation();
124
125
  };
126
+ let primaryToolbarComponents = primaryToolbarComponentsProp;
127
+ if (getBooleanFF('platform.editor.primary-toolbar-ordering')) {
128
+ if (Array.isArray(primaryToolbarState === null || primaryToolbarState === void 0 ? void 0 : primaryToolbarState.components) && Array.isArray(primaryToolbarComponents)) {
129
+ primaryToolbarComponents = primaryToolbarState.components.concat(primaryToolbarComponents);
130
+ }
131
+ }
125
132
  return jsx(WithFlash, {
126
133
  animate: maxContentSizeReached
127
134
  }, jsx("div", {
@@ -223,19 +230,22 @@ function RenderWithPluginState({
223
230
  const api = usePresetContext();
224
231
  const {
225
232
  mediaState,
226
- maxContentSizeState
227
- } = useSharedPluginState(api, ['media', 'maxContentSize']);
233
+ maxContentSizeState,
234
+ primaryToolbarState
235
+ } = useSharedPluginState(api, ['media', 'maxContentSize', 'primaryToolbar']);
228
236
  return jsx(Fragment, null, renderChrome({
229
237
  maxContentSize: maxContentSizeState,
230
- mediaState: mediaState !== null && mediaState !== void 0 ? mediaState : undefined
238
+ mediaState: mediaState !== null && mediaState !== void 0 ? mediaState : undefined,
239
+ primaryToolbarState
231
240
  }));
232
241
  }
233
242
  const EditorNext = props => {
234
243
  const api = usePresetContext();
235
244
  const {
236
245
  mediaState,
237
- maxContentSizeState
238
- } = useSharedPluginState(api, ['media', 'maxContentSize']);
246
+ maxContentSizeState,
247
+ primaryToolbarState
248
+ } = useSharedPluginState(api, ['media', 'maxContentSize', 'primaryToolbar']);
239
249
  const {
240
250
  editorDOMElement,
241
251
  editorView,
@@ -245,7 +255,7 @@ const EditorNext = props => {
245
255
  contentComponents,
246
256
  customContentComponents,
247
257
  customPrimaryToolbarComponents,
248
- primaryToolbarComponents,
258
+ primaryToolbarComponents: primaryToolbarComponentsProp,
249
259
  customSecondaryToolbarComponents,
250
260
  popupsMountPoint,
251
261
  popupsBoundariesElement,
@@ -297,6 +307,12 @@ const EditorNext = props => {
297
307
  event.preventDefault();
298
308
  event.stopPropagation();
299
309
  }, [editorView]);
310
+ let primaryToolbarComponents = primaryToolbarComponentsProp;
311
+ if (getBooleanFF('platform.editor.primary-toolbar-ordering')) {
312
+ if (Array.isArray(primaryToolbarState === null || primaryToolbarState === void 0 ? void 0 : primaryToolbarState.components) && Array.isArray(primaryToolbarComponents)) {
313
+ primaryToolbarComponents = primaryToolbarState.components.concat(primaryToolbarComponents);
314
+ }
315
+ }
300
316
  return jsx(WithFlash, {
301
317
  animate: maxContentSizeReached
302
318
  }, jsx("div", {
@@ -4,6 +4,7 @@ import { jsx } from '@emotion/react';
4
4
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
5
5
  import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
6
6
  import { browser } from '@atlaskit/editor-common/utils';
7
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
8
  import { usePresetContext } from '../../../presets/context';
8
9
  import { FullPageContentArea } from './FullPageContentArea';
9
10
  import { FullPageToolbar } from './FullPageToolbar';
@@ -39,8 +40,15 @@ export const FullPageEditor = props => {
39
40
  const showKeyline = useShowKeyline(scrollContentContainerRef);
40
41
  const editorAPI = usePresetContext();
41
42
  const {
42
- editorViewModeState
43
- } = useSharedPluginState(editorAPI, ['editorViewMode']);
43
+ editorViewModeState,
44
+ primaryToolbarState
45
+ } = useSharedPluginState(editorAPI, ['editorViewMode', 'primaryToolbar']);
46
+ let primaryToolbarComponents = props.primaryToolbarComponents;
47
+ if (getBooleanFF('platform.editor.primary-toolbar-ordering')) {
48
+ if (Array.isArray(primaryToolbarState === null || primaryToolbarState === void 0 ? void 0 : primaryToolbarState.components) && Array.isArray(primaryToolbarComponents)) {
49
+ primaryToolbarComponents = primaryToolbarState.components.concat(primaryToolbarComponents);
50
+ }
51
+ }
44
52
  const isEditorToolbarHidden = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
45
53
  return jsx(ContextPanelWidthProvider, null, jsx("div", {
46
54
  css: fullPageEditorWrapper,
@@ -62,7 +70,7 @@ export const FullPageEditor = props => {
62
70
  popupsBoundariesElement: props.popupsBoundariesElement,
63
71
  popupsMountPoint: props.popupsMountPoint,
64
72
  popupsScrollableElement: props.popupsScrollableElement,
65
- primaryToolbarComponents: props.primaryToolbarComponents,
73
+ primaryToolbarComponents: primaryToolbarComponents,
66
74
  providerFactory: props.providerFactory,
67
75
  showKeyline: showKeyline,
68
76
  featureFlags: props.featureFlags,
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "193.22.0";
2
+ export const version = "193.23.1";
@@ -23,6 +23,7 @@ import { historyPlugin } from '@atlaskit/editor-plugins/history';
23
23
  import { hyperlinkPlugin } from '@atlaskit/editor-plugins/hyperlink';
24
24
  import { pastePlugin } from '@atlaskit/editor-plugins/paste';
25
25
  import { placeholderPlugin } from '@atlaskit/editor-plugins/placeholder';
26
+ import { primaryToolbarPlugin } from '@atlaskit/editor-plugins/primary-toolbar';
26
27
  import { quickInsertPlugin } from '@atlaskit/editor-plugins/quick-insert';
27
28
  import { selectionPlugin } from '@atlaskit/editor-plugins/selection';
28
29
  import { selectionToolbarPlugin } from '@atlaskit/editor-plugins/selection-toolbar';
@@ -33,7 +34,6 @@ import { undoRedoPlugin } from '@atlaskit/editor-plugins/undo-redo';
33
34
  import { unsupportedContentPlugin } from '@atlaskit/editor-plugins/unsupported-content';
34
35
  import { widthPlugin } from '@atlaskit/editor-plugins/width';
35
36
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
36
-
37
37
  // #endregion
38
38
 
39
39
  /**
@@ -48,7 +48,9 @@ export function createDefaultPreset(options) {
48
48
  performanceTracking: options.performanceTracking
49
49
  }], Boolean(options.allowAnalyticsGASV3)).add(betterTypeHistoryPlugin).add([pastePlugin, _objectSpread({}, options === null || options === void 0 ? void 0 : options.paste)]).add(clipboardPlugin).add(focusPlugin).add(compositionPlugin).add([contextIdentifierPlugin, {
50
50
  contextIdentifierProvider: options.contextIdentifierProvider
51
- }]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead]).maybeAdd(historyPlugin, Boolean(isMobile || options.allowUndoRedoButtons)).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, options.blockType]).add(clearMarksOnEmptyDocPlugin).maybeAdd([selectionToolbarPlugin, {
51
+ }]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead]).maybeAdd(historyPlugin, Boolean(isMobile || options.allowUndoRedoButtons)).maybeAdd(primaryToolbarPlugin, function () {
52
+ return !!getBooleanFF('platform.editor.primary-toolbar-ordering');
53
+ }).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, options.blockType]).add(clearMarksOnEmptyDocPlugin).maybeAdd([selectionToolbarPlugin, {
52
54
  preferenceToolbarAboveSelection: false
53
55
  }], function () {
54
56
  if (getBooleanFF('platform.editor.enable-selection-toolbar_ucdwd')) {
@@ -94,7 +94,8 @@ var Editor = /*#__PURE__*/function (_React$Component) {
94
94
  });
95
95
  _defineProperty(_assertThisInitialized(_this), "renderChrome", function (_ref) {
96
96
  var maxContentSize = _ref.maxContentSize,
97
- mediaState = _ref.mediaState;
97
+ mediaState = _ref.mediaState,
98
+ primaryToolbarState = _ref.primaryToolbarState;
98
99
  var _this$props = _this.props,
99
100
  editorDOMElement = _this$props.editorDOMElement,
100
101
  editorView = _this$props.editorView,
@@ -104,7 +105,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
104
105
  contentComponents = _this$props.contentComponents,
105
106
  customContentComponents = _this$props.customContentComponents,
106
107
  customPrimaryToolbarComponents = _this$props.customPrimaryToolbarComponents,
107
- primaryToolbarComponents = _this$props.primaryToolbarComponents,
108
+ primaryToolbarComponentsProp = _this$props.primaryToolbarComponents,
108
109
  customSecondaryToolbarComponents = _this$props.customSecondaryToolbarComponents,
109
110
  popupsMountPoint = _this$props.popupsMountPoint,
110
111
  popupsBoundariesElement = _this$props.popupsBoundariesElement,
@@ -134,6 +135,12 @@ var Editor = /*#__PURE__*/function (_React$Component) {
134
135
  event.preventDefault();
135
136
  event.stopPropagation();
136
137
  };
138
+ var primaryToolbarComponents = primaryToolbarComponentsProp;
139
+ if (getBooleanFF('platform.editor.primary-toolbar-ordering')) {
140
+ if (Array.isArray(primaryToolbarState === null || primaryToolbarState === void 0 ? void 0 : primaryToolbarState.components) && Array.isArray(primaryToolbarComponents)) {
141
+ primaryToolbarComponents = primaryToolbarState.components.concat(primaryToolbarComponents);
142
+ }
143
+ }
137
144
  return jsx(WithFlash, {
138
145
  animate: maxContentSizeReached
139
146
  }, jsx("div", {
@@ -238,19 +245,22 @@ _defineProperty(Editor, "displayName", 'CommentEditorAppearance');
238
245
  function RenderWithPluginState(_ref4) {
239
246
  var renderChrome = _ref4.renderChrome;
240
247
  var api = usePresetContext();
241
- var _useSharedPluginState = useSharedPluginState(api, ['media', 'maxContentSize']),
248
+ var _useSharedPluginState = useSharedPluginState(api, ['media', 'maxContentSize', 'primaryToolbar']),
242
249
  mediaState = _useSharedPluginState.mediaState,
243
- maxContentSizeState = _useSharedPluginState.maxContentSizeState;
250
+ maxContentSizeState = _useSharedPluginState.maxContentSizeState,
251
+ primaryToolbarState = _useSharedPluginState.primaryToolbarState;
244
252
  return jsx(Fragment, null, renderChrome({
245
253
  maxContentSize: maxContentSizeState,
246
- mediaState: mediaState !== null && mediaState !== void 0 ? mediaState : undefined
254
+ mediaState: mediaState !== null && mediaState !== void 0 ? mediaState : undefined,
255
+ primaryToolbarState: primaryToolbarState
247
256
  }));
248
257
  }
249
258
  var EditorNext = function EditorNext(props) {
250
259
  var api = usePresetContext();
251
- var _useSharedPluginState2 = useSharedPluginState(api, ['media', 'maxContentSize']),
260
+ var _useSharedPluginState2 = useSharedPluginState(api, ['media', 'maxContentSize', 'primaryToolbar']),
252
261
  mediaState = _useSharedPluginState2.mediaState,
253
- maxContentSizeState = _useSharedPluginState2.maxContentSizeState;
262
+ maxContentSizeState = _useSharedPluginState2.maxContentSizeState,
263
+ primaryToolbarState = _useSharedPluginState2.primaryToolbarState;
254
264
  var editorDOMElement = props.editorDOMElement,
255
265
  editorView = props.editorView,
256
266
  editorActions = props.editorActions,
@@ -259,7 +269,7 @@ var EditorNext = function EditorNext(props) {
259
269
  contentComponents = props.contentComponents,
260
270
  customContentComponents = props.customContentComponents,
261
271
  customPrimaryToolbarComponents = props.customPrimaryToolbarComponents,
262
- primaryToolbarComponents = props.primaryToolbarComponents,
272
+ primaryToolbarComponentsProp = props.primaryToolbarComponents,
263
273
  customSecondaryToolbarComponents = props.customSecondaryToolbarComponents,
264
274
  popupsMountPoint = props.popupsMountPoint,
265
275
  popupsBoundariesElement = props.popupsBoundariesElement,
@@ -318,6 +328,12 @@ var EditorNext = function EditorNext(props) {
318
328
  event.preventDefault();
319
329
  event.stopPropagation();
320
330
  }, [editorView]);
331
+ var primaryToolbarComponents = primaryToolbarComponentsProp;
332
+ if (getBooleanFF('platform.editor.primary-toolbar-ordering')) {
333
+ if (Array.isArray(primaryToolbarState === null || primaryToolbarState === void 0 ? void 0 : primaryToolbarState.components) && Array.isArray(primaryToolbarComponents)) {
334
+ primaryToolbarComponents = primaryToolbarState.components.concat(primaryToolbarComponents);
335
+ }
336
+ }
321
337
  return jsx(WithFlash, {
322
338
  animate: maxContentSizeReached
323
339
  }, jsx("div", {
@@ -5,6 +5,7 @@ import { jsx } from '@emotion/react';
5
5
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
6
6
  import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
7
7
  import { browser } from '@atlaskit/editor-common/utils';
8
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
9
  import { usePresetContext } from '../../../presets/context';
9
10
  import { FullPageContentArea } from './FullPageContentArea';
10
11
  import { FullPageToolbar } from './FullPageToolbar';
@@ -46,8 +47,15 @@ export var FullPageEditor = function FullPageEditor(props) {
46
47
  var scrollContentContainerRef = useRef(null);
47
48
  var showKeyline = useShowKeyline(scrollContentContainerRef);
48
49
  var editorAPI = usePresetContext();
49
- var _useSharedPluginState = useSharedPluginState(editorAPI, ['editorViewMode']),
50
- editorViewModeState = _useSharedPluginState.editorViewModeState;
50
+ var _useSharedPluginState = useSharedPluginState(editorAPI, ['editorViewMode', 'primaryToolbar']),
51
+ editorViewModeState = _useSharedPluginState.editorViewModeState,
52
+ primaryToolbarState = _useSharedPluginState.primaryToolbarState;
53
+ var primaryToolbarComponents = props.primaryToolbarComponents;
54
+ if (getBooleanFF('platform.editor.primary-toolbar-ordering')) {
55
+ if (Array.isArray(primaryToolbarState === null || primaryToolbarState === void 0 ? void 0 : primaryToolbarState.components) && Array.isArray(primaryToolbarComponents)) {
56
+ primaryToolbarComponents = primaryToolbarState.components.concat(primaryToolbarComponents);
57
+ }
58
+ }
51
59
  var isEditorToolbarHidden = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
52
60
  return jsx(ContextPanelWidthProvider, null, jsx("div", {
53
61
  css: fullPageEditorWrapper,
@@ -69,7 +77,7 @@ export var FullPageEditor = function FullPageEditor(props) {
69
77
  popupsBoundariesElement: props.popupsBoundariesElement,
70
78
  popupsMountPoint: props.popupsMountPoint,
71
79
  popupsScrollableElement: props.popupsScrollableElement,
72
- primaryToolbarComponents: props.primaryToolbarComponents,
80
+ primaryToolbarComponents: primaryToolbarComponents,
73
81
  providerFactory: props.providerFactory,
74
82
  showKeyline: showKeyline,
75
83
  featureFlags: props.featureFlags,
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "193.22.0";
2
+ export var version = "193.23.1";