aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorEric Guzman2012-05-21 12:02:08 -0700
committerEric Guzman2012-05-21 12:02:08 -0700
commitf71e8f853605f0eb4deaf16263124aac1aad9ee1 (patch)
tree408967d5df03bd80d90ad4223a02deb3f0db9f7d /js
parent83a777effad7b20fc9b1ad925de36a261c50451a (diff)
downloadninja-f71e8f853605f0eb4deaf16263124aac1aad9ee1.tar.gz
CSS Panel - Allow ":" to be used in selector field
Diffstat (limited to 'js')
-rw-r--r--js/components/editable.reel/editable.js6
-rw-r--r--js/components/hintable.reel/hintable.js46
-rw-r--r--js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js23
-rw-r--r--js/panels/css-panel/rule-list.reel/rule-list.js2
4 files changed, 31 insertions, 46 deletions
diff --git a/js/components/editable.reel/editable.js b/js/components/editable.reel/editable.js
index a6350359..eab73993 100644
--- a/js/components/editable.reel/editable.js
+++ b/js/components/editable.reel/editable.js
@@ -195,6 +195,7 @@ exports.Editable = Montage.create(Component, {
195 handleKeydown : { 195 handleKeydown : {
196 value : function(e) { 196 value : function(e) {
197 var k = e.keyCode; 197 var k = e.keyCode;
198 console.log("editable - keycode", k);
198 } 199 }
199 }, 200 },
200 201
@@ -269,10 +270,11 @@ exports.Editable = Montage.create(Component, {
269 }, 270 },
270 keyActions : { 271 keyActions : {
271 value : { 272 value : {
272 stop : [27,9,13,186], 273 stop : [27,9,13],
273 revert : [27], 274 revert : [27],
274 backsp : [8] 275 backsp : [8]
275 } 276 },
277 distinct: true
276 } 278 }
277 279
278}); \ No newline at end of file 280}); \ No newline at end of file
diff --git a/js/components/hintable.reel/hintable.js b/js/components/hintable.reel/hintable.js
index 6e3b2aaf..803770db 100644
--- a/js/components/hintable.reel/hintable.js
+++ b/js/components/hintable.reel/hintable.js
@@ -327,48 +327,8 @@ exports.Hintable = Montage.create(Editable, {
327 revert : [27], 327 revert : [27],
328 backsp : [8] 328 backsp : [8]
329 } 329 }
330 } 330 },
331 distinct: true
331 } 332 }
332 333
333}); 334}); \ No newline at end of file
334
335// suggest : {
336// value : function(hint) {
337// ///// if no hint argument passed, clear suggestions
338// if(!hint) {
339// this.clearHint();
340// return false;
341// }
342//
343// this._hint = hint;
344//
345// ///// append span with suggested hint
346// if(this.hintElement) {
347// this.clearHint();
348//
349// ///// Set the hint element's text
350// this._getFirstTextNode(this.hintElement).textContent = hint;
351//
352// ///// if hintElement was removed from the DOM, the object still
353// ///// exists, so it needs to be re-appended
354// if(this.hintElement.parentNode === null) {
355// this._element.appendChild(this.hintElement);
356// }
357// } else {
358// /// Remove the phantom "<BR>" element that is generated when
359// /// content editable element is empty
360// this._children(this._element, function(item) {
361// return item.nodeName === 'BR';
362// }).forEach(function(item) {
363// this._element.removeChild(item);
364// }, this);
365//
366// this.hintElement = document.createElement('span');
367// this.hintElement.classList.add(this.suggestClass);
368// this.hintElement.appendChild(document.createTextNode(hint));
369// this._element.appendChild(this.hintElement);
370// }
371//
372// this._hint = hint;
373// }
374// }, \ No newline at end of file
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 ac714bfa..71fe8470 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
@@ -115,6 +115,8 @@ exports.CssStyleRule = Montage.create(Component, {
115 }, 115 },
116 prepareForDraw : { 116 prepareForDraw : {
117 value: function() { 117 value: function() {
118 this.selectorField.keyActions = this.keyActions;
119
118 if(this.rule.type === 'inline') { 120 if(this.rule.type === 'inline') {
119 this.selectorField.readOnly = true; 121 this.selectorField.readOnly = true;
120 this.declarationComponent.type = 'inline'; 122 this.declarationComponent.type = 'inline';
@@ -144,5 +146,26 @@ exports.CssStyleRule = Montage.create(Component, {
144 this.element.classList.add(this.unappliedClass); 146 this.element.classList.add(this.unappliedClass);
145 } 147 }
146 } 148 }
149 },
150
151 keyActions : {
152 value : {
153 hint : {
154 accept : [9,13], // accept hint
155 stop : [27], // stop editing
156 next : [40], // cycle to next hint
157 prev : [38], // cycle to prev hint
158 revert : [27], // revert value
159 backsp : [8] // backspace hit
160 },
161 noHint : {
162 stop : [27,9,13],
163 next : [40],
164 prev : [38],
165 revert : [27],
166 backsp : [8]
167 }
168 },
169 distinct: true
147 } 170 }
148}); 171});
diff --git a/js/panels/css-panel/rule-list.reel/rule-list.js b/js/panels/css-panel/rule-list.reel/rule-list.js
index b7244a2c..2cd5ac5c 100644
--- a/js/panels/css-panel/rule-list.reel/rule-list.js
+++ b/js/panels/css-panel/rule-list.reel/rule-list.js
@@ -61,7 +61,7 @@ exports.RuleList = Montage.create(Component, {
61 // found rule in our component list, or it's the inline rule 61 // found rule in our component list, or it's the inline rule
62 ruleComponent.update(); 62 ruleComponent.update();
63 foundIndices.push(index); 63 foundIndices.push(index);
64 } else { 64 } else if(!rule.applied) { /// remove rule (unless unapplied)
65 this.rulesToRemove.push(ruleComponent); 65 this.rulesToRemove.push(ruleComponent);
66 } 66 }
67 }, this); 67 }, this);