X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/e8c45077de2d4ada496850fd77fa5035f07f8a4d..c986f6ebfd3d20bdc75ce00ee09bd2c716e0cb16:/modules/rng/rng.js diff --git a/modules/rng/rng.js b/modules/rng/rng.js index cd7122c..a1fe65e 100644 --- a/modules/rng/rng.js +++ b/modules/rng/rng.js @@ -96,7 +96,7 @@ return function(sandbox) { views.visualEditing.setView('rightColumn', views.visualEditingSidebar.getAsView()); addMainTab('Edytor', 'editor', views.visualEditing.getAsView()); - + addMainTab(gettext('Source'), 'sourceEditor', ''); addMainTab('Historia', 'history', views.diffLayout.getAsView()); sandbox.getDOM().append(views.mainLayout.getAsView()); @@ -147,7 +147,7 @@ return function(sandbox) { }, restoringStarted: function(event) { sandbox.getModule('mainBar').setCommandEnabled('save', false); - sandbox.getModule('indicator').showMessage(gettext('Restoring version ' + event.version + '...')); + sandbox.getModule('indicator').showMessage(gettext('Restoring version ') + event.version + '...'); }, historyItemAdded: function(item) { sandbox.getModule('documentHistory').addHistory([item], {animate: true}); @@ -158,12 +158,14 @@ return function(sandbox) { documentReverted: function(event) { commands.resetDocument(event.document, 'revert'); sandbox.getModule('mainBar').setCommandEnabled('save', true); - sandbox.getModule('indicator').clearMessage({message:'Wersja ' + event.version + ' przywrócona'}); + sandbox.getModule('indicator').clearMessage({message:'Wersja ' + event.reverted_version + ' przywrócona'}); + sandbox.getModule('mainBar').setVersion(event.current_version); } } eventHandlers.mainBar = { ready: function() { + sandbox.getModule('mainBar').setVersion(sandbox.getModule('data').getDocumentVersion()); views.mainLayout.setView('topPanel', sandbox.getModule('mainBar').getView()); }, 'cmd.save': function() { @@ -252,11 +254,10 @@ return function(sandbox) { sandbox.getModule('documentCanvas').toggleGrid(toggle); }, newNodeRequested: function(wlxmlTag, wlxmlClass) { - if(window.getSelection().isCollapsed) { sandbox.getModule('documentCanvas').insertNewNode(wlxmlTag, wlxmlClass); - } else { - sandbox.getModule('documentCanvas').wrapSelectionWithNewNode(wlxmlTag, wlxmlClass); - } + }, + command: function(cmd, meta) { + sandbox.getModule('documentCanvas').command(cmd, meta); } }; @@ -285,6 +286,9 @@ return function(sandbox) { }, restoreVersion: function(event) { sandbox.getModule('data').restoreVersion(event); + }, + displayVersion: function(event) { + window.open('/' + gettext('editor') + '/' + sandbox.getModule('data').getDocumentId() + '?version=' + event.version, _.uniqueId()); } }