diff options
Diffstat (limited to 'js/document')
-rwxr-xr-x | js/document/document-html.js | 2 | ||||
-rwxr-xr-x | js/document/models/html.js | 10 | ||||
-rwxr-xr-x | js/document/views/design.js | 10 |
3 files changed, 19 insertions, 3 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js index 8cc61026..33a41a8e 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js | |||
@@ -62,6 +62,8 @@ exports.HtmlDocument = Montage.create(Component, { | |||
62 | parentContainer: {value: document.getElementById("iframeContainer")}, //Saving reference to parent container of all views (should be changed to buckets approach | 62 | parentContainer: {value: document.getElementById("iframeContainer")}, //Saving reference to parent container of all views (should be changed to buckets approach |
63 | views: {value: {'design': DesignDocumentView.create(), 'code': null}} //TODO: Add code view logic | 63 | views: {value: {'design': DesignDocumentView.create(), 'code': null}} //TODO: Add code view logic |
64 | }); | 64 | }); |
65 | //Calling the any init routines in the model | ||
66 | this.model.init(); | ||
65 | //Initiliazing views and hiding | 67 | //Initiliazing views and hiding |
66 | if (this.model.views.design.initialize(this.model.parentContainer)) { | 68 | if (this.model.views.design.initialize(this.model.parentContainer)) { |
67 | //Hiding iFrame, just initiliazing | 69 | //Hiding iFrame, just initiliazing |
diff --git a/js/document/models/html.js b/js/document/models/html.js index 9f5599a2..9aa0d27e 100755 --- a/js/document/models/html.js +++ b/js/document/models/html.js | |||
@@ -18,6 +18,14 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { | |||
18 | value: false | 18 | value: false |
19 | }, | 19 | }, |
20 | //////////////////////////////////////////////////////////////////// | 20 | //////////////////////////////////////////////////////////////////// |
21 | //Called by the document immidiately after the model is created | ||
22 | init: { | ||
23 | value:function() { | ||
24 | //Creating instance of the webGL helper for this model | ||
25 | this.webGlHelper = webGlDocumentHelper.create(); | ||
26 | } | ||
27 | }, | ||
28 | //////////////////////////////////////////////////////////////////// | ||
21 | // | 29 | // |
22 | selectionContainer: { | 30 | selectionContainer: { |
23 | value: [] | 31 | value: [] |
@@ -52,7 +60,7 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { | |||
52 | //////////////////////////////////////////////////////////////////// | 60 | //////////////////////////////////////////////////////////////////// |
53 | // | 61 | // |
54 | webGlHelper: { | 62 | webGlHelper: { |
55 | value: webGlDocumentHelper | 63 | value: null |
56 | }, | 64 | }, |
57 | //////////////////////////////////////////////////////////////////// | 65 | //////////////////////////////////////////////////////////////////// |
58 | // | 66 | // |
diff --git a/js/document/views/design.js b/js/document/views/design.js index dd8754ed..9aeb370a 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js | |||
@@ -124,7 +124,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
124 | // | 124 | // |
125 | onTemplateLoad: { | 125 | onTemplateLoad: { |
126 | value: function (e) { | 126 | value: function (e) { |
127 | //console.log(this.iframe.contentWindow); | 127 | //TODO: Remove, this is a temp patch for webRequest API gate |
128 | this.application.ninja.documentController.redirectRequests = true; | 128 | this.application.ninja.documentController.redirectRequests = true; |
129 | //TODO: Add support to constructing URL with a base HREF | 129 | //TODO: Add support to constructing URL with a base HREF |
130 | var basetag = this.content.document.getElementsByTagName('base'); | 130 | var basetag = this.content.document.getElementsByTagName('base'); |
@@ -240,7 +240,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
240 | this.document.body.removeChild(this.document.getElementsByTagName('ninjaloadinghack')[0]); | 240 | this.document.body.removeChild(this.document.getElementsByTagName('ninjaloadinghack')[0]); |
241 | //Getting style and link tags in document | 241 | //Getting style and link tags in document |
242 | var stags = this.document.getElementsByTagName('style'), | 242 | var stags = this.document.getElementsByTagName('style'), |
243 | ltags = this.document.getElementsByTagName('link'), i, | 243 | ltags = this.document.getElementsByTagName('link'), i, orgNodes, |
244 | scripttags = this.document.getElementsByTagName('script'); | 244 | scripttags = this.document.getElementsByTagName('script'); |
245 | //Temporarily checking for disabled special case (we must enabled for Ninja to access styles) | 245 | //Temporarily checking for disabled special case (we must enabled for Ninja to access styles) |
246 | this.ninjaDisableAttribute(stags); | 246 | this.ninjaDisableAttribute(stags); |
@@ -281,6 +281,12 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
281 | } | 281 | } |
282 | //Storing node list for reference (might need to store in the model) | 282 | //Storing node list for reference (might need to store in the model) |
283 | this._liveNodeList = this.model.documentRoot.getElementsByTagName('*'); | 283 | this._liveNodeList = this.model.documentRoot.getElementsByTagName('*'); |
284 | //Getting list of original nodes | ||
285 | orgNodes = this.document.getElementsByTagName('*'); | ||
286 | //TODO: Figure out if this is ideal for identifying nodes created by Ninja | ||
287 | for (var n in orgNodes) { | ||
288 | if (orgNodes[n].getAttribute) orgNodes[n].setAttribute('data-ninja-node', 'true'); | ||
289 | } | ||
284 | //Initiliazing document model | 290 | //Initiliazing document model |
285 | document.application.njUtils.makeElementModel(this.model.documentRoot, "Body", "body"); | 291 | document.application.njUtils.makeElementModel(this.model.documentRoot, "Body", "body"); |
286 | //Makign callback if specified | 292 | //Makign callback if specified |