UNPKG

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

Version:

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

78 lines (77 loc) 4.24 kB
/* index.tsx generated by @compiled/babel-plugin v0.39.1 */ "use strict"; var _typeof = require("@babel/runtime/helpers/typeof"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = ToolbarListsIndentation; var React = _interopRequireWildcard(require("react")); var _runtime = require("@compiled/react/runtime"); var _analytics = require("@atlaskit/editor-common/analytics"); var _experiments = require("@atlaskit/tmp-editor-statsig/experiments"); var _types = require("../types"); var _onItemActivated = require("./onItemActivated"); var _Toolbar = require("./Toolbar"); var _ToolbarDropdown = require("./ToolbarDropdown"); var _inputMethod = require("./utils/input-method"); function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); } 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; if (isSmall || toolbarType === _types.ToolbarType.FLOATING || (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) { var areAllOptionsDisabled = [bulletListDisabled, orderedListDisabled, indentDisabled, outdentDisabled].every(function (item) { return Boolean(item) === true; }); var isDisabled = disabled || areAllOptionsDisabled; return /*#__PURE__*/React.createElement(_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 /*#__PURE__*/React.createElement(_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 }); }