X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/1aba836313d1513bbe0ca947e01176806c900233..93ea4b37138c4f617a9f8caa75485821d5df4041:/modules/rng.js?ds=sidebyside diff --git a/modules/rng.js b/modules/rng.js index 4e0ca6e..ffb228d 100644 --- a/modules/rng.js +++ b/modules/rng.js @@ -1,4 +1,6 @@ -rng.modules.rng = function(sandbox) { +define(function() { + +return function(sandbox) { function addTab(title, slug, view) { sandbox.getModule('tabsManager').addTab(title, slug, view); @@ -41,20 +43,25 @@ rng.modules.rng = function(sandbox) { editor.setDirty(false); } } + }, + showed: function(slug) { + if(slug === 'visual') + sandbox.getModule('visualEditor').onShowed(); } }; eventHandlers.sourceEditor = { ready: function() { - addTab('Source', 'source', sandbox.getModule('sourceEditor').getView()); + addTab(gettext('Source'), 'source', sandbox.getModule('sourceEditor').getView()); sandbox.getModule('sourceEditor').setDocument(sandbox.getModule('data').getDocument()); } }; eventHandlers.visualEditor = { ready: function() { - addTab('Visual', 'visual', sandbox.getModule('visualEditor').getView()); sandbox.getModule('visualEditor').setDocument(sandbox.getModule('data').getDocument()); + addTab(gettext('Visual'), 'visual', sandbox.getModule('visualEditor').getView()); + } }; @@ -65,6 +72,14 @@ rng.modules.rng = function(sandbox) { documentChanged: function(document, reason) { var slug = (reason === 'visual_edit' ? 'source' : 'visual'); sandbox.getModule(slug+'Editor').setDocument(document); + }, + savingStarted: function() { + sandbox.getModule('skelton').deactivateCommand('save'); + sandbox.getModule('skelton').showMessage(gettext('Saving...')); + }, + savingEnded: function(status) { + sandbox.getModule('skelton').activateCommand('save'); + sandbox.getModule('skelton').clearMessage(); } } @@ -81,4 +96,6 @@ rng.modules.rng = function(sandbox) { } } } -}; \ No newline at end of file +}; + +}); \ No newline at end of file