Mailspring/app/internal_packages/composer-templates/lib/template-status-bar.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

40 lines
963 B
TypeScript

import React from 'react';
import { localized, PropTypes, Message, MessageWithEditorState } from 'mailspring-exports';
class TemplateStatusBar extends React.Component<{ draft: MessageWithEditorState }> {
static displayName = 'TemplateStatusBar';
static containerStyles = {
textAlign: 'center',
width: 580,
margin: 'auto',
};
static propTypes = {
draft: PropTypes.object.isRequired,
};
_usingTemplate(draft: MessageWithEditorState) {
return (
draft &&
draft.bodyEditorState &&
draft.bodyEditorState.document.getInlinesByType('templatevar').size > 0
);
}
render() {
if (!this._usingTemplate(this.props.draft)) {
return <div />;
}
return (
<div className="template-status-bar">
{localized(
'Press "tab" to quickly move between the blanks - highlighting will not be visible to recipients.'
)}
</div>
);
}
}
export default TemplateStatusBar;