зеркало из https://github.com/mozilla/email-tabs.git
Merge pull request #64 from mozilla/add-simple-alt
Start #8, add a simple alt attribute to img
This commit is contained in:
Коммит
dff7c23e86
|
@ -30,9 +30,16 @@ this.emailTemplates = (function () {
|
|||
if (tab.screenshot) {
|
||||
// Note: the alt attribute is searched by gmail, but the title attribute is NOT searched
|
||||
// Note: box-shadow is specifically filtered out by gmail, other styles may get through
|
||||
let imgAlt = "Screenshot";
|
||||
let domain = (new URL(tab.url)).hostname;
|
||||
if (domain) {
|
||||
// If it doesn't have a domain, it's probably a file: URL, or something non-standard
|
||||
domain = domain.replace(/^www\d?\./i, "");
|
||||
imgAlt = `Screenshot of ${domain}`;
|
||||
}
|
||||
img = <section>
|
||||
<div style={{display: "inline-block", boxShadow: "7px 7px 20px #999", border: "1px solid #999"}}>
|
||||
<img height={tab.screenshot.height} width={tab.screenshot.width} src={tab.screenshot.url} />
|
||||
<img height={tab.screenshot.height} width={tab.screenshot.width} src={tab.screenshot.url} alt={imgAlt} />
|
||||
</div>
|
||||
<br />
|
||||
</section>;
|
||||
|
|
Загрузка…
Ссылка в новой задаче