diff options
Diffstat (limited to 'js/controllers')
-rwxr-xr-x | js/controllers/document-controller.js | 13 |
1 files changed, 11 insertions, 2 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 | }, |