UNPKG

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

Version:

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

85 lines (83 loc) 3.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = ToolbarListsIndentation; var _react = require("@emotion/react"); var _analytics = require("@atlaskit/editor-common/analytics"); var _platformFeatureFlags = require("@atlaskit/platform-feature-flags"); var _types = require("../types"); var _onItemActivated = require("./onItemActivated"); var _Toolbar = require("./Toolbar"); var _ToolbarDropdown = require("./ToolbarDropdown"); var _inputMethod = require("./utils/input-method"); /** * @jsxRuntime classic * @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766 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 ? (0, _inputMethod.getInputMethod)(toolbarType) : _analytics.INPUT_METHOD.TOOLBAR; var isDisabled; if (isSmall || toolbarType === _types.ToolbarType.FLOATING) { if ((0, _platformFeatureFlags.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 (0, _react.jsx)(_ToolbarDropdown.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: (0, _onItemActivated.onItemActivated)(pluginInjectionApi, indentationStateNode, inputMethod), featureFlags: featureFlags, pluginInjectionApi: pluginInjectionApi, toolbarType: toolbarType }); } return (0, _react.jsx)(_Toolbar.Toolbar, { editorView: props.editorView, isReducedSpacing: isReducedSpacing, bulletListActive: bulletListActive, bulletListDisabled: bulletListDisabled, showIndentationButtons: showIndentationButtons, orderedListActive: orderedListActive, orderedListDisabled: orderedListDisabled, indentDisabled: indentDisabled, outdentDisabled: outdentDisabled, disabled: disabled, onItemActivated: (0, _onItemActivated.onItemActivated)(pluginInjectionApi, indentationStateNode, inputMethod), featureFlags: featureFlags, pluginInjectionApi: pluginInjectionApi }); }