From 5311b73d68f2d953c04665a5f54526f5d54e9b2a Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Fri, 10 Sep 2021 23:41:57 +0900 Subject: [PATCH] Fix #1786 don't add width/height styles if they are zero --- modules/editor/components/image_link/tpl/popup.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/editor/components/image_link/tpl/popup.js b/modules/editor/components/image_link/tpl/popup.js index 58b13b6cc..41959c8ba 100644 --- a/modules/editor/components/image_link/tpl/popup.js +++ b/modules/editor/components/image_link/tpl/popup.js @@ -86,8 +86,8 @@ else if($form.find('#align_middle').attr('checked') == 'checked') align = 'middle'; else if($form.find('#align_right').attr('checked') == 'checked') align = 'right'; - var width = $form.find('#width').val(); - var height = $form.find('#height').val(); + var width = parseInt($form.find('#width').val(), 10); + var height = parseInt($form.find('#height').val(), 10); if(!url) { window.close(); @@ -101,11 +101,11 @@ img_attrs.src = url; if(alt) img_attrs.alt = alt; - if(width) { + if(width > 0) { img_attrs.width = width; img_style.width = width; } - if(height) { + if(height > 0) { img_attrs.height = height; img_style.height = height; }