From 1e6f46ba556ca3270c89fb848d93856804dd1cc8 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 21 May 2012 12:40:05 -0700 Subject: CSS Style Component - Moved unit identification to local change handler instead of delegate --- js/panels/css-panel/css-style.reel/css-style.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'js/panels/css-panel/css-style.reel/css-style.js') diff --git a/js/panels/css-panel/css-style.reel/css-style.js b/js/panels/css-panel/css-style.reel/css-style.js index dd84c7e9..331faa2f 100644 --- a/js/panels/css-panel/css-style.reel/css-style.js +++ b/js/panels/css-panel/css-style.reel/css-style.js @@ -15,6 +15,7 @@ exports.CssStyle = Montage.create(Component, { invalidStyleClass : { value: "style-item-invalid" }, emptyStyleClass : { value: "empty-css-style" }, source : { value: null }, + units : { value: null }, propertyText : { value: "property", @@ -292,7 +293,17 @@ exports.CssStyle = Montage.create(Component, { value: function(e) { var property = this.propertyField.value, value = this.valueField.value, - rule = this.getRule(); + rule = this.getRule(), + units; + + ///// Auto-fill units if not provided and units + ///// not previously stored + units = this.getUnits(value); + if(this.units && units === null && parseInt(value)) { + value += this.units; + } else if (value !== '0') { + this.units = units; + } this.valueText = value; -- cgit v1.2.3