X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/c66ddb7dbe763b261c7dd4a037239a667f60cd95..2936591f2732b8c8f23c4edffc0f1a7b30d4bcf0:/modules/rng/rng.js?ds=inline 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); } }