aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/document-html.js31
-rwxr-xr-xjs/document/html-document.js78
-rwxr-xr-xjs/document/models/base.js20
-rwxr-xr-xjs/document/models/html.js17
-rw-r--r--js/document/templates/app/main.js (renamed from js/document/templates/html/main.js)4
-rwxr-xr-xjs/document/templates/app/package.json (renamed from js/document/templates/html/package.json)0
-rwxr-xr-xjs/document/templates/banner/index.html2
-rw-r--r--js/document/templates/banner/main.js49
-rwxr-xr-xjs/document/templates/banner/package.json9
-rwxr-xr-xjs/document/templates/html/index.html2
-rwxr-xr-xjs/document/templates/montage-html/package.json9
-rwxr-xr-xjs/document/views/design.js34
12 files changed, 89 insertions, 166 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js
index 56d9db02..983da966 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -119,8 +119,6 @@ exports.HtmlDocument = Montage.create(Component, {
119 this._observer = null; 119 this._observer = null;
120 //Making callback after view is loaded 120 //Making callback after view is loaded
121 this.loaded.callback.call(this.loaded.context, this); 121 this.loaded.callback.call(this.loaded.context, this);
122 //Setting opacity to be viewable after load
123 this.model.views.design.iframe.style.opacity = 1;
124 } 122 }
125 }, 123 },
126 //////////////////////////////////////////////////////////////////// 124 ////////////////////////////////////////////////////////////////////
@@ -136,12 +134,16 @@ exports.HtmlDocument = Montage.create(Component, {
136 // 134 //
137 serializeDocument: { 135 serializeDocument: {
138 value: function () { 136 value: function () {
139 // There are not needed for now ssince we cannot change them 137 // There are not needed for now since we cannot change them
140 //this.gridHorizontalSpacing = this.application.ninja.stage.drawUtils.gridHorizontalSpacing; 138 //this.gridHorizontalSpacing = this.application.ninja.stage.drawUtils.gridHorizontalSpacing;
141 //this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing; 139 //this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing;
142 140
143 // Serialize the current scroll position 141 // Serialize the current scroll position
144 // TODO: Implement 142 this.model.scrollLeft = this.application.ninja.stage._scrollLeft;
143 this.model.scrollTop = this.application.ninja.stage._scrollTop;
144 this.model.userContentLeft = this.application.ninja.stage._userContentLeft;
145 this.model.userContentTop = this.application.ninja.stage._userContentTop;
146
145 147
146 // Serialize the selection 148 // Serialize the selection
147 this.model.selection = this.application.ninja.selectedElements.slice(0); 149 this.model.selection = this.application.ninja.selectedElements.slice(0);
@@ -152,13 +154,32 @@ exports.HtmlDocument = Montage.create(Component, {
152 154
153 // Pause the videos 155 // Pause the videos
154 this.model.views.design.pauseVideos(); 156 this.model.views.design.pauseVideos();
157
158 this.model.isActive = false;
155 } 159 }
156 }, 160 },
157 //////////////////////////////////////////////////////////////////// 161 ////////////////////////////////////////////////////////////////////
158 // 162 //
159 deserializeDocument: { 163 deserializeDocument: {
160 value: function () { 164 value: function () {
161 //TODO: Import functionality 165 // There are not needed for now since we cannot change them
166 //this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing;
167 //this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing;
168
169 // Deserialize the current scroll position
170 this.application.ninja.stage._scrollLeft = this.model.scrollLeft;
171 this.application.ninja.stage._scrollTop = this.model.scrollTop;
172 this.application.ninja.stage._userContentLeft = this.model.userContentLeft;
173 this.application.ninja.stage._userContentTop = this.model.userContentTop;
174
175 this.application.ninja.selectedElements = this.model.selection.slice(0);
176
177 this.application.ninja.appModel.show3dGrid = this.draw3DGrid;
178
179 // Serialize the undo
180 // TODO: Save the montage undo queue
181
182 this.model.isActive = true;
162 } 183 }
163 } 184 }
164 //////////////////////////////////////////////////////////////////// 185 ////////////////////////////////////////////////////////////////////
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 68c2a9fb..bcf2b5c2 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -454,55 +454,6 @@ exports.HTMLDocument = Montage.create(TextDocument, {
454 } 454 }
455 }, 455 },
456 456
457 /**
458 * Return the specified inline attribute from the element.
459 */
460 GetElementAttribute: {
461 value: function(element, attribute) {
462
463 var value;
464
465 if(attribute === "src") {
466 return element[attribute].replace(window.location.href, '');
467 }
468
469 value = element[attribute];
470
471 if(value !== undefined) return value;
472// if(value || value === false) return [value, "inline"];
473
474 // 3.
475 //value = this._document.defaultView.getComputedStyle(element,null).getPropertyValue(attribute);
476 //if(value) return value;
477
478 return null;
479 }
480 },
481
482 GetElementStyle: {
483 value: function(element, style) {
484// return this._queryStylesheets(element, style);
485 }
486 },
487
488 SetStyle: {
489 value: function(type, selector, style, value) {
490 try {
491 for(var j=0; j<this._stylesheets.length;j++){
492 for(var i=0; i<this._stylesheets[j].cssRules.length;i++) {
493 if(this._stylesheets[j].cssRules[i].selectorText === type + selector) {
494 this._stylesheets[j].cssRules[i].style[style] = value;
495
496 return true;
497 }
498 }
499 }
500 } catch(err) {
501 console.log("Cannot change the style of selector: " + selector + " " + err);
502 }
503 }
504 },
505
506 GetElementFromPoint: { 457 GetElementFromPoint: {
507 value: function(x, y) { 458 value: function(x, y) {
508 return this._window.getElement(x,y); 459 return this._window.getElement(x,y);
@@ -919,32 +870,5 @@ exports.HTMLDocument = Montage.create(TextDocument, {
919 //Error 870 //Error
920 } 871 }
921 } 872 }
922 }, 873 }
923
924 ////////////////////////////////////////////////////////////////////
925 restoreAppState:{
926 enumerable: false,
927 value: function () {
928 this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing;
929 this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing;
930
931 if((this.savedLeftScroll !== null) && (this.savedTopScroll !== null)){
932 this.application.ninja.stage._iframeContainer.scrollLeft = this.savedLeftScroll;
933 this.application.ninja.stage._iframeContainer.scrollTop = this.savedTopScroll;
934 this.application.ninja.stage.handleScroll();
935 }
936
937 this.application.ninja.currentSelectedContainer = this.documentRoot;
938 if(this.selectionModel){
939 this.application.ninja.selectedElements = this.selectionModel.slice(0);
940 }
941
942 this.application.ninja.appModel.show3dGrid = this.draw3DGrid;
943
944 this.application.ninja.undocontroller.undoQueue = this.undoStack.slice(0);
945 this.application.ninja.undocontroller.redoQueue = this.redoStack.slice(0);
946
947
948 }
949 }
950}); \ No newline at end of file 874}); \ No newline at end of file
diff --git a/js/document/models/base.js b/js/document/models/base.js
index 649539ea..c99e36c7 100755
--- a/js/document/models/base.js
+++ b/js/document/models/base.js
@@ -30,7 +30,7 @@ exports.BaseDocumentModel = Montage.create(Component, {
30 //////////////////////////////////////////////////////////////////// 30 ////////////////////////////////////////////////////////////////////
31 // 31 //
32 _isActive: { 32 _isActive: {
33 value: null 33 value: true
34 }, 34 },
35 //////////////////////////////////////////////////////////////////// 35 ////////////////////////////////////////////////////////////////////
36 // 36 //
@@ -151,7 +151,7 @@ exports.BaseDocumentModel = Montage.create(Component, {
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 mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator
154 }, callback.bind(this)); 154 }, this.handleSaved.bind({callback: callback, model: this}));
155 } else { 155 } else {
156 //TODO: Add logic to save code view data 156 //TODO: Add logic to save code view data
157 } 157 }
@@ -180,7 +180,7 @@ exports.BaseDocumentModel = Montage.create(Component, {
180 head: this.views.design.iframe.contentWindow.document.head, 180 head: this.views.design.iframe.contentWindow.document.head,
181 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 182 mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator
183 }, callback.bind(this)); 183 }, this.handleSaved.bind({callback: callback, model: this}));
184 } else { 184 } else {
185 //TODO: Add logic to save code view data 185 //TODO: Add logic to save code view data
186 } 186 }
@@ -190,7 +190,7 @@ exports.BaseDocumentModel = Montage.create(Component, {
190 //////////////////////////////////////////////////////////////////// 190 ////////////////////////////////////////////////////////////////////
191 // 191 //
192 saveAs: { 192 saveAs: {
193 value: function () { 193 value: function (callback) {
194 // 194 //
195 if (this.needsSave) {