diff options
Diffstat (limited to 'js/document/views')
-rwxr-xr-x | js/document/views/base.js | 2 | ||||
-rwxr-xr-x | js/document/views/design.js | 44 |
2 files changed, 40 insertions, 6 deletions
diff --git a/js/document/views/base.js b/js/document/views/base.js index db72cc60..d13dce1a 100755 --- a/js/document/views/base.js +++ b/js/document/views/base.js | |||
@@ -28,7 +28,7 @@ exports.BaseDocumentView = Montage.create(Component, { | |||
28 | value: null | 28 | value: null |
29 | }, | 29 | }, |
30 | //////////////////////////////////////////////////////////////////// | 30 | //////////////////////////////////////////////////////////////////// |
31 | // | 31 | //TODO: This should be renamed to better illustrate it's a container (iframe for design, div for code view) |
32 | iframe: { | 32 | iframe: { |
33 | get: function() {return this._iframe;}, | 33 | get: function() {return this._iframe;}, |
34 | set: function(value) {this._iframe= value;} | 34 | set: function(value) {this._iframe= value;} |
diff --git a/js/document/views/design.js b/js/document/views/design.js index b3887fdf..d772aa86 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js | |||
@@ -67,8 +67,34 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
67 | propertiesPanel: { | 67 | propertiesPanel: { |
68 | value: null | 68 | value: null |
69 | }, | 69 | }, |
70 | |||
70 | //////////////////////////////////////////////////////////////////// | 71 | //////////////////////////////////////////////////////////////////// |
71 | // | 72 | // |
73 | _liveNodeList: { | ||
74 | value: null | ||
75 | }, | ||
76 | |||
77 | getLiveNodeList: { | ||
78 | value: function(useFilter) { | ||
79 | if(useFilter) { | ||
80 | var filteredNodes = [], | ||
81 | childNodes = Array.prototype.slice.call(this._liveNodeList, 0); | ||
82 | |||
83 | childNodes.forEach(function(item) { | ||
84 | if( (item.nodeType === 1) && (item.nodeName !== "STYLE") && (item.nodeName !== "SCRIPT")) { | ||
85 | filteredNodes.push(item); | ||
86 | } | ||
87 | }); | ||
88 | return filteredNodes; | ||
89 | } else { | ||
90 | return Array.prototype.slice.call(this._liveNodeList, 0); | ||
91 | } | ||
92 | } | ||
93 | }, | ||
94 | //////////////////////////////////////////////////////////////////// | ||
95 | // | ||
96 | |||
97 | // | ||
72 | initialize: { | 98 | initialize: { |
73 | value: function (parent) { | 99 | value: function (parent) { |
74 | //Creating iFrame for view | 100 | //Creating iFrame for view |
@@ -87,7 +113,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
87 | render: { | 113 | render: { |
88 | value: function (callback, template) { | 114 | value: function (callback, template) { |
89 | //TODO: Remove, this is a temp patch for webRequest API gate | 115 | //TODO: Remove, this is a temp patch for webRequest API gate |
90 | this.application.ninja.documentController._hackRootFlag = false; | 116 | this.application.ninja.documentController.redirectRequests = false; |
91 | //Storing callback for dispatch ready | 117 | //Storing callback for dispatch ready |
92 | this._callback = callback; | 118 | this._callback = callback; |
93 | this._template = template; | 119 | this._template = template; |
@@ -105,7 +131,8 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
105 | // | 131 | // |
106 | onTemplateLoad: { | 132 | onTemplateLoad: { |
107 | value: function (e) { | 133 | value: function (e) { |
108 | this.application.ninja.documentController._hackRootFlag = true; | 134 | //console.log(this.iframe.contentWindow); |
135 | this.application.ninja.documentController.redirectRequests = true; | ||
109 | //TODO: Add support to constructing URL with a base HREF | 136 | //TODO: Add support to constructing URL with a base HREF |
110 | var basetag = this.content.document.getElementsByTagName('base'); | 137 | var basetag = this.content.document.getElementsByTagName('base'); |
111 | //Removing event | 138 | //Removing event |
@@ -189,9 +216,6 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
189 | this._bodyFragment = null; | 216 | this._bodyFragment = null; |
190 | //Calling standard method to finish opening document | 217 | //Calling standard method to finish opening document |
191 | this.bodyContentLoaded(null); | 218 | this.bodyContentLoaded(null); |
192 | //TODO: Move this to be set via the controller | ||
193 | this.application.ninja.stage.documentOffsetLeft = parseInt((this.document.body.scrollWidth - this._template.size.width)/2); | ||
194 | this.application.ninja.stage.documentOffsetTop = parseInt((this.document.body.scrollHeight - this._template.size.height)/2); | ||
195 | } | 219 | } |
196 | }, | 220 | }, |
197 | //////////////////////////////////////////////////////////////////// | 221 | //////////////////////////////////////////////////////////////////// |
@@ -256,6 +280,16 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
256 | } else { | 280 | } else { |
257 | //Else there is not data to parse | 281 | //Else there is not data to parse |
258 | } | 282 | } |
283 | //TODO: Verify appropiate location for this operation | ||
284 | if (this._template && this._template.type === 'banner') { | ||
285 | this.model.documentRoot = this.document.body.getElementsByTagName('ninja-content')[0]; | ||
286 | } else { | ||
287 | this.model.documentRoot = this.document.body; | ||
288 | } | ||
289 | //Storing node list for reference (might need to store in the model) | ||
290 | this._liveNodeList = this.model.documentRoot.getElementsByTagName('*'); | ||
291 | //Initiliazing document model | ||
292 | document.application.njUtils.makeElementModel(this.model.documentRoot, "Body", "body"); | ||
259 | //Makign callback if specified | 293 | //Makign callback if specified |
260 | if (this._callback) this._callback(); | 294 | if (this._callback) this._callback(); |
261 | } | 295 | } |