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/components/editable.reel/editable.js | 1 - js/panels/css-panel/css-style.reel/css-style.js | 13 ++++++++++++- js/panels/css-panel/styles-view-delegate.js | 10 ---------- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'js') diff --git a/js/components/editable.reel/editable.js b/js/components/editable.reel/editable.js index eab73993..103e418f 100644 --- a/js/components/editable.reel/editable.js +++ b/js/components/editable.reel/editable.js @@ -195,7 +195,6 @@ exports.Editable = Montage.create(Component, { handleKeydown : { value : function(e) { var k = e.keyCode; - console.log("editable - keycode", k); } }, 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