W.I.P. collab editor:

- Fix "save and close" does not close the window after save operation
This commit is contained in:
Hadi Nategh 2016-08-25 16:58:19 +02:00
parent da6d35df7d
commit c68be51583

View File

@ -172,8 +172,9 @@ app.classes.filemanager = app.classes.filemanager.extend({
switch (_btn) switch (_btn)
{ {
case 'save': case 'save':
self.editor_save({id:'save'}); self.editor_save({id:'save'}, function(){
leave(); leave();
});
break; break;
case 'leave': case 'leave':
leave(); leave();
@ -247,10 +248,11 @@ app.classes.filemanager = app.classes.filemanager.extend({
* *
* @param {object} _egwAction egw action object * @param {object} _egwAction egw action object
*/ */
editor_save: function (_egwAction) { editor_save: function (_egwAction, _afterSaveCallback) {
var self = this, var self = this,
widgetFilePath = this.et2.getWidgetById('file_path'), widgetFilePath = this.et2.getWidgetById('file_path'),
file_path = widgetFilePath.value; file_path = widgetFilePath.value,
afterSaveCallback = _afterSaveCallback || function(){};
if (this.editor) if (this.editor)
@ -270,7 +272,9 @@ app.classes.filemanager = app.classes.filemanager.extend({
success: function(data) { success: function(data) {
egw(window).message(egw.lang('Document %1 successfully has been saved.', file_path)); egw(window).message(egw.lang('Document %1 successfully has been saved.', file_path));
self.editor.setDocumentModified(false); self.editor.setDocumentModified(false);
egw.json('filemanager.filemanager_collab.ajax_actions',[{'es_id':self.collab_server.es_id, 'file_path': egw.webserverUrl+'/webdav.php'+file_path}, 'save']).sendRequest(); egw.json('filemanager.filemanager_collab.ajax_actions',[{'es_id':self.collab_server.es_id, 'file_path': egw.webserverUrl+'/webdav.php'+file_path}, 'save'], function(){
afterSaveCallback.call(self,{});
}).sendRequest();
}, },
error: function () {}, error: function () {},
data: blob, data: blob,
@ -409,6 +413,7 @@ app.classes.filemanager = app.classes.filemanager.extend({
} }
else if (_btn == 'reload') else if (_btn == 'reload')
{ {
self.collab_server.close = true;
window.location.reload(); window.location.reload();
} }
}, },