@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.
- package/CHANGELOG.md +21 -0
- package/dist/cjs/floatingToolbarPlugin.js +2 -2
- package/dist/cjs/ui/Dropdown.js +11 -7
- package/dist/cjs/ui/DropdownMenu.js +3 -3
- package/dist/cjs/ui/ExtensionsPlaceholder.js +19 -8
- package/dist/cjs/ui/ScrollButtons.js +6 -3
- package/dist/cjs/ui/Toolbar.js +34 -25
- package/dist/es2019/floatingToolbarPlugin.js +2 -2
- package/dist/es2019/ui/Dropdown.js +11 -7
- package/dist/es2019/ui/DropdownMenu.js +3 -3
- package/dist/es2019/ui/ExtensionsPlaceholder.js +19 -8
- package/dist/es2019/ui/ScrollButtons.js +6 -3
- package/dist/es2019/ui/Toolbar.js +34 -25
- package/dist/esm/floatingToolbarPlugin.js +2 -2
- package/dist/esm/ui/Dropdown.js +11 -7
- package/dist/esm/ui/DropdownMenu.js +3 -3
- package/dist/esm/ui/ExtensionsPlaceholder.js +19 -8
- package/dist/esm/ui/ScrollButtons.js +6 -3
- package/dist/esm/ui/Toolbar.js +34 -25
- package/dist/types/floatingToolbarPluginType.d.ts +3 -1
- package/dist/types/ui/Dropdown.d.ts +1 -0
- package/dist/types/ui/DropdownMenu.d.ts +1 -0
- package/dist/types/ui/ExtensionsPlaceholder.d.ts +1 -0
- package/dist/types/ui/ScrollButtons.d.ts +2 -1
- package/dist/types/ui/Toolbar.d.ts +1 -1
- package/dist/types-ts4.5/floatingToolbarPluginType.d.ts +3 -1
- package/dist/types-ts4.5/ui/Dropdown.d.ts +1 -0
- package/dist/types-ts4.5/ui/DropdownMenu.d.ts +1 -0
- package/dist/types-ts4.5/ui/ExtensionsPlaceholder.d.ts +1 -0
- package/dist/types-ts4.5/ui/ScrollButtons.d.ts +2 -1
- package/dist/types-ts4.5/ui/Toolbar.d.ts +1 -1
- package/package.json +7 -7
|
@@ -20,7 +20,6 @@ import { ColorPickerButton, ToolbarArrowKeyNavigationProvider } from '@atlaskit/
|
|
|
20
20
|
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
21
21
|
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
22
22
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
23
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
24
23
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
25
24
|
import { checkShouldForceFocusAndApply, forceFocusSelector } from '../pm-plugins/force-focus';
|
|
26
25
|
import { showConfirmDialog } from '../pm-plugins/toolbar-data/commands';
|
|
@@ -31,7 +30,7 @@ import { Input } from './Input';
|
|
|
31
30
|
import { ScrollButton } from './ScrollButton';
|
|
32
31
|
import { ScrollButtons } from './ScrollButtons';
|
|
33
32
|
import Select from './Select';
|
|
34
|
-
export function groupItems(items) {
|
|
33
|
+
export function groupItems(items, areAnyNewToolbarFlagsEnabled) {
|
|
35
34
|
const groupItems = items.reduce((accumulator, item, i) => {
|
|
36
35
|
const {
|
|
37
36
|
finalOutput,
|
|
@@ -55,7 +54,7 @@ export function groupItems(items) {
|
|
|
55
54
|
} else {
|
|
56
55
|
finalOutput.push(item);
|
|
57
56
|
}
|
|
58
|
-
} else if (item.type === 'separator' &&
|
|
57
|
+
} else if (item.type === 'separator' && areAnyNewToolbarFlagsEnabled) {
|
|
59
58
|
var _items;
|
|
60
59
|
const isLeadingSeparator = i === 0;
|
|
61
60
|
const isTrailingSeparator = i === items.length - 1;
|
|
@@ -90,7 +89,7 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
90
89
|
intl
|
|
91
90
|
}) => {
|
|
92
91
|
const 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;
|
|
93
|
-
const
|
|
92
|
+
const areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
94
93
|
const renderItem = (item, idx) => {
|
|
95
94
|
var _api$contextPanel, _api$extension;
|
|
96
95
|
switch (item.type) {
|
|
@@ -160,7 +159,8 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
160
159
|
ariaLabel: expValEquals('platform_editor_floating_toolbar_button_aria_label', 'isEnabled', true) ? item === null || item === void 0 ? void 0 : item.ariaLabel : undefined,
|
|
161
160
|
pulse: item.pulse,
|
|
162
161
|
spotlightConfig: item.spotlightConfig,
|
|
163
|
-
interactionName: item.interactionName
|
|
162
|
+
interactionName: item.interactionName,
|
|
163
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
164
164
|
}, item.showTitle && item.title);
|
|
165
165
|
case 'input':
|
|
166
166
|
return jsx(Input, {
|
|
@@ -178,7 +178,7 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
178
178
|
}
|
|
179
179
|
case 'overflow-dropdown':
|
|
180
180
|
return jsx(Dropdown, {
|
|
181
|
-
alignX:
|
|
181
|
+
alignX: areAnyNewToolbarFlagsEnabled ? 'right' : undefined,
|
|
182
182
|
key: idx,
|
|
183
183
|
title: intl.formatMessage(commonMessages.viewMore),
|
|
184
184
|
icon: jsx(ShowMoreHorizontalIcon, {
|
|
@@ -200,7 +200,8 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
200
200
|
setDisableParentScroll: scrollable ? setDisableScroll : undefined,
|
|
201
201
|
dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && `${item.id}-dropdownList`,
|
|
202
202
|
alignDropdownWithToolbar: items.length === 1,
|
|
203
|
-
onClick: item.onClick
|
|
203
|
+
onClick: item.onClick,
|
|
204
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
204
205
|
});
|
|
205
206
|
case 'dropdown':
|
|
206
207
|
const DropdownIcon = item.icon;
|
|
@@ -234,7 +235,8 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
234
235
|
onMount: item.onMount,
|
|
235
236
|
onClick: item.onClick,
|
|
236
237
|
pulse: item.pulse,
|
|
237
|
-
shouldFitContainer: item.shouldFitContainer
|
|
238
|
+
shouldFitContainer: item.shouldFitContainer,
|
|
239
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
238
240
|
});
|
|
239
241
|
case 'select':
|
|
240
242
|
if (item.selectType === 'list') {
|
|
@@ -319,22 +321,25 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
319
321
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
320
322
|
popupsScrollableElement: popupsScrollableElement,
|
|
321
323
|
alignDropdownWithToolbar: items.length === 1,
|
|
322
|
-
scrollable: scrollable
|
|
324
|
+
scrollable: scrollable,
|
|
325
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
323
326
|
});
|
|
324
327
|
case 'separator':
|
|
325
|
-
if (
|
|
328
|
+
if (areAnyNewToolbarFlagsEnabled) {
|
|
326
329
|
return item.fullHeight ? jsx(Separator, {
|
|
327
330
|
key: idx,
|
|
328
|
-
fullHeight: true
|
|
331
|
+
fullHeight: true,
|
|
332
|
+
areAnyNewToolbarFlagsEnabled: true
|
|
329
333
|
}) : null;
|
|
330
334
|
}
|
|
331
335
|
return jsx(Separator, {
|
|
332
336
|
key: idx,
|
|
333
|
-
fullHeight: item.fullHeight
|
|
337
|
+
fullHeight: item.fullHeight,
|
|
338
|
+
areAnyNewToolbarFlagsEnabled: false
|
|
334
339
|
});
|
|
335
340
|
}
|
|
336
341
|
};
|
|
337
|
-
const groupedItems = groupItems(items.filter(item => !item.hidden));
|
|
342
|
+
const groupedItems = groupItems(items.filter(item => !item.hidden), areAnyNewToolbarFlagsEnabled);
|
|
338
343
|
return jsx(ButtonGroup, {
|
|
339
344
|
testId: "editor-floating-toolbar-items"
|
|
340
345
|
}, groupedItems.map((element, index) => {
|
|
@@ -344,7 +349,7 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
344
349
|
// Ignored via go/ees005
|
|
345
350
|
// eslint-disable-next-line react/no-array-index-key
|
|
346
351
|
key: index,
|
|
347
|
-
css:
|
|
352
|
+
css: areAnyNewToolbarFlagsEnabled ? buttonGroupStylesNew : buttonGroupStyles,
|
|
348
353
|
role: "radiogroup",
|
|
349
354
|
"aria-label": groupLabel !== null && groupLabel !== void 0 ? groupLabel : undefined,
|
|
350
355
|
"data-testid": "editor-floating-toolbar-grouped-buttons"
|
|
@@ -375,7 +380,7 @@ const buttonGroupStylesNew = css({
|
|
|
375
380
|
});
|
|
376
381
|
|
|
377
382
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
378
|
-
const toolbarContainer = (scrollable, hasSelect, firstElementIsSelect) => css({
|
|
383
|
+
const toolbarContainer = (areAnyNewToolbarFlagsEnabled, scrollable, hasSelect, firstElementIsSelect) => css({
|
|
379
384
|
backgroundColor: "var(--ds-surface-overlay, white)",
|
|
380
385
|
borderRadius: "var(--ds-radius-small, 3px)",
|
|
381
386
|
boxShadow: `var(--ds-shadow-overlay, ${`0 0 1px rgba(9, 30, 66, 0.31), 0 4px 8px -2px rgba(9, 30, 66, 0.25)`})`,
|
|
@@ -405,7 +410,7 @@ css({
|
|
|
405
410
|
overflow: 'hidden'
|
|
406
411
|
}) :
|
|
407
412
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
408
|
-
|
|
413
|
+
areAnyNewToolbarFlagsEnabled ?
|
|
409
414
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
410
415
|
css({
|
|
411
416
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
@@ -428,7 +433,7 @@ css({
|
|
|
428
433
|
paddingLeft: "var(--ds-space-050, 4px)"
|
|
429
434
|
})),
|
|
430
435
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
431
|
-
|
|
436
|
+
areAnyNewToolbarFlagsEnabled ?
|
|
432
437
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
433
438
|
css({
|
|
434
439
|
minHeight: "var(--ds-space-500, 40px)"
|
|
@@ -438,7 +443,8 @@ css({
|
|
|
438
443
|
const toolbarOverflow = ({
|
|
439
444
|
scrollable,
|
|
440
445
|
scrollDisabled,
|
|
441
|
-
firstElementIsSelect
|
|
446
|
+
firstElementIsSelect,
|
|
447
|
+
areAnyNewToolbarFlagsEnabled
|
|
442
448
|
}) => css(
|
|
443
449
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
444
450
|
scrollable ?
|
|
@@ -479,7 +485,7 @@ css({
|
|
|
479
485
|
}
|
|
480
486
|
},
|
|
481
487
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
482
|
-
|
|
488
|
+
areAnyNewToolbarFlagsEnabled ?
|
|
483
489
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
484
490
|
css({
|
|
485
491
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
@@ -605,6 +611,7 @@ class Toolbar extends Component {
|
|
|
605
611
|
this.resetStyling();
|
|
606
612
|
}
|
|
607
613
|
render() {
|
|
614
|
+
var _this$props$api2;
|
|
608
615
|
const {
|
|
609
616
|
items,
|
|
610
617
|
className,
|
|
@@ -613,7 +620,7 @@ class Toolbar extends Component {
|
|
|
613
620
|
scrollable,
|
|
614
621
|
mediaAssistiveMessage
|
|
615
622
|
} = this.props;
|
|
616
|
-
const
|
|
623
|
+
const areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean((_this$props$api2 = this.props.api) === null || _this$props$api2 === void 0 ? void 0 : _this$props$api2.toolbar));
|
|
617
624
|
if (!items || !items.length) {
|
|
618
625
|
return null;
|
|
619
626
|
}
|
|
@@ -634,18 +641,18 @@ class Toolbar extends Component {
|
|
|
634
641
|
intl: intl
|
|
635
642
|
}, jsx("div", {
|
|
636
643
|
ref: this.toolbarContainerRef,
|
|
637
|
-
css: () => [toolbarContainer(scrollable, hasSelect !== undefined, firstElementIsSelect)],
|
|
644
|
+
css: () => [toolbarContainer(areAnyNewToolbarFlagsEnabled, scrollable, hasSelect !== undefined, firstElementIsSelect)],
|
|
638
645
|
"aria-label": intl.formatMessage(messages.floatingToolbarAriaLabel),
|
|
639
646
|
role: "toolbar",
|
|
640
647
|
"data-testid": "editor-floating-toolbar"
|
|
641
648
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
642
649
|
,
|
|
643
650
|
className: className,
|
|
644
|
-
onMouseDown:
|
|
651
|
+
onMouseDown: areAnyNewToolbarFlagsEnabled ? this.captureMouseEvent : undefined
|
|
645
652
|
}, jsx(Announcer, {
|
|
646
653
|
text: mediaAssistiveMessage ? `${mediaAssistiveMessage}, ${intl.formatMessage(messages.floatingToolbarAnnouncer)}` : intl.formatMessage(messages.floatingToolbarAnnouncer),
|
|
647
654
|
delay: 250
|
|
648
|
-
}), scrollable &&
|
|
655
|
+
}), scrollable && areAnyNewToolbarFlagsEnabled && jsx(ScrollButton, {
|
|
649
656
|
intl: intl,
|
|
650
657
|
scrollContainerRef: this.scrollContainerRef,
|
|
651
658
|
node: node,
|
|
@@ -657,6 +664,7 @@ class Toolbar extends Component {
|
|
|
657
664
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
658
665
|
,
|
|
659
666
|
css: toolbarOverflow({
|
|
667
|
+
areAnyNewToolbarFlagsEnabled,
|
|
660
668
|
scrollable,
|
|
661
669
|
scrollDisabled: this.state.scrollDisabled,
|
|
662
670
|
firstElementIsSelect
|
|
@@ -668,7 +676,7 @@ class Toolbar extends Component {
|
|
|
668
676
|
setDisableScroll: this.setDisableScroll.bind(this),
|
|
669
677
|
mountRef: this.mountRef,
|
|
670
678
|
mounted: this.state.mounted
|
|
671
|
-
}))), scrollable && (
|
|
679
|
+
}))), scrollable && (areAnyNewToolbarFlagsEnabled ? jsx(ScrollButton, {
|
|
672
680
|
intl: intl,
|
|
673
681
|
scrollContainerRef: this.scrollContainerRef,
|
|
674
682
|
node: node,
|
|
@@ -678,7 +686,8 @@ class Toolbar extends Component {
|
|
|
678
686
|
intl: intl,
|
|
679
687
|
scrollContainerRef: this.scrollContainerRef,
|
|
680
688
|
node: node,
|
|
681
|
-
disabled: this.state.scrollDisabled
|
|
689
|
+
disabled: this.state.scrollDisabled,
|
|
690
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
682
691
|
}))), jsx("div", {
|
|
683
692
|
ref: this.mountRef
|
|
684
693
|
})));
|
|
@@ -235,7 +235,7 @@ export function ContentComponent(_ref5) {
|
|
|
235
235
|
node = configWithNodeInfo.node;
|
|
236
236
|
|
|
237
237
|
// When the new inline editor-toolbar is enabled, suppress floating toolbar for text selections.
|
|
238
|
-
if (
|
|
238
|
+
if (Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar) && editorExperiment('platform_editor_toolbar_aifc', true)) {
|
|
239
239
|
var selection = editorView.state.selection;
|
|
240
240
|
var isCellSelection = '$anchorCell' in selection && !selection.empty;
|
|
241
241
|
var isTextSelected = selection instanceof TextSelection && !selection.empty;
|
|
@@ -290,7 +290,7 @@ export function ContentComponent(_ref5) {
|
|
|
290
290
|
return toolbarItemViewModeProp in item && !!item[toolbarItemViewModeProp];
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
|
-
if (areToolbarFlagsEnabled()) {
|
|
293
|
+
if (areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))) {
|
|
294
294
|
var _items2;
|
|
295
295
|
// Consolidate floating toolbar items
|
|
296
296
|
var toolbarItemsArray = Array.isArray(items) ? items : (_items2 = items) === null || _items2 === void 0 ? void 0 : _items2(node);
|
package/dist/esm/ui/Dropdown.js
CHANGED
|
@@ -18,7 +18,6 @@ import React, { Component } from 'react';
|
|
|
18
18
|
|
|
19
19
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
20
20
|
import { css, jsx } from '@emotion/react';
|
|
21
|
-
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
22
21
|
import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
23
22
|
import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu';
|
|
24
23
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
@@ -71,13 +70,15 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
71
70
|
var _this$props = _this.props,
|
|
72
71
|
showSelected = _this$props.showSelected,
|
|
73
72
|
dispatchCommand = _this$props.dispatchCommand,
|
|
74
|
-
editorView = _this$props.editorView
|
|
73
|
+
editorView = _this$props.editorView,
|
|
74
|
+
areAnyNewToolbarFlagsEnabled = _this$props.areAnyNewToolbarFlagsEnabled;
|
|
75
75
|
return jsx(DropdownMenu, {
|
|
76
76
|
hide: _this.hide,
|
|
77
77
|
dispatchCommand: dispatchCommand,
|
|
78
78
|
items: options,
|
|
79
79
|
showSelected: showSelected,
|
|
80
|
-
editorView: editorView
|
|
80
|
+
editorView: editorView,
|
|
81
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
81
82
|
});
|
|
82
83
|
});
|
|
83
84
|
_defineProperty(_this, "toggleOpen", function () {
|
|
@@ -154,7 +155,8 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
154
155
|
pulse = _this$props2.pulse,
|
|
155
156
|
spotlightConfig = _this$props2.spotlightConfig,
|
|
156
157
|
shouldFitContainer = _this$props2.shouldFitContainer,
|
|
157
|
-
alignX = _this$props2.alignX
|
|
158
|
+
alignX = _this$props2.alignX,
|
|
159
|
+
areAnyNewToolbarFlagsEnabled = _this$props2.areAnyNewToolbarFlagsEnabled;
|
|
158
160
|
var trigger;
|
|
159
161
|
if (icon) {
|
|
160
162
|
var TriggerIcon = hideExpandIcon ? icon : jsx(CompositeIcon, {
|
|
@@ -169,10 +171,11 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
169
171
|
selected: isOpen,
|
|
170
172
|
disabled: disabled,
|
|
171
173
|
tooltipContent: tooltip,
|
|
172
|
-
ariaHasPopup:
|
|
174
|
+
ariaHasPopup: areAnyNewToolbarFlagsEnabled ? true : undefined,
|
|
173
175
|
onMount: onMount,
|
|
174
176
|
pulse: pulse,
|
|
175
|
-
spotlightConfig: spotlightConfig
|
|
177
|
+
spotlightConfig: spotlightConfig,
|
|
178
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
176
179
|
});
|
|
177
180
|
} else {
|
|
178
181
|
trigger = jsx(Button, {
|
|
@@ -196,7 +199,8 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
196
199
|
areaControls: dropdownListId,
|
|
197
200
|
onMount: onMount,
|
|
198
201
|
pulse: pulse,
|
|
199
|
-
spotlightConfig: spotlightConfig
|
|
202
|
+
spotlightConfig: spotlightConfig,
|
|
203
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
200
204
|
}, title);
|
|
201
205
|
}
|
|
202
206
|
|
|
@@ -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 var menuItemDimensions = {
|
|
16
15
|
width: 175,
|
|
@@ -48,8 +47,9 @@ var Dropdown = /*#__PURE__*/memo(function (props) {
|
|
|
48
47
|
intl = props.intl,
|
|
49
48
|
editorView = props.editorView,
|
|
50
49
|
_props$showSelected = props.showSelected,
|
|
51
|
-
showSelected = _props$showSelected === void 0 ? true : _props$showSelected
|
|
52
|
-
|
|
50
|
+
showSelected = _props$showSelected === void 0 ? true : _props$showSelected,
|
|
51
|
+
areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
|
|
52
|
+
if (areAnyNewToolbarFlagsEnabled) {
|
|
53
53
|
return jsx("div", {
|
|
54
54
|
css: menuContainerStyles,
|
|
55
55
|
role: "menu"
|
|
@@ -46,7 +46,8 @@ var resolveExtensionIcon = /*#__PURE__*/function () {
|
|
|
46
46
|
var ExtensionButton = function ExtensionButton(props) {
|
|
47
47
|
var item = props.item,
|
|
48
48
|
node = props.node,
|
|
49
|
-
extensionApi = props.extensionApi
|
|
49
|
+
extensionApi = props.extensionApi,
|
|
50
|
+
areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
|
|
50
51
|
var ButtonIcon = React.useMemo(function () {
|
|
51
52
|
return item.icon ? Loadable({
|
|
52
53
|
// Ignored via go/ees005
|
|
@@ -101,7 +102,8 @@ var ExtensionButton = function ExtensionButton(props) {
|
|
|
101
102
|
onClick: onClick,
|
|
102
103
|
tooltipContent: item.tooltip,
|
|
103
104
|
tooltipStyle: item.tooltipStyle,
|
|
104
|
-
disabled: item.disabled
|
|
105
|
+
disabled: item.disabled,
|
|
106
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
105
107
|
}, item.label);
|
|
106
108
|
};
|
|
107
109
|
export var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
|
|
@@ -117,7 +119,8 @@ export var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
|
|
|
117
119
|
popupsMountPoint = props.popupsMountPoint,
|
|
118
120
|
popupsBoundariesElement = props.popupsBoundariesElement,
|
|
119
121
|
popupsScrollableElement = props.popupsScrollableElement,
|
|
120
|
-
alignDropdownWithToolbar = props.alignDropdownWithToolbar
|
|
122
|
+
alignDropdownWithToolbar = props.alignDropdownWithToolbar,
|
|
123
|
+
areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
|
|
121
124
|
// Ignored via go/ees005
|
|
122
125
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
123
126
|
var _useState = useState([]),
|
|
@@ -175,7 +178,9 @@ export var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
|
|
|
175
178
|
// but count fragment as 1 child, so here we create the children manually.
|
|
176
179
|
var children = [];
|
|
177
180
|
if (separator && ['start', 'both'].includes(separator)) {
|
|
178
|
-
children.push( /*#__PURE__*/React.createElement(Separator,
|
|
181
|
+
children.push( /*#__PURE__*/React.createElement(Separator, {
|
|
182
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
183
|
+
}));
|
|
179
184
|
}
|
|
180
185
|
var isNestedTable = fg('platform_editor_use_nested_table_pm_nodes') && isSelectionTableNestedInTable(editorView.state);
|
|
181
186
|
|
|
@@ -210,7 +215,8 @@ export var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
|
|
|
210
215
|
footer: item.footer,
|
|
211
216
|
onMount: item.onMount,
|
|
212
217
|
onClick: item.onClick,
|
|
213
|
-
pulse: item.pulse
|
|
218
|
+
pulse: item.pulse,
|
|
219
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
214
220
|
}));
|
|
215
221
|
} else {
|
|
216
222
|
children.push( /*#__PURE__*/React.createElement(ExtensionButton, {
|
|
@@ -218,15 +224,20 @@ export var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
|
|
|
218
224
|
item: item,
|
|
219
225
|
editorView: editorView,
|
|
220
226
|
applyChangeToContextPanel: applyChangeToContextPanel,
|
|
221
|
-
extensionApi: extensionApi
|
|
227
|
+
extensionApi: extensionApi,
|
|
228
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
222
229
|
}));
|
|
223
230
|
}
|
|
224
231
|
if (index < extensionItems.length - 1) {
|
|
225
|
-
children.push( /*#__PURE__*/React.createElement(Separator,
|
|
232
|
+
children.push( /*#__PURE__*/React.createElement(Separator, {
|
|
233
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
234
|
+
}));
|
|
226
235
|
}
|
|
227
236
|
});
|
|
228
237
|
if (separator && ['end', 'both'].includes(separator)) {
|
|
229
|
-
children.push( /*#__PURE__*/React.createElement(Separator,
|
|
238
|
+
children.push( /*#__PURE__*/React.createElement(Separator, {
|
|
239
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
240
|
+
}));
|
|
230
241
|
}
|
|
231
242
|
|
|
232
243
|
// eslint-disable-next-line react/no-children-prop
|
|
@@ -30,7 +30,8 @@ export var ScrollButtons = function ScrollButtons(_ref) {
|
|
|
30
30
|
var intl = _ref.intl,
|
|
31
31
|
scrollContainerRef = _ref.scrollContainerRef,
|
|
32
32
|
node = _ref.node,
|
|
33
|
-
disabled = _ref.disabled
|
|
33
|
+
disabled = _ref.disabled,
|
|
34
|
+
areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled;
|
|
34
35
|
var buttonsContainerRef = useRef(null);
|
|
35
36
|
var _useState = useState(false),
|
|
36
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -148,7 +149,8 @@ export var ScrollButtons = function ScrollButtons(_ref) {
|
|
|
148
149
|
size: "small"
|
|
149
150
|
}),
|
|
150
151
|
onClick: scrollLeft,
|
|
151
|
-
disabled: !canScrollLeft || disabled
|
|
152
|
+
disabled: !canScrollLeft || disabled,
|
|
153
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
152
154
|
}), jsx(Button, {
|
|
153
155
|
title: intl.formatMessage(messages.floatingToolbarScrollRight),
|
|
154
156
|
icon: jsx(RightIcon, {
|
|
@@ -156,6 +158,7 @@ export var ScrollButtons = function ScrollButtons(_ref) {
|
|
|
156
158
|
size: "small"
|
|
157
159
|
}),
|
|
158
160
|
onClick: scrollRight,
|
|
159
|
-
disabled: !canScrollRight || disabled
|
|
161
|
+
disabled: !canScrollRight || disabled,
|
|
162
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
160
163
|
})) : null;
|
|
161
164
|
};
|
package/dist/esm/ui/Toolbar.js
CHANGED
|
@@ -27,7 +27,6 @@ import { ColorPickerButton, ToolbarArrowKeyNavigationProvider } from '@atlaskit/
|
|
|
27
27
|
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
28
28
|
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
29
29
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
30
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
31
30
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
32
31
|
import { checkShouldForceFocusAndApply, forceFocusSelector } from '../pm-plugins/force-focus';
|
|
33
32
|
import { showConfirmDialog } from '../pm-plugins/toolbar-data/commands';
|
|
@@ -38,7 +37,7 @@ import { Input } from './Input';
|
|
|
38
37
|
import { ScrollButton } from './ScrollButton';
|
|
39
38
|
import { ScrollButtons } from './ScrollButtons';
|
|
40
39
|
import Select from './Select';
|
|
41
|
-
export function groupItems(items) {
|
|
40
|
+
export function groupItems(items, areAnyNewToolbarFlagsEnabled) {
|
|
42
41
|
var groupItems = items.reduce(function (accumulator, item, i) {
|
|
43
42
|
var finalOutput = accumulator.finalOutput,
|
|
44
43
|
buttonGroup = accumulator.buttonGroup;
|
|
@@ -60,7 +59,7 @@ export function groupItems(items) {
|
|
|
60
59
|
} else {
|
|
61
60
|
finalOutput.push(item);
|
|
62
61
|
}
|
|
63
|
-
} else if (item.type === 'separator' &&
|
|
62
|
+
} else if (item.type === 'separator' && areAnyNewToolbarFlagsEnabled) {
|
|
64
63
|
var _items;
|
|
65
64
|
var isLeadingSeparator = i === 0;
|
|
66
65
|
var isTrailingSeparator = i === items.length - 1;
|
|
@@ -94,7 +93,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
94
93
|
api = _ref.api,
|
|
95
94
|
intl = _ref.intl;
|
|
96
95
|
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;
|
|
97
|
-
var
|
|
96
|
+
var areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
98
97
|
var renderItem = function renderItem(item, idx) {
|
|
99
98
|
var _api$contextPanel, _api$extension;
|
|
100
99
|
switch (item.type) {
|
|
@@ -172,7 +171,8 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
172
171
|
ariaLabel: expValEquals('platform_editor_floating_toolbar_button_aria_label', 'isEnabled', true) ? item === null || item === void 0 ? void 0 : item.ariaLabel : undefined,
|
|
173
172
|
pulse: item.pulse,
|
|
174
173
|
spotlightConfig: item.spotlightConfig,
|
|
175
|
-
interactionName: item.interactionName
|
|
174
|
+
interactionName: item.interactionName,
|
|
175
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
176
176
|
}, item.showTitle && item.title);
|
|
177
177
|
case 'input':
|
|
178
178
|
return jsx(Input, {
|
|
@@ -194,7 +194,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
194
194
|
}
|
|
195
195
|
case 'overflow-dropdown':
|
|
196
196
|
return jsx(Dropdown, {
|
|
197
|
-
alignX:
|
|
197
|
+
alignX: areAnyNewToolbarFlagsEnabled ? 'right' : undefined,
|
|
198
198
|
key: idx,
|
|
199
199
|
title: intl.formatMessage(commonMessages.viewMore),
|
|
200
200
|
icon: jsx(ShowMoreHorizontalIcon, {
|
|
@@ -216,7 +216,8 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
216
216
|
setDisableParentScroll: scrollable ? setDisableScroll : undefined,
|
|
217
217
|
dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && "".concat(item.id, "-dropdownList"),
|
|
218
218
|
alignDropdownWithToolbar: items.length === 1,
|
|
219
|
-
onClick: item.onClick
|
|
219
|
+
onClick: item.onClick,
|
|
220
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
220
221
|
});
|
|
221
222
|
case 'dropdown':
|
|
222
223
|
var DropdownIcon = item.icon;
|
|
@@ -250,7 +251,8 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
250
251
|
onMount: item.onMount,
|
|
251
252
|
onClick: item.onClick,
|
|
252
253
|
pulse: item.pulse,
|
|
253
|
-
shouldFitContainer: item.shouldFitContainer
|
|
254
|
+
shouldFitContainer: item.shouldFitContainer,
|
|
255
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
254
256
|
});
|
|
255
257
|
case 'select':
|
|
256
258
|
if (item.selectType === 'list') {
|
|
@@ -339,24 +341,27 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
339
341
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
340
342
|
popupsScrollableElement: popupsScrollableElement,
|
|
341
343
|
alignDropdownWithToolbar: items.length === 1,
|
|
342
|
-
scrollable: scrollable
|
|
344
|
+
scrollable: scrollable,
|
|
345
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
343
346
|
});
|
|
344
347
|
case 'separator':
|
|
345
|
-
if (
|
|
348
|
+
if (areAnyNewToolbarFlagsEnabled) {
|
|
346
349
|
return item.fullHeight ? jsx(Separator, {
|
|
347
350
|
key: idx,
|
|
348
|
-
fullHeight: true
|
|
351
|
+
fullHeight: true,
|
|
352
|
+
areAnyNewToolbarFlagsEnabled: true
|
|
349
353
|
}) : null;
|
|
350
354
|
}
|
|
351
355
|
return jsx(Separator, {
|
|
352
356
|
key: idx,
|
|
353
|
-
fullHeight: item.fullHeight
|
|
357
|
+
fullHeight: item.fullHeight,
|
|
358
|
+
areAnyNewToolbarFlagsEnabled: false
|
|
354
359
|
});
|
|
355
360
|
}
|
|
356
361
|
};
|
|
357
362
|
var groupedItems = groupItems(items.filter(function (item) {
|
|
358
363
|
return !item.hidden;
|
|
359
|
-
}));
|
|
364
|
+
}), areAnyNewToolbarFlagsEnabled);
|
|
360
365
|
return jsx(ButtonGroup, {
|
|
361
366
|
testId: "editor-floating-toolbar-items"
|
|
362
367
|
}, groupedItems.map(function (element, index) {
|
|
@@ -366,7 +371,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
366
371
|
// Ignored via go/ees005
|
|
367
372
|
// eslint-disable-next-line react/no-array-index-key
|
|
368
373
|
key: index,
|
|
369
|
-
css:
|
|
374
|
+
css: areAnyNewToolbarFlagsEnabled ? buttonGroupStylesNew : buttonGroupStyles,
|
|
370
375
|
role: "radiogroup",
|
|
371
376
|
"aria-label": groupLabel !== null && groupLabel !== void 0 ? groupLabel : undefined,
|
|
372
377
|
"data-testid": "editor-floating-toolbar-grouped-buttons"
|
|
@@ -401,7 +406,7 @@ var buttonGroupStylesNew = css({
|
|
|
401
406
|
});
|
|
402
407
|
|
|
403
408
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
404
|
-
var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstElementIsSelect) {
|
|
409
|
+
var toolbarContainer = function toolbarContainer(areAnyNewToolbarFlagsEnabled, scrollable, hasSelect, firstElementIsSelect) {
|
|
405
410
|
return css({
|
|
406
411
|
backgroundColor: "var(--ds-surface-overlay, white)",
|
|
407
412
|
borderRadius: "var(--ds-radius-small, 3px)",
|
|
@@ -432,7 +437,7 @@ var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstEle
|
|
|
432
437
|
overflow: 'hidden'
|
|
433
438
|
}) :
|
|
434
439
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
435
|
-
|
|
440
|
+
areAnyNewToolbarFlagsEnabled ?
|
|
436
441
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
437
442
|
css({
|
|
438
443
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
@@ -455,7 +460,7 @@ var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstEle
|
|
|
455
460
|
paddingLeft: "var(--ds-space-050, 4px)"
|
|
456
461
|
})),
|
|
457
462
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
458
|
-
|
|
463
|
+
areAnyNewToolbarFlagsEnabled ?
|
|
459
464
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
460
465
|
css({
|
|
461
466
|
minHeight: "var(--ds-space-500, 40px)"
|
|
@@ -466,7 +471,8 @@ var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstEle
|
|
|
466
471
|
var toolbarOverflow = function toolbarOverflow(_ref2) {
|
|
467
472
|
var scrollable = _ref2.scrollable,
|
|
468
473
|
scrollDisabled = _ref2.scrollDisabled,
|
|
469
|
-
firstElementIsSelect = _ref2.firstElementIsSelect
|
|
474
|
+
firstElementIsSelect = _ref2.firstElementIsSelect,
|
|
475
|
+
areAnyNewToolbarFlagsEnabled = _ref2.areAnyNewToolbarFlagsEnabled;
|
|
470
476
|
return css(
|
|
471
477
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
472
478
|
scrollable ?
|
|
@@ -507,7 +513,7 @@ var toolbarOverflow = function toolbarOverflow(_ref2) {
|
|
|
507
513
|
}
|
|
508
514
|
},
|
|
509
515
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
510
|
-
|
|
516
|
+
areAnyNewToolbarFlagsEnabled ?
|
|
511
517
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
512
518
|
css({
|
|
513
519
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
@@ -646,6 +652,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
646
652
|
}, {
|
|
647
653
|
key: "render",
|
|
648
654
|
value: function render() {
|
|
655
|
+
var _this$props$api2;
|
|
649
656
|
var _this$props2 = this.props,
|
|
650
657
|
items = _this$props2.items,
|
|
651
658
|
className = _this$props2.className,
|
|
@@ -653,7 +660,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
653
660
|
intl = _this$props2.intl,
|
|
654
661
|
scrollable = _this$props2.scrollable,
|
|
655
662
|
mediaAssistiveMessage = _this$props2.mediaAssistiveMessage;
|
|
656
|
-
var
|
|
663
|
+
var areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean((_this$props$api2 = this.props.api) === null || _this$props$api2 === void 0 ? void 0 : _this$props$api2.toolbar));
|
|
657
664
|
if (!items || !items.length) {
|
|
658
665
|
return null;
|
|
659
666
|
}
|
|
@@ -677,7 +684,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
677
684
|
}, jsx("div", {
|
|
678
685
|
ref: this.toolbarContainerRef,
|
|
679
686
|
css: function css() {
|
|
680
|
-
return [toolbarContainer(scrollable, hasSelect !== undefined, firstElementIsSelect)];
|
|
687
|
+
return [toolbarContainer(areAnyNewToolbarFlagsEnabled, scrollable, hasSelect !== undefined, firstElementIsSelect)];
|
|
681
688
|
},
|
|
682
689
|
"aria-label": intl.formatMessage(messages.floatingToolbarAriaLabel),
|
|
683
690
|
role: "toolbar",
|
|
@@ -685,11 +692,11 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
685
692
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
686
693
|
,
|
|
687
694
|
className: className,
|
|
688
|
-
onMouseDown:
|
|
695
|
+
onMouseDown: areAnyNewToolbarFlagsEnabled ? this.captureMouseEvent : undefined
|
|
689
696
|
}, jsx(Announcer, {
|
|
690
697
|
text: mediaAssistiveMessage ? "".concat(mediaAssistiveMessage, ", ").concat(intl.formatMessage(messages.floatingToolbarAnnouncer)) : intl.formatMessage(messages.floatingToolbarAnnouncer),
|
|
691
698
|
delay: 250
|
|
692
|
-
}), scrollable &&
|
|
699
|
+
}), scrollable && areAnyNewToolbarFlagsEnabled && jsx(ScrollButton, {
|
|
693
700
|
intl: intl,
|
|
694
701
|
scrollContainerRef: this.scrollContainerRef,
|
|
695
702
|
node: node,
|
|
@@ -701,6 +708,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
701
708
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
702
709
|
,
|
|
703
710
|
css: toolbarOverflow({
|
|
711
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled,
|
|
704
712
|
scrollable: scrollable,
|
|
705
713
|
scrollDisabled: this.state.scrollDisabled,
|
|
706
714
|
firstElementIsSelect: firstElementIsSelect
|
|
@@ -712,7 +720,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
712
720
|
setDisableScroll: this.setDisableScroll.bind(this),
|
|
713
721
|
mountRef: this.mountRef,
|
|
714
722
|
mounted: this.state.mounted
|
|
715
|
-
}))), scrollable && (
|
|
723
|
+
}))), scrollable && (areAnyNewToolbarFlagsEnabled ? jsx(ScrollButton, {
|
|
716
724
|
intl: intl,
|
|
717
725
|
scrollContainerRef: this.scrollContainerRef,
|
|
718
726
|
node: node,
|
|
@@ -722,7 +730,8 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
722
730
|
intl: intl,
|
|
723
731
|
scrollContainerRef: this.scrollContainerRef,
|
|
724
732
|
node: node,
|
|
725
|
-
disabled: this.state.scrollDisabled
|
|
733
|
+
disabled: this.state.scrollDisabled,
|
|
734
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
726
735
|
}))), jsx("div", {
|
|
727
736
|
ref: this.mountRef
|
|
728
737
|
})));
|
|
@@ -9,6 +9,7 @@ import type { EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
|
|
|
9
9
|
import type { ExtensionPlugin } from '@atlaskit/editor-plugin-extension';
|
|
10
10
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
11
11
|
import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
12
|
+
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
12
13
|
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
13
14
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
14
15
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -39,7 +40,8 @@ export type FloatingToolbarPluginDependencies = [
|
|
|
39
40
|
OptionalPlugin<EmojiPlugin>,
|
|
40
41
|
OptionalPlugin<UserIntentPlugin>,
|
|
41
42
|
OptionalPlugin<InteractionPlugin>,
|
|
42
|
-
OptionalPlugin<AnalyticsPlugin
|
|
43
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
44
|
+
OptionalPlugin<ToolbarPlugin>
|
|
43
45
|
];
|
|
44
46
|
export type FloatingToolbarPlugin = NextEditorPlugin<'floatingToolbar', {
|
|
45
47
|
actions: {
|