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
editor.setDirty(false);\r
}\r
}\r
+ },\r
+ showed: function(slug) {\r
+ if(slug === 'visual')\r
+ sandbox.getModule('visualEditor').onShowed();\r
}\r
};\r
\r
eventHandlers.sourceEditor = {\r
ready: function() {\r
- addTab('Source', 'source', sandbox.getModule('sourceEditor').getView());\r
+ addTab(gettext('Source'), 'source', sandbox.getModule('sourceEditor').getView());\r
sandbox.getModule('sourceEditor').setDocument(sandbox.getModule('data').getDocument());\r
}\r
};\r
\r
eventHandlers.visualEditor = {\r
ready: function() {\r
- addTab('Visual', 'visual', sandbox.getModule('visualEditor').getView());\r
sandbox.getModule('visualEditor').setDocument(sandbox.getModule('data').getDocument());\r
+ addTab(gettext('Visual'), 'visual', sandbox.getModule('visualEditor').getView());\r
+ \r
}\r
};\r
\r
documentChanged: function(document, reason) {\r
var slug = (reason === 'visual_edit' ? 'source' : 'visual');\r
sandbox.getModule(slug+'Editor').setDocument(document);\r
+ },\r
+ savingStarted: function() {\r
+ sandbox.getModule('skelton').deactivateCommand('save');\r
+ sandbox.getModule('skelton').showMessage(gettext('Saving...'));\r
+ },\r
+ savingEnded: function(status) {\r
+ sandbox.getModule('skelton').activateCommand('save');\r
+ sandbox.getModule('skelton').clearMessage();\r
}\r
}\r
\r