X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/95f83648504b6552ff3cbf956f55c6bf5f542a9b..e6e83eed52400d6e8a6ee6339cbe212c8cac1f90:/modules/rng/rng.js diff --git a/modules/rng/rng.js b/modules/rng/rng.js index deda771..3f89cd7 100644 --- a/modules/rng/rng.js +++ b/modules/rng/rng.js @@ -14,14 +14,6 @@ return function(sandbox) { views.mainTabs.addTab(title, slug, view); } - function tabIsDirty(slug) { - if(slug === 'editor' && (dirty.documentCanvas || dirty.metadataEditor)) - return true; - if(slug === 'sourceEditor' && dirty.sourceEditor) - return true; - return false; - } - var dirty = { sourceEditor: false, documentCanvas: false, @@ -29,6 +21,14 @@ return function(sandbox) { }; var synchronizeTab = function(slug) { + function tabIsDirty(slug) { + if(slug === 'editor' && (dirty.documentCanvas || dirty.metadataEditor)) + return true; + if(slug === 'sourceEditor' && dirty.sourceEditor) + return true; + return false; + } + if(tabIsDirty(slug)) { if(slug === 'sourceEditor') { sandbox.getModule('data').commitDocument(sandbox.getModule('sourceEditor').getDocument(), 'source_edit'); @@ -108,7 +108,7 @@ return function(sandbox) { ready: function() { views.mainLayout.setView('mainView', views.mainTabs.getAsView()); - _.each(['sourceEditor', 'documentCanvas', 'documentToolbar', 'nodePane', 'metadataEditor', 'nodeFamilyTree', 'nodeBreadCrumbs', 'mainBar', 'indicator'], function(moduleName) { + _.each(['sourceEditor', 'documentCanvas', 'documentToolbar', 'nodePane', 'metadataEditor', 'nodeFamilyTree', 'nodeBreadCrumbs', 'mainBar', 'indicator', 'documentHistory'], function(moduleName) { sandbox.getModule(moduleName).start(); }); }, @@ -246,6 +246,13 @@ return function(sandbox) { } } + eventHandlers.documentHistory = { + ready: function() { + sandbox.getModule('documentHistory').setHistory(sandbox.getModule('data').getHistory()); + addMainTab('Historia', 'history', sandbox.getModule('documentHistory').getView()); + } + } + /* api */ return {