diff --git a/modules/editor/components/image_link/image_link.class.php b/modules/editor/components/image_link/image_link.class.php index dc5a1d82c..8f91428b8 100644 --- a/modules/editor/components/image_link/image_link.class.php +++ b/modules/editor/components/image_link/image_link.class.php @@ -66,8 +66,10 @@ $attr_output[] = "title=\"".$alt."\""; } if($margin) { - $style = preg_replace('/margin[: 0-9a-z]+\;/i','', $style); - $style .= 'margin:'.$margin.'px;'; + $style = trim(preg_replace('/margin[a-z\-]*[ ]*:[ ]*[0-9 a-z]+(;| )/i','', $style)).';'; + $style = str_replace(';;',';',$style); + if($style == ';') $style = ''; + $style .= ' margin:'.$margin.'px;'; } if($align) $attr_output[] = "align=\"".$align."\""; @@ -75,7 +77,12 @@ if($width) $attr_output[] = 'width="'.$width.'"'; if($height) $attr_output[] = 'height="'.$height.'"'; - if($border) $attr_output[] = 'border="'.$border.'"'; + if($border) { + $style = trim(preg_replace('/border[a-z\-]*[ ]*:[ ]*[0-9 a-z]+(;| )/i','', $style)).';'; + $style = str_replace(';;',';',$style); + if($style == ';') $style = ''; + $style .= ' border-style: solid; border-width:'.$border.'px;'; + } $code = sprintf("", implode(' ',$attr_output), $style); diff --git a/modules/editor/components/image_link/tpl/popup.js b/modules/editor/components/image_link/tpl/popup.js index 6c97366d5..357e82452 100644 --- a/modules/editor/components/image_link/tpl/popup.js +++ b/modules/editor/components/image_link/tpl/popup.js @@ -57,7 +57,9 @@ function getImage() { xGetElementById('image_margin').value = margin; } - xGetElementById("image_border").value = border; + if(border) { + xGetElementById("image_border").value = border; + } xGetElementById("width").value = width; xGetElementById("height").value = height; @@ -110,7 +112,7 @@ function insertImage(obj) { if(height) text+= " height=\""+height+"\""; if(link_url) text+= " link_url=\""+link_url+"\""; if(open_window=='Y') text+= " open_window=\"Y\""; - if(align || border){ + if(align || border || margin){ text+= " style=\""; if(align) text+= align+"; "; if(border) text+= "border: solid "+border+"px; ";