Visual editor: styling buttons in meta table
[fnpeditor.git] / modules / rng.js
index baa400d..4e0ca6e 100644 (file)
@@ -11,6 +11,18 @@ rng.modules.rng = function(sandbox) {
     eventHandlers.skelton = {\r
         ready: function() {\r
             sandbox.getModule('tabsManager').start();\r
+        },\r
+        'cmd.save': function() {\r
+            var editorSlugs = ['visual', 'source'];\r
+            var slug = sandbox.getModule('tabsManager').getCurrentSlug();\r
+            if(_.contains(editorSlugs, slug)) {\r
+                var editor = sandbox.getModule(slug+'Editor');\r
+                if(editor.isDirty()) {\r
+                    sandbox.getModule('data').commitDocument(editor.getDocument(), slug + '_edit');\r
+                    editor.setDirty(false);\r
+                }\r
+            }\r
+            sandbox.getModule('data').saveDocument();\r
         }\r
     };\r
     \r