aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/document/templates/montage-html/main.reel/main.js43
-rw-r--r--node_modules/components-data/textfield.json4
-rw-r--r--node_modules/montage/ui/text-input.js22
3 files changed, 48 insertions, 21 deletions
diff --git a/js/document/templates/montage-html/main.reel/main.js b/js/document/templates/montage-html/main.reel/main.js
index 567f481c..ee23e844 100644
--- a/js/document/templates/montage-html/main.reel/main.js
+++ b/js/document/templates/montage-html/main.reel/main.js
@@ -17,7 +17,25 @@ exports.Main = Montage.create(Component, {
17 */ 17 */
18 templateDidLoad: { 18 templateDidLoad: {
19 value: function(){ 19 value: function(){
20 window.addComponent = this.addComponentToUserDocument; 20 var self = this;
21 window.addComponent = function(element, data, callback) {
22 var component;
23
24 component = require.async(data.path)
25 .then(function(component) {
26 var componentRequire = component[data.name];
27 var componentInstance = componentRequire.create();
28
29 componentInstance.element = element;
30 //componentInstance.deserializedFromTemplate();
31 componentInstance.needsDraw = true;
32 componentInstance.ownerComponent = self;
33
34 callback(componentInstance, element);
35 })
36 .end();
37
38 };
21// window.addBinding = this.addBindingToUserDocument; 39// window.addBinding = this.addBindingToUserDocument;
22 40
23 // Dispatch event when this template has loaded. 41 // Dispatch event when this template has loaded.
@@ -29,26 +47,9 @@ exports.Main = Montage.create(Component, {
29 } 47 }
30 }, 48 },
31 49
32 // Adding components to the user document by using a async require. 50 location: {
33 addComponentToUserDocument:{ 51 value:null,
34 value:function(element, data, callback){ 52 enumerable:false
35
36 var component;
37
38 component = require.async(data.path)
39 .then(function(component) {
40 var componentRequire = component[data.name];
41 var componentInstance = componentRequire.create();
42
43 componentInstance.element = element;
44 //componentInstance.deserializedFromTemplate();
45 componentInstance.needsDraw = true;
46
47 callback(componentInstance, element);
48 })
49 .end();
50
51 }
52 } 53 }
53 54
54}); \ No newline at end of file 55}); \ No newline at end of file
diff --git a/node_modules/components-data/textfield.json b/node_modules/components-data/textfield.json
index 7164b8b3..39c65eab 100644
--- a/node_modules/components-data/textfield.json
+++ b/node_modules/components-data/textfield.json
@@ -7,6 +7,10 @@
7 7
8 "properties": [ 8 "properties": [
9 { 9 {
10 "name": "valueBinding",
11 "type": "string",
12 "default": null
13 },{
10 "name": "accept", 14 "name": "accept",
11 "type": "string", 15 "type": "string",
12 "default": null 16 "default": null
diff --git a/node_modules/montage/ui/text-input.js b/node_modules/montage/ui/text-input.js
index cdd20c78..d707fa69 100644
--- a/node_modules/montage/ui/text-input.js
+++ b/node_modules/montage/ui/text-input.js
@@ -79,6 +79,28 @@ var TextInput = exports.TextInput = Montage.create(NativeControl, {
79 } 79 }
80 }, 80 },
81 81
82 _valueBinding: {
83 value: null
84 },
85
86 valueBinding: {
87 get: function() {
88 return this._valueBinding;
89 },
90 set: function(value) {
91 if (this._valueBinding !== value) {
92 if (this._valueBinding !== null) {
93 Object.deleteBinding(this, "value");
94 }
95 this._valueBinding = value;
96 if (String.isString(value)) {
97 Object.defineBinding(this, "value", {boundObject: this.ownerComponent, boundObjectPropertyPath: value});
98
99 }
100 }
101 }
102 },
103
82 // set value from user input 104 // set value from user input
83 /** 105 /**
84 @private 106 @private