X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/5d5c067b7e0d6523a16e73f79b0dc4b70ba6baa7..b58b8f498d9b5e70aec099829b97af2c4d72da10:/modules/rng/rng.js diff --git a/modules/rng/rng.js b/modules/rng/rng.js index fec264e..09e1b90 100644 --- a/modules/rng/rng.js +++ b/modules/rng/rng.js @@ -54,7 +54,7 @@ return function(sandbox) { ready: function() { views.mainLayout.setView('mainView', views.mainTabs.getAsView()); - _.each(['visualEditor', 'sourceEditor', 'documentCanvas', 'nodePane', 'metadataEditor', 'nodeFamilyTree', 'mainBar', 'indicator'], function(moduleName) { + _.each(['visualEditor', 'sourceEditor', 'documentCanvas', 'documentToolbar', 'nodePane', 'metadataEditor', 'nodeFamilyTree', 'mainBar', 'indicator'], function(moduleName) { sandbox.getModule(moduleName).start(); }); }, @@ -150,6 +150,22 @@ return function(sandbox) { nodeSelected: function(id) { sandbox.getModule('documentCanvas').selectNode(id); } + }; + + eventHandlers.documentToolbar = { + ready: function() { + views.visualEditing.setView('toolbar', sandbox.getModule('documentToolbar').getView()); + }, + toggleGrid: function(toggle) { + 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); + } + } } /* api */