"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = BlockquoteMenu;
var _react = _interopRequireWildcard(require("react"));
var _commons = require("../../../commons");
var _menusConfig = require("../../../constants/menus-config");
var _elementTypes = require("../../../constants/element-types");
var _helpers = require("../helpers");
const menuConfig = _menusConfig.MENUS_CONFIG_MAP[_elementTypes.BLOCKQUOTE];
const isActive = editor => {
  return (0, _helpers.getBlockQuoteType)(editor) === _elementTypes.BLOCKQUOTE;
};
function BlockquoteMenu(_ref) {
  let {
    isRichEditor,
    className,
    readonly,
    editor
  } = _ref;
  const onMousedown = (0, _react.useCallback)(event => {
    const active = isActive(editor);
    (0, _helpers.setBlockQuoteType)(editor, active);
  }, [editor]);
  return /*#__PURE__*/_react.default.createElement(_commons.MenuItem, Object.assign({
    isRichEditor: isRichEditor,
    className: className,
    disabled: (0, _helpers.isMenuDisabled)(editor, readonly),
    isActive: isActive(editor),
    onMouseDown: onMousedown
  }, menuConfig));
}