X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/0add3b13ce4ef42557d9ca33342a159b80a4f42f..051d2e8a2e6cebc453bb855eb7bd4ff5bf0d3451:/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(); } };