mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 18:32:20 +08:00
37 lines
861 B
JavaScript
37 lines
861 B
JavaScript
import {React} from 'nylas-exports';
|
|
|
|
class TemplateStatusBar extends React.Component {
|
|
static displayName = 'TemplateStatusBar';
|
|
|
|
static propTypes = {
|
|
draft: React.PropTypes.object.isRequired,
|
|
};
|
|
|
|
shouldComponentUpdate(nextProps) {
|
|
return (this._usingTemplate(nextProps) !== this._usingTemplate(this.props));
|
|
}
|
|
|
|
_usingTemplate({draft}) {
|
|
return draft && draft.body.search(/<code[^>]*class="var[^>]*>/i) > 0;
|
|
}
|
|
|
|
render() {
|
|
if (this._usingTemplate(this.props)) {
|
|
return (
|
|
<div className="template-status-bar">
|
|
Press "tab" to quickly move between the blanks - highlighting will not be visible to recipients.
|
|
</div>
|
|
);
|
|
}
|
|
return <div />;
|
|
}
|
|
|
|
}
|
|
|
|
TemplateStatusBar.containerStyles = {
|
|
textAlign: 'center',
|
|
width: 580,
|
|
margin: 'auto',
|
|
};
|
|
|
|
export default TemplateStatusBar;
|