import FormTextArea from '@material-hu/components/design-system/Inputs/TextArea/form';

import { uploadArticleAsset } from 'src/pages/dashboard/HuLibraries/utils';
import { megabytesToBytes } from 'src/utils/files';

export const ArticleEditBody = () => {
  return (
    <FormTextArea
      name="body"
      textAreaProps={{
        characterLimit: null,
        sx: { '& .text-area-actions-bar': { top: '-20px' } },
        actions: {
          table: true,
          embedHTML: true,
          insertEmoji: true,
        },
        slotProps: {
          insertImage: {
            uploaderProps: {
              maxFiles: 1,
              fileSizeLimit: megabytesToBytes(10),
              uploadFunction: uploadArticleAsset,
            },
          },
          uploadVideo: {
            uploaderProps: {
              maxFiles: 1,
              fileSizeLimit: megabytesToBytes(1024),
              uploadFunction: uploadArticleAsset,
            },
          },
        },
      }}
    />
  );
};
