aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel/declaration.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/css-panel/declaration.reel')
-rw-r--r--js/panels/css-panel/declaration.reel/declaration.js32
1 files changed, 29 insertions, 3 deletions
diff --git a/js/panels/css-panel/declaration.reel/declaration.js b/js/panels/css-panel/declaration.reel/declaration.js
index 873d2ce4..8ab19ad6 100644
--- a/js/panels/css-panel/declaration.reel/declaration.js
+++ b/js/panels/css-panel/declaration.reel/declaration.js
@@ -9,6 +9,9 @@ var Montage = require("montage/core/core").Montage,
9 ShorthandProps = require("js/panels/CSSPanel/css-shorthand-map"); 9 ShorthandProps = require("js/panels/CSSPanel/css-shorthand-map");
10 10
11exports.Declaration = Montage.create(Component, { 11exports.Declaration = Montage.create(Component, {
12 cssText : {
13 value: null
14 },
12 focusDelegate : { 15 focusDelegate : {
13 value: null 16 value: null
14 }, 17 },
@@ -42,6 +45,8 @@ exports.Declaration = Montage.create(Component, {
42 set: function(dec) { 45 set: function(dec) {
43 this._declaration = dec; 46 this._declaration = dec;
44 47
48 this.cssText = dec.cssText;
49
45 ///// creates data structure to use with tree component 50 ///// creates data structure to use with tree component
46 this.buildStyleTree(); 51 this.buildStyleTree();
47 52
@@ -52,11 +57,34 @@ exports.Declaration = Montage.create(Component, {
52 "isEmpty": true 57 "isEmpty": true
53 }); 58 });
54 } 59 }
55//debugger; 60
56 this.needsDraw = true; 61 this.needsDraw = true;
57 } 62 }
58 }, 63 },
59 64
65 update : {
66 value: function() {
67 if(this.declaration.cssText !== this.cssText) {
68 ///// Needs update
69 this.treeController.branchControllers[0].content.forEach(function(obj) {
70 this.treeController.branchControllers[0].removeObjects(obj);
71 }, this );
72
73 this.buildStyleTree();
74
75 if(this.includeEmptyStyle) {
76 this.styleTree.properties.push({
77 "name": "property",
78 "value" : "value",
79 "isEmpty": true
80 });
81 }
82//debugger;
83 this.needsDraw = true;
84 }
85 }
86 },
87
60 buildStyleTree : { 88 buildStyleTree : {
61 value: function() { 89 value: function() {
62 var styles = Array.prototype.slice.call(this._declaration).sort(); 90 var styles = Array.prototype.slice.call(this._declaration).sort();
@@ -124,8 +152,6 @@ exports.Declaration = Montage.create(Component, {
124 152
125 addNewStyleAfter : { 153 addNewStyleAfter : {
126 value: function(style) { 154 value: function(style) {
127 //this.treeController.branchControllers[0].addObjects({
128 foo1 = style.parentComponent.parentComponent;
129 style.parentComponent.parentComponent.contentController.addObjects({ 155 style.parentComponent.parentComponent.contentController.addObjects({
130 name: 'property', 156 name: 'property',
131 value: 'value', 157 value: 'value',