webmail: show all images (inline and attachment) below the text part (for the text view, not for html view)

the attachment buttons for images get some opacity for the text view, to
indicate you don't have to open them explicitly.
This commit is contained in:
Mechiel Lukkien
2024-04-20 19:36:14 +02:00
parent 41a62de4d7
commit 3a58b2a1f4
10 changed files with 133 additions and 51 deletions

View File

@ -22,6 +22,18 @@ const join = (l: any, efn: () => any): any[] => {
return r
}
// From https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types
const imageTypes = [
'image/avif',
'image/webp',
'image/gif',
'image/png',
'image/jpeg',
'image/apng',
'image/svg+xml',
]
const isImage = (a: api.Attachment) => imageTypes.includes((a.Part.MediaType + '/' + a.Part.MediaSubType).toLowerCase())
// addLinks turns a line of text into alternating strings and links. Links that
// would end with interpunction followed by whitespace are returned with that
// interpunction moved to the next string instead.