aboutsummaryrefslogtreecommitdiff
path: root/js/io
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-06 16:33:24 -0800
committerJose Antonio Marquez2012-02-06 16:33:24 -0800
commit989b433e8d11919b70845abc04f4e9359680aee3 (patch)
tree25eaa938e8418996f4efcb65e84342516610dee9 /js/io
parenta9e6f4aa38cbba79d903a7935fc2ccc701ff60b8 (diff)
parent729bc48212d7244539c99ca206be673eed011115 (diff)
downloadninja-989b433e8d11919b70845abc04f4e9359680aee3.tar.gz
Merge branch 'refs/heads/AnanyaFileIO' into FileIO
Diffstat (limited to 'js/io')
-rwxr-xr-xjs/io/document/document-controller.js19
-rwxr-xr-xjs/io/document/text-document.js1
2 files changed, 14 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 }
diff --git a/js/io/document/text-document.js b/js/io/document/text-document.js
index 683c513c..7db8e91a 100755
--- a/js/io/document/text-document.js
+++ b/js/io/document/text-document.js
@@ -100,6 +100,7 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base
100 var codemirrorDiv = this.textArea.parentNode.querySelector(".CodeMirror"); 100 var codemirrorDiv = this.textArea.parentNode.querySelector(".CodeMirror");
101 if(!!codemirrorDiv){codemirrorDiv.parentNode.removeChild(codemirrorDiv);} 101 if(!!codemirrorDiv){codemirrorDiv.parentNode.removeChild(codemirrorDiv);}
102 } 102 }
103 //console.log("$$$saved : "+this.uri+" : "+this.textArea.value);
103 //persist to filesystem 104 //persist to filesystem
104 } 105 }
105 } 106 }