"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 _elementTypes = require("../../../constants/element-types");
var _helper = require("../helper");
var _constants = require("../../../constants");
var _dropdownMenuItem = _interopRequireDefault(require("../../../commons/dropdown-menu-item"));
const menuConfig = _constants.MENUS_CONFIG_MAP[_elementTypes.DIVIDER];
const DividerMenu = _ref => {
  let {
    readonly,
    editor,
    toggle
  } = _ref;
  const onMousedown = (0, _react.useCallback)(e => {
    e.preventDefault();
    (0, _helper.insertDivider)(editor);
    toggle && toggle();
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, []);
  return /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
    disabled: readonly,
    menuConfig: menuConfig,
    className: "pr-2",
    onClick: onMousedown
  });
};
var _default = exports.default = DividerMenu;