diff options
Diffstat (limited to 'js/document/models')
-rwxr-xr-x | js/document/models/base.js | 41 | ||||
-rwxr-xr-x | js/document/models/html.js | 25 |
2 files changed, 35 insertions, 31 deletions
diff --git a/js/document/models/base.js b/js/document/models/base.js index a3644815..5fa06259 100755 --- a/js/document/models/base.js +++ b/js/document/models/base.js | |||
@@ -68,12 +68,8 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
68 | //////////////////////////////////////////////////////////////////// | 68 | //////////////////////////////////////////////////////////////////// |
69 | // | 69 | // |
70 | selection: { | 70 | selection: { |
71 | get: function() { | 71 | get: function() {return this._selection;}, |
72 | return this._selection; | 72 | set: function(value) {this._selection = value;} |
73 | }, | ||
74 | set: function(value) { | ||
75 | this._selection = value; | ||
76 | } | ||
77 | }, | 73 | }, |
78 | //////////////////////////////////////////////////////////////////// | 74 | //////////////////////////////////////////////////////////////////// |
79 | // | 75 | // |
@@ -92,6 +88,11 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
92 | }, | 88 | }, |
93 | //////////////////////////////////////////////////////////////////// | 89 | //////////////////////////////////////////////////////////////////// |
94 | // | 90 | // |
91 | libs: { | ||
92 | value: null | ||
93 | }, | ||
94 | //////////////////////////////////////////////////////////////////// | ||
95 | // | ||
95 | switchViewTo: { | 96 | switchViewTo: { |
96 | value: function (view) { | 97 | value: function (view) { |
97 | // | 98 | // |
@@ -167,8 +168,9 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
167 | // | 168 | // |
168 | if (this.currentView === this.views.design) { | 169 | if (this.currentView === this.views.design) { |
169 | // | 170 | // |
170 | this.application.ninja.ioMediator.fileSave({ | 171 | var save = this.application.ninja.ioMediator.fileSave({ |
171 | mode: 'html', | 172 | mode: 'html', |
173 | libs: this.libs, | ||
172 | file: this.file, | 174 | file: this.file, |
173 | webgl: this.webGlHelper.glData, | 175 | webgl: this.webGlHelper.glData, |
174 | styles: this.getStyleSheets(), | 176 | styles: this.getStyleSheets(), |
@@ -178,6 +180,17 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
178 | body: this.views.design.iframe.contentWindow.document.body, | 180 | body: this.views.design.iframe.contentWindow.document.body, |
179 | mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator | 181 | mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator |
180 | }, this.handleSaved.bind({callback: callback, model: this}), libCopyCallback); | 182 | }, this.handleSaved.bind({callback: callback, model: this}), libCopyCallback); |
183 | //TODO: Improve detection during save routine | ||
184 | if (save) { | ||
185 | if (save.montageId) { | ||
186 | this.libs.montageId = save.montageId; | ||
187 | this.libs.montage = true; | ||
188 | } | ||
189 | if (save.canvasId) { | ||
190 | this.libs.canvasId = save.canvasId; | ||
191 | this.libs.canvas = true; | ||
192 | } | ||
193 | } | ||
181 | } else { | 194 | } else { |
182 | //TODO: Add logic to save code view data | 195 | //TODO: Add logic to save code view data |
183 | } | 196 | } |
@@ -196,8 +209,9 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
196 | // | 209 | // |
197 | if (this.currentView === this.views.design) { | 210 | if (this.currentView === this.views.design) { |
198 | // | 211 | // |
199 | this.application.ninja.ioMediator.fileSave({ | 212 | var save = this.application.ninja.ioMediator.fileSave({ |
200 | mode: 'html', | 213 | mode: 'html', |
214 | libs: this.libs, | ||
201 | file: this.file, | 215 | file: this.file, |
202 | webgl: this.webGlHelper.glData, | 216 | webgl: this.webGlHelper.glData, |
203 | css: this.getStyleSheets(), | 217 | css: this.getStyleSheets(), |
@@ -207,6 +221,17 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
207 | body: this.views.design.iframe.contentWindow.document.body, | 221 | body: this.views.design.iframe.contentWindow.document.body, |
208 | mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator | 222 | mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator |
209 | }, this.handleSaved.bind({callback: callback, model: this}), libCopyCallback); | 223 | }, this.handleSaved.bind({callback: callback, model: this}), libCopyCallback); |
224 | //TODO: Improve detection during save routine | ||
225 | if (save) { | ||
226 | if (save.montageId) { | ||
227 | this.libs.montageId = save.montageId; | ||
228 | this.libs.montage = true; | ||
229 | } | ||
230 | if (save.canvasId) { | ||
231 | this.libs.canvasId = save.canvasId; | ||
232 | this.libs.canvas = true; | ||
233 | } | ||
234 | } | ||
210 | } else { | 235 | } else { |
211 | //TODO: Add logic to save code view data | 236 | //TODO: Add logic to save code view data |
212 | } | 237 | } |
diff --git a/js/document/models/html.js b/js/document/models/html.js index 0f88229d..7064c6e3 100755 --- a/js/document/models/html.js +++ b/js/document/models/html.js | |||
@@ -23,6 +23,8 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { | |||
23 | value:function() { | 23 | value:function() { |
24 | //Creating instance of the webGL helper for this model | 24 | //Creating instance of the webGL helper for this model |
25 | this.webGlHelper = webGlDocumentHelper.create(); | 25 | this.webGlHelper = webGlDocumentHelper.create(); |
26 | // | ||
27 | this.libs = {montage: false, canvas: false, montageId: null, canvasId: null}; | ||
26 | } | 28 | } |
27 | }, | 29 | }, |
28 | //////////////////////////////////////////////////////////////////// | 30 | //////////////////////////////////////////////////////////////////// |
@@ -73,29 +75,6 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { | |||
73 | value: null | 75 | value: null |
74 | }, | 76 | }, |
75 | //////////////////////////////////////////////////////////////////// | 77 | //////////////////////////////////////////////////////////////////// |
76 | // | ||
77 | userComponents: { | ||
78 | value: {} | ||
79 | }, | ||
80 | //////////////////////////////////////////////////////////////////// | ||
81 | //Add a reference to a component instance to the userComponents hash using the element UUID | ||
82 | setComponentInstance: { | ||
83 | value: function(instance, el) { | ||
84 | this.userComponents[el.uuid] = instance; | ||
85 | } | ||
86 | }, | ||
87 | //////////////////////////////////////////////////////////////////// | ||
88 | //Returns the component instance obj from the element | ||
89 | getComponentFromElement: { | ||
90 | value: function(el) { | ||
91 | if(el) { | ||
92 | if(el.uuid) return this.userComponents[el.uuid]; | ||
93 | } else { | ||
94 | return null; | ||
95 | } | ||
96 | } | ||
97 | } | ||
98 | //////////////////////////////////////////////////////////////////// | ||
99 | //////////////////////////////////////////////////////////////////// | 78 | //////////////////////////////////////////////////////////////////// |
100 | }); | 79 | }); |
101 | //////////////////////////////////////////////////////////////////////// | 80 | //////////////////////////////////////////////////////////////////////// |