aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Marquez Russo2012-06-14 16:09:44 -0700
committerJose Antonio Marquez Russo2012-06-14 16:09:44 -0700
commitaacfa86521c7d1c7159f1da1fad5bb2c638cc811 (patch)
tree4651821120f04eb189b5f1ddc3e871a6c4856bcd
parent682f4917d6badd105998c3dd84d031c38b51f017 (diff)
parent9185145b3ab37070c7f32befaec1ab38486745b3 (diff)
downloadninja-aacfa86521c7d1c7159f1da1fad5bb2c638cc811.tar.gz
Merge pull request #36 from mqg734/FileIO_Jose
Save user's html and body styles and inline body styles for 3d so they don't get saved out with the document.
-rwxr-xr-xjs/controllers/elements/body-controller.js3
-rwxr-xr-xjs/document/views/design.js20
2 files changed, 19 insertions, 4 deletions
diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js
index 27989c65..0ca6c417 100755
--- a/js/controllers/elements/body-controller.js
+++ b/js/controllers/elements/body-controller.js
@@ -13,7 +13,8 @@ exports.BodyController = Montage.create(ElementController, {
13 set3DProperties: { 13 set3DProperties: {
14 value: function(el, props, update3DModel) { 14 value: function(el, props, update3DModel) {
15 var dist = props["dist"], mat = props["mat"]; 15 var dist = props["dist"], mat = props["mat"];
16 this.application.ninja.stylesController.setElementStyle(el, "-webkit-transform", "perspective(" + dist + ") " + "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")"); 16// this.application.ninja.stylesController.setElementStyle(el, "-webkit-transform", "perspective(" + dist + ") " + "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")");
17 el.style["-webkit-transform"] = "perspective(" + dist + ") " + "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")";
17 18
18 el.elementModel.props3D.matrix3d = mat; 19 el.elementModel.props3D.matrix3d = mat;
19 el.elementModel.props3D.perspectiveDist = dist; 20 el.elementModel.props3D.perspectiveDist = dist;
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 }