UNPKG

@atlaskit/editor-plugin-toolbar-lists-indentation

Version:

Toolbar lists and indentation plugin for @atlaskit/editor-core

78 lines 2.9 kB
/** * @jsxRuntime classic * @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766 import { jsx } from '@emotion/react'; import { INPUT_METHOD } from '@atlaskit/editor-common/analytics'; import { fg } from '@atlaskit/platform-feature-flags'; import { ToolbarType } from '../types'; import { onItemActivated } from './onItemActivated'; import { Toolbar } from './Toolbar'; import { ToolbarDropdown } from './ToolbarDropdown'; import { getInputMethod } from './utils/input-method'; export default function ToolbarListsIndentation(props) { const { disabled, isSmall, isReducedSpacing, bulletListActive, bulletListDisabled, orderedListActive, orderedListDisabled, showIndentationButtons, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, indentDisabled, outdentDisabled, indentationStateNode, featureFlags, pluginInjectionApi, toolbarType } = props; const inputMethod = toolbarType ? getInputMethod(toolbarType) : INPUT_METHOD.TOOLBAR; let isDisabled; if (isSmall || toolbarType === ToolbarType.FLOATING) { if (fg('platform_editor_toolbar_fix_for_disabled_options')) { const areAllOptionsDisabled = [bulletListDisabled, orderedListDisabled, indentDisabled, outdentDisabled].every(item => Boolean(item) === true); isDisabled = disabled || areAllOptionsDisabled; } else { isDisabled = disabled; } return jsx(ToolbarDropdown, { editorView: props.editorView, isReducedSpacing: isReducedSpacing, popupsMountPoint: popupsMountPoint, popupsBoundariesElement: popupsBoundariesElement, popupsScrollableElement: popupsScrollableElement, bulletListActive: bulletListActive, bulletListDisabled: bulletListDisabled, showIndentationButtons: showIndentationButtons, orderedListActive: orderedListActive, orderedListDisabled: orderedListDisabled, indentDisabled: indentDisabled, outdentDisabled: outdentDisabled, disabled: isDisabled, onItemActivated: onItemActivated(pluginInjectionApi, indentationStateNode, inputMethod), featureFlags: featureFlags, pluginInjectionApi: pluginInjectionApi, toolbarType: toolbarType }); } return jsx(Toolbar, { editorView: props.editorView, isReducedSpacing: isReducedSpacing, bulletListActive: bulletListActive, bulletListDisabled: bulletListDisabled, showIndentationButtons: showIndentationButtons, orderedListActive: orderedListActive, orderedListDisabled: orderedListDisabled, indentDisabled: indentDisabled, outdentDisabled: outdentDisabled, disabled: disabled, onItemActivated: onItemActivated(pluginInjectionApi, indentationStateNode, inputMethod), featureFlags: featureFlags, pluginInjectionApi: pluginInjectionApi }); }