import { createPrimitiveComponent, useElement } from '@udecode/plate-common';

import { TImageElement } from '../types';

export const useAttachmentImage = () => {
  const { url } = useElement<TImageElement>();

  return {
    props: {
      src: url,
      draggable: false,
    },
  };
};

export const AttachmentImage = createPrimitiveComponent('img')({
  propsHook: useAttachmentImage,
});
