UNPKG

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

Version:

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

78 lines 3.33 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) { var disabled = props.disabled, isSmall = props.isSmall, isReducedSpacing = props.isReducedSpacing, bulletListActive = props.bulletListActive, bulletListDisabled = props.bulletListDisabled, orderedListActive = props.orderedListActive, orderedListDisabled = props.orderedListDisabled, showIndentationButtons = props.showIndentationButtons, popupsMountPoint = props.popupsMountPoint, popupsBoundariesElement = props.popupsBoundariesElement, popupsScrollableElement = props.popupsScrollableElement, indentDisabled = props.indentDisabled, outdentDisabled = props.outdentDisabled, indentationStateNode = props.indentationStateNode, featureFlags = props.featureFlags, pluginInjectionApi = props.pluginInjectionApi, toolbarType = props.toolbarType; var inputMethod = toolbarType ? getInputMethod(toolbarType) : INPUT_METHOD.TOOLBAR; var isDisabled; if (isSmall || toolbarType === ToolbarType.FLOATING) { if (fg('platform_editor_toolbar_fix_for_disabled_options')) { var areAllOptionsDisabled = [bulletListDisabled, orderedListDisabled, indentDisabled, outdentDisabled].every(function (item) { return 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 }); }