@atlaskit/editor-plugin-floating-toolbar 6.0.1 → 6.1.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 +21 -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 -25
  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 -25
  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 -25
  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 +7 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @atlaskit/editor-plugin-floating-toolbar
2
2
 
3
+ ## 6.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`c0113eeccb2df`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c0113eeccb2df) -
8
+ [ux] ED-29120 add a new config option for default editor preset
9
+ (`toolbar.enableNewToolbarExperience`) which allows the new toolbar to be disabled. This is needed
10
+ for editors that can't be excluded at the experiment level.
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 6.0.2
17
+
18
+ ### Patch Changes
19
+
20
+ - [`db97eb262cc5a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/db97eb262cc5a) -
21
+ replace platform_editor_toolbar_aifc with separate experiements for jira and confluence
22
+ - Updated dependencies
23
+
3
24
  ## 6.0.1
4
25
 
5
26
  ### 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, _expValEquals.expValEquals)('platform_editor_toolbar_aifc', 'isEnabled', 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
  };
@@ -27,7 +27,6 @@ var _uiMenu = require("@atlaskit/editor-common/ui-menu");
27
27
  var _editorPalette = require("@atlaskit/editor-palette");
28
28
  var _showMoreHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/show-more-horizontal"));
29
29
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
30
- var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
31
30
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
32
31
  var _forceFocus = require("../pm-plugins/force-focus");
33
32
  var _commands = require("../pm-plugins/toolbar-data/commands");
@@ -44,7 +43,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
44
43
  * @jsxRuntime classic
45
44
  * @jsx jsx
46
45
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
47
- function groupItems(items) {
46
+ function groupItems(items, areAnyNewToolbarFlagsEnabled) {
48
47
  var groupItems = items.reduce(function (accumulator, item, i) {
49
48
  var finalOutput = accumulator.finalOutput,
50
49
  buttonGroup = accumulator.buttonGroup;
@@ -66,7 +65,7 @@ function groupItems(items) {
66
65
  } else {
67
66
  finalOutput.push(item);
68
67
  }
69
- } else if (item.type === 'separator' && (0, _toolbarFlagCheck.areToolbarFlagsEnabled)()) {
68
+ } else if (item.type === 'separator' && areAnyNewToolbarFlagsEnabled) {
70
69
  var _items;
71
70
  var isLeadingSeparator = i === 0;
72
71
  var isTrailingSeparator = i === items.length - 1;
@@ -100,7 +99,7 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
100
99
  api = _ref.api,
101
100
  intl = _ref.intl;
102
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;
103
- var isNewEditorToolbarEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)();
102
+ var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
104
103
  var renderItem = function renderItem(item, idx) {
105
104
  var _api$contextPanel, _api$extension;
106
105
  switch (item.type) {
@@ -178,7 +177,8 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
178
177
  ariaLabel: (0, _expValEquals.expValEquals)('platform_editor_floating_toolbar_button_aria_label', 'isEnabled', true) ? item === null || item === void 0 ? void 0 : item.ariaLabel : undefined,
179
178
  pulse: item.pulse,
180
179
  spotlightConfig: item.spotlightConfig,
181
- interactionName: item.interactionName
180
+ interactionName: item.interactionName,
181
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
182
182
  }, item.showTitle && item.title);
183
183
  case 'input':
184
184
  return (0, _react2.jsx)(_Input.Input, {
@@ -200,7 +200,7 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
200
200
  }
201
201
  case 'overflow-dropdown':
202
202
  return (0, _react2.jsx)(_Dropdown.default, {
203
- alignX: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_toolbar_aifc', 'isEnabled', true) ? 'right' : undefined,
203
+ alignX: areAnyNewToolbarFlagsEnabled ? 'right' : undefined,
204
204
  key: idx,
205
205
  title: intl.formatMessage(_messages.default.viewMore),
206
206
  icon: (0, _react2.jsx)(_showMoreHorizontal.default, {
@@ -222,7 +222,8 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
222
222
  setDisableParentScroll: scrollable ? setDisableScroll : undefined,
223
223
  dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && "".concat(item.id, "-dropdownList"),
224
224
  alignDropdownWithToolbar: items.length === 1,
225
- onClick: item.onClick
225
+ onClick: item.onClick,
226
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
226
227
  });
227
228
  case 'dropdown':
228
229
  var DropdownIcon = item.icon;
@@ -256,7 +257,8 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
256
257
  onMount: item.onMount,
257
258
  onClick: item.onClick,
258
259
  pulse: item.pulse,
259
- shouldFitContainer: item.shouldFitContainer
260
+ shouldFitContainer: item.shouldFitContainer,
261
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
260
262
  });
261
263
  case 'select':
262
264
  if (item.selectType === 'list') {
@@ -345,24 +347,27 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
345
347
  popupsBoundariesElement: popupsBoundariesElement,
346
348
  popupsScrollableElement: popupsScrollableElement,
347
349
  alignDropdownWithToolbar: items.length === 1,
348
- scrollable: scrollable
350
+ scrollable: scrollable,
351
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
349
352
  });
350
353
  case 'separator':
351
- if (isNewEditorToolbarEnabled) {
354
+ if (areAnyNewToolbarFlagsEnabled) {
352
355
  return item.fullHeight ? (0, _react2.jsx)(_ui.FloatingToolbarSeparator, {
353
356
  key: idx,
354
- fullHeight: true
357
+ fullHeight: true,
358
+ areAnyNewToolbarFlagsEnabled: true
355
359
  }) : null;
356
360
  }
357
361
  return (0, _react2.jsx)(_ui.FloatingToolbarSeparator, {
358
362
  key: idx,
359
- fullHeight: item.fullHeight
363
+ fullHeight: item.fullHeight,
364
+ areAnyNewToolbarFlagsEnabled: false
360
365
  });
361
366
  }
362
367
  };
363
368
  var groupedItems = groupItems(items.filter(function (item) {
364
369
  return !item.hidden;
365
- }));
370
+ }), areAnyNewToolbarFlagsEnabled);
366
371
  return (0, _react2.jsx)(_buttonGroup.default, {
367
372
  testId: "editor-floating-toolbar-items"
368
373
  }, groupedItems.map(function (element, index) {
@@ -372,7 +377,7 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
372
377
  // Ignored via go/ees005
373
378
  // eslint-disable-next-line react/no-array-index-key
374
379
  key: index,
375
- css: isNewEditorToolbarEnabled ? buttonGroupStylesNew : buttonGroupStyles,
380
+ css: areAnyNewToolbarFlagsEnabled ? buttonGroupStylesNew : buttonGroupStyles,
376
381
  role: "radiogroup",
377
382
  "aria-label": groupLabel !== null && groupLabel !== void 0 ? groupLabel : undefined,
378
383
  "data-testid": "editor-floating-toolbar-grouped-buttons"
@@ -407,7 +412,7 @@ var buttonGroupStylesNew = (0, _react2.css)({
407
412
  });
408
413
 
409
414
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
410
- var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstElementIsSelect) {
415
+ var toolbarContainer = function toolbarContainer(areAnyNewToolbarFlagsEnabled, scrollable, hasSelect, firstElementIsSelect) {
411
416
  return (0, _react2.css)({
412
417
  backgroundColor: "var(--ds-surface-overlay, white)",
413
418
  borderRadius: "var(--ds-radius-small, 3px)",
@@ -438,7 +443,7 @@ var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstEle
438
443
  overflow: 'hidden'
439
444
  }) :
440
445
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
441
- (0, _toolbarFlagCheck.areToolbarFlagsEnabled)() ?
446
+ areAnyNewToolbarFlagsEnabled ?
442
447
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
443
448
  (0, _react2.css)({
444
449
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
@@ -461,7 +466,7 @@ var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstEle
461
466
  paddingLeft: "var(--ds-space-050, 4px)"
462
467
  })),
463
468
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
464
- (0, _toolbarFlagCheck.areToolbarFlagsEnabled)() ?
469
+ areAnyNewToolbarFlagsEnabled ?
465
470
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
466
471
  (0, _react2.css)({
467
472
  minHeight: "var(--ds-space-500, 40px)"
@@ -472,7 +477,8 @@ var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstEle
472
477
  var toolbarOverflow = function toolbarOverflow(_ref2) {
473
478
  var scrollable = _ref2.scrollable,
474
479
  scrollDisabled = _ref2.scrollDisabled,
475
- firstElementIsSelect = _ref2.firstElementIsSelect;
480
+ firstElementIsSelect = _ref2.firstElementIsSelect,
481
+ areAnyNewToolbarFlagsEnabled = _ref2.areAnyNewToolbarFlagsEnabled;
476
482
  return (0, _react2.css)(
477
483
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
478
484
  scrollable ?
@@ -513,7 +519,7 @@ var toolbarOverflow = function toolbarOverflow(_ref2) {
513
519
  }
514
520
  },
515
521
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
516
- (0, _toolbarFlagCheck.areToolbarFlagsEnabled)() ?
522
+ areAnyNewToolbarFlagsEnabled ?
517
523
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
518
524
  (0, _react2.css)({
519
525
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
@@ -652,6 +658,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
652
658
  }, {
653
659
  key: "render",
654
660
  value: function render() {
661
+ var _this$props$api2;
655
662
  var _this$props2 = this.props,
656
663
  items = _this$props2.items,
657
664
  className = _this$props2.className,
@@ -659,7 +666,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
659
666
  intl = _this$props2.intl,
660
667
  scrollable = _this$props2.scrollable,
661
668
  mediaAssistiveMessage = _this$props2.mediaAssistiveMessage;
662
- 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));
663
670
  if (!items || !items.length) {
664
671
  return null;
665
672
  }
@@ -683,7 +690,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
683
690
  }, (0, _react2.jsx)("div", {
684
691
  ref: this.toolbarContainerRef,
685
692
  css: function css() {
686
- return [toolbarContainer(scrollable, hasSelect !== undefined, firstElementIsSelect)];
693
+ return [toolbarContainer(areAnyNewToolbarFlagsEnabled, scrollable, hasSelect !== undefined, firstElementIsSelect)];
687
694
  },
688
695
  "aria-label": intl.formatMessage(_floatingToolbar.messages.floatingToolbarAriaLabel),
689
696
  role: "toolbar",
@@ -691,11 +698,11 @@ var Toolbar = /*#__PURE__*/function (_Component) {
691
698
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
692
699
  ,
693
700
  className: className,
694
- onMouseDown: isNewEditorToolbarEnabled ? this.captureMouseEvent : undefined
701
+ onMouseDown: areAnyNewToolbarFlagsEnabled ? this.captureMouseEvent : undefined
695
702
  }, (0, _react2.jsx)(_ui.Announcer, {
696
703
  text: mediaAssistiveMessage ? "".concat(mediaAssistiveMessage, ", ").concat(intl.formatMessage(_floatingToolbar.messages.floatingToolbarAnnouncer)) : intl.formatMessage(_floatingToolbar.messages.floatingToolbarAnnouncer),
697
704
  delay: 250
698
- }), scrollable && isNewEditorToolbarEnabled && (0, _react2.jsx)(_ScrollButton.ScrollButton, {
705
+ }), scrollable && areAnyNewToolbarFlagsEnabled && (0, _react2.jsx)(_ScrollButton.ScrollButton, {
699
706
  intl: intl,
700
707
  scrollContainerRef: this.scrollContainerRef,
701
708
  node: node,
@@ -707,6 +714,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
707
714
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
708
715
  ,
709
716
  css: toolbarOverflow({
717
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled,
710
718
  scrollable: scrollable,
711
719
  scrollDisabled: this.state.scrollDisabled,
712
720
  firstElementIsSelect: firstElementIsSelect
@@ -718,7 +726,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
718
726
  setDisableScroll: this.setDisableScroll.bind(this),
719
727
  mountRef: this.mountRef,
720
728
  mounted: this.state.mounted
721
- }))), scrollable && (isNewEditorToolbarEnabled ? (0, _react2.jsx)(_ScrollButton.ScrollButton, {
729
+ }))), scrollable && (areAnyNewToolbarFlagsEnabled ? (0, _react2.jsx)(_ScrollButton.ScrollButton, {
722
730
  intl: intl,
723
731
  scrollContainerRef: this.scrollContainerRef,
724
732
  node: node,
@@ -728,7 +736,8 @@ var Toolbar = /*#__PURE__*/function (_Component) {
728
736
  intl: intl,
729
737
  scrollContainerRef: this.scrollContainerRef,
730
738
  node: node,
731
- disabled: this.state.scrollDisabled
739
+ disabled: this.state.scrollDisabled,
740
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
732
741
  }))), (0, _react2.jsx)("div", {
733
742
  ref: this.mountRef
734
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 (expValEquals('platform_editor_toolbar_aifc', 'isEnabled', 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
  };