Array.from() to spread syntax

This commit is contained in:
djmaze 2020-09-22 10:13:32 +02:00
parent 07b002a66a
commit df1d0fc8d6
6 changed files with 27 additions and 7 deletions

View file

@ -58,7 +58,7 @@ const doc = document,
tpl.querySelectorAll(':not('+allowedElements+',signature)').forEach(el => el.replaceWith(getFragmentOfChildren(el)));
tpl.querySelectorAll('*').forEach(el => {
if (el.hasAttributes()) {
Array.from(el.attributes).forEach(attr => {
[...el.attributes].forEach(attr => {
let name = attr.name.toLowerCase();
if (!allowedAttributes.includes(name)) {
el.removeAttribute(name);

View file

@ -397,8 +397,28 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
* @param {Object} oAttachment
* @returns {boolean}
*/
attachmentPreview() {
// TODO: add lightgallery alternative?
attachmentPreview(/*attachment*/) {
/*
if (attachment && attachment.isImage() && !attachment.isLinked && this.message() && this.message().attachments()) {
const items = this.message().attachments().map(item => {
if (item && !item.isLinked && item.isImage()) {
if (item === attachment) {
index = listIndex;
}
++listIndex;
return {
src: item.linkPreview(),
msrc: item.linkThumbnail(),
title: item.fileName
};
}
return null;
}).filter(value => !!value);
if (items.length) {
}
}
*/
return true;
}