aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/views/design.js20
1 files changed, 17 insertions, 3 deletions
diff --git a/js/document/views/design.js b/js/document/views/design.js
index 1a5b071e..325259ea 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -280,7 +280,10 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
280 //Removing loading container (should be removed) 280 //Removing loading container (should be removed)
281 this.document.body.removeChild(this.document.getElementsByTagName('ninjaloadinghack')[0]); 281 this.document.body.removeChild(this.document.getElementsByTagName('ninjaloadinghack')[0]);
282 //Getting style and link tags in document 282 //Getting style and link tags in document
283 var stags = this.document.getElementsByTagName('style'), 283 var htags = this.document.getElementsByTagName('html'),
284 btags = this.document.getElementsByTagName('body'),
285 userStyles,
286 stags = this.document.getElementsByTagName('style'),
284 ltags = this.document.getElementsByTagName('link'), i, orgNodes, 287 ltags = this.document.getElementsByTagName('link'), i, orgNodes,
285 scripttags = this.document.getElementsByTagName('script'); 288 scripttags = this.document.getElementsByTagName('script');
286 //Temporarily checking for disabled special case (we must enabled for Ninja to access styles) 289 //Temporarily checking for disabled special case (we must enabled for Ninja to access styles)
@@ -319,7 +322,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
319 //Else there is not data to parse 322 //Else there is not data to parse
320 if(this._viewCallback) { 323 if(this._viewCallback) {
321 this._viewCallback.viewCallback.call(this._viewCallback.context); 324 this._viewCallback.viewCallback.call(this._viewCallback.context);
322 } 325 }
323 } 326 }
324 //TODO: Verify appropiate location for this operation 327 //TODO: Verify appropiate location for this operation
325 if (this._template && this._template.type === 'banner') { 328 if (this._template && this._template.type === 'banner') {
@@ -335,7 +338,18 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
335 for (var n in orgNodes) { 338 for (var n in orgNodes) {
336 if (orgNodes[n].getAttribute) orgNodes[n].setAttribute('data-ninja-node', 'true'); 339 if (orgNodes[n].getAttribute) orgNodes[n].setAttribute('data-ninja-node', 'true');
337 } 340 }
338 341
342 // Save initial HTML and Body style attributes so we don't override them on save
343 if(htags.length) {
344 if(userStyles = htags[0].getAttribute('style')) {
345 htags[0].setAttribute('data-ninja-style', userStyles);
346 }
347 }
348 if(btags.length) {
349 if(userStyles = btags[0].getAttribute('style')) {
350 btags[0].setAttribute('data-ninja-style', userStyles);
351 }
352 }
339 //Makign callback if specified 353 //Makign callback if specified
340 if (this._callback) this._callback(); 354 if (this._callback) this._callback();
341 } 355 }