diff options
author | Valerio Virgillito | 2012-02-13 21:43:51 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-13 21:43:51 -0800 |
commit | 081f17954c735fc8b946d72a25b0ee60d370ef9b (patch) | |
tree | de7b50f2d02365df897ef4356f953d3833c9cabd /js/components | |
parent | 47df0aff81c25334b129047bb227ea5015357eda (diff) | |
parent | 1d82f1a041612f32bbf6c9f20d9fb14e2d11fcc7 (diff) | |
download | ninja-081f17954c735fc8b946d72a25b0ee60d370ef9b.tar.gz |
Merge branch 'refs/heads/master' into components
Conflicts:
js/components/treeview/ninja-leaf.reel/ninja-leaf.js
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/components')
-rw-r--r-- | js/components/button.reel/button.js | 2 | ||||
-rw-r--r-- | js/components/colorwheel.reel/compass_app_log.txt | 3 | ||||
-rw-r--r-- | js/components/editable.reel/editable.js | 250 | ||||
-rw-r--r-- | js/components/hintable.reel/hintable.js | 360 | ||||
-rw-r--r-- | js/components/layout/bread-crumb.reel/bread-crumb.js | 108 | ||||
-rw-r--r-- | js/components/package.json | 8 | ||||
-rw-r--r-- | js/components/popup.reel/compass_app_log.txt | 48 | ||||
-rw-r--r-- | js/components/tools-properties/text-properties.reel/text-properties.css | 30 | ||||
-rw-r--r-- | js/components/tools-properties/text-properties.reel/text-properties.html | 326 | ||||
-rw-r--r-- | js/components/tools-properties/text-properties.reel/text-properties.js | 236 | ||||
-rw-r--r-- | js/components/treeview/ninja-branch.reel/ninja-branch.html | 3 | ||||
-rw-r--r-- | js/components/treeview/ninja-branch.reel/ninja-branch.js | 1 | ||||
-rw-r--r-- | js/components/treeview/ninja-leaf.reel/ninja-leaf.html | 2 | ||||
-rw-r--r-- | js/components/treeview/ninja-leaf.reel/ninja-leaf.js | 42 | ||||
-rw-r--r-- | js/components/ui/color-chip.reel/color-chip.js | 64 |
15 files changed, 1238 insertions, 245 deletions
diff --git a/js/components/button.reel/button.js b/js/components/button.reel/button.js index ce5ac1af..2d26c8b4 100644 --- a/js/components/button.reel/button.js +++ b/js/components/button.reel/button.js | |||
@@ -179,7 +179,7 @@ var Button = exports.Button = Montage.create(Component, { | |||
179 | value: function() { | 179 | value: function() { |
180 | if(this.isToggleButton) | 180 | if(this.isToggleButton) |
181 | { | 181 | { |
182 | if(this._value) | 182 | if(this._value === true) |
183 | { | 183 | { |
184 | this.element.classList.remove(this.offState); | 184 | this.element.classList.remove(this.offState); |
185 | this.element.classList.add(this.onState); | 185 | this.element.classList.add(this.onState); |
diff --git a/js/components/colorwheel.reel/compass_app_log.txt b/js/components/colorwheel.reel/compass_app_log.txt deleted file mode 100644 index 815feb02..00000000 --- a/js/components/colorwheel.reel/compass_app_log.txt +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | 2011-11-23 01:07:12 create css/colorwheel.css | ||
2 | 2011-11-23 01:07:25 overwrite css/colorwheel.css | ||
3 | 2011-12-20 17:04:05 overwrite css/colorwheel.css | ||
diff --git a/js/components/editable.reel/editable.js b/js/components/editable.reel/editable.js new file mode 100644 index 00000000..1d0ad776 --- /dev/null +++ b/js/components/editable.reel/editable.js | |||
@@ -0,0 +1,250 @@ | |||
1 | /* ComputedStyleSubPanel.js */ | ||
2 | var Montage = require("montage").Montage, | ||
3 | Component = require("montage/ui/component").Component; | ||
4 | |||
5 | |||
6 | /* | ||
7 | |||
8 | EDITABLE - Methods | ||
9 | - startEdit | ||
10 | - stopEdit | ||
11 | - value | ||
12 | - | ||
13 | - _suggest | ||
14 | - _suggestNext | ||
15 | - _suggestPrev | ||
16 | - _clearSuggest | ||
17 | - _accept | ||
18 | - _revert | ||
19 | - _setCaret | ||
20 | |||
21 | */ | ||
22 | |||
23 | |||
24 | exports.Editable = Montage.create(Component, { | ||
25 | hasTemplate: { value: false }, | ||
26 | |||
27 | _element : { value : null }, | ||
28 | element : { | ||
29 | get : function() { | ||
30 | return this._element; | ||
31 | }, | ||
32 | set : function(el) { | ||
33 | this._element = el; | ||
34 | this._element.addEventListener('keydown', this, false); | ||
35 | this._element.addEventListener('input', this, false); | ||
36 | |||
37 | if(this.startOnEvent) { | ||
38 | this._element.addEventListener(this.startOnEvent, this, false); | ||
39 | } | ||
40 | |||
41 | } | ||
42 | }, | ||
43 | _readOnly : { | ||
44 | value: false | ||
45 | }, | ||
46 | readOnly : { | ||
47 | get : function() { return this._readOnly; }, | ||
48 | set : function(makeReadOnly) { | ||
49 | var action = makeReadOnly ? 'add' : 'remove'; | ||
50 | |||
51 | this._element.classList[action](this.readOnlyClass); | ||
52 | |||
53 | if(this.isEditable) { | ||
54 | this.stop(); | ||
55 | } | ||
56 | this._readOnly = makeReadOnly; | ||
57 | } | ||
58 | }, | ||
59 | _isEditable : { | ||
60 | value : false | ||
61 | }, | ||
62 | isEditable : { | ||
63 | get : function() { | ||
64 | return this._isEditable; | ||
65 | }, | ||
66 | set: function(makeEditable) { | ||
67 | if(this._readOnly && makeEditable) { return false; } | ||
68 | this._isEditable = makeEditable; | ||
69 | } | ||
70 | }, | ||
71 | _isDirty : { | ||
72 | value: false | ||
73 | }, | ||
74 | isDirty : { | ||
75 | get : function() { | ||
76 | return this._isDirty; | ||
77 | }, | ||
78 | set : function(setDirty) { | ||
79 | if(setDirty) { | ||
80 | this._isDirty = true; | ||
81 | this._sendEvent('dirty'); | ||
82 | } else { | ||
83 | this._isDirty = false; | ||
84 | } | ||
85 | } | ||
86 | }, | ||
87 | value : { | ||
88 | get: function() { | ||
89 | return this._element.textContent; | ||
90 | }, | ||
91 | set: function(str) { | ||
92 | this._element.textContent = str; | ||
93 | } | ||
94 | }, | ||
95 | |||
96 | ///// Pre Edit Value | ||
97 | ///// Value stored when editing starts | ||
98 | ///// Useful for reverting to previous value | ||
99 | |||
100 | _preEditValue : { | ||
101 | value : null | ||
102 | }, | ||
103 | start : { | ||
104 | value: function() { | ||
105 | if(!this._readOnly) { | ||
106 | this._isEditable = this._element.contentEditable = true; | ||
107 | this._element.classList.add(this.editingClass); | ||
108 | |||
109 | ///// Save the preEditValue | ||
110 | this._preEditValue = this.value; | ||
111 | |||
112 | if(this.selectOnStart) { | ||
113 | this.selectAll(); | ||
114 | } | ||
115 | |||
116 | if(this.stopOnBlur) { | ||
117 | console.log('adding mousedown event listener'); | ||
118 | ///// Simulate blur on editable node by listening to the doc | ||
119 | document.addEventListener('mouseup', this, false); | ||
120 | } | ||
121 | |||
122 | this._sendEvent('start'); | ||
123 | } | ||
124 | |||
125 | } | ||
126 | }, | ||
127 | stop : { | ||
128 | value: function() { | ||
129 | this._isEditable = this._element.contentEditable = false; | ||
130 | this._element.classList.remove(this.editingClass); | ||
131 | |||
132 | this._sendEvent('stop'); | ||
133 | |||
134 | ///// if value is different than pre-edit val, call onchange method | ||
135 | if(this._preEditValue !== this.value) { | ||
136 | this._sendEvent('change'); | ||
137 | } | ||
138 | } | ||
139 | }, | ||
140 | selectAll : { | ||
141 | value : function() { | ||
142 | var range = document.createRange(), | ||
143 | sel = window.getSelection(); | ||
144 | |||
145 | sel.removeAllRanges(); | ||
146 | range.selectNodeContents(this._element); | ||
147 | sel.addRange(range); | ||
148 | } | ||
149 | }, | ||
150 | setCursor : { | ||
151 | value : function(position) { | ||
152 | var index = position, | ||
153 | range, node, sel; | ||
154 | |||
155 | ///// argument can be "end" or an index | ||
156 | if(typeof position === 'string' && position === 'end') { | ||
157 | index = this.value.length; | ||
158 | } | ||
159 | |||
160 | sel = window.getSelection(); | ||
161 | sel.removeAllRanges(); | ||
162 | //debugger; | ||
163 | node = this._getFirstTextNode(); | ||
164 | range = document.createRange(); | ||
165 | range.setStart(node, index); | ||
166 | range.setEnd(node, index); | ||
167 | sel.addRange(range); | ||
168 | } | ||
169 | }, | ||
170 | blur : { | ||
171 | value : function() { | ||
172 | if(this._hint) { | ||
173 | this.accept(); | ||
174 | } | ||
175 | this.stop(); | ||
176 | document.removeEventListener('mouseup', this, false); | ||
177 | this._sendEvent('blur'); | ||
178 | } | ||
179 | }, | ||
180 | |||
181 | /* -------------------- User Event Handling -------------------- */ | ||
182 | |||
183 | handleKeydown : { | ||
184 | value : function(e) { | ||
185 | var k = e.keyCode; | ||
186< |