From 16adb56d9333eb9686f24faa0380dc1c0cf16f5f Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Sat, 3 Dec 2016 14:50:47 +0100 Subject: [PATCH] Update configs --- src/demo.js | 1 + src/editor/config/config.js | 39 ++++++++++++- src/style_manager/config/config.js | 56 +++---------------- src/style_manager/view/PropertyIntegerView.js | 1 - src/style_manager/view/PropertyView.js | 4 +- 5 files changed, 47 insertions(+), 54 deletions(-) diff --git a/src/demo.js b/src/demo.js index f945b2bb3..6f0b8320e 100644 --- a/src/demo.js +++ b/src/demo.js @@ -329,5 +329,6 @@ require(['config/require-config'], function() { window.editor = editor; + }); }); diff --git a/src/editor/config/config.js b/src/editor/config/config.js index 484dd453d..92aa38019 100644 --- a/src/editor/config/config.js +++ b/src/editor/config/config.js @@ -38,9 +38,6 @@ define(function () { //Configurations for Canvas canvas: {}, - //Configurations for Style Manager - styleManager: {}, - //Configurations for Layers layers: {}, @@ -88,6 +85,42 @@ define(function () { }], }, + //Configurations for Style Manager + styleManager: { + + sectors: [{ + name: 'General', + open: false, + buildProps: ['float', 'display', 'position', 'top', 'right', 'left', 'bottom'], + },{ + name: 'Dimension', + open: false, + buildProps: ['width', 'height', 'max-width', 'min-height', 'margin', 'padding'], + },{ + name: 'Typography', + open: false, + buildProps: ['font-family', 'font-size', 'font-weight', 'letter-spacing', 'color', 'line-height', 'text-align', 'text-shadow'], + properties: [{ + property: 'text-align', + list : [ + {value: 'left', className: 'fa fa-align-left'}, + {value: 'center', className: 'fa fa-align-center' }, + {value: 'right', className: 'fa fa-align-right'}, + {value: 'justify', className: 'fa fa-align-justify'} + ], + }] + },{ + name: 'Decorations', + open: false, + buildProps: ['border-radius-c', 'background-color', 'border-radius', 'border', 'box-shadow', 'background'], + },{ + name: 'Extra', + open: false, + buildProps: ['transition', 'perspective', 'transform'], + }], + + }, + //Configurations for Block Manager blockManager: { 'blocks': [{ diff --git a/src/style_manager/config/config.js b/src/style_manager/config/config.js index fb9458bde..95aa96aa4 100644 --- a/src/style_manager/config/config.js +++ b/src/style_manager/config/config.js @@ -1,55 +1,13 @@ define(function () { - return { - stylePrefix: 'sm-', + return { - // Default sectors, which could include also properties - // - // Example: - // sectors: [{ - // name: 'Some sector name', - // properties:[{ - // name : 'Width', - // property : 'width', - // type : 'integer', - // units : ['px','%'], - // defaults : 'auto', - // min : 0, - // }], - // }] - sectors: [{ - name: 'General', - open: false, - buildProps: ['float', 'display', 'position', 'top', 'right', 'left', 'bottom'], - },{ - name: 'Dimension', - open: false, - buildProps: ['width', 'height', 'max-width', 'min-height', 'margin', 'padding'], - },{ - name: 'Typography', - open: false, - buildProps: ['font-family', 'font-size', 'font-weight', 'letter-spacing', 'color', 'line-height', 'text-align', 'text-shadow'], - properties: [{ - property: 'text-align', - list : [ - {value: 'left', className: 'fa fa-align-left'}, - {value: 'center', className: 'fa fa-align-center' }, - {value: 'right', className: 'fa fa-align-right'}, - {value: 'justify', className: 'fa fa-align-justify'} - ], - }] - },{ - name: 'Decorations', - open: false, - buildProps: ['border-radius-c', 'background-color', 'border-radius', 'border', 'box-shadow', 'background'], - },{ - name: 'Extra', - open: false, - buildProps: ['transition', 'perspective', 'transform'], - }], + stylePrefix: 'sm-', - // Text to show in case no element selected - textNoElement: 'Select an element before using Style Manager', + sectors: [], + // Text to show in case no element selected + textNoElement: 'Select an element before using Style Manager', + }; -}); \ No newline at end of file +}); diff --git a/src/style_manager/view/PropertyIntegerView.js b/src/style_manager/view/PropertyIntegerView.js index 7661a4c1e..e60411c3f 100644 --- a/src/style_manager/view/PropertyIntegerView.js +++ b/src/style_manager/view/PropertyIntegerView.js @@ -169,7 +169,6 @@ define(['backbone','./PropertyView', 'text!./../templates/propertyInteger.html'] if(this.$unit) this.$unit.val(u); - this.model.set({value: v, unit: u,}, {silent: true}); }, diff --git a/src/style_manager/view/PropertyView.js b/src/style_manager/view/PropertyView.js index 16b613204..09e51611d 100644 --- a/src/style_manager/view/PropertyView.js +++ b/src/style_manager/view/PropertyView.js @@ -28,6 +28,7 @@ define(['backbone', 'text!./../templates/propertyLabel.html', 'text!./../templat if(!this.model.get('value')) this.model.set('value', this.model.get('defaults')); + this.listenTo(this.model, 'destroy remove', this.remove); this.listenTo( this.propTarget, 'update', this.targetUpdated); this.listenTo( this.model ,'change:value', this.valueChanged); this.listenTo( this.model ,'targetUpdated', this.targetUpdated); @@ -58,8 +59,9 @@ define(['backbone', 'text!./../templates/propertyLabel.html', 'text!./../templat this.selectedComponent = this.propTarget.model; this.helperComponent = this.propTarget.helper; if(this.getTarget()){ - if(!this.sameValue()) + if(!this.sameValue()){ this.renderInputRequest(); + } } },