N°4518 - ActivityPanel: Fix inline images being shrinked in quick edit

This commit is contained in:
Molkobain
2021-12-08 10:27:33 +01:00
parent 28ecb77bf1
commit d4da1b99d8
3 changed files with 35 additions and 10 deletions

View File

@@ -986,8 +986,6 @@ const CombodoJSConsole = {
}
}
/**
* Helper to Sanitize string
*
@@ -1079,4 +1077,33 @@ const CombodoSanitizer = {
return sEncodedValue;
}
};
};
/**
* Helper for InlineImages
* @since 3.0.0
*/
const CombodoInlineImage = {
/**
* Max width to apply on inline images
*/
max_width: 600,
/**
* @param sMaxWidth {string} {@see CombodoInlineImage.max_width}
*/
SetMaxWidth: function (sMaxWidth) {
this.max_width = sMaxWidth;
},
/**
* Apply the {@see CombodoInlineImage.max_width} to all inline images
*/
FixImagesWidth: function () {
$('img[data-img-id]').each(function() {
if ($(this).width() > CombodoInlineImage.max_width)
{
$(this).css({'max-width': CombodoInlineImage.max_width+'px', width: '', height: '', 'max-height': ''});
}
$(this).addClass('inline-image').attr('href', $(this).attr('src'));
}).magnificPopup({type: 'image', closeOnContentClick: true });
}
}