+ views.mainLayout.setView('messages', sandbox.getModule('indicator').getView());\r
+ }\r
+ };\r
+ \r
+\r
+ \r
+ eventHandlers.documentCanvas = {\r
+ ready: function() {\r
+ sandbox.getModule('documentCanvas').setDocument(sandbox.getModule('data').getDocument());\r
+ views.visualEditing.setView('leftColumn', sandbox.getModule('documentCanvas').getView());\r
+ },\r
+ \r
+ nodeSelected: function(node) {\r
+ sandbox.getModule('nodePane').setNode(node);\r
+ sandbox.getModule('nodeFamilyTree').setNode(node);\r
+ sandbox.getModule('nodeBreadCrumbs').setNode(node);\r
+ },\r
+ \r
+ contentChanged: function() {\r
+ \r
+ },\r
+ \r
+ nodeHovered: function(node) {\r
+ sandbox.getModule('documentCanvas').highlightNode(node.attr('id'));\r
+ sandbox.getModule('nodeFamilyTree').highlightNode(node.attr('id'));\r
+ sandbox.getModule('nodeBreadCrumbs').highlightNode(node.attr('id'));\r
+ \r
+ },\r
+ \r
+ nodeBlured: function(node) {\r
+ sandbox.getModule('documentCanvas').dimNode(node.attr('id'));\r
+ sandbox.getModule('nodeFamilyTree').dimNode(node.attr('id'));\r
+ sandbox.getModule('nodeBreadCrumbs').dimNode(node.attr('id'));\r
+ }\r
+ };\r
+\r
+ eventHandlers.nodePane = {\r
+ ready: function() {\r
+ views.currentNodePaneLayout.appendView(sandbox.getModule('nodePane').getView());\r
+ },\r
+ \r
+ nodeChanged: function(attr, value) {\r
+ sandbox.getModule('documentCanvas').modifyCurrentNode(attr, value);\r
+ }\r
+ };\r
+ \r
+ eventHandlers.metadataEditor = {\r
+ ready: function() {\r
+ sandbox.getModule('metadataEditor').setMetadata(sandbox.getModule('data').getDocument());\r
+ views.visualEditingSidebar.addTab({icon: 'info-sign'}, 'metadataEditor', sandbox.getModule('metadataEditor').getView());\r
+ }\r
+ };\r
+ \r
+ eventHandlers.nodeFamilyTree = {\r
+ ready: function() {\r
+ views.currentNodePaneLayout.appendView(sandbox.getModule('nodeFamilyTree').getView());\r
+ },\r
+ nodeEntered: function(id) {\r
+ sandbox.getModule('documentCanvas').highlightNode(id);\r
+ },\r
+ nodeLeft: function(id) {\r
+ sandbox.getModule('documentCanvas').dimNode(id);\r
+ },\r
+ nodeSelected: function(id) {\r
+ sandbox.getModule('documentCanvas').selectNode(id);\r
+ }\r
+ };\r
+ \r
+ eventHandlers.documentToolbar = {\r
+ ready: function() {\r
+ views.visualEditing.setView('toolbar', sandbox.getModule('documentToolbar').getView());\r
+ },\r
+ toggleGrid: function(toggle) {\r
+ sandbox.getModule('documentCanvas').toggleGrid(toggle);\r
+ },\r
+ newNodeRequested: function(wlxmlTag, wlxmlClass) {\r
+ if(window.getSelection().isCollapsed) {\r
+ sandbox.getModule('documentCanvas').insertNewNode(wlxmlTag, wlxmlClass);\r
+ } else {\r
+ sandbox.getModule('documentCanvas').wrapSelectionWithNewNode(wlxmlTag, wlxmlClass);\r
+ }\r