From: Aleksander Ɓukasz Date: Wed, 12 Jun 2013 15:03:07 +0000 (+0200) Subject: Refactoring X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/9d74ca302ea182d336853aa2578cc455c32556be Refactoring --- diff --git a/modules/rng/rng.js b/modules/rng/rng.js index deda771..992d601 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');