aboutsummaryrefslogtreecommitdiff
path: root/js/document/views
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-06-14 16:00:53 -0700
committerNivesh Rajbhandari2012-06-14 16:00:53 -0700
commit9185145b3ab37070c7f32befaec1ab38486745b3 (patch)
tree4651821120f04eb189b5f1ddc3e871a6c4856bcd /js/document/views
parent682f4917d6badd105998c3dd84d031c38b51f017 (diff)
downloadninja-9185145b3ab37070c7f32befaec1ab38486745b3.tar.gz
Save user's html and body styles and inline body styles for 3d so they don't get saved out with the document.
This still requires some changes by Jose. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/document/views')
-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 }