From 2a66af7ee0ee2d9943f58db45417b78764a43483 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Thu, 13 Jun 2013 12:30:25 +0200 Subject: [PATCH 1/1] Refactoring --- modules/rng/rng.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/rng/rng.js b/modules/rng/rng.js index 9abe00c..43216bd 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); } } -- 2.20.1