@atlaskit/editor-plugin-toolbar-lists-indentation
Version:
Toolbar lists and indentation plugin for @atlaskit/editor-core
70 lines • 2.87 kB
JavaScript
/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
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;
if (isSmall || toolbarType === ToolbarType.FLOATING || editorExperiment('platform_editor_controls', 'variant1')) {
const areAllOptionsDisabled = [bulletListDisabled, orderedListDisabled, indentDisabled, outdentDisabled].every(item => Boolean(item) === true);
const isDisabled = disabled || areAllOptionsDisabled;
return /*#__PURE__*/React.createElement(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 /*#__PURE__*/React.createElement(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
});
}