mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°4518 - ActivityPanel: Fix inline images being shrinked in quick edit
This commit is contained in:
@@ -362,13 +362,8 @@ class InlineImage extends DBObject
|
|||||||
{
|
{
|
||||||
$sJS =
|
$sJS =
|
||||||
<<<JS
|
<<<JS
|
||||||
$('img[data-img-id]').each(function() {
|
CombodoInlineImage.SetMaxWidth('{$iMaxWidth}');
|
||||||
if ($(this).width() > {$iMaxWidth})
|
CombodoInlineImage.FixImagesWidth();
|
||||||
{
|
|
||||||
$(this).css({'max-width': '{$iMaxWidth}px', width: '', height: '', 'max-height': ''});
|
|
||||||
}
|
|
||||||
$(this).addClass('inline-image').attr('href', $(this).attr('src'));
|
|
||||||
}).magnificPopup({type: 'image', closeOnContentClick: true });
|
|
||||||
JS
|
JS
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -928,6 +928,9 @@ $(function()
|
|||||||
}
|
}
|
||||||
me._ApplyEntriesFilters();
|
me._ApplyEntriesFilters();
|
||||||
|
|
||||||
|
// Try to fix inline images width
|
||||||
|
CombodoInlineImage.FixImagesWidth();
|
||||||
|
|
||||||
// For now, we don't hide the forms as the user may want to add something else
|
// For now, we don't hide the forms as the user may want to add something else
|
||||||
me.element.find(me.js_selectors.caselog_entry_form).trigger('clear_entry.caselog_entry_form.itop');
|
me.element.find(me.js_selectors.caselog_entry_form).trigger('clear_entry.caselog_entry_form.itop');
|
||||||
|
|
||||||
|
|||||||
33
js/utils.js
33
js/utils.js
@@ -986,8 +986,6 @@ const CombodoJSConsole = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper to Sanitize string
|
* Helper to Sanitize string
|
||||||
*
|
*
|
||||||
@@ -1079,4 +1077,33 @@ const CombodoSanitizer = {
|
|||||||
|
|
||||||
return sEncodedValue;
|
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 });
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user