import React from 'react';
import { Transforms } from 'slate';
import { faEllipsisVertical } from '@fortawesome/free-solid-svg-icons/faEllipsisVertical';
import { FontAwesomeIcon } from '../font-awesome-icon';
import { Mention } from './mention';
import { CUSTOM_ELEMENT_TYPES } from './constants';
import { jsx as _jsx } from "react/jsx-runtime";
export const renderElement = props => {
  const {
    attributes,
    children,
    element
  } = props;
  if (element.type === CUSTOM_ELEMENT_TYPES.mention) {
    return /*#__PURE__*/_jsx(Mention, {
      ...props
    });
  }
  return /*#__PURE__*/_jsx("p", {
    ...attributes,
    children: children
  });
};
export const insertMention = (editor, mention, key) => {
  Transforms.insertNodes(editor, {
    type: CUSTOM_ELEMENT_TYPES.mention,
    mention,
    key,
    children: [{
      text: ''
    }]
  });
  Transforms.move(editor);
};
export const getOptionsTriggerIcon = () => {
  return /*#__PURE__*/_jsx(FontAwesomeIcon, {
    icon: faEllipsisVertical
  });
};