diff --git a/app/internal_packages/account-sidebar/lib/sidebar-item.ts b/app/internal_packages/account-sidebar/lib/sidebar-item.ts index ef7ad0adff..eca28a26cb 100644 --- a/app/internal_packages/account-sidebar/lib/sidebar-item.ts +++ b/app/internal_packages/account-sidebar/lib/sidebar-item.ts @@ -12,6 +12,7 @@ import { CategoryStore, Actions, RegExpUtils, + DragDropTypes, localized, TaskQueue, } from 'mailspring-exports'; @@ -281,7 +282,7 @@ export default class SidebarItem { onCollapseToggled: toggleItemCollapsed, onDrop(item, event) { - const jsonString = event.dataTransfer.getData('mailspring-threads-data'); + const jsonString = event.dataTransfer.getData(DragDropTypes.ThreadsDragType); let jsonData = null; try { jsonData = JSON.parse(jsonString); @@ -297,7 +298,7 @@ export default class SidebarItem { shouldAcceptDrop(item, event) { const target = item.perspective; const current = FocusedPerspectiveStore.current(); - if (!event.dataTransfer.types.includes('mailspring-threads-data')) { + if (!event.dataTransfer.types.includes(DragDropTypes.ThreadsDragType)) { return false; } if (target.isEqual(current)) { @@ -306,10 +307,7 @@ export default class SidebarItem { // We can't inspect the drag payload until drop, so we use a dataTransfer // type to encode the account IDs of threads currently being dragged. - const accountsType = event.dataTransfer.types.find((t) => - t.startsWith('mailspring-accounts=') - ); - const accountIds = (accountsType || '').replace('mailspring-accounts=', '').split(','); + const accountIds = DragDropTypes.accountIdsForDragTypes(event.dataTransfer.types); return target.canReceiveThreadsFromAccountIds(accountIds); }, diff --git a/app/internal_packages/composer/lib/attachments-area.tsx b/app/internal_packages/composer/lib/attachments-area.tsx index 84f803c3e1..c5646e4e37 100644 --- a/app/internal_packages/composer/lib/attachments-area.tsx +++ b/app/internal_packages/composer/lib/attachments-area.tsx @@ -1,8 +1,14 @@ import React from 'react'; -import { Actions, AttachmentStore, Message } from 'mailspring-exports'; -import { AttachmentItem } from 'mailspring-component-kit'; +import { localized, Actions, AttachmentStore, Message } from 'mailspring-exports'; +import { AttachmentItem, Spinner } from 'mailspring-component-kit'; -export const AttachmentsArea: React.FunctionComponent<{ draft: Message }> = (props) => { +export const AttachmentsArea: React.FunctionComponent<{ + draft: Message; + // True while files dropped on the composer are still being prepared. They + // aren't on the draft yet, so a placeholder stands in to show the drop was + // accepted. + attaching?: boolean; +}> = (props) => { const { files, headerMessageId } = props.draft; return ( @@ -20,6 +26,12 @@ export const AttachmentsArea: React.FunctionComponent<{ draft: Message }> = (pro onRemoveAttachment={() => Actions.removeAttachment(headerMessageId, file)} /> ))} + {props.attaching && ( +