diff options
author | Valerio Virgillito | 2012-05-09 23:30:33 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-09 23:30:33 -0700 |
commit | 25e50eed8afbf86606ec5614194dc34f154feecb (patch) | |
tree | b3826880c843435cdaf2d8981400909127466313 | |
parent | 2e9a6b271439d934439514f6386424567853f93c (diff) | |
parent | 454ba956b0d6f48d37a5ad3f50eb00aaaaa7271b (diff) | |
download | ninja-25e50eed8afbf86606ec5614194dc34f154feecb.tar.gz |
Merge pull request #208 from mqg734/Dom-Architecture
Adding support to save body's css styles on preview.
-rwxr-xr-x | js/controllers/document-controller.js | 33 | ||||
-rwxr-xr-x | js/io/templates/files/html.txt | 4 |
2 files changed, 33 insertions, 4 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 17ae8cc3..682bd6a6 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -498,6 +498,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
498 | 498 | ||
499 | this.webTemplate = false; | 499 | this.webTemplate = false; |
500 | 500 | ||
501 | this._initializeBodyStyles(); | ||
501 | NJevent("onOpenDocument", doc); | 502 | NJevent("onOpenDocument", doc); |
502 | 503 | ||
503 | this.application.ninja.stage.stageView.showCodeViewBar(false); | 504 | this.application.ninja.stage.stageView.showCodeViewBar(false); |
@@ -645,5 +646,37 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
645 | value:function(){ | 646 | value:function(){ |
646 | this.activeDocument.needsSave = true; | 647 | this.activeDocument.needsSave = true; |
647 | } | 648 | } |
649 | }, | ||
650 | |||
651 | _initializeBodyStyles: { | ||
652 | value: function() { | ||
653 | var sc = this.application.ninja.stylesController, | ||
654 | docRoot = this.application.ninja.currentDocument.documentRoot, | ||
655 | styles = {}, | ||
656 | needsRule = false, | ||
657 | rule; | ||
658 | |||
659 | if(sc.getElementStyle(docRoot, "width", false, false) == null) { | ||
660 | styles['width'] = '100%'; | ||
661 | needsRule = true; | ||
662 | } | ||
663 | if(sc.getElementStyle(docRoot, "height", false, false) == null) { | ||
664 | styles['height'] = '100%'; | ||
665 | needsRule = true; | ||
666 | } | ||
667 | if(sc.getElementStyle(docRoot, "-webkit-transform", false, false) == null) { | ||
668 | styles['-webkit-transform'] = 'perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)'; | ||
669 | needsRule = true; | ||
670 | } | ||
671 | if(sc.getElementStyle(docRoot, "-webkit-transform-style", false, false) == null) { | ||
672 | styles['-webkit-transform-style'] = 'preserve-3d'; | ||
673 | needsRule = true; | ||
674 | } | ||
675 | |||
676 | if(needsRule) { | ||
677 | rule = sc.addRule('body{}'); | ||
678 | sc.setStyles(rule, styles); | ||
679 | } | ||
680 | } | ||
648 | } | 681 | } |
649 | }); | 682 | }); |
diff --git a/js/io/templates/files/html.txt b/js/io/templates/files/html.txt index 5a9010cf..3449ae39 100755 --- a/js/io/templates/files/html.txt +++ b/js/io/templates/files/html.txt | |||
@@ -10,10 +10,6 @@ | |||
10 | <meta name="generator" content="Motorola Mobility Ninja"> | 10 | <meta name="generator" content="Motorola Mobility Ninja"> |
11 | 11 | ||
12 | <style type="text/css"> | 12 | <style type="text/css"> |
13 | html, body { | ||
14 | width: 100%; | ||
15 | height: 100%; | ||
16 | } | ||
17 | </style> | 13 | </style> |
18 | 14 | ||
19 | </head> | 15 | </head> |