X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/e6e83eed52400d6e8a6ee6339cbe212c8cac1f90..118b83d442f52feca33ba6568ef39df2092568b7:/modules/rng/rng.js diff --git a/modules/rng/rng.js b/modules/rng/rng.js index 3f89cd7..e3e97ed 100644 --- a/modules/rng/rng.js +++ b/modules/rng/rng.js @@ -30,16 +30,19 @@ return function(sandbox) { } if(tabIsDirty(slug)) { + var reason, doc; if(slug === 'sourceEditor') { - sandbox.getModule('data').commitDocument(sandbox.getModule('sourceEditor').getDocument(), 'source_edit'); + doc = sandbox.getModule('sourceEditor').getDocument(); + reason = 'source_edit'; } if(slug === 'editor') { var doc = dirty.documentCanvas ? sandbox.getModule('documentCanvas').getDocument() : sandbox.getModule('data').getDocument(); if(dirty.metadataEditor) { doc = sandbox.getModule('metadataEditor').attachMetadata(doc); } - sandbox.getModule('data').commitDocument(doc, 'edit'); + reason = 'edit'; } + sandbox.getModule('data').commitDocument(doc, reason); } } @@ -129,7 +132,10 @@ return function(sandbox) { }, savingEnded: function(status) { sandbox.getModule('mainBar').setCommandEnabled('save', true); - sandbox.getModule('indicator').clearMessage(); + sandbox.getModule('indicator').clearMessage({message:'Dokument zapisany'}); + }, + historyItemAdded: function(item) { + sandbox.getModule('documentHistory').addHistory([item], {animate: true}); } } @@ -248,7 +254,7 @@ return function(sandbox) { eventHandlers.documentHistory = { ready: function() { - sandbox.getModule('documentHistory').setHistory(sandbox.getModule('data').getHistory()); + sandbox.getModule('documentHistory').addHistory(sandbox.getModule('data').getHistory()); addMainTab('Historia', 'history', sandbox.getModule('documentHistory').getView()); } }