Fix #1786 don't add width/height styles if they are zero

This commit is contained in:
Kijin Sung 2021-09-10 23:41:57 +09:00
parent 22781e2117
commit 5311b73d68

View file

@ -86,8 +86,8 @@
else if($form.find('#align_middle').attr('checked') == 'checked') align = 'middle'; else if($form.find('#align_middle').attr('checked') == 'checked') align = 'middle';
else if($form.find('#align_right').attr('checked') == 'checked') align = 'right'; else if($form.find('#align_right').attr('checked') == 'checked') align = 'right';
var width = $form.find('#width').val(); var width = parseInt($form.find('#width').val(), 10);
var height = $form.find('#height').val(); var height = parseInt($form.find('#height').val(), 10);
if(!url) { if(!url) {
window.close(); window.close();
@ -101,11 +101,11 @@
img_attrs.src = url; img_attrs.src = url;
if(alt) img_attrs.alt = alt; if(alt) img_attrs.alt = alt;
if(width) { if(width > 0) {
img_attrs.width = width; img_attrs.width = width;
img_style.width = width; img_style.width = width;
} }
if(height) { if(height > 0) {
img_attrs.height = height; img_attrs.height = height;
img_style.height = height; img_style.height = height;
} }