"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _constants = require("../../../constants");
var _menuItem = _interopRequireDefault(require("../../../commons/menu/menu-item"));
var _helpers = require("../helpers");
const TextStyleMenu = _ref => {
  let {
    editor,
    readonly,
    type,
    isRichEditor,
    className
  } = _ref;
  const config = _constants.MENUS_CONFIG_MAP[type];
  const isDisabled = (0, _helpers.isMenuDisabled)(editor, readonly);
  const isActive = (0, _helpers.isMarkActive)(editor, type);
  const handleClickMenu = (0, _react.useCallback)((e, toggleType) => {
    (0, _helpers.toggleTextStyle)(editor, type);
  }, [editor, type]);
  return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_menuItem.default, Object.assign({
    editor: editor,
    disabled: isDisabled,
    isActive: isActive,
    isRichEditor: isRichEditor,
    className: className,
    onMouseDown: handleClickMenu
  }, config)));
};
var _default = exports.default = TextStyleMenu;