@atlaskit/editor-plugin-floating-toolbar 6.0.2 → 7.0.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 (32) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/floatingToolbarPlugin.js +2 -2
  3. package/dist/cjs/ui/Dropdown.js +11 -7
  4. package/dist/cjs/ui/DropdownMenu.js +3 -3
  5. package/dist/cjs/ui/ExtensionsPlaceholder.js +19 -8
  6. package/dist/cjs/ui/ScrollButtons.js +6 -3
  7. package/dist/cjs/ui/Toolbar.js +34 -24
  8. package/dist/es2019/floatingToolbarPlugin.js +2 -2
  9. package/dist/es2019/ui/Dropdown.js +11 -7
  10. package/dist/es2019/ui/DropdownMenu.js +3 -3
  11. package/dist/es2019/ui/ExtensionsPlaceholder.js +19 -8
  12. package/dist/es2019/ui/ScrollButtons.js +6 -3
  13. package/dist/es2019/ui/Toolbar.js +34 -24
  14. package/dist/esm/floatingToolbarPlugin.js +2 -2
  15. package/dist/esm/ui/Dropdown.js +11 -7
  16. package/dist/esm/ui/DropdownMenu.js +3 -3
  17. package/dist/esm/ui/ExtensionsPlaceholder.js +19 -8
  18. package/dist/esm/ui/ScrollButtons.js +6 -3
  19. package/dist/esm/ui/Toolbar.js +34 -24
  20. package/dist/types/floatingToolbarPluginType.d.ts +3 -1
  21. package/dist/types/ui/Dropdown.d.ts +1 -0
  22. package/dist/types/ui/DropdownMenu.d.ts +1 -0
  23. package/dist/types/ui/ExtensionsPlaceholder.d.ts +1 -0
  24. package/dist/types/ui/ScrollButtons.d.ts +2 -1
  25. package/dist/types/ui/Toolbar.d.ts +1 -1
  26. package/dist/types-ts4.5/floatingToolbarPluginType.d.ts +3 -1
  27. package/dist/types-ts4.5/ui/Dropdown.d.ts +1 -0
  28. package/dist/types-ts4.5/ui/DropdownMenu.d.ts +1 -0
  29. package/dist/types-ts4.5/ui/ExtensionsPlaceholder.d.ts +1 -0
  30. package/dist/types-ts4.5/ui/ScrollButtons.d.ts +2 -1
  31. package/dist/types-ts4.5/ui/Toolbar.d.ts +1 -1
  32. package/package.json +16 -16
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/editor-plugin-floating-toolbar
2
2
 
3
+ ## 7.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 6.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`c0113eeccb2df`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c0113eeccb2df) -
14
+ [ux] ED-29120 add a new config option for default editor preset
15
+ (`toolbar.enableNewToolbarExperience`) which allows the new toolbar to be disabled. This is needed
16
+ for editors that can't be excluded at the experiment level.
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 6.0.2
4
23
 
5
24
  ### Patch Changes
@@ -244,7 +244,7 @@ function ContentComponent(_ref5) {
244
244
  node = configWithNodeInfo.node;
245
245
 
246
246
  // When the new inline editor-toolbar is enabled, suppress floating toolbar for text selections.
247
- if ((0, _experiments.editorExperiment)('platform_editor_toolbar_aifc', true)) {
247
+ if (Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar) && (0, _experiments.editorExperiment)('platform_editor_toolbar_aifc', true)) {
248
248
  var selection = editorView.state.selection;
249
249
  var isCellSelection = '$anchorCell' in selection && !selection.empty;
250
250
  var isTextSelected = selection instanceof _state.TextSelection && !selection.empty;
@@ -299,7 +299,7 @@ function ContentComponent(_ref5) {
299
299
  return toolbarItemViewModeProp in item && !!item[toolbarItemViewModeProp];
300
300
  });
301
301
  }
302
- if ((0, _toolbarFlagCheck.areToolbarFlagsEnabled)()) {
302
+ if ((0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))) {
303
303
  var _items2;
304
304
  // Consolidate floating toolbar items
305
305
  var toolbarItemsArray = Array.isArray(items) ? items : (_items2 = items) === null || _items2 === void 0 ? void 0 : _items2(node);
@@ -14,7 +14,6 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
  var _react = _interopRequireWildcard(require("react"));
16
16
  var _react2 = require("@emotion/react");
17
- var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
18
17
  var _ui = require("@atlaskit/editor-common/ui");
19
18
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
20
19
  var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-down"));
@@ -75,13 +74,15 @@ var Dropdown = exports.default = /*#__PURE__*/function (_Component) {
75
74
  var _this$props = _this.props,
76
75
  showSelected = _this$props.showSelected,
77
76
  dispatchCommand = _this$props.dispatchCommand,
78
- editorView = _this$props.editorView;
77
+ editorView = _this$props.editorView,
78
+ areAnyNewToolbarFlagsEnabled = _this$props.areAnyNewToolbarFlagsEnabled;
79
79
  return (0, _react2.jsx)(_DropdownMenu.default, {
80
80
  hide: _this.hide,
81
81
  dispatchCommand: dispatchCommand,
82
82
  items: options,
83
83
  showSelected: showSelected,
84
- editorView: editorView
84
+ editorView: editorView,
85
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
85
86
  });
86
87
  });
87
88
  (0, _defineProperty2.default)(_this, "toggleOpen", function () {
@@ -158,7 +159,8 @@ var Dropdown = exports.default = /*#__PURE__*/function (_Component) {
158
159
  pulse = _this$props2.pulse,
159
160
  spotlightConfig = _this$props2.spotlightConfig,
160
161
  shouldFitContainer = _this$props2.shouldFitContainer,
161
- alignX = _this$props2.alignX;
162
+ alignX = _this$props2.alignX,
163
+ areAnyNewToolbarFlagsEnabled = _this$props2.areAnyNewToolbarFlagsEnabled;
162
164
  var trigger;
163
165
  if (icon) {
164
166
  var TriggerIcon = hideExpandIcon ? icon : (0, _react2.jsx)(CompositeIcon, {
@@ -173,10 +175,11 @@ var Dropdown = exports.default = /*#__PURE__*/function (_Component) {
173
175
  selected: isOpen,
174
176
  disabled: disabled,
175
177
  tooltipContent: tooltip,
176
- ariaHasPopup: (0, _toolbarFlagCheck.areToolbarFlagsEnabled)() ? true : undefined,
178
+ ariaHasPopup: areAnyNewToolbarFlagsEnabled ? true : undefined,
177
179
  onMount: onMount,
178
180
  pulse: pulse,
179
- spotlightConfig: spotlightConfig
181
+ spotlightConfig: spotlightConfig,
182
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
180
183
  });
181
184
  } else {
182
185
  trigger = (0, _react2.jsx)(_ui.FloatingToolbarButton, {
@@ -200,7 +203,8 @@ var Dropdown = exports.default = /*#__PURE__*/function (_Component) {
200
203
  areaControls: dropdownListId,
201
204
  onMount: onMount,
202
205
  pulse: pulse,
203
- spotlightConfig: spotlightConfig
206
+ spotlightConfig: spotlightConfig,
207
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
204
208
  }, title);
205
209
  }
206
210
 
@@ -8,7 +8,6 @@ var _react = require("react");
8
8
  var _react2 = require("@emotion/react");
9
9
  var _reactIntlNext = require("react-intl-next");
10
10
  var _floatingToolbar = require("@atlaskit/editor-common/floating-toolbar");
11
- var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
12
11
  var _menu = require("@atlaskit/menu");
13
12
  /**
14
13
  * @jsxRuntime classic
@@ -55,8 +54,9 @@ var Dropdown = /*#__PURE__*/(0, _react.memo)(function (props) {
55
54
  intl = props.intl,
56
55
  editorView = props.editorView,
57
56
  _props$showSelected = props.showSelected,
58
- showSelected = _props$showSelected === void 0 ? true : _props$showSelected;
59
- if ((0, _toolbarFlagCheck.areToolbarFlagsEnabled)()) {
57
+ showSelected = _props$showSelected === void 0 ? true : _props$showSelected,
58
+ areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
59
+ if (areAnyNewToolbarFlagsEnabled) {
60
60
  return (0, _react2.jsx)("div", {
61
61
  css: menuContainerStyles,
62
62
  role: "menu"
@@ -55,7 +55,8 @@ var resolveExtensionIcon = /*#__PURE__*/function () {
55
55
  var ExtensionButton = function ExtensionButton(props) {
56
56
  var item = props.item,
57
57
  node = props.node,
58
- extensionApi = props.extensionApi;
58
+ extensionApi = props.extensionApi,
59
+ areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
59
60
  var ButtonIcon = _react.default.useMemo(function () {
60
61
  return item.icon ? (0, _reactLoadable.default)({
61
62
  // Ignored via go/ees005
@@ -110,7 +111,8 @@ var ExtensionButton = function ExtensionButton(props) {
110
111
  onClick: onClick,
111
112
  tooltipContent: item.tooltip,
112
113
  tooltipStyle: item.tooltipStyle,
113
- disabled: item.disabled
114
+ disabled: item.disabled,
115
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
114
116
  }, item.label);
115
117
  };
116
118
  var ExtensionsPlaceholder = exports.ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
@@ -126,7 +128,8 @@ var ExtensionsPlaceholder = exports.ExtensionsPlaceholder = function ExtensionsP
126
128
  popupsMountPoint = props.popupsMountPoint,
127
129
  popupsBoundariesElement = props.popupsBoundariesElement,
128
130
  popupsScrollableElement = props.popupsScrollableElement,
129
- alignDropdownWithToolbar = props.alignDropdownWithToolbar;
131
+ alignDropdownWithToolbar = props.alignDropdownWithToolbar,
132
+ areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
130
133
  // Ignored via go/ees005
131
134
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
132
135
  var _useState = (0, _react.useState)([]),
@@ -184,7 +187,9 @@ var ExtensionsPlaceholder = exports.ExtensionsPlaceholder = function ExtensionsP
184
187
  // but count fragment as 1 child, so here we create the children manually.
185
188
  var children = [];
186
189
  if (separator && ['start', 'both'].includes(separator)) {
187
- children.push( /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarSeparator, null));
190
+ children.push( /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarSeparator, {
191
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
192
+ }));
188
193
  }
189
194
  var isNestedTable = (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes') && (0, _nesting.isSelectionTableNestedInTable)(editorView.state);
190
195
 
@@ -219,7 +224,8 @@ var ExtensionsPlaceholder = exports.ExtensionsPlaceholder = function ExtensionsP
219
224
  footer: item.footer,
220
225
  onMount: item.onMount,
221
226
  onClick: item.onClick,
222
- pulse: item.pulse
227
+ pulse: item.pulse,
228
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
223
229
  }));
224
230
  } else {
225
231
  children.push( /*#__PURE__*/_react.default.createElement(ExtensionButton, {
@@ -227,15 +233,20 @@ var ExtensionsPlaceholder = exports.ExtensionsPlaceholder = function ExtensionsP
227
233
  item: item,
228
234
  editorView: editorView,
229
235
  applyChangeToContextPanel: applyChangeToContextPanel,
230
- extensionApi: extensionApi
236
+ extensionApi: extensionApi,
237
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
231
238
  }));
232
239
  }
233
240
  if (index < extensionItems.length - 1) {
234
- children.push( /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarSeparator, null));
241
+ children.push( /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarSeparator, {
242
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
243
+ }));
235
244
  }
236
245
  });
237
246
  if (separator && ['end', 'both'].includes(separator)) {
238
- children.push( /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarSeparator, null));
247
+ children.push( /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarSeparator, {
248
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
249
+ }));
239
250
  }
240
251
 
241
252
  // eslint-disable-next-line react/no-children-prop
@@ -40,7 +40,8 @@ var ScrollButtons = exports.ScrollButtons = function ScrollButtons(_ref) {
40
40
  var intl = _ref.intl,
41
41
  scrollContainerRef = _ref.scrollContainerRef,
42
42
  node = _ref.node,
43
- disabled = _ref.disabled;
43
+ disabled = _ref.disabled,
44
+ areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled;
44
45
  var buttonsContainerRef = (0, _react.useRef)(null);
45
46
  var _useState = (0, _react.useState)(false),
46
47
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -158,7 +159,8 @@ var ScrollButtons = exports.ScrollButtons = function ScrollButtons(_ref) {
158
159
  size: "small"
159
160
  }),
160
161
  onClick: scrollLeft,
161
- disabled: !canScrollLeft || disabled
162
+ disabled: !canScrollLeft || disabled,
163
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
162
164
  }), (0, _react2.jsx)(_ui.FloatingToolbarButton, {
163
165
  title: intl.formatMessage(_floatingToolbar.messages.floatingToolbarScrollRight),
164
166
  icon: (0, _react2.jsx)(RightIcon, {
@@ -166,6 +168,7 @@ var ScrollButtons = exports.ScrollButtons = function ScrollButtons(_ref) {
166
168
  size: "small"
167
169
  }),
168
170
  onClick: scrollRight,
169
- disabled: !canScrollRight || disabled
171
+ disabled: !canScrollRight || disabled,
172
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
170
173
  })) : null;
171
174
  };
@@ -43,7 +43,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
43
43
  * @jsxRuntime classic
44
44
  * @jsx jsx
45
45
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
46
- function groupItems(items) {
46
+ function groupItems(items, areAnyNewToolbarFlagsEnabled) {
47
47
  var groupItems = items.reduce(function (accumulator, item, i) {
48
48
  var finalOutput = accumulator.finalOutput,
49
49
  buttonGroup = accumulator.buttonGroup;
@@ -65,7 +65,7 @@ function groupItems(items) {
65
65
  } else {
66
66
  finalOutput.push(item);
67
67
  }
68
- } else if (item.type === 'separator' && (0, _toolbarFlagCheck.areToolbarFlagsEnabled)()) {
68
+ } else if (item.type === 'separator' && areAnyNewToolbarFlagsEnabled) {
69
69
  var _items;
70
70
  var isLeadingSeparator = i === 0;
71
71
  var isTrailingSeparator = i === items.length - 1;
@@ -99,7 +99,7 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
99
99
  api = _ref.api,
100
100
  intl = _ref.intl;
101
101
  var emojiAndColourPickerMountPoint = scrollable ? popupsMountPoint || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.fabric-editor-popup-scroll-parent')) || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.ak-editor-content-area')) || undefined : popupsMountPoint;
102
- var isNewEditorToolbarEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)();
102
+ var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
103
103
  var renderItem = function renderItem(item, idx) {
104
104
  var _api$contextPanel, _api$extension;
105
105
  switch (item.type) {
@@ -177,7 +177,8 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
177
177
  ariaLabel: (0, _expValEquals.expValEquals)('platform_editor_floating_toolbar_button_aria_label', 'isEnabled', true) ? item === null || item === void 0 ? void 0 : item.ariaLabel : undefined,
178
178
  pulse: item.pulse,
179
179
  spotlightConfig: item.spotlightConfig,
180
- interactionName: item.interactionName
180
+ interactionName: item.interactionName,
181
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
181
182
  }, item.showTitle && item.title);
182
183
  case 'input':
183
184
  return (0, _react2.jsx)(_Input.Input, {
@@ -199,7 +200,7 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
199
200
  }
200
201
  case 'overflow-dropdown':
201
202
  return (0, _react2.jsx)(_Dropdown.default, {
202
- alignX: (0, _experiments.editorExperiment)('platform_editor_toolbar_aifc', true) ? 'right' : undefined,
203
+ alignX: areAnyNewToolbarFlagsEnabled ? 'right' : undefined,
203
204
  key: idx,
204
205
  title: intl.formatMessage(_messages.default.viewMore),
205
206
  icon: (0, _react2.jsx)(_showMoreHorizontal.default, {
@@ -221,7 +222,8 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
221
222
  setDisableParentScroll: scrollable ? setDisableScroll : undefined,
222
223
  dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && "".concat(item.id, "-dropdownList"),
223
224
  alignDropdownWithToolbar: items.length === 1,
224
- onClick: item.onClick
225
+ onClick: item.onClick,
226
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
225
227
  });
226
228
  case 'dropdown':
227
229
  var DropdownIcon = item.icon;
@@ -255,7 +257,8 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
255
257
  onMount: item.onMount,
256
258
  onClick: item.onClick,
257
259
  pulse: item.pulse,
258
- shouldFitContainer: item.shouldFitContainer
260
+ shouldFitContainer: item.shouldFitContainer,
261
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
259
262
  });
260
263
  case 'select':
261
264
  if (item.selectType === 'list') {
@@ -344,24 +347,27 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
344
347
  popupsBoundariesElement: popupsBoundariesElement,
345
348
  popupsScrollableElement: popupsScrollableElement,
346
349
  alignDropdownWithToolbar: items.length === 1,
347
- scrollable: scrollable
350
+ scrollable: scrollable,
351
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
348
352
  });
349
353
  case 'separator':
350
- if (isNewEditorToolbarEnabled) {
354
+ if (areAnyNewToolbarFlagsEnabled) {
351
355
  return item.fullHeight ? (0, _react2.jsx)(_ui.FloatingToolbarSeparator, {
352
356
  key: idx,
353
- fullHeight: true
357
+ fullHeight: true,
358
+ areAnyNewToolbarFlagsEnabled: true
354
359
  }) : null;
355
360
  }
356
361
  return (0, _react2.jsx)(_ui.FloatingToolbarSeparator, {
357
362
  key: idx,
358
- fullHeight: item.fullHeight
363
+ fullHeight: item.fullHeight,
364
+ areAnyNewToolbarFlagsEnabled: false
359
365
  });
360
366
  }
361
367
  };
362
368
  var groupedItems = groupItems(items.filter(function (item) {
363
369
  return !item.hidden;
364
- }));
370
+ }), areAnyNewToolbarFlagsEnabled);
365
371
  return (0, _react2.jsx)(_buttonGroup.default, {
366
372
  testId: "editor-floating-toolbar-items"
367
373
  }, groupedItems.map(function (element, index) {
@@ -371,7 +377,7 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
371
377
  // Ignored via go/ees005
372
378
  // eslint-disable-next-line react/no-array-index-key
373
379
  key: index,
374
- css: isNewEditorToolbarEnabled ? buttonGroupStylesNew : buttonGroupStyles,
380
+ css: areAnyNewToolbarFlagsEnabled ? buttonGroupStylesNew : buttonGroupStyles,
375
381
  role: "radiogroup",
376
382
  "aria-label": groupLabel !== null && groupLabel !== void 0 ? groupLabel : undefined,
377
383
  "data-testid": "editor-floating-toolbar-grouped-buttons"
@@ -406,7 +412,7 @@ var buttonGroupStylesNew = (0, _react2.css)({
406
412
  });
407
413
 
408
414
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
409
- var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstElementIsSelect) {
415
+ var toolbarContainer = function toolbarContainer(areAnyNewToolbarFlagsEnabled, scrollable, hasSelect, firstElementIsSelect) {
410
416
  return (0, _react2.css)({
411
417
  backgroundColor: "var(--ds-surface-overlay, white)",
412
418
  borderRadius: "var(--ds-radius-small, 3px)",
@@ -437,7 +443,7 @@ var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstEle
437
443
  overflow: 'hidden'
438
444
  }) :
439
445
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
440
- (0, _toolbarFlagCheck.areToolbarFlagsEnabled)() ?
446
+ areAnyNewToolbarFlagsEnabled ?
441
447
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
442
448
  (0, _react2.css)({
443
449
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
@@ -460,7 +466,7 @@ var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstEle
460
466
  paddingLeft: "var(--ds-space-050, 4px)"
461
467
  })),
462
468
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
463
- (0, _toolbarFlagCheck.areToolbarFlagsEnabled)() ?
469
+ areAnyNewToolbarFlagsEnabled ?
464
470
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
465
471
  (0, _react2.css)({
466
472
  minHeight: "var(--ds-space-500, 40px)"
@@ -471,7 +477,8 @@ var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstEle
471
477
  var toolbarOverflow = function toolbarOverflow(_ref2) {
472
478
  var scrollable = _ref2.scrollable,
473
479
  scrollDisabled = _ref2.scrollDisabled,
474
- firstElementIsSelect = _ref2.firstElementIsSelect;
480
+ firstElementIsSelect = _ref2.firstElementIsSelect,
481
+ areAnyNewToolbarFlagsEnabled = _ref2.areAnyNewToolbarFlagsEnabled;
475
482
  return (0, _react2.css)(
476
483
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
477
484
  scrollable ?
@@ -512,7 +519,7 @@ var toolbarOverflow = function toolbarOverflow(_ref2) {
512
519
  }
513
520
  },
514
521
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
515
- (0, _toolbarFlagCheck.areToolbarFlagsEnabled)() ?
522
+ areAnyNewToolbarFlagsEnabled ?
516
523
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
517
524
  (0, _react2.css)({
518
525
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
@@ -651,6 +658,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
651
658
  }, {
652
659
  key: "render",
653
660
  value: function render() {
661
+ var _this$props$api2;
654
662
  var _this$props2 = this.props,
655
663
  items = _this$props2.items,
656
664
  className = _this$props2.className,
@@ -658,7 +666,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
658
666
  intl = _this$props2.intl,
659
667
  scrollable = _this$props2.scrollable,
660
668
  mediaAssistiveMessage = _this$props2.mediaAssistiveMessage;
661
- var isNewEditorToolbarEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)();
669
+ var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean((_this$props$api2 = this.props.api) === null || _this$props$api2 === void 0 ? void 0 : _this$props$api2.toolbar));
662
670
  if (!items || !items.length) {
663
671
  return null;
664
672
  }
@@ -682,7 +690,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
682
690
  }, (0, _react2.jsx)("div", {
683
691
  ref: this.toolbarContainerRef,
684
692
  css: function css() {
685
- return [toolbarContainer(scrollable, hasSelect !== undefined, firstElementIsSelect)];
693
+ return [toolbarContainer(areAnyNewToolbarFlagsEnabled, scrollable, hasSelect !== undefined, firstElementIsSelect)];
686
694
  },
687
695
  "aria-label": intl.formatMessage(_floatingToolbar.messages.floatingToolbarAriaLabel),
688
696
  role: "toolbar",
@@ -690,11 +698,11 @@ var Toolbar = /*#__PURE__*/function (_Component) {
690
698
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
691
699
  ,
692
700
  className: className,
693
- onMouseDown: isNewEditorToolbarEnabled ? this.captureMouseEvent : undefined
701
+ onMouseDown: areAnyNewToolbarFlagsEnabled ? this.captureMouseEvent : undefined
694
702
  }, (0, _react2.jsx)(_ui.Announcer, {
695
703
  text: mediaAssistiveMessage ? "".concat(mediaAssistiveMessage, ", ").concat(intl.formatMessage(_floatingToolbar.messages.floatingToolbarAnnouncer)) : intl.formatMessage(_floatingToolbar.messages.floatingToolbarAnnouncer),
696
704
  delay: 250
697
- }), scrollable && isNewEditorToolbarEnabled && (0, _react2.jsx)(_ScrollButton.ScrollButton, {
705
+ }), scrollable && areAnyNewToolbarFlagsEnabled && (0, _react2.jsx)(_ScrollButton.ScrollButton, {
698
706
  intl: intl,
699
707
  scrollContainerRef: this.scrollContainerRef,
700
708
  node: node,
@@ -706,6 +714,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
706
714
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
707
715
  ,
708
716
  css: toolbarOverflow({
717
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled,
709
718
  scrollable: scrollable,
710
719
  scrollDisabled: this.state.scrollDisabled,
711
720
  firstElementIsSelect: firstElementIsSelect
@@ -717,7 +726,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
717
726
  setDisableScroll: this.setDisableScroll.bind(this),
718
727
  mountRef: this.mountRef,
719
728
  mounted: this.state.mounted
720
- }))), scrollable && (isNewEditorToolbarEnabled ? (0, _react2.jsx)(_ScrollButton.ScrollButton, {
729
+ }))), scrollable && (areAnyNewToolbarFlagsEnabled ? (0, _react2.jsx)(_ScrollButton.ScrollButton, {
721
730
  intl: intl,
722
731
  scrollContainerRef: this.scrollContainerRef,
723
732
  node: node,
@@ -727,7 +736,8 @@ var Toolbar = /*#__PURE__*/function (_Component) {
727
736
  intl: intl,
728
737
  scrollContainerRef: this.scrollContainerRef,
729
738
  node: node,
730
- disabled: this.state.scrollDisabled
739
+ disabled: this.state.scrollDisabled,
740
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
731
741
  }))), (0, _react2.jsx)("div", {
732
742
  ref: this.mountRef
733
743
  })));
@@ -236,7 +236,7 @@ export function ContentComponent({
236
236
  } = configWithNodeInfo;
237
237
 
238
238
  // When the new inline editor-toolbar is enabled, suppress floating toolbar for text selections.
239
- if (editorExperiment('platform_editor_toolbar_aifc', true)) {
239
+ if (Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar) && editorExperiment('platform_editor_toolbar_aifc', true)) {
240
240
  const selection = editorView.state.selection;
241
241
  const isCellSelection = '$anchorCell' in selection && !selection.empty;
242
242
  const isTextSelected = selection instanceof TextSelection && !selection.empty;
@@ -288,7 +288,7 @@ export function ContentComponent({
288
288
  const toolbarItemViewModeProp = 'supportsViewMode';
289
289
  items = iterableItems.filter(item => toolbarItemViewModeProp in item && !!item[toolbarItemViewModeProp]);
290
290
  }
291
- if (areToolbarFlagsEnabled()) {
291
+ if (areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))) {
292
292
  var _items2;
293
293
  // Consolidate floating toolbar items
294
294
  const toolbarItemsArray = Array.isArray(items) ? items : (_items2 = items) === null || _items2 === void 0 ? void 0 : _items2(node);
@@ -9,7 +9,6 @@ import React, { Component } from 'react';
9
9
 
10
10
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
11
11
  import { css, jsx } from '@emotion/react';
12
- import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
13
12
  import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
14
13
  import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu';
15
14
  import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
@@ -56,14 +55,16 @@ export default class Dropdown extends Component {
56
55
  const {
57
56
  showSelected,
58
57
  dispatchCommand,
59
- editorView
58
+ editorView,
59
+ areAnyNewToolbarFlagsEnabled
60
60
  } = this.props;
61
61
  return jsx(DropdownMenu, {
62
62
  hide: this.hide,
63
63
  dispatchCommand: dispatchCommand,
64
64
  items: options,
65
65
  showSelected: showSelected,
66
- editorView: editorView
66
+ editorView: editorView,
67
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
67
68
  });
68
69
  });
69
70
  _defineProperty(this, "toggleOpen", () => {
@@ -139,7 +140,8 @@ export default class Dropdown extends Component {
139
140
  pulse,
140
141
  spotlightConfig,
141
142
  shouldFitContainer,
142
- alignX
143
+ alignX,
144
+ areAnyNewToolbarFlagsEnabled
143
145
  } = this.props;
144
146
  let trigger;
145
147
  if (icon) {
@@ -155,10 +157,11 @@ export default class Dropdown extends Component {
155
157
  selected: isOpen,
156
158
  disabled: disabled,
157
159
  tooltipContent: tooltip,
158
- ariaHasPopup: areToolbarFlagsEnabled() ? true : undefined,
160
+ ariaHasPopup: areAnyNewToolbarFlagsEnabled ? true : undefined,
159
161
  onMount: onMount,
160
162
  pulse: pulse,
161
- spotlightConfig: spotlightConfig
163
+ spotlightConfig: spotlightConfig,
164
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
162
165
  });
163
166
  } else {
164
167
  trigger = jsx(Button, {
@@ -182,7 +185,8 @@ export default class Dropdown extends Component {
182
185
  areaControls: dropdownListId,
183
186
  onMount: onMount,
184
187
  pulse: pulse,
185
- spotlightConfig: spotlightConfig
188
+ spotlightConfig: spotlightConfig,
189
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
186
190
  }, title);
187
191
  }
188
192
 
@@ -10,7 +10,6 @@ import { css, jsx } from '@emotion/react';
10
10
 
11
11
  import { injectIntl } from 'react-intl-next';
12
12
  import { DropdownMenuItem, DropdownSeparator } from '@atlaskit/editor-common/floating-toolbar';
13
- import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
14
13
  import { HeadingItem } from '@atlaskit/menu';
15
14
  export const menuItemDimensions = {
16
15
  width: 175,
@@ -48,9 +47,10 @@ const Dropdown = /*#__PURE__*/memo(props => {
48
47
  items,
49
48
  intl,
50
49
  editorView,
51
- showSelected = true
50
+ showSelected = true,
51
+ areAnyNewToolbarFlagsEnabled
52
52
  } = props;
53
- if (areToolbarFlagsEnabled()) {
53
+ if (areAnyNewToolbarFlagsEnabled) {
54
54
  return jsx("div", {
55
55
  css: menuContainerStyles,
56
56
  role: "menu"
@@ -22,7 +22,8 @@ const ExtensionButton = props => {
22
22
  const {
23
23
  item,
24
24
  node,
25
- extensionApi
25
+ extensionApi,
26
+ areAnyNewToolbarFlagsEnabled
26
27
  } = props;
27
28
  const ButtonIcon = React.useMemo(() => item.icon ? Loadable({
28
29
  // Ignored via go/ees005
@@ -60,7 +61,8 @@ const ExtensionButton = props => {
60
61
  onClick: onClick,
61
62
  tooltipContent: item.tooltip,
62
63
  tooltipStyle: item.tooltipStyle,
63
- disabled: item.disabled
64
+ disabled: item.disabled,
65
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
64
66
  }, item.label);
65
67
  };
66
68
  export const ExtensionsPlaceholder = props => {
@@ -77,7 +79,8 @@ export const ExtensionsPlaceholder = props => {
77
79
  popupsMountPoint,
78
80
  popupsBoundariesElement,
79
81
  popupsScrollableElement,
80
- alignDropdownWithToolbar
82
+ alignDropdownWithToolbar,
83
+ areAnyNewToolbarFlagsEnabled
81
84
  } = props;
82
85
  // Ignored via go/ees005
83
86
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -107,7 +110,9 @@ export const ExtensionsPlaceholder = props => {
107
110
  // but count fragment as 1 child, so here we create the children manually.
108
111
  const children = [];
109
112
  if (separator && ['start', 'both'].includes(separator)) {
110
- children.push( /*#__PURE__*/React.createElement(Separator, null));
113
+ children.push( /*#__PURE__*/React.createElement(Separator, {
114
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
115
+ }));
111
116
  }
112
117
  const isNestedTable = fg('platform_editor_use_nested_table_pm_nodes') && isSelectionTableNestedInTable(editorView.state);
113
118
 
@@ -142,7 +147,8 @@ export const ExtensionsPlaceholder = props => {
142
147
  footer: item.footer,
143
148
  onMount: item.onMount,
144
149
  onClick: item.onClick,
145
- pulse: item.pulse
150
+ pulse: item.pulse,
151
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
146
152
  }));
147
153
  } else {
148
154
  children.push( /*#__PURE__*/React.createElement(ExtensionButton, {
@@ -150,15 +156,20 @@ export const ExtensionsPlaceholder = props => {
150
156
  item: item,
151
157
  editorView: editorView,
152
158
  applyChangeToContextPanel: applyChangeToContextPanel,
153
- extensionApi: extensionApi
159
+ extensionApi: extensionApi,
160
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
154
161
  }));
155
162
  }
156
163
  if (index < extensionItems.length - 1) {
157
- children.push( /*#__PURE__*/React.createElement(Separator, null));
164
+ children.push( /*#__PURE__*/React.createElement(Separator, {
165
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
166
+ }));
158
167
  }
159
168
  });
160
169
  if (separator && ['end', 'both'].includes(separator)) {
161
- children.push( /*#__PURE__*/React.createElement(Separator, null));
170
+ children.push( /*#__PURE__*/React.createElement(Separator, {
171
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
172
+ }));
162
173
  }
163
174
 
164
175
  // eslint-disable-next-line react/no-children-prop
@@ -29,7 +29,8 @@ export const ScrollButtons = ({
29
29
  intl,
30
30
  scrollContainerRef,
31
31
  node,
32
- disabled
32
+ disabled,
33
+ areAnyNewToolbarFlagsEnabled
33
34
  }) => {
34
35
  const buttonsContainerRef = useRef(null);
35
36
  const [needScroll, setNeedScroll] = useState(false);
@@ -138,7 +139,8 @@ export const ScrollButtons = ({
138
139
  size: "small"
139
140
  }),
140
141
  onClick: scrollLeft,
141
- disabled: !canScrollLeft || disabled
142
+ disabled: !canScrollLeft || disabled,
143
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
142
144
  }), jsx(Button, {
143
145
  title: intl.formatMessage(messages.floatingToolbarScrollRight),
144
146
  icon: jsx(RightIcon, {
@@ -146,6 +148,7 @@ export const ScrollButtons = ({
146
148
  size: "small"
147
149
  }),
148
150
  onClick: scrollRight,
149
- disabled: !canScrollRight || disabled
151
+ disabled: !canScrollRight || disabled,
152
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
150
153
  })) : null;
151
154
  };