diff options
Diffstat (limited to 'js/components')
7 files changed, 141 insertions, 47 deletions
diff --git a/js/components/editable.reel/editable.js b/js/components/editable.reel/editable.js index 103e418f..88b93b2c 100644 --- a/js/components/editable.reel/editable.js +++ b/js/components/editable.reel/editable.js | |||
@@ -93,12 +93,43 @@ exports.Editable = Montage.create(Component, { | |||
93 | } | 93 | } |
94 | } | 94 | } |
95 | }, | 95 | }, |
96 | |||
97 | _value : { value: null }, | ||
96 | value : { | 98 | value : { |
97 | get: function() { | 99 | get : function() { return this._value; }, |
98 | return this._element.textContent; | 100 | set : function(value) { |
99 | }, | 101 | if(value === this._value) { return; } |
100 | set: function(str) { | 102 | |
101 | this._element.textContent = str; | 103 | var node = this._getFirstTextNode(); |
104 | node.textContent = value; | ||
105 | |||
106 | this._value = value; | ||
107 | } | ||
108 | }, | ||
109 | _getFirstTextNode : { | ||
110 | value : function(el) { | ||
111 | ///// optional el argument specified container element | ||
112 | var e = el || this._element, | ||
113 | nodes = e.childNodes, node; | ||
114 | |||
115 | if(nodes.length) { | ||
116 | for(var i=0; i<nodes.length; i++) { | ||
117 | if(nodes[i].nodeType === 3) { | ||
118 | ///// found the first text node | ||
119 | node = nodes[i]; | ||
120 | break; | ||
121 | } | ||
122 | } | ||
123 | } | ||
124 | |||
125 | ///// Text node not found | ||
126 | if(!node) { | ||
127 | node = document.createTextNode(''); | ||
128 | e.appendChild(node); | ||
129 | } | ||
130 | |||
131 | |||
132 | return node; | ||
102 | } | 133 | } |
103 | }, | 134 | }, |
104 | 135 | ||
@@ -207,6 +238,8 @@ exports.Editable = Montage.create(Component, { | |||
207 | ///// Text input has changed values | 238 | ///// Text input has changed values |
208 | handleInput : { | 239 | handleInput : { |
209 | value : function(e) { | 240 | value : function(e) { |
241 | this.value = this._getFirstTextNode().textContent; | ||
242 | |||
210 | if(!this.isDirty) { | 243 | if(!this.isDirty) { |
211 | this.isDirty = true; | 244 | this.isDirty = true; |
212 | } | 245 | } |
@@ -230,6 +263,8 @@ exports.Editable = Montage.create(Component, { | |||
230 | value: function(e) { | 263 | value: function(e) { |
231 | e.preventDefault(); | 264 | e.preventDefault(); |
232 | document.execCommand('insertHTML', null, e._event.clipboardData.getData("Text")); | 265 | document.execCommand('insertHTML', null, e._event.clipboardData.getData("Text")); |
266 | this.value = this._element.textContent; | ||
267 | |||
233 | this._sendEvent('paste', e); | 268 | this._sendEvent('paste', e); |
234 | } | 269 | } |
235 | }, | 270 | }, |
diff --git a/js/components/hintable.reel/hintable.js b/js/components/hintable.reel/hintable.js index 803770db..d09cdbd2 100644 --- a/js/components/hintable.reel/hintable.js +++ b/js/components/hintable.reel/hintable.js | |||
@@ -140,15 +140,6 @@ exports.Hintable = Montage.create(Editable, { | |||
140 | } | 140 | } |
141 | } | 141 | } |
142 | }, | 142 | }, |
143 | value : { | ||
144 | get: function() { | ||
145 | return this._getFirstTextNode().textContent; | ||
146 | }, | ||
147 | set: function(str) { | ||
148 | var node = this._getFirstTextNode(); | ||
149 | node.textContent = str; | ||
150 | } | ||
151 | }, | ||
152 | 143 | ||
153 | handleKeydown : { | 144 | handleKeydown : { |
154 | value : function handleKeydown(e) { | 145 | value : function handleKeydown(e) { |
@@ -185,17 +176,18 @@ exports.Hintable = Montage.create(Editable, { | |||
185 | handleInput : { | 176 | handleInput : { |
186 | value : function handleInput(e) { | 177 | value : function handleInput(e) { |
187 | this._super(arguments); | 178 | this._super(arguments); |
188 | 179 | ||
189 | var val = this.value, | 180 | var val = this.value, |
190 | matches, hint; | 181 | matches, hint; |
191 | //console.log('val = "' + val + '"'); | 182 | //console.log('val = "' + val + '"'); |
192 | //// Handle auto-suggest if configured | 183 | //// Handle auto-suggest if configured |
193 | if(this.hints instanceof Array) { | 184 | if(this.hints && this.hints.length) { |
194 | 185 | ||
195 | if(val.length > 0) { // content is not empty | 186 | if(val.length > 0) { // content is not empty |
196 | 187 | ||
197 | this._matchIndex = 0; | 188 | this._matchIndex = 0; |
198 | this.matches = this.hints.filter(function(h) { | 189 | this.matches = this.hints.filter(function(h) { |
190 | if(!h) { return false; } | ||
199 | return h.indexOf(val) === 0; | 191 | return h.indexOf(val) === 0; |
200 | }).sort(); | 192 | }).sort(); |
201 | 193 | ||
@@ -271,32 +263,6 @@ exports.Hintable = Montage.create(Editable, { | |||
271 | return Array.prototype.slice.call(arrayLikeObj); | 263 | return Array.prototype.slice.call(arrayLikeObj); |
272 | } | 264 | } |
273 | }, | 265 | }, |
274 | _getFirstTextNode : { | ||
275 | value : function(el) { | ||
276 | ///// optional el argument specified container element | ||
277 | var e = el || this._element, | ||
278 | nodes = e.childNodes, node; | ||
279 | |||
280 | if(nodes.length) { | ||
281 | for(var i=0; i<nodes.length; i++) { | ||
282 | if(nodes[i].nodeType === 3) { | ||
283 | ///// found the first text node | ||
284 | node = nodes[i]; | ||
285 | break; | ||
286 | } | ||
287 | } | ||
288 | } | ||
289 | |||
290 | ///// Text node not found | ||
291 | if(!node) { | ||
292 | node = document.createTextNode(''); | ||
293 | e.appendChild(node); | ||
294 | } | ||
295 | |||
296 | |||
297 | return node; | ||
298 | } | ||
299 | }, | ||
300 | _super : { | 266 | _super : { |
301 | value : function(args) { | 267 | value : function(args) { |
302 | this.inheritsFrom[arguments.callee.caller.name].apply(this, args); | 268 | this.inheritsFrom[arguments.callee.caller.name].apply(this, args); |
@@ -305,7 +271,8 @@ exports.Hintable = Montage.create(Editable, { | |||
305 | 271 | ||
306 | /* --------- CONFIG ---------- */ | 272 | /* --------- CONFIG ---------- */ |
307 | hints : { | 273 | hints : { |
308 | value : ['Testing a hint.', 'Testing another hint.', 'Testing the last hint.'] | 274 | value : ['Testing a hint.', 'Testing another hint.', 'Testing the last hint.'], |
275 | distinct: true | ||
309 | }, | 276 | }, |
310 | hintClass : { | 277 | hintClass : { |
311 | value : "hintable-hint" | 278 | value : "hintable-hint" |
diff --git a/js/components/layout/tools-list.reel/tools-list.html b/js/components/layout/tools-list.reel/tools-list.html index 3a9661f5..5b175f49 100755 --- a/js/components/layout/tools-list.reel/tools-list.html +++ b/js/components/layout/tools-list.reel/tools-list.html | |||
@@ -1,4 +1,4 @@ | |||
1 | <!DOCTYPE HTML> | 1 | <!DOCTYPE HTML> |
2 | <!-- <copyright> | 2 | <!-- <copyright> |
3 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | 3 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> |
4 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | 4 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> |
@@ -95,6 +95,9 @@ | |||
95 | "ZoomTool1": { | 95 | "ZoomTool1": { |
96 | "prototype": "js/tools/ZoomTool" | 96 | "prototype": "js/tools/ZoomTool" |
97 | }, | 97 | }, |
98 | "BindingTool1": { | ||
99 | "prototype": "js/tools/BindingTool" | ||
100 | }, | ||
98 | 101 | ||
99 | "disable": { | 102 | "disable": { |
100 | "prototype": "montage/ui/condition.reel", | 103 | "prototype": "montage/ui/condition.reel", |
@@ -126,7 +129,11 @@ | |||
126 | "EraserTool": {"@": "EraserTool1"}, | 129 | "EraserTool": {"@": "EraserTool1"}, |
127 | "RotateStageTool3D": {"@": "RotateStageTool3D1"}, | 130 | "RotateStageTool3D": {"@": "RotateStageTool3D1"}, |
128 | "PanTool": {"@": "PanTool1"}, | 131 | "PanTool": {"@": "PanTool1"}, |
129 | "ZoomTool": {"@": "ZoomTool1"} | 132 | "ZoomTool": {"@": "ZoomTool1"}, |
133 | "bindingTool": {"@": "BindingTool1"}, | ||
134 | "components": [ | ||
135 | {"@": "repetition1"} | ||
136 | ] | ||
130 | } | 137 | } |
131 | } | 138 | } |
132 | } | 139 | } |
diff --git a/js/components/layout/tools-properties.reel/tools-properties.html b/js/components/layout/tools-properties.reel/tools-properties.html index 6b766532..07444010 100755 --- a/js/components/layout/tools-properties.reel/tools-properties.html +++ b/js/components/layout/tools-properties.reel/tools-properties.html | |||
@@ -1,4 +1,4 @@ | |||
1 | <!DOCTYPE HTML> | 1 | <!DOCTYPE HTML> |
2 | <!-- <copyright> | 2 | <!-- <copyright> |
3 | This file contai |