Ticket #447 (closed defect: fixed)
Problems in ImageManager with no values in margin,padding and border
| Reported by: | anonymous | Owned by: | yermol |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Plugin_ImageManager | Version: | |
| Severity: | normal | Keywords: | ImageManager, margin, padding |
| Cc: |
Description
If you dont put values in the fields Margin, Padding or Border the Image Manager produces redundant Code nobody needs and even worse: In some cases it produces failures you only see in the source Code.
There is written in the stylesdefinition: "border:0px solid; padding:0px; margin:0px"
If you have a global CSS where you want your images to get a permanent border of 3px, 4px or whatever else, this bug compromites your Style-definition because it definitively works again this. All the time you want hin to do NOTHING with this parameter he inserts the "0px"-value.
This si not a bug - it is made explicitly. I dont understand this - because it only produces errors and and hazzle.
Because of this I modified the script.
You have to insert it at line 188 instead of:
img.style.borderWidth = /[^0-9]/.test(value) ? value : (parseInt(value || "0") + 'px');
if(img.style.borderWidth && !img.style.borderStyle)
{
img.style.borderStyle = 'solid';
}
break;
case "f_borderColor": img.style.borderColor = value; break;
case "f_backgroundColor": img.style.backgroundColor = value; break;
case "f_padding": img.style.padding =
/[^0-9]/.test(value) ? value : (parseInt(value || "0") + 'px'); break;
case "f_margin": img.style.margin =
/[^0-9]/.test(value) ? value : (parseInt(value || "0") + 'px'); break;
you put in this:
case "f_border" :
/* changed by Kpt|Kip **** */
if(value.length!=0) { img.style.borderWidth = /[^0-9]/.test(value) ? value : (parseInt(value) + 'px');}
else {img.style.borderWidth = null;}
if(img.style.borderWidth!="" && !img.style.borderStyle!="") {img.style.borderStyle = 'solid';}
else {img.style.borderStyle = null;}
/* changed by Kpt|Kip **** */
break;
case "f_borderColor": img.style.borderColor = value; break;
case "f_backgroundColor": img.style.backgroundColor = value; break;
case "f_padding":
if(value.length!=0) { img.style.padding = /[^0-9]/.test(value) ? value : (parseInt(value) + 'px'); break;} // changed by Kpt|Kip
else { img.style.padding = null; break} // changed by Kpt|Kip
case "f_margin":
if(value.length!=0) {img.style.margin = /[^0-9]/.test(value) ? value : (parseInt(value) + 'px'); break;} // changed by Kpt|Kip
else {img.style.margin = null; break;} // changed by Kpt|Kip
Aftrewards it works like it is expected: If you put in values they are used, if there is a "0" it is set to "0px" and if there are no values there dont appear any parameters.
Greetings Kpt|Kip
