aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-05-17 11:10:15 -0700
committerNivesh Rajbhandari2012-05-17 11:10:15 -0700
commit3d36ca3feb7a2cabd7d64335b2417637bd9aa906 (patch)
treeb89119d747de0c7333a8cbde4a7689c5fb102d5c /js/document
parent2ba4a6fab3b81b537521760ee5f95f1bc80027f9 (diff)
parent0e8ca026098e7abfaeb642643a21977490782922 (diff)
downloadninja-3d36ca3feb7a2cabd7d64335b2417637bd9aa906.tar.gz
Merge branch 'refs/heads/dom-architecture-master' into Dom-Architecture
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/document-html.js21
-rwxr-xr-xjs/document/html-document.js26
-rwxr-xr-xjs/document/models/base.js6
-rwxr-xr-xjs/document/models/html.js5
-rw-r--r--js/document/templates/html/main.js4
5 files changed, 29 insertions, 33 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js
index a26b74d5..56d9db02 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -134,14 +134,29 @@ exports.HtmlDocument = Montage.create(Component, {
134 }, 134 },
135 //////////////////////////////////////////////////////////////////// 135 ////////////////////////////////////////////////////////////////////
136 // 136 //
137 saveAppState: { 137 serializeDocument: {
138 value: function () { 138 value: function () {
139 //TODO: Import functionality 139 // There are not needed for now ssince we cannot change them
140 //this.gridHorizontalSpacing = this.application.ninja.stage.drawUtils.gridHorizontalSpacing;
141 //this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing;
142
143 // Serialize the current scroll position
144 // TODO: Implement
145
146 // Serialize the selection
147 this.model.selection = this.application.ninja.selectedElements.slice(0);
148 this.draw3DGrid = this.application.ninja.appModel.show3dGrid;
149
150 // Serialize the undo
151 // TODO: Save the montage undo queue
152
153 // Pause the videos
154 this.model.views.design.pauseVideos();
140 } 155 }
141 }, 156 },
142 //////////////////////////////////////////////////////////////////// 157 ////////////////////////////////////////////////////////////////////
143 // 158 //
144 restoreAppState: { 159 deserializeDocument: {
145 value: function () { 160 value: function () {
146 //TODO: Import functionality 161 //TODO: Import functionality
147 } 162 }
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 6a84abdf..68c2a9fb 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -920,32 +920,6 @@ exports.HTMLDocument = Montage.create(TextDocument, {
920 } 920 }
921 } 921 }
922 }, 922 },
923 ////////////////////////////////////////////////////////////////////
924 saveAppState:{
925 enumerable: false,
926 value: function () {
927
928 this.savedLeftScroll = this.application.ninja.stage._iframeContainer.scrollLeft;
929 this.savedTopScroll = this.application.ninja.stage._iframeContainer.scrollTop;
930
931 this.gridHorizontalSpacing = this.application.ninja.stage.drawUtils.gridHorizontalSpacing;
932 this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing;
933
934 if(typeof this.application.ninja.selectedElements !== 'undefined'){
935 this.selectionModel = this.application.ninja.selectedElements.slice(0);
936 }
937
938 this.draw3DGrid = this.application.ninja.appModel.show3dGrid;
939
940 //persist a clone of history per document
941 this.undoStack = this.application.ninja.undocontroller.undoQueue.slice(0);
942 this.redoStack = this.application.ninja.undocontroller.redoQueue.slice(0);
943 this.application.ninja.undocontroller.clearHistory();//clear history to give the next document a fresh start
944
945 //pause videos on switching or closing the document, so that the browser does not keep downloading the media data
946 this.pauseVideos();
947 }
948 },
949 923
950 //////////////////////////////////////////////////////////////////// 924 ////////////////////////////////////////////////////////////////////
951 restoreAppState:{ 925 restoreAppState:{
diff --git a/js/document/models/base.js b/js/document/models/base.js
index 033e16f6..649539ea 100755
--- a/js/document/models/base.js
+++ b/js/document/models/base.js
@@ -149,7 +149,8 @@ exports.BaseDocumentModel = Montage.create(Component, {
149 template: this.fileTemplate, 149 template: this.fileTemplate,
150 document: this.views.design.iframe.contentWindow.document, 150 document: this.views.design.iframe.contentWindow.document,
151 head: this.views.design.iframe.contentWindow.document.head, 151 head: this.views.design.iframe.contentWindow.document.head,
152 body: this.views.design.iframe.contentWindow.document.body 152 body: this.views.design.iframe.contentWindow.document.body,
153 mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator
153 }, callback.bind(this)); 154 }, callback.bind(this));
154 } else { 155 } else {
155 //TODO: Add logic to save code view data 156 //TODO: Add logic to save code view data
@@ -177,7 +178,8 @@ exports.BaseDocumentModel = Montage.create(Component, {
177 template: this.fileTemplate, 178 template: this.fileTemplate,
178 document: this.views.design.iframe.contentWindow.document, 179 document: this.views.design.iframe.contentWindow.document,
179 head: this.views.design.iframe.contentWindow.document.head, 180 head: this.views.design.iframe.contentWindow.document.head,
180 body: this.views.design.iframe.contentWindow.document.body 181 body: this.views.design.iframe.contentWindow.document.body,
182 mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator
181 }, callback.bind(this)); 183 }, callback.bind(this));
182 } else { 184 } else {
183 //TODO: Add logic to save code view data 185 //TODO: Add logic to save code view data
diff --git a/js/document/models/html.js b/js/document/models/html.js
index b57ff832..67457863 100755
--- a/js/document/models/html.js
+++ b/js/document/models/html.js
@@ -17,6 +17,11 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, {
17 hasTemplate: { 17 hasTemplate: {
18 value: false 18 value: false
19 }, 19 },
20 ////////////////////////////////////////////////////////////////////
21 //
22 selection: {
23 value: []
24 },
20 //////////////////////////////////////////////////////////////////// 25 ////////////////////////////////////////////////////////////////////
21 // 26 //
22 draw3DGrid: { 27 draw3DGrid: {
diff --git a/js/document/templates/html/main.js b/js/document/templates/html/main.js
index f45657bb..ffa3fab2 100644
--- a/js/document/templates/html/main.js
+++ b/js/document/templates/html/main.js
@@ -40,9 +40,9 @@ exports.Main = Montage.create(Component, {
40 40
41 }; 41 };
42 // 42 //
43 window.mjsTemplateCreator = TemplateCreator.create(); 43 window.mjsTemplateCreator = TemplateCreator;
44 // 44 //
45 window.mjsTemplate = Template.create(); 45 window.mjsTemplate = Template;
46 46
47 47
48 // Dispatch event when this template has loaded. 48 // Dispatch event when this template has loaded.