aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/controllers/document-controller.js13
-rw-r--r--js/mediators/io-mediator.js5
2 files changed, 15 insertions, 3 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 21445214..84b994ce 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -104,9 +104,15 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
104 handleExecuteSave: { 104 handleExecuteSave: {
105 value: function(event) { 105 value: function(event) {
106 //Text and HTML document classes should return the same save object for fileSave 106 //Text and HTML document classes should return the same save object for fileSave
107 this.application.ninja.ioMediator.fileSave(this.activeDocument.save()); 107 this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.clearDocumentDirtyFlag.bind(this));
108 } 108 }
109 }, 109 },
110
111 clearDocumentDirtyFlag:{
112 value: function(){
113 this.activeDocument.dirtyFlag = false;
114 }
115 },
110 //////////////////////////////////////////////////////////////////// 116 ////////////////////////////////////////////////////////////////////
111 117
112 118
@@ -135,8 +141,11 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
135 openNewFileCallback:{ 141 openNewFileCallback:{
136 value:function(doc){ 142 value:function(doc){
137 var response = doc || null;//default just for testing 143 var response = doc || null;//default just for testing
138 if(!!response && response.success && !!response.uri){ 144 if(!!response && response.success && (response.status!== 500) && !!response.uri){
139 this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this)); 145 this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this));
146 }else if(!!response && !response.success){
147 //Todo: restrict directory path to the sandbox, in the dialog itself
148 alert("Unable to create file.\n [Error: Forbidden directory]");
140 } 149 }
141 } 150 }
142 }, 151 },
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index 47069cfb..95e775a0 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -154,7 +154,10 @@ exports.IoMediator = Montage.create(Component, {
154 break; 154 break;
155 } 155 }
156 // 156 //
157 save = this.fio.saveFile({uri: file.document.uri, contents: contents}) 157 save = this.fio.saveFile({uri: file.document.uri, contents: contents});
158 if(save.status === 204){
159 callback();
160 }
158 } 161 }
159 }, 162 },
160 //////////////////////////////////////////////////////////////////// 163 ////////////////////////////////////////////////////////////////////