Mailspring/app/internal_packages/composer/lib/quoted-text-control.tsx
Ben Gotow 21bc2ef398
Upgrade to Slate 0.45.1 for better composer perf and "setStart on Range" error fix (#1518)
* 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
2019-06-10 19:15:07 -05:00

41 lines
1.1 KiB
TypeScript

import React from 'react';
import { localized } from 'mailspring-exports';
import { RetinaImg } from 'mailspring-component-kit';
export const QuotedTextControl: React.FunctionComponent<{
quotedTextPresent: boolean;
quotedTextHidden: boolean;
onUnhide: () => void;
onRemove: () => void;
}> = props => {
if (!props.quotedTextPresent || !props.quotedTextHidden) {
return null;
}
return (
<a
className="quoted-text-control"
onMouseDown={e => {
if (e.target instanceof HTMLElement && e.target.closest('.remove-quoted-text')) return;
e.preventDefault();
e.stopPropagation();
props.onUnhide();
}}
>
<span className="dots">&bull;&bull;&bull;</span>
<span
className="remove-quoted-text"
onMouseUp={e => {
e.preventDefault();
e.stopPropagation();
props.onRemove();
}}
>
<RetinaImg
title={localized('Remove quoted text')}
name="image-cancel-button.png"
mode={RetinaImg.Mode.ContentPreserve}
/>
</span>
</a>
);
};