diff --git a/src/demo.js b/src/demo.js index eecb0e2e5..b60bc7617 100644 --- a/src/demo.js +++ b/src/demo.js @@ -721,13 +721,6 @@ require(['config/require-config'], function() { type : 'stack', preview : true, properties : [{ - name: 'Shadow type', - property: 'shadow-type', - type: 'select', - defaults: '', - list: [ { value : '', name : 'Outside', }, - { value : 'inset', name : 'Inside', }], - },{ name: 'X position', property: 'shadow-x', type: 'integer', @@ -757,7 +750,14 @@ require(['config/require-config'], function() { property: 'shadow-color', type: 'color', defaults: 'black', - },], + },{ + name: 'Shadow type', + property: 'shadow-type', + type: 'select', + defaults: ' ', + list: [ { value : ' ', name : 'Outside', }, + { value : 'inset', name : 'Inside', }], + }], },{ name : 'Background', property : 'background', diff --git a/src/dom_components/model/Components.js b/src/dom_components/model/Components.js index 56e2707fb..b2f2a61a9 100644 --- a/src/dom_components/model/Components.js +++ b/src/dom_components/model/Components.js @@ -67,7 +67,6 @@ define([ 'backbone', 'require'], cssC.addRule(rule); rule.set('style', style); } - console.log('After component add'); }, }); diff --git a/src/editor/model/Editor.js b/src/editor/model/Editor.js index 3382c5214..7d4316f48 100644 --- a/src/editor/model/Editor.js +++ b/src/editor/model/Editor.js @@ -100,7 +100,7 @@ define([ this.cssc = new CssComposer(cfg); this.CssComposer = this.cssc; this.set('CssComposer', this.cssc); - + console.log(this.cssc.getRules()); if(this.stm.isAutosave()) this.listenRules(this.cssc.getRules()); }, diff --git a/src/style_manager/view/PropertyStackView.js b/src/style_manager/view/PropertyStackView.js index 0de00b903..364ab4e32 100644 --- a/src/style_manager/view/PropertyStackView.js +++ b/src/style_manager/view/PropertyStackView.js @@ -229,8 +229,17 @@ define(['backbone','./PropertyCompositeView', 'text!./../templates/propertyStack a = this.getLayersFromTarget(); }else{ var v = this.getComponentValue(); - if(v) + if(v){ + // Remove spaces inside functions: + // eg: + // From: 1px 1px rgba(2px, 2px, 2px), 2px 2px rgba(3px, 3px, 3px) + // To: 1px 1px rgba(2px,2px,2px), 2px 2px rgba(3px,3px,3px) + v.replace(/\(([\w\s,.]*)\)/g, function(match){ + var cleaned = match.replace(/,\s*/g, ','); + v = v.replace(match, cleaned); + }); a = v.split(', '); + } } _.each(a,function(e){ n.push({ value: e});},this); this.$props.detach(); diff --git a/test/specs/style_manager/view/PropertyStackView.js b/test/specs/style_manager/view/PropertyStackView.js index 1f2c34fff..76dcfdc03 100644 --- a/test/specs/style_manager/view/PropertyStackView.js +++ b/test/specs/style_manager/view/PropertyStackView.js @@ -231,6 +231,17 @@ define([path + 'PropertyStackView', 'StyleManager/model/Property', 'DomComponent (view.valueOnIndex(2) === null).should.equal(true); }); + it('The value is correctly extracted from the string with functions', function() { + var style = {}; + style[propName] = 'func(a1a, s2a,d3a) value1 value2, func(4ddb, aAS5b, sS.6b) value3'; + component.set('style', style); + view.propTarget.trigger('update'); + view.model.set('stackIndex', 1); + view.valueOnIndex(0).should.equal('func(4ddb,aAS5b,sS.6b)'); + view.valueOnIndex(1).should.equal('value3'); + (view.valueOnIndex(2) === null).should.equal(true); + }); + it('Build value from properties', function() { view.model.get('properties').at(0).set('value', propValue); view.model.get('properties').at(2).set('value', prop3Val);