X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/d8017ad81ac2b41c7d960fa1dd5b937a61023a34..f372f2a7ad1cf8d0c9320559d406a1df4ea53a12:/modules/rng/rng.js diff --git a/modules/rng/rng.js b/modules/rng/rng.js index fec264e..a48535c 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(); }); }, @@ -112,11 +112,11 @@ return function(sandbox) { }, nodeHovered: function(node) { - + sandbox.getModule('nodeFamilyTree').highlightNode(node.attr('id')); }, nodeBlured: function(node) { - + sandbox.getModule('nodeFamilyTree').dimNode(node.attr('id')); } }; @@ -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 */