Skip to content
Browse files

css value is cropped after editing

  • Loading branch information...
1 parent e67f0d1 commit 21e70d6e0298c2d84fb56543a9585d4cb8f3d6c7 @farshidbeheshti farshidbeheshti committed Sep 4, 2012
Showing with 48 additions and 15 deletions.
  1. +48 −15 extension/content/firebug/css/cssPanel.js
View
63 extension/content/firebug/css/cssPanel.js
@@ -1649,45 +1649,54 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
var propValue, parsedValue, propName;
- target.innerHTML = Str.escapeForCss(value);
-
+ var rule = Firebug.getRepObject(target);
var row = Dom.getAncestorByClass(target, "cssProp");
+
if (Css.hasClass(row, "disabledStyle"))
Css.toggleClass(row, "disabledStyle");
- var rule = Firebug.getRepObject(target);
+ // If the property was previously disabled, remove it from the "disabled"
+ // map. (We will then proceed to enable the property.)
+ if (row && row.classList.contains("disabledStyle"))
+ {
+ row.classList.remove("disabledStyle");
+ propName = Dom.getChildByClass(row, "cssPropName").textContent;
+
+ this.panel.removeDisabledProperty(rule, propName);
+ }
if (rule instanceof window.CSSStyleRule || rule instanceof window.Element)
{
if (Css.hasClass(target, "cssPropName"))
{
-
+ target.textContent = value;
+
if (value && previousValue != value) // name of property has changed.
{
// Record the original CSS text for the inline case so we can reconstruct at a later
// point for diffing purposes
var baseText = rule.style ? rule.style.cssText : rule.cssText;
-
+
propValue = Dom.getChildByClass(row, "cssPropValue").textContent;
parsedValue = parsePriority(propValue);
-
+
if (FBTrace.DBG_CSS)
FBTrace.sysout("CSSEditor.saveEdit : " + previousValue + "->" + value +
" = " + propValue);
-
+
if (propValue && propValue != "undefined")
{
if (FBTrace.DBG_CSS)
FBTrace.sysout("CSSEditor.saveEdit : " + previousValue + "->" + value +
" = " + propValue);
-
+
if (previousValue)
CSSModule.removeProperty(rule, previousValue);
-
+
CSSModule.setProperty(rule, value, parsedValue.value,
parsedValue.priority);
}
-
+
Events.dispatch(CSSModule.fbListeners, "onCSSPropertyNameChanged", [rule, value,
previousValue, baseText]);
}
@@ -1699,16 +1708,19 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
}
else if (Dom.getAncestorByClass(target, "cssPropValue"))
{
+ var limit = Options.get("cssDisplayedPropertyValueLimit");
+ target.textContent = limit > 0 ? Str.cropString(value, limit) : value;
+
propName = Dom.getChildByClass(row, "cssPropName").textContent;
propValue = Dom.getChildByClass(row, "cssPropValue").textContent;
-
+
if (FBTrace.DBG_CSS)
{
FBTrace.sysout("CSSEditor.saveEdit propName=propValue: "+propName +
" = "+propValue+"\n");
// FBTrace.sysout("CSSEditor.saveEdit BEFORE style:",style);
}
-
+
if (value && value != "null")
{
parsedValue = parsePriority(value);
@@ -1720,7 +1732,7 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
CSSModule.removeProperty(rule, propName);
}
}
-
+
if (value)
{
var saveSuccess = !!rule.style.getPropertyValue(propName || value);
@@ -1730,11 +1742,11 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
{
return match[1].toUpperCase()
});
-
+
if (propName in rule.style || propName == "float")
saveSuccess = "almost";
}
-
+
this.box.setAttribute("saveSuccess", saveSuccess);
}
else
@@ -1744,6 +1756,8 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
}
else if (rule instanceof window.CSSImportRule && Css.hasClass(target, "cssMediaQuery"))
{
+ target.textContent = value;
+
if (FBTrace.DBG_CSS)
{
FBTrace.sysout("CSSEditor.saveEdit: @import media query: " +
@@ -1762,6 +1776,8 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
}
else if (rule instanceof window.CSSCharsetRule)
{
+ target.textContent = value;
+
if (FBTrace.DBG_CSS)
FBTrace.sysout("CSSEditor.saveEdit: @charset: " + previousValue + "->" + value);
@@ -1776,6 +1792,23 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
FBTrace.sysout("CSSEditor.saveEdit (ending) " + this.panel.name, value);
},
+ beginEditing: function(target, value)
+ {
+ var row = Dom.getAncestorByClass(target, "cssProp");
+ this.initiallyDisabled = (row && row.classList.contains("disabledStyle"));
+ },
+
+ cancelEditing: function(target, value)
+ {
+ if (this.initiallyDisabled)
+ {
+ // Disable the property again.
+ var row = Dom.getAncestorByClass(target, "cssProp");
+ if (row && !row.classList.contains("disabledStyle"))
+ this.panel.disablePropertyRow(row);
+ }
+ },
+
advanceToNext: function(target, charCode)
{
if (charCode == 58 /*":"*/ && Css.hasClass(target, "cssPropName"))

0 comments on commit 21e70d6

Please sign in to comment.
Something went wrong with that request. Please try again.