diff options
Diffstat (limited to 'js/io/document/document-controller.js')
-rwxr-xr-x | js/io/document/document-controller.js | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/js/io/document/document-controller.js b/js/io/document/document-controller.js index 51575a24..1a5d6058 100755 --- a/js/io/document/document-controller.js +++ b/js/io/document/document-controller.js | |||
@@ -72,6 +72,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
72 | this.eventManager.addEventListener("appLoaded", this, false); | 72 | this.eventManager.addEventListener("appLoaded", this, false); |
73 | this.eventManager.addEventListener("executeFileOpen", this, false); | 73 | this.eventManager.addEventListener("executeFileOpen", this, false); |
74 | this.eventManager.addEventListener("executeNewFile", this, false); | 74 | this.eventManager.addEventListener("executeNewFile", this, false); |
75 | this.eventManager.addEventListener("executeSave", this, false); | ||
75 | } | 76 | } |
76 | }, | 77 | }, |
77 | 78 | ||
@@ -87,8 +88,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
87 | pickerSettings.callback = this.openFileWithURI; | 88 | pickerSettings.callback = this.openFileWithURI; |
88 | pickerSettings.callbackScope = this; | 89 | pickerSettings.callbackScope = this; |
89 | this.application.ninja.filePickerController.showFilePicker(pickerSettings); | 90 | this.application.ninja.filePickerController.showFilePicker(pickerSettings); |
90 | |||
91 | //this.openDocument({"type": "js", "source": this.tmpSourceForTesting}); | ||
92 | } | 91 | } |
93 | }, | 92 | }, |
94 | 93 | ||
@@ -101,6 +100,12 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
101 | } | 100 | } |
102 | }, | 101 | }, |
103 | 102 | ||
103 | handleExecuteSave: { | ||
104 | value: function(event) { | ||
105 | this.activeDocument.save(); | ||
106 | } | ||
107 | }, | ||
108 | |||
104 | createNewFile:{ | 109 | createNewFile:{ |
105 | value:function(newFileObj){ | 110 | value:function(newFileObj){ |
106 | //console.log(newFileObj);//contains the template uri and the new file uri | 111 | //console.log(newFileObj);//contains the template uri and the new file uri |
@@ -240,7 +245,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
240 | 245 | ||
241 | //if file dirty then save | 246 | //if file dirty then save |
242 | if(this.activeDocument.dirtyFlag === true){ | 247 | if(this.activeDocument.dirtyFlag === true){ |
243 | this.activeDocument.save(true); | 248 | this.activeDocument.save(true /*remove the codemirror div after saving*/); |
244 | this.activeDocument.dirtyFlag=false; | 249 | this.activeDocument.dirtyFlag=false; |
245 | } | 250 | } |
246 | 251 | ||
@@ -382,12 +387,13 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
382 | _hideCurrentDocument: { | 387 | _hideCurrentDocument: { |
383 | value: function() { | 388 | value: function() { |
384 | if(this.activeDocument) { | 389 | if(this.activeDocument) { |
385 | this.activeDocument.container.style["display"] = "none"; | 390 | if(this.activeDocument.currentView === "design"){ |
386 | if(this.activeDocument.currentView === "design" || this.activeDocument.currentView === "design"){ | 391 | this.application.ninja.stage.saveStageScroll(); |
387 | this.activeDocument.container.parentNode.style["display"] = "none"; | 392 | this.activeDocument.container.parentNode.style["display"] = "none"; |
388 | this.application.ninja.stage.hideCanvas(true); | 393 | this.application.ninja.stage.hideCanvas(true); |
389 | this.application.ninja.stage.stageView.hideRulers(); | 394 | this.application.ninja.stage.stageView.hideRulers(); |
390 | } | 395 | } |
396 | this.activeDocument.container.style["display"] = "none"; | ||
391 | } | 397 | } |
392 | } | 398 | } |
393 | }, | 399 | }, |
@@ -396,8 +402,9 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
396 | value: function() { | 402 | value: function() { |
397 | if(this.activeDocument) { | 403 | if(this.activeDocument) { |
398 | this.activeDocument.container.style["display"] = "block"; | 404 | this.activeDocument.container.style["display"] = "block"; |
399 | if(this.activeDocument.currentView === "design" || this.activeDocument.currentView === "design"){ | 405 | if(this.activeDocument.currentView === "design"){ |
400 | this.activeDocument.container.parentNode.style["display"] = "block"; | 406 | this.activeDocument.container.parentNode.style["display"] = "block"; |
407 | this.application.ninja.stage.applySavedScroll(); | ||
401 | this.application.ninja.stage.hideCanvas(false); | 408 | this.application.ninja.stage.hideCanvas(false); |
402 | this.application.ninja.stage.stageView.showRulers(); | 409 | this.application.ninja.stage.stageView.showRulers(); |
403 | } | 410 | } |