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 ++++++++++++- js/panels/css-panel/styles-view-delegate.js | 10 ---------- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'js/panels') 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; diff --git a/js/panels/css-panel/styles-view-delegate.js b/js/panels/css-panel/styles-view-delegate.js index 79ae35d1..a187a702 100644 --- a/js/panels/css-panel/styles-view-delegate.js +++ b/js/panels/css-panel/styles-view-delegate.js @@ -177,16 +177,6 @@ exports.StylesViewMediator = Montage.create(Component, { return false; } - ///// Auto-fill units if not provided and units - ///// not previously stored - units = style.getUnits(value); - if(style.units && units === null && parseInt(value)) { - value += style.units; - style.valueField.value = value; - } else if (value !== '0') { - style.units = units; - } - ///// update value browserValue = this.stylesController.setStyle(rule, property, value); style.browserValue = browserValue; -- cgit v1.2.3