From e11e9f9ffa1975bcfefa530f17cd1d29e0c936b8 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 15 Aug 2012 12:21:02 -0700 Subject: CSS Panel - Fix layout when editing long CSS values. --- js/panels/css-panel/css-style.reel/css-style.css | 9 +++++++++ js/panels/css-panel/css-style.reel/css-style.js | 24 +++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/js/panels/css-panel/css-style.reel/css-style.css b/js/panels/css-panel/css-style.reel/css-style.css index d6ca76d1..d114a61f 100644 --- a/js/panels/css-panel/css-style.reel/css-style.css +++ b/js/panels/css-panel/css-style.reel/css-style.css @@ -138,6 +138,15 @@ POSSIBILITY OF SUCH DAMAGE. .style-item .hintable-hint { color: #bdbdbd; } +.edit-value { + white-space: normal; +} +.edit-value dt { + margin-right: -5px; +} +.edit-value dd { + margin-left: 5px; +} /* ------------------------ Empty Style (Add Style) 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 dee94e75..e0055dc6 100644 --- a/js/panels/css-panel/css-style.reel/css-style.js +++ b/js/panels/css-panel/css-style.reel/css-style.js @@ -57,6 +57,7 @@ exports.CssStyle = Montage.create(Component, { delegate : { value: null }, disabledClass : { value: 'style-item-disabled' }, editingStyleClass : { value: 'edit-style-item' }, + editingValueClass : { value: 'edit-value' }, editNewEmptyClass : { value: 'edit-empty-style' }, invalidStyleClass : { value: "style-item-invalid" }, emptyStyleClass : { value: "empty-css-style" }, @@ -181,6 +182,18 @@ exports.CssStyle = Montage.create(Component, { } }, + _editingValue : { value: null }, + editingValue : { + get : function() { return this._editingValue; }, + set : function(value) { + if(value === this._editingValue) { return; } + + this._editingValue = value; + + this.needsDraw = true; + } + }, + remove : { value: function() { var branchController = this.parentComponent.parentComponent.contentController; @@ -257,6 +270,9 @@ exports.CssStyle = Montage.create(Component, { if(this.empty) { this.editingNewStyle = true; } + + this.editingValue = (this.valueField.element === e._currentTarget.element); + } }, @@ -300,7 +316,7 @@ exports.CssStyle = Montage.create(Component, { return false; } - this.editing = false; + this.editing = this.editingValue = false; if(this.empty && !this.dirty && !fieldsClicked.bind(this)()) { ///// Show add button @@ -457,6 +473,12 @@ exports.CssStyle = Montage.create(Component, { } else { this._element.classList.remove(this.editingStyleClass); } + + if(this.editingValue) { + this._element.classList.add(this.editingValueClass); + } else { + this._element.classList.remove(this.editingValueClass); + } } } }); -- cgit v1.2.3