X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/0add3b13ce4ef42557d9ca33342a159b80a4f42f..70fd8f6118a3e8bf298dd9c48c310f3309b780c3:/modules/rng.js?ds=inline diff --git a/modules/rng.js b/modules/rng.js index baa400d..4e0ca6e 100644 --- a/modules/rng.js +++ b/modules/rng.js @@ -11,6 +11,18 @@ rng.modules.rng = function(sandbox) { eventHandlers.skelton = { ready: function() { sandbox.getModule('tabsManager').start(); + }, + 'cmd.save': function() { + var editorSlugs = ['visual', 'source']; + var slug = sandbox.getModule('tabsManager').getCurrentSlug(); + if(_.contains(editorSlugs, slug)) { + var editor = sandbox.getModule(slug+'Editor'); + if(editor.isDirty()) { + sandbox.getModule('data').commitDocument(editor.getDocument(), slug + '_edit'); + editor.setDirty(false); + } + } + sandbox.getModule('data').saveDocument(); } };