aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/document-html.js2
-rwxr-xr-xjs/document/views/design.js29
2 files changed, 27 insertions, 4 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js
index 2375632c..157d7a0e 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -84,7 +84,7 @@ exports.HtmlDocument = Montage.create(Component, {
84 //Rendering design view, using observers to know when template is ready 84 //Rendering design view, using observers to know when template is ready
85 this.model.views.design.render(function () { 85 this.model.views.design.render(function () {
86 //TODO: Why is this needed? 86 //TODO: Why is this needed?
87 this._liveNodeList = this.model.documentRoot.getElementsByTagName('*'); 87 this.model.views.design._liveNodeList = this.documentRoot.getElementsByTagName('*');
88 //Adding observer to know when template is ready 88 //Adding observer to know when template is ready
89 this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this)); 89 this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this));
90 this._observer.observe(this.model.views.design.document.head, {childList: true}); 90 this._observer.observe(this.model.views.design.document.head, {childList: true});
diff --git a/js/document/views/design.js b/js/document/views/design.js
index d1c75c01..06708957 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
@@ -190,9 +216,6 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
190 this._bodyFragment = null; 216 this._bodyFragment = null;
191 //Calling standard method to finish opening document 217 //Calling standard method to finish opening document
192 this.bodyContentLoaded(null); 218 this.bodyContentLoaded(null);
193 //TODO: Move this to be set via the controller
194 this.application.ninja.stage.documentOffsetLeft = parseInt((this.document.body.scrollWidth - this._template.size.width)/2);
195 this.application.ninja.stage.documentOffsetTop = parseInt((this.document.body.scrollHeight - this._template.size.height)/2);
196 } 219 }
197 }, 220 },
198 //////////////////////////////////////////////////////////////////// 221 ////////////////////////////////////////////////////////////////////