mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 16:26:08 +08:00
21bc2ef398
* Move to Slate 44, start using types more extensively in Composer * More types and cleanup * Expose the editor object to the draft session, try exposing editor to session * Bump to Slate 45 for https://github.com/ianstormtaylor/slate/pull/2225/files * How did the unsubscribe plugin get in here * Bump Slate types, fix TS errors, start testing * Polish * Fix issue with emails not shrinking when you close quoted text * Fix the “remove quoted text” button * More polish * Fix issues with PR, improve typings * Remove spurious log
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
import { Utils, Actions, AttachmentStore, Message } from 'mailspring-exports';
|
|
import { AttachmentItem, ImageAttachmentItem } from 'mailspring-component-kit';
|
|
|
|
export const AttachmentsArea: React.FunctionComponent<{ draft: Message }> = props => {
|
|
const { files, headerMessageId } = props.draft;
|
|
|
|
return (
|
|
<div className="attachments-area">
|
|
{files
|
|
.filter(f => !Utils.shouldDisplayAsImage(f))
|
|
.map(file => (
|
|
<AttachmentItem
|
|
key={file.id}
|
|
className="file-upload"
|
|
draggable={false}
|
|
filePath={AttachmentStore.pathForFile(file)}
|
|
displayName={file.filename}
|
|
fileIconName={`file-${file.displayExtension()}.png`}
|
|
onRemoveAttachment={() => Actions.removeAttachment(headerMessageId, file)}
|
|
/>
|
|
))}
|
|
{files
|
|
.filter(f => Utils.shouldDisplayAsImage(f))
|
|
.filter(f => !f.contentId)
|
|
.map(file => (
|
|
<ImageAttachmentItem
|
|
key={file.id}
|
|
draggable={false}
|
|
className="file-upload"
|
|
filePath={AttachmentStore.pathForFile(file)}
|
|
displayName={file.filename}
|
|
onRemoveAttachment={() => Actions.removeAttachment(headerMessageId, file)}
|
|
/>
|
|
))}
|
|
</div>
|
|
);
|
|
};
|