From c68be5158318f842788e5a641add8cc56d00f3e6 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 25 Aug 2016 16:58:19 +0200 Subject: [PATCH] W.I.P. collab editor: - Fix "save and close" does not close the window after save operation --- filemanager/js/collab.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/filemanager/js/collab.js b/filemanager/js/collab.js index 6ed8fa93bc..3bb77e6db6 100644 --- a/filemanager/js/collab.js +++ b/filemanager/js/collab.js @@ -172,8 +172,9 @@ app.classes.filemanager = app.classes.filemanager.extend({ switch (_btn) { case 'save': - self.editor_save({id:'save'}); - leave(); + self.editor_save({id:'save'}, function(){ + leave(); + }); break; case 'leave': leave(); @@ -247,10 +248,11 @@ app.classes.filemanager = app.classes.filemanager.extend({ * * @param {object} _egwAction egw action object */ - editor_save: function (_egwAction) { + editor_save: function (_egwAction, _afterSaveCallback) { var self = this, widgetFilePath = this.et2.getWidgetById('file_path'), - file_path = widgetFilePath.value; + file_path = widgetFilePath.value, + afterSaveCallback = _afterSaveCallback || function(){}; if (this.editor) @@ -270,7 +272,9 @@ app.classes.filemanager = app.classes.filemanager.extend({ success: function(data) { egw(window).message(egw.lang('Document %1 successfully has been saved.', file_path)); 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 () {}, data: blob, @@ -409,6 +413,7 @@ app.classes.filemanager = app.classes.filemanager.extend({ } else if (_btn == 'reload') { + self.collab_server.close = true; window.location.reload(); } },