aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-31 11:04:35 -0700
committerValerio Virgillito2012-05-31 11:04:35 -0700
commit6042bdc5f2aada4412912fd01602d32c9088dc26 (patch)
treee3add0911bdf1dca441f2ed96b5cf0defe6b12fb /js/panels/css-panel
parent2ea84629a355a02d7eaa33464a0298ec4999073c (diff)
parent535a2fae0f4820f9b5a9f33cec250f11c0ee5bb9 (diff)
downloadninja-6042bdc5f2aada4412912fd01602d32c9088dc26.tar.gz
Merge pull request #261 from ericguzman/CSSPanelUpdates
CSS Panel Toolbar - Prevent warning regarding undefined sourceObject
Diffstat (limited to 'js/panels/css-panel')
-rw-r--r--js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js9
-rw-r--r--js/panels/css-panel/rule-list-container.reel/rule-list-container.js8
-rw-r--r--js/panels/css-panel/style-declaration.reel/style-declaration.css3
-rw-r--r--js/panels/css-panel/style-declaration.reel/style-declaration.js10
-rw-r--r--js/panels/css-panel/styles-view-delegate.js9
5 files changed, 30 insertions, 9 deletions
diff --git a/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js b/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js
index e0ffb1a8..54181bf3 100644
--- a/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js
+++ b/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js
@@ -88,6 +88,14 @@ exports.CssStyleRule = Montage.create(Component, {
88 } 88 }
89 } 89 }
90 }, 90 },
91 handleStop : {
92 value: function(e) {
93 if(this.focusDelegate) {
94 e._event.detail.preventDefault();
95 this.focusDelegate.handleSelectorStop(this.rule, this.selectorField.value, this);
96 }
97 }
98 },
91 handleMouseover: { 99 handleMouseover: {
92 value: function(e) { 100 value: function(e) {
93 if(this.focusDelegate) { 101 if(this.focusDelegate) {
@@ -125,6 +133,7 @@ exports.CssStyleRule = Montage.create(Component, {
125 this.declarationComponent.type = 'inline'; 133 this.declarationComponent.type = 'inline';
126 } else { 134 } else {
127 this.selectorField.addEventListener('change', this, false); 135 this.selectorField.addEventListener('change', this, false);
136 this.selectorField.addEventListener('stop', this, false);
128 this.selectorField.element.addEventListener('mouseover', this, false); 137 this.selectorField.element.addEventListener('mouseover', this, false);
129 this.selectorField.element.addEventListener('mouseout', this, false); 138 this.selectorField.element.addEventListener('mouseout', this, false);
130 } 139 }
diff --git a/js/panels/css-panel/rule-list-container.reel/rule-list-container.js b/js/panels/css-panel/rule-list-container.reel/rule-list-container.js
index e2e269ba..c7766d08 100644
--- a/js/panels/css-panel/rule-list-container.reel/rule-list-container.js
+++ b/js/panels/css-panel/rule-list-container.reel/rule-list-container.js
@@ -45,7 +45,7 @@ exports.RuleListContainer = Montage.create(Component, {
45 for(i = 0; i<this.ruleLists.length; i++) { 45 for(i = 0; i<this.ruleLists.length; i++) {
46 list = this.ruleLists[i]; 46 list = this.ruleLists[i];
47 47
48 if(selection.length > 1) { 48 if(selection.length === list.selection.length) {
49 matchesAll = selection.every(function(element, index, array) { 49 matchesAll = selection.every(function(element, index, array) {
50 return list.selection.indexOf(element) !== -1; 50 return list.selection.indexOf(element) !== -1;
51 }); 51 });
@@ -53,12 +53,6 @@ exports.RuleListContainer = Montage.create(Component, {
53 if(matchesAll) { 53 if(matchesAll) {
54 break; 54 break;
55 } 55 }
56 } else {
57 ///// Selection (single element or stylesheet) is the same,
58 ///// Use the existing rule list
59 if(list.selection[0] === selection[0]) {
60 break;
61 }
62 } 56 }
63 57
64 list = null; 58 list = null;
diff --git a/js/panels/css-panel/style-declaration.reel/style-declaration.css b/js/panels/css-panel/style-declaration.reel/style-declaration.css
index 6be8d33c..d4755b04 100644
--- a/js/panels/css-panel/style-declaration.reel/style-declaration.css
+++ b/js/panels/css-panel/style-declaration.reel/style-declaration.css
@@ -10,4 +10,7 @@
10} 10}
11.drag-over { 11.drag-over {
12 /*background-color: red;*/ 12 /*background-color: red;*/
13}
14.css-animation-prevent * {
15 -webkit-transition-duration: 0 !important;
13} \ No newline at end of file 16} \ No newline at end of file
diff --git a/js/panels/css-panel/style-declaration.reel/style-declaration.js b/js/panels/css-panel/style-declaration.reel/style-declaration.js
index 57cbdb63..6187989b 100644
--- a/js/panels/css-panel/style-declaration.reel/style-declaration.js
+++ b/js/panels/css-panel/style-declaration.reel/style-declaration.js
@@ -216,7 +216,15 @@ exports.StyleDeclaration = Montage.create(Component, {
216 }, 216 },
217 217
218 addNewStyle : { 218 addNewStyle : {
219 value: function() { 219 value: function(preventAnimation) {
220 if(preventAnimation) {
221 this.element.classList.add('css-animation-prevent');
222
223 setTimeout(function() {
224 this.element.classList.remove('css-animation-prevent');
225 }.bind(this), 1000);
226 }
227
220 this.addStyle('property', 'value', { 228 this.addStyle('property', 'value', {
221 isEmpty : true 229 isEmpty : true
222 }); 230 });
diff --git a/js/panels/css-panel/styles-view-delegate.js b/js/panels/css-panel/styles-view-delegate.js
index 454008fa..078bd521 100644
--- a/js/panels/css-panel/styles-view-delegate.js
+++ b/js/panels/css-panel/styles-view-delegate.js
@@ -75,6 +75,13 @@ exports.StylesViewDelegate = Montage.create(Component, {
75 this._dispatchChange(); 75 this._dispatchChange();
76 } 76 }
77 }, 77 },
78
79 handleSelectorStop : {
80 value: function(rule, newSelector, ruleComponent) {
81 ruleComponent.declarationComponent.repetition.childComponents[0].propertyField.start()
82 }
83 },
84
78 _getClassNameFromSelector : { 85 _getClassNameFromSelector : {
79 value: function(selectorText) { 86 value: function(selectorText) {
80 var results = /.*\.([A-Za-z0-9_-]+)\:?[A-Za-z0-9_"=-]*$/.exec(selectorText); 87 var results = /.*\.([A-Za-z0-9_-]+)\:?[A-Za-z0-9_"=-]*$/.exec(selectorText);
@@ -145,7 +152,7 @@ exports.StylesViewDelegate = Montage.create(Component, {
145 if(nextFocus) { 152 if(nextFocus) {
146 nextFocus.propertyField.start(); 153 nextFocus.propertyField.start();
147 } else if(style.dirty) { 154 } else if(style.dirty) {
148 style.parentComponent.parentComponent.addNewStyle(); 155 style.parentComponent.parentComponent.addNewStyle(true);
149 style.editingNewStyle = false; 156 style.editingNewStyle = false;
150 setTimeout(function() { 157 setTimeout(function() {
151 style.getSiblingStyle('next').propertyField.start(); 158 style.getSiblingStyle('next').propertyField.start();