"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.renderElement = exports.insertMention = exports.getOptionsTriggerIcon = void 0;
var _react = _interopRequireDefault(require("react"));
var _slate = require("slate");
var _faEllipsisVertical = require("@fortawesome/free-solid-svg-icons/faEllipsisVertical");
var _fontAwesomeIcon = require("../font-awesome-icon");
var _mention = require("./mention");
var _constants = require("./constants");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const renderElement = props => {
  const {
    attributes,
    children,
    element
  } = props;
  if (element.type === _constants.CUSTOM_ELEMENT_TYPES.mention) {
    return /*#__PURE__*/(0, _jsxRuntime.jsx)(_mention.Mention, {
      ...props
    });
  }
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
    ...attributes,
    children: children
  });
};
exports.renderElement = renderElement;
const insertMention = (editor, mention, key) => {
  _slate.Transforms.insertNodes(editor, {
    type: _constants.CUSTOM_ELEMENT_TYPES.mention,
    mention,
    key,
    children: [{
      text: ''
    }]
  });
  _slate.Transforms.move(editor);
};
exports.insertMention = insertMention;
const getOptionsTriggerIcon = () => {
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_fontAwesomeIcon.FontAwesomeIcon, {
    icon: _faEllipsisVertical.faEllipsisVertical
  });
};
exports.getOptionsTriggerIcon = getOptionsTriggerIcon;