X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/072a91dee12e07caf91a693c29fd9f3be5ee177b..762797788fd3c0256a14b0f343410f40d34d4d8e:/modules/data.js diff --git a/modules/data.js b/modules/data.js index 8debbd3..36ba172 100644 --- a/modules/data.js +++ b/modules/data.js @@ -5,8 +5,7 @@ rng.modules.data = function(sandbox) { if(doc === '') { - doc = '\n\ - '; } @@ -52,10 +50,13 @@ rng.modules.data = function(sandbox) { sandbox.publish('documentChanged', doc, reason); }, saveDocument: function() { + sandbox.publish('savingStarted'); $.ajax({ method: 'post', - url: '/editor/' + document_id, - data: JSON.stringify({document:doc}) + url: '/' + gettext('editor') + '/' + document_id, + data: JSON.stringify({document:doc}), + success: function() {sandbox.publish('savingEnded', 'success');}, + error: function() {sandbox.publish('savingEnded', 'error');} }); }